source: main/trunk/greenstone3/web/interfaces/default/transform/gslib.xsl@ 28051

Last change on this file since 28051 was 28051, checked in by sjm84, 11 years ago

Changing the top buttons into actual buttons and a new experimental look for the collection buttons

File size: 34.8 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
5 xmlns:gslib="http://www.greenstone.org/XSL/Library"
6 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
7 xmlns:util="http://org.greenstone.gsdl3.util.XSLTUtil"
8 exclude-result-prefixes="util xalan gslib gsf xslt">
9
10
11 <!-- force lower priority on xsl:output, so other files like rss.xsl can override with their own xsl:output stmt
12 If other files don't specify any, gslib.xsl specifies html output as default and defines a loose DOCTYPE for it. -->
13 <xsl:import href="html-output.xsl" />
14
15 <xsl:include href="xml-to-string.xsl"/>
16
17 <!-- some global parameters - these are set by whoever is invoking the transformation -->
18 <xsl:param name="interface_name"/>
19 <xsl:param name="library_name"/>
20 <xsl:param name="site_name"/>
21 <!-- every pages ....................................................................... -->
22
23 <xsl:template name="siteName">
24 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name='siteName']"/>
25 </xsl:template>
26
27 <xsl:template name="siteLink">
28 <a href="./{$library_name}">
29 <xsl:call-template name="siteName"/>
30 </a>
31 <xsl:text> </xsl:text>
32 </xsl:template>
33
34 <xsl:variable name="a">
35 <xsl:value-of select="/page/pageRequest/paramList/param[@name='a']/@value"/>
36 </xsl:variable>
37
38 <xsl:variable name="collections" select="/page/pageResponse/collectionList/collection"/>
39
40 <xsl:variable name="berrybasketswitch">
41 <xsl:value-of select="/page/pageRequest/paramList/param[@name='berrybasket']/@value"/>
42 </xsl:variable>
43
44 <xsl:variable name="berryBasketOn" select="/page/pageRequest/paramList/param[@name='berrybasket' and @value='on']"/>
45 <xsl:variable name="documentBasketOn" select="/page/pageRequest/paramList/param[@name='documentbasket' and @value='on']"/>
46
47 <xsl:variable name="thisCollectionEditor">
48 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'c']/@value"/>
49 <xsl:text>-collection-editor</xsl:text>
50 </xsl:variable>
51
52 <!-- template to get the name of the current collection -->
53 <xsl:template name="collectionName">
54 <xsl:choose>
55 <xsl:when test="/page/pageResponse/collection">
56 <xsl:value-of select="/page/pageResponse/collection/displayItem[@name='name']"/>
57 </xsl:when>
58 <xsl:otherwise>All Collections</xsl:otherwise>
59 </xsl:choose>
60 </xsl:template>
61
62 <xsl:template name="collectionNameShort">
63 <xsl:value-of select="/page/pageResponse/collection/@name"/>
64 </xsl:template>
65 <xsl:template name="collectionNameLinked">
66 <xsl:if test="/page/pageResponse/collection">
67 <a>
68 <xsl:attribute name="href">./<xsl:value-of select="$library_name"/>/collection/<xsl:call-template name="collectionNameShort"/>/page/about</xsl:attribute>
69 <xsl:call-template name="collectionName"/>
70 </a>
71 </xsl:if>
72 </xsl:template>
73
74 <!-- text to get the name of the current service ("Browse","Search" etc) -->
75 <xsl:template name="serviceName">
76 <xsl:value-of select="/page/pageResponse/service/displayItem[@name='name']"/>
77 </xsl:template>
78
79 <xsl:template name="textDirectionAttribute">
80 <xsl:attribute name="dir">
81 <xsl:choose>
82 <xsl:when 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:when>
83 <xsl:otherwise>ltr</xsl:otherwise>
84 </xsl:choose>
85 </xsl:attribute>
86 </xsl:template>
87
88 <xsl:template name="actionClass">
89 <xsl:attribute name="class"><xsl:value-of select="/page/pageRequest/@action"/>Action <xsl:if test="/page/pageRequest/@subaction"><xsl:value-of select="/page/pageRequest/@subaction"/>Subaction</xsl:if></xsl:attribute>
90 </xsl:template>
91 <!-- username, if logged in -->
92 <!--
93 <xsl:template name="username">
94 <xsl:if test="$un_s!=''">
95 <xsl:if test="$asn!='' and $asn!='0'">
96 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.username')"/> : <xsl:value-of select="$un_s"/>
97 </xsl:if>
98 </xsl:if>
99 </xsl:template>
100 -->
101 <xsl:template name="defaultDividerBar">
102 <xsl:param name="text"/>
103 <xsl:choose>
104 <xsl:when test="$text">
105 <div class="divbar">
106 <xsl:value-of select="$text"/>
107 </div>
108 </xsl:when>
109 <xsl:otherwise>
110 <div class="divbar">
111 <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
112 </div>
113 </xsl:otherwise>
114 </xsl:choose>
115 </xsl:template>
116
117 <xsl:template match="error">
118 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'error')"/> <xsl:value-of select="."/>
119 </xsl:template>
120 <xsl:template name="displayErrorsIfAny">
121 <xsl:if test="descendant::error">
122 <script language="Javascript">
123 <xsl:text disable-output-escaping="yes">
124 function removeAllChildren(node) {
125 while (node.hasChildNodes()) {
126 node.removeChild(node.firstChild);
127 }
128 }
129
130 function toggleHideError(obj) {
131 if (obj.style.display == "none") {
132 obj.style.display = "";
133 hide_link = document.getElementById("hide");
134 removeAllChildren(hide_link);
135 hide_link.appendChild(document.createTextNode("</xsl:text>
136 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'hide_error')"/>
137 <xsl:text disable-output-escaping="yes">"));
138 } else {
139 obj.style.display = "none";
140 hide_link = document.getElementById("hide");
141 removeAllChildren(hide_link);
142 hide_link.appendChild(document.createTextNode("</xsl:text>
143 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/>
144 <xsl:text disable-output-escaping="yes">"));
145 }
146 }
147 </xsl:text>
148 </script>
149 <p align="right">
150 <a id="hide" href="javascript:toggleHideError(error);">
151 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/>
152 </a>
153 </p>
154 <div id="error" style="display: none;">
155 <xsl:apply-templates select="descendant::error"/>
156 </div>
157 </xsl:if>
158 </xsl:template>
159
160 <xsl:template name="noTextBar">
161 <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
162 </xsl:template>
163
164 <xsl:template name="poweredByGS3TextBar">
165 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gs3power')"/>
166 </xsl:template>
167
168 <xsl:template name="rightArrow">
169 <xsl:text disable-output-escaping="yes"> &amp;raquo; </xsl:text>
170 </xsl:template>
171
172 <!-- site home ....................................................................... -->
173 <xsl:template name="siteHomePageTitle">
174 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
175 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
176 <xsl:text> </xsl:text>
177 </xsl:template>
178
179 <xsl:template name="selectACollectionTextBar">
180 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.select_a_collection')"/>
181 </xsl:template>
182
183 <xsl:template name="crossCollectionQuickSearchForm">
184 <xsl:apply-templates select="serviceList/service[@name='TextQuery']"/>
185 </xsl:template>
186
187 <xsl:template match="service[@name='TextQuery']">
188 <form name="QuickSearch" method="get" action="{$library_name}">
189 <input type="hidden" name="a" value="q"/>
190 <input type="hidden" name="rt" value="rd"/>
191 <input type="hidden" name="s" value="{@name}"/>
192 <input type="hidden" name="s1.collection" value="all"/>
193 <input type="text" name="s1.query" size="20"/>
194 <input type="submit">
195 <xsl:attribute name="value">
196 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.quick_search')"/>
197 </xsl:attribute>
198 </input>
199 </form>
200 </xsl:template>
201
202 <xsl:template name="collectionLinkWithImage">
203 <xsl:variable name="desc"><xsl:value-of select="displayItem[@name='shortDescription']"/></xsl:variable>
204 <xsl:variable name="coll_href"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="@name"/>/page/about<xsl:choose><xsl:when test="libraryParamList/param">?<xsl:for-each select="libraryParamList/param"><xsl:value-of select="@name"/>=<xsl:value-of select="@default"/>&amp;</xsl:for-each></xsl:when></xsl:choose></xsl:variable>
205 <xsl:choose>
206 <xsl:when test="displayItem[@name='icon']">
207 <a href="{$coll_href}" title="{$desc}">
208 <img class="collectionLinkImage">
209 <xsl:attribute name="alt"><xsl:value-of select="displayItem[@name='name']"/></xsl:attribute>
210 <xsl:attribute name="src">sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="@name"/>/images/<xsl:value-of select="displayItem[@name='icon']"/></xsl:attribute>
211 </img>
212 </a>
213 </xsl:when>
214 <xsl:otherwise>
215 <a href="{$coll_href}" title="{$desc}">
216 <div class="collectionLink ui-corner-all">
217 <div class="collectionLinkText ui-widget-content ui-corner-top">
218 <xsl:value-of select="displayItem[@name='name']"/>
219 </div>
220 <div style="height:15px;" class="ui-state-default ui-corner-bottom"><xsl:text> </xsl:text></div>
221 </div>
222 </a>
223 </xsl:otherwise>
224 </xsl:choose>
225 </xsl:template>
226
227 <xsl:template name="serviceClusterList">
228 <xsl:apply-templates select="serviceClusterList"/>
229 </xsl:template>
230
231 <xsl:template match="serviceClusterList">
232 <xsl:for-each select="serviceCluster">
233 <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}">
234 <xsl:value-of select="@name"/>
235 <xsl:value-of select="displayItem[@name='name']"/>
236 </a>
237 </xsl:for-each>
238 </xsl:template>
239
240 <xsl:template name="serviceLink">
241 <div class="paramLabel">
242 <a href="{$library_name}?a=q&amp;rt=d&amp;s={@name}">
243 <xsl:value-of select="displayItem[@name='name']"/>
244 </a>
245 </div>
246 <div class="paramValue">
247 <xsl:value-of select="displayItem[@name='description']"/>
248 </div>
249 <br class="clear"/>
250 </xsl:template>
251
252 <xsl:template name="authenticationLink">
253 <xsl:for-each select="//serviceList/service[@type='authen']">
254 <div class="paramLabel">
255 <a href="{$library_name}/admin/ListUsers">
256 <xsl:value-of select="displayItem[@name='name']"/>
257 </a>
258 </div>
259 <div class="paramValue">
260 <xsl:value-of select="displayItem[@name='description']"/>
261 </div>
262 </xsl:for-each>
263 </xsl:template>
264
265 <xsl:template name="registerLink">
266 <xsl:for-each select="//serviceList/service[@type='authen']">
267 <div class="paramLabel">
268 <a href="{$library_name}/admin/Register">
269 <xsl:text>Register</xsl:text>
270 </a>
271 </div>
272 <div class="paramValue">
273 <xsl:text>Register as a new user</xsl:text>
274 </div>
275 </xsl:for-each>
276 </xsl:template>
277
278 <xsl:template name="libraryInterfaceLink">
279 <li>
280 <a href="{$library_name}?a=p&amp;sa=gli4gs3">
281 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.librarian_interface')"/>
282 </a>
283 </li>
284 </xsl:template>
285
286 <xsl:template name="greenstoneLogoAlternateText">
287 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
288 </xsl:template>
289
290 <!-- about page - collection home ....................................................................... -->
291 <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
292 <xsl:variable name="httpPath" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
293 <xsl:variable name="siteName" select="$site_name"/>
294 <xsl:param name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
295 <xsl:param name="pageType"/>
296 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
297 <xsl:variable name="this-service" select="/page/pageRequest/paramList/param[@name = 's']/@value"/>
298
299<!--
300_httpimages_ {_httpweb_/images}
301_httpscript_ {_httpweb_/script}
302_httpstyle_ {_httpweb_/style}
303_httpflash_ {_httpweb_/flash}
304_httpjava_ {_httpweb_/java}
305-->
306
307
308 <xsl:template name="define-js-variable">
309 <xsl:param name="name"/>
310 <xsl:param name="value"/>
311 <script type="text/javascript">
312 gs.variables[<xslt:text disable-output-escaping="yes">"</xslt:text><xsl:value-of select="$name"/><xslt:text disable-output-escaping="yes">"</xslt:text>]
313 <xslt:text disable-output-escaping="yes"> = "</xslt:text>
314 <xsl:value-of select="$value"/>
315 <xslt:text disable-output-escaping="yes">";</xslt:text>
316 </script>
317 </xsl:template>
318
319 <xsl:variable name="_httpcollection_" select="$httpPath"/>
320 <xsl:variable name="_httpbrowse_"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/browse</xsl:variable>
321 <xsl:variable name="_httpquery_"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/search</xsl:variable>
322
323 <xsl:template name="define-js-macro-variables">
324
325 <xsl:call-template name="define-js-variable">
326 <xsl:with-param name="name" select="'_httpbrowse_'"/>
327 <xsl:with-param name="value" select="$_httpbrowse_"/>
328 </xsl:call-template>
329
330 <xsl:call-template name="define-js-variable">
331 <xsl:with-param name="name" select="'_httpquery_'"/>
332 <xsl:with-param name="value" select="$_httpquery_"/>
333 </xsl:call-template>
334
335 </xsl:template>
336
337
338 <xsl:template name="aboutCollectionPageTitle">
339 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
340 <xsl:value-of select="/page/pageResponse/collection/displayItem[@name='name']"/>
341 <xsl:text> </xsl:text>
342 </xsl:template>
343
344 <xsl:template name="collectionHomeLinkWithLogoIfAvailable">
345 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
346 <xsl:choose>
347 <xsl:when test="$this-element/displayItem[@name='icon']">
348 <img border="0">
349 <xsl:attribute name="src"><xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItem[@name='icon']"/></xsl:attribute>
350 <xsl:attribute name="alt">
351 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
352 </xsl:attribute>
353 <xsl:attribute name="title">
354 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
355 </xsl:attribute>
356 </img>
357 </xsl:when>
358 <xsl:otherwise>
359 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
360 </xsl:otherwise>
361 </xsl:choose>
362 </a>
363 </xsl:template>
364
365 <xsl:template name="homeButtonTop">
366 <a href="{$library_name}?a=p&amp;sa=home">
367 <xsl:attribute name="title">
368 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/>
369 </xsl:attribute>
370 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
371 </a>
372 </xsl:template>
373
374 <xsl:template name="helpButtonTop">
375 <xsl:choose>
376 <xsl:when test="$pageType='help'">
377 <li>
378 <a>
379 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
380 </a>
381 </li>
382 </xsl:when>
383 <xsl:otherwise>
384 <li>
385 <a href="{$library_name}?a=p&amp;sa=help&amp;c={$collName}">
386 <xsl:attribute name="title">
387 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/>
388 </xsl:attribute>
389 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
390 </a>
391 </li>
392 </xsl:otherwise>
393 </xsl:choose>
394 </xsl:template>
395
396 <xsl:template name="preferencesButtonTop">
397 <xsl:choose>
398 <xsl:when test="$pageType='pref'">
399 <li>
400 <a>
401 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
402 </a>
403 </li>
404 </xsl:when>
405 <xsl:otherwise>
406 <li>
407 <a href="{$library_name}?a=p&amp;sa=pref&amp;c={$collName}">
408 <xsl:attribute name="title">
409 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/>
410 </xsl:attribute>
411 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
412 </a>
413 </li>
414 </xsl:otherwise>
415 </xsl:choose>
416 </xsl:template>
417
418 <xsl:template name="servicesNavigationBar">
419 <xsl:for-each select="$this-element/serviceList/service">
420 <xsl:variable name="action">
421 <xsl:choose>
422 <xsl:when test="@name=$this-service">CURRENT</xsl:when>
423 <xsl:when test="@type='query'">q</xsl:when>
424 <xsl:when test="@type='browse'">b</xsl:when>
425 <xsl:when test="@type='process'">pr</xsl:when>
426 <xsl:when test="@type='applet'">a</xsl:when>
427 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
428 </xsl:choose>
429 </xsl:variable>
430 <xsl:choose>
431 <xsl:when test="$action='CURRENT'">
432 <li>
433 <a>
434 <xsl:value-of select="displayItem[@name='name']"/>
435 </a>
436 </li>
437 </xsl:when>
438 <xsl:when test="$action !='DO_NOT_DISPLAY'">
439 <li>
440 <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
441 <xsl:if test="displayItem[@name='description']">
442 <xsl:attribute name="title">
443 <xsl:value-of select="displayItem[@name='description']"/>
444 </xsl:attribute>
445 </xsl:if>
446 <xsl:value-of select="displayItem[@name='name']"/>
447 </a>
448 </li>
449 </xsl:when>
450 </xsl:choose>
451 </xsl:for-each>
452 </xsl:template>
453
454 <xsl:template name="collectionDescriptionTextAndServicesLinks">
455 <xsl:apply-templates select="pageResponse/collection|serviceCluster"/>
456 </xsl:template>
457 <xsl:template match="collection|serviceCluster">
458 <xsl:value-of select="displayItem[@name='description']" disable-output-escaping="yes"/>
459 <xsl:apply-templates select="serviceList">
460 <xsl:with-param name="collName" select="$collName"/>
461 </xsl:apply-templates>
462 </xsl:template>
463
464 <xsl:template match="serviceList">
465 <xsl:param name="collName"/>
466 <xsl:if test="service[not(@type = 'query' or @type = 'browse' or @type = 'retrieve' or @type = 'oai')]">
467 <h3>
468 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.services')"/>
469 </h3>
470 <p>
471 <xsl:choose>
472 <xsl:when test="service">
473 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.servicehelp')"/>
474 </xsl:when>
475 <xsl:otherwise>
476 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.noservices')"/>
477 </xsl:otherwise>
478 </xsl:choose>
479 </p>
480 <xsl:if test="service">
481 <div id="servicelist">
482 <xsl:for-each select="service">
483 <xsl:sort select="position()" order="descending" data-type="number"/>
484 <xsl:variable name="action">
485 <xsl:choose>
486 <xsl:when test="@type='query'">q</xsl:when>
487 <xsl:when test="@type='browse'">b</xsl:when>
488 <xsl:when test="@type='process'">pr</xsl:when>
489 <xsl:when test="@type='applet'">a</xsl:when>
490 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
491 </xsl:choose>
492 </xsl:variable>
493 <xsl:if test="$action != 'DO_NOT_DISPLAY'">
494 <div class="paramLabel">
495 <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
496 <xsl:value-of select="displayItem[@name='name']"/>
497 </a>
498 </div>
499 <div class="paramLabel">
500 <xsl:value-of select="displayItem[@name='description']"/>
501 </div>
502 <br class="clear"/>
503 </xsl:if>
504 </xsl:for-each>
505 </div>
506 </xsl:if>
507 </xsl:if>
508 </xsl:template>
509
510 <!-- classifier page ............................................................................ -->
511 <xsl:template name="collapsedNavigationTab">
512 <xsl:param name="type"/>
513 <xsl:variable name="isCurrent" select="/page/pageResponse/service[@type=$type]"/>
514 <li>
515 <xsl:if test="$isCurrent">
516 <xsl:attribute name="class">current</xsl:attribute>
517 </xsl:if>
518 <a>
519 <xsl:if test="service[@name=$type]/displayItem[@name='description']">
520 <xsl:attribute name="title">
521 <xsl:value-of select="service[@name=$type]/displayItem[@name='description']"/>
522 </xsl:attribute>
523 </xsl:if>
524 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=q&amp;rt=d&amp;s=<xsl:value-of select="service[@type=$type]/@name"/>&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:attribute>
525 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, $type)"/>
526 </a>
527 </li>
528 </xsl:template>
529
530 <xsl:template name="navigationTab">
531 <xsl:variable name="isCurrent" select="@name=/page/pageResponse/service/@name"/>
532 <xsl:variable name="action">
533 <xsl:choose>
534 <xsl:when test="@type='query'">q</xsl:when>
535 <xsl:when test="@type='browse'">b</xsl:when>
536 <xsl:when test="@type='process'">pr</xsl:when>
537 <xsl:when test="@type='applet'">a</xsl:when>
538 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
539 </xsl:choose>
540 </xsl:variable>
541 <xsl:if test="$action!='DO_NOT_DISPLAY'">
542 <li>
543 <xsl:if test="$isCurrent">
544 <xsl:attribute name="class">current</xsl:attribute>
545 </xsl:if>
546 <a>
547 <xsl:if test="displayItem[@name='description']">
548 <xsl:attribute name="title">
549 <xsl:value-of select="displayItem[@name='description']"/>
550 </xsl:attribute>
551 </xsl:if>
552 <xsl:choose>
553 <xsl:when test="classifierList/classifier/@name">
554 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=<xsl:value-of select="$action"/>&amp;rt=s&amp;s=<xsl:value-of select="@name"/>&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/>&amp;cl=<xsl:value-of select="classifierList/classifier/@name"/></xsl:attribute>
555 </xsl:when>
556 <xsl:otherwise>
557 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=<xsl:value-of select="$action"/>&amp;rt=d&amp;s=<xsl:value-of select="@name"/>&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:attribute>
558 </xsl:otherwise>
559 </xsl:choose>
560 <xsl:value-of select="displayItem[@name='name']"/>
561 </a>
562 </li>
563 </xsl:if>
564 </xsl:template>
565
566 <xsl:template name="classifierLink">
567 <xsl:if test="@name=/page/pageResponse/classifier/@name">
568 <xsl:attribute name="class">current</xsl:attribute>
569 </xsl:if>
570 <a href="{$library_name}?a=b&amp;rt=r&amp;s={/page/pageResponse/service/@name}&amp;c={/page/pageResponse/collection/@name}&amp;cl={@name}">
571 <xsl:value-of select="displayItem[@name='description']"/>
572 </a>
573 </xsl:template>
574
575 <!-- query page ............................................................................ -->
576 <xsl:template name="indexName">
577 <xsl:value-of select="/page/pageResponse/service/displayItem[@name='name']"/>
578 </xsl:template>
579 <xsl:template name="queryPageCollectionName">
580 <xsl:choose>
581 <xsl:when test="/page/pageResponse/collection">
582 <gslib:aboutCollectionPageTitle/>
583 </xsl:when>
584 <xsl:otherwise>Cross-Collection</xsl:otherwise>
585 </xsl:choose>
586 </xsl:template>
587
588 <!--
589BERRY BASKET TEMPLATES
590These get used on many different pages to add the
591berry basket function to the site
592-->
593 <!-- put the drag&drop berry basket on the page -->
594 <xsl:template name="berryBasket">
595 <xsl:if test="$berryBasketOn">
596 <div id="berrybasket" class="hide">
597 <span>Berry Basket</span>
598 <span id="berryBasketExpandCollapseLinks" style="display: none;">
599 <a id="berryBasketExpandLink" href="javascript:showBasket()">Expand</a>
600 <a id="berryBasketCollapseLink" style="display: none;" href="javascript:hideBasket()">Collapse</a>
601 </span>
602 <div id="baskethandle">
603 <span>
604 <xsl:text> </xsl:text>
605 </span>
606 </div>
607 <div id="berries">
608 <span>
609 <xsl:text> </xsl:text>
610 </span>
611 </div>
612 </div>
613 </xsl:if>
614 </xsl:template>
615
616 <!-- put the drag&drop document basket on the page -->
617 <xsl:template name="documentBasket">
618 <xsl:if test="$documentBasketOn and /page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
619 <div id="documentbasket" class="hide">
620 <span>Document Basket</span>
621 <span id="documentBasketExpandCollapseLinks" style="display: none;">
622 <a id="documentBasketExpandLink" href="javascript:showDocumentBox()">Expand</a>
623 <a id="documentBasketCollapseLink" style="display: none;" href="javascript:hideDocumentBox()">Collapse</a>
624 </span>
625 <div id="documenthandle">
626 <span>
627 <xsl:text> </xsl:text>
628 </span>
629 </div>
630 <div id="documentpages">
631 <span>
632 <xsl:text> </xsl:text>
633 </span>
634 </div>
635 <div>
636 <a href="javascript:clearBasket();">Clear basket</a>
637 </div>
638 </div>
639 </xsl:if>
640 </xsl:template>
641
642 <!-- include the required javascript and css for berry baskets -->
643 <xsl:template name="berryBasketHeadTags">
644 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/yahoo-min.js"><xsl:text> </xsl:text></script>
645 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/event-min.js"><xsl:text> </xsl:text></script>
646 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/connection-min.js"><xsl:text> </xsl:text></script>
647 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dom-min.js"><xsl:text> </xsl:text></script>
648 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dragdrop-min.js"><xsl:text> </xsl:text></script>
649 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/cookie-min.js"><xsl:text> </xsl:text></script>
650 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/animation-min.js"><xsl:text> </xsl:text></script>
651
652 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDPlayer.js"><xsl:text> </xsl:text></script>
653 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDOnTop.js"><xsl:text> </xsl:text></script>
654 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/berrybasket.js"><xsl:text> </xsl:text></script>
655 <link rel="stylesheet" href="interfaces/{$interface_name}/style/berry.css" type="text/css"/>
656
657 <!-- Combo-handled YUI CSS files: -->
658 <link rel="stylesheet" type="text/css" href="interfaces/{$interface_name}/style/skin.css"/>
659
660 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentbasket.js"><xsl:text> </xsl:text></script>
661 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentBasketDragDrop.js"><xsl:text> </xsl:text></script>
662 <!-- Combo-handled YUI JS files: -->
663 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yahoo-dom-event.js"><xsl:text> </xsl:text></script>
664 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/container_core-min.js"><xsl:text> </xsl:text></script>
665 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/element-min.js"><xsl:text> </xsl:text></script>
666 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/menu-min.js"><xsl:text> </xsl:text></script>
667 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/button-min.js"><xsl:text> </xsl:text></script>
668 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-min.js"><xsl:text> </xsl:text></script>
669 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yuiloader-min.js"><xsl:text> </xsl:text></script>
670 <!--<script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-dialog.js"><xsl:text> </xsl:text></script>-->
671
672 <link rel="stylesheet" href="interfaces/{$interface_name}/style/documentbasket.css" type="text/css"/>
673 </xsl:template>
674
675 <!--
676create a little berry which can be drag&dropped onto the berry basket
677used on classifier and search result pages
678-->
679 <xsl:template name="documentBerryForClassifierOrSearchPage">
680 <xsl:if test="$berryBasketOn">
681 <img class="pick" src="interfaces/{$interface_name}/images/berry.png" alt="in basket" width="15" height="15" border="0">
682 <xsl:attribute name="id"><xsl:value-of select="/page/pageResponse/collection/@name"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
683 </img>
684 </xsl:if>
685 </xsl:template>
686
687 <!--
688create little berrys which can be drag&dropped onto the berry basket
689used on the document page
690-->
691 <xsl:template name="documentBerryForDocumentPage">
692 <xsl:variable name="selectedNode">
693 <xsl:value-of select="/page/pageResponse/document/@selectedNode"/>
694 </xsl:variable>
695 <xsl:variable name="rootNode">
696 <xsl:value-of select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
697 </xsl:variable>
698 <xsl:if test="$berryBasketOn">
699 <div id="documentberries">
700 <img class="pick" id="{/page/pageResponse/collection/@name}:{$rootNode}" src="interfaces/{$interface_name}/images/berry.png" alt="in basket" width="15" height="15" border="0"/>
701 <span id="{/page/pageResponse/collection/@name}:{$rootNode}:root" class="documentberry">the whole document</span>
702 <!--<xsl:if test="$selectedNode != $rootNode">
703 <img class="pick" id="{/page/pageResponse/collection/@name}:{$selectedNode}" src="interfaces/{$interface_name}/images/berry.png" alt="in basket" width="15" height="15" border="0"/>
704 <span id="{/page/pageResponse/collection/@name}:{$selectedNode}:section" class="documentberry">the current section</span>
705 </xsl:if>-->
706 </div>
707 </xsl:if>
708 </xsl:template>
709
710 <!-- document page -->
711 <xsl:template name="documentTitle">
712 <xsl:value-of select="/page/pageResponse/document/documentNode/metadataList/metadata[@name='Title']"/>
713 </xsl:template>
714 <xsl:template name="coverImage">
715 <img>
716 <xsl:attribute name="src"><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='assocfilepath']"/>/cover.jpg</xsl:attribute>
717 </img>
718 </xsl:template>
719
720 <xsl:template name="previousNextButtons">
721 <!-- prev -->
722 <a>
723 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/>&amp;d=<xsl:value-of select="@selectedNode"/>.pp&amp;sib=1&amp;p.s=<xsl:value-of select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>&amp;p.sa=<xsl:value-of select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>&amp;p.a=<xsl:value-of select="/page/pageRequest/paramList/param[@name='p.a']/@value"/></xsl:attribute>
724 <img class="lessarrow" src="interfaces/{$interface_name}/images/previous.png"/>
725 </a>
726 <!-- next -->
727 <a>
728 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/>&amp;d=<xsl:value-of select="@selectedNode"/>.np&amp;sib=1&amp;p.s=<xsl:value-of select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>&amp;p.sa=<xsl:value-of select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>&amp;p.a=<xsl:value-of select="/page/pageRequest/paramList/param[@name='p.a']/@value"/></xsl:attribute>
729 <img class="morearrow" src="interfaces/{$interface_name}/images/next.png"/>
730 </a>
731 </xsl:template>
732
733
734 <!-- This next template expands gslib:langfrag (used by document.xsl and documentbasket.xsl).
735 When debugging with o=skinandlibdoc, it's seen that <gslib:langfrag name='dse' /> gets expanded to:
736 <xsl:call-template name="langfrag">
737 <xsl:with-param name="name">dse</xsl:with-param>
738 </xsl:call-template>
739 Before the param can be used in this template, need to retrieve it by name with <xsl:param/>
740 as explained in http://www.maconstateit.net/tutorials/XML/XML05/xml05-05.aspx
741 -->
742 <xsl:template name="langfrag">
743 <xsl:param name="name"/>
744 <script type="text/javascript">
745 <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceStringsAsJavascript($interface_name, /page/@lang, $name)"/>
746 </script>
747 </xsl:template>
748
749
750 <!-- builds up links to available document types equivalent to the default source
751 document with as anchor the equivalent documents' doctype icons. -->
752 <xsl:template name="equivDocLinks">
753 <xsl:param name="count"/>
754
755 <xsl:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
756 <xsl:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
757
758 <!--<xsl:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>-->
759 <!-- In the following variable statement, we're trying to set the docStartlink to any metadata whose value
760 ends on equivDocLink but NOT /equivDocLink. Unfortunately, the xslt function fn:ends-with only exists from
761 xslt 2.0 onwards. So need to use substring() and string-lenth() functions now to check whether the 13th char
762 from the end is a slash or not, in order to distinguish between the start of a doclink and end of one.
763 If this 13th char from the end is not a slash, then we found (the string we want to store in) docStartlink. -->
764 <xsl:variable name="docStartlink">
765 <xsl:for-each select="metadataList/metadata">
766 <xsl:if test="contains(@name, 'equivDocLink')">
767 <xsl:variable name="tmpvar" select="substring(@name, string-length(@name)-12, 1)"/>
768 <xsl:if test="not($tmpvar='/')">
769 <xsl:value-of select="self::node()[@name]"/>
770 </xsl:if>
771 </xsl:if>
772 </xsl:for-each>
773 </xsl:variable>
774
775 <xsl:variable name="equivDocIcon" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docicon, $count)" />
776 <xsl:variable name="equivStartlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docStartlink, $count)" />
777 <xsl:variable name="equivEndlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docEndlink, $count)" />
778
779 <xsl:if test="$equivDocIcon != ''">
780 <xsl:value-of disable-output-escaping="yes" select="$equivStartlink"/>
781 <xsl:value-of disable-output-escaping="yes" select="$equivDocIcon"/>
782 <xsl:value-of disable-output-escaping="yes" select="$equivEndlink"/>
783
784 <!-- recursively call this template to get multiple entries -->
785 <xsl:call-template name="equivDocLinks">
786 <xsl:with-param name="count"><xsl:value-of select="$count + 1"/></xsl:with-param>
787 </xsl:call-template>
788 </xsl:if>
789
790 </xsl:template>
791
792</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.