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

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

Some interface changes made by Dr Bainbridge and some by me on his request.

File size: 16.2 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">
75 <xsl:apply-templates select="/page"/>
76 <br class="clear" />
77 </div>
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">Template by <a href="http://www.os-templates.com/" title="Free Website Templates">OS Templates</a></p>-->
93 <p class="fl_right">Powered by <a href="http://www.greenstone.org/" title="Greenstone Digital Library Software">Greenstone3</a></p>
94 <br class="clear" />
95 </div>
96</div>
97</xsl:template>
98
99<xsl:template name="navBar">
100<xsl:choose>
101<xsl:when test="page/pageResponse/collection">
102<xsl:variable name="count" select="count(/page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier)"/>
103<xsl:variable name="currentPage" select="page/pageRequest/@fullURL"/>
104
105<li><a href="{$library_name}">DL Home</a></li>
106<li>
107<xsl:if test="page/pageRequest/@subaction='about'"><xsl:attribute name="class">active</xsl:attribute></xsl:if>
108<a href="{$library_name}/collection/{$collNameChecked}/page/about">About</a>
109</li>
110
111<xsl:choose>
112<xsl:when test="$count > 3">
113<li><a href="{$currentPage}">Browse</a>
114<ul>
115<xsl:call-template name="Browsing"/>
116</ul>
117</li>
118</xsl:when>
119<xsl:otherwise>
120<xsl:call-template name="Browsing"/>
121</xsl:otherwise>
122</xsl:choose>
123<!--
124<xsl:if test="/page/pageResponse/collection/serviceList/service/@type='query'">
125<li><a href="{$currentPage}">Search</a>
126<ul>
127<xsl:for-each select="/page/pageResponse/collection/serviceList/service[@type='query']">
128<xsl:variable name="search" select="@name"/>
129<xsl:variable name="search_name" select="displayItem[@name='name']"/>
130<li><a href="{$library_name}/collection/{$collNameChecked}/search/{$search}"><xsl:value-of select="$search_name"/></a></li>
131</xsl:for-each>
132</ul>
133</li>
134</xsl:if>
135-->
136</xsl:when>
137<xsl:otherwise> </xsl:otherwise>
138</xsl:choose>
139</xsl:template>
140
141<xsl:template name="Browsing">
142 <xsl:for-each select="/page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">
143 <li>
144 <xsl:choose>
145 <!-- If this tab is selected then colour it differently -->
146 <xsl:when test="util:contains(/page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value, @name)">
147 <xsl:attribute name='class'>active</xsl:attribute>
148 </xsl:when>
149 <xsl:otherwise> </xsl:otherwise>
150 </xsl:choose>
151 <a>
152 <!-- Add a title element to the <a> tag if a description exists for this classifier -->
153 <xsl:if test="displayItem[@name='description']">
154 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
155 </xsl:if>
156
157 <!-- Add the href element to the <a> tag -->
158 <xsl:choose>
159 <xsl:when test="@name">
160 <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>
161 </xsl:when>
162 <xsl:otherwise>
163 <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>
164 </xsl:otherwise>
165 </xsl:choose>
166
167 <!-- Add the actual text of the <a> tag -->
168 <xsl:value-of select="displayItem[@name='name']"/>
169 </a>
170 </li>
171 </xsl:for-each>
172</xsl:template>
173
174<xsl:template name="crossCollSearch">
175 <div id="search">
176 <xsl:for-each select="/page/pageResponse/serviceList/service[@name='TextQuery']">
177 <form name="QuickSearch" method="get" action="{$library_name}">
178 <input type="hidden" name="a" value="q"/>
179 <input type="hidden" name="rt" value="rd"/>
180 <input type="hidden" name="s" value="{@name}"/>
181 <input type="hidden" name="s1.collection" value="all"/>
182 <input type="text" name="s1.query" id="search-text" value="Search all collections
" onfocus="this.value=(this.value=='Search all collections
')? '' : this.value ;" />
183 <input type="submit" name="go" id="go" value="Search" />
184 </form>
185 </xsl:for-each>
186 </div>
187 <br class="clear" />
188</xsl:template>
189
190<xsl:template name="CollectionSearch">
191<div id="search">
192<xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
193<form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
194<!-- This parameter says that we have come from the quick search area -->
195<input type="hidden" name="qs" value="1"/>
196<input type="hidden" name="rt" value="rd"/>
197<input type="hidden" name="s1.level">
198<xsl:attribute name="value">
199<xsl:choose>
200<xsl:when test="/page/pageRequest/paramList/param[@name = 's1.level']">
201<xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.level']/@value"/>
202</xsl:when>
203<xsl:otherwise>
204<xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>
205</xsl:otherwise>
206</xsl:choose>
207</xsl:attribute>
208</input>
209<xsl:choose>
210<xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
211<input type="hidden" name="s1.startPage" value="1"/>
212</xsl:when>
213<xsl:otherwise>
214<input type="hidden" name="startPage" value="1"/>
215</xsl:otherwise>
216</xsl:choose>
217<xsl:if test="not(/page/pageRequest/paramList/param[@name = 's1.hitsPerPage'])">
218<input type="hidden" name="s1.hitsPerPage" value="20"/>
219</xsl:if>
220<xsl:if test="not(/page/pageRequest/paramList/param[@name = 's1.maxDocs'])">
221<input type="hidden" name="s1.maxDocs" value="100"/>
222</xsl:if>
223<!-- The query text box -->
224<span class="querybox">
225<xsl:variable name="qs">
226<xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
227</xsl:variable>
228<nobr>
229<xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
230<xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
231</xsl:apply-templates>
232</nobr>
233</span>
234<!-- The submit button (for TextQuery) -->
235<xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
236<input type="submit" name="go" id="go" value="Search" > </input>
237<br/>
238</xsl:if>
239</form>
240</div>
241<br class="clear" />
242<!--<div id="advanced"><a href="{$library_name}/collection/{$collNameChecked}/search/TextQuery">advanced search</a></div>-->
243</xsl:template>
244
245
246<xsl:template name="loginLinks">
247 <xsl:variable name="username" select="/page/pageRequest/userInformation/@username"/>
248 <xsl:variable name="groups" select="/page/pageRequest/userInformation/@groups"/>
249
250 <xsl:choose>
251 <xsl:when test="$username">
252 <xsl:if test="contains($groups,'admin')">
253 <li class="login"><a href="{$library_name}/admin/AddUser">Add user</a></li>
254 <li class="login"><a href="{$library_name}/admin/ListUsers">Administration</a></li>
255 </xsl:if>
256 <li class="login"><a href="{$library_name}/admin/AccountSettings?s1.username={$username}">Logged in as: <xsl:value-of select="$username"/></a></li>
257 <li class="login"><a href="{$library_name}?logout=">Logout</a></li>
258 </xsl:when>
259 <xsl:otherwise>
260 <li class="login">
261 <a href="{$library_name}?a=p&amp;sa=login&amp;redirectURL={$library_name}%3Fa=p%26sa=home">Login
262 <xsl:attribute name="title">
263 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/>
264 </xsl:attribute>
265 </a>
266 </li>
267 </xsl:otherwise>
268 </xsl:choose>
269</xsl:template>
270
271<xsl:template name="quick-search-area">
272 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
273 <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
274 <div id="quicksearcharea">
275 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
276 <xsl:choose>
277 <xsl:when test="not(page/pageRequest[@action='q']) or /page/pageRequest/paramList/param[@name='qs']/@value = '1'">
278 <form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
279 <!-- This parameter says that we have come from the quick search area -->
280
281 <input type="hidden" name="qs" value="1"/>
282 <input type="hidden" name="rt" value="rd"/>
283 <input type="hidden" name="s1.level">
284 <xsl:attribute name="value">
285 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>
286 </xsl:attribute>
287 </input>
288 <xsl:choose>
289 <xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
290 <input type="hidden" name="s1.startPage" value="1"/>
291 </xsl:when>
292 <xsl:otherwise>
293 <input type="hidden" name="startPage" value="1"/>
294 </xsl:otherwise>
295 </xsl:choose>
296
297 <!-- The query text box -->
298 <span class="querybox">
299 <xsl:variable name="qs">
300 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
301 </xsl:variable>
302 <nobr>
303 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
304 <!--
305 <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
306 -->
307 <xsl:with-param name="default" select="normalize-space($qs)"/>
308
309 </xsl:apply-templates>
310 </nobr>
311 </span>
312 <!-- The index selection list -->
313 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">
314 <span class="textselect">
315 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">
316 <xsl:with-param name="default">
317 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>
318 </xsl:with-param>
319 <xsl:with-param name="hideSingle">false</xsl:with-param>
320 <xsl:with-param name="quickSearch">true</xsl:with-param>
321 </xsl:apply-templates>
322 </span>
323 </xsl:if>
324 <!-- The partition selection list -->
325 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']/@type = 'enum_single'">
326 <span class="textselect">
327 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']">
328 <xsl:with-param name="default">
329 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']" mode="calculate-default"/>
330 </xsl:with-param>
331 <xsl:with-param name="hideSingle">true</xsl:with-param>
332 <xsl:with-param name="quickSearch">true</xsl:with-param>
333 </xsl:apply-templates>
334 </span>
335 </xsl:if>
336 <!-- The language selection list -->
337 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']/@type = 'enum_single'">
338 <span class="textselect">
339 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']">
340 <xsl:with-param name="default">
341 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']" mode="calculate-default"/>
342 </xsl:with-param>
343 <xsl:with-param name="hideSingle">true</xsl:with-param>
344 <xsl:with-param name="quickSearch">true</xsl:with-param>
345 </xsl:apply-templates>
346 </span>
347 </xsl:if>
348 <!-- The submit button (for TextQuery) -->
349 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
350 <input type="submit" id="quickSearchSubmitButton">
351 <xsl:attribute name="value">
352 <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>
353 </xsl:attribute>
354 </input>
355 <br/>
356 </xsl:if>
357 </form>
358 </xsl:when>
359 <xsl:otherwise><br/></xsl:otherwise>
360 </xsl:choose>
361 </xsl:if>
362 <!-- The list of other search types -->
363 <!--
364 <ul>
365 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
366 <xsl:if test="/page/pageRequest/paramList/param[@name='qs']/@value = 1 or not(@name = /page/pageRequest/paramList/param[@name='s']/@value)">
367 <li class="ui-state-default ui-corner-all">
368 <a>
369 <xsl:attribute name="href">
370 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collNameChecked"/>/search/<xsl:value-of select="@name"/>
371 </xsl:attribute>
372 <xsl:value-of select="displayItem[@name='name']"/>
373 </a>
374 </li>
375 </xsl:if>
376 </xsl:for-each>
377 </ul>
378 -->
379 </div>
380 </xsl:if>
381 </xsl:template>
382
383</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.