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

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

added comments and removed some debug text

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