diff --git a/src/_h5ai/client/js/inc/ext/download.js b/src/_h5ai/client/js/inc/ext/download.js index f61caa04..fbab9e5a 100644 --- a/src/_h5ai/client/js/inc/ext/download.js +++ b/src/_h5ai/client/js/inc/ext/download.js @@ -1,10 +1,11 @@ -modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/server'], function (_, $, allsettings, resource, event, server) { +modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/server', 'core/entry'], function (_, $, allsettings, resource, event, server, entry) { var settings = _.extend({ enabled: false, execution: 'php', - format: 'zip' + format: 'zip', + packageName: 'package' }, allsettings.download), // formats = ['tar', 'zip'], @@ -35,7 +36,7 @@ modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'co if (json && json.code === 0) { setTimeout(function () { // wait here so the img above can be updated in time - window.location = '?action=getArchive&id=' + json.id + '&as=package.' + settings.format; + window.location = '?action=getArchive&id=' + json.id + '&as=' + (settings.packageName || entry.label) + '.' + settings.format; }, 200); } else { failed(); diff --git a/src/_h5ai/conf/options.json b/src/_h5ai/conf/options.json index 87bd962b..07cba1f5 100644 --- a/src/_h5ai/conf/options.json +++ b/src/_h5ai/conf/options.json @@ -58,7 +58,7 @@ Options Folders possibly visible in the tree view that are not the current folder might not be updated. - Interval will be a least 1000 milliseconds. + - interval: number, update interval in milliseconds, at least 1000 */ "autorefresh": { "enabled": true, @@ -93,7 +93,8 @@ Options File upload via drag'n'drop. Folders are not supported. The working file size seems to be very browser dependent. - Max file size is in MB. + - maxfiles: number, max number of files per upload + - maxfilesize: number, file size is in MB */ "dropbox": { "enabled": true, @@ -103,13 +104,16 @@ Options /* [php] Enable packaged download of selected entries. - Execution: "php", "shell". - Supported formats: "tar", "zip". + + - execution: "php" or "shell" + - format: "tar" or "zip" + - packageName: basename of the download package, null for current foldername */ "download": { "enabled": true, "execution": "shell", - "format": "zip" + "format": "zip", + "packageName": null }, /* [all] @@ -127,7 +131,6 @@ Options /* [php] Calc the size of folders. - Depends on du. */ "foldersize": { "enabled": true @@ -156,8 +159,8 @@ Options possible values. Adjust it to your needs. If lang is not found in "langs" it defaults to "en". - Optionally try to use browser language, falls back to previous - specified language. + - lang: default language + - useBroserLang: boolean, try to use browser language */ "l10n": { "enabled": true, @@ -174,7 +177,8 @@ Options /* [all] Shows the server mode in the bottom left corner. - display values: + + - display: 0: only show mode 1: mode and servername 2: mode, servername and -version @@ -186,16 +190,20 @@ Options /* [all] Adds Piwik tracker javascript code. - "baseURL" without protocol + + - baseURL: do not include the protocol, e.g. "mydomain.tld/piwik" + - idSite: number */ "piwik-analytics": { "enabled": false, - "baseURL": "mydomain.tld/piwik", + "baseURL": "some/url", "idSite": 1 }, /* [all] Show an image preview on click. + + - types: array of types */ "preview-img": { "enabled": true, @@ -208,6 +216,8 @@ Options be rendered as HTML. For available brushes see http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/ + + - types: maps types to brushes */ "preview-txt": { "enabled": true, @@ -240,6 +250,8 @@ Options /* [all] Show QRCodes on hovering files. + + - size: width and height in pixel */ "qrcode": { "enabled": true, @@ -265,6 +277,8 @@ Options the column: "n" for "Name", "d" for "Date" or "s" for "Size". The second letter specifies the sort order: "a" for "ascending" or "d" for "descending". + + - order: "na", "nd", "da", "dd", "sa" or "sd" */ "sort": { "enabled": true, @@ -281,9 +295,11 @@ Options /* [php] Show thumbnails for image files. Needs the "/_{{pkg.name}}/cache" folder to be writable for the web Server. - - img thumbnails depend on PHP-GD - - mov thumbnails depend on ffmpeg - - doc thumbnails depend on convert + + - img: array of types + - mov: array of types + - doc: array of types + - delay: delay in milliseconds after "dom-ready" before thumb-requesting starts */ "thumbnails": { "enabled": true, @@ -304,7 +320,8 @@ Options Show a folder tree. Note that this might affect performance significantly. - Slide tree bar into viewport if there is enough space. + - slide: boolean, slide tree bar into viewport if there is enough space + - maxSubfolders: max number of subfolders to show in tree */ "tree": { "enabled": true, diff --git a/src/_h5ai/server/php/inc/Archive.php b/src/_h5ai/server/php/inc/Archive.php index 94715b75..2d6ab6fc 100644 --- a/src/_h5ai/server/php/inc/Archive.php +++ b/src/_h5ai/server/php/inc/Archive.php @@ -38,7 +38,8 @@ class Archive { } else { return null; } - $cmd = str_replace("[ROOTDIR]", "\"" . $this->app->get_root_abs_path() . "\"", $cmd); + // $cmd = str_replace("[ROOTDIR]", "\"" . $this->app->get_root_abs_path() . "\"", $cmd); + $cmd = str_replace("[ROOTDIR]", "\"" . $this->app->get_abs_path() . "\"", $cmd); $cmd = str_replace("[TARGET]", "\"" . $target . "\"", $cmd); $cmd = str_replace("[DIRS]", count($this->dirs) ? "\"" . implode("\" \"", array_values($this->dirs)) . "\"" : "", $cmd); $cmd = str_replace("[FILES]", count($this->files) ? "\"" . implode("\" \"", array_values($this->files)) . "\"" : "", $cmd); @@ -76,8 +77,8 @@ class Archive { if ($code == App::$MAGIC_SEQUENCE && !$this->app->is_ignored($n)) { $real_file = $this->app->get_abs_path($href); - $archived_file = preg_replace("!^" . normalize_path($this->app->get_root_abs_path(), true) . "!", "", $real_file); - // $archived_file = preg_replace("!^" . normalize_path($this->app->get_abs_path(), true) . "!", "", $real_file); + // $archived_file = preg_replace("!^" . normalize_path($this->app->get_root_abs_path(), true) . "!", "", $real_file); + $archived_file = preg_replace("!^" . normalize_path($this->app->get_abs_path(), true) . "!", "", $real_file); if (is_dir($real_file)) { $this->add_dir($real_file, $archived_file);