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

Last change on this file since 31386 was 31386, checked in by Georgiy Litvinov, 7 years ago

Moved li inside templates to get rid of empty li elements in html

  • Property svn:executable set to *
File size: 31.5 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="../query-common.xsl"/>
12 <xsl:include href="../javascript-global-setup.xsl"/>
13
14 <!-- If the c parameter is empty then use the p.c parameter for the collection name-->
15 <xsl:variable name="collNameChecked">
16 <xsl:choose>
17 <xsl:when test="$collName = '' and /page/pageRequest/paramList/param[@name='p.c']/@value">
18 <xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/>
19 </xsl:when>
20 <xsl:otherwise>
21 <xsl:value-of select="$collName"/>
22 </xsl:otherwise>
23 </xsl:choose>
24 </xsl:variable>
25
26 <!-- Creates a header for the html page -->
27 <xsl:template name="create-html-header">
28 <base>
29 <xsl:attribute name="href">
30 <xsl:choose>
31 <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'siteURL']">
32 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'siteURL']"/>
33 </xsl:when>
34 <xsl:when test="/page/pageRequest/@baseURL">
35 <xsl:value-of select="/page/pageRequest/@baseURL"/>
36 </xsl:when>
37 </xsl:choose>
38 </xsl:attribute>
39 </base>
40 <xsl:comment>[if lte IE 6]&gt;&lt;/base&gt;&lt;![endif]</xsl:comment>
41
42 <title><xsl:call-template name="pageTitle"/> :: <xsl:call-template name="siteName"/></title>
43
44 <xsl:if test="/page/pageRequest/@action ='d'">
45
46 <xsl:variable name="myMetadataHeader" select="/page/pageResponse/format/gsf:headMetaTags/gsf:metadata"/>
47 <xsl:for-each select="$myMetadataHeader">
48 <xsl:variable name="metaname" select="@name"/>
49
50 <xsl:variable name="metavals"
51 select="/page/pageResponse/document/metadataList/metadata[@name = $metaname]|/page/pageResponse/document/documentNode/metadataList/metadata[@name = $metaname]"/>
52 <xsl:for-each select="$metavals">
53 <META NAME="{$metaname}" CONTENT="{.}"/>
54 </xsl:for-each>
55 </xsl:for-each>
56
57 </xsl:if>
58
59 <xsl:choose>
60 <xsl:when test="/page/pageResponse/interfaceOptions/option[@name = 'cssTheme']/@value">
61 <!-- Get the theme from the interfaceConfig.xml file -->
62 <link rel="stylesheet" href="{/page/pageResponse/interfaceOptions/option[@name = 'cssTheme']/@value}" type="text/css"/>
63 </xsl:when>
64 <xsl:otherwise>
65 <link rel="stylesheet" href="interfaces/{$interface_name}/style/themes/main/jquery-ui-1.8.16.custom.css" type="text/css"/>
66 </xsl:otherwise>
67 </xsl:choose>
68 <link rel="stylesheet" href="interfaces/{$interface_name}/style/core.css" type="text/css"/>
69 <link rel="shortcut icon" href="interfaces/{$interface_name}/images/favicon.ico"/>
70
71 <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery.min.js"><xsl:text> </xsl:text></script>
72 <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.min.js"><xsl:text> </xsl:text></script>
73 <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery.blockUI.js"><xsl:text> </xsl:text></script>
74 <script type="text/javascript" src="interfaces/{$interface_name}/js/ace/ace.js"><xsl:text> </xsl:text></script>
75
76 <script type="text/javascript" src="interfaces/{$interface_name}/js/zoomer.js"><xsl:text> </xsl:text></script>
77
78 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
79 <xsl:call-template name="map-scripts"/>
80 </xsl:if>
81
82 <xsl:if test="/page/pageResponse/format/gsf:option[@name='mapEnabledOpenLayers']/@value = 'true'">
83 <xsl:call-template name="openlayers-map-scripts"/>
84 </xsl:if>
85
86
87 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
88 <xsl:call-template name="panoramaViewer-scripts"/>
89 </xsl:if>
90
91 <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))">
92 <xsl:if test="/page/pageRequest/paramList/param[(@name='docEdit') and (@value='on' or @value='true' or @value='1')]">
93 <script type="text/javascript" src="interfaces/{$interface_name}/js/ckeditor/ckeditor.js" defer="true"><xsl:text> </xsl:text></script>
94 <!-- <xsl:call-template name="init-direct-edit"/> -->
95 </xsl:if>
96 <script type="text/javascript" src="interfaces/{$interface_name}/js/debug_scripts.js"><xsl:text> </xsl:text></script>
97 <script type="text/javascript" src="interfaces/{$interface_name}/js/visual-xml-editor.js"><xsl:text> </xsl:text></script>
98 </xsl:if>
99
100 <xsl:call-template name="setup-gs-variable"/>
101 <xsl:if test="/page/pageRequest/@action ='p' and /page/pageRequest/@subaction='pref'">
102 <script type="text/javascript">
103 <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceStringsAsJavascript($interface_name, /page/@lang, 'pref')"/>
104 </script>
105 <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery.themeswitcher.min.js"><xsl:text> </xsl:text></script>
106 </xsl:if>
107 <xsl:call-template name="define-js-macro-variables"/>
108
109 <xsl:call-template name="additionalHeaderContent"/>
110 </xsl:template>
111
112 <!-- This template allows for extra header content to be added by interface, site and collection. -->
113 <xsl:template name="additionalHeaderContent">
114 <xsl:call-template name="additionalHeaderContent-interface"/>
115 <xsl:call-template name="additionalHeaderContent-site"/>
116 <xsl:call-template name="additionalHeaderContent-collection"/>
117 </xsl:template>
118 <!-- This template should be overridden in header.xsl of a new interface file if you want to add extra header content -->
119 <xsl:template name="additionalHeaderContent-interface">
120 </xsl:template>
121 <!-- This template should be overridden in the header.xsl file in a site's transform directory if you want to add site specific headers -->
122 <xsl:template name="additionalHeaderContent-site">
123 </xsl:template>
124 <!-- This template should be overridden in the collectionConfig.xml file if you want to add extra header content -->
125 <xsl:template name="additionalHeaderContent-collection">
126 </xsl:template>
127
128 <xsl:template name="init-direct-edit">
129 <!-- might be worth moving loading the JS file to earlier, to give time to load -->
130 <script type="text/javascript" src="interfaces/{$interface_name}/js/direct-edit.js"><xsl:text> </xsl:text></script>
131 <script type="text/javascript">
132 <xsl:text disable-output-escaping="yes">
133 $(document).ready(function() {
134 de.onready(function()
135 {
136 try
137 {
138 de.init();
139 }
140 catch (err)
141 {
142 alert("Seaweed failed to initialise: " + err.message);
143 }
144 });
145 });
146 </xsl:text>
147 </script>
148 </xsl:template>
149
150
151 <!-- ***** HEADER LAYOUT TEMPLATE ***** -->
152 <xsl:template name="create-banner">
153 <div id="gs_banner" class="ui-widget-header ui-corner-bottom">
154 <div id="titlesearchcontainer">
155 <xsl:call-template name="page-title-area"/>
156 <xsl:call-template name="quick-search-area"/>
157 <div style="clear:both;"><xsl:text> </xsl:text></div>
158 </div>
159 <xsl:call-template name="browsing-tabs"/>
160 </div>
161 </xsl:template>
162
163 <xsl:template name="additionalNavTabs">
164 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/extraInfo/navigationTab">
165 <li>
166 <xsl:choose>
167 <!-- if we are in frame type and this is the current page, colour it differently-->
168 <xsl:when test="@type='frame' and /page/pageRequest[@subaction='html'] and /page/pageRequest/paramList/param[@name='url']/@value = @url">
169 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
170 </xsl:when>
171 <xsl:otherwise>
172 <xsl:attribute name="class">ui-state-default ui-corner-top</xsl:attribute>
173 </xsl:otherwise>
174 </xsl:choose>
175 <a>
176 <xsl:if test="displayItem[@name='description']">
177 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
178 </xsl:if>
179 <xsl:choose>
180 <xsl:when test="@type='external-link'">
181 <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
182 </xsl:when>
183 <xsl:when test="@type='frame'">
184 <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>
185 </xsl:when>
186 </xsl:choose>
187 <xsl:choose>
188 <xsl:when test="displayItem[@name='name']">
189 <xsl:value-of select="displayItem[@name='name']"/>
190 </xsl:when>
191 <xsl:otherwise>link</xsl:otherwise>
192 </xsl:choose>
193 </a>
194 </li>
195 </xsl:for-each>
196
197 </xsl:template>
198 <!-- ***** BROWSING TABS ***** -->
199 <xsl:template name="browsing-tabs">
200 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service or /page/pageResponse/collection[@name=$collNameChecked]/extraInfo/navigationTab">
201 <ul id="gs-nav">
202 <!-- if this collection has additional tabs, add them here -->
203 <xsl:call-template name="additionalNavTabs"/>
204 <!-- If this collection has a ClassifierBrowse service then add a tab for each classifier-->
205 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='browse' and @name='ClassifierBrowse']">
206 <!-- Loop through each classifier -->
207 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">
208 <li>
209 <xsl:choose>
210 <!-- If this tab is selected then colour it differently -->
211 <xsl:when test="util:contains(/page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value, @name)">
212 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
213 </xsl:when>
214 <xsl:otherwise>
215 <xsl:attribute name='class'>ui-state-default ui-corner-top</xsl:attribute>
216 </xsl:otherwise>
217 </xsl:choose>
218
219 <a>
220 <!-- Add a title element to the <a> tag if a description exists for this classifier -->
221 <xsl:if test="displayItem[@name='description']">
222 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
223 </xsl:if>
224
225 <!-- Add the href element to the <a> tag -->
226 <xsl:choose>
227 <xsl:when test="@name">
228 <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>
229 </xsl:when>
230 <xsl:otherwise>
231 <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>
232 </xsl:otherwise>
233 </xsl:choose>
234
235 <!-- Add the actual text of the <a> tag -->
236 <xsl:value-of select="displayItem[@name='name']"/>
237 </a>
238 </li>
239 </xsl:for-each>
240 </xsl:if>
241
242 <!-- PhindApplet. Need something similar for the Collage applet too, probably -->
243 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='PhindApplet']">
244 <li>
245 <xsl:choose>
246 <!-- If this tab is selected then colour it differently -->
247 <xsl:when test="/page/pageRequest[@action='a']">
248 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
249 </xsl:when>
250 <xsl:otherwise>
251 <xsl:attribute name='class'>ui-state-default ui-corner-top</xsl:attribute>
252 </xsl:otherwise>
253 </xsl:choose>
254
255 <a>
256 <xsl:if test="displayItem[@name='description']">
257 <xsl:attribute name="title">
258 <xsl:value-of select="displayItem[@name='description']"/>
259 </xsl:attribute>
260 </xsl:if>
261 <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>
262 <xsl:value-of select="displayItem[@name='name']"/>
263 </a>
264 </li>
265 </xsl:for-each>
266
267 <!-- all other services -->
268 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[not(@type='query') and not(@type='browse') and not (@name='PhindApplet')]">
269 <xsl:call-template name="navigationTab"/>
270 </xsl:for-each>
271 </ul>
272 <div style="clear:both;"><xsl:text> </xsl:text></div>
273 </xsl:if>
274 </xsl:template>
275
276 <!-- ***** HOME HELP PREFERENCES LOGIN ***** -->
277 <xsl:template name="home-help-preferences">
278 <ul id="bannerLinks">
279 <xsl:call-template name="RSSLink"/>
280 <xsl:call-template name="PrefsLink"/>
281 <xsl:call-template name="HelpLink"/>
282 <xsl:call-template name="LoginoutLink"/>
283 <xsl:call-template name="DebugLink"/>
284 <xsl:call-template name="buttonStyling"/>
285 </ul>
286 </xsl:template>
287
288 <xsl:template name="RSSLink">
289 <!-- RSS feed link can appear in a global format statement (where it has no type attribute)
290 or in section specific format statements, such as browse, search, display.
291 If it's present in any format statement, display the RSS link in the bannerlinks section. -->
292 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search' or not(@type)]/gsf:option[@name='RSS']/@value = 'true'">
293 <li>
294 <gsf:link type="rss"><gsf:icon file="rssicon.png"/></gsf:link>
295 </li>
296 </xsl:if>
297 </xsl:template>
298
299 <xsl:template name="PrefsLink">
300 <li>
301 <a href="{$library_name}/collection/{$collNameChecked}/page/pref">
302 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
303 <span id="preferencesButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></span>
304 </a>
305 </li>
306 </xsl:template>
307
308 <xsl:template name="HelpLink">
309 <li>
310 <a href="{$library_name}/collection/{$collNameChecked}/page/help">
311 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
312 <span id="helpButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></span>
313 </a>
314 </li>
315 </xsl:template>
316
317 <xsl:template name="toggleUserMenuScript">
318 <script type="text/javascript">
319 <xsl:text disable-output-escaping="yes">
320 function toggleUserMenu()
321 {
322 var button = $("#userMenuButton");
323 var menu;
324
325 if(button.data("userMenu"))
326 {
327 menu = button.data("userMenu");
328 if(menu.css("display") == "block")
329 {
330 menu.hide();
331 }
332 else
333 {
334 menu.show();
335 }
336 }
337 else
338 {
339 menu = $("&lt;UL&gt;")
340 .css("position", "absolute")
341 .css("display", "block")
342 .css("z-index", "100")
343 .css("list-style", "none outside none")
344 .css("margin", "0px")
345 .css("padding", "0px")
346 .css("font-size", "90%");
347
348 menu.attr("id", "userMenu");
349
350 button.data("userMenu", menu);
351
352 var settingsLink = $("&lt;a&gt;")
353 .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">");
354 var settingsButton = $("&lt;LI&gt;")
355 .css("padding", "3px")
356 .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.account_settings')"/><xsl:text disable-output-escaping="yes">")
357 .addClass("ui-state-default");
358 settingsLink.append(settingsButton);
359
360 var editingLink = $("&lt;a&gt;")
361 .attr("href", "javascript:;");
362 var editingButton = $("&lt;LI&gt;")
363 .css("padding", "3px")
364 .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">")
365 .addClass("ui-state-default")
366 .click(function()
367 {
368 var 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");
369 $.ajax(url)
370 .success(function(response)
371 {
372 location.reload();
373 });
374 });
375 editingLink.append(editingButton);
376
377 var url = document.URL;
378 var hasQueryString = (url.indexOf("?") != -1);
379 var hashIndex = url.indexOf("#");
380
381 var hashPart;
382 if(hashIndex != -1)
383 {
384 hashPart = url.substring(hashIndex);
385 url = url.substring(0, hashIndex);
386 }
387
388 var logoutLink = $("&lt;a&gt;")
389 .attr("href", url + (hasQueryString ? "&amp;" : "?") + "logout=" + (hashPart ? hashPart : ""));
390 var logoutButton = $("&lt;LI&gt;")
391 .css("padding", "3px")
392 .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.logout')"/><xsl:text disable-output-escaping="yes">")
393 .addClass("ui-state-default");
394 logoutLink.append(logoutButton);
395
396 menu.append(settingsLink);
397 menu.append(editingLink);
398 menu.append(logoutLink);
399
400 var buttonLeft = button.offset().left;
401 var buttonTop = button.offset().top;
402
403 var buttonHeight = button.height();
404
405 menu.offset({top: buttonTop + buttonHeight + 4, left: buttonLeft});
406 $("#topArea").append(menu);
407 }
408 }
409 </xsl:text>
410 </script>
411
412 </xsl:template>
413 <xsl:template name="generateLoginURL">
414 <xsl:value-of select="$library_name"/>
415 <xsl:text>?a=p&amp;sa=login&amp;redirectURL=</xsl:text>
416 <xsl:value-of select="$library_name"/>
417 <xsl:text>%3F</xsl:text>
418 <xsl:if test="/page/pageRequest/@action">
419 <xsl:text>a=</xsl:text>
420 <xsl:value-of select="/page/pageRequest/@action"/>
421 </xsl:if>
422 <xsl:if test="/page/pageRequest/@subaction">
423 <xsl:text>%26sa=</xsl:text>
424 <xsl:value-of select="/page/pageRequest/@subaction"/>
425 </xsl:if>
426 <xsl:for-each select="/page/pageRequest/paramList/param">
427 <xsl:if test="@name != 'password' and @name != 's1.password' and @name != 's1.newPassword' and @name != 's1.oldPassword'">
428 <xsl:text>%26</xsl:text>
429 <xsl:value-of select="@name"/>
430 <xsl:text>=</xsl:text>
431 <xsl:value-of select="@value"/>
432 </xsl:if>
433 </xsl:for-each>
434
435 </xsl:template>
436
437 <xsl:template name="LoginoutLink">
438 <li id="userMenuButton">
439 <!-- login/logout -->
440 <xsl:choose>
441 <xsl:when test="/page/pageRequest/userInformation/@username">
442 <a>
443 <xsl:attribute name="href">javascript:toggleUserMenu();</xsl:attribute>
444 <xsl:call-template name="toggleUserMenuScript"/>
445 <span id="loginButton"><xsl:value-of select="/page/pageRequest/userInformation/@username"/></span>
446 </a>
447 </xsl:when>
448 <xsl:otherwise>
449 <a>
450 <xsl:attribute name="href"><xsl:call-template name="generateLoginURL"/>
451 </xsl:attribute>
452 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/></xsl:attribute>
453 <span id="loginButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_b')"/></span>
454 </a>
455 </xsl:otherwise>
456 </xsl:choose>
457 </li>
458 </xsl:template>
459
460 <xsl:template name="DebugLink">
461 <!-- debuginfo (doesn't use class="ui-state-error" since the text is not legible due to inherited text-colour) -->
462 <xsl:if test="/page/pageRequest/paramList/param[(@name='debug') and (@value='on' or @value='true' or @value='1' or @value='yes')]">
463 <li>
464 <a href="{$library_name}/collection/{$collNameChecked}/page/debug">
465 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_tip')"/></xsl:attribute>
466 <span id="debugButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_b')"/></span>
467 </a>
468 </li>
469 </xsl:if>
470 </xsl:template>
471
472 <xsl:template name="buttonStyling">
473 <script type="text/javascript">
474 <xsl:text disable-output-escaping="yes">
475 $("#preferencesButton").button({icons:{primary:"ui-icon-wrench"}});
476 $("#preferencesButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
477 $("#helpButton").button({icons:{primary:"ui-icon-help"}});
478 $("#helpButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
479 $("#debugButton").button({icons:{primary:"ui-icon-info"}});
480 $("#debugButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
481 </xsl:text>
482 <xsl:choose>
483 <xsl:when test="/page/pageRequest/userInformation/@username">
484 <xsl:text disable-output-escaping="yes">$("#loginButton").button({icons:{primary:"ui-icon-unlocked"}});</xsl:text>
485 </xsl:when>
486 <xsl:otherwise>
487 <xsl:text disable-output-escaping="yes">$("#loginButton").button({icons:{primary:"ui-icon-locked"}});</xsl:text>
488 </xsl:otherwise>
489 </xsl:choose>
490 <xsl:text disable-output-escaping="yes">
491 $("#loginButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
492 </xsl:text>
493 </script>
494
495 </xsl:template>
496 <!-- ***** PAGE TITLE ***** -->
497 <xsl:template name="page-title-area">
498 <xsl:variable name="pageTitleVar"><xsl:call-template name="pageTitle"/></xsl:variable>
499 <div id="titlearea">
500 <h2>
501 <!-- Resize the title based on how long it is (There's probably a better way to do this) -->
502 <xsl:attribute name="style">
503 <xsl:choose>
504 <xsl:when test="string-length($pageTitleVar) &lt; 20">
505 <xsl:text>font-size: 1.5em;</xsl:text>
506 </xsl:when>
507 <xsl:when test="string-length($pageTitleVar) &lt; 30">
508 <xsl:text>font-size: 1.4em;</xsl:text>
509 </xsl:when>
510 <xsl:when test="string-length($pageTitleVar) &lt; 40">
511 <xsl:text>font-size: 1.3em;</xsl:text>
512 </xsl:when>
513 <xsl:when test="string-length($pageTitleVar) &lt; 50">
514 <xsl:text>font-size: 1.2em;</xsl:text>
515 </xsl:when>
516 <xsl:when test="string-length($pageTitleVar) &lt; 60">
517 <xsl:text>font-size: 1.1em;</xsl:text>
518 </xsl:when>
519 <xsl:when test="string-length($pageTitleVar) &lt; 70">
520 <xsl:text>font-size: 1em;</xsl:text>
521 </xsl:when>
522 <xsl:when test="string-length($pageTitleVar) &lt; 80">
523 <xsl:text>font-size: 0.9em;</xsl:text>
524 </xsl:when>
525 <xsl:when test="string-length($pageTitleVar) &lt; 90">
526 <xsl:text>font-size: 0.8em;</xsl:text>
527 </xsl:when>
528 <xsl:otherwise>
529 <xsl:text>font-size: 0.7em;</xsl:text>
530 </xsl:otherwise>
531 </xsl:choose>
532 </xsl:attribute>
533 <!--<xsl:value-of select="string-length($pageTitleVar)" />-->
534 <xsl:value-of select="$pageTitleVar" />
535 </h2><xsl:text> </xsl:text>
536 </div>
537 </xsl:template>
538
539 <!-- ***** QUICK SEARCH AREA ***** -->
540 <!-- Search form should only appear if there's a search (query) service AND it has an index.
541 By default, all collections end up with some query service (default is MGPP) even when they have
542 no search indexes, which is why the extra test for the presence of an index/fq-something is necessary. -->
543 <xsl:template name="quick-search-area">
544 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
545 <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
546 <div id="quicksearcharea">
547 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
548 <xsl:choose>
549 <xsl:when test="not(page/pageRequest[@action='q']) or /page/pageRequest/paramList/param[@name='qs']/@value = '1'">
550 <form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
551 <!-- This parameter says that we have come from the quick search area -->
552 <input type="hidden" name="qs" value="1"/>
553 <input type="hidden" name="rt" value="rd"/>
554 <input type="hidden" name="s1.level">
555 <xsl:attribute name="value">
556 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>
557 </xsl:attribute>
558 </input>
559 <xsl:choose>
560 <xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
561 <input type="hidden" name="s1.startPage" value="1"/>
562 </xsl:when>
563 <xsl:otherwise>
564 <input type="hidden" name="startPage" value="1"/>
565 </xsl:otherwise>
566 </xsl:choose>
567
568 <!-- The query text box -->
569 <span class="querybox">
570 <xsl:variable name="qs">
571 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
572 </xsl:variable>
573 <nobr>
574 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
575 <!--
576 <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
577 -->
578 <xsl:with-param name="default" select="normalize-space($qs)"/>
579
580 </xsl:apply-templates>
581 </nobr>
582 </span>
583 <!-- The index selection list -->
584 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">
585 <span class="textselect">
586 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">
587 <xsl:with-param name="default">
588 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>
589 </xsl:with-param>
590 <xsl:with-param name="hideSingle">false</xsl:with-param>
591 <xsl:with-param name="quickSearch">true</xsl:with-param>
592 </xsl:apply-templates>
593 </span>
594 </xsl:if>
595 <!-- The partition selection list -->
596 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']/@type = 'enum_single'">
597 <span class="textselect">
598 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']">
599 <xsl:with-param name="default">
600 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']" mode="calculate-default"/>
601 </xsl:with-param>
602 <xsl:with-param name="hideSingle">true</xsl:with-param>
603 <xsl:with-param name="quickSearch">true</xsl:with-param>
604 </xsl:apply-templates>
605 </span>
606 </xsl:if>
607 <!-- The language selection list -->
608 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']/@type = 'enum_single'">
609 <span class="textselect">
610 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']">
611 <xsl:with-param name="default">
612 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']" mode="calculate-default"/>
613 </xsl:with-param>
614 <xsl:with-param name="hideSingle">true</xsl:with-param>
615 <xsl:with-param name="quickSearch">true</xsl:with-param>
616 </xsl:apply-templates>
617 </span>
618 </xsl:if>
619 <!-- The submit button (for TextQuery) -->
620 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
621 <input type="submit" id="quickSearchSubmitButton">
622 <xsl:attribute name="value">
623 <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>
624 </xsl:attribute>
625 </input>
626 <br/>
627 </xsl:if>
628 </form>
629 </xsl:when>
630 <xsl:otherwise><br/></xsl:otherwise>
631 </xsl:choose>
632 </xsl:if>
633 <!-- The list of other search types -->
634 <ul>
635 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
636 <li>
637 <xsl:choose>
638 <xsl:when test="@name = /page/pageRequest/paramList/param[@name='s']/@value and not(/page/pageRequest/paramList/param[@name='qs']/@value = 1)">
639 <xsl:attribute name="class">ui-state-default ui-corner-all ui-state-active</xsl:attribute>
640 </xsl:when>
641 <xsl:otherwise>
642 <xsl:attribute name="class">ui-state-default ui-corner-all</xsl:attribute>
643 </xsl:otherwise>
644 </xsl:choose>
645 <a>
646 <xsl:attribute name="href">
647 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collNameChecked"/>/search/<xsl:value-of select="@name"/>
648 </xsl:attribute>
649 <xsl:value-of select="displayItem[@name='name']"/>
650 </a>
651 </li>
652 </xsl:for-each>
653 </ul>
654 </div>
655 </xsl:if>
656 </xsl:template>
657
658 <xsl:template name="map-scripts">
659 <meta content="initial-scale=1.0, user-scalable=no" name="viewport"/>
660 <script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyCofVTps3xHfMvIcTMHqYMMxe3xXfkAxnI" type="text/javascript"><xsl:text> </xsl:text></script>
661 <script src="interfaces/{$interface_name}/js/map-scripts.js" type="text/javascript"><xsl:text> </xsl:text></script>
662 <script type="text/javascript">$(window).load(initializeMapScripts);</script>
663 </xsl:template>
664
665 <xsl:template name="openlayers-map-scripts">
666 <script src="interfaces/{interface_name}/js/OpenLayers.js" type="text/javascript"><xsl:text> </xsl:text></script>
667 </xsl:template>
668
669 <xsl:template name="panoramaViewer-scripts">
670 <script src="interfaces/{$interface_name}/js/three45.min.js" type="text/javascript"><xsl:text> </xsl:text></script>
671 <script src="interfaces/{$interface_name}/js/Tween.js" type="text/javascript"><xsl:text> </xsl:text></script>
672 <script src="interfaces/{$interface_name}/js/Detector.js" type="text/javascript"><xsl:text> </xsl:text></script>
673 <script src="interfaces/{$interface_name}/js/RequestAnimationFrame.js" type="text/javascript"><xsl:text> </xsl:text></script>
674 <script src="interfaces/{$interface_name}/js/panoramaMarker.js" type="text/javascript"><xsl:text> </xsl:text></script>
675 <script src="interfaces/{$interface_name}/js/panoramaViewer.js" type="text/javascript"><xsl:text> </xsl:text></script>
676 <script type="text/javascript">$(window).load(initPanoramaViewer);$(window).load(_animate);</script>
677 </xsl:template>
678
679 <xsl:template name="choose-title">
680 <gsf:choose-metadata>
681 <gsf:metadata name="dc.Title"/>
682 <gsf:metadata name="exp.Title"/>
683 <gsf:metadata name="ex.dc.Title"/>
684 <gsf:metadata name="Title"/>
685 <gsf:default>Untitled</gsf:default>
686 </gsf:choose-metadata>
687 </xsl:template>
688</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.