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

Last change on this file since 37469 was 37469, checked in by davidb, 14 months ago

Set of changes that include links at various points to bring out access to our new webswing GLI capability

  • Property svn:executable set to *
File size: 52.4 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 <xsl:include href="../javascript-global-setup.xsl"/>
15
16 <xsl:include href="header-vars.xsl"/>
17
18
19 <xsl:param name="cookie_consent"/>
20
21 <!-- does this collection allow webswing-based GLI editing? it's turned on by default, can turn off in config file-->
22 <xsl:variable name="isGLIEditingAllowed">
23 <xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='allowGLIEditing']) or /page/pageResponse/format[@type='display']/gsf:option[@name='allowGLIEditing']/@value='true'">1</xsl:if>
24 </xsl:variable>
25
26 <!-- does this collection have editing allowed? it's turned on by default, can turn off in config file-->
27 <xsl:variable name="isDocumentEditingAllowed">
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>
33 </xsl:variable>
34 <xsl:variable name="isMapGPSEditingAllowed">
35 <xsl:choose><xsl:when test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='allowMapGPSEditing']) or /page/pageResponse/format[@type='display']/gsf:option[@name='allowMapGPSEditing']/@value='true'">1</xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose>
36 </xsl:variable>
37
38 <!-- is a user logged in, and do they have editing rights for this collection? -->
39 <xsl:variable name="userHasEditPermission">
40 <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>
41 </xsl:variable>
42
43 <xsl:variable name="siteAdmin">
44 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'siteAdmin']"/>
45 </xsl:variable>
46
47 <xsl:template name="opt-google-maps-api">
48 <xsl:if test="/page/pageResponse/format/gsf:option[@name='mapEnabled']/@value = 'true' or /page/pageResponse/format/gsf:option[@name='allowMapGPSEditing']/@value = 'true'">
49
50 <script>
51 <xsl:text disable-output-escaping="yes">
52 function gsmapsAPILoaded() {
53 console.log("Google Maps API loaded");
54 }
55 </xsl:text >
56 </script>
57 <script src="https://maps.googleapis.com/maps/api/js?key={$googlemaps_api_key}&amp;libraries=drawing&amp;callback=gsmapsAPILoaded" type="text/javascript"><xsl:text> </xsl:text></script>
58 <script src="interfaces/{$interface_name}/js/map-scripts-shapes-util.js" type="text/javascript"><xsl:text> </xsl:text></script>
59 </xsl:if>
60 </xsl:template>
61
62 <!-- Creates a header for the html page -->
63 <xsl:template name="create-html-header">
64 <base>
65 <xsl:attribute name="href">
66 <xsl:choose>
67 <xsl:when test="$servlet_url_prefix">
68 <xsl:value-of select="$servlet_url_prefix"/>
69 </xsl:when>
70 <!-- don't need this one anymore, keep for backwards compat-->
71 <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'siteURL']">
72 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'siteURL']"/>
73 </xsl:when>
74 <xsl:when test="/page/pageRequest/@baseURL">
75 <xsl:value-of select="/page/pageRequest/@baseURL"/>
76 </xsl:when>
77 </xsl:choose>
78 </xsl:attribute>
79 </base>
80 <xsl:comment>[if lte IE 6]&gt;&lt;/base&gt;&lt;![endif]</xsl:comment>
81
82 <xsl:variable name="page"><xsl:call-template name="pageTitle"/></xsl:variable>
83 <xsl:variable name="collection"><xsl:call-template name="collectionName"/></xsl:variable>
84 <xsl:variable name="site"><xsl:call-template name="siteName"/></xsl:variable>
85
86 <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>
87
88 <xsl:if test="/page/pageRequest/@action ='d'">
89
90 <xsl:variable name="myMetadataHeader" select="/page/pageResponse/format/gsf:headMetaTags/gsf:metadata"/>
91 <xsl:for-each select="$myMetadataHeader">
92 <xsl:variable name="metaname" select="@name"/>
93
94 <xsl:variable name="metavals"
95 select="/page/pageResponse/document/metadataList/metadata[@name = $metaname]|/page/pageResponse/document/documentNode/metadataList/metadata[@name = $metaname]"/>
96 <xsl:for-each select="$metavals">
97 <META NAME="{$metaname}" CONTENT="{.}"/>
98 </xsl:for-each>
99 </xsl:for-each>
100
101 </xsl:if>
102
103 <!-- <xsl:call-template name="addGoogleTracking"/>-->
104
105 <script>
106 <xsl:text disable-output-escaping="yes">
107 // Too soon to use gsf:variable, as 'gs' not yet defined, so roll-our-own JS variable
108 var googlesignin_client_id = '</xsl:text><xsl:value-of select="$googlesignin_client_id"/><xsl:text disable-output-escaping="yes">';
109 </xsl:text>
110 </script>
111
112 <xsl:if test="$googlesignin_client_id != ''">
113 <xsl:call-template name="addGoogleSignOn"/>
114 </xsl:if>
115
116 <script>
117 <xsl:text disable-output-escaping="yes">
118 function gslogout(logout_action_url) {
119 if (googlesignin_client_id != '') {
120 //googleLogout();
121 console.log("Need to implement new Google Identiy Logout function?????");
122 }
123 window.location = logout_action_url;
124 }
125 </xsl:text>
126 </script>
127
128 <link rel="stylesheet" href="interfaces/{$interface_name}/style/themes/main/jquery-ui.theme.css" type="text/css"/>
129 <link rel="stylesheet" href="interfaces/{$interface_name}/style/themes/main/jquery-ui.structure.min.css" type="text/css"/>
130 <link rel="stylesheet" href="interfaces/{$interface_name}/style/core.css" type="text/css"/>
131 <!-- Get the theme from the interfaceConfig.xml file -->
132 <xsl:choose>
133 <xsl:when test="/page/pageResponse/interfaceOptions/option[@name = 'cssTheme']/@value">
134 <link rel="stylesheet" href="{/page/pageResponse/interfaceOptions/option[@name = 'cssTheme']/@value}" type="text/css"/>
135 </xsl:when>
136 </xsl:choose>
137
138 <xsl:call-template name="favicon"/>
139
140 <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery-3.6.0.min.js"><xsl:text> </xsl:text></script>
141 <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery-ui-1.13.0.custom/jquery-ui.min.js"><xsl:text> </xsl:text></script>
142 <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery.blockUI.js"><xsl:text> </xsl:text></script>
143 <script type="text/javascript" src="interfaces/{$interface_name}/js/ace/ace.js"><xsl:text> </xsl:text></script>
144
145 <xsl:call-template name="opt-google-maps-api"/>
146
147 <!-- Cookie Consent Manager -->
148 <xsl:choose>
149 <xsl:when test="$cookie_consent">
150 <link rel="stylesheet" href="interfaces/{$interface_name}/style/cookieconsent.css" type="text/css"/>
151 <gslib:langfrag name="ccm" />
152 <script defer="true" type="text/javascript" src="interfaces/{$interface_name}/js/cookieconsent.js"><xsl:text> </xsl:text></script>
153 <script defer="true" type="text/javascript" src="interfaces/{$interface_name}/js/cookieconsent-init.js"><xsl:text> </xsl:text></script>
154 </xsl:when>
155 </xsl:choose>
156
157 <script type="text/javascript" src="interfaces/{$interface_name}/js/zoomer.js"><xsl:text> </xsl:text></script>
158
159 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
160 <xsl:call-template name="map-scripts"/>
161 </xsl:if>
162
163 <xsl:if test="/page/pageResponse/format/gsf:option[@name='mapEnabledOpenLayers']/@value = 'true'">
164 <xsl:call-template name="openlayers-map-scripts"/>
165 </xsl:if>
166
167
168 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
169 <xsl:call-template name="panoramaViewer-scripts"/>
170 </xsl:if>
171
172 <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))">
173 <xsl:if test="/page/pageRequest/paramList/param[(@name='docEdit') and (@value='on' or @value='true' or @value='1')]">
174
175
176 <script type="text/javascript" src="interfaces/{$interface_name}/js/ckeditor/ckeditor.js" defer="true"><xsl:text> </xsl:text></script>
177 <!-- <xsl:call-template name="init-direct-edit"/> -->
178
179 <xsl:variable name="mapEnabled"><xsl:value-of select="/page/pageResponse/format[@type='display']/gsf:option[@name='mapEnabled']/@value"/></xsl:variable>
180 <xsl:if test="$mapEnabled = 'false' or $mapEnabled = ''">
181 <xsl:call-template name="map-scripts"/>
182 </xsl:if>
183
184 </xsl:if>
185
186 <xsl:variable name="allowGreenbugEditing"><xsl:value-of select="/page/pageResponse/format/gsf:option[@name='allowGreenbugEditing']/@value"/></xsl:variable>
187
188 <xsl:if test="$allowGreenbugEditing != 'false'">
189 <!-- TLDR: explicitly set this option to false in your collection if you don't want it enabled -->
190
191 <!-- For backwards compatibility, testing this way means that if <gsf:option name="greenbugEnable"/>
192 isn't set at all, then it default to on ... the way things used to work before the option
193 was introduced -->
194
195 <script type="text/javascript" src="interfaces/{$interface_name}/js/debug_scripts.js"><xsl:text> </xsl:text></script>
196 <script type="text/javascript" src="interfaces/{$interface_name}/js/visual-xml-editor.js"><xsl:text> </xsl:text></script>
197 </xsl:if>
198
199 </xsl:if>
200
201 <xsl:call-template name="setup-gs-variable"/>
202 <xsl:if test="/page/pageRequest/@action ='p' and /page/pageRequest/@subaction='pref'">
203 <gslib:langfrag name="pref" />
204 <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery.themeswitcher.min.js"><xsl:text> </xsl:text></script>
205 </xsl:if>
206 <xsl:call-template name="define-js-macro-variables"/>
207
208
209 <xsl:if test="$favouriteBasketOn">
210 <xsl:call-template name="favouritesHeadTags" />
211 </xsl:if>
212 <xsl:if test="$documentBasketOn">
213 <xsl:call-template name="documentBasketHeadTags" />
214 </xsl:if>
215
216 <!-- now add in any custom things -->
217 <link rel="stylesheet" href="interfaces/{$interface_name}/style/core-extra.css" type="text/css"/>
218 <xsl:call-template name="additionalHeaderContent"/>
219 </xsl:template>
220
221 <xsl:template name="addGoogleTracking">
222 <xsl:variable name="trackid">UA-xxx-1</xsl:variable> <!-- TODO: this no longer seems to be used, now google_tracking_id passed in, and so can be deleted -->
223 <!-- Global site tag (gtag.js) - Google Analytics -->
224 <script async="async" src="https://www.googletagmanager.com/gtag/js?id={$google_tracking_id}"><xsl:text> </xsl:text></script>
225 <script>
226 <xsl:text disable-output-escaping="yes">
227 window.dataLayer = window.dataLayer || [];
228 function gtag(){dataLayer.push(arguments);}
229 gtag('js', new Date());
230
231 gtag('config', '</xsl:text><xsl:value-of select="$google_tracking_id"/><xsl:text disable-output-escaping="yes">');</xsl:text>
232 </script>
233 </xsl:template>
234
235 <xsl:template name="addGoogleSignOn">
236 <meta name="google-signin-client_id--DEPRECATED" content="{$googlesignin_client_id}" />
237 <script src="https://accounts.google.com/gsi/client" async="async" defer="defer" ><xsl:text> </xsl:text></script>
238
239 </xsl:template>
240
241 <xsl:template name="favicon">
242 <link rel="shortcut icon" href="interfaces/{$interface_name}/images/favicon.ico"/>
243 </xsl:template>
244
245 <!-- This template allows for extra header content to be added by page, interface, site and collection. -->
246 <xsl:template name="additionalHeaderContent">
247 <xsl:call-template name="additionalHeaderContent-page"/>
248 <xsl:call-template name="additionalHeaderContent-interface"/>
249 <xsl:call-template name="additionalHeaderContent-site"/>
250 <xsl:call-template name="additionalHeaderContent-collection"/>
251 </xsl:template>
252
253 <!-- This template should be overridden in a page xsl file to add extra header content just to that page -->
254 <xsl:template name="additionalHeaderContent-page">
255 </xsl:template>
256
257 <!-- This template should be overridden in header.xsl of a new interface file if you want to add extra header content -->
258 <xsl:template name="additionalHeaderContent-interface">
259 <!--
260 <link rel="stylesheet" type="text/css" src="interfaces/{$interface_name}/style/core-extra.css"/>
261 -->
262 </xsl:template>
263
264 <!-- This template should be overridden in the header.xsl file in a site's transform directory if you want to add site specific headers -->
265 <xsl:template name="additionalHeaderContent-site">
266 </xsl:template>
267
268 <!-- This template should be overridden in the collectionConfig.xml file if you want to add extra header content -->
269 <xsl:template name="additionalHeaderContent-collection">
270 </xsl:template>
271
272 <xsl:template name="init-direct-edit">
273 <!-- might be worth moving loading the JS file to earlier, to give time to load -->
274 <script type="text/javascript" src="interfaces/{$interface_name}/js/direct-edit.js"><xsl:text> </xsl:text></script>
275 <script type="text/javascript">
276 <xsl:text disable-output-escaping="yes">
277 $(document).ready(function() {
278 de.onready(function()
279 {
280 try
281 {
282 de.init();
283 }
284 catch (err)
285 {
286 alert("Seaweed failed to initialise: " + err.message);
287 }
288 });
289 });
290 </xsl:text>
291 </script>
292 </xsl:template>
293
294
295 <!-- ***** HEADER LAYOUT TEMPLATE ***** -->
296 <xsl:template name="create-banner">
297 <div id="gs_banner" class="ui-widget-header ui-corner-bottom">
298 <div id="titlesearchcontainer">
299 <xsl:call-template name="page-title-area"/>
300 <xsl:call-template name="quick-search-area"/>
301 <div style="clear:both;"><xsl:text> </xsl:text></div>
302 </div>
303 <xsl:call-template name="browsing-tabs"/>
304 </div>
305 </xsl:template>
306
307 <xsl:template name="additionalNavTabs">
308 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/extraInfo/navigationTab">
309 <li>
310 <xsl:choose>
311 <!-- if we are in frame type and this is the current page, colour it differently-->
312 <xsl:when test="@type='frame' and /page/pageRequest[@subaction='html'] and /page/pageRequest/paramList/param[@name='url']/@value = @url">
313 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
314 </xsl:when>
315 <xsl:otherwise>
316 <xsl:attribute name="class">ui-state-default ui-corner-top</xsl:attribute>
317 </xsl:otherwise>
318 </xsl:choose>
319 <a>
320 <xsl:if test="displayItem[@name='description']">
321 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
322 </xsl:if>
323 <xsl:choose>
324 <xsl:when test="@type='external-link'">
325 <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
326 </xsl:when>
327 <xsl:when test="@type='frame'">
328 <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>
329 </xsl:when>
330 </xsl:choose>
331 <xsl:choose>
332 <xsl:when test="displayItem[@name='name']">
333 <xsl:value-of select="displayItem[@name='name']"/>
334 </xsl:when>
335 <xsl:otherwise>link</xsl:otherwise>
336 </xsl:choose>
337 </a>
338 </li>
339 </xsl:for-each>
340
341 </xsl:template>
342 <!-- ***** BROWSING TABS ***** -->
343 <xsl:template name="browsing-tabs">
344 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service or /page/pageResponse/collection[@name=$collNameChecked]/extraInfo/navigationTab">
345 <ul id="gs-nav">
346 <!-- if this collection has additional tabs, add them here -->
347 <xsl:call-template name="additionalNavTabs"/>
348 <!-- If this collection has a ClassifierBrowse service then add a tab for each classifier-->
349 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='browse' and @name='ClassifierBrowse']">
350 <!-- Loop through each classifier -->
351 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">
352 <li>
353 <xsl:choose>
354 <!-- If this tab is selected then colour it differently -->
355 <xsl:when test="util:contains(/page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value, @name)">
356 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
357 </xsl:when>
358 <xsl:otherwise>
359 <xsl:attribute name='class'>ui-state-default ui-corner-top</xsl:attribute>
360 </xsl:otherwise>
361 </xsl:choose>
362
363 <a>
364 <!-- Add a title element to the <a> tag if a description exists for this classifier -->
365 <xsl:if test="displayItem[@name='description']">
366 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
367 </xsl:if>
368
369 <!-- Add the href element to the <a> tag -->
370 <xsl:choose>
371 <xsl:when test="@name">
372 <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>
373 </xsl:when>
374 <xsl:otherwise>
375 <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>
376 </xsl:otherwise>
377 </xsl:choose>
378
379 <!-- Add the actual text of the <a> tag -->
380 <xsl:value-of select="displayItem[@name='name']"/>
381 </a>
382 </li>
383 </xsl:for-each>
384 </xsl:if>
385
386 <!-- PhindApplet. Need something similar for the Collage applet too, probably -->
387 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='PhindApplet']">
388 <li>
389 <xsl:choose>
390 <!-- If this tab is selected then colour it differently -->
391 <xsl:when test="/page/pageRequest[@action='a']">
392 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
393 </xsl:when>
394 <xsl:otherwise>
395 <xsl:attribute name='class'>ui-state-default ui-corner-top</xsl:attribute>
396 </xsl:otherwise>
397 </xsl:choose>
398
399 <a>
400 <xsl:if test="displayItem[@name='description']">
401 <xsl:attribute name="title">
402 <xsl:value-of select="displayItem[@name='description']"/>
403 </xsl:attribute>
404 </xsl:if>
405 <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>
406 <xsl:value-of select="displayItem[@name='name']"/>
407 </a>
408 </li>
409 </xsl:for-each>
410
411 <!-- all other services -->
412 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[not(@type='query') and not(@type='browse') and not (@name='PhindApplet')]">
413 <xsl:call-template name="navigationTab"/>
414 </xsl:for-each>
415 </ul>
416 <div style="clear:both;"><xsl:text> </xsl:text></div>
417 </xsl:if>
418 </xsl:template>
419
420 <!-- ***** HOME HELP PREFERENCES LOGIN ***** -->
421 <xsl:template name="home-help-preferences">
422 <ul id="bannerLinks">
423 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search' or not(@type)]/gsf:option[@name='RSS']/@value = 'true'">
424 <li><xsl:call-template name="RSSLink"/></li>
425 </xsl:if>
426 <li><xsl:call-template name="PrefsLink"/></li>
427 <li><xsl:call-template name="HelpLink"/></li>
428 <li id="userMenuButton"><xsl:call-template name="LoginoutLink"/></li>
429 <xsl:if test="/page/pageRequest/paramList/param[(@name='debug') and (@value='on' or @value='true' or @value='1' or @value='yes')]">
430 <li><xsl:call-template name="DebugLink"/></li>
431 </xsl:if>
432 <xsl:call-template name="buttonStyling"/>
433 </ul>
434 </xsl:template>
435
436 <xsl:template name="RSSLink">
437 <!-- RSS feed link can appear in a global format statement (where it has no type attribute)
438 or in section specific format statements, such as browse, search, display.
439 If it's present in any format statement, display the RSS link in the bannerlinks section. -->
440 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search' or not(@type)]/gsf:option[@name='RSS']/@value = 'true'">
441 <gsf:link type="rss"><gsf:icon file="rssicon.png"/></gsf:link>
442 </xsl:if>
443 </xsl:template>
444
445 <xsl:template name="PrefsLink">
446 <a><xsl:attribute name="href"><xsl:value-of select="$library_name"/>/<xsl:if test="not($collNameChecked = '')">collection/<xsl:value-of select="$collNameChecked"/>/</xsl:if>page/pref</xsl:attribute>
447 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
448 <span id="preferencesButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></span>
449 </a>
450 </xsl:template>
451
452 <xsl:template name="HelpLink">
453 <a><xsl:attribute name="href"><xsl:value-of select="$library_name"/>/<xsl:if test="not($collNameChecked = '')">collection/<xsl:value-of select="$collNameChecked"/>/</xsl:if>page/help</xsl:attribute>
454 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
455 <span id="helpButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></span>
456 </a>
457 </xsl:template>
458
459 <xsl:template name="toggleUserMenuScript">
460
461 <script type="text/javascript">
462 <xsl:text disable-output-escaping="yes">
463 function toggleUserMenu()
464 {
465 var button = $("#userMenuButton");
466 var menu;
467
468 if(button.data("userMenu"))
469 {
470 menu = button.data("userMenu");
471 if(menu.css("display") == "block")
472 {
473 menu.hide();
474 }
475 else
476 {
477 menu.show();
478 }
479 }
480 else
481 {
482 menu = $("&lt;ul&gt;")
483 .css("position", "absolute")
484 .css("display", "block")
485 .css("z-index", "100")
486 .css("list-style", "none outside none")
487 .css("margin", "0px")
488 .css("padding", "0px")
489 .css("font-size", "90%");
490
491 menu.attr("id", "userMenu");
492
493 button.data("userMenu", menu);
494
495 // get the base url
496 var url = document.URL;
497 var hasQueryString = (url.indexOf("?") != -1);
498 var hashIndex = url.indexOf("#");
499
500 var hashPart;
501 if(hashIndex != -1)
502 {
503 hashPart = url.substring(hashIndex);
504 url = url.substring(0, hashIndex);
505 }
506
507 var settingsLink = $("&lt;a&gt;")
508 .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">");
509 var settingsButton = $("&lt;LI&gt;")
510 .css("padding", "3px")
511 .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.account_settings')"/><xsl:text disable-output-escaping="yes">")
512 .addClass("ui-state-default");
513 settingsLink.append(settingsButton);
514 menu.append(settingsLink);
515
516 </xsl:text><xsl:if test="/page/pageRequest/@action = 'd' and $isDocumentEditingAllowed = '1'"><xsl:text disable-output-escaping="yes">
517 var editingLink = $("&lt;a&gt;")
518 .attr("href", "javascript:;");
519 var editingButton = $("&lt;li&gt;")
520 .addClass("ui-state-default")
521 .css("padding", "3px")</xsl:text>
522 <xsl:choose>
523 <xsl:when test="$isEditingAvailable = '1' and $userHasEditPermission = '1'"><xsl:text disable-output-escaping="yes">
524 .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">")
525 .on("click", function()
526 {
527 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");
528 $.ajax(c_url)
529 .done(function(response)
530 {
531 //location.reload(true); // need to set docEdit=0 if we have just disabled editing
532 location.href= url + (hasQueryString ? "&amp;" : "?") + ((gs.userInformation.editEnabled == "true") ? "docEdit=0&amp;ed=0":"") + (hashPart ? hashPart : "");
533 });
534 });
535 </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">
536 .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.error')"/><xsl:text disable-output-escaping='yes'>")
537 .on("click", function()
538 {
539 alert("</xsl:text><xsl:value-of select="$reason"/><xsl:text disable-output-escaping='yes'>");
540 menu.hide();
541 });
542 </xsl:text>
543 </xsl:otherwise></xsl:choose><xsl:text disable-output-escaping="yes">
544 editingLink.append(editingButton);
545 menu.append(editingLink);
546
547 </xsl:text></xsl:if>
548
549 <xsl:if test="$isGLIEditingAllowed = '1'"><xsl:text disable-output-escaping="yes">
550 var gliLink = $("&lt;a&gt;");
551 if (gs.cgiParams["c"]) {
552 gliLink.attr("href", gs.xsltParams.library_name + "/collection/"+gs.cgiParams["c"]+"/page/gli");
553 }
554 else {
555 gliLink.attr("href", gs.xsltParams.library_name + "/page/gli");
556 }
557 var gliButton = $("&lt;li&gt;")
558 .css("padding", "3px")
559 .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.webswing_gli')"/><xsl:text disable-output-escaping="yes">")
560 .addClass("ui-state-default");
561 gliLink.append(gliButton);
562 menu.append(gliLink);
563 </xsl:text></xsl:if>
564
565 <xsl:text disable-output-escaping="yes">
566
567 // Need to check for the situation where the user immediately logs out, having just logged in
568 // Given how cgi-args are used, this sequence of use there is still 'googleidentity-signin=1' in the
569 // the URL, which we don't want.
570 var has_googleidentity_signin = (url.indexOf('googleidentity-signin=') >= 0);
571 if (has_googleidentity_signin) {
572 url = url.replace(/(&amp;|\?)googleidentity-signin=\d+(&amp;|$)/g, "$1")
573 }
574
575 var logout_url_action = url + (hasQueryString ? "&amp;" : "?") + "logout=" + (hashPart ? hashPart : "");
576 var logout_javascript_call = "javascript:gslogout('"+logout_url_action+"')";
577
578 var logoutLink = $("&lt;a&gt;")
579 .attr("href", logout_javascript_call);
580
581 var logoutButton = $("&lt;li&gt;")
582 .css("padding", "3px")
583 .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.logout')"/><xsl:text disable-output-escaping="yes">")
584 .addClass("ui-state-default");
585 logoutLink.append(logoutButton);
586 menu.append(logoutLink);
587
588 var buttonLeft = button.offset().left;
589 var buttonTop = button.offset().top;
590
591 var buttonHeight = button.height();
592
593 menu.offset({top: buttonTop + buttonHeight + 4, left: buttonLeft});
594 $("#topArea").append(menu);
595 }
596 }
597 </xsl:text>
598 </script>
599
600 </xsl:template>
601
602 <xsl:template name="generateLoginURL">
603 <xsl:value-of select="$library_name"/>
604 <xsl:text>?a=p&amp;sa=login&amp;redirectURL=</xsl:text>
605 <xsl:value-of select="$library_name"/>
606 <xsl:text>%3F</xsl:text>
607 <xsl:if test="/page/pageRequest/@action">
608 <xsl:text>a=</xsl:text>
609 <xsl:value-of select="/page/pageRequest/@action"/>
610 </xsl:if>
611 <xsl:if test="/page/pageRequest/@subaction">
612 <xsl:text>%26sa=</xsl:text>
613 <xsl:value-of select="/page/pageRequest/@subaction"/>
614 </xsl:if>
615 <xsl:for-each select="/page/pageRequest/paramList/param">
616 <xsl:if test="@name != 'password' and @name != 's1.password' and @name != 's1.newPassword' and @name != 's1.oldPassword'">
617 <xsl:text>%26</xsl:text>
618 <xsl:value-of select="@name"/>
619 <xsl:text>=</xsl:text>
620 <xsl:value-of select="@value"/>
621 </xsl:if>
622 </xsl:for-each>
623 </xsl:template>
624
625 <!-- Writing the reverse of generateLoginURL since the toggleUserMenuScript does a lot more than I want. -->
626 <!-- https://www.w3schools.com/xml/xsl_functions.asp#string -->
627 <xsl:template name="generateLogoutURL">
628
629 <xsl:variable name="url" select="/page/pageRequest/@fullURL"/>
630 <xsl:variable name="beforeLogout" select="substring-before($url, '&amp;amp;logout=')"/>
631 <xsl:variable name="tmpAfter" select="substring-after($url, '&amp;amp;logout=')"/>
632 <xsl:variable name="afterLogout" select="substring-after($tmpAfter, '&amp;amp;')"/>
633 <xsl:variable name="beforeHash" select="substring-before($url, '#')"/>
634 <xsl:variable name="afterHash" select="substring-after($url, '#')"/>
635 <!-- Get rid of any lingering &amp;logout= already in the URL.
636 But retain anything before and after it (the after portion would start with &).
637 Can't use fn:replace() as it's only been defined since XSLT 2.0. We use XSLT 1.x -->
638 <xsl:variable name="fullURL">
639 <xsl:choose>
640 <xsl:when test="$beforeLogout != ''"><xsl:value-of select="$beforeLogout" /></xsl:when>
641 <xsl:otherwise><xsl:value-of select="$url" /></xsl:otherwise>
642 </xsl:choose>
643 <xsl:if test="$afterLogout != ''">&amp;<xsl:value-of select="$afterLogout" /></xsl:if>
644 </xsl:variable>
645
646 <!-- Output the logout link: the current page's URL (with any lingering logout suffix removed)
647 followed by ?logout= or &amp;logout= followed by any # portion of the current page's URL -->
648 <xsl:choose>
649 <xsl:when test="$beforeHash != ''"><xsl:value-of select="$beforeHash" /></xsl:when>
650 <xsl:otherwise><xsl:value-of select="$fullURL" /></xsl:otherwise>
651 </xsl:choose>
652 <xsl:choose>
653 <xsl:when test="contains($fullURL, '?')"><xsl:text>&amp;logout=</xsl:text></xsl:when>
654 <xsl:otherwise>?logout=</xsl:otherwise>
655 </xsl:choose>
656 <xsl:if test="$afterHash != ''">#<xsl:value-of select="$afterHash" /></xsl:if>
657 </xsl:template>
658
659
660 <xsl:template name="generateGoogleIdentityLoginURL">
661 <xsl:param name="servletProtocol"/>
662 <xsl:param name="baseURL"/>
663 <xsl:param name="redirectURL"/>
664
665 <xsl:variable name="beforeLogout" select="substring-before($redirectURL, '&amp;amp;logout=')"/>
666 <xsl:variable name="tmpAfter" select="substring-after($redirectURL, '&amp;amp;logout=')"/>
667 <xsl:variable name="afterLogout" select="substring-after($tmpAfter, '&amp;amp;')"/>
668 <xsl:variable name="beforeHash" select="substring-before($redirectURL, '#')"/>
669 <xsl:variable name="afterHash" select="substring-after($redirectURL, '#')"/>
670 <!-- Get rid of any lingering &amp;logout= already in the redirectURL.
671 But retain anything before and after it (the after portion would start with &).
672 Can't use fn:replace() as it's only been defined since XSLT 2.0. We use XSLT 1.x -->
673 <xsl:variable name="baseRedirectURL">
674 <xsl:choose>
675 <xsl:when test="$beforeLogout != ''"><xsl:value-of select="$beforeLogout" /></xsl:when>
676 <xsl:otherwise><xsl:value-of select="$redirectURL" /></xsl:otherwise>
677 </xsl:choose>
678 <xsl:if test="$afterLogout != ''">&amp;<xsl:value-of select="$afterLogout" /></xsl:if>
679 </xsl:variable>
680
681 <!-- Output the login link: the current page's URL (with any lingering logout suffix removed)
682 followed by ?{$redirectURL}&googleidentity-signin=1 or &amp;{$redirectURL}&googleidentity-signin=1 followed by any # portion of the current page's URL -->
683 <xsl:value-of select="$servletProtocol"/>
684 <xsl:text>:</xsl:text>
685 <xsl:value-of select="$baseURL"/>
686 <xsl:choose>
687 <xsl:when test="$beforeHash != ''"><xsl:value-of select="$beforeHash" /></xsl:when>
688 <xsl:otherwise><xsl:value-of select="$baseRedirectURL" /></xsl:otherwise>
689 </xsl:choose>
690 <xsl:choose>
691 <xsl:when test="contains($baseRedirectURL, '?')"><xsl:text>&amp;googleidentity-signin=1</xsl:text></xsl:when>
692 <xsl:otherwise><xsl:text>?googleidentity-signin=1</xsl:text></xsl:otherwise>
693 </xsl:choose>
694 <xsl:if test="$afterHash != ''">#<xsl:value-of select="$afterHash" /></xsl:if>
695 </xsl:template>
696
697
698
699 <xsl:template name="LoginoutLink">
700 <!-- login/logout -->
701 <xsl:choose>
702 <xsl:when test="/page/pageRequest/userInformation/@username">
703 <a>
704 <xsl:attribute name="href">javascript:toggleUserMenu();</xsl:attribute>
705 <xsl:call-template name="toggleUserMenuScript"/>
706 <span id="loginButton"><xsl:value-of select="/page/pageRequest/userInformation/@username"/></span>
707 </a>
708 </xsl:when>
709 <xsl:otherwise>
710 <a>
711 <xsl:attribute name="href"><xsl:call-template name="generateLoginURL"/>
712 </xsl:attribute>
713 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/></xsl:attribute>
714 <span id="loginButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_b')"/></span>
715 </a>
716 </xsl:otherwise>
717 </xsl:choose>
718 </xsl:template>
719
720 <xsl:template name="DebugLink">
721 <!-- debuginfo (doesn't use class="ui-state-error" since the text is not legible due to inherited text-colour) -->
722 <xsl:if test="/page/pageRequest/paramList/param[(@name='debug') and (@value='on' or @value='true' or @value='1' or @value='yes')]">
723 <a href="{$library_name}/collection/{$collNameChecked}/page/debug">
724 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_tip')"/></xsl:attribute>
725 <span id="debugButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_b')"/></span>
726 </a>
727 </xsl:if>
728 </xsl:template>
729
730 <xsl:template name="buttonStyling">
731 <script type="text/javascript">
732 <xsl:text disable-output-escaping="yes">
733 $("#preferencesButton").button({icon: "ui-icon-wrench"});
734 $("#preferencesButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
735 $("#helpButton").button({icon: "ui-icon-help"});
736 $("#helpButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
737 $("#debugButton").button({icon: "ui-icon-info"});
738 $("#debugButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
739 </xsl:text>
740 <xsl:choose>
741 <xsl:when test="/page/pageRequest/userInformation/@username">
742 <xsl:text disable-output-escaping="yes">$("#loginButton").button({icon: "ui-icon-unlocked"});</xsl:text>
743 </xsl:when>
744 <xsl:otherwise>
745 <xsl:text disable-output-escaping="yes">$("#loginButton").button({icon: "ui-icon-locked"});</xsl:text>
746 </xsl:otherwise>
747 </xsl:choose>
748 <xsl:text disable-output-escaping="yes">
749 $("#loginButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
750 </xsl:text>
751 </script>
752
753 </xsl:template>
754 <!-- ***** PAGE TITLE ***** -->
755 <xsl:template name="page-title-area">
756 <xsl:variable name="pageTitleVar"><xsl:call-template name="pageTitle"/></xsl:variable>
757 <div id="titlearea">
758 <h2>
759 <!-- Resize the title based on how long it is (There's probably a better way to do this) -->
760 <xsl:attribute name="style">
761 <xsl:choose>
762 <xsl:when test="string-length($pageTitleVar) &lt; 20">
763 <xsl:text>font-size: 1.5em;</xsl:text>
764 </xsl:when>
765 <xsl:when test="string-length($pageTitleVar) &lt; 30">
766 <xsl:text>font-size: 1.4em;</xsl:text>
767 </xsl:when>
768 <xsl:when test="string-length($pageTitleVar) &lt; 40">
769 <xsl:text>font-size: 1.3em;</xsl:text>
770 </xsl:when>
771 <xsl:when test="string-length($pageTitleVar) &lt; 50">
772 <xsl:text>font-size: 1.2em;</xsl:text>
773 </xsl:when>
774 <xsl:when test="string-length($pageTitleVar) &lt; 60">
775 <xsl:text>font-size: 1.1em;</xsl:text>
776 </xsl:when>
777 <xsl:when test="string-length($pageTitleVar) &lt; 70">
778 <xsl:text>font-size: 1em;</xsl:text>
779 </xsl:when>
780 <xsl:when test="string-length($pageTitleVar) &lt; 80">
781 <xsl:text>font-size: 0.9em;</xsl:text>
782 </xsl:when>
783 <xsl:when test="string-length($pageTitleVar) &lt; 90">
784 <xsl:text>font-size: 0.8em;</xsl:text>
785 </xsl:when>
786 <xsl:otherwise>
787 <xsl:text>font-size: 0.7em;</xsl:text>
788 </xsl:otherwise>
789 </xsl:choose>
790 </xsl:attribute>
791 <!--<xsl:value-of select="string-length($pageTitleVar)" />-->
792 <xsl:value-of select="$pageTitleVar" />
793 </h2><xsl:text> </xsl:text>
794 </div>
795 </xsl:template>
796
797 <!-- ***** QUICK SEARCH AREA ***** -->
798 <!-- Search form should only appear if there's a search (query) service AND it has an index.
799 By default, all collections end up with some query service (default is MGPP) even when they have
800 no search indexes, which is why the extra test for the presence of an index/fq-something is necessary. -->
801 <xsl:template name="quick-search-area">
802 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
803 <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
804 <div id="quicksearcharea">
805 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
806 <xsl:choose>
807 <xsl:when test="not(page/pageRequest[@action='q']) or /page/pageRequest/paramList/param[@name='qs']/@value = '1'">
808 <form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
809 <!-- This parameter says that we have come from the quick search area -->
810 <input type="hidden" name="qs" value="1"/>
811 <input type="hidden" name="rt" value="rd"/>
812 <input type="hidden" name="s1.level">
813 <xsl:attribute name="value">
814 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>
815 </xsl:attribute>
816 </input>
817 <xsl:choose>
818 <xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
819 <input type="hidden" name="s1.startPage" value="1"/>
820 </xsl:when>
821 <xsl:otherwise>
822 <input type="hidden" name="startPage" value="1"/>
823 </xsl:otherwise>
824 </xsl:choose>
825
826 <!-- The query text box -->
827 <span class="querybox">
828 <xsl:variable name="qs">
829 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
830 </xsl:variable>
831 <nobr>
832 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
833 <!--
834 <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
835 -->
836 <xsl:with-param name="default" select="normalize-space($qs)"/>
837
838 </xsl:apply-templates>
839 </nobr>
840 </span>
841 <!-- The index selection list -->
842 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">
843 <span class="textselect">
844 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">
845 <xsl:with-param name="default">
846 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>
847 </xsl:with-param>
848 <xsl:with-param name="hideSingle">true</xsl:with-param>
849 <xsl:with-param name="quickSearch">true</xsl:with-param>
850 </xsl:apply-templates>
851 </span>
852 </xsl:if>
853 <!-- The partition selection list -->
854 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']/@type = 'enum_single'">
855 <span class="textselect">
856 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']">
857 <xsl:with-param name="default">
858 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']" mode="calculate-default"/>
859 </xsl:with-param>
860 <xsl:with-param name="hideSingle">true</xsl:with-param>
861 <xsl:with-param name="quickSearch">true</xsl:with-param>
862 </xsl:apply-templates>
863 </span>
864 </xsl:if>
865 <!-- The language selection list -->
866 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']/@type = 'enum_single'">
867 <span class="textselect">
868 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']">
869 <xsl:with-param name="default">
870 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']" mode="calculate-default"/>
871 </xsl:with-param>
872 <xsl:with-param name="hideSingle">true</xsl:with-param>
873 <xsl:with-param name="quickSearch">true</xsl:with-param>
874 </xsl:apply-templates>
875 </span>
876 </xsl:if>
877 <!-- The submit button (for TextQuery) -->
878 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
879 <input type="submit" id="quickSearchSubmitButton">
880 <xsl:attribute name="value">
881 <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>
882 </xsl:attribute>
883 </input>
884 <br/>
885 </xsl:if>
886 </form>
887 </xsl:when>
888 <xsl:otherwise><br/></xsl:otherwise>
889 </xsl:choose>
890 </xsl:if>
891 <!-- The list of other search types -->
892 <ul>
893 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
894 <xsl:if test="/page/pageRequest/paramList/param[@name='qs']/@value = 1 or not(@name = /page/pageRequest/paramList/param[@name='s']/@value)">
895 <li class="ui-state-default ui-corner-all">
896 <a>
897 <xsl:attribute name="href">
898 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collNameChecked"/>/search/<xsl:value-of select="@name"/>
899 </xsl:attribute>
900 <xsl:value-of select="displayItem[@name='name']"/>
901 </a>
902 </li>
903 </xsl:if>
904 </xsl:for-each>
905 </ul>
906 </div>
907 </xsl:if>
908 </xsl:template>
909
910
911 <xsl:template name="map-scripts">
912 <meta content="initial-scale=1.0, user-scalable=no" name="viewport"/>
913 <script src="interfaces/{$interface_name}/js/map-scripts.js" type="text/javascript"><xsl:text> </xsl:text></script>
914 <gsf:script type="text/javascript">$(window).on("load", initializeMapScripts);</gsf:script>
915 </xsl:template>
916
917 <xsl:template name="openlayers-map-scripts">
918 <script src="interfaces/{interface_name}/js/OpenLayers.js" type="text/javascript"><xsl:text> </xsl:text></script>
919 </xsl:template>
920
921 <xsl:template name="panoramaViewer-scripts">
922 <script src="interfaces/{$interface_name}/js/three45.min.js" type="text/javascript"><xsl:text> </xsl:text></script>
923 <script src="interfaces/{$interface_name}/js/Tween.js" type="text/javascript"><xsl:text> </xsl:text></script>
924 <script src="interfaces/{$interface_name}/js/Detector.js" type="text/javascript"><xsl:text> </xsl:text></script>
925 <script src="interfaces/{$interface_name}/js/RequestAnimationFrame.js" type="text/javascript"><xsl:text> </xsl:text></script>
926 <script src="interfaces/{$interface_name}/js/panoramaMarker.js" type="text/javascript"><xsl:text> </xsl:text></script>
927 <script src="interfaces/{$interface_name}/js/panoramaViewer.js" type="text/javascript"><xsl:text> </xsl:text></script>
928 <gsf:script type="text/javascript">$(window).on("load", initPanoramaViewer);$(window).on("load", _animate);</gsf:script>
929 </xsl:template>
930
931 <xsl:template name="choose-title">
932 <gsf:choose-metadata>
933 <gsf:metadata name="dc.Title"/>
934 <gsf:metadata name="exp.Title"/>
935 <gsf:metadata name="ex.dc.Title"/>
936 <gsf:metadata name="Title"/>
937 <gsf:default>Untitled</gsf:default>
938 </gsf:choose-metadata>
939 </xsl:template>
940
941 <xsl:template name="js-for-loading-tk-metadata-set">
942 <!-- gsf:variable sets these as xsl variables and also gs.variable["xx"] javascript variables-->
943 <gsf:variable name="tkMetadataURL_collection"><xsl:value-of select="$library_name"/>/sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="$collNameChecked"/>/metadata/tk.mds</gsf:variable>
944 <gsf:variable name="tkMetadataURL_site"><xsl:value-of select="$library_name"/>/sites/<xsl:value-of select="$site_name"/>/metadata/tk.mds</gsf:variable>
945
946 <script type="text/javascript">
947 <xsl:text disable-output-escaping="yes">
948 $(document).ready(function() {
949 if (tkMetadataSetStatus == "needs-to-be-loaded") {
950 loadTKMetadataSet("</xsl:text><xsl:value-of select="$lang"/><xsl:text disable-output-escaping="yes">", "collection");
951 }
952 if (tkMetadataSetStatus == "no-metadata-set-for-this-collection") {
953 loadTKMetadataSet("</xsl:text><xsl:value-of select="$lang"/><xsl:text disable-output-escaping="yes">", "site");
954 }
955 })
956 </xsl:text>
957 </script>
958 </xsl:template>
959
960 <xsl:template name="choose-tklabels-single-field">
961 <xsl:param name="label-metadata">tk.Labels</xsl:param>
962 <xsl:call-template name="js-for-loading-tk-metadata-set"/>
963 <xsl:variable name="labels-csv"><xsl:for-each select="metadataList/metadata[@name=$label-metadata]"><xsl:value-of select="."/>,</xsl:for-each></xsl:variable>
964 <gsf:div class="tklabels">
965 <xsl:if test="util:csvContains($labels-csv, 'tk.Attribution')">
966 <gsf:icon file="tklabels/tk_a.png"/>
967 </xsl:if>
968 <xsl:if test="util:csvContains($labels-csv, 'tk.Clan')">
969 <gsf:icon file="tklabels/tk_cl.png"/>
970 </xsl:if>
971 <xsl:if test="util:csvContains($labels-csv, 'tk.Family')">
972 <gsf:icon file="tklabels/tk_f.png"/>
973 </xsl:if>
974 <xsl:if test="util:csvContains($labels-csv, 'tk.MultipleCommunities')">
975 <gsf:icon file="tklabels/tk_mc.png"/>
976 </xsl:if>
977 <xsl:if test="util:csvContains($labels-csv, 'tk.CommunityVoice')">
978 <gsf:icon file="tklabels/tk_cv.png"/>
979 </xsl:if>
980 <xsl:if test="util:csvContains($labels-csv, 'tk.Creative')">
981 <gsf:icon file="tklabels/tk_cr.png"/>
982 </xsl:if>
983 <xsl:if test="util:csvContains($labels-csv, 'tk.Verified')">
984 <gsf:icon file="tklabels/tk_v.png"/>
985 </xsl:if>
986 <xsl:if test="util:csvContains($labels-csv, 'tk.NonVerified')">
987 <gsf:icon file="tklabels/tk_nv.png"/>
988 </xsl:if>
989 <xsl:if test="util:csvContains($labels-csv, 'tk.Seasonal')">
990 <gsf:icon file="tklabels/tk_s.png"/>
991 </xsl:if>
992 <xsl:if test="util:csvContains($labels-csv, 'tk.WomenGeneral')">
993 <gsf:icon file="tklabels/tk_wg.png"/>
994 </xsl:if>
995 <xsl:if test="util:csvContains($labels-csv, 'tk.MenGeneral')">
996 <gsf:icon file="tklabels/tk_mg.png"/>
997 </xsl:if>
998 <xsl:if test="util:csvContains($labels-csv, 'tk.MenRestricted')">
999 <gsf:icon file="tklabels/tk_mr.png"/>
1000 </xsl:if>
1001 <xsl:if test="util:csvContains($labels-csv, 'tk.WomenRestricted')">
1002 <gsf:icon file="tklabels/tk_wr.png"/>
1003 </xsl:if>
1004 <xsl:if test="util:csvContains($labels-csv, 'tk.CulturallySensitive')">
1005 <gsf:icon file="tklabels/tk_cs.png"/>
1006 </xsl:if>
1007 <xsl:if test="util:csvContains($labels-csv, 'tk.SecretSacred')">
1008 <gsf:icon file="tklabels/tk_ss.png"/>
1009 </xsl:if>
1010 <xsl:if test="util:csvContains($labels-csv, 'tk.OpenToCommercialization')">
1011 <gsf:icon file="tklabels/tk_oc.png"/>
1012 </xsl:if>
1013 <xsl:if test="util:csvContains($labels-csv, 'tk.NonCommercial')">
1014 <gsf:icon file="tklabels/tk_nc.png"/>
1015 </xsl:if>
1016 <xsl:if test="util:csvContains($labels-csv, 'tk.CommunityUseOnly')">
1017 <gsf:icon file="tklabels/tk_co.png"/>
1018 </xsl:if>
1019 <xsl:if test="util:csvContains($labels-csv, 'tk.Outreach')">
1020 <gsf:icon file="tklabels/tk_o.png"/>
1021 </xsl:if>
1022 <xsl:if test="util:csvContains($labels-csv, 'tk.OpenToCollaboration')">
1023 <gsf:icon file="tklabels/tk_cb.png"/>
1024 </xsl:if>
1025
1026 </gsf:div>
1027 </xsl:template>
1028
1029 <xsl:template name="choose-tklabels">
1030 <xsl:call-template name="js-for-loading-tk-metadata-set"/>
1031 <gsf:div class="tklabels">
1032 <gsf:switch>
1033 <gsf:metadata name="tk.Attribution"/>
1034 <gsf:when test="equals" test-value="true">
1035 <gsf:icon file="tklabels/tk_a.png"/>
1036 </gsf:when>
1037 </gsf:switch>
1038 <gsf:switch>
1039 <gsf:metadata name="tk.Clan"/>
1040 <gsf:when test="equals" test-value="true">
1041 <gsf:icon file="tklabels/tk_cl.png"/>
1042 </gsf:when>
1043 </gsf:switch>
1044 <gsf:switch>
1045 <gsf:metadata name="tk.Family"/>
1046 <gsf:when test="equals" test-value="true">
1047 <gsf:icon file="tklabels/tk_f.png"/>
1048 </gsf:when>
1049 </gsf:switch>
1050 <gsf:switch>
1051 <gsf:metadata name="tk.MultipleCommunities"/>
1052 <gsf:when test="equals" test-value="true">
1053 <gsf:icon file="tklabels/tk_mc.png"/>
1054 </gsf:when>
1055 </gsf:switch>
1056 <gsf:switch>
1057 <gsf:metadata name="tk.CommunityVoice"/>
1058 <gsf:when test="equals" test-value="true">
1059 <gsf:icon file="tklabels/tk_cv.png"/>
1060 </gsf:when>
1061 </gsf:switch>
1062 <gsf:switch>
1063 <gsf:metadata name="tk.Creative"/>
1064 <gsf:when test="equals" test-value="true">
1065 <gsf:icon file="tklabels/tk_cr.png"/>
1066 </gsf:when>
1067 </gsf:switch>
1068 <gsf:switch>
1069 <gsf:metadata name="tk.Verified"/>
1070 <gsf:when test="equals" test-value="true">
1071 <gsf:icon file="tklabels/tk_v.png"/>
1072 </gsf:when>
1073 </gsf:switch>
1074 <gsf:switch>
1075 <gsf:metadata name="tk.NonVerified"/>
1076 <gsf:when test="equals" test-value="true">
1077 <gsf:icon file="tklabels/tk_nv.png"/>
1078 </gsf:when>
1079 </gsf:switch>
1080 <gsf:switch>
1081 <gsf:metadata name="tk.Seasonal"/>
1082 <gsf:when test="equals" test-value="true">
1083 <gsf:icon file="tklabels/tk_s.png"/>
1084 </gsf:when>
1085 </gsf:switch>
1086 <gsf:switch>
1087 <gsf:metadata name="tk.WomenGeneral"/>
1088 <gsf:when test="equals" test-value="true">
1089 <gsf:icon file="tklabels/tk_wg.png"/>
1090 </gsf:when>
1091 </gsf:switch>
1092 <gsf:switch>
1093 <gsf:metadata name="tk.MenGeneral"/>
1094 <gsf:when test="equals" test-value="true">
1095 <gsf:icon file="tklabels/tk_mg.png"/>
1096 </gsf:when>
1097 </gsf:switch>
1098 <gsf:switch>
1099 <gsf:metadata name="tk.MenRestricted"/>
1100 <gsf:when test="equals" test-value="true">
1101 <gsf:icon file="tklabels/tk_mr.png"/>
1102 </gsf:when>
1103 </gsf:switch>
1104 <gsf:switch>
1105 <gsf:metadata name="tk.WomenRestricted"/>
1106 <gsf:when test="equals" test-value="true">
1107 <gsf:icon file="tklabels/tk_wr.png"/>
1108 </gsf:when>
1109 </gsf:switch>
1110 <gsf:switch>
1111 <gsf:metadata name="tk.CulturallySensitive"/>
1112 <gsf:when test="equals" test-value="true">
1113 <gsf:icon file="tklabels/tk_cs.png"/>
1114 </gsf:when>
1115 </gsf:switch>
1116 <gsf:switch>
1117 <gsf:metadata name="tk.SecretSacred"/>
1118 <gsf:when test="equals" test-value="true">
1119 <gsf:icon file="tklabels/tk_ss.png"/>
1120 </gsf:when>
1121 </gsf:switch>
1122 <gsf:switch>
1123 <gsf:metadata name="tk.OpenToCommercialization"/>
1124 <gsf:when test="equals" test-value="true">
1125 <gsf:icon file="tklabels/tk_oc.png"/>
1126 </gsf:when>
1127 </gsf:switch>
1128 <gsf:switch>
1129 <gsf:metadata name="tk.NonCommercial"/>
1130 <gsf:when test="equals" test-value="true">
1131 <gsf:icon file="tklabels/tk_nc.png"/>
1132 </gsf:when>
1133 </gsf:switch>
1134 <gsf:switch>
1135 <gsf:metadata name="tk.CommunityUseOnly"/>
1136 <gsf:when test="equals" test-value="true">
1137 <gsf:icon file="tklabels/tk_co.png"/>
1138 </gsf:when>
1139 </gsf:switch>
1140 <gsf:switch>
1141 <gsf:metadata name="tk.Outreach"/>
1142 <gsf:when test="equals" test-value="true">
1143 <gsf:icon file="tklabels/tk_o.png"/>
1144 </gsf:when>
1145 </gsf:switch>
1146 <gsf:switch>
1147 <gsf:metadata name="tk.OpenToCollaboration"/>
1148 <gsf:when test="equals" test-value="true">
1149 <gsf:icon file="tklabels/tk_cb.png"/>
1150 </gsf:when>
1151 </gsf:switch>
1152 </gsf:div>
1153 </xsl:template>
1154
1155 <xsl:template name="choose-tklabels-small">
1156 <style>
1157 .tklabels img {
1158 width: 2em;
1159 }
1160 </style>
1161 <xsl:call-template name="choose-tklabels"/>
1162 </xsl:template>
1163
1164</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.