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

Last change on this file since 30542 was 30542, checked in by Georgiy Litvinov, 8 years ago

Added checkFileExistence method for xslt checks. Fixed invisible group button in case badly configured group description.

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