Changeset 29400

Show
Ignore:
Timestamp:
22.10.2014 12:44:04 (5 years ago)
Author:
kjdon
Message:

simple docs may have a cover image, eg a text file with a picture associated. And text files may want to have highlighting options. cleaned up the viewoptions so that we don't get hidden list items. don't output the list item if its not appropriate for the doc type.

Files:
1 modified

Legend:

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

    r29319 r29400  
    1313        <xsl:choose> 
    1414          <xsl:when test="@docType = 'simple'"> 
    15         <xsl:text>  </xsl:text> 
     15        <xsl:for-each select="."> 
     16          <xsl:call-template name="displayCoverImage"/> 
     17        </xsl:for-each> 
     18        <xsl:call-template name="viewOptions"/> 
     19        <!--<xsl:text>  </xsl:text>--> 
    1620          </xsl:when> 
    1721        <xsl:otherwise> 
    18           <xsl:call-template name="displayCoverImage"/> 
     22          <xsl:for-each select="documentNode[1]"> 
     23        <xsl:call-template name="displayCoverImage"/> 
     24          </xsl:for-each> 
    1925          <xsl:call-template name="viewOptions"/> 
    2026          <xsl:call-template name="displayTOC"/> 
     
    2430    </xsl:template> 
    2531     
     32    <!-- this is called in the context of the top level node with the metadataList. For a simple doc, this is the document node. For a comples document, this is the first documentNode hcild of the document node. --> 
    2633    <xsl:template name="displayCoverImage"> 
    27         <!-- Need to be in the context of the top-level documentNode rather than the document for the gsf:metadata call to work --> 
    28         <xsl:for-each select="documentNode"> 
    29             <xsl:variable name="hasCover"><gsf:metadata name="hascover"/></xsl:variable> 
    30             <xsl:if test="$hasCover = '1' and (not(/page/pageResponse/format[@type='display']/gsf:option[@name='coverImage']) or /page/pageResponse/format[@type='display']/gsf:option[@name='coverImage']/@value='true')"> 
    31                 <!-- the book's cover image --> 
    32                 <div id="coverImage"> 
    33                     <img> 
    34                         <xsl:attribute name="src"><xsl:value-of select="$httpPath"/>/index/assoc/<gsf:metadata name="assocfilepath"/>/cover.jpg</xsl:attribute> 
    35                     </img><xsl:text> </xsl:text> 
    36                 </div> 
    37             </xsl:if> 
    38         </xsl:for-each> 
    39     </xsl:template> 
     34      <xsl:variable name="hasCover"><gsf:metadata name="hascover"/></xsl:variable> 
     35      <xsl:if test="$hasCover = '1' and (not(/page/pageResponse/format[@type='display']/gsf:option[@name='coverImage']) or /page/pageResponse/format[@type='display']/gsf:option[@name='coverImage']/@value='true')"> 
     36        <!-- the book's cover image --> 
     37        <div id="coverImage"> 
     38          <img> 
     39        <xsl:attribute name="src"><xsl:value-of select="$httpPath"/>/index/assoc/<gsf:metadata name="assocfilepath" pos="1"/>/cover.jpg</xsl:attribute> 
     40          </img><xsl:text> </xsl:text> 
     41        </div> 
     42      </xsl:if> 
     43    </xsl:template>  
    4044     
    4145    <xsl:template name="displayTOC"> 
     
    229233        <div id="viewAndZoomOptions" class="ui-state-default ui-corner-all"> 
    230234            <ul id="viewOptions"> 
    231                 <!-- Paged-image options --> 
     235                <!-- Paged-image document options --> 
     236                            <xsl:if test="count(//documentNode/metadataList/metadata[@name = 'Screen']) > 0 or /page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'"> 
     237                                <!-- view selection option --> 
    232238                <li id="pagedImageOptions"> 
    233                     <xsl:attribute name="style"> 
    234                         <xsl:choose> 
    235                             <xsl:when test="count(//documentNode/metadataList/metadata[@name = 'Screen']) > 0 or /page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'"> 
    236                             </xsl:when> 
    237                             <xsl:otherwise> 
    238                                 display:none; 
    239                             </xsl:otherwise> 
    240                         </xsl:choose> 
    241                     </xsl:attribute> 
    242239                    <select id="viewSelection" onchange="changeView();"> 
    243240                        <xsl:choose> 
     
    264261                <li id="slideShowOptions"> 
    265262                    <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.slideshowTooltip')"/></xsl:attribute> 
    266                     <xsl:attribute name="style"> 
    267                         <xsl:choose> 
    268                             <xsl:when test="count(//documentNode/metadataList/metadata[@name = 'Screen']) > 0 or /page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'"> 
    269                             </xsl:when> 
    270                             <xsl:otherwise> 
    271                                 display:none; 
    272                             </xsl:otherwise> 
    273                         </xsl:choose> 
    274                     </xsl:attribute> 
    275263                    <img onclick="showSlideShow()"> 
    276264                        <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'slideshow_image')"/></xsl:attribute> 
    277265                    </img> 
    278266                </li> 
    279              
     267                    </xsl:if>  
    280268                <!-- Realistic books link --> 
    281269                <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'"> 
     
    297285                        </img> 
    298286                        <input id="highlightOption" type="checkbox" class="optionCheckBox" onclick="swapHighlight(false);"> 
    299                             <xsl:if test="/page/pageRequest/paramList/param[@name = 'hl']/@value != 'off'"> 
     287                            <xsl:if test="not(/page/pageRequest/paramList/param[@name = 'hl']/@value = 'off')"> 
    300288                                <xsl:attribute name="checked">checked</xsl:attribute> 
    301289                            </xsl:if>