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

Last change on this file since 18305 was 18305, checked in by kjdon, 15 years ago

moved greenstonePageBanner template from style.xsl to home.xsl as its only used there. Also moved hard coded text into property file

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