From 9511ba7e49790b307316d350212b3a47006481b1 Mon Sep 17 00:00:00 2001 From: bohwaz Date: Tue, 22 Nov 2022 02:33:35 +0100 Subject: [PATCH] Update webdav manager: implement download all files --- index.php | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 4b6472e..51f8d42 100644 --- a/index.php +++ b/index.php @@ -1852,10 +1852,10 @@ RewriteRule ^.*$ /index.php [END] if ($relative_uri == '.webdav/webdav.js') { fseek($fp, 49805, SEEK_SET); - echo fread($fp, 25889); + echo fread($fp, 26310); } else { - fseek($fp, 49805 + 25889, SEEK_SET); + fseek($fp, 49805 + 26310, SEEK_SET); echo fread($fp, 6760); } @@ -1979,6 +1979,7 @@ const WebDAVNavigator = (url, options) => { + %table%
`; @@ -2181,6 +2182,17 @@ const WebDAVNavigator = (url, options) => { a.remove(); }; + const download_all = async () => { + for (var i = 0; i < items.length; i++) { + var item = items[i]; + if (item.is_dir) { + continue; + } + + await download(item.name, item.uri) + } + }; + const preview = (type, url) => { if (type.match(/^image\//)) { openDialog(``, false); @@ -2295,7 +2307,7 @@ const WebDAVNavigator = (url, options) => { const buildListing = (uri, xml) => { uri = normalizeURL(uri); - var items = [[], []]; + items = [[], []]; var title = null; var root_permissions = null; @@ -2401,6 +2413,13 @@ const WebDAVNavigator = (url, options) => { reloadListing(); }; + if (!items.length) { + $('.download_all').disabled = true; + } + else { + $('.download_all').onclick = download_all; + } + if (!root_permissions || root_permissions.indexOf('CK') != -1) { $('.upload').insertAdjacentHTML('afterbegin', create_buttons); @@ -2611,6 +2630,7 @@ const WebDAVNavigator = (url, options) => { }); }; + var items = [[], []]; var current_url = url; var base_url = url; const user = options.user || null;