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

Last change on this file since 33087 was 33087, checked in by wy59, 5 years ago
  1. Labels sort of work (see point 2) and get saved and reloaded from archives too now. 2. Needs fixing: undo and redo in label field works only if you enter the text first before drawing the shape, whereas vice-versa the redo/undo behaviour is weird (label repeated 3 times).
File size: 38.3 KB
RevLine 
[19856]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
[23989]11 <!-- use the 'main' layout -->
12 <xsl:import href="layouts/main.xsl"/>
[25660]13 <xsl:import href="layouts/toc.xsl"/>
[31537]14
15 <!-- templates for adding user comments -->
16 <xsl:import href="layouts/usercomments.xsl"/>
[23989]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>
[19856]26
[26316]27 <!-- optional cgi-params for links to document pages -->
28 <xsl:variable name="opt-doc-link-args"></xsl:variable>
[19988]29 <!-- set page title -->
30 <xsl:template name="pageTitle"><gslib:documentTitle/></xsl:template>
[19856]31
[19988]32 <!-- set page breadcrumbs -->
[23813]33 <xsl:template name="breadcrumbs">
34 <gslib:siteLink/><gslib:rightArrow/>
35 <gslib:collectionNameLinked/><gslib:rightArrow/>
36 <a>
37 <xsl:attribute name="href">
[25371]38 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/document/<xsl:value-of select="/page/pageResponse/document/documentNode[1]/@nodeID"/>
[23813]39 </xsl:attribute>
40 <xsl:variable name="documentTitleVar">
41 <gslib:documentTitle/>
42 </xsl:variable>
[24009]43 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.document')"/>
[23813]44 </a>
45 </xsl:template>
[23989]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>
[25917]59 <xsl:call-template name="mainTemplate"/>
[23989]60 </xsl:otherwise>
61 </xsl:choose>
62 </xsl:template>
[24650]63
[26020]64 <xsl:template name="documentHeading">
[32627]65 <span style="font-weight:bold; font-size: 120%;">
66 <xsl:call-template name="choose-title"/>
67 </span>
[26020]68 </xsl:template>
[32133]69
70 <!-- content of a simple document. Will not be used for editing mode -->
[26020]71 <xsl:template name="documentContent">
[26298]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>
[30773]79 </xsl:template>
80
[26175]81 <xsl:template name="sectionHeading">
[25936]82 <xsl:call-template name="sectionTitle"/>
83 </xsl:template>
84
[26020]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>
[32058]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">
[29861]100 <br /><br />
[32094]101 <div id="text{@nodeID}" class="sectionText" style="display:block;"><!-- *** -->
[30020]102 <xsl:attribute name="contenteditable">
103 <xsl:text>true</xsl:text>
104 </xsl:attribute>
[31791]105 <xsl:call-template name="documentNodeTextForEditing"/>
[32058]106 </div>
107 </xsl:template>
108
109 <xsl:template name="wrappedSectionText">
110 <br /><br />
111 <div id="text{@nodeID}" class="sectionText"><!-- *** -->
[26020]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>
[31791]122 <xsl:call-template name="documentNodeText"/>
[26020]123 </div>
124 </xsl:template>
125
126 <xsl:template name="sectionImage">
127 <gsf:image type="screen"/>
128 </xsl:template>
129
[24650]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">
[30478]133 <xsl:variable name="nodeID" select="@nodeID"/>
[25433]134 <a name="{@nodeID}"><xsl:text> </xsl:text></a>
[25936]135
[25433]136 <!-- Section header -->
137 <table class="sectionHeader"><tr>
[25936]138
[25433]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">
[25143]144 <xsl:choose>
[30478]145 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or util:oidIsMatchOrParent($nodeID, /page/pageResponse/document/@selectedNode)">
[25433]146 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
[25143]147 </xsl:when>
148 <xsl:otherwise>
[25433]149 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
[25143]150 </xsl:otherwise>
151 </xsl:choose>
152 </xsl:attribute>
[25433]153 </img>
154 </td>
155 </xsl:if>
[25936]156
[25433]157 <!-- Title -->
158 <td id="header{@nodeID}" class="headerTD sectionTitle"><!-- *** -->
[25936]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 -->
[26175]169 <span><xsl:call-template name="sectionHeading"/></span>
[25936]170 </p>
[25433]171 </td>
172
173 <!-- "back to top" link -->
[26216]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'">
[25433]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>
[25936]182
[25433]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>
[25177]189 <xsl:attribute name="style">
[25433]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
[32058]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))">
[25433]213 <table id="meta{@nodeID}">
214 <xsl:attribute name="style">
[25177]215 <xsl:choose>
[25433]216 <xsl:when test="/page/pageRequest/paramList/param[@name = 'dmd']/@value = 'true'">
217 <xsl:text>display:block;</xsl:text>
[25177]218 </xsl:when>
219 <xsl:otherwise>
[25433]220 <xsl:text>display:none;</xsl:text>
[25177]221 </xsl:otherwise>
222 </xsl:choose>
223 </xsl:attribute>
[25433]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>
[31049]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>
[25433]230 </tr>
231 </xsl:for-each>
232 </table>
[32832]233 <div id="map-and-controls-{@nodeID}" tabindex="-1">
[32764]234 <div id="map-{@nodeID}" style="height: 300px;"><xsl:text> </xsl:text></div>
235
236
[32832]237 <div id="ControlPanel-{@nodeID}" class="ControlPanel" >
[32764]238 <div id="ControlButtons">
[32832]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>
[32764]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">
[33062]249 <p class="valueEditor">Line thickness:
[33061]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}" />
[33062]259 </p>
[32764]260 </div>
261
262 <div id="ColourOpacity">
[33062]263 <p class="valueEditor">Colour opacity:
[33061]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}" />
[33042]269 </p>
[32764]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>
[33081]277 <div id = "FourthRow">
278 <p>Label Text:
[33087]279 <input type="text" id="description-{@nodeID}" />
[33081]280 </p>
281 </div>
282
[32764]283 </div>
[33042]284 <!--
[32764]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>
[33042]297 </div>
[33062]298 -->
[32764]299 </div>
300
[32058]301 <xsl:call-template name="sectionContentForEditing"/>
302 </xsl:when>
303 <xsl:otherwise>
[26020]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>
[32058]312 </xsl:otherwise>
313 </xsl:choose>
[25433]314 <xsl:if test="documentNode">
315 <xsl:for-each select="documentNode">
[24650]316 <xsl:call-template name="wrapDocumentNodes"/>
[25433]317 </xsl:for-each>
318 </xsl:if>
319 </div>
[24650]320 </xsl:template>
[19988]321
[30345]322 <xsl:template name="javascriptForDocumentView">
[33016]323 <script type="text/javascript" src="interfaces/{$interface_name}/js/utility_scripts.js"><xsl:text> </xsl:text></script>
[30345]324 <script type="text/javascript" src="interfaces/{$interface_name}/js/document_scripts.js"><xsl:text> </xsl:text></script>
[32072]325 <gsf:metadata name="Thumb" hidden="true"/>
[31416]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>
[32065]335 <xsl:call-template name="customJavascriptForDocumentView"/>
[30345]336 </xsl:template>
[32065]337
338 <!-- Use this to add in extra javascript/files for an interface, site, collection -->
339 <xsl:template name="customJavascriptForDocumentView">
340 </xsl:template>
341
[29172]342 <xsl:template name="javascriptForDocumentEditing">
[31749]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>
[32832]346 <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-shapes-util.js"><xsl:text> </xsl:text></script>
[32764]347 <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor-history.js"><xsl:text> </xsl:text></script>
[33087]348 <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor-themes.js"><xsl:text> </xsl:text></script>
349 <!-- LEAVE THIS NEXT LINE IN, IF USING CUSTOM OVERLAYS TO SHOW LABELS ON THE MAP -->
[33081]350 <!--<script type="text/javascript" src="interfaces/{$interface_name}/js/label-overlay-class.js"><xsl:text> </xsl:text></script>-->
[32764]351 <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor.js"><xsl:text> </xsl:text></script>
[30382]352 <script type="text/javascript" src="interfaces/{$interface_name}/js/hierarchy.js"><xsl:text> </xsl:text></script>
[32764]353
354 <link rel="stylesheet" href="interfaces/{$interface_name}/style/map-editors.css" type="text/css"/>
355
[25462]356 <script type="text/javascript">
357 <xsl:text disable-output-escaping="yes">
[30773]358
[25462]359 $(window).load(function()
360 {
361 if(gs.cgiParams.docEdit == "1")
362 {
363 readyPageForEditing();
364 }
365 });
366 </xsl:text>
[30382]367 <!-- download and process hierarchy files -->
[32836]368 <xsl:text disable-output-escaping="yes">$(document).ready(function(){</xsl:text>
369 <xsl:for-each select="//classifier[@hfile]">
370 <xsl:if test="@hfile != ''">
371 <xsl:text disable-output-escaping="yes">downloadAndProcessHierarchyFile('</xsl:text>
372 <xsl:text>sites/localsite/collect/</xsl:text><xsl:value-of select="$collName"/><xsl:text>/etc/</xsl:text><xsl:value-of select="@hfile"/>
373 <xsl:text disable-output-escaping="yes">','</xsl:text><xsl:value-of select="@metadata"/><xsl:text disable-output-escaping="yes">');</xsl:text>
374 </xsl:if>
375 </xsl:for-each>
[32781]376 <xsl:text disable-output-escaping="yes">});</xsl:text>
[30382]377
[25462]378 </script>
[32065]379 <xsl:call-template name="customJavascriptForDocumentEditing"/>
[29172]380 </xsl:template>
[32065]381
382 <!-- Use this to add in extra javascript/files for an interface, site, collection -->
383 <xsl:template name="customJavascriptForDocumentEditing">
384 </xsl:template>
[24791]385
[29172]386 <!-- the page content -->
387 <xsl:template match="/page/pageResponse/document">
388 <xsl:if test="$bookswitch = 'off'">
[30345]389 <xsl:call-template name="javascriptForDocumentView"/>
[30773]390 <gslib:langfrag name="doc"/>
[29172]391 <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
392 <script type="text/javascript">
393 <xsl:text disable-output-escaping="yes">
394 if(document.URL.indexOf("book=on") != -1)
395 {
396 loadBook();
397 }
398 </xsl:text>
399 </script>
400 </xsl:if>
401 </xsl:if>
402 <xsl:variable name="canDoEditing">
403 <xsl:if test="/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true' and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">true</xsl:if>
404 </xsl:variable>
405 <xsl:if test="$canDoEditing = 'true'">
406 <xsl:call-template name="javascriptForDocumentEditing"/>
407 <gslib:langfrag name="dse"/>
[30773]408 <gslib:langfrag name="de"/>
[29172]409 </xsl:if>
410
[23989]411 <xsl:if test="$bookswitch = 'off'">
[24018]412 <div id="bookdiv" style="visibility:hidden; height:0px; display:inline;"><xsl:text> </xsl:text></div>
413
[29172]414 <div id="float-anchor" style="width: 30%; min-width:180px; float:right; margin: 0 0 10px 20px;">
[31749]415 <xsl:if test="$canDoEditing = 'true'">
[25371]416 <xsl:call-template name="editBar"/>
[25072]417 </xsl:if>
[24791]418 <xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='sideBar']) or /page/pageResponse/format[@type='display']/gsf:option[@name='sideBar']/@value='true'">
[25371]419 <xsl:call-template name="rightSidebar"/>
[24650]420 </xsl:if>
[29440]421 <!-- add in some text just in case nothing has been added to this div-->
422 <xsl:text> </xsl:text>
[29172]423 </div>
[31752]424 <xsl:if test="$canDoEditing = 'true'">
425 <script type="text/javascript">
[29172]426 if (keep_editing_controls_visible) {
427 $(function() {
428 moveScroller();
429 });
430 }
431 </script>
[31752]432 </xsl:if>
[23989]433 </xsl:if>
434
[19856]435 <!-- display the document -->
[23813]436 <xsl:choose>
[19856]437 <xsl:when test="@external != ''">
438 <xsl:call-template name="externalPage">
439 <xsl:with-param name="external" select="@external"/>
440 </xsl:call-template>
441 </xsl:when>
[23989]442 <xsl:when test="$bookswitch = 'flashxml'">
[25720]443 <xsl:call-template name="documentNodeFlashXML"/>
[23989]444 </xsl:when>
445 <xsl:when test="$bookswitch = 'on'">
[24018]446 <div id="bookdiv" style="display:inline;"><xsl:text> </xsl:text></div>
[24791]447 <!-- *** in document-scripts.js *** -->
[24467]448 <script type="text/javascript">
449 <xsl:text disable-output-escaping="yes">
450 if(document.URL.indexOf("book=on") != -1)
451 {
452 loadBook();
453 }
454 </xsl:text>
455 </script>
[23989]456 </xsl:when>
[29166]457 <!-- we want to do this stuff even if docType is simple or paged. Don't want to just set dt=hierarchy as that gives other unnecessary stuff-->
458 <!-- This is the first choice from wrappedDocument template-->
459 <xsl:when test="$canDoEditing = 'true' and /page/pageRequest/paramList/param[@name='docEdit']/@value = '1'">
[30773]460 <div id="gs-document" style="width: 67%">
[29166]461 <xsl:call-template name="documentPre"/>
462 <div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
[29525]463 <xsl:choose>
464 <xsl:when test="@docType='simple'">
465 <xsl:call-template name="wrapDocumentNodes"/>
466 </xsl:when>
467 <xsl:otherwise>
[29166]468 <xsl:for-each select="documentNode">
469 <xsl:call-template name="wrapDocumentNodes"/>
470 </xsl:for-each>
[29525]471 </xsl:otherwise>
472 </xsl:choose>
[29166]473 </div>
474 </div>
475 </xsl:when>
[25837]476 <xsl:when test="@docType='simple'">
477 <xsl:call-template name="documentHeading"/><br/>
478 <xsl:call-template name="documentContent"/>
[31537]479 <br /><xsl:call-template name="userCommentsSection"/>
[29172]480 </xsl:when>
[25837]481 <xsl:otherwise> <!-- display the standard greenstone document -->
[26298]482 <xsl:call-template name="wrappedDocument"/>
[31540]483 <br /><xsl:call-template name="userCommentsSection"/>
[25837]484 </xsl:otherwise>
485 </xsl:choose>
486 </xsl:template>
[25949]487
[25824]488 <xsl:template name="wrappedDocument">
[25837]489 <xsl:choose>
[25936]490 <!-- NOTE: alb = ajax load bypass -->
[26205]491 <!--
[31534]492 If we have asked for expanded document, then do this.
493 OR If the docType is hierarchy and we want to bypass the ajax load then do this
494 OR If the docType is hierarchy and we have asked for the top level document then do this
[26205]495 -->
[31534]496 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or (/page/pageResponse/document/@docType = 'hierarchy' and (/page/pageRequest/paramList/param[@name = 'alb']/@value = '1' or (string-length(/page/pageRequest/paramList/param[@name = 'd']/@value) > 0 and not(util:contains(/page/pageResponse/document/@selectedNode, '.')))))">
[25837]497 <div id="gs-document">
498 <xsl:call-template name="documentPre"/>
499 <div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
500 <xsl:for-each select="documentNode">
501 <xsl:call-template name="wrapDocumentNodes"/>
502 </xsl:for-each>
503 </div>
504 </div>
505 </xsl:when>
[25972]506 <xsl:when test="/page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'">
[25936]507 <div id="gs-document">
508 <div id="tocLoadingImage" style="text-align:center;">
509 <img src="{util:getInterfaceText($interface_name, /page/@lang, 'loading_image')}"/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.loading')"/><xsl:text>...</xsl:text>
510 </div>
511 </div>
512 <script type="text/javascript">
513 <xsl:text disable-output-escaping="yes">
514 $(window).load(function()
515 {
[26296]516 var sectionID = gs.cgiParams.d;
517 var callbackFunction = null;
[32603]518 if(sectionID.indexOf(".") != -1)
[26296]519 {
520 callbackFunction = function()
521 {
522 focusSection(sectionID);
523 };
524 }
[32603]525 else {
526 callbackFunction = function()
527 {
528
529 expandAndExecute(sectionID+".1", null, null, null);
530 };
531 }
[26296]532 var docID = sectionID.replace(/([^.]*)\..*/, "$1");
533 var url = gs.xsltParams.library_name + "?a=d&amp;c=" + gs.cgiParams.c + "&amp;excerptid=gs-document&amp;dt=hierarchy&amp;d=" + docID;
[32504]534 if(gs.cgiParams.p_s) {
535 url += "&amp;p.s="+gs.cgiParams.p_s;
536 }
[26296]537 loadTopLevelPage(callbackFunction, url);
[25936]538 });
539 </xsl:text>
540 </script>
541 </xsl:when>
[25837]542 <xsl:otherwise>
543 <div id="gs-document">
544 <div id="tocLoadingImage" style="text-align:center;">
545 <img src="{util:getInterfaceText($interface_name, /page/@lang, 'loading_image')}"/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.loading')"/><xsl:text>...</xsl:text>
546 </div>
547 </div>
548 <script type="text/javascript">
549 <xsl:text disable-output-escaping="yes">
550 $(window).load(function()
551 {
552 loadTopLevelPage(function()
553 {
554 //Don't focus the section until the table of contents is loaded
555 var tocCheck = function()
[25371]556 {
[25837]557 if(gs.variables.tocLoaded)
[25371]558 {
[25837]559 focusSection("</xsl:text><xsl:value-of select="/page/pageResponse/document/@selectedNode"/><xsl:text disable-output-escaping="yes">");
560 }
561 else
562 {
563 setTimeout(tocCheck, 500);
564 }
565 }
566 tocCheck();
567 });
568 });
569 </xsl:text>
570 </script>
571 </xsl:otherwise>
[19856]572 </xsl:choose>
[24791]573
[19856]574 <div class="clear"><xsl:text> </xsl:text></div>
[23989]575 </xsl:template>
576
[25371]577 <xsl:template name="editBar">
[29172]578 <table style="width:100%; border:none;" id="editBar" class="ui-widget-content"><tr>
[25371]579 <td id="editBarLeft" style="width:70%"><xsl:text> </xsl:text></td>
580 <td id="editBarRight">
581 <div style="text-align:center;">
[30097]582 <!-- edit structure button -->
583 <!-- comment this out as its not working -->
584 <!-- <div style="margin:5px;" class="ui-state-default ui-corner-all">
[30773]585 <a style="padding: 3px; text-decoration:none;" href="{$library_name}?a=g&amp;sa=documentbasket&amp;c=&amp;s=DisplayDocumentList&amp;rt=r&amp;p.c={/page/pageResponse/collection/@name}&amp;docToEdit={/page/pageResponse/document/documentNode/@nodeID}"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.edit_structure')"/></a>
[30097]586 </div>-->
587 <!-- edit content button -->
[25371]588 <div style="margin:5px;" class="ui-state-default ui-corner-all">
[25462]589 <a id="editContentButton" style="padding: 3px; text-decoration:none;">
590 <xsl:attribute name="href">
591 <xsl:value-of select="$library_name"/>
592 <xsl:text>/collection/</xsl:text>
593 <xsl:value-of select="$collName"/>
594 <xsl:text>/document/</xsl:text>
[26140]595 <xsl:choose>
596 <xsl:when test="count(//documentNode) > 0">
597 <xsl:value-of select="/page/pageResponse/document/documentNode/@nodeID"/>
598 </xsl:when>
599 <xsl:otherwise>
600 <xsl:value-of select="/page/pageResponse/document/@nodeID"/>
601 </xsl:otherwise>
602 </xsl:choose>
[25462]603 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1')">
[29166]604 <xsl:text>?ed=1&amp;docEdit=1</xsl:text>
[25462]605 </xsl:if>
606 </xsl:attribute>
607 <xsl:choose>
608 <xsl:when test="/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1'">
[30773]609 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.hide_editor')"/>
[25462]610 </xsl:when>
611 <xsl:otherwise>
[30773]612 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.edit_content')"/>
[25462]613 </xsl:otherwise>
614 </xsl:choose>
615 </a>
[25371]616 </div>
617 </div>
618 </td>
619 </tr></table>
[25720]620 <gslib:langfrag name="dse"/>
[25371]621 </xsl:template>
622
[32504]623
[24650]624 <!-- The default template for displaying section titles -->
[25720]625 <xsl:template name="sectionTitle">
[24650]626 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
627 </xsl:template>
628
[26020]629 <xsl:template name="wrappedSectionImage">
[25433]630 <gsf:variable name="screenImageWidth"><gsf:metadata name="ScreenWidth"/></gsf:variable>
631 <gsf:variable name="screenImageHeight"><gsf:metadata name="ScreenHeight"/></gsf:variable>
632 <gsf:variable name="imageWidth"><gsf:metadata name="ImageWidth"/></gsf:variable>
633 <gsf:variable name="imageHeight"><gsf:metadata name="ImageHeight"/></gsf:variable>
634
635 <xsl:choose>
[32666]636 <xsl:when test="metadataList/metadata[@name = 'Screen'] and metadataList/metadata[@name = 'SourceFile'] and ($imageWidth div $screenImageWidth > 1.2) and (not(/page/pageResponse/format[@type='display']/gsf:option[@name='disableZoom']) or /page/pageResponse/format[@type='display']/gsf:option[@name='disableZoom']/@value='false')">
637 <div id="tidyDiv"/>
638 <!-- adding a div with clear:both when the image doesn't nicely fit in beside the side bar. Otherwise, the divs stays up, but the image moves down and everything looks and acts weird. -->
639 <script type="text/javascript">
640 <xsl:text disable-output-escaping="yes">
641
642 var containerWidth = document.getElementById("container").offsetWidth;
643 var sidebarWidth = document.getElementById("rightSidebar").offsetWidth;
644 if (containerWidth - sidebarWidth &lt; </xsl:text><xsl:value-of select="$screenImageWidth"/><xsl:text disable-output-escaping="yes">) {
645 $("#tidyDiv").css("clear", "both");
646 }
647 </xsl:text>
648 </script>
[25936]649 <div id="image{@nodeID}">
[32504]650 <!-- when we ask for an individual section content we set ed=1. putting this test here prevents downloading all the screen and full images for each section of the document when we are just looking at the contents list. ed is not set for simple docs, so do this if doctype is simple -->
[32568]651 <xsl:if test="/page/pageResponse/document[@docType='simple'] or /page/pageRequest/paramList/param[@name = 'ed']/@value='1'">
[31938]652
[25936]653 <div id="wrap{util:replace(@nodeID, '.', '_')}" class="zoomImage" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
654 <div id="small{util:replace(@nodeID, '.', '_')}" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
[32094]655 <gsf:link type="source" target="_blank"><gsf:image type="screen"/></gsf:link>
[25433]656 </div>
[26408]657 <div id="mover{util:replace(@nodeID, '.', '_')}" style="border: 1px solid green; position: absolute; top: 0; left: 0; width: 598px; height: 598px; overflow: hidden; z-index: 100; background: white; display: none;">
658 <div id="overlay{util:replace(@nodeID, '.', '_')}" style="width: 600px; height: 600px; position: absolute; top: 0; left: 0; z-index: 200;">
[25936]659 <xsl:text> </xsl:text>
660 </div>
661 <div id="large{util:replace(@nodeID, '.', '_')}" style="position: relative; width: {$imageWidth}px; height: {$imageHeight}px;">
[28622]662 <gsf:link type="source"><gsf:image type="source"/></gsf:link>
[25936]663 </div>
[25433]664 </div>
665 </div>
[25936]666 <script type="text/javascript">
667 <xsl:text disable-output-escaping="yes">
668 {
669 var nodeID = "</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">";
670 nodeID = nodeID.replace(/\./g, "_");
[25462]671
[25936]672 var bigHeight = </xsl:text><xsl:value-of select="$imageHeight"/><xsl:text disable-output-escaping="yes">;
673 var smallHeight = </xsl:text><xsl:value-of select="$screenImageHeight"/><xsl:text disable-output-escaping="yes">;
[25462]674
[25936]675 var multiplier = bigHeight / smallHeight;
[25433]676
[25936]677 $("#wrap" + nodeID).anythingZoomer({
678 smallArea: "#small" + nodeID,
679 largeArea: "#large" + nodeID,
680 zoomPort: "#overlay" + nodeID,
681 mover: "#mover" + nodeID,
682 expansionSize:50,
683 speedMultiplier:multiplier
684 });
[26024]685
[29321]686 $("#zoomOptions input").prop("checked", false);
[29441]687 $("#zoomOptions").css("display", "");
[25936]688 }
689 </xsl:text>
690 </script>
[31938]691 </xsl:if>
[25936]692 </div>
[25433]693 </xsl:when>
[26020]694 <xsl:otherwise>
[25433]695 <div id="image{@nodeID}">
696 <xsl:attribute name="style">
697 <xsl:choose>
698 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
699 <xsl:text>display:none;</xsl:text>
700 </xsl:when>
701 <xsl:otherwise>
702 <xsl:text>display:block;</xsl:text>
703 </xsl:otherwise>
704 </xsl:choose>
705 </xsl:attribute>
[26020]706 <xsl:call-template name="sectionImage"/><xsl:text> </xsl:text>
[25433]707 </div>
[26020]708 </xsl:otherwise>
[25433]709 </xsl:choose>
710 </xsl:template>
[25837]711
[25824]712 <!-- The default template for displaying the document node text -->
[25837]713 <!-- equivalent to gsf:text -->
[25824]714 <xsl:template name="documentNodeText">
[32569]715 <xsl:param name="force">0</xsl:param>
[25433]716 <!-- Hides the "This document has no text." message -->
717 <xsl:variable name="noText"><gsf:metadata name="NoText"/></xsl:variable>
[28622]718 <xsl:choose>
[32504]719 <xsl:when test="$force = '1' or not($noText = '1')">
[28622]720
[25837]721 <!-- Section text -->
722 <xsl:for-each select="nodeContent">
[32504]723 <xsl:call-template name="displayMarkedUpTextAndAnnotations"/>
[23989]724 </xsl:for-each>
[28622]725 </xsl:when>
[32504]726 <xsl:when test="$noText = '1' and not(metadataList/metadata[@name='ImageType'])">
[28622]727 <gsf:link type="source"><gsf:metadata name="Source"/></gsf:link>
728 </xsl:when>
729 </xsl:choose>
730 <xsl:text> </xsl:text>
[19856]731 </xsl:template>
[25824]732
[32504]733 <!-- display the text content of a node (content node or metadata node), marking up the annotations -->
734 <xsl:template name="displayMarkedUpTextAndAnnotations">
735 <xsl:variable name="annotation_class">
736 <xsl:choose>
737 <xsl:when test="/page/pageRequest/paramList/param[@name = 'hl']/@value = 'off' or /page/pageResponse/format[@type='display']/gsf:option[@name='disableSearchTermHighlighting']/@value='true'">noTermHighlight</xsl:when>
738 <xsl:otherwise>termHighlight</xsl:otherwise>
739 </xsl:choose>
740 </xsl:variable>
741 <xsl:for-each select="node()">
742 <xsl:choose>
743 <xsl:when test="not(name())">
744 <xsl:value-of select="." disable-output-escaping="yes"/>
745 </xsl:when>
746 <xsl:when test="name() = 'annotation'">
747 <span class="{$annotation_class}"><xsl:value-of select="."/></span>
748 </xsl:when>
749 <xsl:otherwise>
750 <xsl:apply-templates/>
751 </xsl:otherwise>
752 </xsl:choose>
753 </xsl:for-each>
754 </xsl:template>
755
756
[31791]757 <!-- The default template for displaying the document node text in
758 editing mode -->
[32094]759 <!-- Note: we need to put some content in if the nodeContent is empty, otherwise you end up with an empty div, it gets changed to <div> and the ckeditor ends up being attached to everything else afterwards. -->
[31791]760 <!-- equivalent to gsf:text -->
761 <xsl:template name="documentNodeTextForEditing">
762 <!-- Section text -->
763 <xsl:for-each select="nodeContent">
[32094]764 <xsl:if test="not(node())"><gsf:space/></xsl:if>
[31791]765 <xsl:for-each select="node()">
766 <xsl:choose>
767 <xsl:when test="not(name())">
768 <xsl:value-of select="." disable-output-escaping="yes"/>
769 </xsl:when>
770 <xsl:otherwise>
771 <xsl:apply-templates/>
772 </xsl:otherwise>
773 </xsl:choose>
774 </xsl:for-each>
775 </xsl:for-each>
776 </xsl:template>
[32058]777
[23989]778 <!-- Used to produce a version of the page in a format that can be read by the realistic books plugin -->
[25720]779 <xsl:template name="documentNodeFlashXML">
[23989]780 <xsl:text disable-output-escaping="yes">
781 &lt;Section&gt;
782 &lt;Description&gt;
783 &lt;Metadata name="Title"&gt;
784 </xsl:text>
785 <xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/>
786 <xsl:text disable-output-escaping="yes">
787 &lt;/Metadata&gt;
788 &lt;/Description&gt;
789 </xsl:text>
790
791 <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
792
[25660]793 <xsl:for-each select="documentNode">
[25720]794 <xsl:call-template name="documentNodeFlashXML"/>
[25660]795 </xsl:for-each>
[23989]796
797 <xsl:text disable-output-escaping="yes">
798 &lt;/Section&gt;
799 </xsl:text>
800 </xsl:template>
801
[23813]802 <xsl:template name="externalPage">
803 <xsl:param name="external"/>
804 <xsl:variable name="go_forward_link">
805 <a>
806 <xsl:attribute name="href">
807 <xsl:value-of select="$external"/>
808 </xsl:attribute>
809 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/>
810 </a>
811 </xsl:variable>
812 <h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
813 <p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/></p>
814 </xsl:template>
[19856]815
816 <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
[23989]817
[25371]818 <xsl:template name="documentPre">
[24996]819 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
820 <xsl:call-template name="mapFeatures"/>
821 </xsl:if>
822 </xsl:template>
823
824 <xsl:template name="mapFeatures">
[25462]825 <div id="map_canvas" class="map_canvas_full"><xsl:text> </xsl:text></div>
[24996]826
[26178]827 <xsl:choose>
828 <!-- HIERARCHICAL DOCUMENTS -->
829 <xsl:when test="count(//documentNode) > 0">
830 <xsl:for-each select="documentNode">
831 <xsl:call-template name="mapPlacesNearHere"/>
832 </xsl:for-each>
833 </xsl:when>
834 <!-- SIMPLE DOCUMENTS -->
835 <xsl:otherwise>
836 <xsl:call-template name="mapPlacesNearHere"/>
837 </xsl:otherwise>
838 </xsl:choose>
[24996]839
840 <div id="jsonNodes" style="display:none;">
841 <xsl:text>[</xsl:text>
[26139]842 <xsl:choose>
843 <!-- HIERARCHICAL DOCUMENTS -->
844 <xsl:when test="count(//documentNode) > 0">
845 <xsl:for-each select="//documentNode">
846 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
847 <xsl:text>{</xsl:text>
848 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">",</xsl:text>
849 <xsl:text disable-output-escaping="yes">"title":"</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/><xsl:text disable-output-escaping="yes">",</xsl:text>
850 <xsl:text disable-output-escaping="yes">"lat":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Latitude']"/><xsl:text>,</xsl:text>
851 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
852 <xsl:text>}</xsl:text>
853 <xsl:if test="not(position() = count(//documentNode))">
854 <xsl:text>,</xsl:text>
855 </xsl:if>
856 </xsl:if>
857 </xsl:for-each>
858 </xsl:when>
859 <!-- SIMPLE DOCUMENTS -->
860 <xsl:otherwise>
861 <xsl:for-each select="/page/pageResponse/document">
862 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
863 <xsl:text>{</xsl:text>
864 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@selectedNode"/><xsl:text disable-output-escaping="yes">",</xsl:text>
865 <xsl:text disable-output-escaping="yes">"title":"</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/><xsl:text disable-output-escaping="yes">",</xsl:text>
866 <xsl:text disable-output-escaping="yes">"lat":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Latitude']"/><xsl:text>,</xsl:text>
867 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
868 <xsl:text>}</xsl:text>
869 </xsl:if>
870 </xsl:for-each>
871 </xsl:otherwise>
872 </xsl:choose>
[24996]873 <xsl:text>]</xsl:text>
874 </div>
875 </xsl:template>
[26178]876
877 <xsl:template name="mapPlacesNearHere">
878 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
879 <div style="background:#BBFFBB; padding: 5px; margin:0px auto; width:890px;">
[30773]880 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.map_nearby_docs')"/>
[26178]881 <img id="nearbyDocumentsToggle" style="margin-left:5px;" src="interfaces/{$interface_name}/images/expand.png">
882 <xsl:attribute name="onclick">
883 <xsl:text>performDistanceSearch('</xsl:text>
884 <xsl:value-of select="@nodeID"/>
885 <xsl:text>', '</xsl:text>
886 <gsf:metadata name="Latitude"/>
887 <xsl:text>', '</xsl:text>
888 <gsf:metadata name="Longitude"/>
889 <xsl:text>', 2);</xsl:text>
890 </xsl:attribute>
891 </img>
892 <div id="nearbyDocuments"><xsl:text> </xsl:text></div>
893 </div>
894 </xsl:if>
895 </xsl:template>
[19856]896</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.