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

Last change on this file since 32599 was 32599, checked in by davidb, 5 years ago

Splicing in of new template rule to make it easier for a site or collection to specify its own favourite icon shown in the browser

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