Batch Upload Plugin
Attach multiple files at once by uploading a zip archive
Usage
- Enable this plugin in
LocalSite.cfg
or configure
- Test:
- Attach a
zip
file to a topic
- If a comment is entered with the zip file, the comment will be assigned to all contained files unless the
IMPORTFILECOMMENTS
flag below is enabled and the archive contains corresponding file comments (in which case the latter take precedence).
- Using archive file comments, it is possible to specifiy hide and/or link flags on a file-per-file basis which override those given in the upload form by enabling the
FILECOMMENTFLAGS
flag below and adding prefixes of the form +h-l
(case insensitive, given in arbitrary order, to be separated from the 'main' description by at least one whitespace).
Plugin Settings
Plugin settings are stored as preferences values. You can override the defaults for these preferences in Main.SitePreferences, the WebPreferences topic of the current web, or in individual topics, using the standard 'Set' syntax e.g:
* Set BATCHUPLOADPLUGIN_ENABLED = 1
Changing them here will have no effect! This allows you to upgrade the plugin without having worry about losing your settings.
Configurable Preferences
Plugin settings are stored as preferences values. To change the setting you need to overwrite them in
DefaultPreferences. Changing them here will have no effect! This allows you to upgrade the plugin without having worry about losing your settings.
- Enabled state - if disabled, does nothing. You will need to overwrite this if you want the plugin enabled anywhere (either in site or per-web)
- Set BATCHUPLOADPLUGIN_ENABLED = 0
- File comments in archives will be imported (and override the default comment specified in the upload form)
- Set BATCHUPLOADPLUGIN_IMPORTFILECOMMENTS = 1
- File comments in archives may contain prefixes (see above) which override specified default hide and link flags (this flag is independent from the previous one; if it is disabled, existing prefixes will not be stripped from imported comments)
- Set BATCHUPLOADPLUGIN_FILECOMMENTFLAGS = 1
Conditional Batch Upload
This plugin provides the ability to choose between attaching uploaded zip files, or extracting and attaching the contents. To enable this feature, add the following lines to the skin templates files, just after the
hidefile
table entry:
-
templates/attach.pattern.tmpl
(attachform
section):
<input type="checkbox" class="foswikiCheckbox" id="batchupload" checked name="batchupload" %BATCHUPLOADCHECKBOX% /><label for="batchupload">%MAKETEXT{"Batch upload for zip file"}%</label> <span class="foswikiGrayText">%MAKETEXT{"Extracts and uploads individual file in zip archive."}%</span>
-
templates/attach.tmpl
and templates/attach.classic.tmpl
(content
section):
<tr>
<td align="right">
Batch Upload:
</td><td>
<input type="checkbox" name="batchupload" %BATCHUPLOADCHECKBOX% />Extract Files and Attach them to the Topic
</td>
</tr>
In addition, use
configure
to set the
$Foswiki::cfg{Plugins}{BatchUploadPlugin}{usercontrol}
option to true.
Caveats
- Contents of nested zips will only be attached partially
Further Development
- Support nested zips
- Support interactive modification of hide and link attributes on a file-per-file basis during archive import
- Support other archive formats (e.g., tar)
Installation Instructions
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.
Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".
If you have any problems, or if the extension isn't available in
configure
, then you can still install manually from the command-line. See
http://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Plugin Files
File: |
Description: |
data/System/BatchUploadPlugin.txt |
Documentation |
lib/Foswiki/Plugins/BatchUploadPlugin.pm |
Perl module |
lib/Foswiki/Plugins/BatchUploadPlugin/Config.spec |
Configuration Items |
Plugin Info
Related Topics: DefaultPreferences,
SitePreferences,
Plugins