root/main/trunk/greenstone3/web/interfaces/default/transform/util.xsl @ 25869

Revision 25869, 30.2 KB (checked in by kjdon, 8 years ago)

made stylesheet elem nicer to read

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