mirror of
https://github.com/kd2org/picodav.git
synced 2024-11-16 16:48:26 +01:00
Update webdav manager: implement download all files
FossilOrigin-Name: 9c3e89e6a3aa91333ab1f1635dc3d54da97af4308d6f65bfe9e87e0b9fa287d6
This commit is contained in:
parent
57467c06fd
commit
b06ae5fa19
1 changed files with 23 additions and 3 deletions
26
index.php
26
index.php
|
@ -1852,10 +1852,10 @@ RewriteRule ^.*$ /index.php [END]
|
||||||
|
|
||||||
if ($relative_uri == '.webdav/webdav.js') {
|
if ($relative_uri == '.webdav/webdav.js') {
|
||||||
fseek($fp, 49805, SEEK_SET);
|
fseek($fp, 49805, SEEK_SET);
|
||||||
echo fread($fp, 25889);
|
echo fread($fp, 26310);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fseek($fp, 49805 + 25889, SEEK_SET);
|
fseek($fp, 49805 + 26310, SEEK_SET);
|
||||||
echo fread($fp, 6760);
|
echo fread($fp, 6760);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1979,6 +1979,7 @@ const WebDAVNavigator = (url, options) => {
|
||||||
<option value="date">${_('Sort by date')}</option>
|
<option value="date">${_('Sort by date')}</option>
|
||||||
<option value="size">${_('Sort by size')}</option>
|
<option value="size">${_('Sort by size')}</option>
|
||||||
</select>
|
</select>
|
||||||
|
<input type="button" class="download_all" value="${_('Download all files')}" />
|
||||||
</div>
|
</div>
|
||||||
<table>%table%</table>`;
|
<table>%table%</table>`;
|
||||||
|
|
||||||
|
@ -2181,6 +2182,17 @@ const WebDAVNavigator = (url, options) => {
|
||||||
a.remove();
|
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) => {
|
const preview = (type, url) => {
|
||||||
if (type.match(/^image\//)) {
|
if (type.match(/^image\//)) {
|
||||||
openDialog(`<img src="${url}" />`, false);
|
openDialog(`<img src="${url}" />`, false);
|
||||||
|
@ -2295,7 +2307,7 @@ const WebDAVNavigator = (url, options) => {
|
||||||
const buildListing = (uri, xml) => {
|
const buildListing = (uri, xml) => {
|
||||||
uri = normalizeURL(uri);
|
uri = normalizeURL(uri);
|
||||||
|
|
||||||
var items = [[], []];
|
items = [[], []];
|
||||||
var title = null;
|
var title = null;
|
||||||
var root_permissions = null;
|
var root_permissions = null;
|
||||||
|
|
||||||
|
@ -2401,6 +2413,13 @@ const WebDAVNavigator = (url, options) => {
|
||||||
reloadListing();
|
reloadListing();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!items.length) {
|
||||||
|
$('.download_all').disabled = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('.download_all').onclick = download_all;
|
||||||
|
}
|
||||||
|
|
||||||
if (!root_permissions || root_permissions.indexOf('CK') != -1) {
|
if (!root_permissions || root_permissions.indexOf('CK') != -1) {
|
||||||
$('.upload').insertAdjacentHTML('afterbegin', create_buttons);
|
$('.upload').insertAdjacentHTML('afterbegin', create_buttons);
|
||||||
|
|
||||||
|
@ -2611,6 +2630,7 @@ const WebDAVNavigator = (url, options) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var items = [[], []];
|
||||||
var current_url = url;
|
var current_url = url;
|
||||||
var base_url = url;
|
var base_url = url;
|
||||||
const user = options.user || null;
|
const user = options.user || null;
|
||||||
|
|
Loading…
Reference in a new issue