source: main/branches/64_bit_Greenstone/greenstone3/web/interfaces/default/transform/util.xsl@ 24007

Last change on this file since 24007 was 24007, checked in by sjm84, 13 years ago

Updating this branch to match the latest Greenstone3 changes

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