Changeset 37334 for main


Ignore:
Timestamp:
2023-02-20T12:31:14+13:00 (14 months ago)
Author:
kjdon
Message:

now we use (un)selected_favourite_icon_url everywhere, instead of building the path each time. This now comes from interface_default.properties, instead of having hte image name hard coded in gslib. This matches other image definitions, and allows easier customization for a new interface. Note, I needed to define the gsf:variables in a couple places. at the start of gslib, can't use gsf:variable here. gsf:variable neded to make the js variable

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

Legend:

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

    r37019 r37334  
    3030  <xsl:param name="documentbasket"/>
    3131  <xsl:param name="cookie_path"/>
    32   <xsl:variable name="unselected_favourite_icon">favourite-star-transparent-unselected32.png</xsl:variable>
    33   <xsl:variable name="selected_favourite_icon">favourite-star-transparent-selected32.png</xsl:variable>
    34 
     32
     33  <xsl:variable name="unselected_favourite_icon_url"><gsf:interfaceText name="favourite_star_image"/></xsl:variable>
     34  <xsl:variable name="selected_favourite_icon_url"><gsf:interfaceText name="favourite_star_selected_image"/></xsl:variable>
     35 
    3536  <!-- every pages ....................................................................... -->
    3637
     
    880881  -->
    881882  <xsl:template name="gotoFavourites">
    882    <xsl:if test="$favouriteBasketOn">
    883      <!-- set up these gsf variables so we have access in javascript -->
    884     <gsf:variable name="selected_favourite_icon_url">interfaces/<xsl:value-of select="$interface_name"/>/images/<xsl:value-of select="$selected_favourite_icon"/></gsf:variable>
    885     <gsf:variable name="unselected_favourite_icon_url">interfaces/<xsl:value-of select="$interface_name"/>/images/<xsl:value-of select="$unselected_favourite_icon"/></gsf:variable>     
    886       <div id="berrybasket" class="hide">
    887       <img src="interfaces/{$interface_name}/images/{$selected_favourite_icon}" title="click to add to favourites" width="16" height="16" border="0" />
     883    <xsl:if test="$favouriteBasketOn">
     884      <!-- set up these gsf variables so we have access in javascript -->
     885      <gsf:variable name="selected_favourite_icon_url"><gsf:interfaceText name="favourite_star_selected_image"/></gsf:variable>
     886      <gsf:variable name="unselected_favourite_icon_url"><gsf:interfaceText name="favourite_star_image"/></gsf:variable>
     887    <div id="berrybasket" class="hide"> 
     888      <img src="{$selected_favourite_icon_url}" width="16" height="16" border="0" />
    888889        <span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'favourites.title')"/><xsl:text> </xsl:text></span>
    889890    <span id="favouritesCountDisplay">...</span>
     
    987988    <xsl:if test="$favouriteBasketOn">
    988989     <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>
    989       <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">
     990      <img src="{$unselected_favourite_icon_url}" title="click to add to favourites" width="20" height="20" border="0" onclick="toggleFavourite(this)" data-is-favourite="false">
    990991        <xsl:attribute name="id"><xsl:value-of select="$collname"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
    991992      </img>
     
    10031004    <xsl:if test="$favouriteBasketOn">
    10041005      <div id="documentberries">
    1005         <img id="{/page/pageResponse/collection/@name}:{$rootNode}" src="interfaces/{$interface_name}/images/{$unselected_favourite_icon}" alt="in basket" width="15" height="15" border="0"/>
     1006        <img id="{/page/pageResponse/collection/@name}:{$rootNode}" src="{$unselected_favourite_icon_url}" alt="in basket" width="15" height="15" border="0"/>
    10061007        <span id="{/page/pageResponse/collection/@name}:{$rootNode}:root" class="documentberry">the whole document</span>
    10071008        <!--<xsl:if test="$selectedNode != $rootNode">
    1008           <img id="{/page/pageResponse/collection/@name}:{$selectedNode}" src="interfaces/{$interface_name}/images/{$unselected_favourite_icon}" alt="in basket" width="15" height="15" border="0"/>
     1009          <img id="{/page/pageResponse/collection/@name}:{$selectedNode}" src="{$unselected_favourite_icon_url}" alt="in basket" width="15" height="15" border="0"/>
    10091010          <span id="{/page/pageResponse/collection/@name}:{$selectedNode}:section" class="documentberry">the current section</span>
    10101011        </xsl:if>-->
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/favourites.xsl

    r36967 r37334  
    2020    <!-- the page content -->
    2121    <xsl:template match="/page">
    22       <gsf:variable name="selected_favourite_icon_url">interfaces/<xsl:value-of select="$interface_name"/>/images/<xsl:value-of select="$selected_favourite_icon"/></gsf:variable>
    23       <gsf:variable name="unselected_favourite_icon_url">interfaces/<xsl:value-of select="$interface_name"/>/images/<xsl:value-of select="$unselected_favourite_icon"/></gsf:variable>
    24 
     22          <!-- these two variables defined here, then used by javascript-->
     23          <gsf:variable name="selected_favourite_icon_url"><gsf:interfaceText name="favourite_star_selected_image"/></gsf:variable>
     24          <gsf:variable name="unselected_favourite_icon_url"><gsf:interfaceText name="favourite_star_image"/></gsf:variable>
    2525      <gslib:langfrag name="favourites"/>
    2626        <xsl:variable name="clusterName"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
Note: See TracChangeset for help on using the changeset viewer.