source: documentation/trunk/tutorial_sample_files/interfaces/aybara/interface.txt@ 34582

Last change on this file since 34582 was 34582, checked in by anupama, 3 years ago

Updates and new interface.txt file with code snippets for the final 3 customisation tutorials. Not sure why we didn't already have one. By copying directly from the tutorial html, I may not have noticed there was no text file containing all the prepared code snippets to paste into the various xsl files.

File size: 13.8 KB
Line 
1
2Designing a new interface: Part 1
3
4
5Step 4:
6
7<servlet>
8<servlet-name>golden</servlet-name>
9<description>A new library with my new interface!</description>
10<servlet-class>org.greenstone.gsdl3.LibraryServlet</servlet-class>
11<init-param>
12<param-name>library_name</param-name>
13<param-value>golden</param-value>
14</init-param>
15<init-param>
16<param-name>site_name</param-name>
17<param-value>localsite</param-value>
18</init-param>
19<init-param>
20<param-name>interface_name</param-name>
21<param-value>perrin</param-value>
22</init-param>
23<init-param>
24<param-name>receptionist_class</param-name>
25<param-value>DefaultReceptionist</param-value>
26</init-param>
27<init-param>
28<param-name>default_lang</param-name>
29<param-value>en</param-value>
30</init-param>
31</servlet>
32
33
34<servlet-mapping>
35<servlet-name>golden</servlet-name>
36<url-pattern>/golden/*</url-pattern>
37</servlet-mapping>
38
39
40***********************************
41
42Designing a new interface: Part 2
43
44
45Step 3:
46
47<div class="content">
48<div id="featured_slide">
49<ul id="featurednews">
50<xsl:call-template name="collSlider"/>
51</ul>
52</div>
53</div>
54
55
56Step 4:
57
58<xsl:template name="collSlider">
59<xsl:for-each select="./collectionList/collection">
60<xsl:variable name="collectionFolder" select="@name"/>
61<xsl:variable name="collectionName" select="displayItemList/displayItem[@name='name']"/>
62<xsl:variable name="homeImage">
63<xsl:choose>
64<xsl:when test="displayItem[@name='smallicon']">
65sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="$collectionFolder"/>/images/<xsl:value-of select="displayItem[@name='smallicon']"/>
66</xsl:when>
67<xsl:otherwise>
68interfaces/<xsl:value-of select="$interface_name"/>/images/default.jpg
69</xsl:otherwise>
70</xsl:choose>
71</xsl:variable>
72
73<li><img src="{$homeImage}" alt="" />
74<div class="panel-overlay">
75<a href="{$library_name}/collection/{$collectionFolder}/page/about">
76<h2><xsl:value-of select="$collectionName"/></h2>
77</a>
78</div>
79</li>
80</xsl:for-each>
81</xsl:template>
82
83
84Step 6:
85
86<xsl:template name="additionalHeaderContent">
87<script type="text/javascript" src="interfaces/{$interface_name}/scripts/jquery.easing.1.3.js"><xsl:text> </xsl:text></script>
88<script type="text/javascript" src="interfaces/{$interface_name}/scripts/jquery.timers.1.2.js"><xsl:text> </xsl:text></script>
89<script type="text/javascript" src="interfaces/{$interface_name}/scripts/jquery.galleryview.2.1.1.min.js"><xsl:text> </xsl:text></script>
90<script type="text/javascript" src="interfaces/{$interface_name}/scripts/jquery.galleryview.setup.js"><xsl:text> </xsl:text></script>
91</xsl:template>
92
93
94Step 7:
95
96<div class="column">
97<ul class="latestnews">
98<li>
99<p><strong><a href="#">Highlighted Item 1</a></strong><br/>This is a place where you can put information about an item you would like to highlight in your collection, with or without an accompanying image.</p>
100</li>
101<li><img src="interfaces/{$interface_name}/images/80x80.jpg" alt="" />
102<p><strong><a href="#">Highlighted Item 2</a></strong><br/>This is a place where you can put information about an item you would like to highlight in your collection,with or without an accompanying image.</p>
103</li>
104<li class="last"><img src="interfaces/{$interface_name}/images/80x80.jpg" alt="" />
105<p><strong><a href="#">Highlighted Item 3</a></strong><br/>This is a place where you can put information about an item you would like to highlight in your collection, with or without an accompanying image.</p>
106</li>
107</ul>
108</div>
109<br class="clear" />
110
111
112Step 8:
113
114<div id="hpage_cats">
115<xsl:call-template name="collectionsList"/>
116</div>
117
118
119<xsl:template name="collectionsList">
120<xsl:for-each select="./collectionList/collection">
121<xsl:choose>
122<xsl:when test="position() mod 2 = 1">
123<div class="fl_left">
124<xsl:call-template name="collDescription"/>
125</div>
126</xsl:when>
127<xsl:otherwise>
128<div class="fl_right">
129<xsl:call-template name="collDescription"/>
130</div>
131<br class="clear" />
132</xsl:otherwise>
133</xsl:choose>
134</xsl:for-each>
135</xsl:template>
136
137<xsl:template name="collDescription">
138<xsl:variable name="collectionFolder" select="@name"/>
139<xsl:variable name="collectionName" select="displayItemList/displayItem[@name='name']"/>
140<xsl:variable name="homeImage" select="displayItemList/displayItem[@name='icon']"/>
141<xsl:variable name="aboutImage" select="displayItemList/displayItem[@name='smallicon']"/>
142<xsl:variable name="collDesc" select="displayItemList/displayItem[@name='description']"/>
143<xsl:variable name="numDocs" select="metadataList/metadata[@name='numDocs']"/>
144
145<h2><a href="{$library_name}/collection/{$collectionFolder}/page/about"><xsl:value-of select="$collectionName"/></a></h2>
146<xsl:if test="$aboutImage">
147<img src="sites/{$site_name}/collect/{$collectionFolder}/images/{$aboutImage}" alt="{$collectionName}" />
148</xsl:if>
149
150<xsl:choose>
151<xsl:when test="$collDesc">
152<p class="justify"><xsl:apply-templates select="displayItemList/displayItem[@name='description']"/></p>
153</xsl:when>
154<xsl:otherwise>
155<p class="justify">Welcome to the <xsl:value-of select="$collectionName"/> collection. This collection contains <xsl:value-of select="$numDocs"/> documents.</p>
156</xsl:otherwise>
157</xsl:choose>
158</xsl:template>
159
160
161Step 11 (header.xsl):
162
163<link rel="stylesheet" href="interfaces/{$interface_name}/styles/layout.css" type="text/css" />
164<link rel="stylesheet" href="interfaces/{$interface_name}/styles/gs3-core-min.css" type="text/css" />
165
166***********************************
167
168Designing a new interface: Part 3
169
170
171Step 2:
172
173<!-- ******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.-->
174<div class="wrapper col8">
175<div id="copyright">
176<p class="fl_left">Copyright © 2013 - All Rights Reserved - <a href="#">Your Webpage Here</a></p>
177<p class="fl_right">Template by <a href="http://www.os-templates.com/" title="Free Website Templates">OS Templates</a></p>
178<br class="clear" />
179</div>
180</div>
181
182
183Step 4:
184
185<div class="wrapper">
186<div class="container" id="gs_content">
187<xsl:apply-templates select="/page"/>
188<br class="clear" />
189</div>
190</div>
191
192
193Step 6:
194
195<div class="wrapper col2">
196<div id="topbar">
197<div id="topnav">
198<ul>
199<li class="active"><a href="index.html">Home</a></li>
200<li><a href="style-demo.html">Browse</a>
201<ul>
202<li><a href="#">Link 1</a></li>
203<li><a href="#">Link 2</a></li>
204<li><a href="#">Link 3</a></li>
205</ul>
206</li>
207<li><a href="#">Search</a>
208<ul>
209<li><a href="#">Link 1</a></li>
210<li><a href="#">Link 2</a></li>
211<li><a href="#">Link 3</a></li>
212</ul>
213</li>
214</ul>
215</div>
216<!--**********************************************************************-->
217<div id="search">
218<form action="#" method="post">
219<fieldset>
220<legend>Site Search</legend>
221<input type="text" value="Search Our Website
" onfocus="this.value=(this.value=='Search Our Website
')? '' : this.value ;" />
222<input type="submit" name="go" id="go" value="Search" />
223</fieldset>
224</form>
225</div>
226<br class="clear" />
227<div id="advanced"><a href="#">advanced search</a></div>
228<!--**********************************************************************-->
229</div>
230</div>
231
232
233Step 8:
234
235<xsl:call-template name="navBar"/>
236
237
238" select="@name"/>
239<xsl:variable name="search_name" select="displayItem[@name='name']"/>
240<li><a href="{$library_name}/collection/{$collNameChecked}/search/{$search}"><xsl:value-of select="$search_name"/></a></li>
241</xsl:for-each>
242</ul>
243</li>
244</xsl:if>
245
246</xsl:when>
247<xsl:otherwise> </xsl:otherwise>
248</xsl:choose>
249</xsl:template>
250
251<xsl:template name="Browsing">
252<xsl:for-each select="/page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">
253<li>
254<xsl:choose>
255<!-- If this tab is selected then colour it differently -->
256<xsl:when test="util:contains(/page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value, @name)">
257<xsl:attribute name='class'>active</xsl:attribute>
258</xsl:when>
259<xsl:otherwise> </xsl:otherwise>
260</xsl:choose>
261
262<a>
263<!-- Add a title element to the <a> tag if a description exists for this classifier -->
264<xsl:if test="displayItem[@name='description']">
265<xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
266</xsl:if>
267
268<!-- Add the href element to the <a> tag -->
269<xsl:choose>
270<xsl:when test="@name">
271<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>
272</xsl:when>
273<xsl:otherwise>
274<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>
275</xsl:otherwise>
276</xsl:choose>
277
278<!-- Add the actual text of the <a> tag -->
279<xsl:value-of select="displayItem[@name='name']"/>
280</a>
281</li>
282</xsl:for-each>
283</xsl:template>
284
285
286Step 10:
287
288<xsl:choose>
289<xsl:when test="page/pageRequest/@subaction='home'">
290<xsl:call-template name="crossCollSearch"/>
291</xsl:when>
292<xsl:when test="page/pageRequest/paramList/param/@name='c' and /page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
293<xsl:call-template name="CollectionSearch"/>
294</xsl:when>
295<xsl:otherwise/>
296</xsl:choose>
297
298
299Step 11:
300
301<xsl:template name="crossCollSearch">
302<div id="search">
303<xsl:for-each select="/page/pageResponse/serviceList/service[@name='TextQuery']">
304<form name="QuickSearch" method="get" action="{$library_name}">
305<input type="hidden" name="a" value="q"/>
306<input type="hidden" name="rt" value="rd"/>
307<input type="hidden" name="s" value="{@name}"/>
308<input type="hidden" name="s1.collection" value="all"/>
309<input type="text" name="s1.query" id="search-text" value="Search all collections
" onfocus="this.value=(this.value=='Search all collections
')? '' : this.value ;" />
310<input type="submit" name="go" id="go" value="Search" />
311</form>
312</xsl:for-each>
313</div>
314<br class="clear" />
315</xsl:template>
316
317<xsl:template name="CollectionSearch">
318<div id="search">
319<xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
320<form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">
321<!-- This parameter says that we have come from the quick search area -->
322<input type="hidden" name="qs" value="1"/>
323<input type="hidden" name="rt" value="rd"/>
324<input type="hidden" name="s1.level">
325<xsl:attribute name="value">
326<xsl:choose>
327<xsl:when test="/page/pageRequest/paramList/param[@name = 's1.level']">
328<xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.level']/@value"/>
329</xsl:when>
330<xsl:otherwise>
331<xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>
332</xsl:otherwise>
333</xsl:choose>
334</xsl:attribute>
335</input>
336<xsl:choose>
337<xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">
338<input type="hidden" name="s1.startPage" value="1"/>
339</xsl:when>
340<xsl:otherwise>
341<input type="hidden" name="startPage" value="1"/>
342</xsl:otherwise>
343</xsl:choose>
344<xsl:if test="not(/page/pageRequest/paramList/param[@name = 's1.hitsPerPage'])">
345<input type="hidden" name="s1.hitsPerPage" value="20"/>
346</xsl:if>
347<xsl:if test="not(/page/pageRequest/paramList/param[@name = 's1.maxDocs'])">
348<input type="hidden" name="s1.maxDocs" value="100"/>
349</xsl:if>
350<!-- The query text box -->
351<span class="querybox">
352<xsl:variable name="qs">
353<xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
354</xsl:variable>
355<nobr>
356<xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
357<xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>
358</xsl:apply-templates>
359</nobr>
360</span>
361<!-- The submit button (for TextQuery) -->
362<xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
363<input type="submit" name="go" id="go" value="Search" > </input>
364<br/>
365</xsl:if>
366</form>
367</div>
368<br class="clear" />
369<div id="advanced"><a href="{$library_name}/collection/{$collNameChecked}/search/TextQuery">advanced search</a></div>
370</xsl:template>
371
372
373Step 13:
374
375<div class="wrapper">
376<div id="header">
377<div class="fl_left">
378<h1><a href="{$library_name}"><xsl:call-template name="siteName"/></a></h1>
379<p>&#160;
380<xsl:if test="page/pageResponse/collection">
381<a href="{$library_name}/collection/{$collNameChecked}/page/about">
382<xsl:value-of select="page/pageResponse/collection/displayItemList/displayItem[@name='name']"/>
383</a>
384</xsl:if>
385</p>
386</div>
387<br class="clear"/></div>
388</div>
389
390
391Step 14:
392
393<body id="top">
394<div class="wrapper col0">
395<div id="topline">
396<ul>
397<xsl:call-template name="loginLinks"/>
398<li><a href="{$library_name}/collection/{$collNameChecked}/page/pref">Preferences</a></li>
399<li><a href="{$library_name}/collection/{$collNameChecked}/page/help">Help</a></li>
400</ul>
401<br class="clear" />
402</div>
403</div>
404
405
406<xsl:template name="loginLinks">
407<xsl:variable name="username" select="/page/pageRequest/userInformation/@username"/>
408<xsl:variable name="groups" select="/page/pageRequest/userInformation/@groups"/>
409
410<xsl:choose>
411<xsl:when test="$username">
412<xsl:if test="contains($groups,'admin')">
413<li class="login"><a href="{$library_name}/admin/AddUser">Add user</a></li>
414<li class="login"><a href="{$library_name}/admin/ListUsers">Administration</a></li>
415</xsl:if>
416<li class="login"><a href="{$library_name}/admin/AccountSettings?s1.username={$username}">Logged in as: <xsl:value-of select="$username"/></a></li>
417<li class="login"><a href="{$library_name}?logout=">Logout</a></li>
418</xsl:when>
419<xsl:otherwise>
420<li class="login">
421<a href="{$library_name}?a=p&amp;sa=login&amp;redirectURL={$library_name}%3Fa=p%26sa=home">Login
422<xsl:attribute name="title">
423<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/>
424</xsl:attribute>
425</a>
426</li>
427</xsl:otherwise>
428</xsl:choose>
429</xsl:template>
430
431
432***********************************
433
434
Note: See TracBrowser for help on using the repository browser.