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

Last change on this file since 30859 was 30859, checked in by kjdon, 8 years ago

added a template for displaying collection metadata: eg <gslib:collectionMeta name='numDocs'/>

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