source: main/trunk/greenstone3/web/interfaces/default_new/transform/gslib.xsl@ 29852

Last change on this file since 29852 was 29852, checked in by Georgiy Litvinov, 9 years ago

Ckeditor integration commit

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<!-- Uncomment this section if you want the collection service links and their descriptions to appear -->
460 <!--<xsl:apply-templates select="serviceList">
461 <xsl:with-param name="collName" select="$collName"/>
462 </xsl:apply-templates>-->
463 </xsl:template>
464
465 <xsl:template match="serviceList">
466 <xsl:param name="collName"/>
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='process'">pr</xsl:when>
488 <xsl:when test="@type='applet'">a</xsl:when>
489 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
490 </xsl:choose>
491 </xsl:variable>
492 <xsl:if test="$action != 'DO_NOT_DISPLAY'">
493 <div class="paramLabel">
494 <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
495 <xsl:value-of select="displayItem[@name='name']"/>
496 </a>
497 </div>
498 <div class="paramLabel">
499 <xsl:value-of select="displayItem[@name='description']"/>
500 </div>
501 <br class="clear"/>
502 </xsl:if>
503 </xsl:for-each>
504 </div>
505 </xsl:if>
506
507 </xsl:template>
508
509 <!-- classifier page ............................................................................ -->
510 <xsl:template name="collapsedNavigationTab">
511 <xsl:param name="type"/>
512 <xsl:variable name="isCurrent" select="/page/pageResponse/service[@type=$type]"/>
513 <li>
514 <xsl:if test="$isCurrent">
515 <xsl:attribute name="class">current</xsl:attribute>
516 </xsl:if>
517 <a>
518 <xsl:if test="service[@name=$type]/displayItem[@name='description']">
519 <xsl:attribute name="title">
520 <xsl:value-of select="service[@name=$type]/displayItem[@name='description']"/>
521 </xsl:attribute>
522 </xsl:if>
523 <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>
524 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, $type)"/>
525 </a>
526 </li>
527 </xsl:template>
528
529 <xsl:template name="navigationTab">
530 <xsl:variable name="isCurrent" select="@name=/page/pageResponse/service/@name"/>
531 <xsl:variable name="action">
532 <xsl:choose>
533 <xsl:when test="@type='query'">q</xsl:when>
534 <xsl:when test="@type='browse'">b</xsl:when>
535 <xsl:when test="@type='process'">pr</xsl:when>
536 <xsl:when test="@type='applet'">a</xsl:when>
537 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
538 </xsl:choose>
539 </xsl:variable>
540 <xsl:if test="$action!='DO_NOT_DISPLAY'">
541 <li>
542 <xsl:if test="$isCurrent">
543 <xsl:attribute name="class">current</xsl:attribute>
544 </xsl:if>
545 <a>
546 <xsl:if test="displayItem[@name='description']">
547 <xsl:attribute name="title">
548 <xsl:value-of select="displayItem[@name='description']"/>
549 </xsl:attribute>
550 </xsl:if>
551 <xsl:choose>
552 <xsl:when test="classifierList/classifier/@name">
553 <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>
554 </xsl:when>
555 <xsl:otherwise>
556 <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>
557 </xsl:otherwise>
558 </xsl:choose>
559 <xsl:value-of select="displayItem[@name='name']"/>
560 </a>
561 </li>
562 </xsl:if>
563 </xsl:template>
564
565 <xsl:template name="classifierLink">
566 <xsl:if test="@name=/page/pageResponse/classifier/@name">
567 <xsl:attribute name="class">current</xsl:attribute>
568 </xsl:if>
569 <a href="{$library_name}?a=b&amp;rt=r&amp;s={/page/pageResponse/service/@name}&amp;c={/page/pageResponse/collection/@name}&amp;cl={@name}">
570 <xsl:value-of select="displayItem[@name='description']"/>
571 </a>
572 </xsl:template>
573
574 <!-- query page ............................................................................ -->
575 <xsl:template name="indexName">
576 <xsl:value-of select="/page/pageResponse/service/displayItem[@name='name']"/>
577 </xsl:template>
578 <xsl:template name="queryPageCollectionName">
579 <xsl:choose>
580 <xsl:when test="/page/pageResponse/collection">
581 <gslib:aboutCollectionPageTitle/>
582 </xsl:when>
583 <xsl:otherwise>Cross-Collection</xsl:otherwise>
584 </xsl:choose>
585 </xsl:template>
586
587 <!--
588BERRY BASKET TEMPLATES
589These get used on many different pages to add the
590berry basket function to the site
591-->
592 <!-- put the drag&drop berry basket on the page -->
593 <xsl:template name="berryBasket">
594 <xsl:if test="$berryBasketOn">
595 <div id="berrybasket" class="hide">
596 <span>Berry Basket</span>
597 <span id="berryBasketExpandCollapseLinks" style="display: none;">
598 <a id="berryBasketExpandLink" href="javascript:showBasket()">Expand</a>
599 <a id="berryBasketCollapseLink" style="display: none;" href="javascript:hideBasket()">Collapse</a>
600 </span>
601 <div id="baskethandle">
602 <span>
603 <xsl:text> </xsl:text>
604 </span>
605 </div>
606 <div id="berries">
607 <span>
608 <xsl:text> </xsl:text>
609 </span>
610 </div>
611 </div>
612 </xsl:if>
613 </xsl:template>
614
615 <!-- put the drag&drop document basket on the page -->
616 <xsl:template name="documentBasket">
617 <xsl:if test="$documentBasketOn and /page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true' 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))">
618 <div id="documentbasket" class="hide">
619 <span>Document Basket</span>
620 <span id="documentBasketExpandCollapseLinks" style="display: none;">
621 <a id="documentBasketExpandLink" href="javascript:showDocumentBox()">Expand</a>
622 <a id="documentBasketCollapseLink" style="display: none;" href="javascript:hideDocumentBox()">Collapse</a>
623 </span>
624 <div id="documenthandle">
625 <span>
626 <xsl:text> </xsl:text>
627 </span>
628 </div>
629 <div id="documentpages">
630 <span>
631 <xsl:text> </xsl:text>
632 </span>
633 </div>
634 <div>
635 <a href="javascript:clearBasket();">Clear basket</a>
636 </div>
637 </div>
638 </xsl:if>
639 </xsl:template>
640
641 <!-- include the required javascript and css for berry baskets -->
642 <xsl:template name="berryBasketHeadTags">
643 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/yahoo-min.js"><xsl:text> </xsl:text></script>
644 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/event-min.js"><xsl:text> </xsl:text></script>
645 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/connection-min.js"><xsl:text> </xsl:text></script>
646 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dom-min.js"><xsl:text> </xsl:text></script>
647 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dragdrop-min.js"><xsl:text> </xsl:text></script>
648 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/cookie-min.js"><xsl:text> </xsl:text></script>
649 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/animation-min.js"><xsl:text> </xsl:text></script>
650
651 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDPlayer.js"><xsl:text> </xsl:text></script>
652 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDOnTop.js"><xsl:text> </xsl:text></script>
653 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/berrybasket.js"><xsl:text> </xsl:text></script>
654 <link rel="stylesheet" href="interfaces/{$interface_name}/style/berry.css" type="text/css"/>
655
656 <!-- Combo-handled YUI CSS files: -->
657 <link rel="stylesheet" type="text/css" href="interfaces/{$interface_name}/style/skin.css"/>
658
659 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentbasket.js"><xsl:text> </xsl:text></script>
660 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentBasketDragDrop.js"><xsl:text> </xsl:text></script>
661 <!-- Combo-handled YUI JS files: -->
662 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yahoo-dom-event.js"><xsl:text> </xsl:text></script>
663 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/container_core-min.js"><xsl:text> </xsl:text></script>
664 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/element-min.js"><xsl:text> </xsl:text></script>
665 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/menu-min.js"><xsl:text> </xsl:text></script>
666 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/button-min.js"><xsl:text> </xsl:text></script>
667 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-min.js"><xsl:text> </xsl:text></script>
668 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yuiloader-min.js"><xsl:text> </xsl:text></script>
669 <!--<script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-dialog.js"><xsl:text> </xsl:text></script>-->
670
671 <link rel="stylesheet" href="interfaces/{$interface_name}/style/documentbasket.css" type="text/css"/>
672 </xsl:template>
673
674 <!--
675create a little berry which can be drag&dropped onto the berry basket
676used on classifier and search result pages
677-->
678 <xsl:template name="documentBerryForClassifierOrSearchPage">
679 <xsl:if test="$berryBasketOn">
680 <img class="pick" src="interfaces/{$interface_name}/images/berry.png" alt="in basket" width="15" height="15" border="0">
681 <xsl:attribute name="id"><xsl:value-of select="/page/pageResponse/collection/@name"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
682 </img>
683 </xsl:if>
684 </xsl:template>
685
686 <!--
687create little berrys which can be drag&dropped onto the berry basket
688used on the document page
689-->
690 <xsl:template name="documentBerryForDocumentPage">
691 <xsl:variable name="selectedNode">
692 <xsl:value-of select="/page/pageResponse/document/@selectedNode"/>
693 </xsl:variable>
694 <xsl:variable name="rootNode">
695 <xsl:value-of select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
696 </xsl:variable>
697 <xsl:if test="$berryBasketOn">
698 <div id="documentberries">
699 <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"/>
700 <span id="{/page/pageResponse/collection/@name}:{$rootNode}:root" class="documentberry">the whole document</span>
701 <!--<xsl:if test="$selectedNode != $rootNode">
702 <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"/>
703 <span id="{/page/pageResponse/collection/@name}:{$selectedNode}:section" class="documentberry">the current section</span>
704 </xsl:if>-->
705 </div>
706 </xsl:if>
707 </xsl:template>
708
709 <!-- document page -->
710 <xsl:template name="documentTitle">
711 <xsl:value-of select="/page/pageResponse/document/documentNode/metadataList/metadata[@name='Title']"/>
712 </xsl:template>
713 <xsl:template name="coverImage">
714 <img>
715 <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>
716 </img>
717 </xsl:template>
718
719 <xsl:template name="previousNextButtons">
720 <!-- prev -->
721 <a>
722 <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>
723 <img class="lessarrow" src="interfaces/{$interface_name}/images/previous.png"/>
724 </a>
725 <!-- next -->
726 <a>
727 <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>
728 <img class="morearrow" src="interfaces/{$interface_name}/images/next.png"/>
729 </a>
730 </xsl:template>
731
732
733 <!-- This next template expands gslib:langfrag (used by document.xsl and documentbasket.xsl).
734 When debugging with o=skinandlibdoc, it's seen that <gslib:langfrag name='dse' /> gets expanded to:
735 <xsl:call-template name="langfrag">
736 <xsl:with-param name="name">dse</xsl:with-param>
737 </xsl:call-template>
738 Before the param can be used in this template, need to retrieve it by name with <xsl:param/>
739 as explained in http://www.maconstateit.net/tutorials/XML/XML05/xml05-05.aspx
740 -->
741 <xsl:template name="langfrag">
742 <xsl:param name="name"/>
743 <script type="text/javascript">
744 <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceStringsAsJavascript($interface_name, /page/@lang, $name)"/>
745 </script>
746 </xsl:template>
747
748
749 <!-- builds up links to available document types equivalent to the default source
750 document with as anchor the equivalent documents' doctype icons. -->
751 <xsl:template name="equivDocLinks">
752 <xsl:param name="count"/>
753
754 <xsl:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
755 <xsl:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
756
757 <!--<xsl:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>-->
758 <!-- In the following variable statement, we're trying to set the docStartlink to any metadata whose value
759 ends on equivDocLink but NOT /equivDocLink. Unfortunately, the xslt function fn:ends-with only exists from
760 xslt 2.0 onwards. So need to use substring() and string-lenth() functions now to check whether the 13th char
761 from the end is a slash or not, in order to distinguish between the start of a doclink and end of one.
762 If this 13th char from the end is not a slash, then we found (the string we want to store in) docStartlink. -->
763 <xsl:variable name="docStartlink">
764 <xsl:for-each select="metadataList/metadata">
765 <xsl:if test="contains(@name, 'equivDocLink')">
766 <xsl:variable name="tmpvar" select="substring(@name, string-length(@name)-12, 1)"/>
767 <xsl:if test="not($tmpvar='/')">
768 <xsl:value-of select="self::node()[@name]"/>
769 </xsl:if>
770 </xsl:if>
771 </xsl:for-each>
772 </xsl:variable>
773
774 <xsl:variable name="equivDocIcon" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docicon, $count)" />
775 <xsl:variable name="equivStartlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docStartlink, $count)" />
776 <xsl:variable name="equivEndlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docEndlink, $count)" />
777
778 <xsl:if test="$equivDocIcon != ''">
779 <xsl:value-of disable-output-escaping="yes" select="$equivStartlink"/>
780 <xsl:value-of disable-output-escaping="yes" select="$equivDocIcon"/>
781 <xsl:value-of disable-output-escaping="yes" select="$equivEndlink"/>
782
783 <!-- recursively call this template to get multiple entries -->
784 <xsl:call-template name="equivDocLinks">
785 <xsl:with-param name="count"><xsl:value-of select="$count + 1"/></xsl:with-param>
786 </xsl:call-template>
787 </xsl:if>
788
789 </xsl:template>
790
791</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.