Changeset 24025


Ignore:
Timestamp:
2011-05-18T14:02:02+12:00 (13 years ago)
Author:
sjm84
Message:

Added the two requested lucene-specific skin updates (stop words and the sortBy option)

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

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/gs2/transform/query-common.xsl

    r20631 r24025  
    2727 
    2828  <!-- a special handling of the param list - we override the one in service-params -->
    29   <xsl:template match="paramList" priority='2'>     
    30     <span class="textselect">
    31       Search for
    32       <xsl:apply-templates select="param[@name='index']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='index']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates>
    33       <xsl:if test="param[@name='indexSubcollection']">
    34         of <xsl:apply-templates select="param[@name='indexSubcollection']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='indexSubcollection']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates>
    35       </xsl:if>
    36       <xsl:if test="param[@name='indexLanguage']">
    37         in <xsl:apply-templates select="param[@name='indexLanguage']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='indexLanguage']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates>
    38       </xsl:if>
     29  <xsl:template match="paramList" priority='2'> 
     30    <xsl:choose>
     31        <xsl:when test="/page/pageResponse/collection/@type = 'lucene'">
     32            <span class="textselect">
     33                Search in
     34                <xsl:apply-templates select="param[@name='index']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='index']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates>
     35                <xsl:if test="param[@name='indexSubcollection']">
     36                    of <xsl:apply-templates select="param[@name='indexSubcollection']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='indexSubcollection']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates>
     37                </xsl:if>
     38                <xsl:if test="param[@name='indexLanguage']">
     39                    in <xsl:apply-templates select="param[@name='indexLanguage']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='indexLanguage']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates>
     40                </xsl:if>
     41                <xsl:if test="param[@name='sortBy']">
     42                    , sorting results by <xsl:apply-templates select="param[@name='sortBy']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='sortBy']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates>
     43                </xsl:if>
    3944
    40       <xsl:if test="param[@name='level' and not(@type='invisible')]">
    41         at <xsl:apply-templates select="param[@name='level']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='level']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates> level
    42       </xsl:if>
     45                <xsl:call-template name='query_mode'/>
     46            </span>
     47        </xsl:when>
     48        <xsl:otherwise>
     49            <span class="textselect">
     50              Search for
     51              <xsl:apply-templates select="param[@name='index']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='index']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates>
     52              <xsl:if test="param[@name='indexSubcollection']">
     53                of <xsl:apply-templates select="param[@name='indexSubcollection']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='indexSubcollection']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates>
     54              </xsl:if>
     55              <xsl:if test="param[@name='indexLanguage']">
     56                in <xsl:apply-templates select="param[@name='indexLanguage']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='indexLanguage']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates>
     57              </xsl:if>
    4358
    44       <xsl:call-template name='query_mode'/>
     59              <xsl:if test="param[@name='level' and not(@type='invisible')]">
     60                at <xsl:apply-templates select="param[@name='level']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='level']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates> level
     61              </xsl:if>
    4562
    46     </span>
     63              <xsl:call-template name='query_mode'/>
     64
     65            </span>
     66        </xsl:otherwise>
     67    </xsl:choose>
    4768    <span class="querybox">
    4869      <xsl:call-template name="query-and-submit"/>
  • main/trunk/greenstone3/web/interfaces/oran/transform/pages/query.xsl

    r24009 r24025  
    6565                                        <xsl:apply-templates select="."><xsl:with-param name="ns" select="$ns"/></xsl:apply-templates>
    6666                                    </xsl:when>
    67                                     <xsl:when test="@name = 'sortBy' or @name = 'maxDocs'"></xsl:when>
     67                                    <xsl:when test="@name = 'maxDocs' or @name = 'hitsPerPage'"></xsl:when>
    6868                                    <xsl:otherwise>
    6969                                        <xsl:variable name="pvalue"><xsl:apply-templates select="." mode="calculate-default"><xsl:with-param name="ns" select="$ns"/></xsl:apply-templates></xsl:variable>
     
    9292                <!-- The list of search terms with their frequency and document count -->
    9393                <p class="termList">
    94                     <xsl:choose>
    95                         <!-- If there is only one or two search terms then show the expanded information -->
    96                         <xsl:when test="count(/page/pageResponse/termList/term) &lt; 3">
    97                             <xsl:for-each select="/page/pageResponse/termList/term">
     94                    <xsl:if test="count(/page/pageResponse/termList/stopword) &gt; 0">
     95                        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.common')"/><xsl:text> </xsl:text>
     96                    </xsl:if>
     97                   
     98                    <xsl:for-each select="/page/pageResponse/termList/stopword">
     99                        <span style="font-style:italic;"><xsl:value-of select="@name"/></span><xsl:text> </xsl:text>
     100                    </xsl:for-each>
     101                    <br /><br />
     102               
     103                    <xsl:for-each select="/page/pageResponse/termList/term">
     104                        <xsl:choose>
     105                            <!-- If there is only one or two search terms then show the expanded information -->
     106                            <xsl:when test="count(/page/pageResponse/termList/term) &lt; 3">
    98107                                <span style="font-style:italic;"><xsl:value-of select="@name"/></span>
    99108                                <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.occurs')"/><xsl:text> </xsl:text>
     
    118127                                </xsl:choose>
    119128                                <br />
    120                             </xsl:for-each>
    121                         </xsl:when>
    122                         <xsl:otherwise>
    123                             <xsl:for-each select="/page/pageResponse/termList/term">
     129                            </xsl:when>
     130                            <xsl:otherwise>
    124131                                <span style="font-style:italic;"><xsl:value-of select="@name"/></span> (<xsl:value-of select="@freq"/>)
    125                             </xsl:for-each>
    126                         </xsl:otherwise>
    127                     </xsl:choose>
     132                            </xsl:otherwise>
     133                        </xsl:choose>
     134                    </xsl:for-each>
    128135                </p>
    129136               
     
    207214        </xsl:variable>
    208215       
    209             <table id="searchResultNavTable"><tr>
    210                 <!-- Previous button -->
    211                 <td id="prevArrowTD">
    212                     <xsl:if test="$currentPage != 1">
    213                         <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/@subaction}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;startPage={$currentPage - 1}">
    214                             <img src="interfaces/oran/images/previous.png"/>
    215                         </a>
    216                     </xsl:if>
     216        <table id="searchResultNavTable"><tr>
     217            <!-- Previous button -->
     218            <td id="prevArrowTD">
     219                <xsl:if test="$currentPage != 1">
     220                    <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/@subaction}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;startPage={$currentPage - 1}">
     221                        <img src="interfaces/oran/images/previous.png"/>
     222                    </a>
     223                </xsl:if>
     224            </td>
     225            <td id="prevTD">
     226                <xsl:if test="$currentPage != 1">
     227                    <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/@subaction}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;startPage={$currentPage - 1}">Previous</a>
     228                </xsl:if>
     229            </td>
     230           
     231            <!-- Search result status bar (in english it reads "Displaying X to Y of Z documents") -->
     232            <xsl:if test="$docMax &gt; 0">
     233                <td id="searchResultsStatusBar">
     234                    <!-- "Displaying" -->
     235                    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.displaying')"/><xsl:text> </xsl:text>
     236                    <!-- "X" -->
     237                    <xsl:value-of select="($currentPage - 1) * $docsPerPage + 1"/>
     238                    <!-- "to" -->
     239                    <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.to')"/><xsl:text> </xsl:text>
     240                    <!-- "Y" -->
     241                    <xsl:choose>
     242                        <xsl:when test="($currentPage * $docsPerPage + 1) &gt; $docMax">
     243                            <xsl:value-of select="$docMax"/>
     244                        </xsl:when>
     245                        <xsl:otherwise>
     246                            <xsl:value-of select="$currentPage * $docsPerPage"/>
     247                        </xsl:otherwise>
     248                    </xsl:choose>
     249                    <!-- "of" -->
     250                    <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.of')"/><xsl:text> </xsl:text>
     251                    <!-- "Z" -->
     252                    <xsl:value-of select="$docMax"/>
     253                    <!-- "document[s]"-->
     254                    <xsl:choose>
     255                        <xsl:when test="$docMax = 1">
     256                            <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document')"/>
     257                        </xsl:when>
     258                        <xsl:otherwise>
     259                            <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document_plural')"/>
     260                        </xsl:otherwise>
     261                    </xsl:choose>
    217262                </td>
    218                 <td id="prevTD">
    219                     <xsl:if test="$currentPage != 1">
    220                         <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/@subaction}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;startPage={$currentPage - 1}">Previous</a>
    221                     </xsl:if>
    222                 </td>
    223                
    224                 <!-- Search result status bar (in english it reads "Displaying X to Y of Z documents") -->
    225                 <xsl:if test="$docMax &gt; 0">
    226                     <td id="searchResultsStatusBar">
    227                         <!-- "Displaying" -->
    228                         <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.displaying')"/><xsl:text> </xsl:text>
    229                         <!-- "X" -->
    230                         <xsl:value-of select="($currentPage - 1) * $docsPerPage + 1"/>
    231                         <!-- "to" -->
    232                         <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.to')"/><xsl:text> </xsl:text>
    233                         <!-- "Y" -->
    234                         <xsl:choose>
    235                             <xsl:when test="($currentPage * $docsPerPage + 1) &gt; $docMax">
    236                                 <xsl:value-of select="$docMax"/>
    237                             </xsl:when>
    238                             <xsl:otherwise>
    239                                 <xsl:value-of select="$currentPage * $docsPerPage"/>
    240                             </xsl:otherwise>
    241                         </xsl:choose>
    242                         <!-- "of" -->
    243                         <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.of')"/><xsl:text> </xsl:text>
    244                         <!-- "Z" -->
    245                         <xsl:value-of select="$docMax"/>
    246                         <!-- "document[s]"-->
    247                         <xsl:choose>
    248                             <xsl:when test="$docMax = 1">
    249                                 <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document')"/>
    250                             </xsl:when>
    251                             <xsl:otherwise>
    252                                 <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document_plural')"/>
    253                             </xsl:otherwise>
    254                         </xsl:choose>
    255                     </td>
     263            </xsl:if>
     264           
     265            <!-- Next button -->
     266            <td id="nextTD">
     267                <xsl:if test="($currentPage * $docsPerPage + 1) &lt; $docMax">
     268                    <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/paramList/param[@name = 'sa']/@value}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;startPage={$currentPage + 1}">Next</a>
    256269                </xsl:if>
    257                
    258                 <!-- Next button -->
    259                 <td id="nextTD">
    260                     <xsl:if test="($currentPage * $docsPerPage + 1) &lt; $docMax">
    261                         <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/paramList/param[@name = 'sa']/@value}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;startPage={$currentPage + 1}">Next</a>
    262                     </xsl:if>
    263                 </td>
    264                 <td id="nextArrowTD">
    265                     <xsl:if test="($currentPage * $docsPerPage + 1) &lt; $docMax">
    266                         <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/paramList/param[@name = 'sa']/@value}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;startPage={$currentPage + 1}">
    267                             <img src="interfaces/oran/images/next.png"/>
    268                         </a>
    269                     </xsl:if>
    270                 </td>
    271             </tr></table>
     270            </td>
     271            <td id="nextArrowTD">
     272                <xsl:if test="($currentPage * $docsPerPage + 1) &lt; $docMax">
     273                    <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/paramList/param[@name = 'sa']/@value}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;startPage={$currentPage + 1}">
     274                        <img src="interfaces/oran/images/next.png"/>
     275                    </a>
     276                </xsl:if>
     277            </td>
     278        </tr></table>
    272279    </xsl:template>
    273280
Note: See TracChangeset for help on using the changeset viewer.