cogIntercepts attachment download requests to display contents found inside attached ZIP files
TypePlugin
Category
Developed by

XWiki Development Team

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

Example 1: Link to an attached Javadoc zip

Imagine that you have a JAR/ZIP file named xwiki-commons-component-api-3.4-javadoc.jar attached to the current page and that it contains some Javadoc (and thus it has an entry page named index.html). You'd create a link to the Javadoc like this:

{{velocity}}
[[Javadoc>>path:$xwiki.zipexplorer.getFileLink($doc, "xwiki-commons-component-api-3.4-javadoc.jar", "index.html")]]
{{/velocity}}

Example 2: List files in an attachment

The following example lists the files in an attached zip file. The file content may be viewed by clicking on the generated links.

{{velocity}}
#set($attachment="sample.zip")
#set($plugin=$xwiki.zipexplorer)
#foreach($file in $plugin.getFileTreeList($doc, $attachment))
 * [[$file.id>>path:$plugin.getFileLink($doc, $attachment, $file.id)]]
#end
{{/velocity}}

Result:

zipexplorer.png

If you're using XWiki Syntax 2.0 or earlier you'll need to create the link like this instead:

  * {{html}}<a href="$plugin.getFileLink($doc, $attachment, $file.id)">$file.id</a>{{/html}}

Prerequisites & Installation Instructions

To activate this plugin make sure the class com.xpn.xwiki.plugin.zipexplorer.ZipExplorerPlugin is listed in the plugins property of the xwiki.cfg configuration file.

The id of the plugin is zipexplorer.

Tags:
    

Get Connected