source: main/trunk/greenstone3/web/interfaces/default/transform/pages/query.xsl@ 29278

Last change on this file since 29278 was 29278, checked in by kjdon, 10 years ago

added in code to display berries and berry basket for search results page

File size: 25.2 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:java="http://xml.apache.org/xslt/java"
5 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6 xmlns:gslib="http://www.greenstone.org/skinning"
7 xmlns:gsvar="http://www.greenstone.org/skinning-var"
8 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
9 extension-element-prefixes="java util"
10 exclude-result-prefixes="java util gsf">
11
12 <!-- use the 'main' layout -->
13 <xsl:import href="layouts/main.xsl"/>
14
15 <xsl:include href="query-common.xsl"/>
16 <!-- set page title -->
17 <xsl:template name="pageTitle">
18 <gslib:serviceName/>
19 </xsl:template>
20
21 <!-- set page breadcrumbs -->
22 <xsl:template name="breadcrumbs">
23 <gslib:siteLink/>
24 <gslib:rightArrow/>
25 <xsl:if test="/page/pageResponse/collection">
26 <gslib:collectionNameLinked/>
27 <gslib:rightArrow/>
28 </xsl:if>
29 </xsl:template>
30
31 <!-- the page content -->
32 <xsl:template match="/page">
33 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 'qs']) or /page/pageRequest/paramList/param[@name = 'qs']/@value = ''">
34 <xsl:call-template name="queryPage"/>
35 </xsl:if>
36 <xsl:if test="contains(/page/pageRequest/paramList/param[@name='rt']/@value, 'r')">
37 <xsl:call-template name="resultsPage"/>
38 </xsl:if>
39 </xsl:template>
40
41 <xsl:template name="resultsPage">
42 <xsl:call-template name="resultsPagePre"/>
43 <xsl:call-template name="displayMatchDocs"/>
44 <xsl:call-template name="displayTermInfo"/>
45 <xsl:call-template name="displayBaskets"/>
46 <xsl:call-template name="displayResults"/>
47 <xsl:call-template name="resultsPagePost"/>
48 </xsl:template>
49
50 <!-- optional cgi-params for links to document pages -->
51 <xsl:variable name="opt-doc-link-args">p.s=<gsvar:this-service/>
52 </xsl:variable>
53
54 <xsl:template name="displayBaskets">
55 <!-- add in document basket here??? see classifier.xsl -->
56 <xsl:if test="$berryBasketOn">
57 <div id="rightSidebar">
58 <xsl:if test="$berryBasketOn">
59 <!-- show the berry basket if it's turned on -->
60 <gslib:berryBasket/>
61 <xsl:text> </xsl:text>
62 </xsl:if>
63 </div>
64 </xsl:if>
65 </xsl:template>
66
67 <xsl:template name="displayResults">
68 <xsl:if test="/page/pageResponse/facetList/facet">
69 <script type="text/javascript" src="interfaces/{$interface_name}/js/facet-scripts.js">
70 <xsl:text> </xsl:text>
71 </script>
72 <div id="facetSelector">
73 <xsl:for-each select="/page/pageResponse/facetList/facet">
74 <xsl:if test="count(count) > 0">
75 <ul class="facetTable ui-widget-content" indexName="{@name}">
76 <xsl:variable name="serviceName">
77 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 's']/@value"/>
78 </xsl:variable>
79 <xsl:variable name="indexShortName">
80 <xsl:value-of select="@name"/>
81 </xsl:variable>
82 <xsl:variable name="countSize">
83 <xsl:choose>
84 <xsl:when test="/page/pageResponse/format[@type='search']/gsf:option[@name='facetTableRows']">
85 <xsl:value-of select="/page/pageResponse/format[@type='search']/gsf:option[@name='facetTableRows']/@value"/>
86 </xsl:when>
87 <xsl:otherwise>8</xsl:otherwise>
88 </xsl:choose>
89 </xsl:variable>
90
91 <li class="ui-widget-header" style="text-transform:capitalize; text-align:center;">
92 <xsl:choose>
93 <xsl:when test="/page/pageResponse/collection/serviceList/service[@name = $serviceName]/paramList/param[@name = 'index']">
94 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name = $serviceName]/paramList/param[@name = 'index']/option[@name = $indexShortName]/displayItem"/>
95 </xsl:when>
96 <xsl:when test="/page/pageResponse/collection/serviceList/service[@name = $serviceName]/paramList/param[@name = 'complexField']/param[@name = 'fqf']">
97 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name = $serviceName]/paramList/param[@name = 'complexField']/param[@name = 'fqf']/option[@name = $indexShortName]/displayItem"/>
98 </xsl:when>
99 </xsl:choose>
100 </li>
101 <xsl:for-each select="count">
102 <li>
103 <xsl:attribute name="style">
104 <xsl:if test="position() > $countSize">display:none;<xsl:value-of select="$indexShortName"/>
105 </xsl:if>
106 </xsl:attribute>
107 <input type="checkbox" onclick="performRefinedSearch();"/>
108 <span>
109 <xsl:value-of select="@name"/>
110 </span>(<xsl:value-of select="."/>)
111 </li>
112 </xsl:for-each>
113 <xsl:if test="count(count) > $countSize">
114 <li class="expandCollapseFacetList{$indexShortName}">
115 <a class="expandCollapseFacetListLink{$indexShortName}" href="javascript:expandFacetList('{$indexShortName}', {$countSize});">See more...</a>
116 </li>
117 </xsl:if>
118 </ul>
119 </xsl:if>
120 </xsl:for-each>
121 </div>
122 </xsl:if>
123 <div id="resultsArea">
124 <xsl:attribute name="class">
125 <xsl:if test="/page/pageResponse/facetList/facet">facetedResults</xsl:if>
126 </xsl:attribute>
127 <table id="resultsTable">
128 <xsl:for-each select="pageResponse/documentNodeList/documentNode">
129 <tr id="div{@nodeID}" class="document">
130 <xsl:apply-templates select="."/>
131 <!-- The berry (optional) -->
132 <td>
133 <xsl:call-template name="documentBerryForClassifierOrSearchPage"/>
134 </td>
135
136 <xsl:call-template name="documentNodePost"/>
137 </tr>
138 </xsl:for-each>
139 <br/>
140 </table>
141
142 <!-- Previous/Next buttons-->
143 <xsl:call-template name="prevNextButtons"/>
144 </div>
145 <xsl:if test="/page/pageResponse/facetList/facet">
146 <div style="clear:both;">
147 <xsl:text> </xsl:text>
148 </div>
149 </xsl:if>
150 </xsl:template>
151
152 <xsl:template name="queryPage">
153 <xsl:for-each select="pageResponse/service">
154 <form name="QueryForm" method="get" action="{$library_name}/collection/{$collName}/search/{@name}">
155 <div>
156 <input type="hidden" name="a" value="q"/>
157 <input type="hidden" name="sa">
158 <xsl:attribute name="value">
159 <xsl:value-of select="/page/pageRequest/@subaction"/>
160 </xsl:attribute>
161 </input>
162 <input type="hidden" name="rt" value="rd"/>
163 <xsl:choose>
164 <xsl:when test="/page/pageRequest/paramList/param[@name = 's1.maxDocs']">
165 <input type="hidden" name="s1.maxDocs">
166 <xsl:attribute name="value">
167 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.maxDocs']/@value"/>
168 </xsl:attribute>
169 </input>
170 </xsl:when>
171 <xsl:otherwise>
172 <input type="hidden" name="s1.maxDocs" value="100"/>
173 </xsl:otherwise>
174 </xsl:choose>
175 <xsl:choose>
176 <xsl:when test="/page/pageRequest/paramList/param[@name = 's1.hitsPerPage']">
177 <input type="hidden" name="s1.hitsPerPage">
178 <xsl:attribute name="value">
179 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.hitsPerPage']/@value"/>
180 </xsl:attribute>
181 </input>
182 </xsl:when>
183 <xsl:otherwise>
184 <input type="hidden" name="s1.hitsPerPage" value="20"/>
185 </xsl:otherwise>
186 </xsl:choose>
187
188 <xsl:variable name="ns">s1.</xsl:variable>
189 <xsl:for-each select="paramList/param">
190 <xsl:choose>
191 <xsl:when test="@name = 'maxDocs' or @name = 'hitsPerPage'">
192 </xsl:when>
193 <xsl:when test="@type='multi'">
194 <xsl:apply-templates select=".">
195 <xsl:with-param name="ns" select="$ns"/>
196 </xsl:apply-templates>
197 </xsl:when>
198 <xsl:otherwise>
199 <xsl:call-template name="param-display">
200 <xsl:with-param name="ns" select="$ns"/>
201 </xsl:call-template>
202 </xsl:otherwise>
203 </xsl:choose>
204 </xsl:for-each>
205 <br/>
206 <input type="submit">
207 <xsl:attribute name="value">
208 <xsl:value-of select="displayItem[@name='submit']"/>
209 </xsl:attribute>
210 </input>
211 </div>
212 </form>
213 </xsl:for-each>
214 </xsl:template>
215
216 <xsl:template name="displayMatchDocs">
217 <div id="matchdocs">
218 <xsl:variable name="numDocsMatched" select="/page/pageResponse/metadataList/metadata[@name='numDocsMatched']"/>
219 <xsl:variable name="numDocsReturned">
220 <xsl:call-template name="numDocsReturned"/>
221 </xsl:variable>
222 <!-- select="/page/pageResponse/metadataList/metadata[@name='numDocsReturned']"/>-->
223 <xsl:variable name="docLevel">
224 <xsl:call-template name="documentLevel"/>
225 </xsl:variable>
226 <xsl:variable name="docLevelText">
227 <xsl:call-template name="documentLevelText">
228 <xsl:with-param name="numDocsMatched" select="$numDocsMatched"/>
229 <xsl:with-param name="level" select="$docLevelText"/>
230 </xsl:call-template>
231 </xsl:variable>
232 <xsl:choose>
233 <xsl:when test="$numDocsMatched='0' or $numDocsReturned='0'">
234 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.nodocsmatch', $docLevelText)"/>
235 </xsl:when>
236 <xsl:when test="$numDocsMatched='1' or $numDocsReturned='1'">
237 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.onedocsmatch', $docLevelText)"/>
238 </xsl:when>
239 <xsl:when test="$numDocsMatched">
240 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.manydocsmatch', concat($numDocsMatched, ';', $docLevelText))"/>
241 <xsl:if test="$numDocsReturned and not($numDocsMatched=$numDocsReturned)"> (<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.docsreturned', concat($numDocsReturned, ';', $docLevelText))"/>)</xsl:if>
242 </xsl:when>
243 <xsl:when test="$numDocsReturned">
244 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.atleastdocsmatch', concat($numDocsReturned, ';', $docLevelText))"/>
245 </xsl:when>
246 </xsl:choose>
247 </div>
248
249 </xsl:template>
250
251 <xsl:template name="numDocsMatched">
252 <xsl:choose>
253 <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'numDocsMatched']">
254 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'numDocsMatched']"/>
255 </xsl:when>
256 <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'numDocsReturned']">
257 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'numDocsReturned']"/>
258 </xsl:when>
259 <xsl:otherwise>
260 <xsl:value-of select="count(/page/pageResponse/documentNodeList/documentNode)"/>
261 </xsl:otherwise>
262 </xsl:choose>
263 </xsl:template>
264
265 <xsl:template name="numDocsReturned">
266 <xsl:choose>
267 <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'numDocsReturned']">
268 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'numDocsReturned']"/>
269 </xsl:when>
270 <xsl:otherwise>
271 <xsl:value-of select="count(/page/pageResponse/documentNodeList/documentNode)"/>
272 </xsl:otherwise>
273 </xsl:choose>
274 </xsl:template>
275
276 <xsl:template name="documentLevel">
277 <xsl:choose>
278 <xsl:when test="/page/pageRequest/paramList/param[@name='level']">
279 <xsl:value-of select="/page/pageRequest/paramList/param[@name='level']/@value" />
280 </xsl:when>
281 <xsl:when test="/page/pageRequest/paramList/param[@name='s1.level']">
282 <xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.level']/@value" />
283 </xsl:when>
284 <xsl:otherwise>Doc</xsl:otherwise>
285 </xsl:choose>
286 </xsl:template>
287
288 <xsl:template name="documentLevelText">
289 <xsl:param name="numDocsMatched">0</xsl:param>
290 <xsl:param name="level">Doc</xsl:param>
291 <xsl:choose>
292 <xsl:when test="$numDocsMatched = 1">
293 <xsl:choose>
294 <xsl:when test="$level = 'Doc'">
295 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document')"/>
296 </xsl:when>
297 <xsl:otherwise>
298 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.section')"/>
299 </xsl:otherwise>
300 </xsl:choose>
301 </xsl:when>
302 <!-- 0 or more than one use plural. is that the case for all langs??-->
303 <xsl:otherwise>
304 <xsl:choose>
305 <xsl:when test="$level = 'Doc'">
306 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document_plural')"/>
307 </xsl:when>
308 <xsl:otherwise>
309 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.section_plural')"/>
310 </xsl:otherwise>
311 </xsl:choose>
312 </xsl:otherwise>
313 </xsl:choose>
314 </xsl:template>
315
316 <xsl:template name="displayTermInfo">
317
318 <!-- Find the number of documents displayed per page -->
319 <xsl:variable name="level">
320 <xsl:call-template name="documentLevel"/>
321 </xsl:variable>
322
323 <!-- The list of search terms with their frequency and document count -->
324 <p class="termList">
325 <xsl:if test="count(/page/pageResponse/termList/stopword) &gt; 0">
326 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.common')"/>
327 <xsl:text> </xsl:text>
328 <xsl:for-each select="/page/pageResponse/termList/stopword">
329 <span style="font-style:italic;">
330 <xsl:value-of select="@name"/>
331 </span>
332 <xsl:text> </xsl:text>
333 </xsl:for-each>
334 <br />
335 <br />
336 </xsl:if>
337
338 <!-- If there is only one or two search terms then show the expanded information -->
339 <xsl:choose>
340 <xsl:when test="count(/page/pageResponse/termList/term) &lt; 3">
341 <xsl:for-each select="/page/pageResponse/termList/term">
342 <xsl:variable name="occursTextKey">
343 <xsl:choose>
344 <xsl:when test="@freq = 1">query.termoccurs.1.1</xsl:when>
345 <xsl:when test="@numDocsMatch = 1">query.termoccurs.x.1</xsl:when>
346 <xsl:otherwise>query.termoccurs.x.x</xsl:otherwise>
347 </xsl:choose>
348 </xsl:variable>
349 <xsl:variable name="levelText">
350 <xsl:call-template name="documentLevelText">
351 <xsl:with-param name="level" select="$level"/>
352 <xsl:with-param name="numDocsMatched" select="@numDocsMatch"/>
353 </xsl:call-template>
354 </xsl:variable>
355 <span class="termInfo">
356 <!--<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, $occursTextKey, concat(@name,';', @freq,';', @numDocsMatch,';', $levelText))"/>-->
357 <!-- For solr collections, display:
358 term x occured y times
359 term a occured b times
360 For collections using all other indexers, display:
361 term x occurred y times in n sections/documents
362 term a occurred b times in m sections/docs
363 -->
364 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, $occursTextKey, concat(@name,';', @freq))"/>
365 <xsl:choose>
366 <xsl:when test="/page/pageResponse/collection[@type != 'solr']">
367 <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termSectionFreq', concat(@numDocsMatch,';', $levelText))"/>
368 </xsl:when>
369 </xsl:choose>
370 </span>
371 <br/>
372 </xsl:for-each>
373 </xsl:when>
374 <xsl:otherwise>
375 <xsl:for-each select="/page/pageResponse/termList/term">
376 <span style="font-style:italic;">
377 <xsl:value-of select="@name"/>
378 </span> (<xsl:value-of select="@freq"/>)
379 </xsl:for-each>
380 </xsl:otherwise>
381 </xsl:choose>
382 </p>
383 </xsl:template>
384
385 <xsl:template name="prevNextButtons">
386 <!-- Current page -->
387 <xsl:variable name="currentPage">
388 <xsl:choose>
389 <xsl:when test="/page/pageRequest/paramList/param[@name='s1.startPage']/@value">
390 <xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.startPage']/@value" />
391 </xsl:when>
392 <xsl:when test="/page/pageRequest/paramList/param[@name='startPage']/@value">
393 <xsl:value-of select="/page/pageRequest/paramList/param[@name='startPage']/@value" />
394 </xsl:when>
395 <xsl:otherwise>1</xsl:otherwise>
396 </xsl:choose>
397 </xsl:variable>
398
399 <xsl:variable name="usesS1">
400 <xsl:choose>
401 <xsl:when test="/page/pageResponse/service/paramList/param[@name='startPage']">true</xsl:when>
402 <xsl:otherwise>false</xsl:otherwise>
403 </xsl:choose>
404 </xsl:variable>
405
406 <!-- Find the total number of documents returned -->
407 <xsl:variable name="docMax">
408 <xsl:choose>
409 <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'numDocsReturned']">
410 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'numDocsReturned']"/>
411 </xsl:when>
412 <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'numDocsMatched']">
413 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'numDocsMatched']"/>
414 </xsl:when>
415 <xsl:otherwise>
416 <xsl:value-of select="count(/page/pageResponse/documentNodeList/documentNode)"/>
417 </xsl:otherwise>
418 </xsl:choose>
419 </xsl:variable>
420
421 <!-- Find the number of documents displayed per page -->
422 <xsl:variable name="docsPerPage">
423 <xsl:choose>
424 <xsl:when test="/page/pageRequest/paramList/param[@name='hitsPerPage']">
425 <xsl:value-of select="/page/pageRequest/paramList/param[@name='hitsPerPage']/@value" />
426 </xsl:when>
427 <xsl:when test="/page/pageRequest/paramList/param[@name='s1.hitsPerPage']">
428 <xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.hitsPerPage']/@value" />
429 </xsl:when>
430 <xsl:otherwise>20</xsl:otherwise>
431 </xsl:choose>
432 </xsl:variable>
433
434 <!-- Find the number of documents displayed per page -->
435 <xsl:variable name="level">
436 <xsl:choose>
437 <xsl:when test="/page/pageRequest/paramList/param[@name='level']">
438 <xsl:value-of select="/page/pageRequest/paramList/param[@name='level']/@value" />
439 </xsl:when>
440 <xsl:when test="/page/pageRequest/paramList/param[@name='s1.level']">
441 <xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.level']/@value" />
442 </xsl:when>
443 <xsl:otherwise>Doc</xsl:otherwise>
444 </xsl:choose>
445 </xsl:variable>
446
447 <table id="searchResultNavTable">
448 <tr>
449 <xsl:variable name="startPageName">
450 <xsl:if test="$usesS1 = 'true'">s1.</xsl:if>startPage</xsl:variable>
451
452 <!-- Previous button -->
453 <td id="prevArrowTD">
454 <xsl:if test="$currentPage != 1">
455 <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/@subaction}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;{$startPageName}={$currentPage - 1}&amp;qs={/page/pageRequest/paramList/param[@name='qs']/@value}">
456 <img src="interfaces/default/images/previous.png"/>
457 </a>
458 </xsl:if>
459 </td>
460 <td id="prevTD">
461 <xsl:if test="$currentPage != 1">
462 <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/@subaction}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;{$startPageName}={$currentPage - 1}&amp;qs={/page/pageRequest/paramList/param[@name='qs']/@value}">Previous</a>
463 </xsl:if>
464 </td>
465
466 <!-- Search result status bar (in english it reads "Displaying X to Y of Z documents") -->
467 <xsl:if test="$docMax &gt; 0">
468 <xsl:variable name="startdoc" select="($currentPage - 1) * $docsPerPage + 1"/>
469 <xsl:variable name="enddoc">
470 <xsl:choose>
471 <xsl:when test="($currentPage * $docsPerPage + 1) &gt; $docMax">
472 <xsl:value-of select="$docMax"/>
473 </xsl:when>
474 <xsl:otherwise>
475 <xsl:value-of select="$currentPage * $docsPerPage"/>
476 </xsl:otherwise>
477 </xsl:choose>
478 </xsl:variable>
479 <xsl:variable name="levelString">
480 <xsl:choose>
481 <xsl:when test="$docMax = 1">
482 <xsl:text> </xsl:text>
483 <xsl:choose>
484 <xsl:when test="$level = 'Doc'">
485 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document')"/>
486 </xsl:when>
487 <xsl:otherwise>
488 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.section')"/>
489 </xsl:otherwise>
490 </xsl:choose>
491 </xsl:when>
492 <xsl:otherwise>
493 <xsl:text> </xsl:text>
494 <xsl:choose>
495 <xsl:when test="$level = 'Doc'">
496 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document_plural')"/>
497 </xsl:when>
498 <xsl:otherwise>
499 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.section_plural')"/>
500 </xsl:otherwise>
501 </xsl:choose>
502 </xsl:otherwise>
503 </xsl:choose>
504 </xsl:variable>
505 <td id="searchResultsStatusBar">
506 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.displayingnumdocs', concat($startdoc,';', $enddoc, ';', $docMax, ';', $levelString))"/>
507 </td>
508 </xsl:if>
509
510 <!-- Next button -->
511 <td id="nextTD">
512 <xsl:if test="($currentPage * $docsPerPage + 1) &lt; $docMax">
513 <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/paramList/param[@name = 'sa']/@value}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;{$startPageName}={$currentPage + 1}&amp;qs={/page/pageRequest/paramList/param[@name='qs']/@value}">Next</a>
514 </xsl:if>
515 </td>
516 <td id="nextArrowTD">
517 <xsl:if test="($currentPage * $docsPerPage + 1) &lt; $docMax">
518 <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/paramList/param[@name = 'sa']/@value}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;{$startPageName}={$currentPage + 1}&amp;qs={/page/pageRequest/paramList/param[@name='qs']/@value}">
519 <img src="interfaces/default/images/next.png"/>
520 </a>
521 </xsl:if>
522 </td>
523 </tr>
524 </table>
525 </xsl:template>
526
527 <!-- puts all the params into a=p&p=h type form - need to change this if use
528 multi params -->
529 <xsl:template match="paramList" mode="cgi">
530 <xsl:param name="ns">s1.</xsl:param>
531 <xsl:for-each select="param">
532 <xsl:variable name='pname' select="@name"/>
533 <xsl:text>&amp;</xsl:text>
534 <xsl:value-of select="$ns"/>
535 <xsl:value-of select="@name"/>=<xsl:apply-templates select="." mode="calculate-default">
536 <xsl:with-param name='ns' select='$ns'/>
537 </xsl:apply-templates>
538 </xsl:for-each>
539 </xsl:template>
540
541 <xsl:template name="resultsPagePre">
542 <!-- OVERWRITE TO INSERT CONTENT BEFORE THE RESULTS PAGE -->
543 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
544 <xsl:call-template name="mapFeaturesJSONNodes"/>
545 </xsl:if>
546 </xsl:template>
547
548 <xsl:template name="resultsPagePost">
549 <!-- OVERWRITE TO INSERT CONTENT AFTER THE RESULTS PAGE -->
550 </xsl:template>
551
552 <xsl:template name="documentNodePre">
553 <!-- OVERWRITE TO INSERT CONTENT BEFORE EVERY DOCUMENT NODE -->
554 </xsl:template>
555
556 <xsl:template name="documentNodePost">
557 <!-- OVERWRITE TO INSERT CONTENT AFTER EVERY DOCUMENT NODE -->
558 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
559 <xsl:call-template name="mapFeaturesIcon"/>
560 </xsl:if>
561
562 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
563 <xsl:if test=" metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
564 <xsl:call-template name="panoramaViewerFeaturesIcon"/>
565 </xsl:if>
566 </xsl:if>
567
568 </xsl:template>
569
570 <xsl:template name="mapFeaturesJSONNodes">
571 <div id="jsonNodes" style="display:none;">
572 <xsl:text>[</xsl:text>
573 <xsl:for-each select="//documentNode">
574 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
575 <xsl:text>{</xsl:text>
576 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text>
577 <xsl:value-of select="@nodeID"/>
578 <xsl:text disable-output-escaping="yes">",</xsl:text>
579 <xsl:text disable-output-escaping="yes">"title":"</xsl:text>
580 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
581 <xsl:text disable-output-escaping="yes">",</xsl:text>
582 <xsl:text disable-output-escaping="yes">"lat":</xsl:text>
583 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Latitude']"/>
584 <xsl:text>,</xsl:text>
585 <xsl:text disable-output-escaping="yes">"lng":</xsl:text>
586 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
587 <xsl:text>}</xsl:text>
588 <xsl:if test="not(position() = count(//documentNode))">
589 <xsl:text>,</xsl:text>
590 </xsl:if>
591 </xsl:if>
592 </xsl:for-each>
593 <xsl:text>]</xsl:text>
594 </div>
595
596 <div id="map_canvas" style="margin:0px auto; width:450px; height:500px; float:right;">
597 <xsl:text> </xsl:text>
598 </div>
599
600 <!-- Although these aren't visible, they are necessary because it forces Greenstone to include this metadata in the page xml -->
601 <gsf:metadata name="Latitude" hidden="true"/>
602 <gsf:metadata name="Longitude" hidden="true"/>
603 <gsf:metadata name="Image" hidden="true"/>
604 <gsf:metadata name="SourceFile" hidden="true"/>
605 <gsf:metadata name="assocfilepath" hidden="true"/>
606 <gsf:metadata name="PhotoType" hidden="true"/>
607 <gsf:metadata name="cv.rotation" hidden="true"/>
608 <gsf:metadata name="Angle" hidden="true"/>
609
610
611 </xsl:template>
612
613 <xsl:template name="mapFeaturesIcon">
614 <td style="padding-left:5px; padding-right:5px;" valign="top">
615 <a href="javascript:focusDocument('{@nodeID}');">
616 <img src="interfaces/default/images/map_marker.png"/>
617 </a>
618 </td>
619 </xsl:template>
620
621 <xsl:template name="panoramaViewerFeaturesIcon">
622 <td style="padding-left:5px; padding-right:5px;" valign="top">
623 <a href="javascript:switchPanorama('{@nodeID}');">
624 <img src="interfaces/default/images/map_marker.png"/>
625 </a>
626 </td>
627 </xsl:template>
628</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.