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

Last change on this file since 34212 was 34212, checked in by ak19, 4 years ago
  1. Opotiki interface needs the index level dropdown to appear when there's more than one. 2. Also putting in the non-basic search form links and adjusting the styling for them.
File size: 18.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
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
284 <div id="quicksearcharea">
285 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
286 <xsl:choose>
287 <xsl:when test="not(page/pageRequest[@action='q']) or /page/pageRequest/paramList/param[@name='qs']/@value = '1'">
288 <form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
289 <!-- This parameter says that we have come from the quick search area -->
290
291 <input type="hidden" name="qs" value="1"/>
292 <input type="hidden" name="rt" value="rd"/>
293 <!-- don't hide indexing levels: code further down will hide it if there's only 1 indexing level.
294 and display a dropdown if the collection's configured with more than 1 index level available -->
295 <!--<input type="hidden" name="s1.level">
296 <xsl:attribute name="value">
297 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>
298 </xsl:attribute>
299 </input>
300 -->
301 <xsl:choose>
302 <xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
303 <input type="hidden" name="s1.startPage" value="1"/>
304 </xsl:when>
305 <xsl:otherwise>
306 <input type="hidden" name="startPage" value="1"/>
307 </xsl:otherwise>
308 </xsl:choose>
309
310 <!-- The query text box -->
311 <span class="querybox">
312 <xsl:variable name="qs">
313 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
314 </xsl:variable>
315 <nobr>
316 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
317 <!--
318 <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
319 -->
320 <xsl:with-param name="default" select="normalize-space($qs)"/>
321
322 </xsl:apply-templates>
323 </nobr>
324 </span>
325 <!-- The index selection list -->
326 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">
327 <span class="textselect">
328 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">
329 <xsl:with-param name="default">
330 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>
331 </xsl:with-param>
332 <xsl:with-param name="hideSingle">false</xsl:with-param>
333 <xsl:with-param name="quickSearch">true</xsl:with-param>
334 </xsl:apply-templates>
335 </span>
336 </xsl:if>
337 <!-- The partition selection list -->
338 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']/@type = 'enum_single'">
339 <span class="textselect">
340 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']">
341 <xsl:with-param name="default">
342 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']" mode="calculate-default"/>
343 </xsl:with-param>
344 <xsl:with-param name="hideSingle">true</xsl:with-param>
345 <xsl:with-param name="quickSearch">true</xsl:with-param>
346 </xsl:apply-templates>
347 </span>
348 </xsl:if>
349
350 <!-- The index level selection list. hideSingle=true to hide the dropdown if there's only 1 level (the default). -->
351 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='level']/@type = 'enum_single'">
352 <span class="textselect">
353 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='level']">
354 <xsl:with-param name="default">
355 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='level']" mode="calculate-default"/>
356 </xsl:with-param>
357 <xsl:with-param name="hideSingle">true</xsl:with-param>
358 <xsl:with-param name="quickSearch">true</xsl:with-param>
359 </xsl:apply-templates>
360 </span>
361 </xsl:if>
362
363 <!-- The language selection list -->
364 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']/@type = 'enum_single'">
365 <span class="textselect">
366 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']">
367 <xsl:with-param name="default">
368 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']" mode="calculate-default"/>
369 </xsl:with-param>
370 <xsl:with-param name="hideSingle">true</xsl:with-param>
371 <xsl:with-param name="quickSearch">true</xsl:with-param>
372 </xsl:apply-templates>
373 </span>
374 </xsl:if>
375 <!-- The submit button (for TextQuery) -->
376 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
377 <input type="submit" id="quickSearchSubmitButton">
378 <xsl:attribute name="value">
379 <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>
380 </xsl:attribute>
381 </input>
382 <br/>
383 </xsl:if>
384 </form>
385 </xsl:when>
386 <xsl:otherwise><br/></xsl:otherwise>
387 </xsl:choose>
388 </xsl:if>
389
390 </div>
391 <!--<br class="clear" />-->
392 <!--<span id="advanced">-->
393
394 <!-- The list of other search types -->
395 <div class="query-form-links">
396 <ul>
397 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
398 <xsl:if test="/page/pageRequest/paramList/param[@name='qs']/@value = 1 or not(@name = /page/pageRequest/paramList/param[@name='s']/@value)">
399 <li class="ui-state-default ui-corner-all">
400 <a class="query-form-links">
401 <xsl:attribute name="href">
402 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collNameChecked"/>/search/<xsl:value-of select="@name"/>
403 </xsl:attribute>
404 <xsl:value-of select="displayItem[@name='name']"/>
405 </a>
406 </li>
407 </xsl:if>
408 </xsl:for-each>
409 </ul>
410 </div>
411 </xsl:if>
412 <!--<br class="clear" />
413 <div id="advanced"><a href="{$library_name}/collection/{$collNameChecked}/search/TextQuery">form search</a></div>
414 <div id="advanced"><a href="{$library_name}/collection/{$collNameChecked}/search/AdvancedFieldQuery">advanced search</a></div>
415 -->
416 </xsl:template>
417
418</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.