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

Last change on this file since 32832 was 32832, checked in by ak19, 5 years ago

Zeddy map work. 1. Now supports saving when map editor is selected and key s is pressed.. The saved shapes are now reloaded on page (re)load. 2. If you make a change and didn't save it and try to leave the page, there's now a default warning (can't yet control the warning message, but it's helpful enough at this stage). 3. Some more fixes. 4. Some cleaning up of unused code. 5. Still some debugging statements left in, check for console.log() for instance. 6. Gone back to using javascript instead of jQuery for keyboard shortcuts so it will work for PDF docs too, but kept some additional changes made earlier so that things still work on Firefox besides Chrome.

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