source: main/trunk/greenstone3/web/interfaces/default-client-xslt/transform/style.xsl@ 24065

Last change on this file since 24065 was 23779, checked in by davidb, 13 years ago

Two new interfaces - 'default' now tries to use the client's XSLT capabilities of the web browser, falling back to the 'traditional' interface if this fails.

  • Property svn:keywords set to Author Date Id Revision
File size: 8.9 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
5 <xsl:include href="icons.xsl"/>
6
7 <!-- some global parameters - these are set by whoever is invoking the transformation -->
8 <xsl:param name="interface_name"/>
9 <xsl:param name="library_name"/>
10
11 <!-- global style info goes here -->
12 <xsl:template name="globalStyle">
13 <link rel="stylesheet" href="interfaces/default/style/core.css" type="text/css"/>
14 </xsl:template>
15
16 <xsl:template name="response">
17 <xsl:apply-templates select="pageResponse"/>
18 <xsl:if test="descendant::error">
19 <script language="Javascript">
20 <xsl:text disable-output-escaping="yes">
21 function removeAllChildren(node) {
22 while (node.hasChildNodes()) {
23 node.removeChild(node.firstChild);
24 }
25 }
26
27 function toggleHideError(obj) {
28 if (obj.style.display == "none") {
29 obj.style.display = "";
30 hide_link = document.getElementById("hide");
31 removeAllChildren(hide_link);
32 var theText = getText('hide_error', null);
33 alert(theText);
34 var hide_text = document.createTextNode(theText);
35 hide_link.appendChild(hide_text));
36 } else {
37 obj.style.display = "none";
38 hide_link = document.getElementById("hide");
39 removeAllChildren(hide_link);
40 var theText = getText('show_error', null);
41 alert(theText);
42 var show_text = document.createTextNode(theText);
43 hide_link.appendChild(show_text);
44 }
45 }
46 </xsl:text>
47 </script>
48 <p align='right'><a id="hide" href="javascript:toggleHideError($('#error'));"><xsl:call-template name="getTextFor"><xsl:with-param name="key" select="'show_error'" /><xsl:with-param name="affect" select="''" /></xsl:call-template></a></p>
49 <div id="error" style="display: none;">
50 <xsl:apply-templates select="descendant::error"/>
51 </div>
52 </xsl:if>
53 </xsl:template>
54
55 <xsl:template name="greenstoneFooter">
56 <div id="footer">
57 <xsl:call-template name="dividerBar">
58 <xsl:with-param name="text"><xsl:text>powered-by</xsl:text></xsl:with-param>
59 </xsl:call-template>
60 <script type="text/javascript">var placeholder = false;</script>
61 <script type="text/javascript" src="jquery.js">
62 <xsl:comment>Filler for browser</xsl:comment>
63 </script>
64 <script type="text/javascript" src="test.js">
65 <xsl:comment>Filler for browser</xsl:comment>
66 </script>
67 </div>
68 </xsl:template>
69
70 <xsl:template match="error">
71 <span class="getTextFor error"></span> <xsl:value-of select="."/>
72 </xsl:template>
73
74 <xsl:template name="standardPageBanner">
75 <xsl:param name="collName"/>
76 <xsl:param name="pageType"/>
77 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
78 <div id="loading" style="display: none; position: fixed; top: 0; right: 0; padding: 10px;"><img src="interfaces/default/images/loading.gif" alt="Loading interface..." /></div>
79 <span id="language" style="display: none;"><xsl:value-of select="/page/@lang" /></span>
80 <span id="interface" style="display: none;"><xsl:value-of select="$interface_name" /></span>
81 <div id="banner">
82 <p>
83 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
84 <xsl:choose>
85 <xsl:when test="$this-element/displayItem[@name='icon']">
86 <img border="0">
87 <xsl:attribute name="src">
88 <xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItem[@name='icon']"/>
89 </xsl:attribute>
90 <xsl:attribute name="alt">
91 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
92 </xsl:attribute></img>
93 </xsl:when>
94 <xsl:otherwise>
95 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
96 </xsl:otherwise>
97 </xsl:choose>
98 </a>
99 </p>
100 <xsl:call-template name="getTextFor">
101 <xsl:with-param name="key" select="'null'" />
102 <xsl:with-param name="affect" select="'parent.title.aboutpage'" />
103 <xsl:with-param name="display" select="'none'" />
104 </xsl:call-template>
105 <ul id="bannerlist">
106 <xsl:call-template name="top-buttons">
107 <xsl:with-param name="collName" select="$collName"/>
108 <xsl:with-param name="pageType" select="$pageType"/>
109 </xsl:call-template>
110 </ul>
111 </div>
112 </xsl:template>
113
114 <xsl:template name="top-buttons">
115 <xsl:param name="collName"/>
116 <xsl:param name="pageType"/>
117 <li><a href="{$library_name}?a=p&amp;sa=home">
118 <xsl:call-template name="getTextFor">
119 <xsl:with-param name="key" select="'home_b'" />
120 <xsl:with-param name="parentTip" select="'home_tip'" />
121 </xsl:call-template>
122 </a></li>
123 <xsl:choose>
124 <xsl:when test="$pageType='help'">
125 <li><a>
126 <xsl:call-template name="getTextFor">
127 <xsl:with-param name="key" select="'help_b'" />
128 <xsl:with-param name="affect" select="'parent.title.help_tip'" />
129 </xsl:call-template>
130 </a></li>
131 </xsl:when>
132 <xsl:otherwise>
133 <li><a href="{$library_name}?a=p&amp;sa=help&amp;c={$collName}">
134 <xsl:call-template name="getTextFor">
135 <xsl:with-param name="key" select="'help_b'" />
136 <xsl:with-param name="affect" select="'parent.title.help_tip'" />
137 </xsl:call-template>
138 </a></li>
139 </xsl:otherwise>
140 </xsl:choose>
141 <xsl:choose>
142 <xsl:when test="$pageType='pref'">
143 <li><a><xsl:call-template name="getTextFor"><xsl:with-param name="key" select="'pref_b'" /><xsl:with-param name="affect" select="''" /></xsl:call-template></a></li>
144 </xsl:when>
145 <xsl:otherwise>
146 <li><a href="{$library_name}?a=p&amp;sa=pref&amp;c={$collName}">
147 <xsl:call-template name="getTextFor"><xsl:with-param name="key" select="'pref_b'" /><xsl:with-param name="affect" select="'parent.title.pref_tip'" /></xsl:call-template>
148 </a></li>
149 </xsl:otherwise>
150 </xsl:choose>
151 </xsl:template>
152
153 <xsl:template name="getTextFor">
154 <xsl:param name="key" />
155 <xsl:param name="affect" />
156 <xsl:param name="display" select="'yes'" />
157
158 <xsl:variable name="extra">
159 <xsl:choose>
160 <xsl:when test="$affect!=''">
161 <xsl:text> </xsl:text>
162 <xsl:value-of select="$affect" />
163 </xsl:when>
164 <xsl:otherwise>
165 <xsl:value-of select="' '" />
166 </xsl:otherwise>
167 </xsl:choose>
168 </xsl:variable>
169
170 <span class="getTextFor {$key}{$extra}"><xsl:if test="$display='none'"><xsl:attribute name="style"><xsl:text>display: </xsl:text><xsl:value-of select="$display" /><xsl:text>;</xsl:text></xsl:attribute></xsl:if><xsl:value-of select="$key" /></span>
171 </xsl:template>
172
173 <xsl:template name="navigationBar">
174 <xsl:param name="collName"/>
175 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
176 <xsl:variable name="this-service" select="/page/pageResponse/service/@name"/>
177 <xsl:choose>
178 <xsl:when test="$this-element/serviceList/service">
179 <div id="navbar">
180 <ul id="navbarlist">
181 <xsl:for-each select="$this-element/serviceList/service">
182 <xsl:variable name="action"><xsl:choose>
183 <xsl:when test="@hidden='true'">DO_NOT_DISPLAY</xsl:when>
184 <xsl:when test="@name=$this-service">CURRENT</xsl:when>
185 <xsl:when test="@type='query'">q</xsl:when>
186 <xsl:when test="@type='browse'">b</xsl:when>
187 <xsl:when test="@type='process'">pr</xsl:when>
188 <xsl:when test="@type='applet'">a</xsl:when>
189 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
190 </xsl:choose></xsl:variable>
191 <xsl:choose>
192 <xsl:when test="$action='CURRENT'">
193 <li><a ><xsl:value-of select="displayItem[@name='name']"/></a></li>
194 </xsl:when>
195 <xsl:when test="$action !='DO_NOT_DISPLAY'">
196 <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>
197 </xsl:when>
198 </xsl:choose>
199 </xsl:for-each>
200 </ul>
201 </div>
202 </xsl:when>
203 <xsl:otherwise>
204 <xsl:call-template name="dividerBar">
205 <xsl:with-param name="text" select="'&#160;'"/>
206 </xsl:call-template>
207 </xsl:otherwise>
208 </xsl:choose>
209 </xsl:template>
210
211
212 <xsl:template name="dividerBar">
213 <xsl:param name='text'/>
214 <xsl:choose>
215 <xsl:when test="$text">
216 <div class="divbar"><xsl:choose><xsl:when test="$text='powered-by'"><span class="getTextFor gs3power">&amp;nbsp;</span></xsl:when><xsl:when test="$text='query.results'"><span class="getTextFor query.results">&amp;nbsp;</span></xsl:when><xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise></xsl:choose></div>
217 </xsl:when>
218 <xsl:otherwise>
219 <div class="divbar"><xsl:text disable-output-escaping="yes">&#160;</xsl:text></div>
220 </xsl:otherwise>
221 </xsl:choose>
222 </xsl:template>
223
224 <xsl:template name="direction">
225 <xsl:if 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:if>
226 </xsl:template>
227
228</xsl:stylesheet>
229
230
Note: See TracBrowser for help on using the repository browser.