root/other-projects/tipple-android/i-greenstone-server-files/greenstone/webapps/greenstone3/interfaces/basic/transform/pref.xsl @ 26899

Revision 26899, 6.8 KB (checked in by davidb, 7 years ago)

Tipple reborn after Chris's Summer of Code 2013

  • Property svn:mime-type set to application/xml
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4  xmlns:java="http://xml.apache.org/xslt/java"
5  xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6  extension-element-prefixes="java util"
7  exclude-result-prefixes="java util">
8 
9  <!-- style includes global params interface_name, library_name -->
10  <xsl:include href="style.xsl"/>
11
12  <xsl:output method="html"/> 
13 
14  <!-- the main page layout template is here -->
15  <xsl:template match="page">
16    <html>
17      <head>
18    <title>
19      <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
20      <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
21    </title>
22    <xsl:call-template name="globalStyle"/>
23    <xsl:call-template name="pageStyle"/>
24      </head>
25      <body>
26    <xsl:attribute name="dir"><xsl:call-template name="direction"/></xsl:attribute>
27    <div id="page-wrapper">
28      <xsl:call-template name="response" />
29      <xsl:call-template name="greenstoneFooter"/>
30    </div>
31      </body>
32    </html>
33  </xsl:template>
34 
35  <xsl:template name="pageTitle">
36    <xsl:choose><xsl:when test="/page/pageResponse/*/displayItem[@name='name']"><xsl:value-of select="/page/pageResponse/*/displayItem[@name='name']"/></xsl:when><xsl:otherwise><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/></xsl:otherwise></xsl:choose>: <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_t')"/>
37  </xsl:template>
38
39  <!-- page specific style goes here -->
40  <xsl:template name="pageStyle"/>
41
42
43  <xsl:template match="pageResponse">
44    <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
45   
46    <xsl:variable name="tidyoption"><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='tidyoption']"/></xsl:variable>
47   
48    <xsl:call-template name="standardPageBanner">
49      <xsl:with-param name="collName" select="$collName"/>
50      <xsl:with-param name="pageType">pref</xsl:with-param>
51    </xsl:call-template>
52
53    <xsl:call-template name="navigationBar">
54      <xsl:with-param name="collName" select="$collName"/>
55    </xsl:call-template>     
56    <div id="qureyform">
57      <form name="PrefForm" method="get" action="{$library_name}">
58    <input type='hidden' name='a' value='p'/>
59    <input type='hidden' name='sa' value='pref'/>
60    <input type='hidden' name='c' value="{$collName}"/>
61    <div class="formheading"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.prespref')"/></div>
62    <ul id="presprefs"><xsl:call-template name="pres-prefs"/></ul>
63    <ul id="berrybasketprefs" ><xsl:call-template name="berrybasket-prefs"/></ul>
64   
65    <xsl:if test="$tidyoption='tidy'">
66      <ul id="bookprefs"><xsl:call-template name="book-prefs"/></ul>
67    </xsl:if>
68   
69    <div class="formheading"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.searchpref')"/></div>
70    <ul id="searchprefs"><xsl:call-template name="search-prefs"/></ul>
71    <input type='submit'><xsl:attribute name="value"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.set_prefs')"/></xsl:attribute></input>
72      </form>
73    </div>
74  </xsl:template>
75 
76  <xsl:template name="pres-prefs">
77    <li><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.interfacelang')"/> <xsl:call-template name="lang-list"/></li>
78    <li><span class="rightspace"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.encoding')"/></span>x</li>
79  </xsl:template>
80 
81  <xsl:template name="lang-list">
82    <xsl:variable name="current" select="/page/@lang"/>
83    <select name="l">
84      <xsl:for-each select="/page/pageResponse/languageList/language">
85    <option value="{@name}"><xsl:if test="@name=$current"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="displayItem[@name='name']"/></option>
86      </xsl:for-each>
87    </select>
88  </xsl:template>
89 
90  <xsl:template name="search-prefs">
91    <xsl:variable name="hits"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='hitsPerPage']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='hitsPerPage']/@value"/></xsl:when><xsl:otherwise>20</xsl:otherwise></xsl:choose></xsl:variable>
92    <li><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.hitsperpage')"/>
93      <select name="hitsPerPage">
94    <option value="20"><xsl:if test="$hits=20"><xsl:attribute name="selected"></xsl:attribute></xsl:if>20</option>
95    <option value="50"><xsl:if test="$hits=50"><xsl:attribute name="selected"></xsl:attribute></xsl:if>50</option>
96    <option value="100"><xsl:if test="$hits=100"><xsl:attribute name="selected"></xsl:attribute></xsl:if>100</option>
97    <option value="-1"><xsl:if test="$hits=-1"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.all')"/></option>
98      </select>
99    </li>
100  </xsl:template>
101
102  <xsl:template name="berrybasket-prefs">
103    <xsl:variable name="berrybasket"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='berrybasket']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='berrybasket']/@value"/></xsl:when><xsl:otherwise>off</xsl:otherwise></xsl:choose></xsl:variable>
104   
105    <li><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket')"/> <select name="berrybasket">
106        <option value="on"><xsl:if test="$berrybasket='on'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket.on')"/></option>
107    <option value="off"><xsl:if test="$berrybasket='off'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket.off')"/></option>
108      </select>
109    </li>
110  </xsl:template>
111
112  <xsl:template name="book-prefs">
113    <xsl:variable name="book"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='book']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xsl:when><xsl:otherwise>off</xsl:otherwise></xsl:choose></xsl:variable>
114   
115    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.book')"/> <select name="book">
116      <option value="on"><xsl:if test="$book='on'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket.on')"/></option>
117      <option value="off"><xsl:if test="$book='off'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket.off')"/></option>
118    </select>
119   
120  </xsl:template>
121</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.