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

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

Martin's Map Editor commits. First phase of Dr Bainbridge's requests: 1. shape colour controls are no longer 2 lines, merged into one. This was a fix to the css file. 2. Removed the themes dropdown menu. 3. Moved the thickness and opacity sliders' value display from a 2nd row to just in front of their sliders (and percent sign is now sensibly placed AFTER the number). Future commits to contain input fields for thickness and opacity sliders.

File size: 37.4 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:
250 <span id="thicknessRangeVal-{@nodeID}">1.00</span>
251 <!--<input id="thicknessRangeVal-{@nodeID}" type="number" min="1.00" max="5.00" value="1.00" />-->
252 <input type="range" min="20" max="100" value="1" class="slider" id="thicknessRange-{@nodeID}" />
253 </p>
254 <!-- <p>Value: </p> -->
255 </div>
256
257 <div id="ColourOpacity">
258 <p>Colour opacity:
259 <span id="opacityRangeVal-{@nodeID}">1.0</span>
260 <input type="range" min="10" max="100" value="40" class="slider" id="colourOpacity-{@nodeID}" />
261 </p>
262 <!-- <p>Value: </p> -->
263 </div>
264 </div>
265 <div id = "ThirdRow">
266 <div id="FillColour">
267 <p> Fill Colour:</p> <div id="color-palette1-{@nodeID}"><xsl:text> </xsl:text></div>
268 </div>
269 </div>
270 </div>
271 <!--
272 <div id="style-selector-control-{@nodeID}" class="map-control">
273 <select id="style-selector-{@nodeID}" class="selector-control">
274 <option value="default" selected="selected">Default</option>
275 <option value="silver">Silver</option>
276 <option value="night">Night mode</option>
277 <option value="retro">Retro</option>
278 <option value="paleDawn">Pale Dawn</option>
279 <option value="avocadoWorld">Avocado World</option>
280 <option value="bright">Bright</option>
281 <option value="turquoise">Turquoise</option>
282 <option value="hiding">Hide features</option>
283 </select>
284 </div>
285 -->
286
287 </div>
288
289 <xsl:call-template name="sectionContentForEditing"/>
290 </xsl:when>
291 <xsl:otherwise>
292 <xsl:choose>
293 <xsl:when test="../../document">
294 <xsl:call-template name="topLevelSectionContent"/>
295 </xsl:when>
296 <xsl:otherwise>
297 <xsl:call-template name="sectionContent"/>
298 </xsl:otherwise>
299 </xsl:choose>
300 </xsl:otherwise>
301 </xsl:choose>
302 <xsl:if test="documentNode">
303 <xsl:for-each select="documentNode">
304 <xsl:call-template name="wrapDocumentNodes"/>
305 </xsl:for-each>
306 </xsl:if>
307 </div>
308 </xsl:template>
309
310 <xsl:template name="javascriptForDocumentView">
311 <script type="text/javascript" src="interfaces/{$interface_name}/js/utility_scripts.js"><xsl:text> </xsl:text></script>
312 <script type="text/javascript" src="interfaces/{$interface_name}/js/document_scripts.js"><xsl:text> </xsl:text></script>
313 <gsf:metadata name="Thumb" hidden="true"/>
314 <script type="text/javascript">
315 <xsl:text disable-output-escaping="yes">
316 function goToAnchor(sectionID,anchor)
317 {
318 var docIdentifier = '</xsl:text><xsl:value-of select="//documentNode[@nodeType = 'root']/@nodeID"/><xsl:text disable-output-escaping="yes">';
319 focusAnchor(docIdentifier + "."+ sectionID,0,1,anchor);
320 }
321 </xsl:text>
322 </script>
323 <xsl:call-template name="customJavascriptForDocumentView"/>
324 </xsl:template>
325
326 <!-- Use this to add in extra javascript/files for an interface, site, collection -->
327 <xsl:template name="customJavascriptForDocumentView">
328 </xsl:template>
329
330 <xsl:template name="javascriptForDocumentEditing">
331 <!-- <script type="text/javascript" src="interfaces/{$interface_name}/js/documentmaker_scripts.js"><xsl:text> </xsl:text></script>-->
332 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentedit_scripts.js"><xsl:text> </xsl:text></script>
333 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentedit_scripts_util.js"><xsl:text> </xsl:text></script>
334 <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-shapes-util.js"><xsl:text> </xsl:text></script>
335 <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor-history.js"><xsl:text> </xsl:text></script>
336 <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor-themes.js"><xsl:text> </xsl:text></script>
337 <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor.js"><xsl:text> </xsl:text></script>
338 <script type="text/javascript" src="interfaces/{$interface_name}/js/hierarchy.js"><xsl:text> </xsl:text></script>
339
340 <link rel="stylesheet" href="interfaces/{$interface_name}/style/map-editors.css" type="text/css"/>
341
342 <script type="text/javascript">
343 <xsl:text disable-output-escaping="yes">
344
345 $(window).load(function()
346 {
347 if(gs.cgiParams.docEdit == "1")
348 {
349 readyPageForEditing();
350 }
351 });
352 </xsl:text>
353 <!-- download and process hierarchy files -->
354 <xsl:text disable-output-escaping="yes">$(document).ready(function(){</xsl:text>
355 <xsl:for-each select="//classifier[@hfile]">
356 <xsl:if test="@hfile != ''">
357 <xsl:text disable-output-escaping="yes">downloadAndProcessHierarchyFile('</xsl:text>
358 <xsl:text>sites/localsite/collect/</xsl:text><xsl:value-of select="$collName"/><xsl:text>/etc/</xsl:text><xsl:value-of select="@hfile"/>
359 <xsl:text disable-output-escaping="yes">','</xsl:text><xsl:value-of select="@metadata"/><xsl:text disable-output-escaping="yes">');</xsl:text>
360 </xsl:if>
361 </xsl:for-each>
362 <xsl:text disable-output-escaping="yes">});</xsl:text>
363
364 </script>
365 <xsl:call-template name="customJavascriptForDocumentEditing"/>
366 </xsl:template>
367
368 <!-- Use this to add in extra javascript/files for an interface, site, collection -->
369 <xsl:template name="customJavascriptForDocumentEditing">
370 </xsl:template>
371
372 <!-- the page content -->
373 <xsl:template match="/page/pageResponse/document">
374 <xsl:if test="$bookswitch = 'off'">
375 <xsl:call-template name="javascriptForDocumentView"/>
376 <gslib:langfrag name="doc"/>
377 <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
378 <script type="text/javascript">
379 <xsl:text disable-output-escaping="yes">
380 if(document.URL.indexOf("book=on") != -1)
381 {
382 loadBook();
383 }
384 </xsl:text>
385 </script>
386 </xsl:if>
387 </xsl:if>
388 <xsl:variable name="canDoEditing">
389 <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>
390 </xsl:variable>
391 <xsl:if test="$canDoEditing = 'true'">
392 <xsl:call-template name="javascriptForDocumentEditing"/>
393 <gslib:langfrag name="dse"/>
394 <gslib:langfrag name="de"/>
395 </xsl:if>
396
397 <xsl:if test="$bookswitch = 'off'">
398 <div id="bookdiv" style="visibility:hidden; height:0px; display:inline;"><xsl:text> </xsl:text></div>
399
400 <div id="float-anchor" style="width: 30%; min-width:180px; float:right; margin: 0 0 10px 20px;">
401 <xsl:if test="$canDoEditing = 'true'">
402 <xsl:call-template name="editBar"/>
403 </xsl:if>
404 <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'">
405 <xsl:call-template name="rightSidebar"/>
406 </xsl:if>
407 <!-- add in some text just in case nothing has been added to this div-->
408 <xsl:text> </xsl:text>
409 </div>
410 <xsl:if test="$canDoEditing = 'true'">
411 <script type="text/javascript">
412 if (keep_editing_controls_visible) {
413 $(function() {
414 moveScroller();
415 });
416 }
417 </script>
418 </xsl:if>
419 </xsl:if>
420
421 <!-- display the document -->
422 <xsl:choose>
423 <xsl:when test="@external != ''">
424 <xsl:call-template name="externalPage">
425 <xsl:with-param name="external" select="@external"/>
426 </xsl:call-template>
427 </xsl:when>
428 <xsl:when test="$bookswitch = 'flashxml'">
429 <xsl:call-template name="documentNodeFlashXML"/>
430 </xsl:when>
431 <xsl:when test="$bookswitch = 'on'">
432 <div id="bookdiv" style="display:inline;"><xsl:text> </xsl:text></div>
433 <!-- *** in document-scripts.js *** -->
434 <script type="text/javascript">
435 <xsl:text disable-output-escaping="yes">
436 if(document.URL.indexOf("book=on") != -1)
437 {
438 loadBook();
439 }
440 </xsl:text>
441 </script>
442 </xsl:when>
443 <!-- 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-->
444 <!-- This is the first choice from wrappedDocument template-->
445 <xsl:when test="$canDoEditing = 'true' and /page/pageRequest/paramList/param[@name='docEdit']/@value = '1'">
446 <div id="gs-document" style="width: 67%">
447 <xsl:call-template name="documentPre"/>
448 <div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
449 <xsl:choose>
450 <xsl:when test="@docType='simple'">
451 <xsl:call-template name="wrapDocumentNodes"/>
452 </xsl:when>
453 <xsl:otherwise>
454 <xsl:for-each select="documentNode">
455 <xsl:call-template name="wrapDocumentNodes"/>
456 </xsl:for-each>
457 </xsl:otherwise>
458 </xsl:choose>
459 </div>
460 </div>
461 </xsl:when>
462 <xsl:when test="@docType='simple'">
463 <xsl:call-template name="documentHeading"/><br/>
464 <xsl:call-template name="documentContent"/>
465 <br /><xsl:call-template name="userCommentsSection"/>
466 </xsl:when>
467 <xsl:otherwise> <!-- display the standard greenstone document -->
468 <xsl:call-template name="wrappedDocument"/>
469 <br /><xsl:call-template name="userCommentsSection"/>
470 </xsl:otherwise>
471 </xsl:choose>
472 </xsl:template>
473
474 <xsl:template name="wrappedDocument">
475 <xsl:choose>
476 <!-- NOTE: alb = ajax load bypass -->
477 <!--
478 If we have asked for expanded document, then do this.
479 OR If the docType is hierarchy and we want to bypass the ajax load then do this
480 OR If the docType is hierarchy and we have asked for the top level document then do this
481 -->
482 <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, '.')))))">
483 <div id="gs-document">
484 <xsl:call-template name="documentPre"/>
485 <div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
486 <xsl:for-each select="documentNode">
487 <xsl:call-template name="wrapDocumentNodes"/>
488 </xsl:for-each>
489 </div>
490 </div>
491 </xsl:when>
492 <xsl:when test="/page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'">
493 <div id="gs-document">
494 <div id="tocLoadingImage" style="text-align:center;">
495 <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>
496 </div>
497 </div>
498 <script type="text/javascript">
499 <xsl:text disable-output-escaping="yes">
500 $(window).load(function()
501 {
502 var sectionID = gs.cgiParams.d;
503 var callbackFunction = null;
504 if(sectionID.indexOf(".") != -1)
505 {
506 callbackFunction = function()
507 {
508 focusSection(sectionID);
509 };
510 }
511 else {
512 callbackFunction = function()
513 {
514
515 expandAndExecute(sectionID+".1", null, null, null);
516 };
517 }
518 var docID = sectionID.replace(/([^.]*)\..*/, "$1");
519 var url = gs.xsltParams.library_name + "?a=d&amp;c=" + gs.cgiParams.c + "&amp;excerptid=gs-document&amp;dt=hierarchy&amp;d=" + docID;
520 if(gs.cgiParams.p_s) {
521 url += "&amp;p.s="+gs.cgiParams.p_s;
522 }
523 loadTopLevelPage(callbackFunction, url);
524 });
525 </xsl:text>
526 </script>
527 </xsl:when>
528 <xsl:otherwise>
529 <div id="gs-document">
530 <div id="tocLoadingImage" style="text-align:center;">
531 <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>
532 </div>
533 </div>
534 <script type="text/javascript">
535 <xsl:text disable-output-escaping="yes">
536 $(window).load(function()
537 {
538 loadTopLevelPage(function()
539 {
540 //Don't focus the section until the table of contents is loaded
541 var tocCheck = function()
542 {
543 if(gs.variables.tocLoaded)
544 {
545 focusSection("</xsl:text><xsl:value-of select="/page/pageResponse/document/@selectedNode"/><xsl:text disable-output-escaping="yes">");
546 }
547 else
548 {
549 setTimeout(tocCheck, 500);
550 }
551 }
552 tocCheck();
553 });
554 });
555 </xsl:text>
556 </script>
557 </xsl:otherwise>
558 </xsl:choose>
559
560 <div class="clear"><xsl:text> </xsl:text></div>
561 </xsl:template>
562
563 <xsl:template name="editBar">
564 <table style="width:100%; border:none;" id="editBar" class="ui-widget-content"><tr>
565 <td id="editBarLeft" style="width:70%"><xsl:text> </xsl:text></td>
566 <td id="editBarRight">
567 <div style="text-align:center;">
568 <!-- edit structure button -->
569 <!-- comment this out as its not working -->
570 <!-- <div style="margin:5px;" class="ui-state-default ui-corner-all">
571 <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>
572 </div>-->
573 <!-- edit content button -->
574 <div style="margin:5px;" class="ui-state-default ui-corner-all">
575 <a id="editContentButton" style="padding: 3px; text-decoration:none;">
576 <xsl:attribute name="href">
577 <xsl:value-of select="$library_name"/>
578 <xsl:text>/collection/</xsl:text>
579 <xsl:value-of select="$collName"/>
580 <xsl:text>/document/</xsl:text>
581 <xsl:choose>
582 <xsl:when test="count(//documentNode) > 0">
583 <xsl:value-of select="/page/pageResponse/document/documentNode/@nodeID"/>
584 </xsl:when>
585 <xsl:otherwise>
586 <xsl:value-of select="/page/pageResponse/document/@nodeID"/>
587 </xsl:otherwise>
588 </xsl:choose>
589 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1')">
590 <xsl:text>?ed=1&amp;docEdit=1</xsl:text>
591 </xsl:if>
592 </xsl:attribute>
593 <xsl:choose>
594 <xsl:when test="/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1'">
595 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.hide_editor')"/>
596 </xsl:when>
597 <xsl:otherwise>
598 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.edit_content')"/>
599 </xsl:otherwise>
600 </xsl:choose>
601 </a>
602 </div>
603 </div>
604 </td>
605 </tr></table>
606 <gslib:langfrag name="dse"/>
607 </xsl:template>
608
609
610 <!-- The default template for displaying section titles -->
611 <xsl:template name="sectionTitle">
612 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
613 </xsl:template>
614
615 <xsl:template name="wrappedSectionImage">
616 <gsf:variable name="screenImageWidth"><gsf:metadata name="ScreenWidth"/></gsf:variable>
617 <gsf:variable name="screenImageHeight"><gsf:metadata name="ScreenHeight"/></gsf:variable>
618 <gsf:variable name="imageWidth"><gsf:metadata name="ImageWidth"/></gsf:variable>
619 <gsf:variable name="imageHeight"><gsf:metadata name="ImageHeight"/></gsf:variable>
620
621 <xsl:choose>
622 <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')">
623 <div id="tidyDiv"/>
624 <!-- 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. -->
625 <script type="text/javascript">
626 <xsl:text disable-output-escaping="yes">
627
628 var containerWidth = document.getElementById("container").offsetWidth;
629 var sidebarWidth = document.getElementById("rightSidebar").offsetWidth;
630 if (containerWidth - sidebarWidth &lt; </xsl:text><xsl:value-of select="$screenImageWidth"/><xsl:text disable-output-escaping="yes">) {
631 $("#tidyDiv").css("clear", "both");
632 }
633 </xsl:text>
634 </script>
635 <div id="image{@nodeID}">
636 <!-- 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 -->
637 <xsl:if test="/page/pageResponse/document[@docType='simple'] or /page/pageRequest/paramList/param[@name = 'ed']/@value='1'">
638
639 <div id="wrap{util:replace(@nodeID, '.', '_')}" class="zoomImage" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
640 <div id="small{util:replace(@nodeID, '.', '_')}" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
641 <gsf:link type="source" target="_blank"><gsf:image type="screen"/></gsf:link>
642 </div>
643 <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;">
644 <div id="overlay{util:replace(@nodeID, '.', '_')}" style="width: 600px; height: 600px; position: absolute; top: 0; left: 0; z-index: 200;">
645 <xsl:text> </xsl:text>
646 </div>
647 <div id="large{util:replace(@nodeID, '.', '_')}" style="position: relative; width: {$imageWidth}px; height: {$imageHeight}px;">
648 <gsf:link type="source"><gsf:image type="source"/></gsf:link>
649 </div>
650 </div>
651 </div>
652 <script type="text/javascript">
653 <xsl:text disable-output-escaping="yes">
654 {
655 var nodeID = "</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">";
656 nodeID = nodeID.replace(/\./g, "_");
657
658 var bigHeight = </xsl:text><xsl:value-of select="$imageHeight"/><xsl:text disable-output-escaping="yes">;
659 var smallHeight = </xsl:text><xsl:value-of select="$screenImageHeight"/><xsl:text disable-output-escaping="yes">;
660
661 var multiplier = bigHeight / smallHeight;
662
663 $("#wrap" + nodeID).anythingZoomer({
664 smallArea: "#small" + nodeID,
665 largeArea: "#large" + nodeID,
666 zoomPort: "#overlay" + nodeID,
667 mover: "#mover" + nodeID,
668 expansionSize:50,
669 speedMultiplier:multiplier
670 });
671
672 $("#zoomOptions input").prop("checked", false);
673 $("#zoomOptions").css("display", "");
674 }
675 </xsl:text>
676 </script>
677 </xsl:if>
678 </div>
679 </xsl:when>
680 <xsl:otherwise>
681 <div id="image{@nodeID}">
682 <xsl:attribute name="style">
683 <xsl:choose>
684 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
685 <xsl:text>display:none;</xsl:text>
686 </xsl:when>
687 <xsl:otherwise>
688 <xsl:text>display:block;</xsl:text>
689 </xsl:otherwise>
690 </xsl:choose>
691 </xsl:attribute>
692 <xsl:call-template name="sectionImage"/><xsl:text> </xsl:text>
693 </div>
694 </xsl:otherwise>
695 </xsl:choose>
696 </xsl:template>
697
698 <!-- The default template for displaying the document node text -->
699 <!-- equivalent to gsf:text -->
700 <xsl:template name="documentNodeText">
701 <xsl:param name="force">0</xsl:param>
702 <!-- Hides the "This document has no text." message -->
703 <xsl:variable name="noText"><gsf:metadata name="NoText"/></xsl:variable>
704 <xsl:choose>
705 <xsl:when test="$force = '1' or not($noText = '1')">
706
707 <!-- Section text -->
708 <xsl:for-each select="nodeContent">
709 <xsl:call-template name="displayMarkedUpTextAndAnnotations"/>
710 </xsl:for-each>
711 </xsl:when>
712 <xsl:when test="$noText = '1' and not(metadataList/metadata[@name='ImageType'])">
713 <gsf:link type="source"><gsf:metadata name="Source"/></gsf:link>
714 </xsl:when>
715 </xsl:choose>
716 <xsl:text> </xsl:text>
717 </xsl:template>
718
719 <!-- display the text content of a node (content node or metadata node), marking up the annotations -->
720 <xsl:template name="displayMarkedUpTextAndAnnotations">
721 <xsl:variable name="annotation_class">
722 <xsl:choose>
723 <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>
724 <xsl:otherwise>termHighlight</xsl:otherwise>
725 </xsl:choose>
726 </xsl:variable>
727 <xsl:for-each select="node()">
728 <xsl:choose>
729 <xsl:when test="not(name())">
730 <xsl:value-of select="." disable-output-escaping="yes"/>
731 </xsl:when>
732 <xsl:when test="name() = 'annotation'">
733 <span class="{$annotation_class}"><xsl:value-of select="."/></span>
734 </xsl:when>
735 <xsl:otherwise>
736 <xsl:apply-templates/>
737 </xsl:otherwise>
738 </xsl:choose>
739 </xsl:for-each>
740 </xsl:template>
741
742
743 <!-- The default template for displaying the document node text in
744 editing mode -->
745 <!-- 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. -->
746 <!-- equivalent to gsf:text -->
747 <xsl:template name="documentNodeTextForEditing">
748 <!-- Section text -->
749 <xsl:for-each select="nodeContent">
750 <xsl:if test="not(node())"><gsf:space/></xsl:if>
751 <xsl:for-each select="node()">
752 <xsl:choose>
753 <xsl:when test="not(name())">
754 <xsl:value-of select="." disable-output-escaping="yes"/>
755 </xsl:when>
756 <xsl:otherwise>
757 <xsl:apply-templates/>
758 </xsl:otherwise>
759 </xsl:choose>
760 </xsl:for-each>
761 </xsl:for-each>
762 </xsl:template>
763
764 <!-- Used to produce a version of the page in a format that can be read by the realistic books plugin -->
765 <xsl:template name="documentNodeFlashXML">
766 <xsl:text disable-output-escaping="yes">
767 &lt;Section&gt;
768 &lt;Description&gt;
769 &lt;Metadata name="Title"&gt;
770 </xsl:text>
771 <xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/>
772 <xsl:text disable-output-escaping="yes">
773 &lt;/Metadata&gt;
774 &lt;/Description&gt;
775 </xsl:text>
776
777 <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
778
779 <xsl:for-each select="documentNode">
780 <xsl:call-template name="documentNodeFlashXML"/>
781 </xsl:for-each>
782
783 <xsl:text disable-output-escaping="yes">
784 &lt;/Section&gt;
785 </xsl:text>
786 </xsl:template>
787
788 <xsl:template name="externalPage">
789 <xsl:param name="external"/>
790 <xsl:variable name="go_forward_link">
791 <a>
792 <xsl:attribute name="href">
793 <xsl:value-of select="$external"/>
794 </xsl:attribute>
795 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/>
796 </a>
797 </xsl:variable>
798 <h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
799 <p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/></p>
800 </xsl:template>
801
802 <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
803
804 <xsl:template name="documentPre">
805 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
806 <xsl:call-template name="mapFeatures"/>
807 </xsl:if>
808 </xsl:template>
809
810 <xsl:template name="mapFeatures">
811 <div id="map_canvas" class="map_canvas_full"><xsl:text> </xsl:text></div>
812
813 <xsl:choose>
814 <!-- HIERARCHICAL DOCUMENTS -->
815 <xsl:when test="count(//documentNode) > 0">
816 <xsl:for-each select="documentNode">
817 <xsl:call-template name="mapPlacesNearHere"/>
818 </xsl:for-each>
819 </xsl:when>
820 <!-- SIMPLE DOCUMENTS -->
821 <xsl:otherwise>
822 <xsl:call-template name="mapPlacesNearHere"/>
823 </xsl:otherwise>
824 </xsl:choose>
825
826 <div id="jsonNodes" style="display:none;">
827 <xsl:text>[</xsl:text>
828 <xsl:choose>
829 <!-- HIERARCHICAL DOCUMENTS -->
830 <xsl:when test="count(//documentNode) > 0">
831 <xsl:for-each select="//documentNode">
832 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
833 <xsl:text>{</xsl:text>
834 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">",</xsl:text>
835 <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>
836 <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>
837 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
838 <xsl:text>}</xsl:text>
839 <xsl:if test="not(position() = count(//documentNode))">
840 <xsl:text>,</xsl:text>
841 </xsl:if>
842 </xsl:if>
843 </xsl:for-each>
844 </xsl:when>
845 <!-- SIMPLE DOCUMENTS -->
846 <xsl:otherwise>
847 <xsl:for-each select="/page/pageResponse/document">
848 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
849 <xsl:text>{</xsl:text>
850 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@selectedNode"/><xsl:text disable-output-escaping="yes">",</xsl:text>
851 <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>
852 <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>
853 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
854 <xsl:text>}</xsl:text>
855 </xsl:if>
856 </xsl:for-each>
857 </xsl:otherwise>
858 </xsl:choose>
859 <xsl:text>]</xsl:text>
860 </div>
861 </xsl:template>
862
863 <xsl:template name="mapPlacesNearHere">
864 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
865 <div style="background:#BBFFBB; padding: 5px; margin:0px auto; width:890px;">
866 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.map_nearby_docs')"/>
867 <img id="nearbyDocumentsToggle" style="margin-left:5px;" src="interfaces/{$interface_name}/images/expand.png">
868 <xsl:attribute name="onclick">
869 <xsl:text>performDistanceSearch('</xsl:text>
870 <xsl:value-of select="@nodeID"/>
871 <xsl:text>', '</xsl:text>
872 <gsf:metadata name="Latitude"/>
873 <xsl:text>', '</xsl:text>
874 <gsf:metadata name="Longitude"/>
875 <xsl:text>', 2);</xsl:text>
876 </xsl:attribute>
877 </img>
878 <div id="nearbyDocuments"><xsl:text> </xsl:text></div>
879 </div>
880 </xsl:if>
881 </xsl:template>
882</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.