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

Last change on this file since 30478 was 30478, checked in by davidb, 5 years ago

Changes in the XSL and JS code to support the new approach taken to client-side XSLT (using Saxon-CE JS library in the browser). Also the reintroduction of the DirectEdit (Seaweed) template. Not on by default but a simple matter to call the re-instated template for projects that would like to make use of it, such as the digital music stand DL collection. Some white-space changes also occured. This was not deliberate, but would have been quite fiddly to tease out from other changes in the file, so consequently left in.

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