source: main/trunk/greenstone3/web/interfaces/basic/transform/gslib.xsl@ 38056

Last change on this file since 38056 was 38056, checked in by kjdon, 8 months ago

made this interface work again with current greenstone. didn't do any prettying, just wanted to make it functional

File size: 13.0 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:gslib="http://www.greenstone.org/skinning"
5 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
6 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
7 exclude-result-prefixes="util xalan gslib xslt gsf gs3">
8
9 <xsl:output
10 method="html"
11 doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
12 doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
13
14 <!-- some global parameters - these are set by whoever is invoking the transformation -->
15 <xsl:param name="interface_name"/>
16 <xsl:param name="library_name"/>
17 <xsl:param name="servlet_url_prefix"/>
18
19 <xsl:include href="xml-to-string.xsl"/>
20
21 <!-- every pages ................................................. -->
22
23 <xsl:variable name="a"><xsl:value-of select="/page/pageRequest/paramList/param[@name='a']/@value"/></xsl:variable>
24 <xsl:variable name="collections" select="/page/pageResponse/collectionList/collection"/>
25
26
27 <xsl:template name="textDirectionAttribute">
28 <xsl:attribute name="dir">
29 <xsl:choose>
30 <xsl:when test="/page/@lang='ar' or /page/@lang='fa' or /page/@lang='he' or /page/@lang='ur' or /page/@lang='ps' or /page/@lang='prs'">rtl</xsl:when>
31 <xsl:otherwise>ltr</xsl:otherwise>
32 </xsl:choose>
33 </xsl:attribute>
34 </xsl:template>
35
36
37 <xsl:template name="defaultDividerBar">
38 <xsl:param name='text'/>
39 <xsl:choose>
40 <xsl:when test="$text">
41 <div class="divbar"><xsl:value-of select="$text"/></div>
42 </xsl:when>
43 <xsl:otherwise>
44 <div class="divbar"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></div>
45 </xsl:otherwise>
46 </xsl:choose>
47 </xsl:template>
48
49
50 <xsl:template match="error">
51 Error: <xsl:value-of select="."/>
52 </xsl:template>
53
54
55 <xsl:template name="displayErrorsIfAny">
56 <xsl:if test="descendant::error">
57 <script language="Javascript">
58 <xsl:text disable-output-escaping="yes">
59 function removeAllChildren(node) {
60 while (node.hasChildNodes()) {
61 node.removeChild(node.firstChild);
62 }
63 }
64
65 function toggleHideError(obj) {
66 if (obj.style.display == "none") {
67 obj.style.display = "";
68 hide_link = document.getElementById("hide");
69 removeAllChildren(hide_link);
70 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">"));
71 } else {
72 obj.style.display = "none";
73 hide_link = document.getElementById("hide");
74 removeAllChildren(hide_link);
75 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">"));
76 }
77 }
78 </xsl:text>
79 </script>
80 <p align='right'><a id="hide" href="javascript:toggleHideError(error);"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/></a></p>
81 <div id="error" style="display: none;">
82 <xsl:apply-templates select="descendant::error"/>
83 </div>
84 </xsl:if>
85 </xsl:template>
86
87
88 <xsl:template name="noTextBar">
89 <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
90 </xsl:template>
91
92
93 <xsl:template name="poweredByGS3TextBar">
94 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gs3power')"/>
95 </xsl:template>
96
97
98 <!-- site home ...................................................... -->
99
100 <xsl:template name="siteHomePageTitle">
101 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
102 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/><xsl:text> </xsl:text>
103 </xsl:template>
104
105
106 <xsl:template name="selectACollectionTextBar">
107 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.select_a_collection')"/>
108 </xsl:template>
109
110
111 <xsl:template name="crossCollectionQuickSearchForm">
112 <xsl:apply-templates select="serviceList/service[@name='TextQuery']" mode="quicksearch"/>
113 </xsl:template>
114
115 <xsl:template match="service[@name='TextQuery']" mode="quicksearch">
116 <form name="QuickSearch" method="get" action="{$library_name}">
117 <input type="hidden" name="a" value="q"/>
118 <input type="hidden" name="rt" value="rd"/>
119 <input type="hidden" name="s" value="{@name}"/>
120 <input type="hidden" name="s1.collection" value="all"/>
121 <input type="text" name="s1.query" size="20"/>
122 <input type="submit"><xsl:attribute name="value"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.quick_search')"/></xsl:attribute></input>
123 </form>
124 </xsl:template>
125
126 <xsl:template name="collectionLinkWithImage">
127 <xsl:choose>
128 <xsl:when test="displayItemList/displayItem[@name='icon']">
129 <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}">
130 <img>
131 <xsl:attribute name="src">
132 <xsl:value-of select="metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="displayItemList/displayItem[@name='icon']"/>
133 </xsl:attribute>
134 <xsl:attribute name="alt">
135 <xsl:value-of select="displayItemList/displayItem[@name='name']"/>
136 </xsl:attribute>
137 </img>
138 </a>
139 </xsl:when>
140 <xsl:otherwise>
141 <a class="noimage" href="{$library_name}?a=p&amp;sa=about&amp;c={@name}">
142 <xsl:value-of select="displayItemList/displayItem[@name='name']"/>
143 </a>
144 </xsl:otherwise>
145 </xsl:choose>
146 </xsl:template>
147
148 <xsl:template name="collectionMeta">
149 <xsl:param name="name"/>
150 <xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name=$name]"/>
151 </xsl:template>
152
153 <xsl:template name="serviceClusterList">
154 <xsl:apply-templates select="serviceClusterList"/>
155 </xsl:template>
156
157 <xsl:template match="serviceClusterList">
158 <xsl:for-each select="serviceCluster">
159 <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}"><xsl:value-of select='@name'/><xsl:value-of select="displayItemList/displayItem[@name='name']"/></a>
160 </xsl:for-each>
161 </xsl:template>
162
163
164 <xsl:template name="serviceLink">
165 <a href="{$library_name}?a=q&amp;rt=d&amp;s={@name}"><xsl:value-of select="displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/>
166 </xsl:template>
167
168
169 <xsl:template name="authenticationLink">
170 <a href="{$library_name}?a=g&amp;rt=r&amp;sa=authen&amp;s={@name}&amp;s1.aup=Login&amp;s1.un=&amp;s1.asn="><xsl:value-of select="displayItemList/displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/>
171 </xsl:template>
172
173
174 <xsl:template name="libraryInterfaceLink">
175 <li><a href="{$library_name}?a=p&amp;sa=gli4gs3"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.librarian_interface')"/></a></li>
176 </xsl:template>
177
178
179 <xsl:template name="greenstoneLogoAlternateText">
180 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
181 </xsl:template>
182
183 <!-- about page - collection home ......................... -->
184 <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
185 <xsl:param name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
186 <xsl:param name="pageType"/>
187 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
188 <xsl:variable name="this-service" select="/page/pageResponse/service/@name"/>
189
190
191 <xsl:template name="aboutCollectionPageTitle">
192 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
193 <xsl:value-of select="/page/pageResponse/*/displayItem[@name='name']"/><xsl:text> </xsl:text>
194 </xsl:template>
195
196
197 <xsl:template name="collectionHomeLinkWithLogoIfAvailable">
198 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
199 <xsl:choose>
200 <xsl:when test="$this-element/displayItemList/displayItem[@name='icon']">
201 <img border="0">
202 <xsl:attribute name="src">
203 <xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItemList/displayItem[@name='icon']"/>
204 </xsl:attribute>
205 <xsl:attribute name="alt">
206 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
207 </xsl:attribute>
208 <xsl:attribute name="title">
209 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
210 </xsl:attribute>
211 </img>
212 </xsl:when>
213 <xsl:otherwise>
214 <xsl:value-of select="$this-element/displayItemList/displayItem[@name='name']"/>
215 </xsl:otherwise>
216 </xsl:choose>
217 </a>
218 </xsl:template>
219
220
221 <xsl:template name="homeButtonTop">
222 <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>
223 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/></a>
224 </xsl:template>
225
226
227 <xsl:template name="helpButtonTop">
228 <xsl:choose>
229 <xsl:when test="$pageType='help'">
230 <li><a><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></a></li>
231 </xsl:when>
232 <xsl:otherwise>
233 <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>
234 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
235 </a></li>
236 </xsl:otherwise>
237 </xsl:choose>
238 </xsl:template>
239
240
241 <xsl:template name="preferencesButtonTop">
242 <xsl:choose>
243 <xsl:when test="$pageType='pref'">
244 <li><a><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></a></li>
245 </xsl:when>
246 <xsl:otherwise>
247 <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>
248 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
249 </a></li>
250 </xsl:otherwise>
251 </xsl:choose>
252 </xsl:template>
253
254 <xsl:template name="servicesNavigationBar">
255 <xsl:for-each select="$this-element/serviceList/service">
256 <xsl:variable name="action"><xsl:choose>
257 <xsl:when test="@hidden='true'">DO_NOT_DISPLAY</xsl:when>
258 <xsl:when test="@name=$this-service">CURRENT</xsl:when>
259 <xsl:when test="@type='query'">q</xsl:when>
260 <xsl:when test="@type='browse'">b</xsl:when>
261 <xsl:when test="@type='process'">pr</xsl:when>
262 <xsl:when test="@type='applet'">a</xsl:when>
263 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
264 </xsl:choose></xsl:variable>
265 <xsl:choose>
266 <xsl:when test="$action='CURRENT'">
267 <li><a><xsl:value-of select="displayItem[@name='name']"/></a></li>
268 </xsl:when>
269 <xsl:when test="$action !='DO_NOT_DISPLAY'">
270 <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>
271 </xsl:when>
272 </xsl:choose>
273 </xsl:for-each>
274 </xsl:template>
275
276
277 <xsl:template name="collectionDescriptionTextAndServicesLinks">
278 <xsl:apply-templates select="pageResponse/collection|serviceCluster"/>
279 </xsl:template>
280
281 <xsl:template match="collection|serviceCluster">
282 <xsl:value-of select="displayItem[@name='description']" disable-output-escaping="yes"/>
283
284 <xsl:apply-templates select="serviceList">
285 <xsl:with-param name="collName" select="$collName"/>
286 </xsl:apply-templates>
287 </xsl:template>
288
289
290 <xsl:template match="serviceList">
291 <xsl:param name="collName"/>
292 <h3><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.services')"/></h3>
293 <xsl:choose>
294 <xsl:when test="service">
295 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.servicehelp')"/>
296 </xsl:when>
297 <xsl:otherwise>
298 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.noservices')"/>
299 </xsl:otherwise>
300 </xsl:choose>
301
302
303 <xsl:if test="service">
304 <ul id="servicelist">
305 <xsl:for-each select="service">
306 <xsl:variable name="action"><xsl:choose>
307 <xsl:when test="@hidden='true'">DO_NOT_DISPLAY</xsl:when>
308 <xsl:when test="@type='query'">q</xsl:when>
309 <xsl:when test="@type='browse'">b</xsl:when>
310 <xsl:when test="@type='process'">pr</xsl:when>
311 <xsl:when test="@type='applet'">a</xsl:when>
312 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
313 </xsl:choose></xsl:variable>
314 <xsl:if test="$action !='DO_NOT_DISPLAY'">
315 <li><a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}"><xsl:value-of select="displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/></li>
316 </xsl:if>
317 </xsl:for-each>
318 </ul>
319 </xsl:if>
320 </xsl:template>
321
322</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.