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

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

Some major changes to the header to make it work with the new visual style

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