Ignore:
Timestamp:
2019-09-19T14:24:13+12:00 (5 years ago)
Author:
kjdon
Message:

if we are on a cross collection search page, the collection for each documentNode comes from collection attribute - not from a collection element in page response. also moved to gsf:variables to different template, so they can be declared once, not for each docNode

File:
1 edited

Legend:

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

    r33483 r33493  
    763763  -->
    764764  <xsl:template name="gotoFavourites">
     765    <!-- set up these gsf variables so we have access in javascript -->
     766    <gsf:variable name="selected_favourite_icon_url">interfaces/<xsl:value-of select="$interface_name"/>/images/<xsl:value-of select="$selected_favourite_icon"/></gsf:variable>
     767    <gsf:variable name="unselected_favourite_icon_url">interfaces/<xsl:value-of select="$interface_name"/>/images/<xsl:value-of select="$unselected_favourite_icon"/></gsf:variable>
    765768    <xsl:if test="$favouriteBasketOn">
    766769      <div id="berrybasket" class="hide">
     
    862865  <xsl:template name="documentBerryForClassifierOrSearchPage">
    863866    <xsl:if test="$berryBasketOn">
     867      <xsl:variable name="collname"><xsl:choose><xsl:when test="@collection"><xsl:value-of select="@collection"/></xsl:when><xsl:otherwise><xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:otherwise></xsl:choose></xsl:variable>
    864868      <img class="pick" src="interfaces/{$interface_name}/images/{$berry_icon}" alt="in basket" width="15" height="15" border="0">
    865         <xsl:attribute name="id"><xsl:value-of select="/page/pageResponse/collection/@name"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
     869        <xsl:attribute name="id"><xsl:value-of select="$collname"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
    866870      </img>
    867871    </xsl:if>
    868872  </xsl:template>
    869873
     874 
    870875  <xsl:template name="documentFavouriteForClassifierOrSearchPage">
    871 
    872     <gsf:variable name="selected_favourite_icon_url">interfaces/<xsl:value-of select="$interface_name"/>/images/<xsl:value-of select="$selected_favourite_icon"/></gsf:variable>
    873     <gsf:variable name="unselected_favourite_icon_url">interfaces/<xsl:value-of select="$interface_name"/>/images/<xsl:value-of select="$unselected_favourite_icon"/></gsf:variable>
    874 
    875876    <xsl:if test="$favouriteBasketOn">
     877     <xsl:variable name="collname"><xsl:choose><xsl:when test="@collection"><xsl:value-of select="@collection"/></xsl:when><xsl:otherwise><xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:otherwise></xsl:choose></xsl:variable>
    876878      <img src="interfaces/{$interface_name}/images/{$unselected_favourite_icon}" title="click to add to favourites" width="20" height="20" border="0" onclick="toggleFavourite(this)" data-is-favourite="false">
    877         <xsl:attribute name="id"><xsl:value-of select="/page/pageResponse/collection/@name"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
     879        <xsl:attribute name="id"><xsl:value-of select="$collname"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
    878880      </img>
    879881    </xsl:if>
Note: See TracChangeset for help on using the changeset viewer.