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

Last change on this file since 26202 was 26202, checked in by sjm84, 12 years ago

Move the trailing space after the site link to outside of the a tag, this removes the trailing underline that was present before

File size: 32.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<xsl:output
12 method="html"
13 doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
14 doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
15
16 <xsl:include href="xml-to-string.xsl"/>
17
18 <!-- some global parameters - these are set by whoever is invoking the transformation -->
19 <xsl:param name="interface_name"/>
20 <xsl:param name="library_name"/>
21 <xsl:param name="site_name"/>
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 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>
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>
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="collectionLinkWithImage">
204 <xsl:variable name="desc"><xsl:value-of select="displayItem[@name='shortDescription']"/></xsl:variable>
205 <xsl:choose>
206 <xsl:when test="displayItem[@name='icon']">
207 <a href="{$library_name}/collection/{@name}/page/about" title="{$desc}">
208 <img class="collectionLinkImage">
209 <xsl:attribute name="alt"><xsl:value-of select="displayItem[@name='name']"/></xsl:attribute>
210 <xsl:attribute name="src">sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="@name"/>/images/<xsl:value-of select="displayItem[@name='icon']"/></xsl:attribute>
211 </img>
212 </a>
213 </xsl:when>
214 <xsl:otherwise>
215 <a href="{$library_name}/collection/{@name}/page/about" title="{$desc}">
216 <div class="collectionLink">
217 <xsl:value-of select="displayItem[@name='name']"/>
218 </div>
219 </a>
220 </xsl:otherwise>
221 </xsl:choose>
222 </xsl:template>
223
224 <xsl:template name="serviceClusterList">
225 <xsl:apply-templates select="serviceClusterList"/>
226 </xsl:template>
227
228 <xsl:template match="serviceClusterList">
229 <xsl:for-each select="serviceCluster">
230 <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}">
231 <xsl:value-of select="@name"/>
232 <xsl:value-of select="displayItem[@name='name']"/>
233 </a>
234 </xsl:for-each>
235 </xsl:template>
236
237 <xsl:template name="serviceLink">
238 <div class="paramLabel">
239 <a href="{$library_name}?a=q&amp;rt=d&amp;s={@name}">
240 <xsl:value-of select="displayItem[@name='name']"/>
241 </a>
242 </div>
243 <div class="paramValue">
244 <xsl:value-of select="displayItem[@name='description']"/>
245 </div>
246 <br class="clear"/>
247 </xsl:template>
248
249 <xsl:template name="authenticationLink">
250 <xsl:for-each select="//serviceList/service[@type='authen']">
251 <div class="paramLabel">
252 <a href="{$library_name}/admin/ListUsers">
253 <xsl:value-of select="displayItem[@name='name']"/>
254 </a>
255 </div>
256 <div class="paramValue">
257 <xsl:value-of select="displayItem[@name='description']"/>
258 </div>
259 </xsl:for-each>
260 </xsl:template>
261
262 <xsl:template name="registerLink">
263 <xsl:for-each select="//serviceList/service[@type='authen']">
264 <div class="paramLabel">
265 <a href="{$library_name}/admin/Register">
266 <xsl:text>Register</xsl:text>
267 </a>
268 </div>
269 <div class="paramValue">
270 <xsl:text>Register as a new user</xsl:text>
271 </div>
272 </xsl:for-each>
273 </xsl:template>
274
275 <xsl:template name="libraryInterfaceLink">
276 <li>
277 <a href="{$library_name}?a=p&amp;sa=gli4gs3">
278 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.librarian_interface')"/>
279 </a>
280 </li>
281 </xsl:template>
282
283 <xsl:template name="greenstoneLogoAlternateText">
284 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
285 </xsl:template>
286
287 <!-- about page - collection home ....................................................................... -->
288 <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
289 <xsl:variable name="httpPath" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
290 <xsl:variable name="siteName" select="$site_name"/>
291 <xsl:param name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
292 <xsl:param name="pageType"/>
293 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
294 <xsl:variable name="this-service" select="/page/pageRequest/paramList/param[@name = 's']/@value"/>
295
296 <xsl:template name="aboutCollectionPageTitle">
297 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
298 <xsl:value-of select="/page/pageResponse/collection/displayItem[@name='name']"/>
299 <xsl:text> </xsl:text>
300 </xsl:template>
301
302 <xsl:template name="collectionHomeLinkWithLogoIfAvailable">
303 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
304 <xsl:choose>
305 <xsl:when test="$this-element/displayItem[@name='icon']">
306 <img border="0">
307 <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>
308 <xsl:attribute name="alt">
309 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
310 </xsl:attribute>
311 <xsl:attribute name="title">
312 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
313 </xsl:attribute>
314 </img>
315 </xsl:when>
316 <xsl:otherwise>
317 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
318 </xsl:otherwise>
319 </xsl:choose>
320 </a>
321 </xsl:template>
322
323 <xsl:template name="homeButtonTop">
324 <a href="{$library_name}?a=p&amp;sa=home">
325 <xsl:attribute name="title">
326 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/>
327 </xsl:attribute>
328 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
329 </a>
330 </xsl:template>
331
332 <xsl:template name="helpButtonTop">
333 <xsl:choose>
334 <xsl:when test="$pageType='help'">
335 <li>
336 <a>
337 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
338 </a>
339 </li>
340 </xsl:when>
341 <xsl:otherwise>
342 <li>
343 <a href="{$library_name}?a=p&amp;sa=help&amp;c={$collName}">
344 <xsl:attribute name="title">
345 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/>
346 </xsl:attribute>
347 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
348 </a>
349 </li>
350 </xsl:otherwise>
351 </xsl:choose>
352 </xsl:template>
353
354 <xsl:template name="preferencesButtonTop">
355 <xsl:choose>
356 <xsl:when test="$pageType='pref'">
357 <li>
358 <a>
359 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
360 </a>
361 </li>
362 </xsl:when>
363 <xsl:otherwise>
364 <li>
365 <a href="{$library_name}?a=p&amp;sa=pref&amp;c={$collName}">
366 <xsl:attribute name="title">
367 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/>
368 </xsl:attribute>
369 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
370 </a>
371 </li>
372 </xsl:otherwise>
373 </xsl:choose>
374 </xsl:template>
375
376 <xsl:template name="servicesNavigationBar">
377 <xsl:for-each select="$this-element/serviceList/service">
378 <xsl:variable name="action">
379 <xsl:choose>
380 <xsl:when test="@name=$this-service">CURRENT</xsl:when>
381 <xsl:when test="@type='query'">q</xsl:when>
382 <xsl:when test="@type='browse'">b</xsl:when>
383 <xsl:when test="@type='process'">pr</xsl:when>
384 <xsl:when test="@type='applet'">a</xsl:when>
385 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
386 </xsl:choose>
387 </xsl:variable>
388 <xsl:choose>
389 <xsl:when test="$action='CURRENT'">
390 <li>
391 <a>
392 <xsl:value-of select="displayItem[@name='name']"/>
393 </a>
394 </li>
395 </xsl:when>
396 <xsl:when test="$action !='DO_NOT_DISPLAY'">
397 <li>
398 <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
399 <xsl:if test="displayItem[@name='description']">
400 <xsl:attribute name="title">
401 <xsl:value-of select="displayItem[@name='description']"/>
402 </xsl:attribute>
403 </xsl:if>
404 <xsl:value-of select="displayItem[@name='name']"/>
405 </a>
406 </li>
407 </xsl:when>
408 </xsl:choose>
409 </xsl:for-each>
410 </xsl:template>
411
412 <xsl:template name="collectionDescriptionTextAndServicesLinks">
413 <xsl:apply-templates select="pageResponse/collection|serviceCluster"/>
414 </xsl:template>
415 <xsl:template match="collection|serviceCluster">
416 <xsl:value-of select="displayItem[@name='description']" disable-output-escaping="yes"/>
417 <xsl:apply-templates select="serviceList">
418 <xsl:with-param name="collName" select="$collName"/>
419 </xsl:apply-templates>
420 </xsl:template>
421
422 <xsl:template match="serviceList">
423 <xsl:param name="collName"/>
424 <xsl:if test="service[not(@type = 'query' or @type = 'browse' or @type = 'retrieve' or @type = 'oai')]">
425 <h3>
426 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.services')"/>
427 </h3>
428 <p>
429 <xsl:choose>
430 <xsl:when test="service">
431 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.servicehelp')"/>
432 </xsl:when>
433 <xsl:otherwise>
434 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.noservices')"/>
435 </xsl:otherwise>
436 </xsl:choose>
437 </p>
438 <xsl:if test="service">
439 <div id="servicelist">
440 <xsl:for-each select="service">
441 <xsl:sort select="position()" order="descending" data-type="number"/>
442 <xsl:variable name="action">
443 <xsl:choose>
444 <xsl:when test="@type='query'">q</xsl:when>
445 <xsl:when test="@type='browse'">b</xsl:when>
446 <xsl:when test="@type='process'">pr</xsl:when>
447 <xsl:when test="@type='applet'">a</xsl:when>
448 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
449 </xsl:choose>
450 </xsl:variable>
451 <xsl:if test="$action != 'DO_NOT_DISPLAY'">
452 <div class="paramLabel">
453 <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
454 <xsl:value-of select="displayItem[@name='name']"/>
455 </a>
456 </div>
457 <div class="paramLabel">
458 <xsl:value-of select="displayItem[@name='description']"/>
459 </div>
460 <br class="clear"/>
461 </xsl:if>
462 </xsl:for-each>
463 </div>
464 </xsl:if>
465 </xsl:if>
466 </xsl:template>
467
468 <!-- classifier page ............................................................................ -->
469 <xsl:template name="collapsedNavigationTab">
470 <xsl:param name="type"/>
471 <xsl:variable name="isCurrent" select="/page/pageResponse/service[@type=$type]"/>
472 <li>
473 <xsl:if test="$isCurrent">
474 <xsl:attribute name="class">current</xsl:attribute>
475 </xsl:if>
476 <a>
477 <xsl:if test="service[@name=$type]/displayItem[@name='description']">
478 <xsl:attribute name="title">
479 <xsl:value-of select="service[@name=$type]/displayItem[@name='description']"/>
480 </xsl:attribute>
481 </xsl:if>
482 <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>
483 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, $type)"/>
484 </a>
485 </li>
486 </xsl:template>
487
488 <xsl:template name="navigationTab">
489 <xsl:variable name="isCurrent" select="@name=/page/pageResponse/service/@name"/>
490 <xsl:variable name="action">
491 <xsl:choose>
492 <xsl:when test="@type='query'">q</xsl:when>
493 <xsl:when test="@type='browse'">b</xsl:when>
494 <xsl:when test="@type='process'">pr</xsl:when>
495 <xsl:when test="@type='applet'">a</xsl:when>
496 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
497 </xsl:choose>
498 </xsl:variable>
499 <xsl:if test="$action!='DO_NOT_DISPLAY'">
500 <li>
501 <xsl:if test="$isCurrent">
502 <xsl:attribute name="class">current</xsl:attribute>
503 </xsl:if>
504 <a>
505 <xsl:if test="displayItem[@name='description']">
506 <xsl:attribute name="title">
507 <xsl:value-of select="displayItem[@name='description']"/>
508 </xsl:attribute>
509 </xsl:if>
510 <xsl:choose>
511 <xsl:when test="classifierList/classifier/@name">
512 <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>
513 </xsl:when>
514 <xsl:otherwise>
515 <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>
516 </xsl:otherwise>
517 </xsl:choose>
518 <xsl:value-of select="displayItem[@name='name']"/>
519 </a>
520 </li>
521 </xsl:if>
522 </xsl:template>
523
524 <xsl:template name="classifierLink">
525 <xsl:if test="@name=/page/pageResponse/classifier/@name">
526 <xsl:attribute name="class">current</xsl:attribute>
527 </xsl:if>
528 <a href="{$library_name}?a=b&amp;rt=r&amp;s={/page/pageResponse/service/@name}&amp;c={/page/pageResponse/collection/@name}&amp;cl={@name}">
529 <xsl:value-of select="displayItem[@name='description']"/>
530 </a>
531 </xsl:template>
532
533 <!-- query page ............................................................................ -->
534 <xsl:template name="indexName">
535 <xsl:value-of select="/page/pageResponse/service/displayItem[@name='name']"/>
536 </xsl:template>
537 <xsl:template name="queryPageCollectionName">
538 <xsl:choose>
539 <xsl:when test="/page/pageResponse/collection">
540 <gslib:aboutCollectionPageTitle/>
541 </xsl:when>
542 <xsl:otherwise>Cross-Collection</xsl:otherwise>
543 </xsl:choose>
544 </xsl:template>
545
546 <!--
547BERRY BASKET TEMPLATES
548These get used on many different pages to add the
549berry basket function to the site
550-->
551 <!-- put the drag&drop berry basket on the page -->
552 <xsl:template name="berryBasket">
553 <xsl:if test="$berryBasketOn">
554 <div id="berrybasket" class="hide">
555 <span>Berry Basket</span>
556 <span id="berryBasketExpandCollapseLinks" style="display: none;">
557 <a id="berryBasketExpandLink" href="javascript:showBasket()">Expand</a>
558 <a id="berryBasketCollapseLink" style="display: none;" href="javascript:hideBasket()">Collapse</a>
559 </span>
560 <div id="baskethandle">
561 <span>
562 <xsl:text> </xsl:text>
563 </span>
564 </div>
565 <div id="berries">
566 <span>
567 <xsl:text> </xsl:text>
568 </span>
569 </div>
570 </div>
571 </xsl:if>
572 </xsl:template>
573
574 <!-- put the drag&drop document basket on the page -->
575 <xsl:template name="documentBasket">
576 <xsl:if test="$documentBasketOn and /page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
577 <div id="documentbasket" class="hide">
578 <span>Document Basket</span>
579 <span id="documentBasketExpandCollapseLinks" style="display: none;">
580 <a id="documentBasketExpandLink" href="javascript:showDocumentBox()">Expand</a>
581 <a id="documentBasketCollapseLink" style="display: none;" href="javascript:hideDocumentBox()">Collapse</a>
582 </span>
583 <div id="documenthandle">
584 <span>
585 <xsl:text> </xsl:text>
586 </span>
587 </div>
588 <div id="documentpages">
589 <span>
590 <xsl:text> </xsl:text>
591 </span>
592 </div>
593 <div>
594 <a href="javascript:clearBasket();">Clear basket</a>
595 </div>
596 </div>
597 </xsl:if>
598 </xsl:template>
599
600 <!-- include the required javascript and css for berry baskets -->
601 <xsl:template name="berryBasketHeadTags">
602 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/yahoo-min.js"><xsl:text> </xsl:text></script>
603 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/event-min.js"><xsl:text> </xsl:text></script>
604 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/connection-min.js"><xsl:text> </xsl:text></script>
605 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dom-min.js"><xsl:text> </xsl:text></script>
606 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dragdrop-min.js"><xsl:text> </xsl:text></script>
607 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/cookie-min.js"><xsl:text> </xsl:text></script>
608 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/animation-min.js"><xsl:text> </xsl:text></script>
609
610 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDPlayer.js"><xsl:text> </xsl:text></script>
611 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDOnTop.js"><xsl:text> </xsl:text></script>
612 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/berrybasket.js"><xsl:text> </xsl:text></script>
613 <link rel="stylesheet" href="interfaces/{$interface_name}/style/berry.css" type="text/css"/>
614
615 <!-- Combo-handled YUI CSS files: -->
616 <link rel="stylesheet" type="text/css" href="interfaces/{$interface_name}/style/skin.css"/>
617
618 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentbasket.js"><xsl:text> </xsl:text></script>
619 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentBasketDragDrop.js"><xsl:text> </xsl:text></script>
620 <!-- Combo-handled YUI JS files: -->
621 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yahoo-dom-event.js"><xsl:text> </xsl:text></script>
622 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/container_core-min.js"><xsl:text> </xsl:text></script>
623 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/element-min.js"><xsl:text> </xsl:text></script>
624 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/menu-min.js"><xsl:text> </xsl:text></script>
625 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/button-min.js"><xsl:text> </xsl:text></script>
626 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-min.js"><xsl:text> </xsl:text></script>
627 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yuiloader-min.js"><xsl:text> </xsl:text></script>
628 <!--<script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-dialog.js"><xsl:text> </xsl:text></script>-->
629
630 <link rel="stylesheet" href="interfaces/{$interface_name}/style/documentbasket.css" type="text/css"/>
631 </xsl:template>
632
633 <!--
634create a little berry which can be drag&dropped onto the berry basket
635used on classifier and search result pages
636-->
637 <xsl:template name="documentBerryForClassifierOrSearchPage">
638 <xsl:if test="$berryBasketOn">
639 <img class="pick" src="interfaces/{$interface_name}/images/berry.png" alt="in basket" width="15" height="15" border="0">
640 <xsl:attribute name="id"><xsl:value-of select="/page/pageResponse/collection/@name"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
641 </img>
642 </xsl:if>
643 </xsl:template>
644
645 <!--
646create little berrys which can be drag&dropped onto the berry basket
647used on the document page
648-->
649 <xsl:template name="documentBerryForDocumentPage">
650 <xsl:variable name="selectedNode">
651 <xsl:value-of select="/page/pageResponse/document/@selectedNode"/>
652 </xsl:variable>
653 <xsl:variable name="rootNode">
654 <xsl:value-of select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
655 </xsl:variable>
656 <xsl:if test="$berryBasketOn">
657 <div id="documentberries">
658 <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"/>
659 <span id="{/page/pageResponse/collection/@name}:{$rootNode}:root" class="documentberry">the whole document</span>
660 <!--<xsl:if test="$selectedNode != $rootNode">
661 <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"/>
662 <span id="{/page/pageResponse/collection/@name}:{$selectedNode}:section" class="documentberry">the current section</span>
663 </xsl:if>-->
664 </div>
665 </xsl:if>
666 </xsl:template>
667
668 <!-- document page -->
669 <xsl:template name="documentTitle">
670 <xsl:value-of select="/page/pageResponse/document/documentNode/metadataList/metadata[@name='Title']"/>
671 </xsl:template>
672 <xsl:template name="coverImage">
673 <img>
674 <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>
675 </img>
676 </xsl:template>
677
678 <xsl:template name="previousNextButtons">
679 <!-- prev -->
680 <a>
681 <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>
682 <img class="lessarrow" src="interfaces/{$interface_name}/images/previous.png"/>
683 </a>
684 <!-- next -->
685 <a>
686 <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>
687 <img class="morearrow" src="interfaces/{$interface_name}/images/next.png"/>
688 </a>
689 </xsl:template>
690
691
692 <!-- This next template expands gslib:langfrag (used by document.xsl and documentbasket.xsl).
693 When debugging with o=skinandlibdoc, it's seen that <gslib:langfrag name='dse' /> gets expanded to:
694 <xsl:call-template name="langfrag">
695 <xsl:with-param name="name">dse</xsl:with-param>
696 </xsl:call-template>
697 Before the param can be used in this template, need to retrieve it by name with <xsl:param/>
698 as explained in http://www.maconstateit.net/tutorials/XML/XML05/xml05-05.aspx
699 -->
700 <xsl:template name="langfrag">
701 <xsl:param name="name"/>
702 <script type="text/javascript">
703 <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceStringsAsJavascript($interface_name, /page/@lang, $name)"/>
704 </script>
705 </xsl:template>
706
707
708 <!-- builds up links to available document types equivalent to the default source
709 document with as anchor the equivalent documents' doctype icons. -->
710 <xsl:template name="equivDocLinks">
711 <xsl:param name="count"/>
712
713 <xsl:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
714 <xsl:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
715
716 <!--<xsl:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>-->
717 <!-- In the following variable statement, we're trying to set the docStartlink to any metadata whose value
718 ends on equivDocLink but NOT /equivDocLink. Unfortunately, the xslt function fn:ends-with only exists from
719 xslt 2.0 onwards. So need to use substring() and string-lenth() functions now to check whether the 13th char
720 from the end is a slash or not, in order to distinguish between the start of a doclink and end of one.
721 If this 13th char from the end is not a slash, then we found (the string we want to store in) docStartlink. -->
722 <xsl:variable name="docStartlink">
723 <xsl:for-each select="metadataList/metadata">
724 <xsl:if test="contains(@name, 'equivDocLink')">
725 <xsl:variable name="tmpvar" select="substring(@name, string-length(@name)-12, 1)"/>
726 <xsl:if test="not($tmpvar='/')">
727 <xsl:value-of select="self::node()[@name]"/>
728 </xsl:if>
729 </xsl:if>
730 </xsl:for-each>
731 </xsl:variable>
732
733 <xsl:variable name="equivDocIcon" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docicon, $count)" />
734 <xsl:variable name="equivStartlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docStartlink, $count)" />
735 <xsl:variable name="equivEndlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docEndlink, $count)" />
736
737 <xsl:if test="$equivDocIcon != ''">
738 <xsl:value-of disable-output-escaping="yes" select="$equivStartlink"/>
739 <xsl:value-of disable-output-escaping="yes" select="$equivDocIcon"/>
740 <xsl:value-of disable-output-escaping="yes" select="$equivEndlink"/>
741
742 <!-- recursively call this template to get multiple entries -->
743 <xsl:call-template name="equivDocLinks">
744 <xsl:with-param name="count"><xsl:value-of select="$count + 1"/></xsl:with-param>
745 </xsl:call-template>
746 </xsl:if>
747
748 </xsl:template>
749
750</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.