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

Last change on this file since 30841 was 30841, checked in by kjdon, 8 years ago

site name and description are now displayItems rather than metadata. and at site and colleciton level, displayItems are in a displayItemList, to match metadataList

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