source: greenstone3/trunk/web/interfaces/gs2/transform/style.xsl@ 19874

Last change on this file since 19874 was 19874, checked in by ak19, 13 years ago

Added in missing template response that's called and was previously missing (and which cased a fatal error message to be printed to the tomcat console).

  • Property svn:keywords set to Author Date Id Revision
File size: 11.5 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 <xsl:include href="icons.xsl"/>
10
11 <!-- some global parameters - these are set by whoever is invoking the transformation -->
12 <xsl:param name="interface_name"/>
13 <xsl:param name="library_name"/>
14
15 <!-- any global style stuff should go in here -->
16 <xsl:template name="response">
17 <xsl:apply-templates select="pageResponse"/>
18 <xsl:if test="descendant::error">
19 <script language="Javascript">
20 <xsl:text disable-output-escaping="yes">
21 function removeAllChildren(node) {
22 while (node.hasChildNodes()) {
23 node.removeChild(node.firstChild);
24 }
25 }
26
27 function toggleHideError(obj) {
28 if (obj.style.display == "none") {
29 obj.style.display = "";
30 hide_link = document.getElementById("hide");
31 removeAllChildren(hide_link);
32 hide_link.appendChild(document.createTextNode("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'hide_error')"/><xsl:text disable-output-escaping="yes">"));
33 } else {
34 obj.style.display = "none";
35 hide_link = document.getElementById("hide");
36 removeAllChildren(hide_link);
37 hide_link.appendChild(document.createTextNode("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/><xsl:text disable-output-escaping="yes">"));
38 }
39 }
40 </xsl:text>
41 </script>
42 <p align='right'><a id="hide" href="javascript:toggleHideError(error);"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/></a></p>
43 <div id="error" style="display: none;">
44 <xsl:apply-templates select="descendant::error"/>
45 </div>
46 </xsl:if>
47 </xsl:template>
48
49 <xsl:template name="globalStyle">
50 <link rel="stylesheet" href="interfaces/gs2/style/gs2-style.css" type="text/css"/>
51 <link rel="stylesheet" href="interfaces/gs2/style/gs2-style2.css" type="text/css"/>
52 </xsl:template>
53
54 <xsl:template name="genericPageBanner">
55 <xsl:param name='text'/>
56 <xsl:variable name="lang" select="/page/@lang"/>
57 <center>
58 <table width="100%">
59 <tr><td align="left"></td>
60 <td align="right">
61 <table>
62 <tr><td class="gsbutton">
63 <a class="gsbutton" href="{$library_name}?a=p&amp;sa=home">
64 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
65 </a>
66 </td></tr></table>
67 </td>
68 </tr>
69 </table>
70 </center>
71 <xsl:call-template name="dividerBar"><xsl:with-param name='text' select="$text"/></xsl:call-template>
72 </xsl:template>
73
74 <xsl:template name="standardPageBanner">
75 <xsl:param name="collName"/>
76 <xsl:param name="pageType"/>
77 <xsl:param name="clTop"/>
78 <xsl:variable name="this-element" select="/page/pageResponse/collection"/>
79 <div id="bannar">
80 <div class="pageinfo">
81 <xsl:call-template name="top-buttons">
82 <xsl:with-param name="collName" select="$collName"/>
83 <xsl:with-param name="pageType" select="$pageType"/>
84 </xsl:call-template>
85 <xsl:if test="not(/page/pageRequest/@action='d')">
86 <xsl:variable name="text">
87 <xsl:choose>
88 <xsl:when test="$pageType='browse'">
89 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier[@name=$clTop]/displayItem[@name='name']"/>
90 </xsl:when>
91 <xsl:otherwise>
92 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, concat($pageType, '_t'))"/>
93 </xsl:otherwise>
94 </xsl:choose>
95 </xsl:variable>
96 <xsl:if test="$text != '__t_'">
97 <p class="bannertitle"><xsl:value-of select="$text"/></p>
98 </xsl:if>
99 </xsl:if>
100 </div>
101
102 <div class="collectimage">
103 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
104 <xsl:choose>
105 <xsl:when test="$this-element/displayItem[@name='icon']">
106 <img border="0">
107 <xsl:attribute name="src">
108 <xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItem[@name='icon']"/>
109 </xsl:attribute>
110 <xsl:attribute name="alt">
111 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
112 </xsl:attribute>
113 <xsl:attribute name="title">
114 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
115 </xsl:attribute>
116 </img>
117 </xsl:when>
118 <xsl:otherwise>
119 <b><xsl:value-of select="$this-element/displayItem[@name='name']"/></b>
120 </xsl:otherwise>
121 </xsl:choose>
122 </a>
123 </div>
124 </div>
125 <div class="bannerextra"></div>
126 </xsl:template>
127
128 <xsl:template name="top-buttons">
129 <xsl:param name="collName"/>
130 <xsl:param name="pageType"/>
131 <p class="bannerlinks">
132 <a class="navlink" href="{$library_name}?a=p&amp;sa=home"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/></xsl:attribute>
133 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
134 </a>
135 <!--<xsl:choose>
136 <xsl:when test="$pageType='help'">
137 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
138 </xsl:when>
139 <xsl:otherwise>
140 <a class="navlink" href="{$library_name}?a=p&amp;sa=help&amp;c={$collName}"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
141 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
142 </a>
143 </xsl:otherwise>
144 </xsl:choose> -->
145 <xsl:choose>
146 <xsl:when test="$pageType='pref'">
147 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
148 </xsl:when>
149 <xsl:otherwise>
150 <a class="navlink" href="{$library_name}?a=p&amp;sa=pref&amp;c={$collName}"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
151 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
152 </a>
153 </xsl:otherwise>
154 </xsl:choose>
155 </p>
156 </xsl:template>
157
158 <xsl:template name="navigationBar">
159 <xsl:param name="collName"/>
160 <xsl:param name="clTop"/>
161 <xsl:variable name="this-element" select="/page/pageResponse/collection"/>
162 <xsl:variable name="this-service" select="/page/pageResponse/service/@name"/>
163 <xsl:variable name="classifiers" select="$this-element/serviceList/service[@name='ClassifierBrowse']/classifierList[1]"/>
164
165 <!-- display order, for Arabic etc. languages, display right to left -->
166 <xsl:variable name="dir"><xsl:call-template name="direction"/></xsl:variable>
167 <xsl:variable name="sort_order"><xsl:choose><xsl:when test="$dir='rtl'">descending</xsl:when><xsl:otherwise>ascending</xsl:otherwise></xsl:choose></xsl:variable>
168
169 <div class="navbar">
170 <p class="navbar">
171 <xsl:choose>
172 <xsl:when test="not($dir='rtl')">
173 <xsl:if test="$this-element/serviceList/service[@type='query']">
174 <xsl:call-template name="navbar-search"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
175 </xsl:if>
176 </xsl:when>
177 <xsl:otherwise>
178 <xsl:if test="$this-element/serviceList/service[@name='PhindApplet']">
179 <xsl:call-template name="navbar-phind"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
180 </xsl:if>
181 </xsl:otherwise>
182 </xsl:choose>
183
184 <xsl:for-each select="$classifiers/classifier">
185 <xsl:sort order="{$sort_order}" select="position()" />
186 <xsl:apply-templates select="." mode="navbar">
187 <xsl:with-param name="collName" select="$collName"/>
188 <xsl:with-param name="clTop" select="$clTop"/>
189 </xsl:apply-templates>
190 </xsl:for-each>
191
192 <xsl:choose>
193 <xsl:when test="$dir='rtl'">
194 <xsl:if test="$this-element/serviceList/service[@type='query']">
195 <xsl:call-template name="navbar-search"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
196 </xsl:if>
197 </xsl:when>
198 <xsl:otherwise>
199 <xsl:if test="$this-element/serviceList/service[@name='PhindApplet']">
200 <xsl:call-template name="navbar-phind"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
201 </xsl:if>
202 </xsl:otherwise>
203 </xsl:choose>
204 </p>
205 </div>
206 </xsl:template>
207
208 <xsl:template name="navbar-search">
209 <xsl:param name="collName"/>
210 <xsl:choose>
211 <xsl:when test="/page/pageRequest/@action='q'">
212 <span class="narspace">search</span>
213 </xsl:when>
214 <xsl:otherwise>
215 <xsl:variable name="service">
216 <xsl:choose>
217 <xsl:when test="not(/page/pageRequest/paramList/param[@name='ct'])">TextQuery</xsl:when>
218 <xsl:when test="/page/pageRequest/paramList/param[@name='ct']/@value='0'">TextQuery</xsl:when>
219 <xsl:when test="/page/pageRequest/paramList/param[@name='qt']/@value='1'"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='qfm']/@value='1'">AdvancedFieldQuery</xsl:when><xsl:otherwise>FieldQuery</xsl:otherwise></xsl:choose></xsl:when>
220 <xsl:otherwise>TextQuery</xsl:otherwise>
221 </xsl:choose>
222 </xsl:variable>
223 <a class="navlink" href="{$library_name}?a=q&amp;rt=d&amp;s={$service}&amp;c={$collName}"><xsl:attribute name='title'><xsl:value-of select="/page/pageResponse/collection/service[@name=$service]/displayItem[@name='description']"/></xsl:attribute>search</a>
224 </xsl:otherwise>
225 </xsl:choose>
226 </xsl:template>
227
228 <xsl:template name="navbar-phind">
229 <xsl:param name="collName"/>
230 <xsl:choose>
231 <xsl:when test="/page/pageRequest/paramList/param[@name='s']/@value='PhindApplet'">
232 <span class="narspace">phrases</span>
233 </xsl:when>
234 <xsl:otherwise>
235 <a class="navlink" href="{$library_name}?a=a&amp;rt=d&amp;s=PhindApplet&amp;c={$collName}"><xsl:if test="/page/pageResponse/collection/service[@name='PhindApplet']/displayItem[@name='description']"><xsl:attribute name='title'><xsl:value-of select="/page/pageResponse/collection/service[@name='PhindApplet']/displayItem[@name='description']"/></xsl:attribute></xsl:if>phrases</a>
236 </xsl:otherwise>
237 </xsl:choose>
238 </xsl:template>
239
240 <xsl:template match="classifier" mode="navbar">
241 <xsl:param name="collName"/>
242 <xsl:param name="clTop"/>
243 <xsl:choose>
244 <xsl:when test="/page/pageRequest/@action='b' and $clTop=@name">
245 <span class="narspace"><xsl:value-of select="displayItem[@name='name']"/></span>
246 </xsl:when>
247 <xsl:otherwise>
248 <a class="navlink" href="{$library_name}?a=b&amp;rt=r&amp;s=ClassifierBrowse&amp;c={$collName}&amp;cl={@name}"><xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute><xsl:value-of select="displayItem[@name='name']"/></a>
249 </xsl:otherwise>
250 </xsl:choose>
251 </xsl:template>
252
253 <xsl:template name="dividerBar">
254 <xsl:param name='text'/>
255 <xsl:choose>
256 <xsl:when test="$text">
257 <div class="divbar"><p class="navbar"><xsl:value-of select="$text"/></p></div>
258 </xsl:when>
259 <xsl:otherwise>
260 <div class="divbar"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></div>
261 </xsl:otherwise>
262 </xsl:choose>
263 </xsl:template>
264
265 <xsl:template name="greenstoneFooter">
266 <div class="divbar"><p class="navbar">powered by greenstone3</p>
267 </div>
268 </xsl:template>
269
270 <xsl:template name="direction">
271 <xsl:if test="/page/@lang='ar' or /page/@lang='fa' or /page/@lang='he' or /page/@lang='ur' or /page/@lang='ps' or /page/@lang='prs'">rtl</xsl:if>
272 </xsl:template>
273
274</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.