Changeset 5690


Ignore:
Timestamp:
2003-10-21T11:06:47+13:00 (21 years ago)
Author:
kjdon
Message:

changes to doc layout. title at top, click icon to link back to search/browse page. top node of toc now called table of contents, click icon to close toc, added expand doc and contents buttons

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/web/interfaces/default/transform/document.xsl

    r5431 r5690  
    44  xmlns:java="http://xml.apache.org/xslt/java"
    55  xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
     6  xmlns:gsf="http://www.greenstone.org/configformat"
    67  extension-element-prefixes="java util"
    7   exclude-result-prefixes="java util">
     8  exclude-result-prefixes="java util gsf">
    89
    910  <xsl:include href="style.xsl"/>
     
    3435  <xsl:template match="pageResponse">
    3536    <xsl:variable name="collName"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
    36     <!--<center>-->
    37       <xsl:call-template name="standardPageBanner">
    38     <xsl:with-param name="collName" select="$collName"/>
    39       </xsl:call-template>
     37    <xsl:call-template name="standardPageBanner">
     38      <xsl:with-param name="collName" select="$collName"/>
     39    </xsl:call-template>
    4040    <xsl:call-template name="navigationBar">
    4141      <xsl:with-param name="collName" select="$collName"/>
    4242    </xsl:call-template>     
    43 <!--      <xsl:call-template name="dividerBar"/>-->
    44       <!-- display the document -->
    45       <xsl:apply-templates select="document">
    46     <xsl:with-param name="collName" select="$collName"/>
    47       </xsl:apply-templates>
    48    <!-- </center>-->
    49    
     43    <!-- display the document -->
     44    <xsl:apply-templates select="document">
     45      <xsl:with-param name="collName" select="$collName"/>
     46    </xsl:apply-templates>
    5047    <xsl:call-template name="dividerBar"/>
    5148  </xsl:template>
     
    5350  <xsl:template match="document">
    5451    <xsl:param name="collName"/>
    55     <p/>
    5652    <xsl:call-template name="documentHeading">
    5753      <xsl:with-param name="collName" select="$collName"/>
    5854    </xsl:call-template>
    59     <p/>
    6055    <xsl:call-template name="documentContent">
    6156      <xsl:with-param name="collName" select="$collName"/>
     
    6560  <xsl:template name="documentHeading">
    6661    <xsl:param name="collName"/>
    67     <table width="100%" cellpadding="0" cellspacing="0">
     62    <xsl:variable name="doCoverImage" select="/page/pageResponse/format/gsf:option[@name='coverImages']/@value"/>
     63    <xsl:variable name="doTOC" select="/page/pageResponse/format/gsf:option[@name='TOC']/@value"/>
     64    <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
     65    <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
     66    <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
     67   
     68    <table><tr><td>
     69      <a href="{$library_name}?a={$p.a}&amp;sa={$p.sa}&amp;s={$p.s}&amp;c={$collName}&amp;rt=r"><xsl:call-template name="openbookimg"><xsl:with-param name="title">Close this book and return to search/browse</xsl:with-param>
     70      </xsl:call-template></a></td>
     71    <td valign='top'><b><font size="+1">&#160;<xsl:value-of disable-output-escaping="yes" select="documentNode/metadataList/metadata[@name='Title']"/></font></b></td>
     72      </tr></table>
     73
     74    <table cellpadding="10" cellspacing="0">
    6875      <tr>
    69     <td valign="top" align="left" width="200">
    70       <xsl:call-template name="coverImage"/>
    71       <p/>
    72       <xsl:call-template name="enrichServices">
     76    <td valign="top" align="left">
     77      <xsl:if test="string($doCoverImage) != 'false' and (@docType='paged' or @docType='hierarchy')">
     78        <xsl:call-template name="coverImage"/>
     79        <p/>
     80      </xsl:if>
     81     
     82      <xsl:call-template name="documentButtons">
    7383        <xsl:with-param name="collName" select="$collName"/>
    7484      </xsl:call-template>
     85      <!--<xsl:call-template name="enrichServices">
     86        <xsl:with-param name="collName" select="$collName"/>
     87      </xsl:call-template>-->
    7588    </td>
    76     <td valign="top">
    77       <xsl:call-template name="TOC">
    78         <xsl:with-param name="collName" select="$collName"/>
    79       </xsl:call-template>
    80     </td>
     89    <xsl:if test="string($doTOC) != 'false'">
     90      <td valign="top" align="left">
     91        <xsl:call-template name="TOC">
     92          <xsl:with-param name="collName" select="$collName"/>
     93        </xsl:call-template>
     94      </td>
     95    </xsl:if>
    8196      </tr>
    8297    </table>
     
    85100  <xsl:template name="coverImage">
    86101    <img><xsl:attribute name='src'><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg</xsl:attribute></img>
     102  </xsl:template>
     103
     104  <xsl:template name="documentButtons">
     105    <xsl:param name="collName"/>
     106    <xsl:variable name="docID" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
     107    <xsl:variable name="sib" select="/page/pageRequest/paramList/param[@name='sib']/@value"/>
     108    <xsl:variable name="ec" select="/page/pageRequest/paramList/param[@name='ec']/@value"/>
     109    <xsl:variable name="et" select="/page/pageRequest/paramList/param[@name='et']/@value"/>
     110    <table>
     111      <tr><td xsl:use-attribute-sets="td-brownbutton">
     112      <xsl:choose><xsl:when test="string($et)='1'">
     113          <a style="text-decoration:none" href="{$library_name}?a=d&amp;d={$docID}&amp;c={$collName}&amp;sib={$sib}&amp;et=0"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.contract_text_tip')"/></xsl:attribute>
     114        <b><font color='{$colour-button-text}'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.contract_text_b')"/></font></b>
     115          </a>
     116        </xsl:when>
     117        <xsl:otherwise>
     118      <a style="text-decoration:none" href="{$library_name}?a=d&amp;d={$docID}&amp;c={$collName}&amp;sib={$sib}&amp;et=1"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.expand_text_tip')"/></xsl:attribute>
     119        <b><font color='{$colour-button-text}'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.expand_text_b')"/></font></b>
     120      </a>
     121        </xsl:otherwise>
     122      </xsl:choose>
     123    </td></tr>
     124      <tr><td xsl:use-attribute-sets="td-brownbutton">
     125      <xsl:choose><xsl:when test="string($ec)='1'">
     126          <a style="text-decoration:none" href="{$library_name}?a=d&amp;d={$docID}&amp;c={$collName}&amp;sib={$sib}&amp;ec=0"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.contract_contents_tip')"/></xsl:attribute>
     127        <b><font color='{$colour-button-text}'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.contract_contents_b')"/></font></b>
     128          </a>
     129        </xsl:when>
     130        <xsl:otherwise>
     131          <a style="text-decoration:none" href="{$library_name}?a=d&amp;d={$docID}&amp;c={$collName}&amp;sib={$sib}&amp;ec=1"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.expand_contents_tip')"/></xsl:attribute>
     132        <b><font color='{$colour-button-text}'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.expand_contents_b')"/></font></b>
     133          </a>
     134        </xsl:otherwise>
     135      </xsl:choose>
     136    </td></tr>
     137      <tr><td xsl:use-attribute-sets="td-brownbutton">Detach Page</td></tr>
     138    </table>
    87139  </xsl:template>
    88140
     
    100152    </xsl:call-template>
    101153      </xsl:when>
    102       <xsl:otherwise>
    103     <!-- just print the title of teh one and only docNode -->
    104     <xsl:value-of disable-output-escaping="yes" select="documentNode/metadataList/metadata[@name='Title']"/>
    105       </xsl:otherwise>
    106154    </xsl:choose>
    107155  </xsl:template>
    108  
     156   
    109157  <xsl:template name="hierarchicalContents">
    110158    <xsl:param name="collName"/>
    111     <xsl:apply-templates select="documentNode[@nodeID]">
    112       <xsl:with-param name="collName" select="$collName"/>
    113       <xsl:with-param name="depth" select="0"/>
    114     </xsl:apply-templates>
    115   </xsl:template>
    116  
     159    <xsl:variable name="oc" select="/page/pageRequest/paramList/param[@name='oc']/@value"/>
     160    <xsl:variable name="d" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
     161    <xsl:variable name="sib" select="/page/pageRequest/paramList/param[@name='sib']/@value"/>
     162    <xsl:if test="documentNode[@nodeID]">
     163      <table>
     164    <tr valign='top'><td>
     165        <xsl:choose><xsl:when test="string($oc)='0'">
     166        <a href="{$library_name}?a=d&amp;c={$collName}&amp;d={$d}&amp;sib={$sib}&amp;oc=1"><xsl:call-template name="closedfolderimg"><xsl:with-param name="title">open the table of contents</xsl:with-param></xsl:call-template></a>
     167          </xsl:when>
     168          <xsl:otherwise><a href="{$library_name}?a=d&amp;c={$collName}&amp;d={$d}&amp;sib={$sib}&amp;oc=0"><xsl:call-template name="openfolderimg"><xsl:with-param name="title">close the table of contents</xsl:with-param></xsl:call-template></a></xsl:otherwise></xsl:choose>
     169      </td><td>Table of Contents</td></tr>
     170    <xsl:if test="string($oc)!='0'">
     171      <tr><td></td><td>
     172          <table>
     173        <xsl:for-each select="documentNode/documentNode[@nodeID]">
     174          <xsl:apply-templates select='.'><xsl:with-param name="collName" select="$collName"/></xsl:apply-templates>
     175        </xsl:for-each>
     176          </table>
     177        </td></tr>
     178    </xsl:if>
     179      </table>
     180    </xsl:if>
     181  </xsl:template>
     182 
     183  <!-- each icon-title pair is a row in a table. children go in a table in another row -->
    117184  <xsl:template match="documentNode">
    118185    <xsl:param name="collName"/>
    119     <xsl:param name="depth"/>
    120     <xsl:variable name="space" select="$depth * 25"/>
    121    
    122     <table>
    123       <tr valign="top">
    124     <td>
    125       <xsl:if test="not($depth = '0')">
    126         <img src="interfaces/default/images/tocspace.gif" width="{$space}"/>
    127       </xsl:if>
    128     </td>
    129    
    130     <!-- Display the appropriate image, depending on the node type -->
    131     <td valign="top">
    132       <a><xsl:attribute name="href"><xsl:value-of select='$library_name'/>?a=d&amp;c=<xsl:value-of select='$collName'/>&amp;d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if><xsl:if test="@nodeType='leaf'">&amp;sib=1</xsl:if></xsl:attribute>
    133         <xsl:apply-templates select="." mode="displayNodeIcon"/>
    134       </a>
    135     </td>
    136    
    137     <!-- Display associated title, bolded if the node has content -->
    138     <td valign="top">
    139       <xsl:choose>
    140         <xsl:when test="nodeContent">
    141           <b><xsl:value-of  disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></b>
    142         </xsl:when>
    143         <xsl:otherwise>
    144           <xsl:value-of  disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
    145         </xsl:otherwise>
    146       </xsl:choose>
    147     </td>
    148       </tr>
    149     </table>   
     186    <!-- Display the appropriate image, depending on the node type -->
     187    <tr><td valign="top">
     188    <a><xsl:attribute name="href"><xsl:value-of select='$library_name'/>?a=d&amp;c=<xsl:value-of select='$collName'/>&amp;d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if><xsl:if test="@nodeType='leaf'">&amp;sib=1</xsl:if></xsl:attribute>
     189      <xsl:apply-templates select="." mode="displayNodeIcon"/>
     190    </a>
     191      </td>
     192     
     193      <!-- Display associated title, bolded if the node has content -->
     194      <td valign="top">
     195    <xsl:choose>
     196      <xsl:when test="nodeContent">
     197        <b><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></b>
     198      </xsl:when>
     199      <xsl:otherwise>
     200        <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
     201      </xsl:otherwise>
     202    </xsl:choose>
     203      </td>
     204    </tr>
    150205    <!-- Apply recursively to the children of this node -->
    151     <xsl:apply-templates select="documentNode[@nodeID]">
    152       <xsl:with-param name="collName" select="$collName"/>
    153       <xsl:with-param name="depth" select="$depth + 1"/>
    154     </xsl:apply-templates>
    155   </xsl:template>
    156  
    157 
     206    <xsl:if test="documentNode[@nodeID]">
     207      <tr><td></td><td><table>
     208        <xsl:apply-templates select="documentNode[@nodeID]">
     209          <xsl:with-param name="collName" select="$collName"/>
     210          <!--<xsl:with-param name="depth" select="$depth + 1"/>-->
     211        </xsl:apply-templates>
     212      </table>
     213    </td></tr>
     214    </xsl:if>
     215  </xsl:template>
     216 
    158217  <!-- default content is to process any nodeContent elements and print out their text -->
    159218  <xsl:template name="documentContent">
     
    165224  <xsl:template match="nodeContent">
    166225    <p/>
    167     <table width="100%" cellpadding="0" cellspacing="0">
    168       <tr>
    169     <td align="left">
    170       <xsl:for-each select="node()">
    171         <xsl:choose>
    172           <xsl:when test="not(name())"><xsl:value-of select="." disable-output-escaping="yes"/></xsl:when>
    173           <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
    174         </xsl:choose>
    175       </xsl:for-each>
    176     </td>
    177       </tr>
    178     </table>
     226    <xsl:for-each select="node()">
     227      <xsl:choose>
     228    <xsl:when test="not(name())"><xsl:value-of select="." disable-output-escaping="yes"/></xsl:when>
     229    <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
     230      </xsl:choose>
     231    </xsl:for-each>
    179232  </xsl:template>
    180233 
    181234  <!-- match any link nodes -->
    182  
    183235  <xsl:template match="link">
    184236    <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
     
    202254    <span class="{@type}"><xsl:value-of disable-output-escaping="yes" select="."/></span>
    203255  </xsl:template>
    204 
    205 
    206  
     256 
    207257  <!-- paged naviagtion : INCOMPLETE!!-->
    208258  <xsl:template name="pagedContents">
Note: See TracChangeset for help on using the changeset viewer.