From 6e2321b5c65438a4ac079026d6cb411020c3e50f Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Tue, 16 Jan 2024 09:35:53 +0000 Subject: [PATCH] add multiple file download by check boxes (#5699) Signed-off-by: si458 --- views/default.handlebars | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/views/default.handlebars b/views/default.handlebars index 77a59a15..d34aed96 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -524,6 +524,7 @@       +         @@ -862,6 +863,7 @@ + @@ -11135,6 +11137,7 @@ QE('p13ZipButton', false); QE('p13PasteButton', false); QE('p13GoToFolderButton', false); + QE('p13DownloadButton', false); } else { var cc = p13getFileSelCount(), tc = p13getFileCount(), sfc = p13getFileSelCount(false); // In order: number of entires selected, number of total entries, number of selected entires that are files (not folders) var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5)) || (currentNode.agent.id == 14)|| (currentNode.agent.id == 34); @@ -11152,6 +11155,7 @@ QE('p13ZipButton', advancedFeatures && (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13PasteButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0))); QE('p13GoToFolderButton', true); + QE('p13DownloadButton', advancedFeatures && (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false))); } var filesState = ((files != null) && (files.state != 0)); if (((filesState == true) && (files.contype != 2)) || (filesNode.agent == null) || (filesNode.agent.id == 3) || (filesNode.agent.id == 4)) { @@ -11333,6 +11337,20 @@ } } + function p13downloadButton() { + var checkboxes = document.getElementsByName('fd'); + for (var i = 0; i < checkboxes.length; i++) { + if (checkboxes[i].checked) { + var thefile = p13filetree.dir[checkboxes[i].value]; + var link = 'devicefile.ashx?c=' + authCookie; + link += '&m=' + currentNode.meshid.split('/')[2]; + link += '&n=' + currentNode._id.split('/')[2]; + link += '&f=' + encodeURIComponentEx(p13filetreelocation.join('/') + '/' + thefile.n); + downloadFile(link,encodeURIComponentEx(thefile.n)); + } + } + } + var d4EditWrapVal = 0; var d4EditSizeVal = 0; var d4EditEncodingVal = 0; @@ -14439,6 +14457,7 @@ QE('p5ViewFileButton', (cc == 1) && (sfc == 1) && (filetreelocation.length > 0)); QE('p5NewFolderButton', filetreelocation.length > 0); QE('p5UploadButton', filetreelocation.length > 0); + QE('p5DownloadButton', (cc > 0) && (cc == sfc) && (filetreelocation.length > 0)); QE('p5RenameFileButton', (cc == 1) && (filetreelocation.length > 0)); QE('p5SelectAllButton', tc > 0); Q('p5SelectAllButton').value = (cc > 0 ? "Select None" : "Select All"); @@ -14608,6 +14627,16 @@ } } + function p5downloadButton() { + var checkboxes = document.getElementsByName('fc'); + for (var i = 0; i < checkboxes.length; i++) { + if (checkboxes[i].checked) { + var link = 'downloadfile.ashx?link=' + encodeURIComponentEx(filetreelinkpath + '/' + checkboxes[i].value); + downloadFile(link); + } + } + } + /* function p5fileCatchAllInputChanged(e) { p5fileDragLeave(e);