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

Last change on this file since 37078 was 37078, checked in by davidb, 17 months ago

Tweaked an existing (empty) rule with a commented out body that shows the sort of thing you might like to change it to

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