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

Last change on this file since 5686 was 5686, checked in by kjdon, 21 years ago

some tidying up stuff, made the doc node images into their own templates so they should be only defined once

  • Property svn:keywords set to Author Date Id Revision
File size: 11.0 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
13 <!-- some global variables -->
14 <xsl:variable name="colour-button-text">#345437</xsl:variable>
15 <xsl:variable name="colour-navbar-link-text">#345437</xsl:variable>
16 <xsl:variable name="colour-navbar-selected-text">#c6aa69</xsl:variable>
17
18 <!-- the main page layout template is here -->
19 <xsl:template match="page">
20 <html>
21 <xsl:call-template name="pageHead"/>
22 <body xsl:use-attribute-sets="body-style">
23 <table border="0" cellspacing="0" cellpadding="0" width="100%">
24 <td valign="top" width="65"/><!-- a space for our side bar-->
25 <td>
26 <table width="100%">
27 <tr><td>
28 <xsl:apply-templates select="pageResponse"/>
29 <xsl:call-template name="greenstoneFooter"/>
30 </td></tr>
31 </table>
32 </td>
33 </table>
34 </body>
35 </html>
36 </xsl:template>
37
38 <xsl:attribute-set name="body-style">
39 <xsl:attribute name="bgcolor">#ffffff</xsl:attribute>
40 <xsl:attribute name="text">#000000</xsl:attribute>
41 <xsl:attribute name="link">#006666</xsl:attribute>
42 <xsl:attribute name="alink">#cc9900</xsl:attribute>
43 <xsl:attribute name="vlink">#666633</xsl:attribute>
44 <xsl:attribute name="background">interfaces/default/images/chalk.gif</xsl:attribute>
45 </xsl:attribute-set>
46
47 <xsl:attribute-set name="td-brownbutton">
48 <xsl:attribute name='background'>interfaces/default/images/brownbutton.gif</xsl:attribute>
49 <xsl:attribute name='height'>20</xsl:attribute>
50 <xsl:attribute name='align'>center</xsl:attribute>
51 </xsl:attribute-set>
52
53 <xsl:attribute-set name="td-brownbutton-off">
54 <xsl:attribute name='background'>interfaces/default/images/greenbar.gif</xsl:attribute>
55 <xsl:attribute name='height'>20</xsl:attribute>
56 <xsl:attribute name='align'>center</xsl:attribute>
57 </xsl:attribute-set>
58
59 <xsl:attribute-set name="td-navbar">
60 <xsl:attribute name='background'>interfaces/default/images/greenbar.gif</xsl:attribute>
61 <xsl:attribute name='height'>20</xsl:attribute>
62 <xsl:attribute name='align'>center</xsl:attribute>
63 </xsl:attribute-set>
64
65 <xsl:template name="greenstonePageBanner">
66 <center><img src="interfaces/default/images/gsdlhead.gif"><xsl:attribute name="alt"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/></xsl:attribute></img></center>
67 <xsl:call-template name="dividerBar"/>
68 </xsl:template>
69
70 <xsl:template name="greenstoneFooter">
71 <center>
72 <p/>
73 <small><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gs3power')"/></small>
74 </center>
75 </xsl:template>
76
77 <xsl:template name="standardPageBanner">
78 <xsl:param name="collName"/>
79 <xsl:param name="pageType"/>
80 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
81 <table width="100%">
82 <tr>
83 <td align="left">
84 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
85 <xsl:choose>
86 <xsl:when test="$this-element/displayItem[@name='icon']">
87 <img border="0">
88 <xsl:attribute name="src">
89 <xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItem[@name='icon']"/>
90 </xsl:attribute>
91 <xsl:attribute name="alt">
92 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
93 </xsl:attribute>
94 <xsl:attribute name="title">
95 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
96 </xsl:attribute>
97 </img>
98 </xsl:when>
99 <xsl:otherwise>
100 <b><xsl:value-of select="$this-element/displayItem[@name='name']"/></b>
101 </xsl:otherwise>
102 </xsl:choose>
103 </a>
104 </td>
105 <td align="right">
106 <table cellspacing='4'>
107 <tr>
108 <td xsl:use-attribute-sets="td-brownbutton">
109 <a style="text-decoration:none" 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>
110 <b><font color='{$colour-button-text}'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/></font></b>
111 </a>
112 </td>
113 <xsl:choose>
114 <xsl:when test="$pageType='help'">
115 <td xsl:use-attribute-sets="td-brownbutton-off">
116 <b><font color='{$colour-button-text}'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></font></b>
117 </td>
118 </xsl:when>
119 <xsl:otherwise>
120 <td xsl:use-attribute-sets="td-brownbutton">
121 <a style="text-decoration:none" 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>
122 <b><font color='{$colour-button-text}'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></font></b>
123 </a>
124 </td>
125 </xsl:otherwise>
126 </xsl:choose>
127 <xsl:choose>
128 <xsl:when test="$pageType='pref'">
129 <td xsl:use-attribute-sets="td-brownbutton-off">
130 <b><font color='{$colour-button-text}'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></font></b>
131 </td>
132 </xsl:when>
133 <xsl:otherwise>
134 <td xsl:use-attribute-sets="td-brownbutton">
135 <a style="text-decoration:none" 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>
136 <b><font color='{$colour-button-text}'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></font></b>
137 </a>
138 </td>
139 </xsl:otherwise>
140 </xsl:choose>
141 </tr>
142 </table>
143 </td>
144 </tr>
145 </table>
146 <p/>
147 </xsl:template>
148
149 <xsl:template name="navigationBar">
150 <xsl:param name="collName"/>
151 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
152 <xsl:variable name="this-service" select="/page/pageResponse/service/@name"/>
153 <table border='0' cellspacing='0' width='100%'>
154 <tr>
155 <xsl:for-each select="$this-element/serviceList/service">
156 <xsl:variable name="action"><xsl:choose>
157 <xsl:when test="@name=$this-service">CURRENT</xsl:when>
158 <xsl:when test="@type='query'">q</xsl:when>
159 <xsl:when test="@type='browse'">b</xsl:when>
160 <xsl:when test="@type='process'">pr</xsl:when>
161 <xsl:when test="@type='applet'">a</xsl:when>
162 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
163 </xsl:choose></xsl:variable>
164 <xsl:choose>
165 <xsl:when test="$action='CURRENT'">
166 <td xsl:use-attribute-sets="td-navbar"><b><nobr><font size='+1' color='{$colour-navbar-selected-text}'><xsl:value-of select="displayItem[@name='name']"/></font></nobr></b></td>
167 </xsl:when>
168 <xsl:when test="$action !='DO_NOT_DISPLAY'">
169 <td xsl:use-attribute-sets="td-navbar"><a style="text-decoration:none" 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><b><nobr><font size='+1' color='{$colour-navbar-link-text}'><xsl:value-of select="displayItem[@name='name']"/></font></nobr></b></a></td>
170 </xsl:when>
171 </xsl:choose>
172 </xsl:for-each>
173 </tr>
174 </table>
175 <br/>
176 </xsl:template>
177
178
179 <xsl:template name="dividerBar">
180 <xsl:param name='text'/>
181 <br/><table width='100%' border="0" cellpadding="0" cellspacing="0">
182 <tr><td valign='bottom' height='20' background='interfaces/default/images/greenbar.gif'><font size="+1" color="black"><b>&#160;<xsl:value-of select='$text'/></b></font></td></tr></table><br/>
183 </xsl:template>
184
185 <!-- Display the appropriate image, depending on the node type -->
186 <xsl:template match="documentNode" mode="displayNodeIcon">
187
188 <!-- Root node: book icon (open or closed) -->
189 <xsl:choose>
190 <xsl:when test="@nodeType='root'">
191 <xsl:choose>
192 <xsl:when test="documentNode">
193 <xsl:call-template name="openbookimg">
194 <xsl:with-param name="title">Close this book</xsl:with-param>
195 </xsl:call-template>
196 </xsl:when>
197 <xsl:otherwise>
198 <xsl:call-template name="closedbookimg">
199 <xsl:with-param name="title">Open this document and view contents</xsl:with-param>
200 </xsl:call-template>
201 </xsl:otherwise>
202 </xsl:choose>
203 </xsl:when>
204
205 <!-- Interior node: folder icon (open or closed) -->
206 <xsl:when test="@nodeType='interior'">
207 <xsl:choose>
208 <xsl:when test="documentNode">
209 <xsl:call-template name="openfolderimg">
210 <xsl:with-param name="title">Close this folder</xsl:with-param>
211 </xsl:call-template>
212 </xsl:when>
213 <xsl:otherwise>
214 <xsl:call-template name="closedfolderimg">
215 <xsl:with-param name="title">Open this folder and view contents</xsl:with-param>
216 </xsl:call-template>
217 </xsl:otherwise>
218 </xsl:choose>
219 </xsl:when>
220
221 <!-- Leaf node: page icon, and this is the default -->
222 <xsl:otherwise>
223 <xsl:call-template name="textpageimg">
224 <xsl:with-param name="title">View the document</xsl:with-param>
225 </xsl:call-template>
226 </xsl:otherwise>
227 </xsl:choose>
228 </xsl:template>
229
230 <xsl:template name="openbookimg">
231 <xsl:param name="alt"/>
232 <xsl:param name="title"/>
233 <img border="0" width="28" height="23"
234 src="interfaces/default/images/openbook.gif"
235 alt="{$alt}" title="{$title}"/>
236 </xsl:template>
237
238 <xsl:template name="closedbookimg">
239 <xsl:param name="alt"/>
240 <xsl:param name="title"/>
241 <img border="0" width="18" height="11"
242 src="interfaces/default/images/book.gif"
243 alt="{$alt}" title="{$title}"/>
244 </xsl:template>
245
246 <xsl:template name="openfolderimg">
247 <xsl:param name="alt"/>
248 <xsl:param name="title"/>
249 <img border="0" width="23" height="15"
250 src="interfaces/default/images/openfldr.gif"
251 alt="{$alt}" title="{$title}"/>
252 </xsl:template>
253
254 <xsl:template name="closedfolderimg">
255 <xsl:param name="alt"/>
256 <xsl:param name="title"/>
257 <img border="0" width="23" height="15"
258 src="interfaces/default/images/clsdfldr.gif"
259 alt="{$alt}" title="{$title}"/>
260 </xsl:template>
261
262 <xsl:template name="textpageimg">
263 <xsl:param name="alt"/>
264 <xsl:param name="title"/>
265 <img border="0" width="16" height="21"
266 src="interfaces/default/images/itext.gif"
267 alt="{$alt}" title="{$title}"/>
268 </xsl:template>
269
270 <xsl:template name="bookshelfimg">
271 <xsl:param name="alt"/>
272 <xsl:param name="title"/>
273 <img border="0" width="20" height="16"
274 src="interfaces/default/images/bshelf.gif"
275 alt="{$alt}" title="{$title}"/>
276 </xsl:template>
277</xsl:stylesheet>
278
279
Note: See TracBrowser for help on using the repository browser.