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

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

Adding in the Depositor link (visible only to logged in users) to the Opotiki interface.

File size: 16.7 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 <!-- Depositor link: only for logged-in users.
253 CSS class=login to make Depositor link blue to indicate it's only available when logged in.
254 Don't put this depositorTitleAndLink inside the test for whether user 'admin' is
255 in the current list of groups, as we want the depositor link to be visible for any
256 logged in user. The collection they want to deposit a doc into will determine whether
257 that user has the right to modify that collection.
258 -->
259 <li class="login"><gslib:depositorTitleAndLink/></li>
260 <xsl:if test="contains($groups,'admin')">
261 <li class="login"><a href="{$library_name}/admin/AddUser">Add user</a></li>
262 <li class="login"><a href="{$library_name}/admin/ListUsers">Administration</a></li>
263 </xsl:if>
264 <li class="login"><a href="{$library_name}/admin/AccountSettings?s1.username={$username}">Logged in as: <xsl:value-of select="$username"/></a></li>
265 <li class="login"><a href="{$library_name}?logout=">Logout</a></li>
266 </xsl:when>
267 <xsl:otherwise>
268 <li class="login">
269 <a href="{$library_name}?a=p&amp;sa=login&amp;redirectURL={$library_name}%3Fa=p%26sa=home">Login
270 <xsl:attribute name="title">
271 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/>
272 </xsl:attribute>
273 </a>
274 </li>
275 </xsl:otherwise>
276 </xsl:choose>
277</xsl:template>
278
279<xsl:template name="quick-search-area">
280 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
281 <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
282 <div id="quicksearcharea">
283 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
284 <xsl:choose>
285 <xsl:when test="not(page/pageRequest[@action='q']) or /page/pageRequest/paramList/param[@name='qs']/@value = '1'">
286 <form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
287 <!-- This parameter says that we have come from the quick search area -->
288
289 <input type="hidden" name="qs" value="1"/>
290 <input type="hidden" name="rt" value="rd"/>
291 <input type="hidden" name="s1.level">
292 <xsl:attribute name="value">
293 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>
294 </xsl:attribute>
295 </input>
296 <xsl:choose>
297 <xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
298 <input type="hidden" name="s1.startPage" value="1"/>
299 </xsl:when>
300 <xsl:otherwise>
301 <input type="hidden" name="startPage" value="1"/>
302 </xsl:otherwise>
303 </xsl:choose>
304
305 <!-- The query text box -->
306 <span class="querybox">
307 <xsl:variable name="qs">
308 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
309 </xsl:variable>
310 <nobr>
311 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
312 <!--
313 <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
314 -->
315 <xsl:with-param name="default" select="normalize-space($qs)"/>
316
317 </xsl:apply-templates>
318 </nobr>
319 </span>
320 <!-- The index selection list -->
321 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">
322 <span class="textselect">
323 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">
324 <xsl:with-param name="default">
325 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>
326 </xsl:with-param>
327 <xsl:with-param name="hideSingle">false</xsl:with-param>
328 <xsl:with-param name="quickSearch">true</xsl:with-param>
329 </xsl:apply-templates>
330 </span>
331 </xsl:if>
332 <!-- The partition selection list -->
333 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']/@type = 'enum_single'">
334 <span class="textselect">
335 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']">
336 <xsl:with-param name="default">
337 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']" mode="calculate-default"/>
338 </xsl:with-param>
339 <xsl:with-param name="hideSingle">true</xsl:with-param>
340 <xsl:with-param name="quickSearch">true</xsl:with-param>
341 </xsl:apply-templates>
342 </span>
343 </xsl:if>
344 <!-- The language selection list -->
345 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']/@type = 'enum_single'">
346 <span class="textselect">
347 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']">
348 <xsl:with-param name="default">
349 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']" mode="calculate-default"/>
350 </xsl:with-param>
351 <xsl:with-param name="hideSingle">true</xsl:with-param>
352 <xsl:with-param name="quickSearch">true</xsl:with-param>
353 </xsl:apply-templates>
354 </span>
355 </xsl:if>
356 <!-- The submit button (for TextQuery) -->
357 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
358 <input type="submit" id="quickSearchSubmitButton">
359 <xsl:attribute name="value">
360 <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>
361 </xsl:attribute>
362 </input>
363 <br/>
364 </xsl:if>
365 </form>
366 </xsl:when>
367 <xsl:otherwise><br/></xsl:otherwise>
368 </xsl:choose>
369 </xsl:if>
370 <!-- The list of other search types -->
371 <!--
372 <ul>
373 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
374 <xsl:if test="/page/pageRequest/paramList/param[@name='qs']/@value = 1 or not(@name = /page/pageRequest/paramList/param[@name='s']/@value)">
375 <li class="ui-state-default ui-corner-all">
376 <a>
377 <xsl:attribute name="href">
378 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collNameChecked"/>/search/<xsl:value-of select="@name"/>
379 </xsl:attribute>
380 <xsl:value-of select="displayItem[@name='name']"/>
381 </a>
382 </li>
383 </xsl:if>
384 </xsl:for-each>
385 </ul>
386 -->
387 </div>
388 </xsl:if>
389 </xsl:template>
390
391</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.