diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-02-08 00:11:54 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-02-08 00:11:54 +0100 |
commit | f93f9dd50cce6b6e2ed4eeca2d34b2bac82e0350 (patch) | |
tree | c76b2eabb63ed308eb882468cb2a74042e6f9d53 /apps/files_trashbin/js/trash.js | |
parent | 697536cf6ad1c9a862c32605b807172dfa680d22 (diff) | |
parent | 3bd33b69a1c37cee5c3d180ec8952a611aabb4d1 (diff) | |
download | nextcloud-server-f93f9dd50cce6b6e2ed4eeca2d34b2bac82e0350.tar.gz nextcloud-server-f93f9dd50cce6b6e2ed4eeca2d34b2bac82e0350.zip |
merge master into trash_fileactions
Diffstat (limited to 'apps/files_trashbin/js/trash.js')
-rw-r--r-- | apps/files_trashbin/js/trash.js | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/apps/files_trashbin/js/trash.js b/apps/files_trashbin/js/trash.js index f2797347b82..c3429e7a838 100644 --- a/apps/files_trashbin/js/trash.js +++ b/apps/files_trashbin/js/trash.js @@ -21,7 +21,32 @@ $(document).ready(function() { }); }; - + + FileActions.register('all', 'Delete', OC.PERMISSION_READ, function () { + return OC.imagePath('core', 'actions/delete'); + }, function (filename) { + $('.tipsy').remove(); + + var tr=$('tr').filterAttr('data-file', filename); + var deleteAction = $('tr').filterAttr('data-file',filename).children("td.date").children(".action.delete"); + var oldHTML = deleteAction[0].outerHTML; + var newHTML = '<img class="move2trash" data-action="Delete" title="'+t('files', 'delete file permanently')+'" src="'+ OC.imagePath('core', 'loading.gif') +'"></a>'; + deleteAction[0].outerHTML = newHTML; + + $.post(OC.filePath('files_trashbin','ajax','delete.php'), + {file:tr.attr('data-file') }, + function(result){ + if ( result.status == 'success' ) { + var row = document.getElementById(result.data.filename); + row.parentNode.removeChild(row); + } else { + deleteAction[0].outerHTML = oldHTML; + OC.dialogs.alert(result.data.message, 'Error'); + } + }); + + }); + // Sets the select_all checkbox behaviour : $('#select_all').click(function() { if($(this).attr('checked')){ @@ -66,7 +91,7 @@ $(document).ready(function() { }); $('.undelete').click('click',function(event) { - var spinner = '<img class="move2trash" title="'+t('files_trashbin', 'perform undelete operation')+'" src="'+ OC.imagePath('core', 'loader.gif') +'"></a>'; + var spinner = '<img class="move2trash" title="'+t('files_trashbin', 'perform restore operation')+'" src="'+ OC.imagePath('core', 'loader.gif') +'"></a>'; var files=getSelectedFiles('file'); var fileslist=files.join(';'); var dirlisting=getSelectedFiles('dirlisting')[0]; |