en:user:expanding_on_gs3_customisation_tutorials
This version is outdated by a newer approved version.
This version (2020/09/03 21:36) is a draft.
Approvals: 0/1
This version (2020/09/03 21:36) is a draft.Approvals: 0/1
This is an old revision of the document!
Expanding on the GS3 Customisation tutorials
This wiki explains how to introduce support for other Greenstone 3 features into the custom perrin interface created by following the Greenstone 3 tutorial series on Designing a new interface.
Adding support for collection groups
If you edited web/sites/<sitename>/groupConfig.xml to set up collection groups, then you can add support for them in the perrin Greenstone3 interface by editing web/interfaces/perrin/transform/pages/home.xsl as follows:
1. Change:
<div id="hpage_cats"> <xsl:call-template name="collectionsList"/> </div>
to:
<div id="hpage_cats"> <!--<xsl:call-template name="collectionsList"/>--> <xsl:call-template name="collectionsOrGroupsList"/> </div>
2. Before the terminating </xsl:stylesheet> add:
<xsl:template name="collectionsOrGroupsList">
<xsl:for-each select="./collectionList/collection|groupList/group">
<xsl:choose>
<xsl:when test="position() mod 2 = 1">
<div class="fl_left">
<xsl:call-template name="collOrGroupDescription"/>
</div>
</xsl:when>
<xsl:otherwise>
<div class="fl_right">
<xsl:call-template name="collOrGroupDescription"/>
</div>
<br class="clear" />
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="collOrGroupDescription">
<xsl:if test="name() = 'group'">
<xsl:call-template name="customGroupDescription"/><!--<gslib:groupLinkWithImage/>-->
</xsl:if>
<xsl:if test="name() = 'collection'">
<xsl:call-template name="collDescription"/><!--<gslib:collectionLinkWithImage/>-->
</xsl:if>
</xsl:template>
<!-- Modified version of <gslib:groupLinkWithImage/> for customising perrin interface -->
<xsl:template name="customGroupDescription">
<xsl:variable name="short"><xsl:value-of select="shortDescription"/></xsl:variable>
<xsl:variable name="desc"><xsl:value-of select="description"/></xsl:variable>
<xsl:variable name="group_href"><xsl:value-of select="$library_name"/>/group/<xsl:if test="/page/pageRequest/paramList/param[@name='group']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='group']/@value"/>/</xsl:if><xsl:value-of select="@name"/></xsl:variable>
<!-- creates a header that links to the collection's about page -->
<!--group: <xsl:value-of select="@name"/>-->
<h2>
<a href="{$group_href}" title="{$short}">
<xsl:choose>
<xsl:when test="boolean(title)">
<xsl:value-of select="title"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</a>
</h2>
<!-- if there is an image for this group, this is displayed -->
<xsl:choose>
<xsl:when test="util:checkFileExistence($site_name, backgroundImage)">
<img class="groupLinkImage">
<xsl:attribute name="alt"><xsl:value-of select="@name"/></xsl:attribute>
<xsl:attribute name="src">sites/<xsl:value-of select="$site_name"/>/<xsl:value-of select="backgroundImage"/></xsl:attribute>
<xsl:attribute name="height">200px</xsl:attribute>
<xsl:attribute name="style">float:right</xsl:attribute>
</img>
</xsl:when>
</xsl:choose>
<div style="clear:right">
<xsl:choose>
<!-- If the group has a description - display it -->
<xsl:when test="$desc">
<p class="justify"><xsl:value-of select="$desc" disable-output-escaping="yes"/></p>
</xsl:when>
<!-- If no group description - repeat group name -->
<xsl:otherwise>
<p class="justify">Collection group: <xsl:value-of select="@name" disable-output-escaping="yes"/></p>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
en/user/expanding_on_gs3_customisation_tutorials.1599169002.txt.gz · Last modified: 2020/09/03 21:36 by anupama
