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

Last change on this file since 26488 was 26488, checked in by kjdon, 11 years ago

using a dictionary string instead of hard coding

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