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

Last change on this file since 30559 was 30559, checked in by kjdon, 5 years ago

handling to add navigationTabs into the navigation bar

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