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

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