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

Last change on this file since 33062 was 33062, checked in by wy59, 5 years ago

Tidying up the previous commit of debug statements

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