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

Last change on this file since 37091 was 37091, checked in by davidb, 18 months ago

document-vars.xsl a better name for this now that the template rules have been moved back into document.xsl

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