root/main/trunk/greenstone3/web/interfaces/default/transform/gslib.xsl @ 32127

Revision 32127, 41.9 KB (checked in by ak19, 22 months ago)

Fixing up the GS3 GLI applet. To get it to work, follow the instructions at  http://wiki.greenstone.org/doku.php?id=old:remote_greenstone&s[]=applet 2. But need to put the SignedGatherer?.java in web\applet for GS3. 3. In the default interface, edit home.xsl and uncomment <gslib:libraryInterfaceLink/>. 4. Set up Java Control Panel to allow from the host:port of the (remote) GS server on which the GS3 to connect to is hosted. This will then allow accessing applets from that host:port. 5. Configure Internet Explorer (works on Win 8) as explained in GS3's Tudors tutorial for the Phind phrase browser. 6. In Internet Explorer, visit the GS home page, click on the Librarian Interface link and now you will be asked to allow and run the SignedGatherer?.jar GLI applet.

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    <!--<li>-->
388      <a href="{$library_name}?a=p&amp;sa=gli4gs3">
389        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.librarian_interface')"/>
390      </a>
391    <!--</li>-->
392  </xsl:template>
393 
394  <xsl:template name="greenstoneLogoAlternateText">
395    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
396  </xsl:template>
397 
398  <!-- about page - collection home ....................................................................... -->
399  <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
400  <xsl:variable name="httpPath" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
401  <xsl:variable name="siteName" select="$site_name"/>
402  <!--
403      Already defined above as a variable, not sure why if way being defined here again as a 'param'
404      <xsl:param name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
405      -->
406  <xsl:param name="pageType"/>
407  <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
408  <xsl:variable name="this-service" select="/page/pageRequest/paramList/param[@name = 's']/@value"/>
409
410<!-- 
411_httpimages_ {_httpweb_/images}
412_httpscript_ {_httpweb_/script}
413_httpstyle_ {_httpweb_/style}
414_httpflash_ {_httpweb_/flash}
415_httpjava_ {_httpweb_/java}
416-->
417
418
419  <xsl:template name="define-js-variable">
420    <xsl:param name="name"/>
421    <xsl:param name="value"/>
422    <script type="text/javascript">
423      gs.variables[<xslt:text disable-output-escaping="yes">"</xslt:text><xsl:value-of select="$name"/><xslt:text disable-output-escaping="yes">"</xslt:text>]
424      <xslt:text disable-output-escaping="yes"> = "</xslt:text>
425      <xsl:value-of select="$value"/>
426      <xslt:text disable-output-escaping="yes">";</xslt:text>
427    </script>
428  </xsl:template>
429
430  <xsl:variable name="_httpcollection_" select="$httpPath"/>
431  <xsl:variable name="_httpbrowse_"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/browse</xsl:variable>
432  <xsl:variable name="_httpquery_"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/search</xsl:variable>
433
434  <xsl:template name="define-js-macro-variables">
435
436    <xsl:call-template name="define-js-variable">
437      <xsl:with-param name="name"  select="'_httpbrowse_'"/>
438      <xsl:with-param name="value" select="$_httpbrowse_"/>
439    </xsl:call-template>
440
441    <xsl:call-template name="define-js-variable">
442      <xsl:with-param name="name"  select="'_httpquery_'"/>
443      <xsl:with-param name="value" select="$_httpquery_"/>
444    </xsl:call-template>
445
446  </xsl:template>
447
448
449  <xsl:template name="aboutCollectionPageTitle">
450    <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
451    <xsl:value-of select="/page/pageResponse/collection/displayItemList/displayItem[@name='name']"/>
452    <xsl:text> </xsl:text>
453  </xsl:template>
454 
455  <xsl:template name="collectionHomeLinkWithLogoIfAvailable">
456    <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
457      <xsl:choose>
458        <xsl:when test="$this-element/displayItemList/displayItem[@name='icon']">
459          <img border="0">
460            <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>
461            <xsl:attribute name="alt">
462              <xsl:value-of select="$this-element/displayItemList/displayItem[@name='name']"/>
463            </xsl:attribute>
464            <xsl:attribute name="title">
465              <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
466            </xsl:attribute>
467          </img>
468        </xsl:when>
469        <xsl:otherwise>
470          <xsl:value-of select="$this-element/displayItemList/displayItem[@name='name']"/>
471        </xsl:otherwise>
472      </xsl:choose>
473    </a>
474  </xsl:template>
475 
476  <xsl:template name="homeButtonTop">
477    <a href="{$library_name}?a=p&amp;sa=home">
478      <xsl:attribute name="title">
479        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/>
480      </xsl:attribute>
481      <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
482    </a>
483  </xsl:template>
484 
485  <xsl:template name="helpButtonTop">
486    <xsl:choose>
487      <xsl:when test="$pageType='help'">
488        <li>
489          <a>
490            <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
491          </a>
492        </li>
493      </xsl:when>
494      <xsl:otherwise>
495        <li>
496          <a href="{$library_name}?a=p&amp;sa=help&amp;c={$collName}">
497            <xsl:attribute name="title">
498              <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/>
499            </xsl:attribute>
500            <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
501          </a>
502        </li>
503      </xsl:otherwise>
504    </xsl:choose>
505  </xsl:template>
506 
507  <xsl:template name="preferencesButtonTop">
508    <xsl:choose>
509      <xsl:when test="$pageType='pref'">
510        <li>
511          <a>
512            <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
513          </a>
514        </li>
515      </xsl:when>
516      <xsl:otherwise>
517        <li>
518          <a href="{$library_name}?a=p&amp;sa=pref&amp;c={$collName}">
519            <xsl:attribute name="title">
520              <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/>
521            </xsl:attribute>
522            <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
523          </a>
524        </li>
525      </xsl:otherwise>
526    </xsl:choose>
527  </xsl:template>
528 
529  <xsl:template name="servicesNavigationBar">
530    <xsl:for-each select="$this-element/serviceList/service">
531      <xsl:variable name="action">
532        <xsl:choose>
533          <xsl:when test="@name=$this-service">CURRENT</xsl:when>
534          <xsl:when test="@type='query'">q</xsl:when>
535          <xsl:when test="@type='browse'">b</xsl:when>
536          <xsl:when test="@type='process'">pr</xsl:when>
537          <xsl:when test="@type='applet'">a</xsl:when>
538          <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
539        </xsl:choose>
540      </xsl:variable>
541      <xsl:choose>
542        <xsl:when test="$action='CURRENT'">
543          <li>
544            <a>
545              <xsl:value-of select="displayItem[@name='name']"/>
546            </a>
547          </li>
548        </xsl:when>
549        <xsl:when test="$action !='DO_NOT_DISPLAY'">
550          <li>
551            <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
552              <xsl:if test="displayItem[@name='description']">
553                <xsl:attribute name="title">
554                  <xsl:value-of select="displayItem[@name='description']"/>
555                </xsl:attribute>
556              </xsl:if>
557              <xsl:value-of select="displayItem[@name='name']"/>
558            </a>
559          </li>
560        </xsl:when>
561      </xsl:choose>
562    </xsl:for-each>
563  </xsl:template>
564 
565  <xsl:template name="collectionDescriptionTextAndServicesLinks">
566    <xsl:apply-templates select="pageResponse/collection|serviceCluster"/>
567  </xsl:template>
568 
569  <xsl:template match="collection|serviceCluster">
570    <xsl:value-of select="displayItemList/displayItem[@name='description']" disable-output-escaping="yes"/>
571<!-- Uncomment this section if you want the collection service links and their descriptions to appear -->
572    <!--<xsl:apply-templates select="serviceList">
573      <xsl:with-param name="collName" select="$collName"/>
574    </xsl:apply-templates>-->
575  </xsl:template>
576 
577  <xsl:template match="serviceList">   
578    <xsl:param name="collName"/>
579        <h3>
580          <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.services')"/>
581        </h3>
582        <p>
583          <xsl:choose>
584            <xsl:when test="service">
585              <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.servicehelp')"/>
586            </xsl:when>
587            <xsl:otherwise>
588              <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.noservices')"/>
589            </xsl:otherwise>
590          </xsl:choose>
591        </p>
592        <xsl:if test="service">
593          <div id="servicelist">
594            <xsl:for-each select="service">
595              <xsl:sort select="position()" order="descending" data-type="number"/>
596              <xsl:variable name="action">
597                <xsl:choose>
598                  <xsl:when test="@type='query'">q</xsl:when>
599                  <xsl:when test="@type='process'">pr</xsl:when>
600                  <xsl:when test="@type='applet'">a</xsl:when>
601                  <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
602                </xsl:choose>
603              </xsl:variable>
604              <xsl:if test="$action != 'DO_NOT_DISPLAY'">
605                <div class="paramLabel">
606                  <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
607                    <xsl:value-of select="displayItem[@name='name']"/>
608                  </a>
609                </div>
610                <div class="paramLabel">
611                  <xsl:value-of select="displayItem[@name='description']"/>
612                </div>
613                <br class="clear"/>
614              </xsl:if>
615            </xsl:for-each>
616          </div>
617        </xsl:if>
618
619  </xsl:template>
620 
621  <!-- classifier page ............................................................................ -->
622  <xsl:template name="collapsedNavigationTab">
623    <xsl:param name="type"/>
624    <xsl:variable name="isCurrent" select="/page/pageResponse/service[@type=$type]"/>
625    <li>
626      <xsl:if test="$isCurrent">
627        <xsl:attribute name="class">current</xsl:attribute>
628      </xsl:if>
629      <a>
630        <xsl:if test="service[@name=$type]/displayItem[@name='description']">
631          <xsl:attribute name="title">
632            <xsl:value-of select="service[@name=$type]/displayItem[@name='description']"/>
633          </xsl:attribute>
634        </xsl:if>
635        <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>
636        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, $type)"/>
637      </a>
638    </li>
639  </xsl:template>
640 
641  <xsl:template name="navigationTab">
642    <xsl:variable name="isCurrent" select="@name=/page/pageResponse/service/@name"/>
643    <xsl:variable name="action">
644      <xsl:choose>
645        <xsl:when test="@type='query'">q</xsl:when>
646        <xsl:when test="@type='browse'">b</xsl:when>
647        <xsl:when test="@type='process'">pr</xsl:when>
648        <xsl:when test="@type='applet'">a</xsl:when>
649        <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
650      </xsl:choose>
651    </xsl:variable>
652    <xsl:if test="$action!='DO_NOT_DISPLAY'">
653      <li>
654        <xsl:if test="$isCurrent">
655          <xsl:attribute name="class">current</xsl:attribute>
656        </xsl:if>
657        <a>
658          <xsl:if test="displayItem[@name='description']">
659            <xsl:attribute name="title">
660              <xsl:value-of select="displayItem[@name='description']"/>
661            </xsl:attribute>
662          </xsl:if>
663          <xsl:choose>
664            <xsl:when test="classifierList/classifier/@name">
665              <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>
666            </xsl:when>
667            <xsl:otherwise>
668              <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>
669            </xsl:otherwise>
670          </xsl:choose>
671          <xsl:value-of select="displayItem[@name='name']"/>
672        </a>
673      </li>
674    </xsl:if>
675  </xsl:template>
676 
677  <xsl:template name="classifierLink">
678    <xsl:if test="@name=/page/pageResponse/classifier/@name">
679      <xsl:attribute name="class">current</xsl:attribute>
680    </xsl:if>
681    <a href="{$library_name}?a=b&amp;rt=r&amp;s={/page/pageResponse/service/@name}&amp;c={/page/pageResponse/collection/@name}&amp;cl={@name}">
682      <xsl:value-of select="displayItem[@name='description']"/>
683    </a>
684  </xsl:template>
685 
686  <!-- query page ............................................................................ -->
687<!--  <xsl:template name="indexName">
688    <xsl:value-of select="/page/pageResponse/service/displayItem[@name='name']"/>
689  </xsl:template>
690
691  <xsl:template name="queryPageCollectionName">
692    <xsl:choose>
693      <xsl:when test="/page/pageResponse/collection">
694        <gslib:aboutCollectionPageTitle/>
695      </xsl:when>
696      <xsl:otherwise>Cross-Collection</xsl:otherwise>
697    </xsl:choose>
698  </xsl:template>-->
699 
700  <!--
701BERRY BASKET TEMPLATES
702These get used on many different pages to add the
703berry basket function to the site
704-->
705  <!-- put the drag&drop berry basket on the page -->
706  <xsl:template name="berryBasket">
707    <xsl:if test="$berryBasketOn">
708      <div id="berrybasket" class="hide">
709        <span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.title')"/><xsl:text> </xsl:text></span>
710        <span id="berryBasketExpandCollapseLinks" style="display: none;">
711          <a id="berryBasketExpandLink" href="javascript:showBasket()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.expand')"/></a>
712          <a id="berryBasketCollapseLink" style="display: none;" href="javascript:hideBasket()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.collapse')"/></a>
713        </span>
714        <div id="baskethandle">
715          <span>
716            <xsl:text> </xsl:text>
717          </span>
718        </div>
719        <div id="berries">
720          <span>
721            <xsl:text> </xsl:text>
722          </span>
723    </div>
724    <div><a id="berryFullViewLink" style="display: none;"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.full')"/></a></div>
725    <div id="berryHelpMsg"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.help')"/></div>
726      </div>
727     
728    </xsl:if>
729  </xsl:template>
730 
731    <!-- put the drag&drop document basket on the page -->
732    <xsl:template name="documentBasket">
733        <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))">
734            <div id="documentbasket" class="hide">
735                <span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'db.doc_basket')"/><xsl:text> </xsl:text></span>
736                <span id="documentBasketExpandCollapseLinks" style="display: none;">
737                    <a id="documentBasketExpandLink" href="javascript:showDocumentBox()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.expand')"/></a>
738                    <a id="documentBasketCollapseLink" style="display: none;" href="javascript:hideDocumentBox()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.collapse')"/></a>
739                </span>
740                <div id="documenthandle">
741                    <span>
742                        <xsl:text> </xsl:text>
743                    </span>
744                </div>
745                <div id="documentpages">
746                    <span>
747                        <xsl:text> </xsl:text>
748                    </span>
749                </div>
750                <div>
751                    <a href="javascript:clearBasket();"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.clear')"/></a>
752                </div>
753            </div>
754        </xsl:if>
755    </xsl:template>
756 
757  <!-- include the required javascript and css for berry baskets -->
758  <xsl:template name="berryBasketHeadTags">
759    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/yahoo-min.js"><xsl:text> </xsl:text></script>
760    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/event-min.js"><xsl:text> </xsl:text></script>
761    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/connection-min.js"><xsl:text> </xsl:text></script>
762    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dom-min.js"><xsl:text> </xsl:text></script>
763    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dragdrop-min.js"><xsl:text> </xsl:text></script>
764    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/cookie-min.js"><xsl:text> </xsl:text></script>
765    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/animation-min.js"><xsl:text> </xsl:text></script>
766   
767    <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDPlayer.js"><xsl:text> </xsl:text></script>
768    <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDOnTop.js"><xsl:text> </xsl:text></script>
769    <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/berrybasket.js"><xsl:text> </xsl:text></script>
770    <link rel="stylesheet" href="interfaces/{$interface_name}/style/berry.css" type="text/css"/>
771   
772    <!-- Combo-handled YUI CSS files: -->
773    <link rel="stylesheet" type="text/css" href="interfaces/{$interface_name}/style/skin.css"/>
774
775    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentbasket.js"><xsl:text> </xsl:text></script>
776    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentBasketDragDrop.js"><xsl:text> </xsl:text></script>
777    <!-- Combo-handled YUI JS files: -->
778    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yahoo-dom-event.js"><xsl:text> </xsl:text></script>
779    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/container_core-min.js"><xsl:text> </xsl:text></script>
780    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/element-min.js"><xsl:text> </xsl:text></script>
781    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/menu-min.js"><xsl:text> </xsl:text></script>
782    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/button-min.js"><xsl:text> </xsl:text></script>
783    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-min.js"><xsl:text> </xsl:text></script>
784    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yuiloader-min.js"><xsl:text> </xsl:text></script>
785    <!--<script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-dialog.js"><xsl:text> </xsl:text></script>-->
786   
787    <link rel="stylesheet" href="interfaces/{$interface_name}/style/documentbasket.css" type="text/css"/>
788  </xsl:template>
789 
790  <!--
791create a little berry which can be drag&dropped onto the berry basket
792used on classifier and search result pages
793-->
794  <xsl:template name="documentBerryForClassifierOrSearchPage">
795    <xsl:if test="$berryBasketOn">
796      <img class="pick" src="interfaces/{$interface_name}/images/berry.png" alt="in basket" width="15" height="15" border="0">
797        <xsl:attribute name="id"><xsl:value-of select="/page/pageResponse/collection/@name"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
798      </img>
799    </xsl:if>
800  </xsl:template>
801 
802  <!--
803create little berrys which can be drag&dropped onto the berry basket
804used on the document page
805-->
806  <xsl:template name="documentBerryForDocumentPage">
807    <xsl:variable name="selectedNode">
808      <xsl:value-of select="/page/pageResponse/document/@selectedNode"/>
809    </xsl:variable>
810    <xsl:variable name="rootNode">
811      <xsl:value-of select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
812    </xsl:variable>
813    <xsl:if test="$berryBasketOn">
814      <div id="documentberries">
815        <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"/>
816        <span id="{/page/pageResponse/collection/@name}:{$rootNode}:root" class="documentberry">the whole document</span>
817        <!--<xsl:if test="$selectedNode != $rootNode">
818          <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"/>
819          <span id="{/page/pageResponse/collection/@name}:{$selectedNode}:section" class="documentberry">the current section</span>
820        </xsl:if>-->
821      </div>
822    </xsl:if>
823  </xsl:template>
824 
825  <!-- document page -->
826  <xsl:template name="documentTitle">
827    <xsl:value-of select="/page/pageResponse/document/documentNode/metadataList/metadata[@name='Title']"/>
828  </xsl:template>
829  <xsl:template name="coverImage">
830    <img>
831      <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>
832    </img>
833  </xsl:template>
834 
835  <xsl:template name="previousNextButtons">
836    <!-- prev -->
837    <a>
838      <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>
839      <img class="lessarrow" src="interfaces/{$interface_name}/images/previous.png"/>
840    </a>
841    <!-- next -->
842    <a>
843      <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>
844      <img class="morearrow" src="interfaces/{$interface_name}/images/next.png"/>
845    </a>
846  </xsl:template>
847
848
849  <!-- This next template expands gslib:langfrag (used by document.xsl and documentbasket.xsl).
850       When debugging with o=skinandlibdoc, it's seen that <gslib:langfrag name='dse' /> gets expanded to:
851       <xsl:call-template name="langfrag">
852     <xsl:with-param name="name">dse</xsl:with-param>
853       </xsl:call-template>
854       Before the param can be used in this template, need to retrieve it by name with <xsl:param/>
855       as explained in http://www.maconstateit.net/tutorials/XML/XML05/xml05-05.aspx
856       -->
857  <xsl:template name="langfrag">
858    <xsl:param name="name"/>
859    <script type="text/javascript">
860      <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceStringsAsJavascript($interface_name, /page/@lang, $name)"/>
861    </script>
862  </xsl:template>
863
864
865  <!-- builds up links to available document types equivalent to the default source
866       document with as anchor the equivalent documents' doctype icons. -->
867  <xsl:template name="equivDocLinks">
868    <xsl:param name="count"/>
869
870      <xsl:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
871      <xsl:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
872
873      <!--<xsl:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>-->   
874      <!-- In the following variable statement, we're trying to set the docStartlink to any metadata whose value
875    ends on equivDocLink but NOT /equivDocLink. Unfortunately, the xslt function fn:ends-with only exists from
876    xslt 2.0 onwards. So need to use substring() and string-lenth() functions now to check whether the 13th char
877    from the end is a slash or not, in order to distinguish between the start of a doclink and end of one.
878    If this 13th char from the end is not a slash, then we found (the string we want to store in) docStartlink. -->
879      <xsl:variable name="docStartlink">
880    <xsl:for-each select="metadataList/metadata">
881      <xsl:if test="contains(@name, 'equivDocLink')">   
882        <xsl:variable name="tmpvar" select="substring(@name, string-length(@name)-12, 1)"/>
883          <xsl:if test="not($tmpvar='/')">
884            <xsl:value-of select="self::node()[@name]"/>           
885          </xsl:if>     
886      </xsl:if>
887    </xsl:for-each>
888      </xsl:variable>
889
890      <xsl:variable name="equivDocIcon" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docicon, $count)" />
891      <xsl:variable name="equivStartlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docStartlink, $count)" />
892      <xsl:variable name="equivEndlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docEndlink, $count)" />
893
894      <xsl:if test="$equivDocIcon != ''">
895        <xsl:value-of disable-output-escaping="yes" select="$equivStartlink"/>
896        <xsl:value-of disable-output-escaping="yes" select="$equivDocIcon"/>
897        <xsl:value-of disable-output-escaping="yes" select="$equivEndlink"/>
898
899        <!-- recursively call this template to get multiple entries -->
900        <xsl:call-template name="equivDocLinks">
901          <xsl:with-param name="count"><xsl:value-of select="$count + 1"/></xsl:with-param>
902        </xsl:call-template>
903      </xsl:if>
904
905  </xsl:template>
906
907  <xsl:template name="expandContractDocumentLinks">
908    <!--<xsl:if test="count(//documentNode) > 1">-->
909      <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>
910      <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>
911    <!--</xsl:if>-->
912  </xsl:template>
913</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.