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

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