Changeset 31563

Show
Ignore:
Timestamp:
03.04.2017 10:34:37 (2 years ago)
Author:
kjdon
Message:

tidied up default templates for classifiers. added a new template classifierNodeLink to handle the logic of choosing which type or link the bookshelf should use - static, which opens a new page for that bookshelf, or javascript - uses the toggleSection method to open/close the section inplace. we are leaving bookshelves as static links to allow google to traverse the classifier and index all the documents

Location:
main/trunk/greenstone3/web/interfaces/default/transform
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/transform/config_format.xsl

    r31537 r31563  
    231231                    </xsl:if> 
    232232 
    233                     <xslt:attribute name='href'> 
    234                         <xslt:value-of select='$library_name'/> 
    235                         <xsl:text>/collection/</xsl:text> 
    236                         <xslt:value-of select='/page/pageResponse/collection/@name'/> 
    237                         <xsl:text>/browse/</xsl:text> 
    238                         <xsl:choose> 
    239                             <xsl:when test="@nodeID"> 
    240                                 <xsl:value-of select="@nodeID"/> 
    241                             </xsl:when> 
    242                             <xsl:otherwise> 
    243                                 <xslt:value-of select='util:replace(@nodeID, ".", "/")'/> 
    244                             </xsl:otherwise> 
    245                         </xsl:choose> 
     233                    <xslt:attribute name='href'><xslt:call-template name="classifierNodeLink"><xsl:if test="@style"><xslt:with-param name="link-type"><xsl:value-of select="@style"/></xslt:with-param></xsl:if><xsl:if test="@nodeID"><xslt:with-param name="node-id" select="@nodeID"/></xsl:if></xslt:call-template> 
    246234                    </xslt:attribute> 
    247235                    <xsl:copy-of select="$opt-title"/> 
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/classifier.xsl

    r31554 r31563  
    2222  <!-- optional cgi-params for links to document pages --> 
    2323  <xsl:variable name="opt-doc-link-args"></xsl:variable> 
     24 
    2425  <!-- the page content --> 
    2526  <xsl:template match="/page/pageResponse"> 
     
    154155            <xsl:if test="not(/page/pageResponse/format[@type='browse']/gsf:option[@name='turnstyleClassifiers']) or /page/pageResponse/format[@type='browse']/gsf:option[@name='turnstyleClassifiers']/@value='true'"> 
    155156              <td class="headerTD"> 
    156             <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">            
     157            <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon turnstyleicon">          
    157158              <xsl:attribute name="src"> 
    158159                <xsl:choose> 
     
    279280  --> 
    280281  <xsl:template match="classifierNode[@classifierStyle = 'HList']" > 
    281     <gsf:link type="classifier"> 
     282    <gsf:link type="classifier" style="static"> 
    282283      <xsl:value-of disable-output-escaping="yes"  select="metadataList/metadata[@name='Title']"/> 
    283284    </gsf:link> 
    284285  </xsl:template> 
    285286 
    286   <xsl:template match="classifierNode"><!-- priority="3"--> 
    287  
    288     <!--<table id="title{@nodeID}"><tbody><tr>--> 
     287  <xsl:template match="classifierNode"> 
    289288    <!-- Bookshelf icon --> 
    290289    <td> 
     290      <gsf:link type="classifier" style="static"> 
    291291      <img> 
    292292    <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'bookshelf_image')"/></xsl:attribute> 
    293293      </img> 
     294      </gsf:link> 
    294295    </td> 
    295296    <!-- Link title --> 
    296297    <td> 
    297       <a href="javascript:toggleSection('{@nodeID}');"> 
     298      <gsf:link type="classifier"> 
    298299    <xsl:value-of disable-output-escaping="yes"  select="metadataList/metadata[@name='Title']"/> 
    299       </a> 
    300     </td> 
    301     <!--</tr></tbody></table>--> 
    302      
    303     <!-- Show any documents or sub-groups in this group --> 
    304     <!--    <xsl:if test="documentNode|classifierNode"> 
    305     <div id="div{@nodeID}" class="classifierContainer"> 
    306     <table> 
    307     <xsl:for-each select="documentNode|classifierNode"> 
    308     <tr> 
    309     <xsl:apply-templates select="."/> 
    310     </tr> 
    311     </xsl:for-each> 
    312     </table> 
    313     </div> 
    314     </xsl:if>--> 
    315   </xsl:template> 
    316    
     300      </gsf:link> 
     301    </td> 
     302  </xsl:template> 
     303   
     304  <xsl:template name="classifierNodeLink"> 
     305    <xsl:param name="link-type">dynamic</xsl:param> 
     306    <xsl:param name="node-id"></xsl:param> 
     307    <xsl:variable name="final-link-type"> 
     308      <xsl:choose> 
     309    <xsl:when test="$link-type='static'">static</xsl:when> 
     310    <xsl:when test="$link-type='javascript'">javascript</xsl:when> 
     311    <xsl:when test="@classifierStyle = 'HList'">static</xsl:when> 
     312    <xsl:when test="not(/page/pageResponse/format[@type='browse']/gsf:option[@name='turnstyleClassifiers']) or /page/pageResponse/format[@type='browse']/gsf:option[@name='turnstyleClassifiers']/@value='true'">javascript</xsl:when> 
     313    <xsl:otherwise>static</xsl:otherwise> 
     314      </xsl:choose> 
     315    </xsl:variable> 
     316    <xsl:choose> 
     317      <xsl:when test="$final-link-type='static'"> 
     318    <xsl:value-of select='$library_name'/>/collection/<xsl:value-of select='/page/pageResponse/collection/@name'/>/browse/<xsl:choose><xsl:when test="$node-id"><xsl:value-of select="$node-id"/></xsl:when><xsl:otherwise><xsl:value-of select='util:replace(@nodeID, ".", "/")'/></xsl:otherwise></xsl:choose> 
     319      </xsl:when> 
     320      <xsl:otherwise>javascript:toggleSection('<xsl:value-of select="@nodeID"/>');</xsl:otherwise> 
     321    </xsl:choose>    
     322  </xsl:template> 
     323 
     324 
    317325  <xsl:template name="classifierPre"> 
    318326    <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'"> 
     
    335343  </xsl:template> 
    336344   
    337    
    338   <xsl:template name="bookshelfimg"> 
    339     <xsl:param name="alt"/> 
    340     <xsl:param name="title"/> 
    341     <img border="0" width="20" height="16" src="interfaces/default/images/bshelf.gif" alt="{$alt}" title="{$title}"/> 
    342   </xsl:template> 
    343  
    344  
    345345  <xsl:template match="/page/xsltparams"> 
    346346    <!-- suppress xsltparam block in page --> 
    347347  </xsl:template> 
    348348 
    349   <!-- is this ever used? copied from classifier tools and renamed xxxOld --> 
    350   <xsl:template match="documentNodeOld"> 
    351     <xsl:param name="collName"/> 
    352     <xsl:param name="serviceName"/> 
    353     <a href="{$library_name}?a=d&amp;c={$collName}&amp;d={@nodeID}&amp;dt={@docType}&amp;p.a=b&amp;p.s={$serviceName}"><xsl:apply-templates select="." mode="displayNodeIcon"/></a><xsl:value-of disable-output-escaping="yes"  select="metadataList/metadata[@name='Title']"/> 
    354   </xsl:template> 
    355    
    356    
    357   <!-- icon + title template--> 
    358   <!-- is this ever used??? copied from classifier tools and renamed xxxOld???  --> 
    359   <xsl:template match="classifierNodeOld"> 
    360     <xsl:param name="collName"/> 
    361     <xsl:param name="serviceName"/> 
    362     <a><xsl:attribute name='href'><xsl:value-of select='$library_name'/>?a=b&amp;rt=r&amp;s=<xsl:value-of select='$serviceName'/>&amp;c=<xsl:value-of select='$collName'/>&amp;cl=<xsl:value-of select='@nodeID'/><xsl:if test="classifierNode|documentNode">.pr</xsl:if></xsl:attribute><xsl:call-template name="bookshelfimg"/></a><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/> 
    363   </xsl:template> 
    364    
    365  
    366349</xsl:stylesheet> 
    367350