source: main/trunk/greenstone3/web/interfaces/oran/transform/layouts/header.xsl@ 25123

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

The first wave of changes supporting the new login method

  • Property svn:executable set to *
File size: 15.7 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 <title><xsl:call-template name="pageTitle"/> :: <xsl:call-template name="siteName"/></title>
28
29 <xsl:choose>
30 <xsl:when test="/page/pageResponse/interfaceOptions/option[@name = 'cssTheme']/@value">
31 <link rel="stylesheet" href="{/page/pageResponse/interfaceOptions/option[@name = 'cssTheme']/@value}" type="text/css"/>
32 </xsl:when>
33 <xsl:otherwise>
34 <link rel="stylesheet" href="interfaces/{$interface_name}/style/themes/main/jquery-ui-1.8.16.custom.css" type="text/css"/>
35 </xsl:otherwise>
36 </xsl:choose>
37 <link rel="stylesheet" href="interfaces/{$interface_name}/style/core.css" type="text/css"/>
38 <link rel="shortcut icon" href="favicon.ico"/>
39
40 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"><xsl:text> </xsl:text></script>
41 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"><xsl:text> </xsl:text></script>
42 <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery.themeswitcher.min.js"><xsl:text> </xsl:text></script>
43
44 <script type="text/javascript" src="interfaces/{$interface_name}/js/direct-edit.js"><xsl:text> </xsl:text></script>
45
46 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
47 <xsl:call-template name="map-scripts"/>
48 </xsl:if>
49 <xsl:call-template name="init-seaweed"/>
50 <xsl:call-template name="setup-gs-variable"/>
51 <xsl:call-template name="additionalHeaderContent"/>
52 </xsl:template>
53
54 <xsl:template name="additionalHeaderContent">
55 <!-- This template should be overridden in the collectionConfig.xml file if you want to add extra header content -->
56 </xsl:template>
57
58 <xsl:template name="init-seaweed">
59 <script type="text/javascript">
60 <xsl:text disable-output-escaping="yes">
61 de.onready(function() {
62 try {
63 de.init();
64 }
65 catch (err) {
66 alert("Seaweed failed to initialise: " + err.message);
67 }
68 });
69 </xsl:text>
70 </script>
71 </xsl:template>
72
73 <!-- ***** HEADER LAYOUT TEMPLATE ***** -->
74 <xsl:template name="create-banner">
75 <div id="gs_banner" class="ui-widget-header ui-corner-bottom">
76 <table id="titlesearchcontainer">
77 <tr>
78 <xsl:call-template name="page-title-area"/>
79 <xsl:call-template name="quick-search-area"/>
80 </tr>
81 </table>
82 <xsl:call-template name="browsing-tabs"/>
83 </div>
84 </xsl:template>
85
86 <!-- ***** BROWSING TABS ***** -->
87 <xsl:template name="browsing-tabs">
88 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service">
89 <ul id="nav">
90 <!-- If this collection has a ClassifierBrowse service then add a tab for each classifier-->
91 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='browse' and @name='ClassifierBrowse']">
92 <!-- Loop through each classifier -->
93 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">
94 <li>
95 <xsl:choose>
96 <!-- If this tab is selected then colour it differently -->
97 <xsl:when test="@name = /page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value">
98 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>
99 </xsl:when>
100 <xsl:otherwise>
101 <xsl:attribute name='class'>ui-state-default ui-corner-top</xsl:attribute>
102 </xsl:otherwise>
103 </xsl:choose>
104
105 <a>
106 <!-- Add a title element to the <a> tag if a description exists for this classifier -->
107 <xsl:if test="displayItem[@name='description']">
108 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
109 </xsl:if>
110
111 <!-- Add the href element to the <a> tag -->
112 <xsl:choose>
113 <xsl:when test="@name">
114 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=b&amp;rt=s&amp;s=ClassifierBrowse&amp;c=<xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/@name"/>&amp;cl=<xsl:value-of select="@name"/></xsl:attribute>
115 </xsl:when>
116 <xsl:otherwise>
117 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=b&amp;rt=d&amp;s=ClassifierBrowse&amp;c=<xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/@name"/></xsl:attribute>
118 </xsl:otherwise>
119 </xsl:choose>
120
121 <!-- Add the actual text of the <a> tag -->
122 <xsl:value-of select="displayItem[@name='name']"/>
123 </a>
124 </li>
125 </xsl:for-each>
126 </xsl:if>
127
128 <!-- all other services -->
129 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[not(@type='query') and not(@type='browse')]">
130 <xsl:call-template name="navigationTab"/>
131 </xsl:for-each>
132 </ul>
133 </xsl:if>
134 </xsl:template>
135
136 <!-- ***** HOME HELP PREFERENCES LOGIN ***** -->
137 <xsl:template name="home-help-preferences">
138 <xsl:if test="/page/pageResponse/collection">
139 <ul id="bannerLinks">
140 <!-- preferences -->
141 <li class="ui-state-default ui-corner-all">
142 <a href="{$library_name}?a=p&amp;amp;sa=pref&amp;amp;c={$collNameChecked}">
143 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
144 <ul>
145 <li><span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></span></li>
146 <li><span class="ui-icon ui-icon-wrench"><xsl:text> </xsl:text></span></li>
147 </ul>
148 </a>
149 </li>
150
151 <!-- help -->
152 <li class="ui-state-default ui-corner-all">
153 <a href="{$library_name}?a=p&amp;amp;sa=help&amp;amp;c={$collNameChecked}">
154 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
155 <ul>
156 <li><span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></span></li>
157 <li><span class="ui-icon ui-icon-help"><xsl:text> </xsl:text></span></li>
158 </ul>
159 </a>
160 </li>
161
162 <!-- home -->
163 <!--
164 <li class="ui-state-default ui-corner-all">
165 <a href="{$library_name}?a=p&amp;amp;sa=home">
166 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/></xsl:attribute>
167 <ul>
168 <li><span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/></span></li>
169 <li><span class="ui-icon ui-icon-home"><xsl:text> </xsl:text></span></li>
170 </ul>
171 </a>
172 </li>
173 -->
174
175 <!-- login/logout -->
176 <li class="ui-state-default ui-corner-all">
177 <xsl:choose>
178 <xsl:when test="/page/pageRequest/userInformation/@username">
179 <a>
180 <xsl:attribute name="href">
181 <xsl:value-of select="$library_name"/>
182 <xsl:text>?logout=</xsl:text>
183 <xsl:if test="/page/pageRequest/@action">
184 <xsl:text>&amp;a=</xsl:text>
185 <xsl:value-of select="/page/pageRequest/@action"/>
186 </xsl:if>
187 <xsl:if test="/page/pageRequest/@subaction">
188 <xsl:text>&amp;sa=</xsl:text>
189 <xsl:value-of select="/page/pageRequest/@subaction"/>
190 </xsl:if>
191 <xsl:for-each select="/page/pageRequest/paramList/param">
192 <xsl:if test="not(@name = 'username' or @name = 'password')">
193 <xsl:text>&amp;</xsl:text>
194 <xsl:value-of select="@name"/>
195 <xsl:text>=</xsl:text>
196 <xsl:value-of select="@value"/>
197 </xsl:if>
198 </xsl:for-each>
199 </xsl:attribute>
200 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'logout_tip')"/></xsl:attribute>
201 <ul>
202 <li><span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'logout_b')"/><xsl:text> </xsl:text><xsl:value-of select="/page/pageRequest/userInformation/@username"/></span></li>
203 <li><span class="ui-icon ui-icon-unlocked"><xsl:text> </xsl:text></span></li>
204 </ul>
205 </a>
206 </xsl:when>
207 <xsl:otherwise>
208 <a>
209 <xsl:attribute name="href">
210 <xsl:value-of select="$library_name"/>
211 <xsl:text>?a=p&amp;sa=login&amp;redirectURL=</xsl:text>
212 <xsl:value-of select="$library_name"/>
213 <xsl:text>%3F</xsl:text>
214 <xsl:if test="/page/pageRequest/@action">
215 <xsl:text>a=</xsl:text>
216 <xsl:value-of select="/page/pageRequest/@action"/>
217 </xsl:if>
218 <xsl:if test="/page/pageRequest/@subaction">
219 <xsl:text>%26sa=</xsl:text>
220 <xsl:value-of select="/page/pageRequest/@subaction"/>
221 </xsl:if>
222 <xsl:for-each select="/page/pageRequest/paramList/param">
223 <xsl:text>%26</xsl:text>
224 <xsl:value-of select="@name"/>
225 <xsl:text>=</xsl:text>
226 <xsl:value-of select="@value"/>
227 </xsl:for-each>
228 </xsl:attribute>
229 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/></xsl:attribute>
230 <ul>
231 <li><span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_b')"/></span></li>
232 <li><span class="ui-icon ui-icon-locked"><xsl:text> </xsl:text></span></li>
233 </ul>
234 </a>
235 </xsl:otherwise>
236 </xsl:choose>
237 </li>
238 </ul>
239 </xsl:if>
240 </xsl:template>
241
242 <!-- ***** PAGE TITLE ***** -->
243 <xsl:template name="page-title-area">
244 <xsl:variable name="pageTitleVar"><xsl:call-template name="pageTitle"/></xsl:variable>
245 <td id="titlearea">
246 <h2>
247 <!-- Resize the title based on how long it is (There's probably a better way to do this) -->
248 <xsl:attribute name="style">
249 <xsl:choose>
250 <xsl:when test="string-length($pageTitleVar) &lt; 20">
251 <xsl:text>font-size: 1.5em;</xsl:text>
252 </xsl:when>
253 <xsl:when test="string-length($pageTitleVar) &lt; 30">
254 <xsl:text>font-size: 1.4em;</xsl:text>
255 </xsl:when>
256 <xsl:when test="string-length($pageTitleVar) &lt; 40">
257 <xsl:text>font-size: 1.3em;</xsl:text>
258 </xsl:when>
259 <xsl:when test="string-length($pageTitleVar) &lt; 50">
260 <xsl:text>font-size: 1.2em;</xsl:text>
261 </xsl:when>
262 <xsl:when test="string-length($pageTitleVar) &lt; 60">
263 <xsl:text>font-size: 1.1em;</xsl:text>
264 </xsl:when>
265 <xsl:when test="string-length($pageTitleVar) &lt; 70">
266 <xsl:text>font-size: 1em;</xsl:text>
267 </xsl:when>
268 <xsl:when test="string-length($pageTitleVar) &lt; 80">
269 <xsl:text>font-size: 0.9em;</xsl:text>
270 </xsl:when>
271 <xsl:when test="string-length($pageTitleVar) &lt; 90">
272 <xsl:text>font-size: 0.8em;</xsl:text>
273 </xsl:when>
274 <xsl:otherwise>
275 <xsl:text>font-size: 0.7em;</xsl:text>
276 </xsl:otherwise>
277 </xsl:choose>
278 </xsl:attribute>
279 <!--<xsl:value-of select="string-length($pageTitleVar)" />-->
280 <xsl:value-of select="$pageTitleVar" />
281 </h2>
282 </td>
283 </xsl:template>
284
285
286 <!-- ***** QUICK SEARCH AREA ***** -->
287 <xsl:template name="quick-search-area">
288 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
289 <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
290 <td id="quicksearcharea">
291 <form action="{$library_name}">
292 <input type="hidden" name="a" value="q"/>
293 <input type="hidden" name="sa" value="{$subaction}"/>
294 <input type="hidden" name="rt" value="rd"/>
295 <input type="hidden" name="s" value="TextQuery"/>
296 <input type="hidden" name="c" value="{$collNameChecked}"/>
297 <input type="hidden" name="startPage" value="1"/>
298 <!-- The query text box -->
299 <span class="querybox">
300 <xsl:variable name="qs">
301 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
302 </xsl:variable>
303 <nobr>
304 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
305 <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs)"/>
306 </xsl:apply-templates>
307 </nobr>
308 </span>
309 <!-- The index selection list -->
310 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">
311 <span class="textselect">
312 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">
313 <xsl:with-param name="default">
314 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>
315 </xsl:with-param>
316 </xsl:apply-templates>
317 </span>
318 </xsl:if>
319 <!-- The submit button -->
320 <input type="submit" id="quickSearchSubmitButton">
321 <xsl:attribute name="value">
322 <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>
323 </xsl:attribute>
324 </input>
325 <br/>
326 <!-- The list of other search types -->
327 <ul>
328 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
329 <li class="ui-state-default ui-corner-all">
330 <a>
331 <xsl:attribute name="href">
332 <xsl:value-of select="$library_name"/>?a=q&amp;rt=d&amp;c=<xsl:value-of select="$collNameChecked"/>&amp;s=<xsl:value-of select="@name"/>
333 </xsl:attribute>
334 <xsl:value-of select="displayItem[@name='name']"/>
335 </a>
336 </li>
337 </xsl:for-each>
338 </ul>
339 </form>
340 </td>
341 </xsl:if>
342 </xsl:template>
343
344 <xsl:template name="map-scripts">
345 <meta content="initial-scale=1.0, user-scalable=no" name="viewport"/>
346 <script src="http://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"><xsl:text> </xsl:text></script>
347 <script src="interfaces/{$interface_name}/js/map-scripts.js" type="text/javascript"><xsl:text> </xsl:text></script>
348 <script type="text/javascript">$(window).load(initializeMapScripts);</script>
349 </xsl:template>
350</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.