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

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

move register text to property file

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