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

Last change on this file since 32150 was 32150, checked in by ak19, 3 years ago

I changed gli4gs3.xsl to rewrite the applet page produced by PageAction.java to replace it with the JNLP Web Start version of GLI. Dr Bainbridge got this to work by changing the Librarian Interface link on the main page to have a download attribute, which will force the linked item to be downloaded. The download attribute is set to the name to assign to the downloaded item, the jnlp file. Now removing the unnecessary static GLIappWebStart.jnlp from the gli folder (as it used some fixed strings for dynamic values) and removed the unnecessary style.xsl and icons.xsl from default\transform as they were used by the now bypassed applet and were moreover GS2 styling.

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