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

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

HTML elements for the map editor controls are added

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