source: main/trunk/model-interfaces-dev/opotiki/transform/layouts/main.xsl@ 34148

Last change on this file since 34148 was 34148, checked in by ak19, 4 years ago

Fix for broken remote greenstone server, which wouldn't load collections in any site. Turns out this was because the opotiki interface based on the customization tutorials materials did not have a div with id=gs_content where the /page content would go. As a result, ServletRealmCheck, which sends off a authentication-ping request with an excerptid=gs_content got nothing back as there used to be no element with id gs_content in this interface. So no user groups were returned for a user by ServletRealmCheck. This means no collections created by a remote user were found and loaded for that user into client-GLI. One line fix, but caused one huge headache to locate the cause. Is it compulsory for the div containing the actual page content to have id=gs_content, or is another solution better? For now going this route as it's a single change, moreover in an xsl file so no recompiling required and finally there's a lot more code that works with the expected presence of a div with id gs_content, so main.xsl appears to for now be required to use id=gs_content on the div containing the actual page content.

File size: 16.8 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
5 xmlns:java="http://xml.apache.org/xslt/java"
6 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
7 xmlns:gslib="http://www.greenstone.org/skinning"
8 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
9
10 xmlns:lxslt="http://xml.apache.org/xslt"
11 xmlns:result="http://www.example.com/results"
12 xmlns:exsl="http://exslt.org/common"
13
14 extension-element-prefixes="java util result exsl"
15 exclude-result-prefixes="util java util">
16
17
18<!-- The main layout is defined here -->
19<!-- Every page in our library uses this template -->
20<xsl:template name="mainTemplate">
21<html>
22 <head>
23 <!-- ***** in header.xsl ***** -->
24 <xsl:call-template name="create-html-header"/>
25 <xsl:call-template name="basketHeadTags"/>
26 </head>
27 <body id="top">
28 <div class="wrapper col0">
29 <div id="topline">
30 <ul>
31 <xsl:call-template name="loginLinks"/>
32 <li><a href="{$library_name}/collection/{$collNameChecked}/page/pref">Preferences</a></li>
33 <li><a href="{$library_name}/collection/{$collNameChecked}/page/help">Help</a></li>
34 </ul>
35 <br class="clear" />
36 </div>
37 </div>
38 <div class="wrapper">
39 <div id="header">
40 <div class="fl_left">
41 <h1><a href="{$library_name}"><xsl:call-template name="siteName"/></a></h1>
42 <p>&#160;
43 <xsl:if test="page/pageResponse/collection">
44 <a href="{$library_name}/collection/{$collNameChecked}/page/about">
45 <xsl:value-of select="page/pageResponse/collection/displayItemList/displayItem[@name='name']"/>
46 </a>
47 </xsl:if>
48 </p>
49 </div>
50 <br class="clear"/>
51 </div>
52 </div>
53 <div class="wrapper col2">
54 <div id="topbar">
55 <div id="topnav">
56 <ul>
57 <xsl:call-template name="navBar"/>
58 </ul>
59 </div>
60 <!--**********************************************************************-->
61 <xsl:choose>
62 <xsl:when test="page/pageRequest/@subaction='home'">
63 <xsl:call-template name="crossCollSearch"/>
64 </xsl:when>
65 <xsl:when test="page/pageRequest/paramList/param/@name='c' and /page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
66 <xsl:call-template name="quick-search-area"/>
67 </xsl:when>
68 <xsl:otherwise/>
69 </xsl:choose>
70 <!--**********************************************************************-->
71 </div>
72 </div>
73 <div class="wrapper">
74 <div class="container" id="gs_content">
75 <xsl:apply-templates select="/page"/>
76 </div>
77 <br class="clear" />
78 </div>
79 <xsl:call-template name="gs_footer"/>
80 </body>
81</html>
82</xsl:template>
83
84
85<!-- Template controlling the footer. -->
86<xsl:template name="gs_footer">
87<!-- Put footer in here. -->
88<!-- ******DO NOT REMOVE THE LINK TO OS TEMPLATES: Template is free to use/modify, but this link MUST remain on all pages. Do not remove Copyright information. Replace "Your Webpage Here" (and it's link) with your own information.-->
89<div class="wrapper col8">
90 <div id="copyright">
91 <p class="fl_left">Developed in partnership between <a href="http://www.whakatohea.co.nz/">Whakatōhea Māori Trust Board</a> and the <a href="https://www.waikato.ac.nz/">University of Waikato</a></p>
92 <p class="fl_right">Powered by <a href="http://www.greenstone.org/" title="Greenstone Digital Library Software">Greenstone3</a></p>
93 <p class="fl_right">Copyright &#169; 2013 - All Rights Reserved
94 - Template by <a href="http://www.os-templates.com/" title="Free Website Templates">OS Templates</a></p>
95 <br class="clear" />
96 </div>
97</div>
98</xsl:template>
99
100<xsl:template name="navBar">
101<xsl:choose>
102<xsl:when test="page/pageResponse/collection">
103<xsl:variable name="count" select="count(/page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier)"/>
104<xsl:variable name="currentPage" select="page/pageRequest/@fullURL"/>
105
106<li><a href="{$library_name}">DL Home</a></li>
107<li>
108<xsl:if test="page/pageRequest/@subaction='about'"><xsl:attribute name="class">active</xsl:attribute></xsl:if>
109<a href="{$library_name}/collection/{$collNameChecked}/page/about">About</a>
110</li>
111
112<xsl:choose>
113<xsl:when test="$count > 3">
114<li><a href="{$currentPage}">Browse</a>
115<ul>
116<xsl:call-template name="Browsing"/>
117</ul>
118</li>
119</xsl:when>
120<xsl:otherwise>
121<xsl:call-template name="Browsing"/>
122</xsl:otherwise>
123</xsl:choose>
124<!--
125<xsl:if test="/page/pageResponse/collection/serviceList/service/@type='query'">
126<li><a href="{$currentPage}">Search</a>
127<ul>
128<xsl:for-each select="/page/pageResponse/collection/serviceList/service[@type='query']">
129<xsl:variable name="search" select="@name"/>
130<xsl:variable name="search_name" select="displayItem[@name='name']"/>
131<li><a href="{$library_name}/collection/{$collNameChecked}/search/{$search}"><xsl:value-of select="$search_name"/></a></li>
132</xsl:for-each>
133</ul>
134</li>
135</xsl:if>
136-->
137</xsl:when>
138<xsl:otherwise> </xsl:otherwise>
139</xsl:choose>
140</xsl:template>
141
142<xsl:template name="Browsing">
143 <xsl:for-each select="/page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">
144 <li>
145 <xsl:choose>
146 <!-- If this tab is selected then colour it differently -->
147 <xsl:when test="util:contains(/page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value, @name)">
148 <xsl:attribute name='class'>active</xsl:attribute>
149 </xsl:when>
150 <xsl:otherwise> </xsl:otherwise>
151 </xsl:choose>
152 <a>
153 <!-- Add a title element to the <a> tag if a description exists for this classifier -->
154 <xsl:if test="displayItem[@name='description']">
155 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
156 </xsl:if>
157
158 <!-- Add the href element to the <a> tag -->
159 <xsl:choose>
160 <xsl:when test="@name">
161 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/@name"/>/browse/<xsl:value-of select="@name"/></xsl:attribute>
162 </xsl:when>
163 <xsl:otherwise>
164 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/@name"/>/browse/1</xsl:attribute>
165 </xsl:otherwise>
166 </xsl:choose>
167
168 <!-- Add the actual text of the <a> tag -->
169 <xsl:value-of select="displayItem[@name='name']"/>
170 </a>
171 </li>
172 </xsl:for-each>
173</xsl:template>
174
175<xsl:template name="crossCollSearch">
176 <div id="search">
177 <xsl:for-each select="/page/pageResponse/serviceList/service[@name='TextQuery']">
178 <form name="QuickSearch" method="get" action="{$library_name}">
179 <input type="hidden" name="a" value="q"/>
180 <input type="hidden" name="rt" value="rd"/>
181 <input type="hidden" name="s" value="{@name}"/>
182 <input type="hidden" name="s1.collection" value="all"/>
183 <input type="text" name="s1.query" id="search-text" value="Search all collections
" onfocus="this.value=(this.value=='Search all collections
')? '' : this.value ;" />
184 <input type="submit" name="go" id="go" value="Search" />
185 </form>
186 </xsl:for-each>
187 </div>
188 <br class="clear" />
189</xsl:template>
190
191<xsl:template name="CollectionSearch">
192<div id="search">
193<xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
194<form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
195<!-- This parameter says that we have come from the quick search area -->
196<input type="hidden" name="qs" value="1"/>
197<input type="hidden" name="rt" value="rd"/>
198<input type="hidden" name="s1.level">
199<xsl:attribute name="value">
200<xsl:choose>
201<xsl:when test="/page/pageRequest/paramList/param[@name = 's1.level']">
202<xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.level']/@value"/>
203</xsl:when>
204<xsl:otherwise>
205<xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>
206</xsl:otherwise>
207</xsl:choose>
208</xsl:attribute>
209</input>
210<xsl:choose>
211<xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
212<input type="hidden" name="s1.startPage" value="1"/>
213</xsl:when>
214<xsl:otherwise>
215<input type="hidden" name="startPage" value="1"/>
216</xsl:otherwise>
217</xsl:choose>
218<xsl:if test="not(/page/pageRequest/paramList/param[@name = 's1.hitsPerPage'])">
219<input type="hidden" name="s1.hitsPerPage" value="20"/>
220</xsl:if>
221<xsl:if test="not(/page/pageRequest/paramList/param[@name = 's1.maxDocs'])">
222<input type="hidden" name="s1.maxDocs" value="100"/>
223</xsl:if>
224<!-- The query text box -->
225<span class="querybox">
226<xsl:variable name="qs">
227<xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
228</xsl:variable>
229<nobr>
230<xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
231<xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
232</xsl:apply-templates>
233</nobr>
234</span>
235<!-- The submit button (for TextQuery) -->
236<xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
237<input type="submit" name="go" id="go" value="Search" > </input>
238<br/>
239</xsl:if>
240</form>
241</div>
242<br class="clear" />
243<!--<div id="advanced"><a href="{$library_name}/collection/{$collNameChecked}/search/TextQuery">advanced search</a></div>-->
244</xsl:template>
245
246
247<xsl:template name="loginLinks">
248 <xsl:variable name="username" select="/page/pageRequest/userInformation/@username"/>
249 <xsl:variable name="groups" select="/page/pageRequest/userInformation/@groups"/>
250
251 <xsl:choose>
252 <xsl:when test="$username">
253 <!-- Depositor link: only for logged-in users.
254 CSS class=login to make Depositor link blue to indicate it's only available when logged in.
255 Don't put this depositorTitleAndLink inside the test for whether user 'admin' is
256 in the current list of groups, as we want the depositor link to be visible for any
257 logged in user. The collection they want to deposit a doc into will determine whether
258 that user has the right to modify that collection.
259 -->
260 <li class="login"><gslib:depositorTitleAndLink/></li>
261 <xsl:if test="contains($groups,'admin')">
262 <li class="login"><a href="{$library_name}/admin/AddUser">Add user</a></li>
263 <li class="login"><a href="{$library_name}/admin/ListUsers">Administration</a></li>
264 </xsl:if>
265 <li class="login"><a href="{$library_name}/admin/AccountSettings?s1.username={$username}">Logged in as: <xsl:value-of select="$username"/></a></li>
266 <li class="login"><a href="{$library_name}?logout=">Logout</a></li>
267 </xsl:when>
268 <xsl:otherwise>
269 <li class="login">
270 <a href="{$library_name}?a=p&amp;sa=login&amp;redirectURL={$library_name}%3Fa=p%26sa=home">Login
271 <xsl:attribute name="title">
272 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/>
273 </xsl:attribute>
274 </a>
275 </li>
276 </xsl:otherwise>
277 </xsl:choose>
278</xsl:template>
279
280<xsl:template name="quick-search-area">
281 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
282 <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
283 <div id="quicksearcharea">
284 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
285 <xsl:choose>
286 <xsl:when test="not(page/pageRequest[@action='q']) or /page/pageRequest/paramList/param[@name='qs']/@value = '1'">
287 <form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
288 <!-- This parameter says that we have come from the quick search area -->
289
290 <input type="hidden" name="qs" value="1"/>
291 <input type="hidden" name="rt" value="rd"/>
292 <input type="hidden" name="s1.level">
293 <xsl:attribute name="value">
294 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>
295 </xsl:attribute>
296 </input>
297 <xsl:choose>
298 <xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
299 <input type="hidden" name="s1.startPage" value="1"/>
300 </xsl:when>
301 <xsl:otherwise>
302 <input type="hidden" name="startPage" value="1"/>
303 </xsl:otherwise>
304 </xsl:choose>
305
306 <!-- The query text box -->
307 <span class="querybox">
308 <xsl:variable name="qs">
309 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
310 </xsl:variable>
311 <nobr>
312 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
313 <!--
314 <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
315 -->
316 <xsl:with-param name="default" select="normalize-space($qs)"/>
317
318 </xsl:apply-templates>
319 </nobr>
320 </span>
321 <!-- The index selection list -->
322 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">
323 <span class="textselect">
324 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">
325 <xsl:with-param name="default">
326 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>
327 </xsl:with-param>
328 <xsl:with-param name="hideSingle">false</xsl:with-param>
329 <xsl:with-param name="quickSearch">true</xsl:with-param>
330 </xsl:apply-templates>
331 </span>
332 </xsl:if>
333 <!-- The partition selection list -->
334 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']/@type = 'enum_single'">
335 <span class="textselect">
336 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']">
337 <xsl:with-param name="default">
338 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']" mode="calculate-default"/>
339 </xsl:with-param>
340 <xsl:with-param name="hideSingle">true</xsl:with-param>
341 <xsl:with-param name="quickSearch">true</xsl:with-param>
342 </xsl:apply-templates>
343 </span>
344 </xsl:if>
345 <!-- The language selection list -->
346 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']/@type = 'enum_single'">
347 <span class="textselect">
348 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']">
349 <xsl:with-param name="default">
350 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']" mode="calculate-default"/>
351 </xsl:with-param>
352 <xsl:with-param name="hideSingle">true</xsl:with-param>
353 <xsl:with-param name="quickSearch">true</xsl:with-param>
354 </xsl:apply-templates>
355 </span>
356 </xsl:if>
357 <!-- The submit button (for TextQuery) -->
358 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
359 <input type="submit" id="quickSearchSubmitButton">
360 <xsl:attribute name="value">
361 <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>
362 </xsl:attribute>
363 </input>
364 <br/>
365 </xsl:if>
366 </form>
367 </xsl:when>
368 <xsl:otherwise><br/></xsl:otherwise>
369 </xsl:choose>
370 </xsl:if>
371 <!-- The list of other search types -->
372 <!--
373 <ul>
374 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
375 <xsl:if test="/page/pageRequest/paramList/param[@name='qs']/@value = 1 or not(@name = /page/pageRequest/paramList/param[@name='s']/@value)">
376 <li class="ui-state-default ui-corner-all">
377 <a>
378 <xsl:attribute name="href">
379 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collNameChecked"/>/search/<xsl:value-of select="@name"/>
380 </xsl:attribute>
381 <xsl:value-of select="displayItem[@name='name']"/>
382 </a>
383 </li>
384 </xsl:if>
385 </xsl:for-each>
386 </ul>
387 -->
388 </div>
389 </xsl:if>
390 </xsl:template>
391
392</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.