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

Last change on this file since 26883 was 26883, checked in by davidb, 9 years ago

Latest round of changes for the panorama viewer

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