Batch Upload Plugin
Attach multiple files at once by uploading a zip archive. All files in the zip file will be attached to the topic.
Usage
- Enable this plugin in
LocalSite.cfg or configure - Test: BatchUploadPlugin is enabled
- 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
- Debug plugin
- Enabled state - if disabled, does nothing
- File comments in archives will be imported (and override the default comment specified in the upload form)
- Set 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 SHORTDESCRIPTION = Attach multiple files at once by uploading a zip archive
Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>% , e.g., %BATCHUPLOADPLUGIN_SHORTDESCRIPTION%
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)
Plugin Installation Instructions
Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.
- Download the ZIP file from the Plugin web (see below)
- Unzip
BatchUploadPlugin.zip in your twiki installation directory. Content: File: | Description: | data/TWiki/BatchUploadPlugin.txt | Documentation | lib/TWiki/Plugins/BatchUploadPlugin.pm | Perl module |
- (Dakar) Visit
configure in your TWiki installation, and enable the plugin in the {Plugins} section.
- Flip ENABLED switch to 1
- Test if the installation was successful:
Conditional Batch Upload
Versions 1.2 and above include the ability to choose between attaching uploaded zip files, or extracting and attaching the contents. To add this feature to TWiki, 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="twikiCheckbox" id="batchupload" checked name="batchupload" %BATCHUPLOADCHECKBOX% /><label for="batchupload">%MAKETEXT{"Batch upload for zip file"}%</label> <span class="twikiGrayText">%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, add the following line to lib/LocalSite.cfg :
$TWiki::cfg{Plugins}{BatchUploadPlugin}{usercontrol} = 1;
Plugin Info
Related Topics: TWikiPreferences, TWikiPlugins |