Changeset 5134


Ignore:
Timestamp:
2003-08-13T12:29:37+12:00 (21 years ago)
Author:
kjdon
Message:

have modified the results navigation arrows. hits per page param will go onto teh preferences page (soon). the xslt will use a service specified hitsPerPage param if available otherwise use its own one. this affects which docs in the results list to display - if the service is doing the paging, we display all teh results with possible some links - depends on teh numDocsMatched metadata. if teh interface is doing the paging, we have all tehresults, but only display part of them.

File:
1 edited

Legend:

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

    r5119 r5134  
    77  exclude-result-prefixes="java util">
    88
     9  <!-- have changed this so it uses service hitsPerPage and startPage if available, otherwise uses interface ones -->
    910  <xsl:template name="resultNavigation">
    10     <xsl:variable name="hp"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='hp']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='hp']/@value"/></xsl:when><xsl:otherwise>20</xsl:otherwise></xsl:choose></xsl:variable>
    11     <xsl:if test="not($hp=-1)">
    12       <xsl:variable name="hn"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='hn']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='hn']/@value"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:variable>
     11    <xsl:variable name="param-list" select="/page/pageRequest/paramList"/>
     12    <!-- hits per page -->
     13    <xsl:variable name="hpp">
     14      <xsl:choose>
     15    <xsl:when test="$param-list/param[@name='s1.hitsPerPage']"><xsl:value-of select="$param-list/param[@name='s1.hitsPerPage']/@value"/></xsl:when>
     16    <xsl:when test="$param-list/param[@name='hitsPerPage']"><xsl:value-of select="$param-list/param[@name='hitsPerPage']/@value"/></xsl:when>
     17    <xsl:otherwise>20</xsl:otherwise>
     18      </xsl:choose>
     19    </xsl:variable>
     20    <!-- hits type -->
     21    <xsl:variable name='ht'>
     22      <xsl:choose>
     23    <xsl:when test="$param-list/param[@name='s1.hitsPerPage']">s</xsl:when>
     24    <xsl:otherwise>i</xsl:otherwise>
     25      </xsl:choose>
     26    </xsl:variable>
     27    <!-- total docs -->
     28    <xsl:variable name="td">
     29      <xsl:choose>
     30    <xsl:when test="$ht='s'">
     31      <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name='numDocsMatched']/@value"/>
     32    </xsl:when>
     33    <xsl:otherwise>
     34      <xsl:value-of select="count(/page/pageResponse/documentNodeList/documentNode)"/>
     35    </xsl:otherwise>
     36      </xsl:choose>
     37    </xsl:variable>
     38    <!-- only continue if hpp != -1 and td > hpp -->
     39    <xsl:if test="not($hpp=-1) and $td &gt; $hpp">
     40      <!-- start page -->
     41      <xsl:variable name="here">
     42    <xsl:choose>
     43      <xsl:when test="$param-list/param[@name='s1.startPage']"><xsl:value-of select="$param-list/param[@name='s1.startPage']/@value"/></xsl:when>
     44      <xsl:when test="$param-list/param[@name='startPage']"><xsl:value-of select="$param-list/param[@name='startPage']/@value"/></xsl:when>
     45      <xsl:otherwise>1</xsl:otherwise>
     46    </xsl:choose>
     47      </xsl:variable>
    1348      <xsl:variable name="sa" select="/page/pageRequest/@subaction"/>
    14       <xsl:variable name="prev" select="$hn - 1"/>
    15       <xsl:variable name="next" select="$hn + 1"/>
    16       <xsl:variable name="count" select="count(documentNodeList/documentNode)"/>
     49      <xsl:variable name="service" select="$param-list/param[@name='s']/@value"/>
     50      <xsl:variable name="prev" select="$here - 1"/>
     51      <xsl:variable name="next" select="$here + 1"/>
     52      <xsl:variable name="page-param"><xsl:if test="$ht='s'">s1.</xsl:if>startPage</xsl:variable>
    1753      <p />
    1854      <center>
    19     <table cellspacing='0' cellpadding='0' width='537'>
     55    <table cellspacing='0' cellpadding='0' width='70%'>
    2056      <tr>
    2157        <td align='left'>
    22           <xsl:if test="$hn &gt; 1"><a href="{$library_name}?a=q&amp;rt=r&amp;hn={$prev}"><img src="interfaces/default/images/less.gif" width='30' height='16' border='0' align='top'/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.matches')"/><xsl:text> </xsl:text><xsl:value-of select="number(($prev - 1)*$hp + 1)"/> - <xsl:value-of select="number(($prev * $hp))"/></a></xsl:if>
     58          <xsl:if test="$here &gt; 1"><a href="{$library_name}?a=q&amp;sa={$sa}&amp;s={$service}&amp;rt=r&amp;{$page-param}={$prev}"><img src="interfaces/default/images/less.gif" width='30' height='16' border='0' align='top'/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.matches')"/><xsl:text> </xsl:text><xsl:value-of select="number(($prev - 1)*$hpp + 1)"/> - <xsl:value-of select="number(($prev * $hpp))"/></a></xsl:if>
    2359        </td>
    2460        <td align='right'>
    25           <xsl:if test="(($hn * $hp) + 1)  &lt; $count">
    26         <xsl:variable name='m' select="number($next * $hp)"/>
    27         <xsl:variable name='mm'><xsl:choose><xsl:when test="$m &lt; $count"><xsl:value-of select='$m'/></xsl:when><xsl:otherwise><xsl:value-of select='$count'/></xsl:otherwise></xsl:choose></xsl:variable>
    28         <a href="{$library_name}?a=q&amp;sa={$sa}&amp;rt=r&amp;hn={$next}"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.matches')"/><xsl:text> </xsl:text><xsl:value-of select="number(($next - 1)*$hp + 1)"/> - <xsl:value-of select="$mm"/><img src="interfaces/default/images/more.gif" width='30' height='16' border='0' align='top'/></a></xsl:if></td> </tr>
     61          <xsl:if test="(($here * $hpp) + 1)  &lt; $td">
     62        <xsl:variable name='m' select="number($next * $hpp)"/>
     63        <xsl:variable name='mm'><xsl:choose><xsl:when test="$m &lt; $td"><xsl:value-of select='$m'/></xsl:when><xsl:otherwise><xsl:value-of select='$td'/></xsl:otherwise></xsl:choose></xsl:variable>
     64        <a href="{$library_name}?a=q&amp;sa={$sa}&amp;s={$service}&amp;rt=r&amp;{$page-param}={$next}"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.matches')"/><xsl:text> </xsl:text><xsl:value-of select="number(($next - 1)*$hpp + 1)"/> - <xsl:value-of select="$mm"/><img src="interfaces/default/images/more.gif" width='30' height='16' border='0' align='top'/></a></xsl:if></td> </tr>
    2965    </table>
    3066      </center>
     
    3874    <xsl:param name="collName"/>
    3975    <td>
    40       <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="@nodeType='leaf'">&amp;sib=1</xsl:if>&amp;dt=<xsl:value-of select='@docType'/></xsl:attribute>
     76      <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="@nodeType='leaf'">&amp;sib=1</xsl:if>&amp;dt=<xsl:value-of select='@docType'/></xsl:attribute>
    4177    <xsl:apply-templates select="." mode="displayNodeIcon"/>
    4278      </a>
     
    4480    <td><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></td>
    4581  </xsl:template>
    46  
    47 <!--
    48   <xsl:template name="greenBarResults">
    49     <table width='100%' border="0" cellpadding="0" cellspacing="0">
    50       <tr><td width='100%' height='17' background='interfaces/default/images/divb.gif' valign='bottom'><font size="+1" color="black"><b>Results</b></font></td></tr></table>
    51   </xsl:template>
    52  
    53  
    54   <xsl:template name="greenBarResultsold">
    55     <p/>
    56  
    57       <img src="interfaces/default/images/qryresb.gif" width="100%" height="17"/>
    58    
    59   </xsl:template>
    60   -->
     82
    6183  <xsl:template name="termInfo">
    6284    <xsl:if test="count(termList/term) > 0">
     
    90112  </xsl:template>
    91113
     114
    92115  <xsl:template name="resultList">
    93116    <xsl:param name="collName"/>
    94     <xsl:variable name="hp"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='hp']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='hp']/@value"/></xsl:when><xsl:otherwise>20</xsl:otherwise></xsl:choose></xsl:variable>
    95     <xsl:variable name="hn" select="/page/pageRequest/paramList/param[@name='hn']/@value"/>     
    96     <table>
    97       <tr valign="top">
    98     <xsl:for-each select="documentNodeList/documentNode">
    99       <xsl:if test="$hp=-1 or (position()&gt; (($hn - 1)*$hp) and position() &lt;= ($hn * $hp))">
     117    <xsl:variable name="param-list" select="/page/pageRequest/paramList"/>
     118    <!-- hits per page -->
     119    <xsl:variable name="hpp">
     120      <xsl:choose>
     121    <xsl:when test="$param-list/param[@name='s1.hitsPerPage']"><xsl:value-of select="$param-list/param[@name='s1.hitsPerPage']/@value"/></xsl:when>
     122    <xsl:when test="$param-list/param[@name='hitsPerPage']"><xsl:value-of select="$param-list/param[@name='hitsPerPage']/@value"/></xsl:when>
     123    <xsl:otherwise>20</xsl:otherwise>
     124      </xsl:choose>
     125    </xsl:variable>
     126    <xsl:choose>
     127      <xsl:when test="$param-list/param[@name='s1.hitsPerPage'] or $hpp=-1">
     128    <!-- the service has handled the paging, just output all the docs -->
     129    <table>
     130      <xsl:for-each select="documentNodeList/documentNode">
    100131        <tr>
    101132          <xsl:apply-templates select=".">
    102133        <xsl:with-param name="collName" select="$collName"/>
    103134          </xsl:apply-templates>
    104         </tr>
    105       </xsl:if>
    106     </xsl:for-each>
    107       </tr>
    108     </table>
     135        </tr>       
     136      </xsl:for-each>
     137    </table>
     138      </xsl:when>
     139      <xsl:otherwise>
     140    <!-- we have done the paging, only show a selection of the docs -->
     141    <!-- start page -->
     142    <xsl:variable name="sp">
     143      <xsl:choose>
     144        <xsl:when test="$param-list/param[@name='s1.startPage']"><xsl:value-of select="$param-list/param[@name='s1.startPage']/@value"/></xsl:when>
     145        <xsl:when test="$param-list/param[@name='startPage']"><xsl:value-of select="$param-list/param[@name='startPage']/@value"/></xsl:when>
     146        <xsl:otherwise>1</xsl:otherwise>
     147      </xsl:choose>
     148    </xsl:variable>
     149    <table>
     150      <xsl:for-each select="documentNodeList/documentNode">
     151        <xsl:if test=" (position()&gt; (($sp - 1)*$hpp) and position() &lt;= ($sp * $hpp))">
     152          <tr>
     153        <xsl:apply-templates select=".">
     154          <xsl:with-param name="collName" select="$collName"/>
     155        </xsl:apply-templates>
     156          </tr>
     157        </xsl:if>
     158      </xsl:for-each>
     159    </table>
     160      </xsl:otherwise>
     161    </xsl:choose>
    109162  </xsl:template>
    110163
Note: See TracChangeset for help on using the changeset viewer.