summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/js/trash.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/js/trash.js')
-rw-r--r--apps/files_trashbin/js/trash.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/files_trashbin/js/trash.js b/apps/files_trashbin/js/trash.js
index f1241fce51e..6c810e4c2bd 100644
--- a/apps/files_trashbin/js/trash.js
+++ b/apps/files_trashbin/js/trash.js
@@ -22,6 +22,31 @@ $(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')){