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

Last change on this file since 37069 was 37069, checked in by davidb, 16 months ago

Fixed silly typo in allowMapGPSEditing test that made the test go wrong; other changes just white-space differences

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