Export Plugins
From MSpace
(→Core Plugins) |
(→Site Specific Plugins) |
||
Line 49: | Line 49: | ||
Site specific plugins can be found at: | Site specific plugins can be found at: | ||
<pre>/sites/{$current_site}/export/plugins</pre> | <pre>/sites/{$current_site}/export/plugins</pre> | ||
+ | |||
+ | The core plugins are always loaded first so it is possible for a site specific plugin to be loaded with the same unique 3 character ID that will overwrite a core export plugin. This will result in the site specific plugin being used instead of the stock alternative. |
Revision as of 15:11, 24 November 2008
Contents |
Plugin Architecture
Each plugin is a self contained folder which must contain two files:
- plugin.php
- plugin.xslt
plugin.php
This is the configuration file for the export plugin
Example config file (for plain text export):
<?php $plugin = array(); $plugin['id'] = 'TXT'; $plugin['header'] = "text/plain"; $plugin['stripXML'] = true; ?> *<b>id</b> - the 3 character unique ID for this plugin (used as the file extension in the export script) *<b>header</b> - the HTTP header that the exported data should be sent with *<b>stripXML</b> - should the XML declaration added by the XSLT transformation be removed before output
plugin.xslt
This is the XSLT template that is used to transform the output from the mSpace Server into the desired output format. The server output will be a slicegetitems request and as such the export plugin's have access to MetaDataConnections aswell as DirectConnections metadata.
Example template file (for plain text export):
<?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" /> <xsl:template match="/"> <xsl:for-each select="//MetadataConnections/ColumnMetadata/RowItem"> <xsl:value-of select="../@label" /> <xsl:text>: </xsl:text> <xsl:value-of select="@label" /> <xsl:text> </xsl:text> </xsl:for-each> </xsl:template> </xsl:stylesheet>
Core Plugins
The core mSpace export plugins can be found at:
/export/plugins
Site Specific Plugins
Site specific plugins can be found at:
/sites/{$current_site}/export/plugins
The core plugins are always loaded first so it is possible for a site specific plugin to be loaded with the same unique 3 character ID that will overwrite a core export plugin. This will result in the site specific plugin being used instead of the stock alternative.