Improves download extension. Updates option docs.

This commit is contained in:
Lars Jung 2012-10-13 23:58:52 +02:00
parent 270956c10d
commit 160fd8ecbf
3 changed files with 40 additions and 21 deletions

View file

@ -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({ var settings = _.extend({
enabled: false, enabled: false,
execution: 'php', execution: 'php',
format: 'zip' format: 'zip',
packageName: 'package'
}, allsettings.download), }, allsettings.download),
// formats = ['tar', 'zip'], // formats = ['tar', 'zip'],
@ -35,7 +36,7 @@ modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'co
if (json && json.code === 0) { if (json && json.code === 0) {
setTimeout(function () { // wait here so the img above can be updated in time 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); }, 200);
} else { } else {
failed(); failed();

View file

@ -58,7 +58,7 @@ Options
Folders possibly visible in the tree view that are not the Folders possibly visible in the tree view that are not the
current folder might not be updated. current folder might not be updated.
Interval will be a least 1000 milliseconds. - interval: number, update interval in milliseconds, at least 1000
*/ */
"autorefresh": { "autorefresh": {
"enabled": true, "enabled": true,
@ -93,7 +93,8 @@ Options
File upload via drag'n'drop. Folders are not supported. File upload via drag'n'drop. Folders are not supported.
The working file size seems to be very browser dependent. 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": { "dropbox": {
"enabled": true, "enabled": true,
@ -103,13 +104,16 @@ Options
/* [php] /* [php]
Enable packaged download of selected entries. 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": { "download": {
"enabled": true, "enabled": true,
"execution": "shell", "execution": "shell",
"format": "zip" "format": "zip",
"packageName": null
}, },
/* [all] /* [all]
@ -127,7 +131,6 @@ Options
/* [php] /* [php]
Calc the size of folders. Calc the size of folders.
Depends on du.
*/ */
"foldersize": { "foldersize": {
"enabled": true "enabled": true
@ -156,8 +159,8 @@ Options
possible values. Adjust it to your needs. If lang is not found in possible values. Adjust it to your needs. If lang is not found in
"langs" it defaults to "en". "langs" it defaults to "en".
Optionally try to use browser language, falls back to previous - lang: default language
specified language. - useBroserLang: boolean, try to use browser language
*/ */
"l10n": { "l10n": {
"enabled": true, "enabled": true,
@ -174,7 +177,8 @@ Options
/* [all] /* [all]
Shows the server mode in the bottom left corner. Shows the server mode in the bottom left corner.
display values:
- display:
0: only show mode 0: only show mode
1: mode and servername 1: mode and servername
2: mode, servername and -version 2: mode, servername and -version
@ -186,16 +190,20 @@ Options
/* [all] /* [all]
Adds Piwik tracker javascript code. Adds Piwik tracker javascript code.
"baseURL" without protocol
- baseURL: do not include the protocol, e.g. "mydomain.tld/piwik"
- idSite: number
*/ */
"piwik-analytics": { "piwik-analytics": {
"enabled": false, "enabled": false,
"baseURL": "mydomain.tld/piwik", "baseURL": "some/url",
"idSite": 1 "idSite": 1
}, },
/* [all] /* [all]
Show an image preview on click. Show an image preview on click.
- types: array of types
*/ */
"preview-img": { "preview-img": {
"enabled": true, "enabled": true,
@ -208,6 +216,8 @@ Options
be rendered as HTML. be rendered as HTML.
For available brushes see http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/ For available brushes see http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/
- types: maps types to brushes
*/ */
"preview-txt": { "preview-txt": {
"enabled": true, "enabled": true,
@ -240,6 +250,8 @@ Options
/* [all] /* [all]
Show QRCodes on hovering files. Show QRCodes on hovering files.
- size: width and height in pixel
*/ */
"qrcode": { "qrcode": {
"enabled": true, "enabled": true,
@ -265,6 +277,8 @@ Options
the column: "n" for "Name", "d" for "Date" or "s" for "Size". The the column: "n" for "Name", "d" for "Date" or "s" for "Size". The
second letter specifies the sort order: "a" for "ascending" or "d" second letter specifies the sort order: "a" for "ascending" or "d"
for "descending". for "descending".
- order: "na", "nd", "da", "dd", "sa" or "sd"
*/ */
"sort": { "sort": {
"enabled": true, "enabled": true,
@ -281,9 +295,11 @@ Options
/* [php] /* [php]
Show thumbnails for image files. Needs the "/_{{pkg.name}}/cache" folder to be Show thumbnails for image files. Needs the "/_{{pkg.name}}/cache" folder to be
writable for the web Server. writable for the web Server.
- img thumbnails depend on PHP-GD
- mov thumbnails depend on ffmpeg - img: array of types
- doc thumbnails depend on convert - mov: array of types
- doc: array of types
- delay: delay in milliseconds after "dom-ready" before thumb-requesting starts
*/ */
"thumbnails": { "thumbnails": {
"enabled": true, "enabled": true,
@ -304,7 +320,8 @@ Options
Show a folder tree. Show a folder tree.
Note that this might affect performance significantly. 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": { "tree": {
"enabled": true, "enabled": true,

View file

@ -38,7 +38,8 @@ class Archive {
} else { } else {
return null; 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("[TARGET]", "\"" . $target . "\"", $cmd);
$cmd = str_replace("[DIRS]", count($this->dirs) ? "\"" . implode("\" \"", array_values($this->dirs)) . "\"" : "", $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); $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)) { if ($code == App::$MAGIC_SEQUENCE && !$this->app->is_ignored($n)) {
$real_file = $this->app->get_abs_path($href); $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_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_abs_path(), true) . "!", "", $real_file);
if (is_dir($real_file)) { if (is_dir($real_file)) {
$this->add_dir($real_file, $archived_file); $this->add_dir($real_file, $archived_file);