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

Last change on this file since 37732 was 37732, checked in by davidb, 12 months ago

Updating to newer version, and then also including some changes that were beneficial in helping Safari an a Mac set the 'cc_concent' cookie

  • Property svn:executable set to *
File size: 54.7 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:java="http://xml.apache.org/xslt/java"
5 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6 xmlns:gslib="http://www.greenstone.org/skinning"
7 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
8 extension-element-prefixes="java util"
9 exclude-result-prefixes="java util gsf">
10
11 <xsl:include href="../shared-templates.xsl"/>
12 <xsl:include href="../javascript-global-setup.xsl"/>
13
14 <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 <xsl:variable name="base-href">
63 <xsl:choose>
64 <xsl:when test="$servlet_url_prefix">
65 <xsl:value-of select="$servlet_url_prefix"/>
66 </xsl:when>
67 <!-- don't need this one anymore, keep for backwards compat-->
68 <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'siteURL']">
69 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'siteURL']"/>
70 </xsl:when>
71 <xsl:when test="/page/pageRequest/@baseURL">
72 <xsl:value-of select="/page/pageRequest/@baseURL"/>
73 </xsl:when>
74 </xsl:choose>
75 </xsl:variable>
76
77 <!-- Creates a header for the html page -->
78 <xsl:template name="create-html-header">
79 <base href="{$ base-href}"/>
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}/cc/cookieconsent.css" type="text/css"/>
151 <gslib:langfrag name="ccm" />
152 <script defer="true" type="text/javascript" src="interfaces/{$interface_name}/cc/cookieconsent.js"><xsl:text> </xsl:text></script>
153 <script defer="true" type="text/javascript" src="interfaces/{$interface_name}/cc/cookieconsent-gsinit.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
297 <xsl:template name="top-area">
298 <div id="topArea" class="ui-state-default ui-corner-top">
299 <table>
300 <tbody>
301 <tr>
302 <td>
303 <div id="breadcrumbs">
304 <xsl:call-template name="breadcrumbs" />
305 <xsl:text> </xsl:text>
306 </div>
307 </td>
308
309 <td>
310 <xsl:call-template name="home-help-preferences" />
311 </td>
312 </tr>
313 </tbody>
314 </table>
315 </div>
316 </xsl:template>
317
318 <xsl:template name="create-banner">
319 <div id="gs_banner" class="ui-widget-header ui-corner-bottom">
320 <div id="titlesearchcontainer">
321 <xsl:call-template name="page-title-area"/>
322 <xsl:call-template name="quick-search-area"/>
323 <div style="clear:both;"><xsl:text> </xsl:text></div>
324 </div>
325 <xsl:call-template name="browsing-tabs"/>
326 </div>
327 </xsl:template>
328
329 <xsl:template name="additionalNavTabs">
330 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/extraInfo/navigationTab">
331 <li>
332 <xsl:choose>
333 <!-- if we are in frame type and this is the current page, colour it differently-->
334 <xsl:when test="@type='frame' and /page/pageRequest[@subaction='html'] and /page/pageRequest/paramList/param[@name='url']/@value = @url">
335 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
336 </xsl:when>
337 <xsl:otherwise>
338 <xsl:attribute name="class">ui-state-default ui-corner-top</xsl:attribute>
339 </xsl:otherwise>
340 </xsl:choose>
341 <a>
342 <xsl:if test="displayItem[@name='description']">
343 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
344 </xsl:if>
345 <xsl:choose>
346 <xsl:when test="@type='external-link'">
347 <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
348 </xsl:when>
349 <xsl:when test="@type='frame'">
350 <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>
351 </xsl:when>
352 </xsl:choose>
353 <xsl:choose>
354 <xsl:when test="displayItem[@name='name']">
355 <xsl:value-of select="displayItem[@name='name']"/>
356 </xsl:when>
357 <xsl:otherwise>link</xsl:otherwise>
358 </xsl:choose>
359 </a>
360 </li>
361 </xsl:for-each>
362
363 </xsl:template>
364 <!-- ***** BROWSING TABS ***** -->
365 <xsl:template name="browsing-tabs">
366 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service or /page/pageResponse/collection[@name=$collNameChecked]/extraInfo/navigationTab">
367 <ul id="gs-nav">
368 <!-- if this collection has additional tabs, add them here -->
369 <xsl:call-template name="additionalNavTabs"/>
370 <!-- If this collection has a ClassifierBrowse service then add a tab for each classifier-->
371 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='browse' and @name='ClassifierBrowse']">
372 <!-- Loop through each classifier -->
373 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">
374 <li>
375 <xsl:choose>
376 <!-- If this tab is selected then colour it differently -->
377 <xsl:when test="util:contains(/page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value, @name)">
378 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
379 </xsl:when>
380 <xsl:otherwise>
381 <xsl:attribute name='class'>ui-state-default ui-corner-top</xsl:attribute>
382 </xsl:otherwise>
383 </xsl:choose>
384
385 <a>
386 <!-- Add a title element to the <a> tag if a description exists for this classifier -->
387 <xsl:if test="displayItem[@name='description']">
388 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
389 </xsl:if>
390
391 <!-- Add the href element to the <a> tag -->
392 <xsl:choose>
393 <xsl:when test="@name">
394 <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>
395 </xsl:when>
396 <xsl:otherwise>
397 <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>
398 </xsl:otherwise>
399 </xsl:choose>
400
401 <!-- Add the actual text of the <a> tag -->
402 <xsl:value-of select="displayItem[@name='name']"/>
403 </a>
404 </li>
405 </xsl:for-each>
406 </xsl:if>
407
408 <!-- PhindApplet. Need something similar for the Collage applet too, probably -->
409 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='PhindApplet']">
410 <li>
411 <xsl:choose>
412 <!-- If this tab is selected then colour it differently -->
413 <xsl:when test="/page/pageRequest[@action='a']">
414 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
415 </xsl:when>
416 <xsl:otherwise>
417 <xsl:attribute name='class'>ui-state-default ui-corner-top</xsl:attribute>
418 </xsl:otherwise>
419 </xsl:choose>
420
421 <a>
422 <xsl:if test="displayItem[@name='description']">
423 <xsl:attribute name="title">
424 <xsl:value-of select="displayItem[@name='description']"/>
425 </xsl:attribute>
426 </xsl:if>
427 <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>
428 <xsl:value-of select="displayItem[@name='name']"/>
429 </a>
430 </li>
431 </xsl:for-each>
432
433 <!-- all other services -->
434 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[not(@type='query') and not(@type='browse') and not (@name='PhindApplet')]">
435 <xsl:call-template name="navigationTab"/>
436 </xsl:for-each>
437 </ul>
438
439 <!-- consider developing inclusion of the following, expressed as a global gsf:option switch/text? -->
440 <!--
441 <xsl:call-template name="home-help-preferences-tab-alternative"/>
442 -->
443
444 <div style="clear:both;"><xsl:text> </xsl:text></div>
445 </xsl:if>
446 </xsl:template>
447
448 <!-- ***** HOME HELP PREFERENCES LOGIN ***** -->
449 <xsl:template name="home-help-preferences">
450 <ul id="bannerLinks">
451 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search' or not(@type)]/gsf:option[@name='RSS']/@value = 'true'">
452 <li><xsl:call-template name="RSSLink"/></li>
453 </xsl:if>
454 <li><xsl:call-template name="PrefsLink"/></li>
455 <li><xsl:call-template name="HelpLink"/></li>
456 <li id="userMenuButton"><xsl:call-template name="LoginoutLink"/></li>
457 <xsl:if test="/page/pageRequest/paramList/param[(@name='debug') and (@value='on' or @value='true' or @value='1' or @value='yes')]">
458 <li><xsl:call-template name="DebugLink"/></li>
459 </xsl:if>
460 <xsl:call-template name="buttonStyling"/>
461 </ul>
462 </xsl:template>
463
464
465 <xsl:template name="home-help-preferences-tab-alternative">
466 <style>
467 #bannerLinksTab {
468 list-style: none outside none;
469 padding: 0px;
470 margin: 0 0 0 20px;
471 font-size: 14px;
472 }
473
474 #bannerLinksTab li {
475 float: right;
476 display: inline;
477 margin-right: 5px;
478 padding: 3px 5px 5px 7px;
479 text-transform: capitalize;
480 text-align: center;
481 border-bottom: 0px;
482 }
483
484 li.ui-tab-styling {
485 }
486 </style>
487 <ul id="bannerLinksTab">
488 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search' or not(@type)]/gsf:option[@name='RSS']/@value = 'true'">
489 <li class="ui-tab-styling"><xsl:call-template name="RSSLink"/></li>
490 </xsl:if>
491 <li class="ui-tab-styling"><xsl:call-template name="PrefsLink"/></li>
492 <li class="ui-tab-styling"><xsl:call-template name="HelpLink"/></li>
493 <li class="ui-tab-styling" id="userMenuButton"><xsl:call-template name="LoginoutLink"/></li>
494 <xsl:if test="/page/pageRequest/paramList/param[(@name='debug') and (@value='on' or @value='true' or @value='1' or @value='yes')]">
495 <li class="ui-tab-styling"><xsl:call-template name="DebugLink"/></li>
496 </xsl:if>
497 <!--
498 <xsl:call-template name="buttonStyling"/>
499 -->
500 <!--
501
502 <li class="ui-state-default ui-corner-top">
503 <a href="{$library_name}/collection/{$collName}/page/sparql" title="Export data via SPARQL queries">SPARQL</a>
504 </li>
505 <li class="ui-state-default ui-corner-top">
506 <a href="{$library_name}/collection/{$collName}/page/sgvizler" title="Visualize data such as countries voting patterns over the years">visualizer</a>
507 </li>
508 -->
509 </ul>
510 </xsl:template>
511
512
513
514 <xsl:template name="RSSLink">
515 <!-- RSS feed link can appear in a global format statement (where it has no type attribute)
516 or in section specific format statements, such as browse, search, display.
517 If it's present in any format statement, display the RSS link in the bannerlinks section. -->
518 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search' or not(@type)]/gsf:option[@name='RSS']/@value = 'true'">
519 <gsf:link type="rss"><gsf:icon file="rssicon.png"/></gsf:link>
520 </xsl:if>
521 </xsl:template>
522
523 <xsl:template name="PrefsLink">
524 <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>
525 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
526 <span id="preferencesButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></span>
527 </a>
528 </xsl:template>
529
530 <xsl:template name="HelpLink">
531 <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>
532 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
533 <span id="helpButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></span>
534 </a>
535 </xsl:template>
536
537 <xsl:template name="toggleUserMenuScript">
538
539 <script type="text/javascript">
540 <xsl:text disable-output-escaping="yes">
541 function toggleUserMenu()
542 {
543 var button = $("#userMenuButton");
544 var menu;
545
546 if(button.data("userMenu"))
547 {
548 menu = button.data("userMenu");
549
550 if(menu.css("display") == "block")
551 {
552 menu.hide();
553 }
554 else
555 {
556 menu.show();
557 }
558 }
559 else
560 {
561 menu = $("&lt;ul&gt;")
562 .css("display", "block");
563
564 menu.attr("id", "userMenu");
565
566 button.data("userMenu", menu);
567
568 // get the base url
569 var url = document.URL;
570 var hasQueryString = (url.indexOf("?") != -1);
571 var hashIndex = url.indexOf("#");
572
573 var hashPart;
574 if(hashIndex != -1)
575 {
576 hashPart = url.substring(hashIndex);
577 url = url.substring(0, hashIndex);
578 }
579
580 var settingsLink = $("&lt;a&gt;")
581 .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">");
582 var settingsButton = $("&lt;LI&gt;")
583 .css("padding", "3px")
584 .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.account_settings')"/><xsl:text disable-output-escaping="yes">")
585 .addClass("ui-state-default");
586 settingsLink.append(settingsButton);
587 menu.append(settingsLink);
588 </xsl:text>
589
590 <xsl:if test="$isGLIEditingAllowed = '1'"><xsl:text disable-output-escaping="yes">
591 var gliLink = $("&lt;a&gt;");
592 if (gs.cgiParams["c"]) {
593 gliLink.attr("href", gs.xsltParams.library_name + "/collection/"+gs.cgiParams["c"]+"/page/gli");
594 }
595 else {
596 gliLink.attr("href", gs.xsltParams.library_name + "/page/gli");
597 }
598 var gliButton = $("&lt;li&gt;")
599 .css("padding", "3px")
600 .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.webswing_gli')"/><xsl:text disable-output-escaping="yes">")
601 .addClass("ui-state-default");
602 gliLink.append(gliButton);
603 menu.append(gliLink);
604 </xsl:text></xsl:if>
605
606 <xsl:if test="/page/pageRequest/@action = 'd' and $isDocumentEditingAllowed = '1'"><xsl:text disable-output-escaping="yes">
607 var editingLink = $("&lt;a&gt;")
608 .attr("href", "javascript:;");
609 var editingButton = $("&lt;li&gt;")
610 .addClass("ui-state-default")
611 .css("padding", "3px")</xsl:text>
612 <xsl:choose>
613 <xsl:when test="$isEditingAvailable = '1' and $userHasEditPermission = '1'"><xsl:text disable-output-escaping="yes">
614 .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">")
615 .on("click", function()
616 {
617 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");
618 $.ajax(c_url)
619 .done(function(response)
620 {
621 //location.reload(true); // need to set docEdit=0 if we have just disabled editing
622 location.href= url + (hasQueryString ? "&amp;" : "?") + ((gs.userInformation.editEnabled == "true") ? "docEdit=0&amp;ed=0":"") + (hashPart ? hashPart : "");
623 });
624 });
625 </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">
626 .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.error')"/><xsl:text disable-output-escaping='yes'>")
627 .on("click", function()
628 {
629 alert("</xsl:text><xsl:value-of select="$reason"/><xsl:text disable-output-escaping='yes'>");
630 menu.hide();
631 });
632 </xsl:text>
633 </xsl:otherwise></xsl:choose><xsl:text disable-output-escaping="yes">
634 editingLink.append(editingButton);
635 menu.append(editingLink);
636
637 </xsl:text></xsl:if>
638
639 <xsl:text disable-output-escaping="yes">
640
641 // Need to check for the situation where the user immediately logs out, having just logged in
642 // Given how cgi-args are used, this sequence of use there is still 'googleidentity-signin=1' in the
643 // the URL, which we don't want.
644 var has_googleidentity_signin = (url.indexOf('googleidentity-signin=') >= 0);
645 if (has_googleidentity_signin) {
646 url = url.replace(/(&amp;|\?)googleidentity-signin=\d+(&amp;|$)/g, "$1")
647 }
648
649 var logout_url_action = url + (hasQueryString ? "&amp;" : "?") + "logout=" + (hashPart ? hashPart : "");
650 var logout_javascript_call = "javascript:gslogout('"+logout_url_action+"')";
651
652 var logoutLink = $("&lt;a&gt;")
653 .attr("href", logout_javascript_call);
654
655 var logoutButton = $("&lt;li&gt;")
656 .css("padding", "3px")
657 .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.logout')"/><xsl:text disable-output-escaping="yes">")
658 .addClass("ui-state-default");
659 logoutLink.append(logoutButton);
660 menu.append(logoutLink);
661
662 var buttonHeight = button.height();
663 menu.css("top", buttonHeight + 4);
664 menu.css("left", 0);
665 $("#userMenuDiv").append(menu);
666 }
667 }
668 </xsl:text>
669 </script>
670
671 </xsl:template>
672
673 <xsl:template name="generateLoginURL">
674 <xsl:value-of select="$library_name"/>
675 <xsl:text>?a=p&amp;sa=login&amp;redirectURL=</xsl:text>
676 <xsl:value-of select="$library_name"/>
677 <xsl:text>%3F</xsl:text>
678 <xsl:if test="/page/pageRequest/@action">
679 <xsl:text>a=</xsl:text>
680 <xsl:value-of select="/page/pageRequest/@action"/>
681 </xsl:if>
682 <xsl:if test="/page/pageRequest/@subaction">
683 <xsl:text>%26sa=</xsl:text>
684 <xsl:value-of select="/page/pageRequest/@subaction"/>
685 </xsl:if>
686 <xsl:for-each select="/page/pageRequest/paramList/param">
687 <xsl:if test="@name != 'password' and @name != 's1.password' and @name != 's1.newPassword' and @name != 's1.oldPassword'">
688 <xsl:text>%26</xsl:text>
689 <xsl:value-of select="@name"/>
690 <xsl:text>=</xsl:text>
691 <xsl:value-of select="@value"/>
692 </xsl:if>
693 </xsl:for-each>
694 </xsl:template>
695
696 <!-- Writing the reverse of generateLoginURL since the toggleUserMenuScript does a lot more than I want. -->
697 <!-- https://www.w3schools.com/xml/xsl_functions.asp#string -->
698 <xsl:template name="generateLogoutURL">
699
700 <xsl:variable name="url" select="/page/pageRequest/@fullURL"/>
701 <xsl:variable name="beforeLogout" select="substring-before($url, '&amp;amp;logout=')"/>
702 <xsl:variable name="tmpAfter" select="substring-after($url, '&amp;amp;logout=')"/>
703 <xsl:variable name="afterLogout" select="substring-after($tmpAfter, '&amp;amp;')"/>
704 <xsl:variable name="beforeHash" select="substring-before($url, '#')"/>
705 <xsl:variable name="afterHash" select="substring-after($url, '#')"/>
706 <!-- Get rid of any lingering &amp;logout= already in the URL.
707 But retain anything before and after it (the after portion would start with &).
708 Can't use fn:replace() as it's only been defined since XSLT 2.0. We use XSLT 1.x -->
709 <xsl:variable name="fullURL">
710 <xsl:choose>
711 <xsl:when test="$beforeLogout != ''"><xsl:value-of select="$beforeLogout" /></xsl:when>
712 <xsl:otherwise><xsl:value-of select="$url" /></xsl:otherwise>
713 </xsl:choose>
714 <xsl:if test="$afterLogout != ''">&amp;<xsl:value-of select="$afterLogout" /></xsl:if>
715 </xsl:variable>
716
717 <!-- Output the logout link: the current page's URL (with any lingering logout suffix removed)
718 followed by ?logout= or &amp;logout= followed by any # portion of the current page's URL -->
719 <xsl:choose>
720 <xsl:when test="$beforeHash != ''"><xsl:value-of select="$beforeHash" /></xsl:when>
721 <xsl:otherwise><xsl:value-of select="$fullURL" /></xsl:otherwise>
722 </xsl:choose>
723 <xsl:choose>
724 <xsl:when test="contains($fullURL, '?')"><xsl:text>&amp;logout=</xsl:text></xsl:when>
725 <xsl:otherwise>?logout=</xsl:otherwise>
726 </xsl:choose>
727 <xsl:if test="$afterHash != ''">#<xsl:value-of select="$afterHash" /></xsl:if>
728 </xsl:template>
729
730
731 <xsl:template name="generateGoogleIdentityLoginURL">
732 <xsl:param name="servletProtocol"/>
733 <xsl:param name="baseURL"/>
734 <xsl:param name="redirectURL"/>
735
736 <xsl:variable name="beforeLogout" select="substring-before($redirectURL, '&amp;amp;logout=')"/>
737 <xsl:variable name="tmpAfter" select="substring-after($redirectURL, '&amp;amp;logout=')"/>
738 <xsl:variable name="afterLogout" select="substring-after($tmpAfter, '&amp;amp;')"/>
739 <xsl:variable name="beforeHash" select="substring-before($redirectURL, '#')"/>
740 <xsl:variable name="afterHash" select="substring-after($redirectURL, '#')"/>
741 <!-- Get rid of any lingering &amp;logout= already in the redirectURL.
742 But retain anything before and after it (the after portion would start with &).
743 Can't use fn:replace() as it's only been defined since XSLT 2.0. We use XSLT 1.x -->
744 <xsl:variable name="baseRedirectURL">
745 <xsl:choose>
746 <xsl:when test="$beforeLogout != ''"><xsl:value-of select="$beforeLogout" /></xsl:when>
747 <xsl:otherwise><xsl:value-of select="$redirectURL" /></xsl:otherwise>
748 </xsl:choose>
749 <xsl:if test="$afterLogout != ''">&amp;<xsl:value-of select="$afterLogout" /></xsl:if>
750 </xsl:variable>
751
752 <!-- Output the login link: the current page's URL (with any lingering logout suffix removed)
753 followed by ?{$redirectURL}&googleidentity-signin=1 or &amp;{$redirectURL}&googleidentity-signin=1 followed by any # portion of the current page's URL -->
754 <xsl:value-of select="$servletProtocol"/>
755 <xsl:text>:</xsl:text>
756 <xsl:value-of select="$baseURL"/>
757 <xsl:choose>
758 <xsl:when test="$beforeHash != ''"><xsl:value-of select="$beforeHash" /></xsl:when>
759 <xsl:otherwise><xsl:value-of select="$baseRedirectURL" /></xsl:otherwise>
760 </xsl:choose>
761 <xsl:choose>
762 <xsl:when test="contains($baseRedirectURL, '?')"><xsl:text>&amp;googleidentity-signin=1</xsl:text></xsl:when>
763 <xsl:otherwise><xsl:text>?googleidentity-signin=1</xsl:text></xsl:otherwise>
764 </xsl:choose>
765 <xsl:if test="$afterHash != ''">#<xsl:value-of select="$afterHash" /></xsl:if>
766 </xsl:template>
767
768
769
770 <xsl:template name="LoginoutLink">
771 <div id="userMenuDiv" style="position:relative;">
772 <!-- login/logout -->
773 <xsl:choose>
774 <xsl:when test="/page/pageRequest/userInformation/@username">
775 <a>
776 <xsl:attribute name="href">javascript:toggleUserMenu();</xsl:attribute>
777 <xsl:call-template name="toggleUserMenuScript"/>
778 <span id="loginButton"><xsl:value-of select="/page/pageRequest/userInformation/@username"/></span>
779 </a>
780 </xsl:when>
781 <xsl:otherwise>
782 <a>
783 <xsl:attribute name="href"><xsl:call-template name="generateLoginURL"/>
784 </xsl:attribute>
785 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/></xsl:attribute>
786 <span id="loginButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_b')"/></span>
787 </a>
788 </xsl:otherwise>
789 </xsl:choose>
790 </div>
791 </xsl:template>
792
793 <xsl:template name="DebugLink">
794 <!-- debuginfo (doesn't use class="ui-state-error" since the text is not legible due to inherited text-colour) -->
795 <xsl:if test="/page/pageRequest/paramList/param[(@name='debug') and (@value='on' or @value='true' or @value='1' or @value='yes')]">
796 <a href="{$library_name}/collection/{$collNameChecked}/page/debug">
797 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_tip')"/></xsl:attribute>
798 <span id="debugButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_b')"/></span>
799 </a>
800 </xsl:if>
801 </xsl:template>
802
803 <xsl:template name="buttonStyling">
804 <script type="text/javascript">
805 <xsl:text disable-output-escaping="yes">
806 $("#preferencesButton").button({icon: "ui-icon-wrench"});
807 $("#preferencesButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
808 $("#helpButton").button({icon: "ui-icon-help"});
809 $("#helpButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
810 $("#debugButton").button({icon: "ui-icon-info"});
811 $("#debugButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
812 </xsl:text>
813 <xsl:choose>
814 <xsl:when test="/page/pageRequest/userInformation/@username">
815 <xsl:text disable-output-escaping="yes">$("#loginButton").button({icon: "ui-icon-unlocked"});</xsl:text>
816 </xsl:when>
817 <xsl:otherwise>
818 <xsl:text disable-output-escaping="yes">$("#loginButton").button({icon: "ui-icon-locked"});</xsl:text>
819 </xsl:otherwise>
820 </xsl:choose>
821 <xsl:text disable-output-escaping="yes">
822 $("#loginButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
823 </xsl:text>
824 </script>
825
826 </xsl:template>
827 <!-- ***** PAGE TITLE ***** -->
828 <xsl:template name="page-title-area">
829 <xsl:variable name="pageTitleVar"><xsl:call-template name="pageTitle"/></xsl:variable>
830 <div id="titlearea">
831 <h2>
832 <!-- Resize the title based on how long it is (There's probably a better way to do this) -->
833 <xsl:attribute name="style">
834 <xsl:choose>
835 <xsl:when test="string-length($pageTitleVar) &lt; 20">
836 <xsl:text>font-size: 1.5em;</xsl:text>
837 </xsl:when>
838 <xsl:when test="string-length($pageTitleVar) &lt; 30">
839 <xsl:text>font-size: 1.4em;</xsl:text>
840 </xsl:when>
841 <xsl:when test="string-length($pageTitleVar) &lt; 40">
842 <xsl:text>font-size: 1.3em;</xsl:text>
843 </xsl:when>
844 <xsl:when test="string-length($pageTitleVar) &lt; 50">
845 <xsl:text>font-size: 1.2em;</xsl:text>
846 </xsl:when>
847 <xsl:when test="string-length($pageTitleVar) &lt; 60">
848 <xsl:text>font-size: 1.1em;</xsl:text>
849 </xsl:when>
850 <xsl:when test="string-length($pageTitleVar) &lt; 70">
851 <xsl:text>font-size: 1em;</xsl:text>
852 </xsl:when>
853 <xsl:when test="string-length($pageTitleVar) &lt; 80">
854 <xsl:text>font-size: 0.9em;</xsl:text>
855 </xsl:when>
856 <xsl:when test="string-length($pageTitleVar) &lt; 90">
857 <xsl:text>font-size: 0.8em;</xsl:text>
858 </xsl:when>
859 <xsl:otherwise>
860 <xsl:text>font-size: 0.7em;</xsl:text>
861 </xsl:otherwise>
862 </xsl:choose>
863 </xsl:attribute>
864 <!--<xsl:value-of select="string-length($pageTitleVar)" />-->
865 <xsl:value-of select="$pageTitleVar" />
866 </h2><xsl:text> </xsl:text>
867 </div>
868 </xsl:template>
869
870 <!-- ***** QUICK SEARCH AREA ***** -->
871 <!-- Search form should only appear if there's a search (query) service AND it has an index.
872 By default, all collections end up with some query service (default is MGPP) even when they have
873 no search indexes, which is why the extra test for the presence of an index/fq-something is necessary. -->
874 <xsl:template name="quick-search-area">
875 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
876 <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
877 <div id="quicksearcharea">
878 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
879 <xsl:choose>
880 <xsl:when test="not(page/pageRequest[@action='q']) or /page/pageRequest/paramList/param[@name='qs']/@value = '1'">
881 <form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
882 <!-- This parameter says that we have come from the quick search area -->
883 <input type="hidden" name="qs" value="1"/>
884 <input type="hidden" name="rt" value="rd"/>
885 <input type="hidden" name="s1.level">
886 <xsl:attribute name="value">
887 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>
888 </xsl:attribute>
889 </input>
890 <xsl:choose>
891 <xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
892 <input type="hidden" name="s1.startPage" value="1"/>
893 </xsl:when>
894 <xsl:otherwise>
895 <input type="hidden" name="startPage" value="1"/>
896 </xsl:otherwise>
897 </xsl:choose>
898
899 <!-- The query text box -->
900 <span class="querybox">
901 <xsl:variable name="qs">
902 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
903 </xsl:variable>
904 <nobr>
905 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
906 <!--
907 <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
908 -->
909 <xsl:with-param name="default" select="normalize-space($qs)"/>
910
911 </xsl:apply-templates>
912 </nobr>
913 </span>
914 <!-- The index selection list -->
915 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">
916 <span class="textselect">
917 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">
918 <xsl:with-param name="default">
919 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>
920 </xsl:with-param>
921 <xsl:with-param name="hideSingle">true</xsl:with-param>
922 <xsl:with-param name="quickSearch">true</xsl:with-param>
923 </xsl:apply-templates>
924 </span>
925 </xsl:if>
926 <!-- The partition selection list -->
927 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']/@type = 'enum_single'">
928 <span class="textselect">
929 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']">
930 <xsl:with-param name="default">
931 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']" mode="calculate-default"/>
932 </xsl:with-param>
933 <xsl:with-param name="hideSingle">true</xsl:with-param>
934 <xsl:with-param name="quickSearch">true</xsl:with-param>
935 </xsl:apply-templates>
936 </span>
937 </xsl:if>
938 <!-- The language selection list -->
939 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']/@type = 'enum_single'">
940 <span class="textselect">
941 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']">
942 <xsl:with-param name="default">
943 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']" mode="calculate-default"/>
944 </xsl:with-param>
945 <xsl:with-param name="hideSingle">true</xsl:with-param>
946 <xsl:with-param name="quickSearch">true</xsl:with-param>
947 </xsl:apply-templates>
948 </span>
949 </xsl:if>
950 <!-- The submit button (for TextQuery) -->
951 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
952 <input type="submit" id="quickSearchSubmitButton">
953 <xsl:attribute name="value">
954 <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>
955 </xsl:attribute>
956 </input>
957 <br/>
958 </xsl:if>
959 </form>
960 </xsl:when>
961 <xsl:otherwise><br/></xsl:otherwise>
962 </xsl:choose>
963 </xsl:if>
964 <!-- The list of other search types -->
965 <ul>
966 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
967 <xsl:if test="/page/pageRequest/paramList/param[@name='qs']/@value = 1 or not(@name = /page/pageRequest/paramList/param[@name='s']/@value)">
968 <li class="ui-state-default ui-corner-all">
969 <a>
970 <xsl:attribute name="href">
971 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collNameChecked"/>/search/<xsl:value-of select="@name"/>
972 </xsl:attribute>
973 <xsl:value-of select="displayItem[@name='name']"/>
974 </a>
975 </li>
976 </xsl:if>
977 </xsl:for-each>
978 </ul>
979 </div>
980 </xsl:if>
981 </xsl:template>
982
983
984 <xsl:template name="map-scripts">
985 <meta content="initial-scale=1.0, user-scalable=no" name="viewport"/>
986 <script src="interfaces/{$interface_name}/js/map-scripts.js" type="text/javascript"><xsl:text> </xsl:text></script>
987 <gsf:script type="text/javascript">$(window).on("load", initializeMapScripts);</gsf:script>
988 </xsl:template>
989
990 <xsl:template name="openlayers-map-scripts">
991 <script src="interfaces/{interface_name}/js/OpenLayers.js" type="text/javascript"><xsl:text> </xsl:text></script>
992 </xsl:template>
993
994 <xsl:template name="panoramaViewer-scripts">
995 <script src="interfaces/{$interface_name}/js/three45.min.js" type="text/javascript"><xsl:text> </xsl:text></script>
996 <script src="interfaces/{$interface_name}/js/Tween.js" type="text/javascript"><xsl:text> </xsl:text></script>
997 <script src="interfaces/{$interface_name}/js/Detector.js" type="text/javascript"><xsl:text> </xsl:text></script>
998 <script src="interfaces/{$interface_name}/js/RequestAnimationFrame.js" type="text/javascript"><xsl:text> </xsl:text></script>
999 <script src="interfaces/{$interface_name}/js/panoramaMarker.js" type="text/javascript"><xsl:text> </xsl:text></script>
1000 <script src="interfaces/{$interface_name}/js/panoramaViewer.js" type="text/javascript"><xsl:text> </xsl:text></script>
1001 <gsf:script type="text/javascript">$(window).on("load", initPanoramaViewer);$(window).on("load", _animate);</gsf:script>
1002 </xsl:template>
1003
1004 <xsl:template name="choose-title">
1005 <gsf:choose-metadata>
1006 <gsf:metadata name="dc.Title"/>
1007 <gsf:metadata name="exp.Title"/>
1008 <gsf:metadata name="ex.dc.Title"/>
1009 <gsf:metadata name="Title"/>
1010 <gsf:default>Untitled</gsf:default>
1011 </gsf:choose-metadata>
1012 </xsl:template>
1013
1014 <xsl:template name="js-for-loading-tk-metadata-set">
1015 <!-- gsf:variable sets these as xsl variables and also gs.variable["xx"] javascript variables-->
1016 <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>
1017 <gsf:variable name="tkMetadataURL_site"><xsl:value-of select="$library_name"/>/sites/<xsl:value-of select="$site_name"/>/metadata/tk.mds</gsf:variable>
1018
1019 <script type="text/javascript">
1020 <xsl:text disable-output-escaping="yes">
1021 $(document).ready(function() {
1022 if (tkMetadataSetStatus == "needs-to-be-loaded") {
1023 loadTKMetadataSet("</xsl:text><xsl:value-of select="$lang"/><xsl:text disable-output-escaping="yes">", "collection");
1024 }
1025 if (tkMetadataSetStatus == "no-metadata-set-for-this-collection") {
1026 loadTKMetadataSet("</xsl:text><xsl:value-of select="$lang"/><xsl:text disable-output-escaping="yes">", "site");
1027 }
1028 })
1029 </xsl:text>
1030 </script>
1031 </xsl:template>
1032
1033 <xsl:template name="choose-tklabels-single-field">
1034 <xsl:param name="label-metadata">tk.Labels</xsl:param>
1035 <xsl:call-template name="js-for-loading-tk-metadata-set"/>
1036 <xsl:variable name="labels-csv"><xsl:for-each select="metadataList/metadata[@name=$label-metadata]"><xsl:value-of select="."/>,</xsl:for-each></xsl:variable>
1037 <gsf:div class="tklabels">
1038 <xsl:if test="util:csvContains($labels-csv, 'tk.Attribution')">
1039 <gsf:icon file="tklabels/tk_a.png"/>
1040 </xsl:if>
1041 <xsl:if test="util:csvContains($labels-csv, 'tk.Clan')">
1042 <gsf:icon file="tklabels/tk_cl.png"/>
1043 </xsl:if>
1044 <xsl:if test="util:csvContains($labels-csv, 'tk.Family')">
1045 <gsf:icon file="tklabels/tk_f.png"/>
1046 </xsl:if>
1047 <xsl:if test="util:csvContains($labels-csv, 'tk.MultipleCommunities')">
1048 <gsf:icon file="tklabels/tk_mc.png"/>
1049 </xsl:if>
1050 <xsl:if test="util:csvContains($labels-csv, 'tk.CommunityVoice')">
1051 <gsf:icon file="tklabels/tk_cv.png"/>
1052 </xsl:if>
1053 <xsl:if test="util:csvContains($labels-csv, 'tk.Creative')">
1054 <gsf:icon file="tklabels/tk_cr.png"/>
1055 </xsl:if>
1056 <xsl:if test="util:csvContains($labels-csv, 'tk.Verified')">
1057 <gsf:icon file="tklabels/tk_v.png"/>
1058 </xsl:if>
1059 <xsl:if test="util:csvContains($labels-csv, 'tk.NonVerified')">
1060 <gsf:icon file="tklabels/tk_nv.png"/>
1061 </xsl:if>
1062 <xsl:if test="util:csvContains($labels-csv, 'tk.Seasonal')">
1063 <gsf:icon file="tklabels/tk_s.png"/>
1064 </xsl:if>
1065 <xsl:if test="util:csvContains($labels-csv, 'tk.WomenGeneral')">
1066 <gsf:icon file="tklabels/tk_wg.png"/>
1067 </xsl:if>
1068 <xsl:if test="util:csvContains($labels-csv, 'tk.MenGeneral')">
1069 <gsf:icon file="tklabels/tk_mg.png"/>
1070 </xsl:if>
1071 <xsl:if test="util:csvContains($labels-csv, 'tk.MenRestricted')">
1072 <gsf:icon file="tklabels/tk_mr.png"/>
1073 </xsl:if>
1074 <xsl:if test="util:csvContains($labels-csv, 'tk.WomenRestricted')">
1075 <gsf:icon file="tklabels/tk_wr.png"/>
1076 </xsl:if>
1077 <xsl:if test="util:csvContains($labels-csv, 'tk.CulturallySensitive')">
1078 <gsf:icon file="tklabels/tk_cs.png"/>
1079 </xsl:if>
1080 <xsl:if test="util:csvContains($labels-csv, 'tk.SecretSacred')">
1081 <gsf:icon file="tklabels/tk_ss.png"/>
1082 </xsl:if>
1083 <xsl:if test="util:csvContains($labels-csv, 'tk.OpenToCommercialization')">
1084 <gsf:icon file="tklabels/tk_oc.png"/>
1085 </xsl:if>
1086 <xsl:if test="util:csvContains($labels-csv, 'tk.NonCommercial')">
1087 <gsf:icon file="tklabels/tk_nc.png"/>
1088 </xsl:if>
1089 <xsl:if test="util:csvContains($labels-csv, 'tk.CommunityUseOnly')">
1090 <gsf:icon file="tklabels/tk_co.png"/>
1091 </xsl:if>
1092 <xsl:if test="util:csvContains($labels-csv, 'tk.Outreach')">
1093 <gsf:icon file="tklabels/tk_o.png"/>
1094 </xsl:if>
1095 <xsl:if test="util:csvContains($labels-csv, 'tk.OpenToCollaboration')">
1096 <gsf:icon file="tklabels/tk_cb.png"/>
1097 </xsl:if>
1098
1099 </gsf:div>
1100 </xsl:template>
1101
1102 <xsl:template name="choose-tklabels">
1103 <xsl:call-template name="js-for-loading-tk-metadata-set"/>
1104 <gsf:div class="tklabels">
1105 <gsf:switch>
1106 <gsf:metadata name="tk.Attribution"/>
1107 <gsf:when test="equals" test-value="true">
1108 <gsf:icon file="tklabels/tk_a.png"/>
1109 </gsf:when>
1110 </gsf:switch>
1111 <gsf:switch>
1112 <gsf:metadata name="tk.Clan"/>
1113 <gsf:when test="equals" test-value="true">
1114 <gsf:icon file="tklabels/tk_cl.png"/>
1115 </gsf:when>
1116 </gsf:switch>
1117 <gsf:switch>
1118 <gsf:metadata name="tk.Family"/>
1119 <gsf:when test="equals" test-value="true">
1120 <gsf:icon file="tklabels/tk_f.png"/>
1121 </gsf:when>
1122 </gsf:switch>
1123 <gsf:switch>
1124 <gsf:metadata name="tk.MultipleCommunities"/>
1125 <gsf:when test="equals" test-value="true">
1126 <gsf:icon file="tklabels/tk_mc.png"/>
1127 </gsf:when>
1128 </gsf:switch>
1129 <gsf:switch>
1130 <gsf:metadata name="tk.CommunityVoice"/>
1131 <gsf:when test="equals" test-value="true">
1132 <gsf:icon file="tklabels/tk_cv.png"/>
1133 </gsf:when>
1134 </gsf:switch>
1135 <gsf:switch>
1136 <gsf:metadata name="tk.Creative"/>
1137 <gsf:when test="equals" test-value="true">
1138 <gsf:icon file="tklabels/tk_cr.png"/>
1139 </gsf:when>
1140 </gsf:switch>
1141 <gsf:switch>
1142 <gsf:metadata name="tk.Verified"/>
1143 <gsf:when test="equals" test-value="true">
1144 <gsf:icon file="tklabels/tk_v.png"/>
1145 </gsf:when>
1146 </gsf:switch>
1147 <gsf:switch>
1148 <gsf:metadata name="tk.NonVerified"/>
1149 <gsf:when test="equals" test-value="true">
1150 <gsf:icon file="tklabels/tk_nv.png"/>
1151 </gsf:when>
1152 </gsf:switch>
1153 <gsf:switch>
1154 <gsf:metadata name="tk.Seasonal"/>
1155 <gsf:when test="equals" test-value="true">
1156 <gsf:icon file="tklabels/tk_s.png"/>
1157 </gsf:when>
1158 </gsf:switch>
1159 <gsf:switch>
1160 <gsf:metadata name="tk.WomenGeneral"/>
1161 <gsf:when test="equals" test-value="true">
1162 <gsf:icon file="tklabels/tk_wg.png"/>
1163 </gsf:when>
1164 </gsf:switch>
1165 <gsf:switch>
1166 <gsf:metadata name="tk.MenGeneral"/>
1167 <gsf:when test="equals" test-value="true">
1168 <gsf:icon file="tklabels/tk_mg.png"/>
1169 </gsf:when>
1170 </gsf:switch>
1171 <gsf:switch>
1172 <gsf:metadata name="tk.MenRestricted"/>
1173 <gsf:when test="equals" test-value="true">
1174 <gsf:icon file="tklabels/tk_mr.png"/>
1175 </gsf:when>
1176 </gsf:switch>
1177 <gsf:switch>
1178 <gsf:metadata name="tk.WomenRestricted"/>
1179 <gsf:when test="equals" test-value="true">
1180 <gsf:icon file="tklabels/tk_wr.png"/>
1181 </gsf:when>
1182 </gsf:switch>
1183 <gsf:switch>
1184 <gsf:metadata name="tk.CulturallySensitive"/>
1185 <gsf:when test="equals" test-value="true">
1186 <gsf:icon file="tklabels/tk_cs.png"/>
1187 </gsf:when>
1188 </gsf:switch>
1189 <gsf:switch>
1190 <gsf:metadata name="tk.SecretSacred"/>
1191 <gsf:when test="equals" test-value="true">
1192 <gsf:icon file="tklabels/tk_ss.png"/>
1193 </gsf:when>
1194 </gsf:switch>
1195 <gsf:switch>
1196 <gsf:metadata name="tk.OpenToCommercialization"/>
1197 <gsf:when test="equals" test-value="true">
1198 <gsf:icon file="tklabels/tk_oc.png"/>
1199 </gsf:when>
1200 </gsf:switch>
1201 <gsf:switch>
1202 <gsf:metadata name="tk.NonCommercial"/>
1203 <gsf:when test="equals" test-value="true">
1204 <gsf:icon file="tklabels/tk_nc.png"/>
1205 </gsf:when>
1206 </gsf:switch>
1207 <gsf:switch>
1208 <gsf:metadata name="tk.CommunityUseOnly"/>
1209 <gsf:when test="equals" test-value="true">
1210 <gsf:icon file="tklabels/tk_co.png"/>
1211 </gsf:when>
1212 </gsf:switch>
1213 <gsf:switch>
1214 <gsf:metadata name="tk.Outreach"/>
1215 <gsf:when test="equals" test-value="true">
1216 <gsf:icon file="tklabels/tk_o.png"/>
1217 </gsf:when>
1218 </gsf:switch>
1219 <gsf:switch>
1220 <gsf:metadata name="tk.OpenToCollaboration"/>
1221 <gsf:when test="equals" test-value="true">
1222 <gsf:icon file="tklabels/tk_cb.png"/>
1223 </gsf:when>
1224 </gsf:switch>
1225 </gsf:div>
1226 </xsl:template>
1227
1228 <xsl:template name="choose-tklabels-small">
1229 <style>
1230 .tklabels img {
1231 width: 2em;
1232 }
1233 </style>
1234 <xsl:call-template name="choose-tklabels"/>
1235 </xsl:template>
1236
1237</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.