implemented Delete action in file menu

remotes/origin/stable
Arthur Schiwon 14 years ago
parent 573d36a168
commit 03747a0ffb
  1. 39
      files/js/files.js
  2. 2
      files/templates/index.php

@ -39,6 +39,19 @@ $(document).ready(function() {
$('.browser input:checkbox').attr('checked', false);
});
// Delete current file
$('#delete_single_file').click(function() {
filename = $('#file_menu').parents('tr:first').find('.filename:first').children('a:first').text();
$.ajax({
url: 'ajax/delete.php',
data: "dir="+$('#dir').val()+"&file="+filename,
complete: function(data){
boolOperationFinished(data, true, $('#file_menu').parents('tr:first'));
}
});
return false;
});
$('#file_upload_start').click(function() {
$('#file_upload_target').load(uploadFinished);
});
@ -47,7 +60,7 @@ $(document).ready(function() {
$.ajax({
url: 'ajax/newfolder.php',
data: "dir="+$('#dir').val()+"&foldername="+$('#file_new_dir_name').val(),
complete: boolOpFinished
complete: function(data){boolOperationFinished(data, false);}
});
});
@ -98,14 +111,20 @@ function resetFileActionPanel() {
$('#file_action_panel').attr('activeAction', false);
}
function boolOpFinished(data) {
function boolOperationFinished(data, single, el) {
result = eval("("+data.responseText+");");
if(result.status == 'success'){
$.ajax({
url: 'ajax/list.php',
data: "dir="+$('#dir').val(),
complete: refreshContents
});
if(single) {
$('#file_menu').slideToggle(0);
$('body').append($('#file_menu'));
$(el).remove();
} else {
$.ajax({
url: 'ajax/list.php',
data: "dir="+$('#dir').val(),
complete: refreshContents
});
}
} else {
alert(result.data.message);
}
@ -117,7 +136,11 @@ function refreshContents(data) {
updateBreadcrumb(result.data.breadcrumb);
}
updateFileList(result.data.files);
$('#file_upload_button').click();
$('td.fileaction a').click(function() {
$(this).parent().append($('#file_menu'));
$('#file_menu').slideToggle(250);
return false;
});
resetFileActionPanel();
}

@ -40,6 +40,6 @@ name="file_upload_target" src=""></iframe></form>
<ul>
<li><a href="" title="">Download</a></li>
<li><a href="" title="">Share</a></li>
<li><a href="" title="">Delete</a></li>
<li><a href="" title="" id="delete_single_file">Delete</a></li>
</ul>
</div>

Loading…
Cancel
Save