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

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

Added the ability to edit the document directly on the page

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