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

Last change on this file since 24653 was 24653, checked in by sjm84, 13 years ago

Seaweed functionality is included in Greenstone 3 by default

  • Property svn:executable set to *
File size: 11.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 extension-element-prefixes="java util"
7 exclude-result-prefixes="java util">
8
9 <xsl:include href="../query-common.xsl"/>
10 <xsl:include href="../javascript-global-setup.xsl"/>
11
12 <!-- If the c parameter is empty then use the p.c parameter for the collection name-->
13 <xsl:variable name="collNameChecked">
14 <xsl:choose>
15 <xsl:when test="$collName = '' and /page/pageRequest/paramList/param[@name='p.c']/@value">
16 <xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/>
17 </xsl:when>
18 <xsl:otherwise>
19 <xsl:value-of select="$collName"/>
20 </xsl:otherwise>
21 </xsl:choose>
22 </xsl:variable>
23
24 <!-- Creates a header for the html page -->
25 <xsl:template name="create-html-header">
26 <title><xsl:call-template name="pageTitle"/> :: <xsl:call-template name="siteName"/></title>
27 <link rel="stylesheet" href="interfaces/{$interface_name}/style/core.css" type="text/css"/>
28 <link rel="shortcut icon" href="favicon.ico"/>
29 <script type="text/javascript" src="interfaces/{$interface_name}/js/direct-edit.js"><xsl:text> </xsl:text></script>
30
31 <xsl:call-template name="init-seaweed"/>
32 <xsl:call-template name="setup-gs-variable"/>
33 </xsl:template>
34
35 <xsl:template name="init-seaweed">
36 <script type="text/javascript">
37 <xsl:text disable-output-escaping="yes">
38 de.onready(function() {
39 try {
40 de.init();
41
42 de.doc.declarePropertySets({
43 metadata: {
44 phMarkup: '[Enter metadata value]',
45 name: "metadata"
46 }
47 });
48 }
49 catch (err) {
50 alert("Seaweed failed to initialise: " + err.message);
51 }
52 });
53 </xsl:text>
54 </script>
55 </xsl:template>
56
57 <!-- ***** HEADER LAYOUT TEMPLATE ***** -->
58 <xsl:template name="create-banner">
59 <div id="breadcrumbs"><xsl:call-template name="breadcrumbs"/><xsl:text> </xsl:text></div>
60 <table id="titlesearchcontainer">
61 <tr>
62 <xsl:call-template name="page-title-area"/>
63 <xsl:call-template name="quick-search-area"/>
64 </tr>
65 </table>
66 <xsl:call-template name="home-help-preferences"/>
67 <xsl:call-template name="browsing-tabs"/>
68 </xsl:template>
69
70 <!-- ***** BROWSING TABS ***** -->
71 <xsl:template name="browsing-tabs">
72 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service">
73 <ul id="nav">
74 <!-- If this collection has a ClassifierBrowse service then add a tab for each classifier-->
75 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='browse' and @name='ClassifierBrowse']">
76 <!-- Loop through each classifier -->
77 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">
78 <xsl:element name="li">
79 <!-- If this tab is selected then colour it differently (right part) -->
80 <xsl:if test="@name = /page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value">
81 <xsl:attribute name='style'>background: transparent url('interfaces/oran/images/tab-right-selected.png') scroll no-repeat 100% -100px;</xsl:attribute>
82 </xsl:if>
83
84 <xsl:element name="a">
85 <!-- If this tab is selected then colour it differently (left part) -->
86 <xsl:if test="@name = /page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value">
87 <xsl:attribute name='style'>background: transparent url('interfaces/oran/images/tab-left-selected.png') no-repeat scroll 0 -100px;</xsl:attribute>
88 </xsl:if>
89
90 <!-- Add a title element to the <a> tag if a description exists for this classifier -->
91 <xsl:if test="displayItem[@name='description']">
92 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
93 </xsl:if>
94
95 <!-- Add the href element to the <a> tag -->
96 <xsl:choose>
97 <xsl:when test="@name">
98 <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>
99 </xsl:when>
100 <xsl:otherwise>
101 <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>
102 </xsl:otherwise>
103 </xsl:choose>
104
105 <!-- Add the actual text of the <a> tag -->
106 <xsl:value-of select="displayItem[@name='name']"/>
107 </xsl:element>
108 </xsl:element>
109 </xsl:for-each>
110 </xsl:if>
111
112 <!-- all other services -->
113 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[not(@type='query') and not(@type='browse')]">
114 <xsl:call-template name="navigationTab"/>
115 </xsl:for-each>
116 </ul>
117 </xsl:if>
118 </xsl:template>
119
120 <!-- ***** HOME HELP PREFERENCES ***** -->
121 <xsl:template name="home-help-preferences">
122 <xsl:if test="/page/pageResponse/collection">
123 <ul id="bannerLinks">
124
125 <!-- preferences -->
126 <li>
127 <a href="{$library_name}?a=p&amp;amp;sa=pref&amp;amp;c={$collNameChecked}">
128 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
129 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
130 </a>
131 </li>
132
133 <!-- help -->
134 <li>
135 <a href="{$library_name}?a=p&amp;amp;sa=help&amp;amp;c={$collNameChecked}">
136 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
137 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
138 </a>
139 </li>
140
141 <!-- home -->
142 <li>
143 <a href="{$library_name}?a=p&amp;amp;sa=home">
144 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/></xsl:attribute>
145 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
146 </a>
147 </li>
148 </ul>
149 </xsl:if>
150 </xsl:template>
151
152 <!-- ***** PAGE TITLE ***** -->
153 <xsl:template name="page-title-area">
154 <xsl:variable name="pageTitleVar"><xsl:call-template name="pageTitle"/></xsl:variable>
155 <td id="titlearea">
156 <h2>
157 <!-- Resize the title based on how long it is (There's probably a better way to do this) -->
158 <xsl:attribute name="style">
159 <xsl:choose>
160 <xsl:when test="string-length($pageTitleVar) &lt; 20">
161 <xsl:text>font-size: 1.5em; line-height: 1.5em;</xsl:text>
162 </xsl:when>
163 <xsl:when test="string-length($pageTitleVar) &lt; 30">
164 <xsl:text>font-size: 1.4em; line-height: 1.4em;</xsl:text>
165 </xsl:when>
166 <xsl:when test="string-length($pageTitleVar) &lt; 40">
167 <xsl:text>font-size: 1.3em; line-height: 1.3em;</xsl:text>
168 </xsl:when>
169 <xsl:when test="string-length($pageTitleVar) &lt; 50">
170 <xsl:text>font-size: 1.2em; line-height: 1.2em;</xsl:text>
171 </xsl:when>
172 <xsl:when test="string-length($pageTitleVar) &lt; 60">
173 <xsl:text>font-size: 1.1em; line-height: 1.2em;</xsl:text>
174 </xsl:when>
175 <xsl:when test="string-length($pageTitleVar) &lt; 70">
176 <xsl:text>font-size: 1em; line-height: 1.1em;</xsl:text>
177 </xsl:when>
178 <xsl:when test="string-length($pageTitleVar) &lt; 80">
179 <xsl:text>font-size: 0.9em; line-height: 1em;</xsl:text>
180 </xsl:when>
181 <xsl:when test="string-length($pageTitleVar) &lt; 90">
182 <xsl:text>font-size: 0.8em; line-height: 0.9em;</xsl:text>
183 </xsl:when>
184 <xsl:otherwise>
185 <xsl:text>font-size: 0.7em; line-height: 0.9em;</xsl:text>
186 </xsl:otherwise>
187 </xsl:choose>
188 </xsl:attribute>
189 <!--<xsl:value-of select="string-length($pageTitleVar)" />-->
190 <xsl:value-of select="$pageTitleVar" />
191 </h2>
192 </td>
193 </xsl:template>
194
195
196 <!-- ***** QUICK SEARCH AREA ***** -->
197 <xsl:template name="quick-search-area">
198 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
199 <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
200 <td id="quicksearcharea">
201 <form action="{$library_name}">
202 <input type="hidden" name="a" value="q"/>
203 <input type="hidden" name="sa" value="{$subaction}"/>
204 <input type="hidden" name="rt" value="rd"/>
205 <input type="hidden" name="s" value="TextQuery"/>
206 <input type="hidden" name="c" value="{$collNameChecked}"/>
207 <input type="hidden" name="startPage" value="1"/>
208 <!-- The query text box -->
209 <span class="querybox">
210 <xsl:variable name="qs">
211 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
212 </xsl:variable>
213 <nobr>
214 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
215 <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs)"/>
216 </xsl:apply-templates>
217 </nobr>
218 </span>
219 <!-- The index selection list -->
220 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">
221 <span class="textselect">
222 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">
223 <xsl:with-param name="default">
224 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>
225 </xsl:with-param>
226 </xsl:apply-templates>
227 </span>
228 </xsl:if>
229 <!-- The submit button -->
230 <input type="submit">
231 <xsl:attribute name="value">
232 <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>
233 </xsl:attribute>
234 </input>
235 <br/>
236 <!-- The list of other search types -->
237 <table>
238 <tr>
239 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
240 <td>
241 <a>
242 <xsl:attribute name="href">
243 <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"/>
244 </xsl:attribute>
245 <xsl:value-of select="displayItem[@name='name']"/>
246 </a>
247 </td>
248 </xsl:for-each>
249 </tr>
250 </table>
251 </form>
252 </td>
253 </xsl:if>
254 </xsl:template>
255</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.