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

Last change on this file was 38841, checked in by kjdon, 5 weeks ago

when I added a global format statement containing <gsf:link> in it to a collection, the about page crapped out due to variable opt-doc-link-args not being defined. This is used in the replacement xsl for gsf:link. This means that any page could potentially have this problem, so I added the empty default def into header-vars, and removed it from individual page xsl

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