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

Last change on this file since 13996 was 13996, checked in by lh92, 17 years ago

Added code to display the page turning when book switch is on and the tidy_option is set

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