root/main/trunk/greenstone3/web/interfaces/default/transform/layouts/header.xsl @ 32046

Revision 32046, 33.9 KB (checked in by kjdon, 3 years ago)

modified how we make the html header title. use page :: collection :: site, but don't print collection or site if not appropriate

  • Property svn:executable set to *
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:java="http://xml.apache.org/xslt/java"
5        xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6        xmlns:gslib="http://www.greenstone.org/skinning"
7        xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
8        extension-element-prefixes="java util"
9        exclude-result-prefixes="java util gsf">
10 
11  <xsl:include href="../shared-templates.xsl"/>
12  <xsl:include href="../javascript-global-setup.xsl"/>
13 
14  <!-- If the c parameter is empty then use the p.c parameter for the collection name-->
15  <xsl:variable name="collNameChecked">
16    <xsl:choose>
17      <xsl:when test="$collName = '' and /page/pageRequest/paramList/param[@name='p.c']/@value">
18    <xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/>
19      </xsl:when>
20      <xsl:otherwise>
21    <xsl:value-of select="$collName"/>
22      </xsl:otherwise>
23    </xsl:choose>
24  </xsl:variable>
25 
26  <!-- Creates a header for the html page -->
27  <xsl:template name="create-html-header">
28    <base>
29      <xsl:attribute name="href">
30    <xsl:choose>
31      <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'siteURL']">
32        <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'siteURL']"/>
33      </xsl:when>
34      <xsl:when test="/page/pageRequest/@baseURL">
35        <xsl:value-of select="/page/pageRequest/@baseURL"/>
36      </xsl:when>
37    </xsl:choose>
38      </xsl:attribute>
39    </base>
40    <xsl:comment>[if lte IE 6]&gt;&lt;/base&gt;&lt;![endif]</xsl:comment>
41
42    <xsl:variable name="page"><xsl:call-template name="pageTitle"/></xsl:variable>
43    <xsl:variable name="collection"><xsl:call-template name="collectionName"/></xsl:variable>
44    <xsl:variable name="site"><xsl:call-template name="siteName"/></xsl:variable>
45    <title><xsl:value-of select="$page"/><xsl:if test="$collection != '' and $page != $collection"> :: <xsl:value-of select="$collection"/></xsl:if><xsl:if test="$page != $site"> :: <xsl:value-of select="$site"/></xsl:if></title>
46   
47    <xsl:if test="/page/pageRequest/@action ='d'">
48     
49      <xsl:variable name="myMetadataHeader" select="/page/pageResponse/format/gsf:headMetaTags/gsf:metadata"/>
50      <xsl:for-each select="$myMetadataHeader">
51    <xsl:variable name="metaname" select="@name"/>
52   
53    <xsl:variable name="metavals"
54              select="/page/pageResponse/document/metadataList/metadata[@name = $metaname]|/page/pageResponse/document/documentNode/metadataList/metadata[@name = $metaname]"/>
55    <xsl:for-each select="$metavals">
56      <META NAME="{$metaname}" CONTENT="{.}"/>
57    </xsl:for-each>
58      </xsl:for-each>
59     
60    </xsl:if>
61
62    <xsl:choose>
63      <xsl:when test="/page/pageResponse/interfaceOptions/option[@name = 'cssTheme']/@value">
64    <!-- Get the theme from the interfaceConfig.xml file -->
65    <link rel="stylesheet" href="{/page/pageResponse/interfaceOptions/option[@name = 'cssTheme']/@value}" type="text/css"/>
66      </xsl:when>
67      <xsl:otherwise>
68    <link rel="stylesheet" href="interfaces/{$interface_name}/style/themes/main/jquery-ui-1.8.16.custom.css" type="text/css"/>
69      </xsl:otherwise>
70    </xsl:choose>
71    <link rel="stylesheet" href="interfaces/{$interface_name}/style/core.css" type="text/css"/>
72    <link rel="shortcut icon" href="interfaces/{$interface_name}/images/favicon.ico"/>
73   
74    <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery.min.js"><xsl:text> </xsl:text></script>
75    <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.min.js"><xsl:text> </xsl:text></script>
76    <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery.blockUI.js"><xsl:text> </xsl:text></script>
77    <script type="text/javascript" src="interfaces/{$interface_name}/js/ace/ace.js"><xsl:text> </xsl:text></script>
78   
79    <script type="text/javascript" src="interfaces/{$interface_name}/js/zoomer.js"><xsl:text> </xsl:text></script>
80
81    <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
82      <xsl:call-template name="map-scripts"/>
83    </xsl:if>
84   
85    <xsl:if test="/page/pageResponse/format/gsf:option[@name='mapEnabledOpenLayers']/@value = 'true'">
86      <xsl:call-template name="openlayers-map-scripts"/>
87    </xsl:if>
88
89
90    <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
91      <xsl:call-template name="panoramaViewer-scripts"/>
92    </xsl:if>
93
94    <xsl:if test="/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))">
95      <xsl:if test="/page/pageRequest/paramList/param[(@name='docEdit') and (@value='on' or @value='true' or @value='1')]">
96    <script type="text/javascript" src="interfaces/{$interface_name}/js/ckeditor/ckeditor.js" defer="true"><xsl:text> </xsl:text></script> 
97    <!--            <xsl:call-template name="init-direct-edit"/> -->
98      </xsl:if>
99      <script type="text/javascript" src="interfaces/{$interface_name}/js/debug_scripts.js"><xsl:text> </xsl:text></script>
100      <script type="text/javascript" src="interfaces/{$interface_name}/js/visual-xml-editor.js"><xsl:text> </xsl:text></script>
101    </xsl:if>
102   
103    <xsl:call-template name="setup-gs-variable"/>
104    <xsl:if test="/page/pageRequest/@action ='p' and /page/pageRequest/@subaction='pref'">
105      <script type="text/javascript">
106    <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceStringsAsJavascript($interface_name, /page/@lang, 'pref')"/>
107      </script>
108      <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery.themeswitcher.min.js"><xsl:text> </xsl:text></script>
109    </xsl:if>
110    <xsl:call-template name="define-js-macro-variables"/>
111
112    <xsl:call-template name="additionalHeaderContent"/>
113  </xsl:template>
114 
115  <!-- This template allows for extra header content to be added by interface, site and collection. -->
116  <xsl:template name="additionalHeaderContent">
117    <xsl:call-template name="additionalHeaderContent-interface"/>
118    <xsl:call-template name="additionalHeaderContent-site"/>
119    <xsl:call-template name="additionalHeaderContent-collection"/>
120  </xsl:template>
121  <!-- This template should be overridden in header.xsl of a new interface file if you want to add extra header content -->
122  <xsl:template name="additionalHeaderContent-interface">
123  </xsl:template>
124  <!-- This template should be overridden in the header.xsl file in a site's transform directory if you want to add site specific headers -->
125  <xsl:template name="additionalHeaderContent-site">
126  </xsl:template>
127  <!-- This template should be overridden in the collectionConfig.xml file if you want to add extra header content -->
128  <xsl:template name="additionalHeaderContent-collection">
129  </xsl:template>
130
131  <xsl:template name="init-direct-edit">
132    <!-- might be worth moving loading the JS file to earlier, to give time to load  -->
133    <script type="text/javascript" src="interfaces/{$interface_name}/js/direct-edit.js"><xsl:text> </xsl:text></script>
134    <script type="text/javascript">
135      <xsl:text disable-output-escaping="yes">
136    $(document).ready(function() {         
137    de.onready(function()
138    {
139    try
140    {
141    de.init();
142    }
143    catch (err)
144    {
145    alert("Seaweed failed to initialise: " + err.message);
146    }
147    });
148    });                     
149      </xsl:text>
150    </script>
151  </xsl:template>
152
153 
154  <!-- ***** HEADER LAYOUT TEMPLATE ***** -->
155  <xsl:template name="create-banner">       
156    <div id="gs_banner" class="ui-widget-header ui-corner-bottom">
157      <div id="titlesearchcontainer">
158    <xsl:call-template name="page-title-area"/>
159    <xsl:call-template name="quick-search-area"/>
160    <div style="clear:both;"><xsl:text> </xsl:text></div>
161      </div>
162      <xsl:call-template name="browsing-tabs"/>
163    </div>
164  </xsl:template>
165 
166  <xsl:template name="additionalNavTabs">
167    <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/extraInfo/navigationTab">
168      <li>
169    <xsl:choose>
170      <!-- if we are in frame type and this is the current page, colour it differently-->
171      <xsl:when test="@type='frame' and /page/pageRequest[@subaction='html'] and /page/pageRequest/paramList/param[@name='url']/@value = @url">
172        <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
173      </xsl:when>
174      <xsl:otherwise>
175        <xsl:attribute name="class">ui-state-default ui-corner-top</xsl:attribute>
176      </xsl:otherwise>
177    </xsl:choose>
178    <a>
179      <xsl:if test="displayItem[@name='description']">
180        <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
181      </xsl:if>
182      <xsl:choose>
183        <xsl:when test="@type='external-link'">
184          <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
185        </xsl:when>
186        <xsl:when test="@type='frame'">
187          <xsl:attribute name="href"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/@name"/>/page/html?url=<xsl:value-of select="@url"/></xsl:attribute>
188        </xsl:when>
189      </xsl:choose>
190      <xsl:choose>
191        <xsl:when test="displayItem[@name='name']">
192          <xsl:value-of select="displayItem[@name='name']"/>
193        </xsl:when>
194        <xsl:otherwise>link</xsl:otherwise>
195      </xsl:choose>
196    </a>
197      </li>
198    </xsl:for-each>
199   
200  </xsl:template>
201  <!-- ***** BROWSING TABS ***** -->
202  <xsl:template name="browsing-tabs">
203    <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service or /page/pageResponse/collection[@name=$collNameChecked]/extraInfo/navigationTab">
204      <ul id="gs-nav">
205    <!-- if this collection has additional tabs, add them here -->
206    <xsl:call-template name="additionalNavTabs"/>
207    <!-- If this collection has a ClassifierBrowse service then add a tab for each classifier-->
208    <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='browse' and @name='ClassifierBrowse']">
209      <!-- Loop through each classifier -->
210      <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">
211        <li>
212          <xsl:choose>
213        <!-- If this tab is selected then colour it differently -->
214        <xsl:when test="util:contains(/page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value, @name)">
215          <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
216        </xsl:when>
217        <xsl:otherwise>
218          <xsl:attribute name='class'>ui-state-default ui-corner-top</xsl:attribute>
219        </xsl:otherwise>
220          </xsl:choose>
221         
222          <a>
223        <!-- Add a title element to the <a> tag if a description exists for this classifier -->
224        <xsl:if test="displayItem[@name='description']">
225          <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
226        </xsl:if>
227       
228        <!-- Add the href element to the <a> tag -->
229        <xsl:choose>
230          <xsl:when test="@name">
231            <xsl:attribute name="href"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/@name"/>/browse/<xsl:value-of select="@name"/></xsl:attribute>
232          </xsl:when>
233          <xsl:otherwise>
234            <xsl:attribute name="href"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/@name"/>/browse/1</xsl:attribute>
235          </xsl:otherwise>
236        </xsl:choose>
237       
238        <!-- Add the actual text of the <a> tag -->
239        <xsl:value-of select="displayItem[@name='name']"/>
240          </a>
241        </li>
242      </xsl:for-each>
243    </xsl:if>
244
245    <!-- PhindApplet. Need something similar for the Collage applet too, probably -->
246    <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='PhindApplet']">
247      <li>
248        <xsl:choose>
249          <!-- If this tab is selected then colour it differently -->
250          <xsl:when test="/page/pageRequest[@action='a']">
251        <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
252          </xsl:when>
253          <xsl:otherwise>
254        <xsl:attribute name='class'>ui-state-default ui-corner-top</xsl:attribute>
255          </xsl:otherwise>
256        </xsl:choose>
257       
258        <a>
259          <xsl:if test="displayItem[@name='description']">
260        <xsl:attribute name="title">
261          <xsl:value-of select="displayItem[@name='description']"/>
262        </xsl:attribute>
263          </xsl:if>                       
264          <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=a&amp;rt=d&amp;s=<xsl:value-of select="@name"/>&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:attribute>
265          <xsl:value-of select="displayItem[@name='name']"/>
266        </a>
267      </li>
268    </xsl:for-each>
269   
270    <!-- all other services -->
271    <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[not(@type='query') and not(@type='browse') and not (@name='PhindApplet')]">
272      <xsl:call-template name="navigationTab"/>
273    </xsl:for-each>
274      </ul>
275      <div style="clear:both;"><xsl:text> </xsl:text></div>
276    </xsl:if>
277  </xsl:template>
278 
279  <!-- ***** HOME HELP PREFERENCES LOGIN ***** -->
280  <xsl:template name="home-help-preferences">
281    <ul id="bannerLinks">
282      <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search' or not(@type)]/gsf:option[@name='RSS']/@value = 'true'">
283        <li><xsl:call-template name="RSSLink"/></li>
284      </xsl:if>
285      <li><xsl:call-template name="PrefsLink"/></li>
286      <li><xsl:call-template name="HelpLink"/></li>
287      <li id="userMenuButton"><xsl:call-template name="LoginoutLink"/></li>
288      <xsl:if test="/page/pageRequest/paramList/param[(@name='debug') and (@value='on' or @value='true' or @value='1' or @value='yes')]">
289        <li><xsl:call-template name="DebugLink"/></li>
290      </xsl:if>
291      <xsl:call-template name="buttonStyling"/>
292    </ul>
293  </xsl:template>   
294 
295  <xsl:template name="RSSLink">
296    <!-- RSS feed link can appear in a global format statement (where it has no type attribute)
297     or in section specific format statements, such as browse, search, display.
298     If it's present in any format statement, display the RSS link in the bannerlinks section. -->
299    <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search' or not(@type)]/gsf:option[@name='RSS']/@value = 'true'">
300      <gsf:link type="rss"><gsf:icon file="rssicon.png"/></gsf:link>
301    </xsl:if>
302  </xsl:template>
303 
304  <xsl:template name="PrefsLink">
305    <a href="{$library_name}/collection/{$collNameChecked}/page/pref">
306      <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
307      <span id="preferencesButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></span>
308    </a>
309  </xsl:template>
310 
311  <xsl:template name="HelpLink">
312    <a href="{$library_name}/collection/{$collNameChecked}/page/help">
313      <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
314      <span id="helpButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></span>
315    </a>
316  </xsl:template>
317 
318  <xsl:template name="toggleUserMenuScript">
319    <script type="text/javascript">
320      <xsl:text disable-output-escaping="yes">
321    function toggleUserMenu()
322    {
323    var button = $("#userMenuButton");
324    var menu;
325
326    if(button.data("userMenu"))
327    {
328    menu = button.data("userMenu");
329    if(menu.css("display") == "block")
330    {
331    menu.hide();
332    }
333    else
334    {
335    menu.show();
336    }
337    }
338    else
339    {
340    menu = $("&lt;UL&gt;")
341    .css("position", "absolute")
342    .css("display", "block")
343    .css("z-index", "100")
344    .css("list-style", "none outside none")
345    .css("margin", "0px")
346    .css("padding", "0px")
347    .css("font-size", "90%");
348   
349    menu.attr("id", "userMenu");
350
351    button.data("userMenu", menu);
352
353    var settingsLink = $("&lt;a&gt;")
354    .attr("href", gs.xsltParams.library_name + "/admin/AccountSettings?s1.username=</xsl:text><xsl:value-of select="/page/pageRequest/userInformation/@username"/><xsl:text disable-output-escaping="yes">");
355    var settingsButton = $("&lt;LI&gt;")
356    .css("padding", "3px")
357    .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.account_settings')"/><xsl:text disable-output-escaping="yes">")
358    .addClass("ui-state-default");
359    settingsLink.append(settingsButton);
360   
361    var editingLink = $("&lt;a&gt;")
362    .attr("href", "javascript:;");
363    var editingButton = $("&lt;LI&gt;")
364    .css("padding", "3px")
365    .html((gs.userInformation.editEnabled == "true") ? "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.disable_edit_mode')"/><xsl:text disable-output-escaping="yes">" : "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.enable_edit_mode')"/><xsl:text disable-output-escaping="yes">")
366    .addClass("ui-state-default")
367    .click(function()
368    {
369    var url = gs.xsltParams.library_name + "?a=g&amp;rt=ro&amp;s=ChangeUserEditMode&amp;s1.username=" + gs.userInformation.username + "&amp;s1.enabled=" + ((gs.userInformation.editEnabled == "true") ? "false" : "true");
370    $.ajax(url)
371    .success(function(response)
372    {
373    location.reload();
374    });
375    });
376    editingLink.append(editingButton);
377
378    var url = document.URL;
379    var hasQueryString = (url.indexOf("?") != -1);
380    var hashIndex = url.indexOf("#");
381   
382    var hashPart;
383    if(hashIndex != -1)
384    {
385    hashPart = url.substring(hashIndex);
386    url = url.substring(0, hashIndex);
387    }
388   
389    var logoutLink = $("&lt;a&gt;")
390    .attr("href", url + (hasQueryString ? "&amp;" : "?") + "logout=" + (hashPart ? hashPart : ""));
391    var logoutButton = $("&lt;LI&gt;")
392    .css("padding", "3px")
393    .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.logout')"/><xsl:text disable-output-escaping="yes">")
394    .addClass("ui-state-default");
395    logoutLink.append(logoutButton);
396
397    menu.append(settingsLink);
398    menu.append(editingLink);
399    menu.append(logoutLink);
400
401    var buttonLeft = button.offset().left;
402    var buttonTop = button.offset().top;
403
404    var buttonHeight = button.height();
405
406    menu.offset({top: buttonTop + buttonHeight + 4, left: buttonLeft});
407    $("#topArea").append(menu);
408    }
409    }
410      </xsl:text>
411    </script>
412   
413  </xsl:template>
414
415  <xsl:template name="generateLoginURL">
416    <xsl:value-of select="$library_name"/>
417    <xsl:text>?a=p&amp;sa=login&amp;redirectURL=</xsl:text>
418    <xsl:value-of select="$library_name"/>
419    <xsl:text>%3F</xsl:text>
420    <xsl:if test="/page/pageRequest/@action">
421      <xsl:text>a=</xsl:text>
422      <xsl:value-of select="/page/pageRequest/@action"/>
423    </xsl:if>
424    <xsl:if test="/page/pageRequest/@subaction">
425      <xsl:text>%26sa=</xsl:text>
426      <xsl:value-of select="/page/pageRequest/@subaction"/>
427    </xsl:if>
428    <xsl:for-each select="/page/pageRequest/paramList/param">
429      <xsl:if test="@name != 'password' and @name != 's1.password' and @name != 's1.newPassword' and @name != 's1.oldPassword'">
430    <xsl:text>%26</xsl:text>
431    <xsl:value-of select="@name"/>
432    <xsl:text>=</xsl:text>
433    <xsl:value-of select="@value"/>
434      </xsl:if>
435    </xsl:for-each>
436   
437  </xsl:template>
438
439  <!-- Writing the reverse of generateLoginURL since the toggleUserMenuScript does a lot more than I want. -->
440  <!-- https://www.w3schools.com/xml/xsl_functions.asp#string --> 
441  <xsl:template name="generateLogoutURL">
442   
443    <xsl:variable name="url" select="/page/pageRequest/@fullURL"/>
444    <xsl:variable name="beforeLogout" select="substring-before($url, '&amp;amp;logout=')"/>
445    <xsl:variable name="tmpAfter" select="substring-after($url, '&amp;amp;logout=')"/>
446    <xsl:variable name="afterLogout" select="substring-after($tmpAfter, '&amp;amp;')"/>
447    <xsl:variable name="beforeHash" select="substring-before($url, '#')"/>
448    <xsl:variable name="afterHash" select="substring-after($url, '#')"/>
449    <!-- Get rid of any lingering &amp;logout= already in the URL.
450        But retain anything before and after it (the after portion would start with &).
451        Can't use fn:replace() as it's only been defined since XSLT 2.0. We use XSLT 1.x -->
452    <xsl:variable name="fullURL">
453      <xsl:choose>
454        <xsl:when test="$beforeLogout != ''"><xsl:value-of select="$beforeLogout" /></xsl:when>
455        <xsl:otherwise><xsl:value-of select="$url" /></xsl:otherwise>
456      </xsl:choose>   
457      <xsl:if test="$afterLogout != ''">&amp;<xsl:value-of select="$afterLogout" /></xsl:if>     
458    </xsl:variable>
459
460    <!-- Output the logout link: the current page's URL (with any lingering logout suffix removed)
461     followed by ?logout= or &amp;logout= followed by any # portion of the current page's URL -->
462    <xsl:choose>
463      <xsl:when test="$beforeHash != ''"><xsl:value-of select="$beforeHash" /></xsl:when>
464      <xsl:otherwise><xsl:value-of select="$fullURL" /></xsl:otherwise>
465    </xsl:choose>
466    <xsl:choose>
467      <xsl:when test="contains($fullURL, '?')"><xsl:text>&amp;logout=</xsl:text></xsl:when>
468      <xsl:otherwise>?logout=</xsl:otherwise>
469    </xsl:choose>
470    <xsl:if test="$afterHash != ''">#<xsl:value-of select="$afterHash" /></xsl:if>   
471  </xsl:template>
472 
473  <xsl:template name="LoginoutLink">
474    <!-- login/logout -->
475    <xsl:choose>
476      <xsl:when test="/page/pageRequest/userInformation/@username">
477    <a>
478      <xsl:attribute name="href">javascript:toggleUserMenu();</xsl:attribute>
479      <xsl:call-template name="toggleUserMenuScript"/>
480      <span id="loginButton"><xsl:value-of select="/page/pageRequest/userInformation/@username"/></span>
481    </a>
482      </xsl:when>
483      <xsl:otherwise>
484    <a>
485      <xsl:attribute name="href"><xsl:call-template name="generateLoginURL"/>
486      </xsl:attribute>
487      <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/></xsl:attribute>
488      <span id="loginButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_b')"/></span>
489    </a>
490      </xsl:otherwise>
491    </xsl:choose>
492  </xsl:template>
493 
494  <xsl:template name="DebugLink">
495    <!-- debuginfo (doesn't use class="ui-state-error" since the text is not legible due to inherited text-colour) -->
496    <xsl:if test="/page/pageRequest/paramList/param[(@name='debug') and (@value='on' or @value='true' or @value='1' or @value='yes')]">
497      <a href="{$library_name}/collection/{$collNameChecked}/page/debug">
498    <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_tip')"/></xsl:attribute>
499    <span id="debugButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_b')"/></span>
500      </a>
501    </xsl:if>
502  </xsl:template>
503 
504  <xsl:template name="buttonStyling">
505    <script type="text/javascript">
506      <xsl:text disable-output-escaping="yes">
507    $("#preferencesButton").button({icons:{primary:"ui-icon-wrench"}});
508    $("#preferencesButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
509    $("#helpButton").button({icons:{primary:"ui-icon-help"}});
510    $("#helpButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
511    $("#debugButton").button({icons:{primary:"ui-icon-info"}});
512    $("#debugButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
513      </xsl:text>
514      <xsl:choose>
515    <xsl:when test="/page/pageRequest/userInformation/@username">
516      <xsl:text disable-output-escaping="yes">$("#loginButton").button({icons:{primary:"ui-icon-unlocked"}});</xsl:text>
517    </xsl:when>
518    <xsl:otherwise>
519      <xsl:text disable-output-escaping="yes">$("#loginButton").button({icons:{primary:"ui-icon-locked"}});</xsl:text>
520    </xsl:otherwise>
521      </xsl:choose>
522      <xsl:text disable-output-escaping="yes">
523    $("#loginButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
524      </xsl:text>
525    </script>
526
527  </xsl:template>
528  <!-- ***** PAGE TITLE ***** -->
529  <xsl:template name="page-title-area">
530    <xsl:variable name="pageTitleVar"><xsl:call-template name="pageTitle"/></xsl:variable>
531    <div id="titlearea">
532      <h2>
533    <!-- Resize the title based on how long it is (There's probably a better way to do this) -->
534    <xsl:attribute name="style">
535      <xsl:choose>
536        <xsl:when test="string-length($pageTitleVar) &lt; 20">
537          <xsl:text>font-size: 1.5em;</xsl:text>
538        </xsl:when>
539        <xsl:when test="string-length($pageTitleVar) &lt; 30">
540          <xsl:text>font-size: 1.4em;</xsl:text>
541        </xsl:when>
542        <xsl:when test="string-length($pageTitleVar) &lt; 40">
543          <xsl:text>font-size: 1.3em;</xsl:text>
544        </xsl:when>
545        <xsl:when test="string-length($pageTitleVar) &lt; 50">
546          <xsl:text>font-size: 1.2em;</xsl:text>
547        </xsl:when>
548        <xsl:when test="string-length($pageTitleVar) &lt; 60">
549          <xsl:text>font-size: 1.1em;</xsl:text>
550        </xsl:when>
551        <xsl:when test="string-length($pageTitleVar) &lt; 70">
552          <xsl:text>font-size: 1em;</xsl:text>
553        </xsl:when>
554        <xsl:when test="string-length($pageTitleVar) &lt; 80">
555          <xsl:text>font-size: 0.9em;</xsl:text>
556        </xsl:when>
557        <xsl:when test="string-length($pageTitleVar) &lt; 90">
558          <xsl:text>font-size: 0.8em;</xsl:text>
559        </xsl:when>
560        <xsl:otherwise>
561          <xsl:text>font-size: 0.7em;</xsl:text>
562        </xsl:otherwise>
563      </xsl:choose>
564    </xsl:attribute>
565    <!--<xsl:value-of select="string-length($pageTitleVar)" />-->
566    <xsl:value-of select="$pageTitleVar" />
567    </h2><xsl:text> </xsl:text>
568    </div>
569  </xsl:template>
570 
571  <!-- ***** QUICK SEARCH AREA ***** -->
572  <!-- Search form should only appear if there's a search (query) service AND it has an index.
573       By default, all collections end up with some query service (default is MGPP) even when they have
574       no search indexes, which is why the extra test for the presence of an index/fq-something is necessary. -->
575  <xsl:template name="quick-search-area">
576    <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
577      <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
578      <div id="quicksearcharea">
579    <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
580      <xsl:choose>
581        <xsl:when test="not(page/pageRequest[@action='q']) or /page/pageRequest/paramList/param[@name='qs']/@value = '1'">
582          <form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
583        <!-- This parameter says that we have come from the quick search area -->
584        <input type="hidden" name="qs" value="1"/>
585        <input type="hidden" name="rt" value="rd"/>
586        <input type="hidden" name="s1.level">
587          <xsl:attribute name="value">
588            <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>
589          </xsl:attribute>
590        </input>
591        <xsl:choose>
592          <xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
593            <input type="hidden" name="s1.startPage" value="1"/>
594          </xsl:when>
595          <xsl:otherwise>
596            <input type="hidden" name="startPage" value="1"/>
597          </xsl:otherwise>
598        </xsl:choose>
599
600        <!-- The query text box -->
601        <span class="querybox">
602          <xsl:variable name="qs">
603            <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
604          </xsl:variable>
605          <nobr>
606            <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
607              <!--
608              <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
609              -->
610              <xsl:with-param name="default" select="normalize-space($qs)"/>
611             
612            </xsl:apply-templates>
613          </nobr>
614        </span>
615        <!-- The index selection list -->
616        <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">
617          <span class="textselect">
618            <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">
619              <xsl:with-param name="default">
620            <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>
621              </xsl:with-param>
622              <xsl:with-param name="hideSingle">false</xsl:with-param>
623              <xsl:with-param name="quickSearch">true</xsl:with-param>
624            </xsl:apply-templates>
625          </span>
626        </xsl:if>
627        <!-- The partition selection list -->                       
628        <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']/@type = 'enum_single'">
629          <span class="textselect">
630            <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']">
631              <xsl:with-param name="default">
632            <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']" mode="calculate-default"/>
633              </xsl:with-param>
634              <xsl:with-param name="hideSingle">true</xsl:with-param>
635              <xsl:with-param name="quickSearch">true</xsl:with-param>
636            </xsl:apply-templates>
637          </span>
638        </xsl:if>   
639        <!-- The language selection list -->                       
640        <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']/@type = 'enum_single'">
641          <span class="textselect">
642            <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']">
643              <xsl:with-param name="default">
644            <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']" mode="calculate-default"/>
645              </xsl:with-param>
646              <xsl:with-param name="hideSingle">true</xsl:with-param>
647              <xsl:with-param name="quickSearch">true</xsl:with-param>
648            </xsl:apply-templates>
649          </span>
650        </xsl:if>                           
651        <!-- The submit button (for TextQuery) -->
652        <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
653          <input type="submit" id="quickSearchSubmitButton">
654            <xsl:attribute name="value">
655              <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>
656            </xsl:attribute>
657          </input>
658          <br/>
659        </xsl:if>
660          </form>
661        </xsl:when>
662        <xsl:otherwise><br/></xsl:otherwise>
663      </xsl:choose>         
664    </xsl:if>
665    <!-- The list of other search types -->
666    <ul>
667      <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
668        <xsl:if test="/page/pageRequest/paramList/param[@name='qs']/@value = 1 or not(@name = /page/pageRequest/paramList/param[@name='s']/@value)">
669          <li class="ui-state-default ui-corner-all">
670            <a>
671              <xsl:attribute name="href">
672            <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collNameChecked"/>/search/<xsl:value-of select="@name"/>
673              </xsl:attribute>
674              <xsl:value-of select="displayItem[@name='name']"/>
675            </a>
676          </li>
677        </xsl:if>
678      </xsl:for-each>
679    </ul>
680      </div>
681    </xsl:if>
682  </xsl:template>
683 
684  <xsl:template name="map-scripts">
685    <meta content="initial-scale=1.0, user-scalable=no" name="viewport"/>
686    <script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyCofVTps3xHfMvIcTMHqYMMxe3xXfkAxnI" type="text/javascript"><xsl:text> </xsl:text></script>
687    <script src="interfaces/{$interface_name}/js/map-scripts.js" type="text/javascript"><xsl:text> </xsl:text></script>
688    <script type="text/javascript">$(window).load(initializeMapScripts);</script>
689  </xsl:template>
690
691  <xsl:template name="openlayers-map-scripts">
692    <script src="interfaces/{interface_name}/js/OpenLayers.js" type="text/javascript"><xsl:text> </xsl:text></script>
693  </xsl:template>
694
695  <xsl:template name="panoramaViewer-scripts">
696    <script src="interfaces/{$interface_name}/js/three45.min.js" type="text/javascript"><xsl:text> </xsl:text></script>
697    <script src="interfaces/{$interface_name}/js/Tween.js" type="text/javascript"><xsl:text> </xsl:text></script>
698    <script src="interfaces/{$interface_name}/js/Detector.js" type="text/javascript"><xsl:text> </xsl:text></script>
699    <script src="interfaces/{$interface_name}/js/RequestAnimationFrame.js" type="text/javascript"><xsl:text> </xsl:text></script>
700    <script src="interfaces/{$interface_name}/js/panoramaMarker.js" type="text/javascript"><xsl:text> </xsl:text></script>
701    <script src="interfaces/{$interface_name}/js/panoramaViewer.js" type="text/javascript"><xsl:text> </xsl:text></script>
702    <script type="text/javascript">$(window).load(initPanoramaViewer);$(window).load(_animate);</script>
703  </xsl:template>
704
705  <xsl:template name="choose-title">
706    <gsf:choose-metadata>
707      <gsf:metadata name="dc.Title"/>
708      <gsf:metadata name="exp.Title"/>
709      <gsf:metadata name="ex.dc.Title"/>
710      <gsf:metadata name="Title"/>
711      <gsf:default>Untitled</gsf:default>
712    </gsf:choose-metadata>
713  </xsl:template>
714</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.