Skip to content
Snippets Groups Projects
Commit c73dd867 authored by Robin Appelman's avatar Robin Appelman
Browse files

confirmation dialogs for deletions

parent 433ad8c3
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,7 @@ table td.delete { background-image:url('../img/delete.png'); } ...@@ -51,7 +51,7 @@ table td.delete { background-image:url('../img/delete.png'); }
#fileList tr input[type=checkbox]:checked, #fileList tr:hover input[type=checkbox] { display:inline; } #fileList tr input[type=checkbox]:checked, #fileList tr:hover input[type=checkbox] { display:inline; }
#fileList tr.selected td.filename a, #fileList tr:hover td.filename a { background-image:none !important } #fileList tr.selected td.filename a, #fileList tr:hover td.filename a { background-image:none !important }
#select_all { float:left; margin:0.2em; margin-left:0.6em; } #select_all { float:left; margin:0.2em; margin-left:0.6em; }
#uploadsize-message { display:none; } #uploadsize-message,#delete-confirm { display:none; }
.selectedActions a, a.file_action { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; } .selectedActions a, a.file_action { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; }
.selectedActions { display:none; } .selectedActions { display:none; }
.selectedActions a:hover, a.file_action:hover { background:#fff; -moz-box-shadow:0 0 10px #fff; -webkit-box-shadow:0 0 10px #fff; box-shadow:0 0 10px #fff; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; } .selectedActions a:hover, a.file_action:hover { background:#fff; -moz-box-shadow:0 0 10px #fff; -webkit-box-shadow:0 0 10px #fff; box-shadow:0 0 10px #fff; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }
......
...@@ -114,13 +114,27 @@ FileActions.register('all','Download',OC.imagePath('core','actions/download'),fu ...@@ -114,13 +114,27 @@ FileActions.register('all','Download',OC.imagePath('core','actions/download'),fu
}); });
FileActions.register('all','Delete',OC.imagePath('core','actions/delete'),function(filename){ FileActions.register('all','Delete',OC.imagePath('core','actions/delete'),function(filename){
$.ajax({ $( "#delete-confirm" ).dialog({
url: 'ajax/delete.php', resizable: false,
data: "dir="+encodeURIComponent($('#dir').val())+"&file="+encodeURIComponent(filename), height:200,
complete: function(data){ title:"Delete "+filename,
boolOperationFinished(data, function(){ modal: true,
FileList.remove(filename); buttons: {
}); "Delete": function() {
$( this ).dialog( "close" );
$.ajax({
url: 'ajax/delete.php',
data: "dir="+encodeURIComponent($('#dir').val())+"&file="+encodeURIComponent(filename),
complete: function(data){
boolOperationFinished(data, function(){
FileList.remove(filename);
});
}
});
},
Cancel: function() {
$( this ).dialog( "close" );
}
} }
}); });
}); });
......
...@@ -100,19 +100,40 @@ $(document).ready(function() { ...@@ -100,19 +100,40 @@ $(document).ready(function() {
}); });
$('.delete').click(function(event) { $('.delete').click(function(event) {
var files=getSelectedFiles('name').join(';'); var fileNames=getSelectedFiles('name');
var files=fileNames.join(';');
$.ajax({ var lastFileName=fileNames.pop();
url: 'ajax/delete.php', if(fileNames.length>0){
data: "dir="+$('#dir').val()+"&files="+encodeURIComponent(files), fileNames=fileNames.join(', ')+' and '+lastFileName;
complete: function(data){ }else{
boolOperationFinished(data, function(){ fileNames=lastFileName;
var files=getSelectedFiles('name'); }
for(var i=0;i<files.length;i++){
FileList.remove(files[i]); $( "#delete-confirm" ).dialog({
} resizable: false,
procesSelection(); height:200,
}); modal: true,
title:"Delete "+fileNames,
buttons: {
"Delete": function() {
$( this ).dialog( "close" );
$.ajax({
url: 'ajax/delete.php',
data: "dir="+$('#dir').val()+"&files="+encodeURIComponent(files),
complete: function(data){
boolOperationFinished(data, function(){
var files=getSelectedFiles('name');
for(var i=0;i<files.length;i++){
FileList.remove(files[i]);
}
procesSelection();
});
}
});
},
Cancel: function() {
$( this ).dialog( "close" );
}
} }
}); });
......
...@@ -48,4 +48,8 @@ ...@@ -48,4 +48,8 @@
</p> </p>
</div> </div>
<div id="delete-confirm" title="">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>These items will be permanently deleted and cannot be recovered. Are you sure?</p>
</div>
<span id="file_menu"/> <span id="file_menu"/>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment