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

Last change on this file since 32771 was 32765, checked in by ak19, 5 years ago

Google Maps added to PDF documents

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