source: greenstone3/trunk/web/interfaces/default/transform/pref.xsl@ 18316

Last change on this file since 18316 was 18316, checked in by kjdon, 15 years ago

indented the xml nicely.

  • Property svn:keywords set to Author Date Id Revision
File size: 6.7 KB
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 <div id="globalwrapper">
27 <xsl:call-template name="response" />
28 <xsl:call-template name="greenstoneFooter"/>
29 </div>
30 </body>
31 </html>
32 </xsl:template>
33
34 <xsl:template name="pageTitle">
35 <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')"/>
36 </xsl:template>
37
38 <!-- page specific style goes here -->
39 <xsl:template name="pageStyle"/>
40
41
42 <xsl:template match="pageResponse">
43 <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
44
45 <xsl:variable name="tidyoption"><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='tidyoption']"/></xsl:variable>
46
47 <xsl:call-template name="standardPageBanner">
48 <xsl:with-param name="collName" select="$collName"/>
49 <xsl:with-param name="pageType">pref</xsl:with-param>
50 </xsl:call-template>
51
52 <xsl:call-template name="navigationBar">
53 <xsl:with-param name="collName" select="$collName"/>
54 </xsl:call-template>
55 <div id="qureyform">
56 <form name="PrefForm" method="get" action="{$library_name}">
57 <input type='hidden' name='a' value='p'/>
58 <input type='hidden' name='sa' value='pref'/>
59 <input type='hidden' name='c' value="{$collName}"/>
60 <div class="formheading"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.prespref')"/></div>
61 <ul id="presprefs"><xsl:call-template name="pres-prefs"/></ul>
62 <ul id="berrybasketprefs" ><xsl:call-template name="berrybasket-prefs"/></ul>
63
64 <xsl:if test="$tidyoption='tidy'">
65 <ul id="bookprefs"><xsl:call-template name="book-prefs"/></ul>
66 </xsl:if>
67
68 <div class="formheading"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.searchpref')"/></div>
69 <ul id="searchprefs"><xsl:call-template name="search-prefs"/></ul>
70 <input type='submit'><xsl:attribute name="value"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.set_prefs')"/></xsl:attribute></input>
71 </form>
72 </div>
73 </xsl:template>
74
75 <xsl:template name="pres-prefs">
76 <li><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.interfacelang')"/> <xsl:call-template name="lang-list"/></li>
77 <li><span class="rightspace"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.encoding')"/></span>x</li>
78 </xsl:template>
79
80 <xsl:template name="lang-list">
81 <xsl:variable name="current" select="/page/@lang"/>
82 <select name="l">
83 <xsl:for-each select="/page/pageResponse/languageList/language">
84 <option value="{@name}"><xsl:if test="@name=$current"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="displayItem[@name='name']"/></option>
85 </xsl:for-each>
86 </select>
87 </xsl:template>
88
89 <xsl:template name="search-prefs">
90 <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>
91 <li><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.hitsperpage')"/>
92 <select name="hitsPerPage">
93 <option value="20"><xsl:if test="$hits=20"><xsl:attribute name="selected"></xsl:attribute></xsl:if>20</option>
94 <option value="50"><xsl:if test="$hits=50"><xsl:attribute name="selected"></xsl:attribute></xsl:if>50</option>
95 <option value="100"><xsl:if test="$hits=100"><xsl:attribute name="selected"></xsl:attribute></xsl:if>100</option>
96 <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>
97 </select>
98 </li>
99 </xsl:template>
100
101 <xsl:template name="berrybasket-prefs">
102 <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>
103
104 <li><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket')"/> <select name="berrybasket">
105 <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>
106 <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>
107 </select>
108 </li>
109 </xsl:template>
110
111 <xsl:template name="book-prefs">
112 <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>
113
114 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.book')"/> <select name="book">
115 <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>
116 <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>
117 </select>
118
119 </xsl:template>
120</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.