source: documentation/trunk/tutorial_sample_files/libraries/althor/transform/layouts/main.xsl@ 28601

Last change on this file since 28601 was 28601, checked in by jlwhisler, 10 years ago

Made a few changes to the interface to make it look more polished.

File size: 11.5 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<xsl:template name="mainTemplate">
20<html>
21 <head>
22 <!-- ***** in header.xsl ***** -->
23 <xsl:call-template name="create-html-header"/>
24 </head>
25 <body>
26 <header>
27
28 <!-- header wrapper -->
29 <div id="heading" class="wrapper cf">
30 <div id="top"><xsl:text> </xsl:text></div>
31 <div id="logo">
32 <div id="title"><a href="{$library_name}"><xsl:call-template name="siteName"/></a></div>
33 </div>
34 <div id="bottom"><xsl:text> </xsl:text></div>
35 </div><!-- ENDS header wrapper -->
36 <!-- ENDS header wrapper -->
37
38
39
40 <!-- nav -->
41 <nav class="cf">
42 <div class="wrapper cf">
43 <ul id="nav" class="sf-menu">
44 <xsl:call-template name="navBar"/>
45 </ul>
46 <div id="combo-holder"></div>
47 </div>
48 </nav>
49 <!-- ends nav -->
50
51 </header>
52 <div role="main" id="main">
53 <div class="wrapper">
54 <xsl:choose>
55 <xsl:when test="not(/page/pageRequest/@subaction='home')">
56 <div class="page-content">
57 <div class="entry-content cf">
58 <xsl:apply-templates select="/page"/>
59 </div>
60 <div class="c-1"><xsl:text> </xsl:text></div>
61<div class="c-2"><xsl:text> </xsl:text></div>
62<div class="c-3"><xsl:text> </xsl:text></div>
63<div class="c-4"><xsl:text> </xsl:text></div>
64
65 </div>
66
67 </xsl:when>
68 <xsl:otherwise>
69 <xsl:apply-templates select="/page"/>
70 </xsl:otherwise>
71 </xsl:choose>
72 </div>
73 </div>
74 <xsl:call-template name="gs_footer"/>
75
76 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"><xsl:text> </xsl:text></script>
77
78
79 <!-- scripts concatenated and minified via build script -->
80 <script src="interfaces/{$interface_name}/js/custom.js"><xsl:text> </xsl:text></script>
81
82 <!-- superfish -->
83 <script src="interfaces/{$interface_name}/js/superfish-1.4.8/js/hoverIntent.js"><xsl:text> </xsl:text></script>
84 <script src="interfaces/{$interface_name}/js/superfish-1.4.8/js/superfish.js"><xsl:text> </xsl:text></script>
85 <script src="interfaces/{$interface_name}/js/superfish-1.4.8/js/supersubs.js"><xsl:text> </xsl:text></script>
86 <!-- ENDS superfish -->
87
88 <script src="interfaces/{$interface_name}/js/tweet/jquery.tweet.js" ><xsl:text> </xsl:text></script>
89 <script src="interfaces/{$interface_name}/js/jquery.isotope.min.js"><xsl:text> </xsl:text></script>
90 <script src="interfaces/{$interface_name}/js/jquery.nivo.slider.js" ><xsl:text> </xsl:text></script>
91 <script src="interfaces/{$interface_name}/js/css3-mediaqueries.js"><xsl:text> </xsl:text></script>
92 <script src="interfaces/{$interface_name}/js/tabs.js"><xsl:text> </xsl:text></script>
93 <script src="interfaces/{$interface_name}/js/poshytip-1.1/src/jquery.poshytip.min.js"><xsl:text> </xsl:text></script>
94
95
96 </body>
97</html>
98</xsl:template>
99
100<!-- Template controlling the footer. -->
101<xsl:template name="gs_footer">
102<!-- Put footer in here. -->
103<footer>
104 <!-- wrapper -->
105 <div class="wrapper cf">
106 <!-- social -->
107 <div class="sb-holder cf">
108 <ul id="social-bar" class="cf">
109 <li class="left-corner"><i></i></li>
110 <li><a href="http://www.facebook.com" title="Become a fan" ><img src="interfaces/{$interface_name}/images/social/Facebook.png" alt="Facebook" /></a></li>
111 <li><a href="http://www.twitter.com" title="Follow my tweets" ><img src="interfaces/{$interface_name}/images/social/Twitter.png" alt="twitter" /></a></li>
112 <li><a href="http://www.google.com" title="Add to the circle" ><img src="interfaces/{$interface_name}/images/social/Google+.png" alt="Google plus" /></a></li>
113 <!-- RSS feed link can appear in a global format statement (where it has no type attribute)
114 or in section specific format statements, such as browse, search, display.
115 If it's present in any format statement, display the RSS link in the bannerlinks section. -->
116 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search' or not(@type)]/gsf:option[@name='RSS']/@value = 'true'">
117
118 <li><gsf:link type="rss"><gsf:icon file="social/RSS.png"/></gsf:link></li>
119 </xsl:if>
120 <li class="right-corner"><i></i></li>
121 </ul>
122 </div>
123 <!-- ENDS social -->
124 <!-- widgets -->
125 <ul class="widget-cols cf">
126 <li class="first-col">
127 <div class="widget-block">
128 <h4>News</h4>
129 <div class="recent-post cf">
130 <a href="http://www.greenstone.org/download" class="thumb"><img src="interfaces/{$interface_name}/images/54x54.jpg" alt="Post" /></a>
131 <div class="post-head">
132 <a href="http://www.greenstone.org/download">Greenstone 2.86 Released!</a><span> 30 October 2013</span>
133 </div>
134 </div>
135 <div class="recent-post cf">
136 <a href="http://wiki.greenstone.org" class="thumb"><img src="interfaces/{$interface_name}/images/54x54.jpg" alt="Post" /></a>
137 <div class="post-head">
138 <a href="http://wiki.greenstone.org">New Wiki Launched!</a><span>20 October 2013</span>
139 </div>
140 </div>
141 </div>
142 </li>
143 <li class="second-col">
144 <div class="widget-block">
145 <h4>ABOUT</h4>
146 <p>This interface was created using a free CSS template by <a href="http://luiszuno.com/">http://luiszuno.com/</a>. Be sure to keep the credit line in the footer intact.</p>
147
148 <p>Placeholder images by Jennifer L. Whisler (free for reuse under a <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution</a> license).</p>
149 </div>
150 </li>
151 <li class="third-col">
152 <div class="widget-block">
153 <div id="tweets" class="footer-col tweet">
154 <h4>Library Links</h4>
155 <ul>
156 <xsl:call-template name="loginLinks"/>
157 <li class="cat-item"><a href="{$library_name}/collection/{$collNameChecked}/page/pref">Preferences</a></li>
158 <li class="cat-item"><a href="{$library_name}/collection/{$collNameChecked}/page/help">Help</a></li>
159 </ul>
160 </div>
161 </div>
162 </li>
163 <li class="fourth-col">
164 <div class="widget-block">
165 <h4>External Links</h4>
166 <ul>
167 <li class="cat-item"><a href="http://www.greenstone.org" >Greenstone</a></li>
168 <li class="cat-item"><a href="http://wiki.greenstone.org">Greenstone Wiki</a></li>
169 <li class="cat-item"><a href="http://www.nzdl.org/cgi-bin/library.cgi" >NZDL</a></li>
170 <li class="cat-item"><a href="http://www.greenstone.org/greenstone3-home">Download Greenstone3</a></li>
171 </ul>
172 </div>
173
174 </li>
175 </ul>
176 <!-- ENDS widgets -->
177 <div id="footer-bottom">Vintage Template designed by <a href="http://www.luiszuno.com" >luiszuno.com</a></div>
178
179 </div><!-- ENDS wrapper -->
180 </footer>
181</xsl:template>
182
183
184
185
186<xsl:template name="loginLinks">
187<xsl:variable name="username" select="/page/pageRequest/userInformation/@username"/>
188<xsl:variable name="groups" select="/page/pageRequest/userInformation/@groups"/>
189
190<xsl:choose>
191<xsl:when test="$username">
192<li class="login cat-item"><a href="{$library_name}/admin/AccountSettings?s1.username={$username}">Logged in as: <xsl:value-of select="$username"/></a></li>
193<xsl:if test="contains($groups,'admin')">
194<li class="login cat-item"><a href="{$library_name}/admin/AddUser">Add user</a></li>
195<li class="login cat-item"><a href="{$library_name}/admin/ListUsers">Administration</a></li>
196</xsl:if>
197<li class="login cat-item"><a href="{$library_name}?logout=">Logout</a></li>
198</xsl:when>
199<xsl:otherwise>
200<li class="login cat-item">
201<a href="{$library_name}?a=p&amp;sa=login&amp;redirectURL={$library_name}%3Fa=p%26sa=home">Login
202<xsl:attribute name="title">
203<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/>
204</xsl:attribute>
205</a>
206</li>
207</xsl:otherwise>
208</xsl:choose>
209</xsl:template>
210
211
212
213
214
215
216
217<xsl:variable name="count" select="count(/page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier)"/>
218
219
220
221
222
223<xsl:template name="navBar">
224<xsl:choose>
225<xsl:when test="page/pageResponse/collection">
226
227<xsl:variable name="currentPage" select="page/pageRequest/@fullURL"/>
228
229<li><a href="{$library_name}">Home<i><b><xsl:text> </xsl:text></b></i></a></li>
230<li>
231<xsl:if test="page/pageRequest/@subaction='about'"><xsl:attribute name="class">current-menu-item</xsl:attribute></xsl:if>
232<a href="{$library_name}/collection/{$collNameChecked}/page/about">About<i><b><xsl:text> </xsl:text></b></i></a>
233</li>
234
235<xsl:choose>
236<xsl:when test="$count > 5">
237<li>
238<xsl:if test="page/pageRequest/@action='b'"><xsl:attribute name="class">current-menu-item</xsl:attribute></xsl:if>
239<a href="{$library_name}/collection/{$collNameChecked}/browse/CL1">Browse<i><b><xsl:text> </xsl:text></b></i></a>
240<ul>
241<xsl:call-template name="Browsing"/>
242</ul>
243</li>
244</xsl:when>
245<xsl:otherwise>
246<xsl:call-template name="Browsing"/>
247</xsl:otherwise>
248</xsl:choose>
249
250<xsl:if test="/page/pageResponse/collection/serviceList/service/@type='query'">
251<xsl:variable name="default_search" select="/page/pageResponse/collection/serviceList/service[@type='query'][1]/@name"/>
252<li>
253<xsl:if test="page/pageRequest/@action='q'"><xsl:attribute name="class">current-menu-item</xsl:attribute></xsl:if>
254<a href="{$library_name}/collection/{$collNameChecked}/search/{$default_search}">Search<i><b><xsl:text> </xsl:text></b></i></a>
255<ul>
256<xsl:for-each select="/page/pageResponse/collection/serviceList/service[@type='query']">
257<xsl:variable name="search" select="@name"/>
258<xsl:variable name="search_name" select="displayItem[@name='name']"/>
259<li><a href="{$library_name}/collection/{$collNameChecked}/search/{$search}"><xsl:value-of select="$search_name"/></a></li>
260</xsl:for-each>
261</ul>
262</li>
263</xsl:if>
264
265</xsl:when>
266<xsl:otherwise> </xsl:otherwise>
267</xsl:choose>
268</xsl:template>
269
270<xsl:template name="Browsing">
271<xsl:for-each select="/page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">
272<li>
273<xsl:choose>
274<!-- If this tab is selected then colour it differently -->
275<xsl:when test="util:contains(/page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value, @name) and $count &lt; 5">
276<xsl:attribute name='class'>current-menu-item</xsl:attribute>
277</xsl:when>
278<xsl:otherwise> </xsl:otherwise>
279</xsl:choose>
280
281<a>
282<!-- Add a title element to the <a> tag if a description exists for this classifier -->
283<xsl:if test="displayItem[@name='description']">
284<xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
285</xsl:if>
286
287<!-- Add the href element to the <a> tag -->
288<xsl:choose>
289<xsl:when test="@name">
290<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>
291</xsl:when>
292<xsl:otherwise>
293<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>
294</xsl:otherwise>
295</xsl:choose>
296
297<!-- Add the actual text of the <a> tag -->
298<xsl:value-of select="displayItem[@name='name']"/>
299<xsl:if test="$count &lt; 5"><i><b><xsl:text> </xsl:text></b></i></xsl:if>
300</a>
301</li>
302</xsl:for-each>
303</xsl:template>
304
305</xsl:stylesheet>
306
Note: See TracBrowser for help on using the repository browser.