source: other-projects/tipple-android/i-greenstone-server-files/greenstone/webapps/greenstone3/interfaces/basic-client-xslt/transform/gslib.xsl@ 26899

Last change on this file since 26899 was 26899, checked in by davidb, 11 years ago

Tipple reborn after Chris's Summer of Code 2013

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