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

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

Removed the pageHead template declaration again, since this has npw been moved into the authen.xsl file, in the same manner that Max had moved other structural templates into the files they were used so that the structure is clear when reading those files.

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