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

Last change on this file since 31380 was 31380, checked in by kjdon, 7 years ago

added some new templates to do with collection groups. modified selectACollectionTextBar to display a different message depending on whether there are groups or collecitons or both or none.

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