summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/js/trash.js
blob: b9088944fd46ee4eb26e12b674db09fd03530469 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Override download path to files_sharing/public.php
function fileDownloadPath(dir, file) {
	var url = $('#downloadURL').val();
	if (url.indexOf('&path=') != -1) {
		url += '/'+file;
	}
	return url;
}

$(document).ready(function() {

	if (typeof FileActions !== 'undefined') {
		FileActions.register('all', 'Undelete', OC.PERMISSION_READ, '', function(filename) {
			var tr=$('tr').filterAttr('data-file', filename);
			$.post(OC.filePath('files_trashbin','ajax','undelete.php'),
				{timestamp:tr.attr('data-timestamp'),filename:tr.attr('data-filename')},
				function(result){
					if (result.status == 'success') {
						var row = document.getElementById(result.data.filename+'.d'+result.data.timestamp);
						row.parentNode.removeChild(row);
					} else {
						OC.dialogs.alert(result.data.message, 'Error');
					}
				});
			
			});
		};

});