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

Last change on this file since 25177 was 25177, checked in by sjm84, 9 years ago

Some major upgrades to the document view

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