root/main/branches/64_bit_Greenstone/greenstone3/web/interfaces/default/transform/pref.xsl @ 24007

Revision 24007, 6.2 KB (checked in by sjm84, 8 years ago)

Updating this branch to match the latest Greenstone3 changes

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