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

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

removing hard coded text fragments from xsl/js files

File size: 37.5 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">
308 <xsl:text>Register</xsl:text>
309 </a>
310 </div>
311 <div class="paramValue">
312 <xsl:text>Register as a new user</xsl:text>
313 </div>
314 </xsl:for-each>
315 </xsl:template>
316
317 <xsl:template name="libraryInterfaceLink">
318 <li>
319 <a href="{$library_name}?a=p&amp;sa=gli4gs3">
320 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.librarian_interface')"/>
321 </a>
322 </li>
323 </xsl:template>
324
325 <xsl:template name="greenstoneLogoAlternateText">
326 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
327 </xsl:template>
328
329 <!-- about page - collection home ....................................................................... -->
330 <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
331 <xsl:variable name="httpPath" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
332 <xsl:variable name="siteName" select="$site_name"/>
333 <!--
334 Already defined above as a variable, not sure why if way being defined here again as a 'param'
335 <xsl:param name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
336 -->
337 <xsl:param name="pageType"/>
338 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
339 <xsl:variable name="this-service" select="/page/pageRequest/paramList/param[@name = 's']/@value"/>
340
341<!--
342_httpimages_ {_httpweb_/images}
343_httpscript_ {_httpweb_/script}
344_httpstyle_ {_httpweb_/style}
345_httpflash_ {_httpweb_/flash}
346_httpjava_ {_httpweb_/java}
347-->
348
349
350 <xsl:template name="define-js-variable">
351 <xsl:param name="name"/>
352 <xsl:param name="value"/>
353 <script type="text/javascript">
354 gs.variables[<xslt:text disable-output-escaping="yes">"</xslt:text><xsl:value-of select="$name"/><xslt:text disable-output-escaping="yes">"</xslt:text>]
355 <xslt:text disable-output-escaping="yes"> = "</xslt:text>
356 <xsl:value-of select="$value"/>
357 <xslt:text disable-output-escaping="yes">";</xslt:text>
358 </script>
359 </xsl:template>
360
361 <xsl:variable name="_httpcollection_" select="$httpPath"/>
362 <xsl:variable name="_httpbrowse_"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/browse</xsl:variable>
363 <xsl:variable name="_httpquery_"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/search</xsl:variable>
364
365 <xsl:template name="define-js-macro-variables">
366
367 <xsl:call-template name="define-js-variable">
368 <xsl:with-param name="name" select="'_httpbrowse_'"/>
369 <xsl:with-param name="value" select="$_httpbrowse_"/>
370 </xsl:call-template>
371
372 <xsl:call-template name="define-js-variable">
373 <xsl:with-param name="name" select="'_httpquery_'"/>
374 <xsl:with-param name="value" select="$_httpquery_"/>
375 </xsl:call-template>
376
377 </xsl:template>
378
379
380 <xsl:template name="aboutCollectionPageTitle">
381 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
382 <xsl:value-of select="/page/pageResponse/collection/displayItem[@name='name']"/>
383 <xsl:text> </xsl:text>
384 </xsl:template>
385
386 <xsl:template name="collectionHomeLinkWithLogoIfAvailable">
387 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
388 <xsl:choose>
389 <xsl:when test="$this-element/displayItem[@name='icon']">
390 <img border="0">
391 <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>
392 <xsl:attribute name="alt">
393 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
394 </xsl:attribute>
395 <xsl:attribute name="title">
396 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
397 </xsl:attribute>
398 </img>
399 </xsl:when>
400 <xsl:otherwise>
401 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
402 </xsl:otherwise>
403 </xsl:choose>
404 </a>
405 </xsl:template>
406
407 <xsl:template name="homeButtonTop">
408 <a href="{$library_name}?a=p&amp;sa=home">
409 <xsl:attribute name="title">
410 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/>
411 </xsl:attribute>
412 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
413 </a>
414 </xsl:template>
415
416 <xsl:template name="helpButtonTop">
417 <xsl:choose>
418 <xsl:when test="$pageType='help'">
419 <li>
420 <a>
421 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
422 </a>
423 </li>
424 </xsl:when>
425 <xsl:otherwise>
426 <li>
427 <a href="{$library_name}?a=p&amp;sa=help&amp;c={$collName}">
428 <xsl:attribute name="title">
429 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/>
430 </xsl:attribute>
431 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
432 </a>
433 </li>
434 </xsl:otherwise>
435 </xsl:choose>
436 </xsl:template>
437
438 <xsl:template name="preferencesButtonTop">
439 <xsl:choose>
440 <xsl:when test="$pageType='pref'">
441 <li>
442 <a>
443 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
444 </a>
445 </li>
446 </xsl:when>
447 <xsl:otherwise>
448 <li>
449 <a href="{$library_name}?a=p&amp;sa=pref&amp;c={$collName}">
450 <xsl:attribute name="title">
451 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/>
452 </xsl:attribute>
453 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
454 </a>
455 </li>
456 </xsl:otherwise>
457 </xsl:choose>
458 </xsl:template>
459
460 <xsl:template name="servicesNavigationBar">
461 <xsl:for-each select="$this-element/serviceList/service">
462 <xsl:variable name="action">
463 <xsl:choose>
464 <xsl:when test="@name=$this-service">CURRENT</xsl:when>
465 <xsl:when test="@type='query'">q</xsl:when>
466 <xsl:when test="@type='browse'">b</xsl:when>
467 <xsl:when test="@type='process'">pr</xsl:when>
468 <xsl:when test="@type='applet'">a</xsl:when>
469 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
470 </xsl:choose>
471 </xsl:variable>
472 <xsl:choose>
473 <xsl:when test="$action='CURRENT'">
474 <li>
475 <a>
476 <xsl:value-of select="displayItem[@name='name']"/>
477 </a>
478 </li>
479 </xsl:when>
480 <xsl:when test="$action !='DO_NOT_DISPLAY'">
481 <li>
482 <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
483 <xsl:if test="displayItem[@name='description']">
484 <xsl:attribute name="title">
485 <xsl:value-of select="displayItem[@name='description']"/>
486 </xsl:attribute>
487 </xsl:if>
488 <xsl:value-of select="displayItem[@name='name']"/>
489 </a>
490 </li>
491 </xsl:when>
492 </xsl:choose>
493 </xsl:for-each>
494 </xsl:template>
495
496 <xsl:template name="collectionDescriptionTextAndServicesLinks">
497 <xsl:apply-templates select="pageResponse/collection|serviceCluster"/>
498 </xsl:template>
499 <xsl:template match="collection|serviceCluster">
500 <xsl:value-of select="displayItem[@name='description']" disable-output-escaping="yes"/>
501<!-- Uncomment this section if you want the collection service links and their descriptions to appear -->
502 <!--<xsl:apply-templates select="serviceList">
503 <xsl:with-param name="collName" select="$collName"/>
504 </xsl:apply-templates>-->
505 </xsl:template>
506
507 <xsl:template match="serviceList">
508 <xsl:param name="collName"/>
509 <h3>
510 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.services')"/>
511 </h3>
512 <p>
513 <xsl:choose>
514 <xsl:when test="service">
515 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.servicehelp')"/>
516 </xsl:when>
517 <xsl:otherwise>
518 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.noservices')"/>
519 </xsl:otherwise>
520 </xsl:choose>
521 </p>
522 <xsl:if test="service">
523 <div id="servicelist">
524 <xsl:for-each select="service">
525 <xsl:sort select="position()" order="descending" data-type="number"/>
526 <xsl:variable name="action">
527 <xsl:choose>
528 <xsl:when test="@type='query'">q</xsl:when>
529 <xsl:when test="@type='process'">pr</xsl:when>
530 <xsl:when test="@type='applet'">a</xsl:when>
531 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
532 </xsl:choose>
533 </xsl:variable>
534 <xsl:if test="$action != 'DO_NOT_DISPLAY'">
535 <div class="paramLabel">
536 <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
537 <xsl:value-of select="displayItem[@name='name']"/>
538 </a>
539 </div>
540 <div class="paramLabel">
541 <xsl:value-of select="displayItem[@name='description']"/>
542 </div>
543 <br class="clear"/>
544 </xsl:if>
545 </xsl:for-each>
546 </div>
547 </xsl:if>
548
549 </xsl:template>
550
551 <!-- classifier page ............................................................................ -->
552 <xsl:template name="collapsedNavigationTab">
553 <xsl:param name="type"/>
554 <xsl:variable name="isCurrent" select="/page/pageResponse/service[@type=$type]"/>
555 <li>
556 <xsl:if test="$isCurrent">
557 <xsl:attribute name="class">current</xsl:attribute>
558 </xsl:if>
559 <a>
560 <xsl:if test="service[@name=$type]/displayItem[@name='description']">
561 <xsl:attribute name="title">
562 <xsl:value-of select="service[@name=$type]/displayItem[@name='description']"/>
563 </xsl:attribute>
564 </xsl:if>
565 <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>
566 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, $type)"/>
567 </a>
568 </li>
569 </xsl:template>
570
571 <xsl:template name="navigationTab">
572 <xsl:variable name="isCurrent" select="@name=/page/pageResponse/service/@name"/>
573 <xsl:variable name="action">
574 <xsl:choose>
575 <xsl:when test="@type='query'">q</xsl:when>
576 <xsl:when test="@type='browse'">b</xsl:when>
577 <xsl:when test="@type='process'">pr</xsl:when>
578 <xsl:when test="@type='applet'">a</xsl:when>
579 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
580 </xsl:choose>
581 </xsl:variable>
582 <xsl:if test="$action!='DO_NOT_DISPLAY'">
583 <li>
584 <xsl:if test="$isCurrent">
585 <xsl:attribute name="class">current</xsl:attribute>
586 </xsl:if>
587 <a>
588 <xsl:if test="displayItem[@name='description']">
589 <xsl:attribute name="title">
590 <xsl:value-of select="displayItem[@name='description']"/>
591 </xsl:attribute>
592 </xsl:if>
593 <xsl:choose>
594 <xsl:when test="classifierList/classifier/@name">
595 <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>
596 </xsl:when>
597 <xsl:otherwise>
598 <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>
599 </xsl:otherwise>
600 </xsl:choose>
601 <xsl:value-of select="displayItem[@name='name']"/>
602 </a>
603 </li>
604 </xsl:if>
605 </xsl:template>
606
607 <xsl:template name="classifierLink">
608 <xsl:if test="@name=/page/pageResponse/classifier/@name">
609 <xsl:attribute name="class">current</xsl:attribute>
610 </xsl:if>
611 <a href="{$library_name}?a=b&amp;rt=r&amp;s={/page/pageResponse/service/@name}&amp;c={/page/pageResponse/collection/@name}&amp;cl={@name}">
612 <xsl:value-of select="displayItem[@name='description']"/>
613 </a>
614 </xsl:template>
615
616 <!-- query page ............................................................................ -->
617<!-- <xsl:template name="indexName">
618 <xsl:value-of select="/page/pageResponse/service/displayItem[@name='name']"/>
619 </xsl:template>
620
621 <xsl:template name="queryPageCollectionName">
622 <xsl:choose>
623 <xsl:when test="/page/pageResponse/collection">
624 <gslib:aboutCollectionPageTitle/>
625 </xsl:when>
626 <xsl:otherwise>Cross-Collection</xsl:otherwise>
627 </xsl:choose>
628 </xsl:template>-->
629
630 <!--
631BERRY BASKET TEMPLATES
632These get used on many different pages to add the
633berry basket function to the site
634-->
635 <!-- put the drag&drop berry basket on the page -->
636 <xsl:template name="berryBasket">
637 <xsl:if test="$berryBasketOn">
638 <div id="berrybasket" class="hide">
639 <span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.title')"/><xsl:text> </xsl:text></span>
640 <span id="berryBasketExpandCollapseLinks" style="display: none;">
641 <a id="berryBasketExpandLink" href="javascript:showBasket()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.expand')"/></a>
642 <a id="berryBasketCollapseLink" style="display: none;" href="javascript:hideBasket()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.collapse')"/></a>
643 </span>
644 <div id="baskethandle">
645 <span>
646 <xsl:text> </xsl:text>
647 </span>
648 </div>
649 <div id="berries">
650 <span>
651 <xsl:text> </xsl:text>
652 </span>
653 </div>
654 <div><a id="berryFullViewLink" style="display: none;"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.full')"/></a></div>
655 <div id="berryHelpMsg"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.help')"/></div>
656 </div>
657
658 </xsl:if>
659 </xsl:template>
660
661 <!-- put the drag&drop document basket on the page -->
662 <xsl:template name="documentBasket">
663 <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))">
664 <div id="documentbasket" class="hide">
665 <span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'db.doc_basket')"/><xsl:text> </xsl:text></span>
666 <span id="documentBasketExpandCollapseLinks" style="display: none;">
667 <a id="documentBasketExpandLink" href="javascript:showDocumentBox()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.expand')"/></a>
668 <a id="documentBasketCollapseLink" style="display: none;" href="javascript:hideDocumentBox()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.collapse')"/></a>
669 </span>
670 <div id="documenthandle">
671 <span>
672 <xsl:text> </xsl:text>
673 </span>
674 </div>
675 <div id="documentpages">
676 <span>
677 <xsl:text> </xsl:text>
678 </span>
679 </div>
680 <div>
681 <a href="javascript:clearBasket();"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.clear')"/></a>
682 </div>
683 </div>
684 </xsl:if>
685 </xsl:template>
686
687 <!-- include the required javascript and css for berry baskets -->
688 <xsl:template name="berryBasketHeadTags">
689 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/yahoo-min.js"><xsl:text> </xsl:text></script>
690 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/event-min.js"><xsl:text> </xsl:text></script>
691 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/connection-min.js"><xsl:text> </xsl:text></script>
692 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dom-min.js"><xsl:text> </xsl:text></script>
693 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dragdrop-min.js"><xsl:text> </xsl:text></script>
694 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/cookie-min.js"><xsl:text> </xsl:text></script>
695 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/animation-min.js"><xsl:text> </xsl:text></script>
696
697 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDPlayer.js"><xsl:text> </xsl:text></script>
698 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDOnTop.js"><xsl:text> </xsl:text></script>
699 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/berrybasket.js"><xsl:text> </xsl:text></script>
700 <link rel="stylesheet" href="interfaces/{$interface_name}/style/berry.css" type="text/css"/>
701
702 <!-- Combo-handled YUI CSS files: -->
703 <link rel="stylesheet" type="text/css" href="interfaces/{$interface_name}/style/skin.css"/>
704
705 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentbasket.js"><xsl:text> </xsl:text></script>
706 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentBasketDragDrop.js"><xsl:text> </xsl:text></script>
707 <!-- Combo-handled YUI JS files: -->
708 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yahoo-dom-event.js"><xsl:text> </xsl:text></script>
709 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/container_core-min.js"><xsl:text> </xsl:text></script>
710 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/element-min.js"><xsl:text> </xsl:text></script>
711 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/menu-min.js"><xsl:text> </xsl:text></script>
712 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/button-min.js"><xsl:text> </xsl:text></script>
713 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-min.js"><xsl:text> </xsl:text></script>
714 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yuiloader-min.js"><xsl:text> </xsl:text></script>
715 <!--<script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-dialog.js"><xsl:text> </xsl:text></script>-->
716
717 <link rel="stylesheet" href="interfaces/{$interface_name}/style/documentbasket.css" type="text/css"/>
718 </xsl:template>
719
720 <!--
721create a little berry which can be drag&dropped onto the berry basket
722used on classifier and search result pages
723-->
724 <xsl:template name="documentBerryForClassifierOrSearchPage">
725 <xsl:if test="$berryBasketOn">
726 <img class="pick" src="interfaces/{$interface_name}/images/berry.png" alt="in basket" width="15" height="15" border="0">
727 <xsl:attribute name="id"><xsl:value-of select="/page/pageResponse/collection/@name"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
728 </img>
729 </xsl:if>
730 </xsl:template>
731
732 <!--
733create little berrys which can be drag&dropped onto the berry basket
734used on the document page
735-->
736 <xsl:template name="documentBerryForDocumentPage">
737 <xsl:variable name="selectedNode">
738 <xsl:value-of select="/page/pageResponse/document/@selectedNode"/>
739 </xsl:variable>
740 <xsl:variable name="rootNode">
741 <xsl:value-of select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
742 </xsl:variable>
743 <xsl:if test="$berryBasketOn">
744 <div id="documentberries">
745 <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"/>
746 <span id="{/page/pageResponse/collection/@name}:{$rootNode}:root" class="documentberry">the whole document</span>
747 <!--<xsl:if test="$selectedNode != $rootNode">
748 <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"/>
749 <span id="{/page/pageResponse/collection/@name}:{$selectedNode}:section" class="documentberry">the current section</span>
750 </xsl:if>-->
751 </div>
752 </xsl:if>
753 </xsl:template>
754
755 <!-- document page -->
756 <xsl:template name="documentTitle">
757 <xsl:value-of select="/page/pageResponse/document/documentNode/metadataList/metadata[@name='Title']"/>
758 </xsl:template>
759 <xsl:template name="coverImage">
760 <img>
761 <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>
762 </img>
763 </xsl:template>
764
765 <xsl:template name="previousNextButtons">
766 <!-- prev -->
767 <a>
768 <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>
769 <img class="lessarrow" src="interfaces/{$interface_name}/images/previous.png"/>
770 </a>
771 <!-- next -->
772 <a>
773 <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>
774 <img class="morearrow" src="interfaces/{$interface_name}/images/next.png"/>
775 </a>
776 </xsl:template>
777
778
779 <!-- This next template expands gslib:langfrag (used by document.xsl and documentbasket.xsl).
780 When debugging with o=skinandlibdoc, it's seen that <gslib:langfrag name='dse' /> gets expanded to:
781 <xsl:call-template name="langfrag">
782 <xsl:with-param name="name">dse</xsl:with-param>
783 </xsl:call-template>
784 Before the param can be used in this template, need to retrieve it by name with <xsl:param/>
785 as explained in http://www.maconstateit.net/tutorials/XML/XML05/xml05-05.aspx
786 -->
787 <xsl:template name="langfrag">
788 <xsl:param name="name"/>
789 <script type="text/javascript">
790 <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceStringsAsJavascript($interface_name, /page/@lang, $name)"/>
791 </script>
792 </xsl:template>
793
794
795 <!-- builds up links to available document types equivalent to the default source
796 document with as anchor the equivalent documents' doctype icons. -->
797 <xsl:template name="equivDocLinks">
798 <xsl:param name="count"/>
799
800 <xsl:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
801 <xsl:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
802
803 <!--<xsl:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>-->
804 <!-- In the following variable statement, we're trying to set the docStartlink to any metadata whose value
805 ends on equivDocLink but NOT /equivDocLink. Unfortunately, the xslt function fn:ends-with only exists from
806 xslt 2.0 onwards. So need to use substring() and string-lenth() functions now to check whether the 13th char
807 from the end is a slash or not, in order to distinguish between the start of a doclink and end of one.
808 If this 13th char from the end is not a slash, then we found (the string we want to store in) docStartlink. -->
809 <xsl:variable name="docStartlink">
810 <xsl:for-each select="metadataList/metadata">
811 <xsl:if test="contains(@name, 'equivDocLink')">
812 <xsl:variable name="tmpvar" select="substring(@name, string-length(@name)-12, 1)"/>
813 <xsl:if test="not($tmpvar='/')">
814 <xsl:value-of select="self::node()[@name]"/>
815 </xsl:if>
816 </xsl:if>
817 </xsl:for-each>
818 </xsl:variable>
819
820 <xsl:variable name="equivDocIcon" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docicon, $count)" />
821 <xsl:variable name="equivStartlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docStartlink, $count)" />
822 <xsl:variable name="equivEndlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docEndlink, $count)" />
823
824 <xsl:if test="$equivDocIcon != ''">
825 <xsl:value-of disable-output-escaping="yes" select="$equivStartlink"/>
826 <xsl:value-of disable-output-escaping="yes" select="$equivDocIcon"/>
827 <xsl:value-of disable-output-escaping="yes" select="$equivEndlink"/>
828
829 <!-- recursively call this template to get multiple entries -->
830 <xsl:call-template name="equivDocLinks">
831 <xsl:with-param name="count"><xsl:value-of select="$count + 1"/></xsl:with-param>
832 </xsl:call-template>
833 </xsl:if>
834
835 </xsl:template>
836
837</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.