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

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