source: greenstone3/trunk/web/interfaces/classic/transform/style.xsl@ 14419

Last change on this file since 14419 was 14419, checked in by anna, 17 years ago

Added the right-to-left direction display for Arabic etc. language.

  • Property svn:keywords set to Author Date Id Revision
File size: 15.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 <!-- some global parameters - these are set by whoever is invoking the transformation -->
10 <xsl:param name="interface_name"/>
11 <xsl:param name="library_name"/>
12
13 <!-- the main page layout template is here -->
14 <xsl:template match="page">
15 <html>
16 <xsl:call-template name="pageHead"/>
17 <body class="bgimage">
18 <xsl:attribute name="dir"><xsl:call-template name="direction"/></xsl:attribute>
19 <div id="page">
20 <xsl:apply-templates select="pageResponse"/>
21 <xsl:call-template name="greenstoneFooter"/>
22 </div>
23 </body>
24 </html>
25 </xsl:template>
26
27 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
28 <xsl:template name="pageHead">
29 <head>
30 <title>
31 <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
32 </title>
33 <xsl:call-template name="globalStyle"/>
34 <xsl:call-template name="pageStyle"/>
35 </head>
36 </xsl:template>
37
38 <!-- any global style stuff should go in here -->
39 <xsl:template name="globalStyle">
40 <link rel="stylesheet" href="interfaces/classic/style/classic.css" type="text/css"/>
41 <link rel="stylesheet" href="interfaces/classic/style/classic2.css" type="text/css"/>
42 </xsl:template>
43
44 <xsl:template name="greenstonePageBanner">
45 <div id="banner">
46 <div class="collectimage">
47 <img src="interfaces/default/images/gsdlhead.gif"><xsl:attribute name="alt"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/></xsl:attribute>
48 </img>
49 </div>
50 </div>
51 <div class="bannerextra"></div>
52 <div id="content">
53 <xsl:call-template name="dividerBar">
54 <xsl:with-param name="text" select="'select a collection'"/>
55 </xsl:call-template>
56 </div>
57 </xsl:template>
58
59 <xsl:template name="genericPageBanner">
60 <xsl:param name='text'/>
61 <xsl:variable name="lang" select="/page/@lang"/>
62 <center>
63 <table width="100%">
64 <tr><td align="left"></td>
65 <td align="right">
66 <table>
67 <tr><td class="gsbutton">
68 <a class="gsbutton" href="{$library_name}?a=p&amp;sa=home">
69 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
70 </a>
71 </td></tr></table>
72 </td>
73 </tr>
74 </table>
75 </center>
76 <xsl:call-template name="dividerBar"><xsl:with-param name='text' select="$text"/></xsl:call-template>
77 </xsl:template>
78
79 <xsl:template name="standardPageBanner">
80 <xsl:param name="collName"/>
81 <xsl:param name="pageType"/>
82 <xsl:param name="clTop"/>
83 <xsl:variable name="this-element" select="/page/pageResponse/collection"/>
84 <div id="bannar">
85 <div class="pageinfo">
86 <xsl:call-template name="top-buttons">
87 <xsl:with-param name="collName" select="$collName"/>
88 <xsl:with-param name="pageType" select="$pageType"/>
89 </xsl:call-template>
90 <xsl:if test="not(/page/pageRequest/@action='d')">
91 <xsl:variable name="text">
92 <xsl:choose>
93 <xsl:when test="$pageType='browse'">
94 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier[@name=$clTop]/displayItem[@name='name']"/>
95 </xsl:when>
96 <xsl:otherwise>
97 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, concat($pageType, '_t'))"/>
98 </xsl:otherwise>
99 </xsl:choose>
100 </xsl:variable>
101 <p class="bannertitle"><xsl:value-of select="$text"/></p>
102 </xsl:if>
103 </div>
104
105 <div class="collectimage">
106 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
107 <xsl:choose>
108 <xsl:when test="$this-element/displayItem[@name='icon']">
109 <img border="0">
110 <xsl:attribute name="src">
111 <xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItem[@name='icon']"/>
112 </xsl:attribute>
113 <xsl:attribute name="alt">
114 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
115 </xsl:attribute>
116 <xsl:attribute name="title">
117 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
118 </xsl:attribute>
119 </img>
120 </xsl:when>
121 <xsl:otherwise>
122 <b><xsl:value-of select="$this-element/displayItem[@name='name']"/>hello</b>
123 </xsl:otherwise>
124 </xsl:choose>
125 </a>
126 </div>
127 </div>
128 <div class="bannerextra"></div>
129 </xsl:template>
130
131 <xsl:template name="top-buttons">
132 <xsl:param name="collName"/>
133 <xsl:param name="pageType"/>
134 <p class="bannerlinks">
135 <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>
136 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
137 </a>
138 <!-- <xsl:choose>
139 <xsl:when test="$pageType='help'">
140 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
141 </xsl:when>
142 <xsl:otherwise>
143 <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>
144 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
145 </a>
146 </xsl:otherwise>
147 </xsl:choose> -->
148 <xsl:choose>
149 <xsl:when test="$pageType='pref'">
150 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
151 </xsl:when>
152 <xsl:otherwise>
153 <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>
154 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
155 </a>
156 </xsl:otherwise>
157 </xsl:choose>
158 </p>
159 </xsl:template>
160
161 <xsl:template name="navigationBar">
162 <xsl:param name="collName"/>
163 <xsl:param name="clTop"/>
164 <xsl:variable name="this-element" select="/page/pageResponse/collection"/>
165 <xsl:variable name="this-service" select="/page/pageResponse/service/@name"/>
166 <xsl:variable name="classifiers" select="$this-element/serviceList/service[@name='ClassifierBrowse']/classifierList[1]"/>
167
168 <!-- display order, for Arabic etc. languages, display right to left -->
169 <xsl:variable name="dir"><xsl:call-template name="direction"/></xsl:variable>
170 <xsl:variable name="sort_order"><xsl:choose><xsl:when test="$dir='rtl'">descending</xsl:when><xsl:otherwise>ascending</xsl:otherwise></xsl:choose></xsl:variable>
171
172 <div class="navbar">
173 <p class="navbar">
174 <xsl:choose>
175 <xsl:when test="not($dir='rtl')">
176 <xsl:if test="$this-element/serviceList/service[@type='query']">
177 <xsl:call-template name="navbar-search"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
178 </xsl:if>
179 </xsl:when>
180 <xsl:otherwise>
181 <xsl:if test="$this-element/serviceList/service[@name='PhindApplet']">
182 <xsl:call-template name="navbar-phind"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
183 </xsl:if>
184 </xsl:otherwise>
185 </xsl:choose>
186
187 <xsl:for-each select="$classifiers/classifier">
188 <xsl:sort order="{$sort_order}" select="position()" />
189 <xsl:apply-templates select="." mode="navbar">
190 <xsl:with-param name="collName" select="$collName"/>
191 <xsl:with-param name="clTop" select="$clTop"/>
192 </xsl:apply-templates>
193 </xsl:for-each>
194
195 <xsl:choose>
196 <xsl:when test="$dir='rtl'">
197 <xsl:if test="$this-element/serviceList/service[@type='query']">
198 <xsl:call-template name="navbar-search"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
199 </xsl:if>
200 </xsl:when>
201 <xsl:otherwise>
202 <xsl:if test="$this-element/serviceList/service[@name='PhindApplet']">
203 <xsl:call-template name="navbar-phind"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
204 </xsl:if>
205 </xsl:otherwise>
206 </xsl:choose>
207 </p>
208 </div>
209 </xsl:template>
210
211 <xsl:template name="navbar-search">
212 <xsl:param name="collName"/>
213 <xsl:choose>
214 <xsl:when test="/page/pageRequest/@action='q'">
215 <span class="narspace">search</span>
216 </xsl:when>
217 <xsl:otherwise>
218 <xsl:variable name="service">
219 <xsl:choose>
220 <xsl:when test="not(/page/pageRequest/paramList/param[@name='ct'])">TextQuery</xsl:when>
221 <xsl:when test="/page/pageRequest/paramList/param[@name='ct']/@value='0'">TextQuery</xsl:when>
222 <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>
223 <xsl:otherwise>TextQuery</xsl:otherwise>
224 </xsl:choose>
225 </xsl:variable>
226 <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>
227 </xsl:otherwise>
228 </xsl:choose>
229 </xsl:template>
230
231 <xsl:template name="navbar-phind">
232 <xsl:param name="collName"/>
233 <xsl:choose>
234 <xsl:when test="/page/pageRequest/paramList/param[@name='s']/@value='PhindApplet'">
235 <span class="narspace">phrases</span>
236 </xsl:when>
237 <xsl:otherwise>
238 <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>
239 </xsl:otherwise>
240 </xsl:choose>
241 </xsl:template>
242
243 <xsl:template match="classifier" mode="navbar">
244 <xsl:param name="collName"/>
245 <xsl:param name="clTop"/>
246 <xsl:choose>
247 <xsl:when test="/page/pageRequest/@action='b' and $clTop=@name">
248 <span class="narspace"><xsl:value-of select="displayItem[@name='name']"/></span>
249 </xsl:when>
250 <xsl:otherwise>
251 <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>
252 </xsl:otherwise>
253 </xsl:choose>
254 </xsl:template>
255
256 <xsl:template name="dividerBar">
257 <xsl:param name='text'/>
258 <xsl:choose>
259 <xsl:when test="$text">
260 <div class="divbar"><p class="navbar"><xsl:value-of select="$text"/></p></div>
261 </xsl:when>
262 <xsl:otherwise>
263 <div class="divbar"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></div>
264 </xsl:otherwise>
265 </xsl:choose>
266 </xsl:template>
267
268 <xsl:template name="nzdlPageBanner">
269 <div><img src="interfaces/nzdl/images/nzdl2gr.gif" width="457" height="181" ><xsl:attribute name="alt"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'nzdl')"/></xsl:attribute></img></div>
270 <!-- end of page banner -->
271 </xsl:template>
272
273 <xsl:template name="greenstoneFooter">
274 <div class="divbar"><p class="navbar">powered by greenstone3</p>
275 </div>
276 </xsl:template>
277
278 <xsl:template name="imagegreenstone">
279 <img src="interfaces/nzdl/images/gsdl.gif" width="140" height="77" border="0" hspace='0'><xsl:attribute name='alt'><xsl:call-template name='textimagegreenstone'/></xsl:attribute></img>
280 </xsl:template>
281
282 <!-- Display the appropriate image, depending on the node type -->
283 <xsl:template match="documentNode" mode="displayNodeIcon">
284
285 <!-- Root node: book icon (open or closed) -->
286 <xsl:choose>
287 <xsl:when test="@nodeType='root'">
288 <xsl:choose>
289 <xsl:when test="documentNode">
290 <xsl:call-template name="openbookimg">
291 <xsl:with-param name="title">Close this book</xsl:with-param>
292 </xsl:call-template>
293 </xsl:when>
294 <xsl:otherwise>
295 <xsl:call-template name="closedbookimg">
296 <xsl:with-param name="title">Open this document and view contents</xsl:with-param>
297 </xsl:call-template>
298 </xsl:otherwise>
299 </xsl:choose>
300 </xsl:when>
301
302 <!-- Internal node: folder icon (open or closed) -->
303 <xsl:when test="@nodeType='internal'">
304 <xsl:choose>
305 <xsl:when test="documentNode">
306 <xsl:call-template name="openfolderimg">
307 <xsl:with-param name="title">Close this folder</xsl:with-param>
308 </xsl:call-template>
309 </xsl:when>
310 <xsl:otherwise>
311 <xsl:call-template name="closedfolderimg">
312 <xsl:with-param name="title">Open this folder and view contents</xsl:with-param>
313 </xsl:call-template>
314 </xsl:otherwise>
315 </xsl:choose>
316 </xsl:when>
317
318 <!-- Leaf node: page icon, and this is the default -->
319 <xsl:otherwise>
320 <xsl:call-template name="textpageimg">
321 <xsl:with-param name="title">View the document</xsl:with-param>
322 </xsl:call-template>
323 </xsl:otherwise>
324 </xsl:choose>
325 </xsl:template>
326
327
328 <xsl:template name="openbookimg">
329 <xsl:param name="alt"/>
330 <xsl:param name="title"/>
331 <img border="0" width="28" height="23"
332 src="interfaces/default/images/openbook.gif"
333 alt="{$alt}" title="{$title}"/>
334 </xsl:template>
335
336 <xsl:template name="closedbookimg">
337 <xsl:param name="alt"/>
338 <xsl:param name="title"/>
339 <img border="0" width="18" height="11"
340 src="interfaces/default/images/book.gif"
341 alt="{$alt}" title="{$title}"/>
342 </xsl:template>
343
344 <xsl:template name="openfolderimg">
345 <xsl:param name="alt"/>
346 <xsl:param name="title"/>
347 <img border="0" width="23" height="15"
348 src="interfaces/default/images/openfldr.gif"
349 alt="{$alt}" title="{$title}"/>
350 </xsl:template>
351
352 <xsl:template name="closedfolderimg">
353 <xsl:param name="alt"/>
354 <xsl:param name="title"/>
355 <img border="0" width="23" height="15"
356 src="interfaces/default/images/clsdfldr.gif"
357 alt="{$alt}" title="{$title}"/>
358 </xsl:template>
359
360 <xsl:template name="textpageimg">
361 <xsl:param name="alt"/>
362 <xsl:param name="title"/>
363 <img border="0" width="16" height="21"
364 src="interfaces/default/images/itext.gif"
365 alt="{$alt}" title="{$title}"/>
366 </xsl:template>
367
368 <xsl:template name="bookshelfimg">
369 <xsl:param name="alt"/>
370 <xsl:param name="title"/>
371 <img border="0" width="20" height="16"
372 src="interfaces/default/images/bshelf.gif"
373 alt="{$alt}" title="{$title}"/>
374 </xsl:template>
375
376 <xsl:template name="iconpdf">
377 <xsl:param name="alt">PDF</xsl:param>
378 <xsl:param name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'texticonpdf')"/></xsl:param>
379 <img border="0" width='26' height='26'
380 src='interfaces/default/images/ipdf.gif'
381 alt='{$alt}' title='{$title}'/>
382 </xsl:template>
383
384 <xsl:template name="icondoc">
385 <xsl:param name="alt">Word</xsl:param>
386 <xsl:param name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'texticonmsword')"/></xsl:param>
387 <img border="0" width='26' height='26'
388 src='interfaces/default/images/imsword.gif'
389 alt='{$alt}' title='{$title}'/>
390 </xsl:template>
391
392 <xsl:template name="direction">
393 <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>
394 </xsl:template>
395
396</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.