source: trunk/gsdl3/web/interfaces/default/transform/style.xsl@ 13505

Last change on this file since 13505 was 13505, checked in by shaoqun, 17 years ago

replaced some div tags with ul and li tags

  • Property svn:keywords set to Author Date Id Revision
File size: 10.8 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:java="http://xml.apache.org/xslt/java"
5 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6 extension-element-prefixes="java util"
7 exclude-result-prefixes="java util">
8
9 <!-- some global parameters - these are set by whoever is invoking the transformation -->
10 <xsl:param name="interface_name"/>
11 <xsl:param name="library_name"/>
12 <!-- global style info goes here -->
13 <xsl:template name="globalStyle">
14 <link rel="stylesheet" href="interfaces/default/style/core.css" type="text/css"/>
15 </xsl:template>
16
17 <!-- the main page layout template is here -->
18 <xsl:template match="page">
19 <html>
20 <xsl:call-template name="pageHead"/>
21
22 <body>
23 <div id="globalwrapper">
24 <xsl:apply-templates select="pageResponse"/>
25 <xsl:if test="descendant::error">
26 <script language="Javascript">
27 <xsl:text disable-output-escaping="yes">
28 function removeAllChildren(node) {
29 while (node.hasChildNodes()) {
30 node.removeChild(node.firstChild);
31 }
32 }
33
34 function toggleHideError(obj) {
35 if (obj.style.display == "none") {
36 obj.style.display = "";
37 hide_link = document.getElementById("hide");
38 removeAllChildren(hide_link);
39 hide_link.appendChild(document.createTextNode("Hide Error"));
40 } else {
41 obj.style.display = "none";
42 hide_link = document.getElementById("hide");
43 removeAllChildren(hide_link);
44 hide_link.appendChild(document.createTextNode("Show Error"));
45
46 }
47 }
48 </xsl:text>
49 </script>
50 <p align='right'><a id="hide" href="javascript:toggleHideError(error);">Show Error</a></p>
51 <div id="error" style="display: none;">
52 <xsl:apply-templates select="descendant::error"/>
53 </div>
54 </xsl:if>
55 <xsl:call-template name="greenstoneFooter"/>
56 </div>
57 </body>
58 </html>
59 </xsl:template>
60
61 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
62 <xsl:template name="pageHead">
63 <head>
64 <title>
65 <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
66 </title>
67 <xsl:call-template name="globalStyle"/>
68 <xsl:call-template name="pageStyle"/>
69 </head>
70 </xsl:template>
71
72
73 <xsl:template name="greenstonePageBanner">
74 <div id="banner">
75 <p>
76 <img src="interfaces/default/images/gsdlhead.gif"><xsl:attribute name="alt"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/></xsl:attribute>
77 </img>
78 </p>
79 </div>
80 <div id="content">
81 <xsl:call-template name="dividerBar">
82 <xsl:with-param name="text" select="'select a collection'"/>
83 </xsl:call-template>
84 </div>
85 </xsl:template>
86
87 <xsl:template name="greenstoneFooter">
88 <div id="footer">
89 <xsl:call-template name="dividerBar">
90 <xsl:with-param name="text" select="util:getInterfaceText($interface_name, /page/@lang, 'gs3power')"/>
91 </xsl:call-template>
92 </div>
93 </xsl:template>
94
95 <xsl:template match="error">
96 Error: <xsl:value-of select="."/>
97 </xsl:template>
98
99 <xsl:template name="standardPageBanner">
100 <xsl:param name="collName"/>
101 <xsl:param name="pageType"/>
102 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
103 <div id="banner">
104 <p>
105 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
106 <xsl:choose>
107 <xsl:when test="$this-element/displayItem[@name='icon']">
108 <img border="0">
109 <xsl:attribute name="src">
110 <xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItem[@name='icon']"/>
111 </xsl:attribute>
112 <xsl:attribute name="alt">
113 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
114 </xsl:attribute>
115 <xsl:attribute name="title">
116 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
117 </xsl:attribute>
118 </img>
119 </xsl:when>
120 <xsl:otherwise>
121 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
122 </xsl:otherwise>
123 </xsl:choose>
124 </a>
125 </p>
126 <ul id="bannerlist">
127 <xsl:call-template name="top-buttons">
128 <xsl:with-param name="collName" select="$collName"/>
129 <xsl:with-param name="pageType" select="$pageType"/>
130 </xsl:call-template>
131 </ul>
132 </div>
133 </xsl:template>
134
135 <xsl:template name="top-buttons">
136 <xsl:param name="collName"/>
137 <xsl:param name="pageType"/>
138 <li><a href="{$library_name}?a=p&amp;sa=home"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/></xsl:attribute>
139 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
140 </a></li>
141 <xsl:choose>
142 <xsl:when test="$pageType='help'">
143 <li><a><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></a></li>
144 </xsl:when>
145 <xsl:otherwise>
146 <li><a href="{$library_name}?a=p&amp;sa=help&amp;c={$collName}"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
147 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
148 </a></li>
149 </xsl:otherwise>
150 </xsl:choose>
151 <xsl:choose>
152 <xsl:when test="$pageType='pref'">
153 <li><a><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></a></li>
154 </xsl:when>
155 <xsl:otherwise>
156 <li><a href="{$library_name}?a=p&amp;sa=pref&amp;c={$collName}"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
157 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
158 </a></li>
159 </xsl:otherwise>
160 </xsl:choose>
161 </xsl:template>
162
163 <xsl:template name="navigationBar">
164 <xsl:param name="collName"/>
165 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
166 <xsl:variable name="this-service" select="/page/pageResponse/service/@name"/>
167 <xsl:choose>
168 <xsl:when test="$this-element/serviceList/service">
169 <div id="navbar">
170 <ul id="navbarlist">
171 <xsl:for-each select="$this-element/serviceList/service">
172 <xsl:variable name="action"><xsl:choose>
173 <xsl:when test="@name=$this-service">CURRENT</xsl:when>
174 <xsl:when test="@type='query'">q</xsl:when>
175 <xsl:when test="@type='browse'">b</xsl:when>
176 <xsl:when test="@type='process'">pr</xsl:when>
177 <xsl:when test="@type='applet'">a</xsl:when>
178 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
179 </xsl:choose></xsl:variable>
180 <xsl:choose>
181 <xsl:when test="$action='CURRENT'">
182 <li><a ><xsl:value-of select="displayItem[@name='name']"/></a></li>
183 </xsl:when>
184 <xsl:when test="$action !='DO_NOT_DISPLAY'">
185 <li><a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}"><xsl:if test="displayItem[@name='description']"><xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute></xsl:if><xsl:value-of select="displayItem[@name='name']"/></a></li>
186 </xsl:when>
187 </xsl:choose>
188 </xsl:for-each>
189 </ul>
190 </div>
191 </xsl:when>
192 <xsl:otherwise>
193 <xsl:call-template name="dividerBar">
194 <xsl:with-param name="text" select="'&#160;'"/>
195 </xsl:call-template>
196 </xsl:otherwise>
197 </xsl:choose>
198 </xsl:template>
199
200
201 <xsl:template name="dividerBar">
202 <xsl:param name='text'/>
203 <xsl:choose>
204 <xsl:when test="$text">
205 <div class="divbar"><xsl:value-of select="$text"/></div>
206 </xsl:when>
207 <xsl:otherwise>
208 <div class="divbar"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></div>
209 </xsl:otherwise>
210 </xsl:choose>
211 </xsl:template>
212
213 <!-- Display the appropriate image, depending on the node type -->
214 <xsl:template match="documentNode" mode="displayNodeIcon">
215
216 <!-- Root node: book icon (open or closed) -->
217 <xsl:choose>
218 <xsl:when test="@nodeType='root'">
219 <xsl:choose>
220 <xsl:when test="documentNode">
221 <xsl:call-template name="openbookimg">
222 <xsl:with-param name="title">Close this book</xsl:with-param>
223 </xsl:call-template>
224 </xsl:when>
225 <xsl:otherwise>
226 <xsl:call-template name="closedbookimg">
227 <xsl:with-param name="title">Open this document and view contents</xsl:with-param>
228 </xsl:call-template>
229 </xsl:otherwise>
230 </xsl:choose>
231 </xsl:when>
232
233 <!-- Internal node: folder icon (open or closed) -->
234 <xsl:when test="@nodeType='internal'">
235 <xsl:choose>
236 <xsl:when test="documentNode">
237 <xsl:call-template name="openfolderimg">
238 <xsl:with-param name="title">Close this folder</xsl:with-param>
239 </xsl:call-template>
240 </xsl:when>
241 <xsl:otherwise>
242 <xsl:call-template name="closedfolderimg">
243 <xsl:with-param name="title">Open this folder and view contents</xsl:with-param>
244 </xsl:call-template>
245 </xsl:otherwise>
246 </xsl:choose>
247 </xsl:when>
248
249 <!-- Leaf node: page icon, and this is the default -->
250 <xsl:otherwise>
251 <xsl:call-template name="textpageimg">
252 <xsl:with-param name="title">View the document</xsl:with-param>
253 </xsl:call-template>
254 </xsl:otherwise>
255 </xsl:choose>
256 </xsl:template>
257
258 <xsl:template name="openbookimg">
259 <xsl:param name="alt"/>
260 <xsl:param name="title"/>
261 <img border="0" width="28" height="23"
262 src="interfaces/default/images/openbook.gif"
263 alt="{$alt}" title="{$title}"/>
264 </xsl:template>
265
266 <xsl:template name="closedbookimg">
267 <xsl:param name="alt"/>
268 <xsl:param name="title"/>
269 <img border="0" width="18" height="11"
270 src="interfaces/default/images/book.gif"
271 alt="{$alt}" title="{$title}"/>
272 </xsl:template>
273
274 <xsl:template name="openfolderimg">
275 <xsl:param name="alt"/>
276 <xsl:param name="title"/>
277 <img border="0" width="23" height="15"
278 src="interfaces/default/images/openfldr.gif"
279 alt="{$alt}" title="{$title}"/>
280 </xsl:template>
281
282 <xsl:template name="closedfolderimg">
283 <xsl:param name="alt"/>
284 <xsl:param name="title"/>
285 <img border="0" width="23" height="15"
286 src="interfaces/default/images/clsdfldr.gif"
287 alt="{$alt}" title="{$title}"/>
288 </xsl:template>
289
290 <xsl:template name="textpageimg">
291 <xsl:param name="alt"/>
292 <xsl:param name="title"/>
293 <img border="0" width="16" height="21"
294 src="interfaces/default/images/itext.gif"
295 alt="{$alt}" title="{$title}"/>
296 </xsl:template>
297
298 <xsl:template name="bookshelfimg">
299 <xsl:param name="alt"/>
300 <xsl:param name="title"/>
301 <img border="0" width="20" height="16"
302 src="interfaces/default/images/bshelf.gif"
303 alt="{$alt}" title="{$title}"/>
304 </xsl:template>
305</xsl:stylesheet>
306
307
Note: See TracBrowser for help on using the repository browser.