source: other-projects/tipple-android/i-greenstone-server-files/greenstone/webapps/greenstone3/interfaces/default/transform/gslib.xsl@ 26899

Last change on this file since 26899 was 26899, checked in by davidb, 11 years ago

Tipple reborn after Chris's Summer of Code 2013

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