source: main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl@ 37782

Last change on this file since 37782 was 37782, checked in by kjdon, 12 months ago

using a js variable now, don't need to pass in isMapGPSEditingAllowed into readyPageForEditing.

File size: 45.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 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:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
8 extension-element-prefixes="java util"
9 exclude-result-prefixes="java util gsf">
10
11 <!-- use the 'main' layout -->
12 <xsl:import href="layouts/main.xsl"/>
13 <xsl:import href="layouts/toc.xsl"/>
14
15 <!-- templates for adding user comments -->
16 <xsl:import href="layouts/usercomments.xsl"/>
17
18 <!-- We technically need this include. However, it is already imported with toc.xsl -->
19 <!-- <xsl:include href="document-shared.xsl" /> -->
20
21 <xsl:include href="pages/document-vars.xsl" />
22
23
24 <!--
25 The 'bookswitch' variable was invented for the Flash-based Realistic Books project:
26
27 * If set to 'on' then this triggers in JavaScript loadBook(), which creates a version
28 of the document URL that sets 'bookswitch; to flashxml (&book=flashxml)
29 The Flash plugin uses this version of the URL to load in the doc for the Flash plugin
30
31 * If not set, then defaults to 'off'
32
33 * Subsequent to its invention for Realistic Books, the book/bookswitch variable has
34 been extended to other alternative (richly interative) views of the document, such
35 as with the Mirador document viewer, for IIIF compliant books
36 -->
37
38 <xsl:variable name="bookswitch">
39 <xsl:choose>
40 <xsl:when test="/page/pageRequest/paramList/param[@name='book']/@value">
41 <xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/>
42 </xsl:when>
43 <xsl:otherwise>off</xsl:otherwise>
44 </xsl:choose>
45 </xsl:variable>
46
47 <xsl:variable name="canDoEditing">
48 <xsl:if test="$isDocumentEditingAllowed = '1' and (/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true' and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor)))">true</xsl:if>
49 </xsl:variable>
50 <xsl:variable name="editingTurnedOn">
51 <xsl:if test="/page/pageRequest/paramList/param[@name='docEdit']/@value = '1'">true</xsl:if>
52 </xsl:variable>
53
54 <!-- optional cgi-params for links to document pages -->
55 <xsl:variable name="opt-doc-link-args"></xsl:variable>
56 <!-- set page title -->
57 <xsl:template name="pageTitle"><gslib:documentTitle/></xsl:template>
58
59 <!-- set page breadcrumbs -->
60 <xsl:template name="breadcrumbs">
61 <gslib:siteLink/><gslib:rightArrow/>
62 <gslib:groupLinks/>
63 <gslib:collectionNameLinked/><gslib:rightArrow/>
64 <a>
65 <xsl:attribute name="href">
66 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/document/<xsl:value-of select="/page/pageResponse/document/documentNode[1]/@nodeID"/>
67 </xsl:attribute>
68 <xsl:variable name="documentTitleVar">
69 <gslib:documentTitle/>
70 </xsl:variable>
71 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.document')"/>
72 </a>
73 </xsl:template>
74
75 <xsl:template match="/">
76 <xsl:choose>
77 <!-- if this is the realistic books version of the page -->
78 <xsl:when test="$bookswitch = 'flashxml'">
79 <html>
80 <body>
81 <xsl:apply-templates select="/page/pageResponse/document"/>
82 </body>
83 </html>
84 </xsl:when>
85 <!-- if this is the regular version of the page -->
86 <xsl:otherwise>
87 <xsl:call-template name="mainTemplate"/>
88 </xsl:otherwise>
89 </xsl:choose>
90 </xsl:template>
91
92 <xsl:template name="documentHeading">
93 <span style="font-weight:bold; font-size: 120%;">
94 <xsl:call-template name="choose-title"/>
95 </span>
96 </xsl:template>
97
98 <!-- content of a simple document. Will not be used for editing mode -->
99 <xsl:template name="documentContent">
100 <div id="gs-document">
101 <xsl:call-template name="documentPre"/>
102 <xsl:call-template name="wrappedSectionImage"/>
103 <div id="gs-document-text">
104 <xsl:call-template name="documentNodeText"/>
105 </div>
106 <xsl:call-template name="documentPost"/>
107 </div>
108 </xsl:template>
109
110 <!-- For symmetry reasons, companion template to wrappedDocumentTopLevel -->
111 <xsl:template name="documentContentTopLevel">
112 <xsl:call-template name="documentContent"/>
113 </xsl:template>
114
115 <xsl:template name="topLevelSectionContent">
116 <xsl:call-template name="wrappedSectionImage"/>
117 <xsl:call-template name="wrappedSectionText"/>
118 </xsl:template>
119
120 <xsl:template name="sectionContent">
121 <xsl:call-template name="wrappedSectionImage"/>
122 <xsl:call-template name="wrappedSectionText"/>
123 </xsl:template>
124
125 <xsl:template name="sectionContentForEditing">
126 <xsl:call-template name="wrappedSectionImage"/>
127 <xsl:call-template name="wrappedSectionTextForEditing"/>
128 </xsl:template>
129
130 <xsl:template name="wrappedSectionText">
131 <!-- <br /><br /> --> <!-- **** better to do with CSS .setionText -->
132
133 <div id="text{@nodeID}" class="sectionText"><!-- *** -->
134 <xsl:attribute name="style">
135 <xsl:choose>
136 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'image'">
137 <xsl:text>display:none;</xsl:text>
138 </xsl:when>
139 <xsl:otherwise>
140 <xsl:text>display:block;</xsl:text>
141 </xsl:otherwise>
142 </xsl:choose>
143 </xsl:attribute>
144 <xsl:call-template name="documentNodeText"/>
145 </div>
146 </xsl:template>
147
148 <xsl:template name="wrappedSectionTextForEditing">
149 <!-- <br /><br /> --> <!-- **** better to do with CSS .sectionText -->
150 <div id="text{@nodeID}" class="sectionText" style="display:block;"><!-- *** -->
151 <xsl:attribute name="contenteditable">
152 <xsl:text>true</xsl:text>
153 </xsl:attribute>
154 <xsl:call-template name="documentNodeTextForEditing"/>
155 </div>
156 </xsl:template>
157
158 <xsl:template name="sectionImage">
159 <gsf:image type="screen"/>
160 </xsl:template>
161
162
163 <!-- Used to make sure that regardless what the collection designer uses for the title and content we can wrap it properly -->
164 <!-- If editing, be aware that the Document Basket looks for specific classes that this template bakes in (key points marked with ***) -->
165 <xsl:template name="wrapDocumentNodes">
166 <xsl:variable name="nodeID" select="@nodeID"/>
167 <a name="{@nodeID}"><xsl:text> </xsl:text></a>
168
169 <!-- Section header -->
170 <table class="sectionHeader"><tr>
171
172 <!-- Expand/collapse button -->
173 <xsl:if test="not(/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='sectionExpandCollapse']/@value) or /page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='sectionExpandCollapse']/@value = 'true'">
174 <td class="headerTD">
175 <img id="dtoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
176 <xsl:attribute name="src">
177 <xsl:choose>
178 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or util:oidIsMatchOrParent($nodeID, /page/pageResponse/document/@selectedNode)">
179 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
180 </xsl:when>
181 <xsl:otherwise>
182 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
183 </xsl:otherwise>
184 </xsl:choose>
185 </xsl:attribute>
186 </img>
187 </td>
188 </xsl:if>
189
190 <!-- Title -->
191 <td id="header{@nodeID}" class="headerTD sectionTitle"><!-- *** -->
192 <p>
193 <xsl:attribute name="class"><xsl:value-of select="util:hashToDepthClass(@nodeID)"/> sectionHeader</xsl:attribute>
194
195 <xsl:if test="util:hashToSectionId(@nodeID)">
196 <span class="sectionNumberSpan">
197 <xsl:value-of select="util:hashToSectionId(@nodeID)"/>
198 <xsl:text> </xsl:text>
199 </span>
200 </xsl:if>
201 <!-- Display the title for the section regardless of whether automatic section numbering is turned on -->
202 <span><xsl:call-template name="sectionHeading"/></span>
203 </p>
204 </td>
205
206 <!-- "back to top" link -->
207 <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle' and not(/page/pageResponse/format[@type='display']/gsf:option[@name='backToTopLinks']) or /page/pageResponse/format[@type='display']/gsf:option[@name='backToTopLinks']/@value='true'">
208 <td class="backToTop headerTD">
209 <a href="javascript:scrollToTop();">
210 <xsl:text disable-output-escaping="yes">&#9650;</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.back_to_top')"/>
211 </a>
212 </td>
213 </xsl:if>
214 </tr></table>
215
216 <div id="doc{@nodeID}"><!-- *** -->
217 <xsl:choose>
218 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or /page/pageResponse/document/@selectedNode = @nodeID">
219 <xsl:attribute name="class">
220 <xsl:text>sectionContainer hasText</xsl:text>
221 </xsl:attribute>
222 <xsl:attribute name="style">
223 <xsl:text>display:block;</xsl:text>
224 </xsl:attribute>
225 </xsl:when>
226 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or util:oidIsMatchOrParent(@nodeID, /page/pageResponse/document/@selectedNode)">
227 <xsl:attribute name="class">
228 <xsl:text>sectionContainer noText</xsl:text>
229 </xsl:attribute>
230 <xsl:attribute name="style">
231 <xsl:text>display:block;</xsl:text>
232 </xsl:attribute>
233 </xsl:when>
234 <xsl:otherwise>
235 <xsl:attribute name="class">
236 <xsl:text>sectionContainer noText</xsl:text>
237 </xsl:attribute>
238 <xsl:attribute name="style">
239 <xsl:text>display:none;</xsl:text>
240 </xsl:attribute>
241 </xsl:otherwise>
242 </xsl:choose>
243
244 <xsl:choose>
245 <xsl:when test="$canDoEditing = 'true' and $editingTurnedOn = 'true'">
246 <table id="meta{@nodeID}">
247 <xsl:attribute name="style">
248 <xsl:choose>
249 <xsl:when test="/page/pageRequest/paramList/param[@name = 'dmd']/@value = 'true'">
250 <xsl:text>display:block;</xsl:text>
251 </xsl:when>
252 <xsl:otherwise>
253 <xsl:text>display:none;</xsl:text>
254 </xsl:otherwise>
255 </xsl:choose>
256 </xsl:attribute>
257 <xsl:value-of select="util:clearMetadataStorage()"/>
258 <xsl:for-each select="metadataList/metadata">
259 <xsl:sort select="@name"/>
260 <tr>
261 <td class="metaTableCellName"><xsl:value-of select="@name"/></td>
262 <td class="metaTableCell"> <textarea autocomplete="off"><xsl:attribute name="class">metaTableCellArea <xsl:value-of select="translate(@name, '.-', '')"/></xsl:attribute><xsl:value-of select="."/></textarea></td>
263 </tr>
264 </xsl:for-each>
265 </table>
266 <xsl:if test="$isMapGPSEditingAllowed = '1'">
267 <div id="map-and-controls-{@nodeID}" tabindex="-1" style="display: none;">
268 <div id="map-{@nodeID}" style="height: 300px;"><xsl:text> </xsl:text></div>
269
270
271 <div id="MapControlPanel-{@nodeID}" class="MapControlPanel">
272 <div id="ControlButtons">
273
274 <button onclick="gsmap_store['map-{@nodeID}'].deleteAllShapes()" >Clear All</button>
275 <button onclick="gsmap_store['map-{@nodeID}'].deleteSelectedShapes()" >Delete Selected</button>
276 <button onclick="gsmap_store['map-{@nodeID}'].mapEditorHistory.undo()" >Undo</button>
277 <button onclick="gsmap_store['map-{@nodeID}'].mapEditorHistory.redo()" >Redo</button>
278 <input type="checkbox" name="draggableCB" id="draggableCB-{@nodeID}" value="false" /> Lock all shapes location <br/>
279 </div>
280
281 <div id="SecondRow">
282 <div id="LineThickness">
283 <p class="valueEditor">Line thickness:
284 <div class="valueChanger">
285 <input type="number" class="valueInput" id="thicknessRangeVal-{@nodeID}" min="1.00" max="5.00" value="1.00" step="0.01" />
286 <span class="unit" style="display:none">%</span>
287 <!-- % sign added above, to keep the thickness field width equal to that of the opacity field -->
288 <!-- setting the step attribute to 0.01 means we allow 2 decimal places
289 (then Firefox won't make the box red/invalid for values with 2 dec places)
290 -->
291 </div>
292 <input type="range" size="2" min="20" max="100" value="1" class="slider" id="thicknessRange-{@nodeID}" />
293 </p>
294 </div>
295
296 <div id="ColourOpacity">
297 <p class="valueEditor">Colour opacity:
298 <div class="valueChanger">
299 <input type="number" class="valueInput" id="opacityRangeVal-{@nodeID}" min="0.0" max="100.0" value="40" />
300 <span class="unit">%</span>
301 </div>
302 <input type="range" min="0" max="100" value="40" class="slider" id="colourOpacity-{@nodeID}" />
303 </p>
304 </div>
305 </div>
306 <div id = "ThirdRow">
307 <div id="FillColour">
308 <p> Fill Colour:</p> <div id="color-palette1-{@nodeID}"><xsl:text> </xsl:text></div>
309 </div>
310 </div>
311 <div id = "FourthRow">
312 <p>Label Text:
313 <input type="text" class="description" id="description-{@nodeID}" value="" />
314 </p>
315 </div>
316
317 </div>
318 <!--
319 <div id="style-selector-control-{@nodeID}" class="map-control">
320 <select id="style-selector-{@nodeID}" class="selector-control">
321 <option value="default" selected="selected">Default</option>
322 <option value="silver">Silver</option>
323 <option value="night">Night mode</option>
324 <option value="retro">Retro</option>
325 <option value="paleDawn">Pale Dawn</option>
326 <option value="avocadoWorld">Avocado World</option>
327 <option value="bright">Bright</option>
328 <option value="turquoise">Turquoise</option>
329 <option value="hiding">Hide features</option>
330 </select>
331 </div>
332 -->
333 </div>
334 </xsl:if>
335 <xsl:call-template name="sectionContentForEditing"/>
336 </xsl:when>
337 <xsl:otherwise>
338 <xsl:choose>
339 <xsl:when test="../../document">
340 <xsl:call-template name="topLevelSectionContent"/>
341 </xsl:when>
342 <xsl:otherwise>
343 <xsl:call-template name="sectionContent"/>
344 </xsl:otherwise>
345 </xsl:choose>
346 </xsl:otherwise>
347 </xsl:choose>
348 <xsl:if test="documentNode">
349 <xsl:for-each select="documentNode">
350 <xsl:call-template name="wrapDocumentNodes"/>
351 </xsl:for-each>
352 </xsl:if>
353 </div>
354 </xsl:template>
355
356 <xsl:template name="javascriptForDocumentView">
357 <script type="text/javascript" src="interfaces/{$interface_name}/js/utility_scripts.js"><xsl:text> </xsl:text></script>
358 <script type="text/javascript" src="interfaces/{$interface_name}/js/document_scripts.js"><xsl:text> </xsl:text></script>
359 <gsf:metadata name="Thumb" hidden="true"/>
360 <script type="text/javascript">
361 <xsl:text disable-output-escaping="yes">
362 function goToAnchor(sectionID,anchor)
363 {
364 var docIdentifier = '</xsl:text><xsl:value-of select="//documentNode[@nodeType = 'root']/@nodeID"/><xsl:text disable-output-escaping="yes">';
365 focusAnchor(docIdentifier + "."+ sectionID,0,1,anchor);
366 }
367 </xsl:text>
368 </script>
369 <xsl:call-template name="customJavascriptForDocumentView"/>
370 </xsl:template>
371
372 <!-- Use this to add in extra javascript/files for an interface, site, collection -->
373 <xsl:template name="customJavascriptForDocumentView">
374 </xsl:template>
375
376 <xsl:template name="javascriptForDocumentEditing">
377 <!-- <script type="text/javascript" src="interfaces/{$interface_name}/js/documentmaker_scripts.js"><xsl:text> </xsl:text></script>-->
378 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentedit_scripts.js"><xsl:text> </xsl:text></script>
379 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentedit_scripts_util.js"><xsl:text> </xsl:text></script>
380 <script type="text/javascript">
381 <xsl:text disable-output-escaping="yes">gs.variables.isMapGPSEditingAllowed = "</xsl:text><xsl:value-of select="$isMapGPSEditingAllowed"/><xsl:text disable-output-escaping="yes">";</xsl:text></script>
382 <xsl:if test="$isMapGPSEditingAllowed = '1'">
383
384 <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor-history.js"><xsl:text> </xsl:text></script>
385 <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor-themes.js"><xsl:text> </xsl:text></script>
386 <!-- LEAVE THIS NEXT LINE IN, IF USING CUSTOM OVERLAYS TO SHOW LABELS ON THE MAP -->
387 <!--<script type="text/javascript" src="interfaces/{$interface_name}/js/label-overlay-class.js"><xsl:text> </xsl:text></script>-->
388 <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor.js"><xsl:text> </xsl:text></script>
389 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentedit_scripts_maps.js"><xsl:text> </xsl:text></script>
390
391 <link rel="stylesheet" href="interfaces/{$interface_name}/style/map-editors.css" type="text/css"/>
392 </xsl:if>
393
394 <script type="text/javascript" src="interfaces/{$interface_name}/js/hierarchy.js"><xsl:text> </xsl:text></script>
395
396
397 <script type="text/javascript">
398 <xsl:text disable-output-escaping="yes">
399
400 $(window).on("load", function()
401 {
402 if(gs.cgiParams.docEdit == "1")
403 {
404 readyPageForEditing();
405 }
406 });
407 </xsl:text>
408 <!-- download and process hierarchy files -->
409 <xsl:text disable-output-escaping="yes">$(document).ready(function(){</xsl:text>
410 <xsl:for-each select="//classifier[@hfile]">
411 <xsl:if test="@hfile != ''">
412 <xsl:text disable-output-escaping="yes">downloadAndProcessHierarchyFile('</xsl:text>
413 <xsl:text>sites/localsite/collect/</xsl:text><xsl:value-of select="$collName"/><xsl:text>/etc/</xsl:text><xsl:value-of select="@hfile"/>
414 <xsl:text disable-output-escaping="yes">','</xsl:text><xsl:value-of select="@metadata"/><xsl:text disable-output-escaping="yes">');</xsl:text>
415 </xsl:if>
416 </xsl:for-each>
417 <xsl:text disable-output-escaping="yes">});</xsl:text>
418
419 </script>
420 <xsl:call-template name="customJavascriptForDocumentEditing"/>
421 </xsl:template>
422
423 <!-- Use this to add in extra javascript/files for an interface, site, collection -->
424 <xsl:template name="customJavascriptForDocumentEditing">
425 </xsl:template>
426
427 <!-- the page content -->
428 <xsl:template match="/page/pageResponse/document">
429 <xsl:if test="$bookswitch = 'off' or ($bookswitch != 'on' and $bookswitch != 'flashxml')"> <!-- true when bookswitch=mirador, for example -->
430 <xsl:call-template name="javascriptForDocumentView"/>
431 <gslib:langfrag name="doc"/>
432 <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
433 <script type="text/javascript">
434 <xsl:text disable-output-escaping="yes">
435 if(document.URL.indexOf("book=on") != -1)
436 {
437 loadBook();
438 }
439 </xsl:text>
440 </script>
441 </xsl:if>
442 </xsl:if>
443 <xsl:if test="$canDoEditing = 'true'">
444 <xsl:call-template name="javascriptForDocumentEditing"/>
445 <gslib:langfrag name="dse"/>
446 <gslib:langfrag name="de"/>
447 </xsl:if>
448
449 <xsl:if test="$bookswitch = 'off' or ($bookswitch != 'on' and $bookswitch != 'flashxml')">
450 <div id="bookdiv" style="visibility:hidden; height:0px; display:inline;"><xsl:text> </xsl:text></div>
451
452 <div id="float-anchor" style="width: 30%; min-width:180px; float:right; margin: 0 0 10px 20px;">
453 <xsl:if test="$canDoEditing = 'true'">
454 <xsl:call-template name="editBar"/>
455 </xsl:if>
456 <xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='sideBar']) or /page/pageResponse/format[@type='display']/gsf:option[@name='sideBar']/@value='true'">
457 <xsl:call-template name="rightSidebarTOC"/>
458 </xsl:if>
459 <!-- add in some text just in case nothing has been added to this div-->
460 <xsl:text> </xsl:text>
461 </div>
462 <xsl:if test="$canDoEditing = 'true'">
463 <script type="text/javascript">
464 if (keep_editing_controls_visible) {
465 $(function() {
466 moveScroller();
467 });
468 }
469 </script>
470 </xsl:if>
471 </xsl:if>
472
473 <!-- display the document -->
474 <xsl:choose>
475 <xsl:when test="@external != ''">
476 <xsl:call-template name="externalPage">
477 <xsl:with-param name="external" select="@external"/>
478 </xsl:call-template>
479 </xsl:when>
480 <xsl:when test="$bookswitch = 'flashxml'">
481 <xsl:call-template name="documentNodeFlashXML"/>
482 </xsl:when>
483 <xsl:when test="$bookswitch = 'on'">
484 <div id="bookdiv" style="display:inline;"><xsl:text> </xsl:text></div>
485 <script type="text/javascript">
486 <xsl:text disable-output-escaping="yes">
487 if(document.URL.indexOf("book=on") != -1)
488 {
489 <!-- in document_scripts.js -->
490 loadBook();
491 }
492 </xsl:text>
493 </script>
494 </xsl:when>
495 <!-- we want to do this stuff even if docType is simple or paged. Don't want to just set dt=hierarchy as that gives other unnecessary stuff-->
496 <!-- This is the first choice from wrappedDocument template-->
497 <xsl:when test="$canDoEditing = 'true' and $editingTurnedOn = 'true' ">
498 <div id="gs-document" style="width: 67%">
499 <xsl:call-template name="documentPre"/>
500 <div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
501 <xsl:choose>
502 <xsl:when test="@docType='simple'">
503 <xsl:call-template name="wrapDocumentNodes"/>
504 </xsl:when>
505 <xsl:otherwise>
506 <xsl:for-each select="documentNode">
507 <xsl:call-template name="wrapDocumentNodes"/>
508 </xsl:for-each>
509 </xsl:otherwise>
510 </xsl:choose>
511 </div>
512 <xsl:call-template name="documentPost"/>
513 </div>
514 </xsl:when>
515 <xsl:when test="@docType='simple'">
516 <xsl:call-template name="documentHeading"/><br/>
517 <xsl:call-template name="documentContentTopLevel"/>
518 <br /><xsl:call-template name="userCommentsSection"/>
519 </xsl:when>
520 <xsl:otherwise> <!-- display the standard greenstone document -->
521 <xsl:call-template name="wrappedDocumentTopLevel"/>
522 <br /><xsl:call-template name="userCommentsSection"/>
523 </xsl:otherwise>
524 </xsl:choose>
525 </xsl:template>
526
527 <xsl:template name="wrappedDocument">
528 <xsl:choose>
529 <!-- NOTE: alb = ajax load bypass -->
530 <!--
531 If we have asked for expanded document, then do this.
532 OR If the docType is hierarchy and we want to bypass the ajax load then do this
533 OR If the docType is hierarchy and we have asked for the top level document then do this
534 -->
535 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or (/page/pageResponse/document/@docType = 'hierarchy' and (/page/pageRequest/paramList/param[@name = 'alb']/@value = '1' or (string-length(/page/pageRequest/paramList/param[@name = 'd']/@value) > 0 and not(util:contains(/page/pageResponse/document/@selectedNode, '.')))))">
536 <div id="gs-document">
537 <xsl:call-template name="documentPre"/>
538 <div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
539 <xsl:for-each select="documentNode">
540 <xsl:call-template name="wrapDocumentNodes"/>
541 </xsl:for-each>
542 </div>
543 <xsl:call-template name="documentPost"/>
544 </div>
545 </xsl:when>
546 <xsl:when test="/page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'">
547 <div id="gs-document">
548 <div id="tocLoadingImage" style="text-align:center;">
549 <img src="{util:getInterfaceText($interface_name, /page/@lang, 'loading_image')}"/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.loading')"/><xsl:text>...</xsl:text>
550 </div>
551 </div>
552 <script type="text/javascript">
553 <xsl:text disable-output-escaping="yes">
554 $(window).on("load", function()
555 {
556 var sectionID = gs.cgiParams.d;
557 var callbackFunction = null;
558 if(sectionID.indexOf(".") != -1)
559 {
560 callbackFunction = function()
561 {
562 focusSection(sectionID);
563 };
564 }
565 else {
566 callbackFunction = function()
567 {
568
569 expandAndExecute(sectionID+".1", null, null, null);
570 };
571 }
572 var docID = sectionID.replace(/([^.]*)\..*/, "$1");
573 var url = gs.xsltParams.library_name + "?a=d&amp;c=" + gs.cgiParams.c + "&amp;excerptid=gs-document&amp;dt=hierarchy&amp;d=" + docID;
574 if(gs.cgiParams.p_s) {
575 url += "&amp;p.s="+gs.cgiParams.p_s;
576 }
577 loadTopLevelPage(callbackFunction, url);
578 });
579 </xsl:text>
580 </script>
581 </xsl:when>
582 <xsl:otherwise>
583 <div id="gs-document">
584 <div id="tocLoadingImage" style="text-align:center;">
585 <img src="{util:getInterfaceText($interface_name, /page/@lang, 'loading_image')}"/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.loading')"/><xsl:text>...</xsl:text>
586 </div>
587 </div>
588 <script type="text/javascript">
589 <xsl:text disable-output-escaping="yes">
590 $(window).on("load", function()
591 {
592 loadTopLevelPage(function()
593 {
594 //Don't focus the section until the table of contents is loaded
595 var tocCheck = function()
596 {
597 if(gs.variables.tocLoaded)
598 {
599 focusSection("</xsl:text><xsl:value-of select="/page/pageResponse/document/@selectedNode"/><xsl:text disable-output-escaping="yes">");
600 }
601 else
602 {
603 setTimeout(tocCheck, 500);
604 }
605 }
606 tocCheck();
607 });
608 });
609 </xsl:text>
610 </script>
611 </xsl:otherwise>
612 </xsl:choose>
613
614 <div class="clear"><xsl:text> </xsl:text></div>
615 </xsl:template>
616
617 <!--
618 The follow is a useful template to redefine in an interface/site/collection
619 through which extra tests can be introduced to drive new document displays,
620 such as the IIIF Manifest based Mirador viewer
621 -->
622 <xsl:template name="wrappedDocumentTopLevel">
623 <xsl:call-template name="wrappedDocument"/>
624 </xsl:template>
625
626 <xsl:template name="editBar">
627 <table style="width:100%; border:none;" id="editBar" class="ui-widget-content"><tr>
628 <td id="editBarLeft" style="width:70%"><xsl:text> </xsl:text></td>
629 <td id="editBarRight">
630 <div style="text-align:center;">
631 <!-- edit structure button -->
632 <!-- comment this out as its not working -->
633 <!-- <div style="margin:5px;" class="ui-state-default ui-corner-all">
634 <a style="padding: 3px; text-decoration:none;" href="{$library_name}?a=g&amp;sa=documentbasket&amp;c=&amp;s=DisplayDocumentList&amp;rt=r&amp;p.c={/page/pageResponse/collection/@name}&amp;docToEdit={/page/pageResponse/document/documentNode/@nodeID}"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.edit_structure')"/></a>
635 </div>-->
636 <!-- edit content button -->
637 <div style="margin:5px;" class="ui-state-default ui-corner-all">
638 <a id="editContentButton" style="padding: 3px; text-decoration:none;">
639 <xsl:attribute name="href">
640 <xsl:value-of select="$library_name"/>
641 <xsl:text>/collection/</xsl:text>
642 <xsl:value-of select="$collName"/>
643 <xsl:text>/document/</xsl:text>
644 <xsl:choose>
645 <xsl:when test="count(//documentNode) > 0">
646 <xsl:value-of select="/page/pageResponse/document/documentNode/@nodeID"/>
647 </xsl:when>
648 <xsl:otherwise>
649 <xsl:value-of select="/page/pageResponse/document/@nodeID"/>
650 </xsl:otherwise>
651 </xsl:choose>
652 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1')">
653 <xsl:text>?ed=1&amp;docEdit=1</xsl:text>
654 </xsl:if>
655 </xsl:attribute>
656 <xsl:choose>
657 <xsl:when test="/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1'">
658 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.hide_editor')"/>
659 </xsl:when>
660 <xsl:otherwise>
661 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.edit_content')"/>
662 </xsl:otherwise>
663 </xsl:choose>
664 </a>
665 </div>
666 </div>
667 </td>
668 </tr></table>
669 <gslib:langfrag name="dse"/>
670 </xsl:template>
671
672 <xsl:template name="wrappedSectionImage">
673 <gsf:variable name="screenImageWidth"><gsf:metadata name="ScreenWidth"/></gsf:variable>
674 <gsf:variable name="screenImageHeight"><gsf:metadata name="ScreenHeight"/></gsf:variable>
675 <gsf:variable name="imageWidth"><gsf:metadata name="ImageWidth"/></gsf:variable>
676 <gsf:variable name="imageHeight"><gsf:metadata name="ImageHeight"/></gsf:variable>
677 <gsf:variable name="docNodeID"><xsl:value-of select="@nodeID"/></gsf:variable> <!-- used to make each 'tidyDiv' unique -->
678
679 <xsl:choose>
680 <!-- **** Should the test of 'Source' perhaps be changed to 'Image' to be more consistent with usage else where for showing an web friendy Image-->
681 <xsl:when test="metadataList/metadata[@name = 'Screen'] and (metadataList/metadata[@name = 'Source'] or metadataList/metadata[@name = 'Image']) and ($imageWidth div $screenImageWidth > 1.2) and (not(/page/pageResponse/format[@type='display']/gsf:option[@name='disableZoom']) or /page/pageResponse/format[@type='display']/gsf:option[@name='disableZoom']/@value='false')">
682 <gsf:div id="tidyDiv-{@nodeID}" />
683 <!-- adding a div with clear:both when the image doesn't nicely fit in beside the side bar. Otherwise, the divs stays up, but the image moves down and everything looks and acts weird. -->
684 <script type="text/javascript">
685 <xsl:text disable-output-escaping="yes">
686
687 var containerWidth = document.getElementById("container").offsetWidth;
688 var rightSidebar = document.getElementById("rightSidebar");
689 if (rightSidebar) {
690 var rightSidebarWidth = rightSidebar.offsetWidth;
691 if (containerWidth - rightSidebarWidth &lt; </xsl:text><xsl:value-of select="$screenImageWidth"/><xsl:text disable-output-escaping="yes">) {
692 $("#tidyDiv-"+gs.variables.docNodeID).css("clear", "both");
693 }
694 }
695 </xsl:text>
696 </script>
697 <gsf:div id="image{@nodeID}">
698 <!-- when we ask for an individual section content we set ed=1. putting this test here prevents downloading all the screen and full images for each section of the document when we are just looking at the contents list. ed is not set for simple docs, so do this if doctype is simple -->
699 <xsl:if test="/page/pageResponse/document[@docType='simple'] or /page/pageRequest/paramList/param[@name = 'ed']/@value='1'">
700
701 <div id="wrap{util:replace(@nodeID, '.', '_')}" class="zoomImage" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
702 <div id="small{util:replace(@nodeID, '.', '_')}" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
703 <gsf:link type="source" target="_blank"><gsf:image type="screen"/></gsf:link>
704 </div>
705 <div id="mover{util:replace(@nodeID, '.', '_')}" style="border: 1px solid green; position: absolute; top: 0; left: 0; width: 598px; height: 598px; overflow: hidden; z-index: 100; background: white; display: none;">
706 <div id="overlay{util:replace(@nodeID, '.', '_')}" style="width: 600px; height: 600px; position: absolute; top: 0; left: 0; z-index: 200;">
707 <xsl:text> </xsl:text>
708 </div>
709 <div id="large{util:replace(@nodeID, '.', '_')}" style="position: relative; width: {$imageWidth}px; height: {$imageHeight}px;">
710 <gsf:link type="source"><gsf:image type="image"/></gsf:link>
711 </div>
712 </div>
713 </div>
714 <script type="text/javascript">
715 <xsl:text disable-output-escaping="yes">
716 {
717 var nodeID = "</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">";
718 nodeID = nodeID.replace(/\./g, "_");
719
720 var bigHeight = </xsl:text><xsl:value-of select="$imageHeight"/><xsl:text disable-output-escaping="yes">;
721 var smallHeight = </xsl:text><xsl:value-of select="$screenImageHeight"/><xsl:text disable-output-escaping="yes">;
722
723 var multiplier = bigHeight / smallHeight;
724
725 $("#wrap" + nodeID).anythingZoomer({
726 smallArea: "#small" + nodeID,
727 largeArea: "#large" + nodeID,
728 zoomPort: "#overlay" + nodeID,
729 mover: "#mover" + nodeID,
730 expansionSize:50,
731 speedMultiplier:multiplier
732 });
733
734 $("#zoomOptions input").prop("checked", false);
735 $("#zoomOptions").css("display", "");
736 }
737 </xsl:text>
738 </script>
739 </xsl:if>
740 </gsf:div>
741 </xsl:when>
742 <xsl:otherwise>
743 <gsf:div id="image{@nodeID}">
744 <xsl:attribute name="style">
745 <xsl:choose>
746 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
747 <xsl:text>display:none;</xsl:text>
748 </xsl:when>
749 <xsl:otherwise>
750 <xsl:text>display:block;</xsl:text>
751 </xsl:otherwise>
752 </xsl:choose>
753 </xsl:attribute>
754 <xsl:call-template name="sectionImage"/><xsl:text> </xsl:text>
755 </gsf:div>
756 </xsl:otherwise>
757 </xsl:choose>
758 </xsl:template>
759
760 <!-- The default template for displaying the document node text -->
761 <!-- equivalent to gsf:text -->
762 <xsl:template name="documentNodeText">
763 <xsl:param name="force">0</xsl:param>
764 <!-- Hides the "This document has no text." message -->
765 <xsl:variable name="noText"><gsf:metadata name="NoText"/></xsl:variable>
766 <xsl:choose>
767 <xsl:when test="$force = '1' or not($noText = '1')">
768
769 <!-- Section text -->
770 <xsl:for-each select="nodeContent">
771 <xsl:call-template name="displayMarkedUpTextAndAnnotations"/>
772 </xsl:for-each>
773 </xsl:when>
774 <xsl:when test="$noText = '1' and not(metadataList/metadata[@name='ImageType'])">
775 <gsf:link type="source"><gsf:metadata name="Source"/></gsf:link>
776 </xsl:when>
777 </xsl:choose>
778 <xsl:text> </xsl:text>
779 </xsl:template>
780
781 <!-- The default template for displaying the document node text in
782 editing mode -->
783 <!-- Note: we need to put some content in if the nodeContent is empty, otherwise you end up with an empty div, it gets changed to <div> and the ckeditor ends up being attached to everything else afterwards. -->
784 <!-- equivalent to gsf:text -->
785 <xsl:template name="documentNodeTextForEditing">
786 <!-- Section text -->
787 <xsl:for-each select="nodeContent">
788 <xsl:if test="not(node())"><gsf:space/></xsl:if>
789 <xsl:for-each select="node()">
790 <xsl:choose>
791 <xsl:when test="not(name())">
792 <xsl:value-of select="." disable-output-escaping="yes"/>
793 </xsl:when>
794 <xsl:otherwise>
795 <xsl:apply-templates/>
796 </xsl:otherwise>
797 </xsl:choose>
798 </xsl:for-each>
799 </xsl:for-each>
800 </xsl:template>
801
802 <!-- Used to produce a version of the page in a format that can be read by the realistic books plugin -->
803 <xsl:template name="documentNodeFlashXML">
804 <xsl:text disable-output-escaping="yes">
805 &lt;Section&gt;
806 &lt;Description&gt;
807 &lt;Metadata name="Title"&gt;
808 </xsl:text>
809 <xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/>
810 <xsl:text disable-output-escaping="yes">
811 &lt;/Metadata&gt;
812 &lt;/Description&gt;
813 </xsl:text>
814
815 <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
816
817 <xsl:for-each select="documentNode">
818 <xsl:call-template name="documentNodeFlashXML"/>
819 </xsl:for-each>
820
821 <xsl:text disable-output-escaping="yes">
822 &lt;/Section&gt;
823 </xsl:text>
824 </xsl:template>
825
826 <xsl:template name="externalPage">
827 <xsl:param name="external"/>
828 <xsl:variable name="go_forward_link">
829 <a>
830 <xsl:attribute name="href">
831 <xsl:value-of select="$external"/>
832 </xsl:attribute>
833 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/>
834 </a>
835 </xsl:variable>
836 <h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
837 <p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/></p>
838 </xsl:template>
839
840 <xsl:template match="/page"><gslib:displayErrorsIfAny/><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
841
842 <xsl:template name="documentPre">
843 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
844 <xsl:call-template name="mapFeatures"/>
845 </xsl:if>
846 </xsl:template>
847
848 <xsl:template name="documentPost">
849 <!-- empty by default, to be overridden as needed -->
850 </xsl:template>
851
852
853 <xsl:template name="mapFeatures">
854 <div id="map_canvas" class="map_canvas_full"><xsl:text> </xsl:text></div>
855
856 <xsl:choose>
857 <!-- HIERARCHICAL DOCUMENTS -->
858 <xsl:when test="count(//documentNode) > 0">
859 <xsl:for-each select="documentNode">
860 <xsl:call-template name="mapPlacesNearHere"/>
861 </xsl:for-each>
862 </xsl:when>
863 <!-- SIMPLE DOCUMENTS -->
864 <xsl:otherwise>
865 <xsl:call-template name="mapPlacesNearHere"/>
866 </xsl:otherwise>
867 </xsl:choose>
868
869 <div id="jsonNodes" style="display:none;">
870 <xsl:text>[</xsl:text>
871 <xsl:choose>
872 <!-- HIERARCHICAL DOCUMENTS -->
873 <xsl:when test="count(//documentNode) > 0">
874 <xsl:for-each select="//documentNode">
875 <xsl:if test="(metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']) or metadataList/metadata[@name = 'Coordinate'] or metadataList/metadata[@name = 'GPS.mapOverlay'] or metadataList/metadata[@name = 'descendants_GPS.mapOverlay']">
876 <xsl:text>{</xsl:text>
877 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">",</xsl:text>
878 <xsl:text disable-output-escaping="yes">"title":"</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
879 <xsl:text disable-output-escaping="yes">"</xsl:text>
880 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
881 <xsl:text disable-output-escaping="yes">,</xsl:text>
882 <xsl:text disable-output-escaping="yes">"lat":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Latitude']"/><xsl:text>,</xsl:text>
883 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
884 </xsl:if>
885 <!--
886 <xsl:if test="metadataList/metadata[@name = 'Coordinate']">
887 <xsl:text disable-output-escaping="yes">,</xsl:text>
888 <xsl:text disable-output-escaping="yes">"coords":</xsl:text>
889 <xsl:text>[</xsl:text>
890 <xsl:for-each select="metadataList/metadata[@name = 'Coordinate']">
891 <xsl:text disable-output-escaping="yes">"</xsl:text>
892 <xsl:value-of disable-output-escaping="yes" select="current()"/>
893 <xsl:text disable-output-escaping="yes">"</xsl:text>
894 <xsl:text disable-output-escaping="yes">,</xsl:text>
895 </xsl:for-each>
896 <xsl:text>]</xsl:text>
897 </xsl:if>
898 -->
899 <xsl:if test="metadataList/metadata[@name = 'GPS.mapOverlay']">
900 <xsl:text disable-output-escaping="yes">,</xsl:text>
901 <xsl:text disable-output-escaping="yes">"mapoverlay":</xsl:text>
902 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'GPS.mapOverlay']"/>
903 </xsl:if>
904
905 <xsl:if test="metadataList/metadata[@name = 'descendants_GPS.mapOverlay']">
906 <xsl:variable name="count"><xsl:value-of select="count(metadataList/metadata[@name = 'descendants_GPS.mapOverlay'])"/></xsl:variable>
907 <xsl:text disable-output-escaping="yes">,</xsl:text>
908 <xsl:text disable-output-escaping="yes">"descendantsMapoverlays":[</xsl:text>
909 <xsl:for-each select="metadataList/metadata[@name = 'descendants_GPS.mapOverlay']">
910 <xsl:value-of disable-output-escaping="yes" select="current()"/>
911 <xsl:if test="not(position() = $count)">
912 <xsl:text disable-output-escaping="yes">,</xsl:text>
913 </xsl:if>
914 </xsl:for-each>
915 <xsl:text disable-output-escaping="yes">]</xsl:text>
916 </xsl:if>
917
918 <xsl:text>}</xsl:text>
919
920 <xsl:if test="not(position() = count(//documentNode))">
921 <xsl:text>,</xsl:text>
922 </xsl:if>
923
924 </xsl:if>
925 </xsl:for-each>
926 </xsl:when>
927 <!-- SIMPLE DOCUMENTS -->
928 <xsl:otherwise>
929 <xsl:for-each select="/page/pageResponse/document">
930 <xsl:if test="(metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']) or metadataList/metadata[@name = 'Coordinate'] or metadataList/metadata[@name = 'GPS.mapOverlay'] or metadataList/metadata[@name = 'descendants_GPS.mapOverlay']">
931 <xsl:text>{</xsl:text>
932 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@selectedNode"/><xsl:text disable-output-escaping="yes">",</xsl:text>
933 <xsl:text disable-output-escaping="yes">"title":"</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
934 <xsl:text disable-output-escaping="yes">"</xsl:text>
935 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
936 <xsl:text disable-output-escaping="yes">,</xsl:text>
937 <xsl:text disable-output-escaping="yes">"lat":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Latitude']"/><xsl:text>,</xsl:text>
938 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
939 </xsl:if>
940 <!--
941 <xsl:if test="metadataList/metadata[@name = 'Coordinate']">
942 <xsl:text disable-output-escaping="yes">,</xsl:text>
943 <xsl:text disable-output-escaping="yes">"coords":</xsl:text>
944 <xsl:text>[</xsl:text>
945 <xsl:for-each select="metadataList/metadata[@name = 'Coordinate']">
946 <xsl:text disable-output-escaping="yes">"</xsl:text>
947 <xsl:value-of disable-output-escaping="yes" select="current()"/>
948 <xsl:text disable-output-escaping="yes">"</xsl:text>
949 <xsl:text disable-output-escaping="yes">,</xsl:text>
950 </xsl:for-each>
951 <xsl:text>]</xsl:text>
952 </xsl:if>
953 -->
954 <xsl:if test="metadataList/metadata[@name = 'GPS.mapOverlay']">
955 <xsl:text disable-output-escaping="yes">,</xsl:text>
956 <xsl:text disable-output-escaping="yes">"mapoverlay":</xsl:text>
957 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'GPS.mapOverlay']"/>
958 </xsl:if>
959
960 <xsl:if test="metadataList/metadata[@name = 'descendants_GPS.mapOverlay']">
961 <xsl:variable name="count"><xsl:value-of select="count(metadataList/metadata[@name = 'descendants_GPS.mapOverlay'])"/></xsl:variable>
962 <xsl:text disable-output-escaping="yes">,</xsl:text>
963 <xsl:text disable-output-escaping="yes">"descendantsMapoverlays":[</xsl:text>
964 <xsl:for-each select="metadataList/metadata[@name = 'descendants_GPS.mapOverlay']">
965 <xsl:value-of disable-output-escaping="yes" select="current()"/>
966 <xsl:if test="not(position() = $count)">
967 <xsl:text disable-output-escaping="yes">,</xsl:text>
968 </xsl:if>
969 </xsl:for-each>
970 <xsl:text disable-output-escaping="yes">]</xsl:text>
971 </xsl:if>
972
973 <xsl:text>}</xsl:text>
974 </xsl:if>
975 </xsl:for-each>
976 </xsl:otherwise>
977 </xsl:choose>
978 <xsl:text>]</xsl:text>
979 </div>
980
981 <!-- TODO: Why do we have to do this to see Coordinate meta appear in extraMetadataList on o=xml page, when Lat and Lng appear without doing the same???
982 Furthermore, map-tools.xsl already requests Coordinate meta, and map-tools.xsl is always included when format statement for collection in
983 search|browse|doc display view has mapEnabled=true -->
984 <gsf:metadata name="Coordinate" hidden="true"/>
985 <gsf:metadata name="GPS.mapOverlay" hidden="true"/>
986 <gsf:metadata name="GPS.mapOverlay" select="descendants" hidden="true"/>
987 </xsl:template>
988
989 <xsl:template name="mapPlacesNearHere">
990 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
991 <div style="background:#BBFFBB; padding: 5px; margin:0px auto; width:890px;">
992 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.map_nearby_docs')"/>
993 <img id="nearbyDocumentsToggle" style="margin-left:5px;" src="interfaces/{$interface_name}/images/expand.png">
994 <xsl:attribute name="onclick">
995 <xsl:text>performDistanceSearch('</xsl:text>
996 <xsl:value-of select="@nodeID"/>
997 <xsl:text>', '</xsl:text>
998 <gsf:metadata name="Latitude"/>
999 <xsl:text>', '</xsl:text>
1000 <gsf:metadata name="Longitude"/>
1001 <xsl:text>', 2);</xsl:text>
1002 </xsl:attribute>
1003 </img>
1004 <div id="nearbyDocuments"><xsl:text> </xsl:text></div>
1005 </div>
1006 </xsl:if>
1007
1008 <xsl:if test="metadataList/metadata[@name = 'Coordinate']">
1009 <div style="background:#BBFFBB; padding: 5px; margin:0px auto; width:890px;">
1010 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.map_nearby_docs')"/>
1011 <xsl:for-each select="metadataList/metadata[@name = 'Coordinate']">
1012
1013 <xsl:variable name="coordinate"><xsl:value-of select="current()"/></xsl:variable>
1014
1015
1016 <img id="nearbyDocumentsToggle" style="margin-left:5px;" src="interfaces/{$interface_name}/images/expand.png">
1017 <xsl:attribute name="onclick">
1018 <xsl:text>performDistanceSearchWithCoordinates('</xsl:text>
1019 <xsl:value-of select="@nodeID"/>
1020 <xsl:text>', '</xsl:text>
1021 <xsl:value-of select="$coordinate"/><!--<gsf:metadata name="Coordinate"/>-->
1022 <xsl:text>', 2);</xsl:text>
1023 </xsl:attribute>
1024 </img>
1025 </xsl:for-each>
1026 <div id="nearbyDocuments"><xsl:text> </xsl:text></div>
1027 </div>
1028 </xsl:if>
1029 </xsl:template>
1030</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.