source: main/trunk/greenstone3/web/interfaces/default/transform/layouts/header.xsl@ 32371

Last change on this file since 32371 was 32371, checked in by kjdon, 6 years ago

added additionalHeaderContent-page template so that pages can add header info themselves. eg authentication page adding in recaptcha script

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