source: greenstone3/trunk/web/interfaces/default/transform/style.xsl@ 18325

Last change on this file since 18325 was 18325, checked in by ak19, 15 years ago

Reintroduced code that was previously removed for the purposes of optimisation and better organisation, since when trying to make GS3 into a remote server, an error was displayed upon clicking on the Administration page link of the Greenstone 3 default interface when this tried to display the Authentication page.

  • Property svn:keywords set to Author Date Id Revision
File size: 11.6 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("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'hide_error')"/><xsl:text disable-output-escaping="yes">"));
60 } else {
61 obj.style.display = "none";
62 hide_link = document.getElementById("hide");
63 removeAllChildren(hide_link);
64 hide_link.appendChild(document.createTextNode("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/><xsl:text disable-output-escaping="yes">"));
65 }
66 }
67 </xsl:text>
68 </script>
69 <p align='right'><a id="hide" href="javascript:toggleHideError(error);"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/></a></p>
70 <div id="error" style="display: none;">
71 <xsl:apply-templates select="descendant::error"/>
72 </div>
73 </xsl:if>
74 </xsl:template>
75
76 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
77 <xsl:template name="pageHead">
78 <head>
79 <title>
80 <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
81 </title>
82 <xsl:call-template name="globalStyle"/>
83 <xsl:call-template name="pageStyle"/>
84 </head>
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 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, '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"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'close_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"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'open_book')"/></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"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'close_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"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'open_folder')"/></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"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'view_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.