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

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