root/main/trunk/greenstone3/web/interfaces/oran/transform/util.xsl @ 25347

Revision 25347, 29.8 KB (checked in by ak19, 8 years ago)

Array of strings to be initialised for Javascript now done by Java code instead of XSLT. Intermediate step completed where header.xsl calls the Java code. The call to Java will still need to be moved into util.xsl from header.xsl. header.xsl should use a gslib:langfrag and so invoke util.xsl, but that doesn't work yet at present.

Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xslt="http://www.w3.org/1999/XSL/Transform" xmlns:gslib="http://www.greenstone.org/XSL/Library" xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat" xmlns:util="http://org.greenstone.gsdl3.util.XSLTUtil" version="1.0" exclude-result-prefixes="util gslib gsf xslt">
3  <!-- some global parameters - these are set by whoever is invoking the transformation -->
4  <xsl:param name="interface_name"/>
5  <xsl:param name="library_name"/>
6  <xsl:param name="site_name"/>
7  <xsl:include href="xml-to-string.xsl"/>
8  <!-- every pages ....................................................................... -->
9
10  <xsl:template name="siteName">
11    <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name='siteName']"/>
12  </xsl:template>
13
14  <xsl:template name="siteLink">
15    <a href="./{$library_name}">
16      <xsl:call-template name="siteName"/>
17      <xsl:text> </xsl:text>
18    </a>
19  </xsl:template>
20 
21  <xsl:variable name="a">
22    <xsl:value-of select="/page/pageRequest/paramList/param[@name='a']/@value"/>
23  </xsl:variable>
24 
25  <xsl:variable name="collections" select="/page/pageResponse/collectionList/collection"/>
26 
27  <xsl:variable name="berrybasketswitch">
28    <xsl:value-of select="/page/pageRequest/paramList/param[@name='berrybasket']/@value"/>
29  </xsl:variable>
30 
31  <xsl:variable name="berryBasketOn" select="/page/pageRequest/paramList/param[@name='berrybasket' and @value='on']"/>
32  <xsl:variable name="documentBasketOn" select="/page/pageRequest/paramList/param[@name='documentbasket' and @value='on']"/>
33 
34    <xsl:variable name="thisCollectionEditor">
35        <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'c']/@value"/>
36        <xsl:text>-collection-editor</xsl:text>
37    </xsl:variable>
38 
39  <!-- template to get the name of the current collection -->
40  <xsl:template name="collectionName">
41    <xsl:choose>
42      <xsl:when test="/page/pageResponse/collection">
43        <xsl:value-of select="/page/pageResponse/collection/displayItem[@name='name']"/>
44      </xsl:when>
45      <xsl:otherwise>All Collections</xsl:otherwise>
46    </xsl:choose>
47  </xsl:template>
48 
49  <xsl:template name="collectionNameShort">
50    <xsl:value-of select="/page/pageResponse/collection/@name"/>
51  </xsl:template>
52  <xsl:template name="collectionNameLinked">
53    <xsl:if test="/page/pageResponse/collection">
54      <a>
55        <xsl:attribute name="href">./<xsl:value-of select="$library_name"/>?a=p&amp;sa=about&amp;c=<xsl:call-template name="collectionNameShort"/></xsl:attribute>
56        <xsl:call-template name="collectionName"/>
57      </a>
58    </xsl:if>
59  </xsl:template>
60 
61  <!-- text to get the name of the current service ("Browse","Search" etc) -->
62  <xsl:template name="serviceName">
63    <xsl:value-of select="/page/pageResponse/service/displayItem[@name='name']"/>
64  </xsl:template>
65 
66  <xsl:template name="textDirectionAttribute">
67    <xsl:attribute name="dir">
68      <xsl:choose>
69        <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>
70        <xsl:otherwise>ltr</xsl:otherwise>
71      </xsl:choose>
72    </xsl:attribute>
73  </xsl:template>
74 
75  <xsl:template name="actionClass">
76    <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>
77  </xsl:template>
78  <!-- username, if logged in -->
79  <!--
80    <xsl:template name="username">
81        <xsl:if test="$un_s!=''">
82            <xsl:if test="$asn!='' and $asn!='0'">
83            <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.username')"/>  :  <xsl:value-of select="$un_s"/>
84            </xsl:if>
85        </xsl:if>
86    </xsl:template>
87    -->
88  <xsl:template name="defaultDividerBar">
89    <xsl:param name="text"/>
90    <xsl:choose>
91      <xsl:when test="$text">
92        <div class="divbar">
93          <xsl:value-of select="$text"/>
94        </div>
95      </xsl:when>
96      <xsl:otherwise>
97        <div class="divbar">
98          <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
99        </div>
100      </xsl:otherwise>
101    </xsl:choose>
102  </xsl:template>
103 
104  <xsl:template match="error">
105    Error: <xsl:value-of select="."/>
106  </xsl:template>
107  <xsl:template name="displayErrorsIfAny">
108    <xsl:if test="descendant::error">
109      <script language="Javascript">
110        <xsl:text disable-output-escaping="yes">
111      function removeAllChildren(node) {
112        while (node.hasChildNodes()) {
113          node.removeChild(node.firstChild);
114        }
115      }
116
117      function toggleHideError(obj) {
118        if (obj.style.display == "none") {
119          obj.style.display = "";
120          hide_link = document.getElementById("hide");
121          removeAllChildren(hide_link);
122          hide_link.appendChild(document.createTextNode("</xsl:text>
123        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'hide_error')"/>
124        <xsl:text disable-output-escaping="yes">"));
125        } else {
126          obj.style.display = "none";
127          hide_link = document.getElementById("hide");
128          removeAllChildren(hide_link);
129          hide_link.appendChild(document.createTextNode("</xsl:text>
130        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/>
131        <xsl:text disable-output-escaping="yes">"));
132        }
133      }
134    </xsl:text>
135      </script>
136      <p align="right">
137        <a id="hide" href="javascript:toggleHideError(error);">
138          <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/>
139        </a>
140      </p>
141      <div id="error" style="display: none;">
142        <xsl:apply-templates select="descendant::error"/>
143      </div>
144    </xsl:if>
145  </xsl:template>
146 
147  <xsl:template name="noTextBar">
148    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
149  </xsl:template>
150 
151  <xsl:template name="poweredByGS3TextBar">
152    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gs3power')"/>
153  </xsl:template>
154 
155  <xsl:template name="rightArrow">
156    <xsl:text disable-output-escaping="yes"> &amp;raquo; </xsl:text>
157  </xsl:template>
158 
159  <!-- site home ....................................................................... -->
160  <xsl:template name="siteHomePageTitle">
161    <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
162    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
163    <xsl:text> </xsl:text>
164  </xsl:template>
165 
166  <xsl:template name="selectACollectionTextBar">
167    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.select_a_collection')"/>
168  </xsl:template>
169 
170  <xsl:template name="crossCollectionQuickSearchForm">
171    <xsl:apply-templates select="serviceList/service[@name='TextQuery']"/>
172  </xsl:template>
173 
174  <xsl:template match="service[@name='TextQuery']">
175    <form name="QuickSearch" method="get" action="{$library_name}">
176      <input type="hidden" name="a" value="q"/>
177      <input type="hidden" name="rt" value="rd"/>
178      <input type="hidden" name="s" value="{@name}"/>
179      <input type="hidden" name="s1.collection" value="all"/>
180      <input type="text" name="s1.query" size="20"/>
181      <input type="submit">
182        <xsl:attribute name="value">
183          <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.quick_search')"/>
184        </xsl:attribute>
185      </input>
186    </form>
187  </xsl:template>
188 
189  <xsl:template name="collectionLinkWithImage">
190    <xsl:choose>
191      <xsl:when test="displayItem[@name='icon']">
192        <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}">
193          <img class="collectionLinkImage">
194            <xsl:attribute name="alt"/>
195            <xsl:attribute name="src">sites/localsite/collect/<xsl:value-of select="@name"/>/images/<xsl:value-of select="displayItem[@name='icon']"/></xsl:attribute>
196          </img>
197          <!--
198                    <div class="collectionLink">
199                        <xsl:attribute name="style">background-image: url(/sites/localsite/collect/<xsl:value-of select="@name"/>/images/<xsl:value-of select="displayItem[@name='icon']"/>);</xsl:attribute>
200                        <xsl:value-of select="displayItem[@name='name']"/>
201                    </div>
202-->
203        </a>
204      </xsl:when>
205      <xsl:otherwise>
206        <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}">
207          <div class="collectionLink">
208            <xsl:value-of select="displayItem[@name='name']"/>
209          </div>
210        </a>
211      </xsl:otherwise>
212    </xsl:choose>
213  </xsl:template>
214 
215  <xsl:template name="serviceClusterList">
216    <xsl:apply-templates select="serviceClusterList"/>
217  </xsl:template>
218 
219  <xsl:template match="serviceClusterList">
220    <xsl:for-each select="serviceCluster">
221      <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}">
222        <xsl:value-of select="@name"/>
223        <xsl:value-of select="displayItem[@name='name']"/>
224      </a>
225    </xsl:for-each>
226  </xsl:template>
227 
228  <xsl:template name="serviceLink">
229    <div class="paramLabel">
230      <a href="{$library_name}?a=q&amp;rt=d&amp;s={@name}">
231        <xsl:value-of select="displayItem[@name='name']"/>
232      </a>
233    </div>
234    <div class="paramValue">
235      <xsl:value-of select="displayItem[@name='description']"/>
236    </div>
237    <br class="clear"/>
238  </xsl:template>
239 
240  <xsl:template name="authenticationLink">
241    <xsl:for-each select="//serviceList/service[@type='authen']">
242        <div class="paramLabel">
243            <a href="{$library_name}/admin/ListUsers">
244                <xsl:value-of select="displayItem[@name='name']"/>
245            </a>
246        </div>
247        <div class="paramValue">
248            <xsl:value-of select="displayItem[@name='description']"/>
249        </div>
250    </xsl:for-each>
251  </xsl:template>
252
253  <xsl:template name="registerLink">
254    <xsl:for-each select="//serviceList/service[@type='authen']">
255        <div class="paramLabel">
256            <a href="{$library_name}/admin/Register">
257                <xsl:text>Register</xsl:text>
258            </a>
259        </div>
260        <div class="paramValue">
261            <xsl:text>Register as a new user</xsl:text>
262        </div>
263    </xsl:for-each>
264  </xsl:template>
265
266  <xsl:template name="libraryInterfaceLink">
267    <li>
268      <a href="{$library_name}?a=p&amp;sa=gli4gs3">
269        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.librarian_interface')"/>
270      </a>
271    </li>
272  </xsl:template>
273 
274  <xsl:template name="greenstoneLogoAlternateText">
275    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
276  </xsl:template>
277 
278  <!-- about page - collection home ....................................................................... -->
279  <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
280  <xsl:param name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
281  <xsl:param name="pageType"/>
282  <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
283  <xsl:variable name="this-service" select="/page/pageResponse/service/@name"/>
284 
285  <xsl:template name="aboutCollectionPageTitle">
286    <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
287    <xsl:value-of select="/page/pageResponse/collection/displayItem[@name='name']"/>
288    <xsl:text> </xsl:text>
289  </xsl:template>
290 
291  <xsl:template name="collectionHomeLinkWithLogoIfAvailable">
292    <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
293      <xsl:choose>
294        <xsl:when test="$this-element/displayItem[@name='icon']">
295          <img border="0">
296            <xsl:attribute name="src"><xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItem[@name='icon']"/></xsl:attribute>
297            <xsl:attribute name="alt">
298              <xsl:value-of select="$this-element/displayItem[@name='name']"/>
299            </xsl:attribute>
300            <xsl:attribute name="title">
301              <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
302            </xsl:attribute>
303          </img>
304        </xsl:when>
305        <xsl:otherwise>
306          <xsl:value-of select="$this-element/displayItem[@name='name']"/>
307        </xsl:otherwise>
308      </xsl:choose>
309    </a>
310  </xsl:template>
311 
312  <xsl:template name="homeButtonTop">
313    <a href="{$library_name}?a=p&amp;sa=home">
314      <xsl:attribute name="title">
315        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/>
316      </xsl:attribute>
317      <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
318    </a>
319  </xsl:template>
320 
321  <xsl:template name="helpButtonTop">
322    <xsl:choose>
323      <xsl:when test="$pageType='help'">
324        <li>
325          <a>
326            <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
327          </a>
328        </li>
329      </xsl:when>
330      <xsl:otherwise>
331        <li>
332          <a href="{$library_name}?a=p&amp;sa=help&amp;c={$collName}">
333            <xsl:attribute name="title">
334              <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/>
335            </xsl:attribute>
336            <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
337          </a>
338        </li>
339      </xsl:otherwise>
340    </xsl:choose>
341  </xsl:template>
342 
343  <xsl:template name="preferencesButtonTop">
344    <xsl:choose>
345      <xsl:when test="$pageType='pref'">
346        <li>
347          <a>
348            <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
349          </a>
350        </li>
351      </xsl:when>
352      <xsl:otherwise>
353        <li>
354          <a href="{$library_name}?a=p&amp;sa=pref&amp;c={$collName}">
355            <xsl:attribute name="title">
356              <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/>
357            </xsl:attribute>
358            <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
359          </a>
360        </li>
361      </xsl:otherwise>
362    </xsl:choose>
363  </xsl:template>
364 
365  <xsl:template name="servicesNavigationBar">
366    <xsl:for-each select="$this-element/serviceList/service">
367      <xsl:variable name="action">
368        <xsl:choose>
369          <xsl:when test="@name=$this-service">CURRENT</xsl:when>
370          <xsl:when test="@type='query'">q</xsl:when>
371          <xsl:when test="@type='browse'">b</xsl:when>
372          <xsl:when test="@type='process'">pr</xsl:when>
373          <xsl:when test="@type='applet'">a</xsl:when>
374          <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
375        </xsl:choose>
376      </xsl:variable>
377      <xsl:choose>
378        <xsl:when test="$action='CURRENT'">
379          <li>
380            <a>
381              <xsl:value-of select="displayItem[@name='name']"/>
382            </a>
383          </li>
384        </xsl:when>
385        <xsl:when test="$action !='DO_NOT_DISPLAY'">
386          <li>
387            <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
388              <xsl:if test="displayItem[@name='description']">
389                <xsl:attribute name="title">
390                  <xsl:value-of select="displayItem[@name='description']"/>
391                </xsl:attribute>
392              </xsl:if>
393              <xsl:value-of select="displayItem[@name='name']"/>
394            </a>
395          </li>
396        </xsl:when>
397      </xsl:choose>
398    </xsl:for-each>
399  </xsl:template>
400 
401  <xsl:template name="collectionDescriptionTextAndServicesLinks">
402    <xsl:apply-templates select="pageResponse/collection|serviceCluster"/>
403  </xsl:template>
404  <xsl:template match="collection|serviceCluster">
405    <xsl:value-of select="displayItem[@name='description']" disable-output-escaping="yes"/>
406    <xsl:apply-templates select="serviceList">
407      <xsl:with-param name="collName" select="$collName"/>
408    </xsl:apply-templates>
409  </xsl:template>
410 
411  <xsl:template match="serviceList">   
412    <xsl:param name="collName"/>
413    <xsl:if test="service[not(@type = 'query' or @type = 'browse' or @type = 'retrieve' or @type = 'oai')]">
414        <h3>
415          <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.services')"/>
416        </h3>
417        <p>
418          <xsl:choose>
419            <xsl:when test="service">
420              <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.servicehelp')"/>
421            </xsl:when>
422            <xsl:otherwise>
423              <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.noservices')"/>
424            </xsl:otherwise>
425          </xsl:choose>
426        </p>
427        <xsl:if test="service">
428          <div id="servicelist">
429            <xsl:for-each select="service">
430              <xsl:sort select="position()" order="descending" data-type="number"/>
431              <xsl:variable name="action">
432                <xsl:choose>
433                  <xsl:when test="@type='query'">q</xsl:when>
434                  <xsl:when test="@type='browse'">b</xsl:when>
435                  <xsl:when test="@type='process'">pr</xsl:when>
436                  <xsl:when test="@type='applet'">a</xsl:when>
437                  <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
438                </xsl:choose>
439              </xsl:variable>
440              <xsl:if test="$action != 'DO_NOT_DISPLAY'">
441                <div class="paramLabel">
442                  <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
443                    <xsl:value-of select="displayItem[@name='name']"/>
444                  </a>
445                </div>
446                <div class="paramLabel">
447                  <xsl:value-of select="displayItem[@name='description']"/>
448                </div>
449                <br class="clear"/>
450              </xsl:if>
451            </xsl:for-each>
452          </div>
453        </xsl:if>
454    </xsl:if>
455  </xsl:template>
456 
457  <!-- classifier page ............................................................................ -->
458  <xsl:template name="collapsedNavigationTab">
459    <xsl:param name="type"/>
460    <xsl:variable name="isCurrent" select="/page/pageResponse/service[@type=$type]"/>
461    <li>
462      <xsl:if test="$isCurrent">
463        <xsl:attribute name="class">current</xsl:attribute>
464      </xsl:if>
465      <a>
466        <xsl:if test="service[@name=$type]/displayItem[@name='description']">
467          <xsl:attribute name="title">
468            <xsl:value-of select="service[@name=$type]/displayItem[@name='description']"/>
469          </xsl:attribute>
470        </xsl:if>
471        <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>
472        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, $type)"/>
473      </a>
474    </li>
475  </xsl:template>
476 
477  <xsl:template name="navigationTab">
478    <xsl:variable name="isCurrent" select="@name=/page/pageResponse/service/@name"/>
479    <xsl:variable name="action">
480      <xsl:choose>
481        <xsl:when test="@type='query'">q</xsl:when>
482        <xsl:when test="@type='browse'">b</xsl:when>
483        <xsl:when test="@type='process'">pr</xsl:when>
484        <xsl:when test="@type='applet'">a</xsl:when>
485        <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
486      </xsl:choose>
487    </xsl:variable>
488    <xsl:if test="$action!='DO_NOT_DISPLAY'">
489      <li>
490        <xsl:if test="$isCurrent">
491          <xsl:attribute name="class">current</xsl:attribute>
492        </xsl:if>
493        <a>
494          <xsl:if test="displayItem[@name='description']">
495            <xsl:attribute name="title">
496              <xsl:value-of select="displayItem[@name='description']"/>
497            </xsl:attribute>
498          </xsl:if>
499          <xsl:choose>
500            <xsl:when test="classifierList/classifier/@name">
501              <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>
502            </xsl:when>
503            <xsl:otherwise>
504              <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>
505            </xsl:otherwise>
506          </xsl:choose>
507          <xsl:value-of select="displayItem[@name='name']"/>
508        </a>
509      </li>
510    </xsl:if>
511  </xsl:template>
512 
513  <xsl:template name="classifierLink">
514    <xsl:if test="@name=/page/pageResponse/classifier/@name">
515      <xsl:attribute name="class">current</xsl:attribute>
516    </xsl:if>
517    <a href="{$library_name}?a=b&amp;rt=r&amp;s={/page/pageResponse/service/@name}&amp;c={/page/pageResponse/collection/@name}&amp;cl={@name}">
518      <xsl:value-of select="displayItem[@name='description']"/>
519    </a>
520  </xsl:template>
521 
522  <!-- query page ............................................................................ -->
523  <xsl:template name="indexName">
524    <xsl:value-of select="/page/pageResponse/service/displayItem[@name='name']"/>
525  </xsl:template>
526  <xsl:template name="queryPageCollectionName">
527    <xsl:choose>
528      <xsl:when test="/page/pageResponse/collection">
529        <gslib:aboutCollectionPageTitle/>
530      </xsl:when>
531      <xsl:otherwise>Cross-Collection</xsl:otherwise>
532    </xsl:choose>
533  </xsl:template>
534 
535  <!--
536BERRY BASKET TEMPLATES
537These get used on many different pages to add the
538berry basket function to the site
539-->
540  <!-- put the drag&drop berry basket on the page -->
541  <xsl:template name="berryBasket">
542    <xsl:if test="$berryBasketOn">
543      <div id="berrybasket" class="hide">
544        <span>Berry Basket</span>
545        <span id="berryBasketExpandCollapseLinks" style="display: none;">
546          <a id="berryBasketExpandLink" href="javascript:showBasket()">Expand</a>
547          <a id="berryBasketCollapseLink" style="display: none;" href="javascript:hideBasket()">Collapse</a>
548        </span>
549        <div id="baskethandle">
550          <span>
551            <xsl:text> </xsl:text>
552          </span>
553        </div>
554        <div id="berries">
555          <span>
556            <xsl:text> </xsl:text>
557          </span>
558        </div>
559      </div>
560    </xsl:if>
561  </xsl:template>
562 
563    <!-- put the drag&drop document basket on the page -->
564    <xsl:template name="documentBasket">
565        <xsl:if test="$documentBasketOn and /page/pageRequest/userInformation 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))">
566            <div id="documentbasket" class="hide">
567                <span>Document Basket</span>
568                <span id="documentBasketExpandCollapseLinks" style="display: none;">
569                    <a id="documentBasketExpandLink" href="javascript:showDocumentBox()">Expand</a>
570                    <a id="documentBasketCollapseLink" style="display: none;" href="javascript:hideDocumentBox()">Collapse</a>
571                </span>
572                <div id="documenthandle">
573                    <span>
574                        <xsl:text> </xsl:text>
575                    </span>
576                </div>
577                <div id="documentpages">
578                    <span>
579                        <xsl:text> </xsl:text>
580                    </span>
581                </div>
582                <div>
583                    <a href="javascript:clearBasket();">Clear basket</a>
584                </div>
585            </div>
586        </xsl:if>
587    </xsl:template>
588 
589  <!-- include the required javascript and css for berry baskets -->
590  <xsl:template name="berryBasketHeadTags">
591    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/yahoo-min.js"><xsl:text> </xsl:text></script>
592    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/event-min.js"><xsl:text> </xsl:text></script>
593    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/connection-min.js"><xsl:text> </xsl:text></script>
594    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dom-min.js"><xsl:text> </xsl:text></script>
595    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dragdrop-min.js"><xsl:text> </xsl:text></script>
596    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/cookie-min.js"><xsl:text> </xsl:text></script>
597    <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/animation-min.js"><xsl:text> </xsl:text></script>
598   
599    <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDPlayer.js"><xsl:text> </xsl:text></script>
600    <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDOnTop.js"><xsl:text> </xsl:text></script>
601    <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/berrybasket.js"><xsl:text> </xsl:text></script>
602    <link rel="stylesheet" href="interfaces/{$interface_name}/style/berry.css" type="text/css"/>
603   
604    <!-- Combo-handled YUI CSS files: -->
605    <link rel="stylesheet" type="text/css" href="interfaces/{$interface_name}/style/skin.css"/>
606
607    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentbasket.js"><xsl:text> </xsl:text></script>
608    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentBasketDragDrop.js"><xsl:text> </xsl:text></script>
609    <!-- Combo-handled YUI JS files: -->
610    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yahoo-dom-event.js"><xsl:text> </xsl:text></script>
611    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/container_core-min.js"><xsl:text> </xsl:text></script>
612    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/element-min.js"><xsl:text> </xsl:text></script>
613    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/menu-min.js"><xsl:text> </xsl:text></script>
614    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/button-min.js"><xsl:text> </xsl:text></script>
615    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-min.js"><xsl:text> </xsl:text></script>
616    <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yuiloader-min.js"><xsl:text> </xsl:text></script>
617    <!--<script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-dialog.js"><xsl:text> </xsl:text></script>-->
618   
619    <link rel="stylesheet" href="interfaces/{$interface_name}/style/documentbasket.css" type="text/css"/>
620  </xsl:template>
621 
622  <!--
623create a little berry which can be drag&dropped onto the berry basket
624used on classifier and search result pages
625-->
626  <xsl:template name="documentBerryForClassifierOrSearchPage">
627    <xsl:if test="$berryBasketOn">
628      <img class="pick" src="interfaces/{$interface_name}/images/berry.png" alt="in basket" width="15" height="15" border="0">
629        <xsl:attribute name="id"><xsl:value-of select="/page/pageResponse/collection/@name"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
630      </img>
631    </xsl:if>
632  </xsl:template>
633 
634  <!--
635create little berrys which can be drag&dropped onto the berry basket
636used on the document page
637-->
638  <xsl:template name="documentBerryForDocumentPage">
639    <xsl:variable name="selectedNode">
640      <xsl:value-of select="/page/pageResponse/document/@selectedNode"/>
641    </xsl:variable>
642    <xsl:variable name="rootNode">
643      <xsl:value-of select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
644    </xsl:variable>
645    <xsl:if test="$berryBasketOn">
646      <div id="documentberries">
647        <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"/>
648        <span id="{/page/pageResponse/collection/@name}:{$rootNode}:root" class="documentberry">the whole document</span>
649        <!--<xsl:if test="$selectedNode != $rootNode">
650          <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"/>
651          <span id="{/page/pageResponse/collection/@name}:{$selectedNode}:section" class="documentberry">the current section</span>
652        </xsl:if>-->
653      </div>
654    </xsl:if>
655  </xsl:template>
656 
657  <!-- document page -->
658  <xsl:template name="documentTitle">
659    <xsl:value-of select="/page/pageResponse/document/documentNode/metadataList/metadata[@name='Title']"/>
660  </xsl:template>
661  <xsl:template name="coverImage">
662    <img>
663      <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>
664    </img>
665  </xsl:template>
666 
667  <xsl:template name="previousNextButtons">
668    <!-- prev -->
669    <a>
670      <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=&quot;p.s&quot;]/@value"/>&amp;p.sa=<xsl:value-of select="/page/pageRequest/paramList/param[@name=&quot;p.sa&quot;]/@value"/>&amp;p.a=<xsl:value-of select="/page/pageRequest/paramList/param[@name=&quot;p.a&quot;]/@value"/></xsl:attribute>
671      <img class="lessarrow" src="interfaces/{$interface_name}/images/previous.png"/>
672    </a>
673    <!-- next -->
674    <a>
675      <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=&quot;p.s&quot;]/@value"/>&amp;p.sa=<xsl:value-of select="/page/pageRequest/paramList/param[@name=&quot;p.sa&quot;]/@value"/>&amp;p.a=<xsl:value-of select="/page/pageRequest/paramList/param[@name=&quot;p.a&quot;]/@value"/></xsl:attribute>
676      <img class="morearrow" src="interfaces/{$interface_name}/images/next.png"/>
677    </a>
678  </xsl:template>
679
680  <!-- needs to be name=attrvalue else xsl:param -->
681  <!-- call function with the name prefix (e.g. dse) and the file -->
682  <xsl:template name="langfrag">
683    <script type="text/javascript">     
684      gs.text = new Array();
685      gs.text.<xsl:value-of select="@name"/> = new Array();
686      <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceStringsAsJavascript($interface_name, /page/@lang, @name, 'gs.text')"/>
687    </script>
688  </xsl:template>
689
690</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.