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

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

Templates and vars move into their '-core.xsl' counterparts

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