Changeset 33261

Show
Ignore:
Timestamp:
02.07.2019 12:01:22 (2 weeks ago)
Author:
davidb
Message:

XSL changes to support for either berries or favourites

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

Legend:

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

    r33253 r33261  
    2828 
    2929  <xsl:variable name="berry_icon">berry.png</xsl:variable> 
     30  <xsl:variable name="unselected_favourite_icon">favourite-star-transparent-unselected32.png</xsl:variable> 
     31  <xsl:variable name="selected_favourite_icon">favourite-star-transparent-selected32.png</xsl:variable> 
     32 
    3033  <!-- every pages ....................................................................... --> 
    3134 
     
    5457    <xsl:value-of select="/page/pageRequest/paramList/param[@name='berrybasket']/@value"/> 
    5558  </xsl:variable> 
     59  <xsl:variable name="favouritesbasketswitch"> 
     60    <xsl:value-of select="/page/pageRequest/paramList/param[@name='favouritesbasket']/@value"/> 
     61  </xsl:variable> 
    5662   
    5763  <xsl:variable name="berryBasketOn" select="/page/pageRequest/paramList/param[@name='berrybasket' and @value='on']"/> 
     64  <xsl:variable name="favouritesBasketOn" select="/page/pageRequest/paramList/param[@name='favouritesbasket' and @value='on']"/> 
    5865  <xsl:variable name="documentBasketOn" select="/page/pageRequest/paramList/param[@name='documentbasket' and @value='on']"/> 
    5966   
     
    750757  </xsl:template> 
    751758   
     759  <!-- 
     760      Goto Favourites Template 
     761      This gets used on many different pages to add the 
     762      goto favourites check-out functionality to the site 
     763  --> 
     764  <xsl:template name="gotoFavourites"> 
     765    <xsl:if test="$favouritesBasketOn"> 
     766      <div id="berrybasket" class="hide"> 
     767      <img src="interfaces/{$interface_name}/images/{$selected_favourite_icon}" title="click to add to favourites" width="16" height="16" border="0" /> 
     768        <span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'favourites.title')"/><xsl:text> </xsl:text></span> 
     769    <span id="favouritesCountDisplay">...</span> 
     770 
     771    <div><a id="favouritesFullViewLink" style="display: block;"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.full')"/></a></div> 
     772      </div> 
     773      <gsf:script> 
     774    //set url and show full view link 
     775        var fullView = YAHOO.util.Dom.get('favouritesFullViewLink'); 
     776    //Find the collection in the cgi parameters 
     777    var url = window.location.href; 
     778    var colstart = url.indexOf("&amp;c="); 
     779    var collectionName = ""; 
     780    if (colstart != -1) 
     781    { 
     782        var colend = url.indexOf("&amp;", (colstart + 1)); 
     783        if (colend == -1) 
     784        { 
     785            colend = url.length - 1; 
     786        } 
     787        collectionName = url.substring(colstart + 3, colend); 
     788    } 
     789     
     790    fullView.setAttribute("href",gs.xsltParams.library_name + "?a=g&amp;sa=berry&amp;c=&amp;s=DisplayList&amp;rt=r&amp;p.c=" + collectionName); 
     791        fullView.style.display='block'; 
     792 
     793      </gsf:script> 
     794    </xsl:if> 
     795  </xsl:template> 
     796   
     797 
     798 
     799 
    752800    <!-- put the drag&drop document basket on the page --> 
    753801    <xsl:template name="documentBasket"> 
     
    777825   
    778826  <!-- include the required javascript and css for berry baskets --> 
    779   <xsl:template name="berryBasketHeadTags"> 
     827  <xsl:template name="basketHeadTags"> 
    780828    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/yahoo-min.js"><xsl:text> </xsl:text></script> 
    781829    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/event-min.js"><xsl:text> </xsl:text></script> 
     
    815863    <xsl:if test="$berryBasketOn"> 
    816864      <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> 
     866      </img> 
     867    </xsl:if> 
     868  </xsl:template> 
     869 
     870  <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 
     875    <xsl:if test="$favouritesBasketOn"> 
     876      <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"> 
    817877        <xsl:attribute name="id"><xsl:value-of select="/page/pageResponse/collection/@name"/>:<xsl:value-of select="@nodeID"/></xsl:attribute> 
    818878      </img> 
     
    842902    </xsl:if> 
    843903  </xsl:template> 
     904 
     905  <xsl:template name="documentFavouriteForDocumentPage"> 
     906    <xsl:variable name="selectedNode"> 
     907      <xsl:value-of select="/page/pageResponse/document/@selectedNode"/> 
     908    </xsl:variable> 
     909    <xsl:variable name="rootNode"> 
     910      <xsl:value-of select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/> 
     911    </xsl:variable> 
     912    <xsl:if test="$favouritesBasketOn"> 
     913      <div id="documentberries"> 
     914        <img id="{/page/pageResponse/collection/@name}:{$rootNode}" src="interfaces/{$interface_name}/images/{$unselected_favourite_icon}" alt="in basket" width="15" height="15" border="0"/> 
     915        <span id="{/page/pageResponse/collection/@name}:{$rootNode}:root" class="documentberry">the whole document</span> 
     916        <!--<xsl:if test="$selectedNode != $rootNode"> 
     917          <img id="{/page/pageResponse/collection/@name}:{$selectedNode}" src="interfaces/{$interface_name}/images/{$berry_icon}" alt="in basket" width="15" height="15" border="0"/> 
     918          <span id="{/page/pageResponse/collection/@name}:{$selectedNode}:section" class="documentberry">the current section</span> 
     919        </xsl:if>--> 
     920      </div> 
     921    </xsl:if> 
     922  </xsl:template> 
    844923   
    845924  <!-- document page --> 
  • main/trunk/greenstone3/web/interfaces/default/transform/layouts/main.xsl

    r30567 r33261  
    4040                <!-- ***** in header.xsl ***** --> 
    4141                <xsl:call-template name="create-html-header"/> 
    42                 <xsl:call-template name="berryBasketHeadTags"/>  
     42                <xsl:call-template name="basketHeadTags"/>   
    4343            </head> 
    4444             
  • main/trunk/greenstone3/web/interfaces/default/transform/layouts/toc.xsl

    r32759 r33261  
    7676                <tr><td id="tdContentsArea"> 
    7777                    <div id="contentsArea">  
    78                         <!-- show the berry basket if it's turned on --> 
    79                         <xsl:call-template name="berryBasket"/> 
     78                            <!-- showing gotoFavourites display-area takes priority over berryBaskets --> 
     79                            <xsl:choose> 
     80                          <xsl:when test="/page/pageResponse/interfaceOptions/option[@name = 'favouritesBaskets']/@value = 'true'"> 
     81                            <!-- show the goto favourites if it's turned on --> 
     82                            <xsl:call-template name="gotoFavourites"/> 
     83                          </xsl:when> 
     84                          <xsl:otherwise> 
     85                            <!-- show the berry basket if it's turned on --> 
     86                            <xsl:call-template name="berryBasket"/> 
     87                          </xsl:otherwise> 
     88                        </xsl:choose> 
     89 
    8090                        <!-- add in expand and contract document links --> 
    8191                        <xsl:call-template name="expandContractDocumentLinks"/> 
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/berry.xsl

    r33255 r33261  
    55    xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil" 
    66    xmlns:gslib="http://www.greenstone.org/skinning" 
     7    xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"  
    78    extension-element-prefixes="java util" 
    89    exclude-result-prefixes="java util"> 
     
    1920    <!-- the page content --> 
    2021    <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 
    2125      <gslib:langfrag name="berry"/> 
    2226        <xsl:variable name="clusterName"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable> 
     
    5256            <div class="clear"><xsl:text> </xsl:text></div> 
    5357        </table> 
    54         <div id="delOptions"> 
    55         <input type="checkbox" name="selall-checkbox" id="select-all-checkbox" value="select-all" onclick="toggleSelectAll(this)"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.select_all')"/></input> 
    56         <input type="checkbox" name="delsel-checkbox" id="delete-selected-checkbox" value="delete-all" onclick="deleteSelected()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.delete_selected')"/></input> 
    57         <input type="checkbox" name="delall-checkbox" id="delete-all-checkbox" value="delete-all" onclick="deleteAll()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.delete_all')"/></input> 
     58 
     59        <div id="berryBasketContent"><span><xsl:text> </xsl:text></span></div> 
     60         
     61        <div id="delOptions">  
     62 
     63          <!-- showing favourites help text takes priority over berryBasket help text --> 
     64          <xsl:choose> 
     65            <xsl:when test="/page/pageResponse/interfaceOptions/option[@name = 'favouritesBaskets']/@value = 'true'"> 
     66              <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'favourites.delete_help')"/> <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'favourites.delete_else')"/><xsl:text>  </xsl:text> 
     67            </xsl:when> 
     68            <xsl:otherwise> 
     69              <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.delete_help')"/> <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.delete_else')"/><xsl:text>  </xsl:text> 
     70            </xsl:otherwise> 
     71          </xsl:choose> 
     72 
     73           
     74          <style> #bbdeleteallbutton:hover { background-color: #773030;}</style> 
     75          <div id="bbdeleteallbutton" class="ui-button ui-widget ui-state-default ui-corner-all"  
     76               style="color: white; padding: 5px;" onclick="deleteAll()"> 
     77            <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.delete_all')"/> 
     78          </div> 
    5879        </div> 
    59         <div id="berryBasketContent"><span><xsl:text> </xsl:text></span></div> 
    6080 
    6181    </xsl:template> 
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/classifier.xsl

    r33148 r33261  
    2929    <script type="text/javascript" src="interfaces/{$interface_name}/js/classifier_scripts.js"><xsl:text> </xsl:text></script> 
    3030    <script type="text/javascript">$(window).load(openStoredClassifiers);</script> 
    31      
    3231    <!-- this right sidebar --> 
    33     <xsl:if test="$berryBasketOn or ($documentBasketOn and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor)))"> 
     32    <xsl:if test="$berryBasketOn or $favouritesBasketOn or ($documentBasketOn and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor)))"> 
    3433      <div id="rightSidebar"> 
    3534    <xsl:if test="$berryBasketOn"> 
    3635      <!-- show the berry basket if it's turned on --> 
    3736      <gslib:berryBasket/> 
     37      <xsl:text> </xsl:text> 
     38    </xsl:if> 
     39 
     40    <xsl:if test="$favouritesBasketOn"> 
     41      <!-- show the favourites 'basket' if it's turned on --> 
     42      <gslib:gotoFavourites/> 
    3843      <xsl:text> </xsl:text> 
    3944    </xsl:if> 
     
    261266      <xsl:with-param name="serviceName" select="$serviceName"/> 
    262267    </xsl:apply-templates> 
    263     <!-- The berry (optional) --> 
    264     <td> 
    265       <xsl:call-template name="documentBerryForClassifierOrSearchPage"/> 
     268    <!-- The berry/favourite (optional) --> 
     269    <td valign="top"> 
     270      <xsl:if test="/page/pageResponse/interfaceOptions/option[@name = 'berryBaskets']/@value = 'true'"> 
     271    <xsl:call-template name="documentBerryForClassifierOrSearchPage"/> 
     272      </xsl:if> 
     273      <xsl:if test="/page/pageResponse/interfaceOptions/option[@name = 'favouritesBaskets']/@value = 'true'"> 
     274    <xsl:call-template name="documentFavouriteForClassifierOrSearchPage"/> 
     275      </xsl:if> 
     276 
    266277    </td> 
    267278    <xsl:call-template name="documentNodePost"/> 
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/pref.xsl

    r32548 r33261  
    5050     <!-- <xsl:call-template name="encoding-param"/>--> 
    5151      <xsl:call-template name="format-edit-param"/> 
    52     <xsl:call-template name="berry-basket-param"/> 
     52      <xsl:if test="/page/pageResponse/interfaceOptions/option[@name = 'berryBaskets']/@value = 'true'"> 
     53    <xsl:call-template name="berry-basket-param"/> 
     54      </xsl:if> 
     55      <xsl:if test="/page/pageResponse/interfaceOptions/option[@name = 'favouritesBaskets']/@value = 'true'"> 
     56    <xsl:call-template name="favourites-basket-param"/> 
     57      </xsl:if> 
    5358    <!--<xsl:call-template name="document-maker-param"/> not working at moment--> 
    5459    <xsl:call-template name="book-param"/> 
     
    166171                </div> 
    167172</xsl:template> 
     173 
     174 
     175<xsl:template name="favourites-basket-param"> 
     176                <div id="favouritesbasketprefs"> 
     177                    <xsl:variable name="favouritesbasket"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='favouritesbasket']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='favouritesbasket']/@value"/></xsl:when><xsl:otherwise>off</xsl:otherwise></xsl:choose></xsl:variable> 
     178                    <div class="paramLabel"> 
     179                        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.favouritesbasket')"/> 
     180                    </div> 
     181                    <div class="paramValue"> 
     182                        <select name="favouritesbasket"> 
     183                            <option value="on"><xsl:if test="$favouritesbasket='on'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.on')"/></option>  
     184                            <option value="off"><xsl:if test="$favouritesbasket='off'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.off')"/></option> 
     185                        </select> 
     186                    </div> 
     187                    <br class="clear"/> 
     188                </div> 
     189</xsl:template> 
     190 
    168191                <xsl:template name="document-maker-param"> 
    169192                <xsl:if test="/page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))"> 
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/query.xsl

    r33209 r33261  
    5959 
    6060    <xsl:template name="displayBaskets"> 
    61       <xsl:if test="$berryBasketOn or ($documentBasketOn and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor)))"> 
     61      <xsl:if test="$berryBasketOn or $favouritesBasketOn or ($documentBasketOn and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor)))"> 
    6262        <div id="rightSidebar"> 
    6363          <xsl:if test="$berryBasketOn"> 
     
    6666        <xsl:text> </xsl:text> 
    6767          </xsl:if> 
     68 
     69          <xsl:if test="$favouritesBasketOn"> 
     70        <!-- show the favourites 'basket' if it's turned on --> 
     71        <gslib:gotoFavourites/> 
     72        <xsl:text> </xsl:text> 
     73          </xsl:if> 
     74 
    6875          <xsl:if test="$documentBasketOn and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))"> 
    6976        <gslib:documentBasket/> 
     
    8693                    <tr id="div{@nodeID}" class="document"> 
    8794                        <xsl:apply-templates select="."/> 
    88                         <!-- The berry (optional) --> 
    89                         <td> 
    90                           <xsl:call-template name="documentBerryForClassifierOrSearchPage"/> 
     95                        <!-- The berry/favourite (optional) --> 
     96                        <td valign="top"> 
     97                          <xsl:if test="/page/pageResponse/interfaceOptions/option[@name = 'berryBaskets']/@value = 'true'"> 
     98                            <xsl:call-template name="documentBerryForClassifierOrSearchPage"/> 
     99                          </xsl:if> 
     100                          <xsl:if test="/page/pageResponse/interfaceOptions/option[@name = 'favouritesBaskets']/@value = 'true'"> 
     101                            <xsl:call-template name="documentFavouriteForClassifierOrSearchPage"/> 
     102                          </xsl:if> 
    91103                        </td> 
    92104                        <xsl:call-template name="highlightSnippet">