aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-07-29 00:26:23 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-07-29 00:26:23 +0200
commitc73dd86713de9e249bee432f7728dfd06859fac3 (patch)
tree42d77387df24d2965422484ac802b022a55eb14d
parent433ad8c3ce80dde20e4fc0ea4cc3edaae2c0654f (diff)
downloadnextcloud-server-c73dd86713de9e249bee432f7728dfd06859fac3.tar.gz
nextcloud-server-c73dd86713de9e249bee432f7728dfd06859fac3.zip
confirmation dialogs for deletions
-rw-r--r--files/css/files.css2
-rw-r--r--files/js/fileactions.js28
-rw-r--r--files/js/files.js47
-rw-r--r--files/templates/index.php4
4 files changed, 60 insertions, 21 deletions
diff --git a/files/css/files.css b/files/css/files.css
index 166baebf861..d79e75468a5 100644
--- a/files/css/files.css
+++ b/files/css/files.css
@@ -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.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; }
-#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 { 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; }
diff --git a/files/js/fileactions.js b/files/js/fileactions.js
index 1eb885f06de..e1f25885fec 100644
--- a/files/js/fileactions.js
+++ b/files/js/fileactions.js
@@ -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){
- $.ajax({
- url: 'ajax/delete.php',
- data: "dir="+encodeURIComponent($('#dir').val())+"&file="+encodeURIComponent(filename),
- complete: function(data){
- boolOperationFinished(data, function(){
- FileList.remove(filename);
- });
+ $( "#delete-confirm" ).dialog({
+ resizable: false,
+ height:200,
+ title:"Delete "+filename,
+ modal: true,
+ 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" );
+ }
}
});
});
diff --git a/files/js/files.js b/files/js/files.js
index f68e4d0c3cd..cd1689a2dd7 100644
--- a/files/js/files.js
+++ b/files/js/files.js
@@ -100,19 +100,40 @@ $(document).ready(function() {
});
$('.delete').click(function(event) {
- var files=getSelectedFiles('name').join(';');
-
- $.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();
- });
+ var fileNames=getSelectedFiles('name');
+ var files=fileNames.join(';');
+ var lastFileName=fileNames.pop();
+ if(fileNames.length>0){
+ fileNames=fileNames.join(', ')+' and '+lastFileName;
+ }else{
+ fileNames=lastFileName;
+ }
+
+ $( "#delete-confirm" ).dialog({
+ resizable: false,
+ 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" );
+ }
}
});
diff --git a/files/templates/index.php b/files/templates/index.php
index c098a4e0632..336cca19cd4 100644
--- a/files/templates/index.php
+++ b/files/templates/index.php
@@ -48,4 +48,8 @@
</p>
</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"/>