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

Last change on this file was 38951, checked in by anupama, 28 hours ago

Removing the temporary GS3 runtime Service class GsdlCollageBrowse.java and changes in buildConfigxml.pm and header.xsl needed to work with this that were added in order to get the GsdlCollageApplet to run in some manner and get some idea as to how it was to work/look. Since we've got it working the ideal way, these no longer used temporary changes are no longer necessary.

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