aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/files.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-02-13 20:20:00 +0100
committerVincent Petry <pvince81@owncloud.com>2014-02-13 20:28:52 +0100
commitd5397d813cd731b5bf8ac4b7c193ac39d704af6e (patch)
tree9de3d45f938bdb755ac158933aef994cb58e257e /apps/files/js/files.js
parent30662fa7acbe7a367ee8b0c07afabf425a10ef06 (diff)
downloadnextcloud-server-d5397d813cd731b5bf8ac4b7c193ac39d704af6e.tar.gz
nextcloud-server-d5397d813cd731b5bf8ac4b7c193ac39d704af6e.zip
Do not send file list for select all on Download/delete
- When all files are selected, do not send the whole file list - Download will trigger download for the parent folder, also works with root - Delete will send "allfiles" to the server that will find the file list or the passed directory by itself
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r--apps/files/js/files.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 1ec4c4ec7ab..fbac601f67a 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -364,23 +364,26 @@ $(document).ready(function() {
});
$('.download').click('click',function(event) {
- var files=getSelectedFilesTrash('name');
- var fileslist = JSON.stringify(files);
- var dir=$('#dir').val()||'/';
- OC.Notification.show(t('files','Your download is being prepared. This might take some time if the files are big.'));
- // use special download URL if provided, e.g. for public shared files
- var downloadURL = document.getElementById("downloadURL");
- if ( downloadURL ) {
- window.location = downloadURL.value+"&download&files=" + encodeURIComponent(fileslist);
- } else {
- window.location = OC.filePath('files', 'ajax', 'download.php') + '?'+ $.param({ dir: dir, files: fileslist });
+ var files;
+ var dir = FileList.getCurrentDirectory();
+ if (FileList.isAllSelected()) {
+ files = OC.basename(dir);
+ dir = OC.dirname(dir) || '/';
}
+ else {
+ files = getSelectedFilesTrash('name');
+ }
+ OC.Notification.show(t('files','Your download is being prepared. This might take some time if the files are big.'));
+ OC.redirect(FileList.getDownloadUrl(files, dir));
return false;
});
$('.delete-selected').click(function(event) {
var files=getSelectedFilesTrash('name');
event.preventDefault();
+ if (FileList.isAllSelected()) {
+ files = null;
+ }
FileList.do_delete(files);
return false;
});