source: main/trunk/model-interfaces-dev/wmtb/transform/layouts/main.xsl@ 34273

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

WMTB interface based on whakatohea.co.nz's styling. Had to reverse engineer from viewing their Hapu & Marae page, as weebly's exported theme zip file had nothing relevant. Renaming this interface to wmtb for commit purposes, since Dr Bainbridge has already committed a model interface named whakatohea to model-interfaces-dev. I have left out the 8 images downloaded from the whakatohea site (sample placeholders for groups and the Digital Library main page, as well as the Whakatohea label in the navbar) since I didn't ask for permission to commit these to SVN.

File size: 18.6 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 <xsl:import href="footer.xsl"/>
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" class="banner-overlay-on">
28 <div class="wrapper">
29
30 <xsl:call-template name="whakatohea-navbar"/>
31 <div class="site-canvas">
32 <div class="wrapper-old col0">
33 <div id="topline">
34 <ul>
35 <xsl:call-template name="loginLinks"/>
36 <li><a href="{$library_name}/collection/{$collNameChecked}/page/pref">Preferences</a></li>
37 <li><a href="{$library_name}/collection/{$collNameChecked}/page/help">Help</a></li>
38 </ul>
39 <br class="clear" />
40 </div>
41 </div>
42 <div class="wrapper-old">
43 <div id="header-old">
44
45 <div class="banner-wrap">
46 <div class="wsite-elements wsite-not-footer wsite-header-elements">
47 <div class="wsite-section-wrap">
48 <div class="wsite-section wsite-header-section wsite-section-bg-image" style="height: auto;background-image: url(&quot;interfaces/{$interface_name}/images/digital-library.jpg&quot;) ;background-repeat: no-repeat ;background-position: 50.00% 21.94% ;background-size: 100% ;background-color: transparent ;background-size: cover;" >
49 <div class="wsite-section-content">
50
51 <div class="container">
52 <div class="banner">
53 <div class="wsite-section-elements">
54 <h2 class="wsite-content-title" style="text-align:center;"><font size="6"><a href="{$library_name}"><xsl:call-template name="siteName"/></a></font></h2>
55
56 <!-- Why does this feel like it's still inside the banner-wrap? -->
57 <xsl:if test="page/pageResponse/collection">
58 <div>
59 <p>&#160;
60 <a href="{$library_name}/collection/{$collNameChecked}/page/about">
61 <xsl:value-of select="page/pageResponse/collection/displayItemList/displayItem[@name='name']"/>
62 </a>
63 </p>
64 <br class="clear"/>
65 </div>
66 </xsl:if>
67 </div>
68 </div>
69 </div>
70
71 </div>
72 <!--<div class=""></div>-->
73 </div>
74 </div>
75
76 </div>
77
78 </div><!-- end banner-wrap -->
79 </div>
80 </div>
81 <div class="wrapper-old col2">
82
83 <div id="topbar">
84 <div id="topnav">
85 <ul>
86 <xsl:call-template name="navBar"/>
87 </ul>
88 </div>
89 <!--**********************************************************************-->
90 <xsl:choose>
91 <xsl:when test="page/pageRequest/@subaction='home'">
92 <xsl:call-template name="crossCollSearch"/>
93 </xsl:when>
94 <xsl:when test="page/pageRequest/paramList/param/@name='c' and /page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
95 <xsl:call-template name="quick-search-area"/>
96 </xsl:when>
97 <xsl:otherwise/>
98 </xsl:choose>
99 <!--**********************************************************************-->
100 </div>
101 </div>
102 <div class="wrapper-old">
103 <div class="container" id="gs_content">
104 <xsl:apply-templates select="/page"/>
105 </div>
106 <br class="clear" />
107 </div>
108 <xsl:call-template name="wmtb-footer"/>
109
110 </div> <!-- end site-canvas -->
111 </div> <!-- end wrapper-->
112 </body>
113</html>
114</xsl:template>
115
116
117<xsl:template name="navBar">
118<xsl:choose>
119<xsl:when test="page/pageResponse/collection">
120<xsl:variable name="count" select="count(/page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier)"/>
121<xsl:variable name="currentPage" select="page/pageRequest/@fullURL"/>
122
123<li><a href="{$library_name}">DL Home</a></li>
124<li>
125<xsl:if test="page/pageRequest/@subaction='about'"><xsl:attribute name="class">active</xsl:attribute></xsl:if>
126<a href="{$library_name}/collection/{$collNameChecked}/page/about">About</a>
127</li>
128
129<xsl:choose>
130<xsl:when test="$count > 3">
131<li><a href="{$currentPage}">Browse</a>
132<ul>
133<xsl:call-template name="Browsing"/>
134</ul>
135</li>
136</xsl:when>
137<xsl:otherwise>
138<xsl:call-template name="Browsing"/>
139</xsl:otherwise>
140</xsl:choose>
141<!--
142<xsl:if test="/page/pageResponse/collection/serviceList/service/@type='query'">
143<li><a href="{$currentPage}">Search</a>
144<ul>
145<xsl:for-each select="/page/pageResponse/collection/serviceList/service[@type='query']">
146<xsl:variable name="search" select="@name"/>
147<xsl:variable name="search_name" select="displayItem[@name='name']"/>
148<li><a href="{$library_name}/collection/{$collNameChecked}/search/{$search}"><xsl:value-of select="$search_name"/></a></li>
149</xsl:for-each>
150</ul>
151</li>
152</xsl:if>
153-->
154</xsl:when>
155<xsl:otherwise> </xsl:otherwise>
156</xsl:choose>
157</xsl:template>
158
159<xsl:template name="Browsing">
160 <xsl:for-each select="/page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">
161 <li>
162 <xsl:choose>
163 <!-- If this tab is selected then colour it differently -->
164 <xsl:when test="util:contains(/page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value, @name)">
165 <xsl:attribute name='class'>active</xsl:attribute>
166 </xsl:when>
167 <xsl:otherwise> </xsl:otherwise>
168 </xsl:choose>
169 <a>
170 <!-- Add a title element to the <a> tag if a description exists for this classifier -->
171 <xsl:if test="displayItem[@name='description']">
172 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
173 </xsl:if>
174
175 <!-- Add the href element to the <a> tag -->
176 <xsl:choose>
177 <xsl:when test="@name">
178 <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>
179 </xsl:when>
180 <xsl:otherwise>
181 <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>
182 </xsl:otherwise>
183 </xsl:choose>
184
185 <!-- Add the actual text of the <a> tag -->
186 <xsl:value-of select="displayItem[@name='name']"/>
187 </a>
188 </li>
189 </xsl:for-each>
190</xsl:template>
191
192<xsl:template name="crossCollSearch">
193 <div id="search">
194 <xsl:for-each select="/page/pageResponse/serviceList/service[@name='TextQuery']">
195 <form name="QuickSearch" method="get" action="{$library_name}">
196 <input type="hidden" name="a" value="q"/>
197 <input type="hidden" name="rt" value="rd"/>
198 <input type="hidden" name="s" value="{@name}"/>
199 <input type="hidden" name="s1.collection" value="all"/>
200 <input type="text" name="s1.query" id="search-text" value="Search all collections
" onfocus="this.value=(this.value=='Search all collections
')? '' : this.value ;" />
201 <input type="submit" name="go" id="go" value="Search" />
202 </form>
203 </xsl:for-each>
204 </div>
205 <br class="clear" />
206</xsl:template>
207
208<xsl:template name="CollectionSearch">
209<div id="search">
210<xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
211<form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
212<!-- This parameter says that we have come from the quick search area -->
213<input type="hidden" name="qs" value="1"/>
214<input type="hidden" name="rt" value="rd"/>
215<input type="hidden" name="s1.level">
216<xsl:attribute name="value">
217<xsl:choose>
218<xsl:when test="/page/pageRequest/paramList/param[@name = 's1.level']">
219<xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.level']/@value"/>
220</xsl:when>
221<xsl:otherwise>
222<xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>
223</xsl:otherwise>
224</xsl:choose>
225</xsl:attribute>
226</input>
227<xsl:choose>
228<xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
229<input type="hidden" name="s1.startPage" value="1"/>
230</xsl:when>
231<xsl:otherwise>
232<input type="hidden" name="startPage" value="1"/>
233</xsl:otherwise>
234</xsl:choose>
235<xsl:if test="not(/page/pageRequest/paramList/param[@name = 's1.hitsPerPage'])">
236<input type="hidden" name="s1.hitsPerPage" value="20"/>
237</xsl:if>
238<xsl:if test="not(/page/pageRequest/paramList/param[@name = 's1.maxDocs'])">
239<input type="hidden" name="s1.maxDocs" value="100"/>
240</xsl:if>
241<!-- The query text box -->
242<span class="querybox">
243<xsl:variable name="qs">
244<xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
245</xsl:variable>
246<nobr>
247<xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
248<xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
249</xsl:apply-templates>
250</nobr>
251</span>
252<!-- The submit button (for TextQuery) -->
253<xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
254<input type="submit" name="go" id="go" value="Search" > </input>
255<br/>
256</xsl:if>
257</form>
258</div>
259<br class="clear" />
260<!--<div id="advanced"><a href="{$library_name}/collection/{$collNameChecked}/search/TextQuery">advanced search</a></div>-->
261</xsl:template>
262
263
264<xsl:template name="loginLinks">
265 <xsl:variable name="username" select="/page/pageRequest/userInformation/@username"/>
266 <xsl:variable name="groups" select="/page/pageRequest/userInformation/@groups"/>
267
268 <xsl:choose>
269 <xsl:when test="$username">
270 <!-- Depositor link: only for logged-in users.
271 CSS class=login to make Depositor link blue to indicate it's only available when logged in.
272 Don't put this depositorTitleAndLink inside the test for whether user 'admin' is
273 in the current list of groups, as we want the depositor link to be visible for any
274 logged in user. The collection they want to deposit a doc into will determine whether
275 that user has the right to modify that collection.
276 -->
277 <li class="login"><gslib:depositorTitleAndLink/></li>
278 <xsl:if test="contains($groups,'admin')">
279 <li class="login"><a href="{$library_name}/admin/AddUser">Add user</a></li>
280 <li class="login"><a href="{$library_name}/admin/ListUsers">Administration</a></li>
281 </xsl:if>
282 <li class="login"><a href="{$library_name}/admin/AccountSettings?s1.username={$username}">Logged in as: <xsl:value-of select="$username"/></a></li>
283 <li class="login"><a href="{$library_name}?logout=">Logout</a></li>
284 </xsl:when>
285 <xsl:otherwise>
286 <li class="login">
287 <a href="{$library_name}?a=p&amp;sa=login&amp;redirectURL={$library_name}%3Fa=p%26sa=home">Login
288 <xsl:attribute name="title">
289 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/>
290 </xsl:attribute>
291 </a>
292 </li>
293 </xsl:otherwise>
294 </xsl:choose>
295</xsl:template>
296
297<xsl:template name="quick-search-area">
298 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
299 <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
300
301 <div id="quicksearcharea">
302 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
303 <xsl:choose>
304 <xsl:when test="not(page/pageRequest[@action='q']) or /page/pageRequest/paramList/param[@name='qs']/@value = '1'">
305 <form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
306 <!-- This parameter says that we have come from the quick search area -->
307
308 <input type="hidden" name="qs" value="1"/>
309 <input type="hidden" name="rt" value="rd"/>
310 <!-- don't hide indexing levels: code further down will hide it if there's only 1 indexing level.
311 and display a dropdown if the collection's configured with more than 1 index level available -->
312 <!--<input type="hidden" name="s1.level">
313 <xsl:attribute name="value">
314 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>
315 </xsl:attribute>
316 </input>
317 -->
318 <xsl:choose>
319 <xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
320 <input type="hidden" name="s1.startPage" value="1"/>
321 </xsl:when>
322 <xsl:otherwise>
323 <input type="hidden" name="startPage" value="1"/>
324 </xsl:otherwise>
325 </xsl:choose>
326
327 <!-- The query text box -->
328 <span class="querybox">
329 <xsl:variable name="qs">
330 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
331 </xsl:variable>
332 <nobr>
333 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
334 <!--
335 <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
336 -->
337 <xsl:with-param name="default" select="normalize-space($qs)"/>
338
339 </xsl:apply-templates>
340 </nobr>
341 </span>
342 <!-- The index selection list -->
343 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">
344 <span class="textselect">
345 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">
346 <xsl:with-param name="default">
347 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>
348 </xsl:with-param>
349 <xsl:with-param name="hideSingle">false</xsl:with-param>
350 <xsl:with-param name="quickSearch">true</xsl:with-param>
351 </xsl:apply-templates>
352 </span>
353 </xsl:if>
354 <!-- The partition selection list -->
355 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']/@type = 'enum_single'">
356 <span class="textselect">
357 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']">
358 <xsl:with-param name="default">
359 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexSubcollection']" mode="calculate-default"/>
360 </xsl:with-param>
361 <xsl:with-param name="hideSingle">true</xsl:with-param>
362 <xsl:with-param name="quickSearch">true</xsl:with-param>
363 </xsl:apply-templates>
364 </span>
365 </xsl:if>
366
367 <!-- The index level selection list. hideSingle=true to hide the dropdown if there's only 1 level (the default). -->
368 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='level']/@type = 'enum_single'">
369 <span class="textselect">
370 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='level']">
371 <xsl:with-param name="default">
372 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='level']" mode="calculate-default"/>
373 </xsl:with-param>
374 <xsl:with-param name="hideSingle">true</xsl:with-param>
375 <xsl:with-param name="quickSearch">true</xsl:with-param>
376 </xsl:apply-templates>
377 </span>
378 </xsl:if>
379
380 <!-- The language selection list -->
381 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']/@type = 'enum_single'">
382 <span class="textselect">
383 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']">
384 <xsl:with-param name="default">
385 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='indexLanguage']" mode="calculate-default"/>
386 </xsl:with-param>
387 <xsl:with-param name="hideSingle">true</xsl:with-param>
388 <xsl:with-param name="quickSearch">true</xsl:with-param>
389 </xsl:apply-templates>
390 </span>
391 </xsl:if>
392 <!-- The submit button (for TextQuery) -->
393 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
394 <input type="submit" id="quickSearchSubmitButton">
395 <xsl:attribute name="value">
396 <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>
397 </xsl:attribute>
398 </input>
399 <br/>
400 </xsl:if>
401 </form>
402 </xsl:when>
403 <xsl:otherwise><br/></xsl:otherwise>
404 </xsl:choose>
405 </xsl:if>
406
407 </div>
408 <!--<br class="clear" />-->
409 <!--<span id="advanced">-->
410
411 <!-- The list of other search types -->
412 <div class="query-form-links">
413 <ul>
414 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
415 <xsl:if test="/page/pageRequest/paramList/param[@name='qs']/@value = 1 or not(@name = /page/pageRequest/paramList/param[@name='s']/@value)">
416 <li class="ui-state-default ui-corner-all">
417 <a class="query-form-links">
418 <xsl:attribute name="href">
419 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collNameChecked"/>/search/<xsl:value-of select="@name"/>
420 </xsl:attribute>
421 <xsl:value-of select="displayItem[@name='name']"/>
422 </a>
423 </li>
424 </xsl:if>
425 </xsl:for-each>
426 </ul>
427 </div>
428 </xsl:if>
429 <!--<br class="clear" />
430 <div id="advanced"><a href="{$library_name}/collection/{$collNameChecked}/search/TextQuery">form search</a></div>
431 <div id="advanced"><a href="{$library_name}/collection/{$collNameChecked}/search/AdvancedFieldQuery">advanced search</a></div>
432 -->
433 </xsl:template>
434
435</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.