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

Last change on this file since 26305 was 26305, checked in by sjm84, 12 years ago

Changed the slideshow to use more of the screen and reverting the page width change

  • Property svn:executable set to *
File size: 21.5 KB
Line 
1<xsl:stylesheet version="1.0"
2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:java="http://xml.apache.org/xslt/java"
4 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
5 xmlns:gslib="http://www.greenstone.org/skinning"
6 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
7 extension-element-prefixes="java util"
8 exclude-result-prefixes="java util gsf">
9
10 <xsl:include href="../query-common.xsl"/>
11 <xsl:include href="../javascript-global-setup.xsl"/>
12
13 <!-- If the c parameter is empty then use the p.c parameter for the collection name-->
14 <xsl:variable name="collNameChecked">
15 <xsl:choose>
16 <xsl:when test="$collName = '' and /page/pageRequest/paramList/param[@name='p.c']/@value">
17 <xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/>
18 </xsl:when>
19 <xsl:otherwise>
20 <xsl:value-of select="$collName"/>
21 </xsl:otherwise>
22 </xsl:choose>
23 </xsl:variable>
24
25 <!-- Creates a header for the html page -->
26 <xsl:template name="create-html-header">
27 <base>
28 <xsl:attribute name="href">
29 <xsl:choose>
30 <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'siteURL']">
31 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'siteURL']"/>
32 </xsl:when>
33 <xsl:when test="/page/pageRequest/@baseURL">
34 <xsl:value-of select="/page/pageRequest/@baseURL"/>
35 </xsl:when>
36 </xsl:choose>
37 </xsl:attribute>
38 </base>
39 <xsl:comment>[if lte IE 6]&gt;&lt;/base&gt;&lt;![endif]</xsl:comment>
40
41 <title><xsl:call-template name="pageTitle"/> :: <xsl:call-template name="siteName"/></title>
42
43 <xsl:choose>
44 <xsl:when test="/page/pageResponse/interfaceOptions/option[@name = 'cssTheme']/@value">
45 <!-- Get the theme from the interfaceConfig.xml file -->
46 <link rel="stylesheet" href="{/page/pageResponse/interfaceOptions/option[@name = 'cssTheme']/@value}" type="text/css"/>
47 </xsl:when>
48 <xsl:otherwise>
49 <link rel="stylesheet" href="interfaces/{$interface_name}/style/themes/main/jquery-ui-1.8.16.custom.css" type="text/css"/>
50 </xsl:otherwise>
51 </xsl:choose>
52 <link rel="stylesheet" href="interfaces/{$interface_name}/style/core.css" type="text/css"/>
53 <link rel="shortcut icon" href="interfaces/{$interface_name}/images/favicon.ico"/>
54
55 <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery.min.js"><xsl:text> </xsl:text></script>
56 <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery-ui.min.js"><xsl:text> </xsl:text></script>
57 <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery.themeswitcher.min.js"><xsl:text> </xsl:text></script>
58 <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery.blockUI.js"><xsl:text> </xsl:text></script>
59
60 <script type="text/javascript" src="interfaces/{$interface_name}/js/direct-edit.js"><xsl:text> </xsl:text></script>
61 <script type="text/javascript" src="interfaces/{$interface_name}/js/zoomer.js"><xsl:text> </xsl:text></script>
62
63 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
64 <xsl:call-template name="map-scripts"/>
65 </xsl:if>
66
67 <xsl:if test="/page/pageRequest/userInformation 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))">
68 <xsl:call-template name="init-direct-edit"/>
69 </xsl:if>
70 <xsl:call-template name="setup-gs-variable"/>
71 <xsl:call-template name="additionalHeaderContent"/>
72 </xsl:template>
73
74 <xsl:template name="additionalHeaderContent">
75 <!-- This template should be overridden in the collectionConfig.xml file if you want to add extra header content -->
76 </xsl:template>
77
78 <xsl:template name="init-direct-edit">
79 <script type="text/javascript">
80 <xsl:text disable-output-escaping="yes">
81 de.onready(function()
82 {
83 try
84 {
85 de.init();
86 }
87 catch (err)
88 {
89 alert("Seaweed failed to initialise: " + err.message);
90 }
91 });
92 </xsl:text>
93 </script>
94 </xsl:template>
95
96 <!-- ***** HEADER LAYOUT TEMPLATE ***** -->
97 <xsl:template name="create-banner">
98 <div id="gs_banner" class="ui-widget-header ui-corner-bottom">
99 <div id="titlesearchcontainer">
100 <xsl:call-template name="page-title-area"/>
101 <xsl:call-template name="quick-search-area"/>
102 <div style="clear:both;"><xsl:text> </xsl:text></div>
103 </div>
104 <xsl:call-template name="browsing-tabs"/>
105 </div>
106 </xsl:template>
107
108 <!-- ***** BROWSING TABS ***** -->
109 <xsl:template name="browsing-tabs">
110 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service">
111 <ul id="gs-nav">
112 <!-- If this collection has a ClassifierBrowse service then add a tab for each classifier-->
113 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='browse' and @name='ClassifierBrowse']">
114 <!-- Loop through each classifier -->
115 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">
116 <li>
117 <xsl:choose>
118 <!-- If this tab is selected then colour it differently -->
119 <xsl:when test="util:contains(/page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value, @name)">
120 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
121 </xsl:when>
122 <xsl:otherwise>
123 <xsl:attribute name='class'>ui-state-default ui-corner-top</xsl:attribute>
124 </xsl:otherwise>
125 </xsl:choose>
126
127 <a>
128 <!-- Add a title element to the <a> tag if a description exists for this classifier -->
129 <xsl:if test="displayItem[@name='description']">
130 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
131 </xsl:if>
132
133 <!-- Add the href element to the <a> tag -->
134 <xsl:choose>
135 <xsl:when test="@name">
136 <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>
137 </xsl:when>
138 <xsl:otherwise>
139 <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>
140 </xsl:otherwise>
141 </xsl:choose>
142
143 <!-- Add the actual text of the <a> tag -->
144 <xsl:value-of select="displayItem[@name='name']"/>
145 </a>
146 </li>
147 </xsl:for-each>
148 </xsl:if>
149
150 <!-- PhindApplet. Need something similar for the Collage applet too, probably -->
151 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='PhindApplet']">
152 <li>
153 <xsl:choose>
154 <!-- If this tab is selected then colour it differently -->
155 <xsl:when test="/page/pageRequest[@action='a']">
156 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
157 </xsl:when>
158 <xsl:otherwise>
159 <xsl:attribute name='class'>ui-state-default ui-corner-top</xsl:attribute>
160 </xsl:otherwise>
161 </xsl:choose>
162
163 <a>
164 <xsl:if test="displayItem[@name='description']">
165 <xsl:attribute name="title">
166 <xsl:value-of select="displayItem[@name='description']"/>
167 </xsl:attribute>
168 </xsl:if>
169 <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>
170 <xsl:value-of select="displayItem[@name='name']"/>
171 </a>
172 </li>
173 </xsl:for-each>
174
175 <!-- all other services -->
176 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[not(@type='query') and not(@type='browse') and not (@name='PhindApplet')]">
177 <xsl:call-template name="navigationTab"/>
178 </xsl:for-each>
179 </ul>
180 <div style="clear:both;"><xsl:text> </xsl:text></div>
181 </xsl:if>
182 </xsl:template>
183
184 <!-- ***** HOME HELP PREFERENCES LOGIN ***** -->
185 <xsl:template name="home-help-preferences">
186 <ul id="bannerLinks">
187 <!-- preferences -->
188 <li class="ui-state-default ui-corner-all">
189 <a href="{$library_name}/collection/{$collNameChecked}/page/pref">
190 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
191 <ul>
192 <li><span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></span></li>
193 <li><span class="ui-icon ui-icon-wrench"><xsl:text> </xsl:text></span></li>
194 </ul>
195 </a>
196 </li>
197
198 <!-- help -->
199 <li class="ui-state-default ui-corner-all">
200 <a href="{$library_name}/collection/{$collNameChecked}/page/help">
201 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
202 <ul>
203 <li><span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></span></li>
204 <li><span class="ui-icon ui-icon-help"><xsl:text> </xsl:text></span></li>
205 </ul>
206 </a>
207 </li>
208
209 <!-- login/logout -->
210 <li class="ui-state-default ui-corner-all" id="userMenuButton">
211 <xsl:choose>
212 <xsl:when test="/page/pageRequest/userInformation/@username">
213 <a>
214 <xsl:attribute name="href">javascript:toggleUserMenu();</xsl:attribute>
215 <script type="text/javascript">
216 <xsl:text disable-output-escaping="yes">
217 function toggleUserMenu()
218 {
219 var button = $("#userMenuButton");
220 var menu;
221
222 if(button.data("userMenu"))
223 {
224 menu = button.data("userMenu");
225 if(menu.css("display") == "block")
226 {
227 menu.hide();
228 }
229 else
230 {
231 menu.show();
232 }
233 }
234 else
235 {
236 menu = $("&lt;UL&gt;")
237 .css("position", "absolute")
238 .css("display", "block")
239 .css("z-index", "100")
240 .css("list-style", "none outside none")
241 .css("margin-left", "0px")
242 .css("padding", "0px")
243 .css("font-size", "90%");
244
245 menu.attr("id", "userMenu");
246
247 button.data("userMenu", menu);
248
249 var settingsLink = $("&lt;a&gt;")
250 .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">");
251 var settingsButton = $("&lt;LI&gt;")
252 .css("padding", "3px")
253 .html("Account settings")
254 .addClass("ui-state-default");
255 settingsLink.append(settingsButton);
256
257 var url = document.URL;
258 var hasQueryString = (url.indexOf("?") != -1);
259 var hashIndex = url.indexOf("#");
260
261 var hashPart;
262 if(hashIndex != -1)
263 {
264 hashPart = url.substring(hashIndex);
265 url = url.substring(0, hashIndex);
266 }
267
268 var logoutLink = $("&lt;a&gt;")
269 .attr("href", url + (hasQueryString ? "&amp;" : "?") + "logout=" + (hashPart ? hashPart : ""));
270 var logoutButton = $("&lt;LI&gt;")
271 .css("padding", "3px")
272 .html("Logout")
273 .addClass("ui-state-default");
274 logoutLink.append(logoutButton);
275
276 menu.append(settingsLink);
277 menu.append(logoutLink);
278
279 var buttonLeft = button.offset().left;
280 var buttonTop = button.offset().top;
281 var buttonHeight = button.height();
282
283 menu.offset({top: buttonTop + buttonHeight + 4, left: buttonLeft});
284 $("#topArea").append(menu);
285 }
286 }
287 </xsl:text>
288 </script>
289 <ul>
290 <li><span><xsl:value-of select="/page/pageRequest/userInformation/@username"/></span></li>
291 <li><span class="ui-icon ui-icon-unlocked"><xsl:text> </xsl:text></span></li>
292 </ul>
293 </a>
294 </xsl:when>
295 <xsl:otherwise>
296 <a>
297 <xsl:attribute name="href">
298 <xsl:value-of select="$library_name"/>
299 <xsl:text>?a=p&amp;sa=login&amp;redirectURL=</xsl:text>
300 <xsl:value-of select="$library_name"/>
301 <xsl:text>%3F</xsl:text>
302 <xsl:if test="/page/pageRequest/@action">
303 <xsl:text>a=</xsl:text>
304 <xsl:value-of select="/page/pageRequest/@action"/>
305 </xsl:if>
306 <xsl:if test="/page/pageRequest/@subaction">
307 <xsl:text>%26sa=</xsl:text>
308 <xsl:value-of select="/page/pageRequest/@subaction"/>
309 </xsl:if>
310 <xsl:for-each select="/page/pageRequest/paramList/param">
311 <xsl:if test="@name != 'password' and @name != 's1.password' and @name != 's1.newPassword' and @name != 's1.oldPassword'">
312 <xsl:text>%26</xsl:text>
313 <xsl:value-of select="@name"/>
314 <xsl:text>=</xsl:text>
315 <xsl:value-of select="@value"/>
316 </xsl:if>
317 </xsl:for-each>
318 </xsl:attribute>
319 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/></xsl:attribute>
320 <ul>
321 <li><span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_b')"/></span></li>
322 <li><span class="ui-icon ui-icon-locked"><xsl:text> </xsl:text></span></li>
323 </ul>
324 </a>
325 </xsl:otherwise>
326 </xsl:choose>
327 </li>
328 <!-- debuginfo (doesn't use class="ui-state-error" since the text is not legible due to inherited text-colour) -->
329 <xsl:if test="/page/pageRequest/paramList/param[(@name='debug') and (@value='on' or @value='true' or @value='1')]">
330 <li class="ui-state-default ui-corner-all">
331 <a href="{$library_name}/collection/{$collNameChecked}/page/debug">
332 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_tip')"/></xsl:attribute>
333 <ul>
334 <li><span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_b')"/></span></li>
335 <li><span class="ui-icon ui-icon-info"><xsl:text> </xsl:text></span></li>
336 </ul>
337 </a>
338 </li>
339 </xsl:if>
340 </ul>
341 </xsl:template>
342
343 <!-- ***** PAGE TITLE ***** -->
344 <xsl:template name="page-title-area">
345 <xsl:variable name="pageTitleVar"><xsl:call-template name="pageTitle"/></xsl:variable>
346 <div id="titlearea">
347 <h2>
348 <!-- Resize the title based on how long it is (There's probably a better way to do this) -->
349 <xsl:attribute name="style">
350 <xsl:choose>
351 <xsl:when test="string-length($pageTitleVar) &lt; 20">
352 <xsl:text>font-size: 1.5em;</xsl:text>
353 </xsl:when>
354 <xsl:when test="string-length($pageTitleVar) &lt; 30">
355 <xsl:text>font-size: 1.4em;</xsl:text>
356 </xsl:when>
357 <xsl:when test="string-length($pageTitleVar) &lt; 40">
358 <xsl:text>font-size: 1.3em;</xsl:text>
359 </xsl:when>
360 <xsl:when test="string-length($pageTitleVar) &lt; 50">
361 <xsl:text>font-size: 1.2em;</xsl:text>
362 </xsl:when>
363 <xsl:when test="string-length($pageTitleVar) &lt; 60">
364 <xsl:text>font-size: 1.1em;</xsl:text>
365 </xsl:when>
366 <xsl:when test="string-length($pageTitleVar) &lt; 70">
367 <xsl:text>font-size: 1em;</xsl:text>
368 </xsl:when>
369 <xsl:when test="string-length($pageTitleVar) &lt; 80">
370 <xsl:text>font-size: 0.9em;</xsl:text>
371 </xsl:when>
372 <xsl:when test="string-length($pageTitleVar) &lt; 90">
373 <xsl:text>font-size: 0.8em;</xsl:text>
374 </xsl:when>
375 <xsl:otherwise>
376 <xsl:text>font-size: 0.7em;</xsl:text>
377 </xsl:otherwise>
378 </xsl:choose>
379 </xsl:attribute>
380 <!--<xsl:value-of select="string-length($pageTitleVar)" />-->
381 <xsl:value-of select="$pageTitleVar" />
382 </h2><xsl:text> </xsl:text>
383 </div>
384 </xsl:template>
385
386 <!-- ***** QUICK SEARCH AREA ***** -->
387 <!-- Search form should only appear if there's a search (query) service AND it has an index.
388 By default, all collections end up with some query service (default is MGPP) even when they have
389 no search indexes, which is why the extra test for the presence of an index/fq-something is necessary. -->
390 <xsl:template name="quick-search-area">
391 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
392 <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
393 <div id="quicksearcharea">
394 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
395 <form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
396 <!-- This parameter says that we have come from the quick search area -->
397 <input type="hidden" name="qs" value="1"/>
398 <input type="hidden" name="rt" value="rd"/>
399 <input type="hidden" name="s1.level">
400 <xsl:attribute name="value">
401 <xsl:choose>
402 <xsl:when test="/page/pageRequest/paramList/param[@name = 's1.level']">
403 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.level']/@value"/>
404 </xsl:when>
405 <xsl:otherwise>
406 <xsl:text>Sec</xsl:text>
407 </xsl:otherwise>
408 </xsl:choose>
409 </xsl:attribute>
410 </input>
411 <xsl:choose>
412 <xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
413 <input type="hidden" name="s1.startPage" value="1"/>
414 </xsl:when>
415 <xsl:otherwise>
416 <input type="hidden" name="startPage" value="1"/>
417 </xsl:otherwise>
418 </xsl:choose>
419 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 's1.hitsPerPage'])">
420 <input type="hidden" name="s1.hitsPerPage" value="20"/>
421 </xsl:if>
422 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 's1.maxDocs'])">
423 <input type="hidden" name="s1.maxDocs" value="100"/>
424 </xsl:if>
425 <!-- The query text box -->
426 <span class="querybox">
427 <xsl:variable name="qs">
428 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
429 </xsl:variable>
430 <nobr>
431 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
432 <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
433 </xsl:apply-templates>
434 </nobr>
435 </span>
436 <!-- The index selection list -->
437 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">
438 <span class="textselect">
439 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">
440 <xsl:with-param name="default">
441 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>
442 </xsl:with-param>
443 <xsl:with-param name="hideSingle">true</xsl:with-param>
444 </xsl:apply-templates>
445 </span>
446 </xsl:if>
447 <!-- The submit button (for TextQuery) -->
448 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
449 <input type="submit" id="quickSearchSubmitButton">
450 <xsl:attribute name="value">
451 <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>
452 </xsl:attribute>
453 </input>
454 <br/>
455 </xsl:if>
456 </form>
457 </xsl:if>
458 <!-- The list of other search types -->
459 <ul>
460 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
461 <li class="ui-state-default ui-corner-all">
462 <a>
463 <xsl:attribute name="href">
464 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collNameChecked"/>/search/<xsl:value-of select="@name"/>
465 </xsl:attribute>
466 <xsl:value-of select="displayItem[@name='name']"/>
467 </a>
468 </li>
469 </xsl:for-each>
470 </ul>
471 </div>
472 </xsl:if>
473 </xsl:template>
474
475 <xsl:template name="map-scripts">
476 <meta content="initial-scale=1.0, user-scalable=no" name="viewport"/>
477 <script src="http://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"><xsl:text> </xsl:text></script>
478 <script src="interfaces/{$interface_name}/js/map-scripts.js" type="text/javascript"><xsl:text> </xsl:text></script>
479 <script type="text/javascript">$(window).load(initializeMapScripts);</script>
480 </xsl:template>
481</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.