implemented Delete action in file menu
This commit is contained in:
parent
573d36a168
commit
03747a0ffb
|
@ -39,6 +39,19 @@ $(document).ready(function() {
|
||||||
$('.browser input:checkbox').attr('checked', false);
|
$('.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_start').click(function() {
|
||||||
$('#file_upload_target').load(uploadFinished);
|
$('#file_upload_target').load(uploadFinished);
|
||||||
});
|
});
|
||||||
|
@ -47,7 +60,7 @@ $(document).ready(function() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'ajax/newfolder.php',
|
url: 'ajax/newfolder.php',
|
||||||
data: "dir="+$('#dir').val()+"&foldername="+$('#file_new_dir_name').val(),
|
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);
|
$('#file_action_panel').attr('activeAction', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function boolOpFinished(data) {
|
function boolOperationFinished(data, single, el) {
|
||||||
result = eval("("+data.responseText+");");
|
result = eval("("+data.responseText+");");
|
||||||
if(result.status == 'success'){
|
if(result.status == 'success'){
|
||||||
|
if(single) {
|
||||||
|
$('#file_menu').slideToggle(0);
|
||||||
|
$('body').append($('#file_menu'));
|
||||||
|
$(el).remove();
|
||||||
|
} else {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'ajax/list.php',
|
url: 'ajax/list.php',
|
||||||
data: "dir="+$('#dir').val(),
|
data: "dir="+$('#dir').val(),
|
||||||
complete: refreshContents
|
complete: refreshContents
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
alert(result.data.message);
|
alert(result.data.message);
|
||||||
}
|
}
|
||||||
|
@ -117,7 +136,11 @@ function refreshContents(data) {
|
||||||
updateBreadcrumb(result.data.breadcrumb);
|
updateBreadcrumb(result.data.breadcrumb);
|
||||||
}
|
}
|
||||||
updateFileList(result.data.files);
|
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();
|
resetFileActionPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,6 @@ name="file_upload_target" src=""></iframe></form>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="" title="">Download</a></li>
|
<li><a href="" title="">Download</a></li>
|
||||||
<li><a href="" title="">Share</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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue