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

Last change on this file since 31537 was 31537, checked in by ak19, 7 years ago

First commit for getting user comments working for GS3. It all works, but there's debugging statements still and haven't cleaned up commented out code. After that, would like to make POST rather than GET AJAX calls, so more refactoring required. 1. config_format.xsl is just minor spelling corrections. 2. header.xsl has a new function generateLogoutURL. 3. document.xsl imports and calls new usercomments.xsl to set up the user comments area. 4. New usercomments.js is imported by new usercomments.xsl, and sets up the interaction of the usercomments area. 5. javascript-global-functions.js now contains setMetadataArray and getMetadataArray functions to parallel what GS2 used in gsajaxapi.js, but for GS3 need to go through GS2Construct.processModifyMetadata() service in java code. 5. GS2Construct.java does different checking for users adding user comments versus users doing document editing. For the latter, the user needs to have editing permissions for the document. But any user is allowed to add comments on any accessible document. But ModifyMetadata should not allow any other metadata to be modified other than meta fields. 6. New language strings for usercomment area and GS2Construct errors in the 2 changed properties files.

File size: 31.3 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 <b><xsl:text> </xsl:text><gsf:metadata name="Title"/></b><br/>
66 </xsl:template>
67
68 <xsl:template name="documentContent">
69 <div id="gs-document">
70 <xsl:call-template name="documentPre"/>
71 <xsl:call-template name="wrappedSectionImage"/>
72 <div id="gs-document-text">
73 <xsl:call-template name="documentNodeText"/>
74 </div>
75 </div>
76 </xsl:template>
77
78 <xsl:template name="sectionHeading">
79 <xsl:call-template name="sectionTitle"/>
80 </xsl:template>
81
82 <xsl:template name="topLevelSectionContent">
83 <xsl:call-template name="wrappedSectionImage"/>
84 <xsl:call-template name="wrappedSectionText"/>
85 </xsl:template>
86
87 <xsl:template name="sectionContent">
88 <xsl:call-template name="wrappedSectionImage"/>
89 <xsl:call-template name="wrappedSectionText"/>
90 </xsl:template>
91
92 <xsl:template name="wrappedSectionText">
93 <br /><br />
94 <div id="text{@nodeID}" class="sectionText"><!-- *** -->
95 <xsl:if test="/page/pageRequest/paramList/param[(@name='docEdit') and (@value='on' or @value='true' or @value='1')]">
96 <xsl:attribute name="contenteditable">
97 <xsl:text>true</xsl:text>
98 </xsl:attribute>
99 </xsl:if>
100 <xsl:attribute name="style">
101 <xsl:choose>
102 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'image'">
103 <xsl:text>display:none;</xsl:text>
104 </xsl:when>
105 <xsl:otherwise>
106 <xsl:text>display:block;</xsl:text>
107 </xsl:otherwise>
108 </xsl:choose>
109 </xsl:attribute>
110
111 <xsl:call-template name="documentNodeText"/>
112 </div>
113 </xsl:template>
114
115 <xsl:template name="sectionImage">
116 <gsf:image type="screen"/>
117 </xsl:template>
118
119 <!-- Used to make sure that regardless what the collection designer uses for the title and content we can wrap it properly -->
120 <!-- If editing, be aware that the Document Basket looks for specific classes that this template bakes in (key points marked with ***) -->
121 <xsl:template name="wrapDocumentNodes">
122 <xsl:variable name="nodeID" select="@nodeID"/>
123 <a name="{@nodeID}"><xsl:text> </xsl:text></a>
124
125 <!-- Section header -->
126 <table class="sectionHeader"><tr>
127
128 <!-- Expand/collapse button -->
129 <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'">
130 <td class="headerTD">
131 <img id="dtoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
132 <xsl:attribute name="src">
133 <xsl:choose>
134 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or util:oidIsMatchOrParent($nodeID, /page/pageResponse/document/@selectedNode)">
135 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
136 </xsl:when>
137 <xsl:otherwise>
138 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
139 </xsl:otherwise>
140 </xsl:choose>
141 </xsl:attribute>
142 </img>
143 </td>
144 </xsl:if>
145
146 <!-- Title -->
147 <td id="header{@nodeID}" class="headerTD sectionTitle"><!-- *** -->
148 <p>
149 <xsl:attribute name="class"><xsl:value-of select="util:hashToDepthClass(@nodeID)"/> sectionHeader</xsl:attribute>
150
151 <xsl:if test="util:hashToSectionId(@nodeID)">
152 <span class="sectionNumberSpan">
153 <xsl:value-of select="util:hashToSectionId(@nodeID)"/>
154 <xsl:text> </xsl:text>
155 </span>
156 </xsl:if>
157 <!-- Display the title for the section regardless of whether automatic section numbering is turned on -->
158 <span><xsl:call-template name="sectionHeading"/></span>
159 </p>
160 </td>
161
162 <!-- "back to top" link -->
163 <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'">
164 <td class="backToTop headerTD">
165 <a href="javascript:scrollToTop();">
166 <xsl:text disable-output-escaping="yes">&#9650;</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.back_to_top')"/>
167 </a>
168 </td>
169 </xsl:if>
170 </tr></table>
171
172 <div id="doc{@nodeID}"><!-- *** -->
173 <xsl:choose>
174 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or /page/pageResponse/document/@selectedNode = @nodeID">
175 <xsl:attribute name="class">
176 <xsl:text>sectionContainer hasText</xsl:text>
177 </xsl:attribute>
178 <xsl:attribute name="style">
179 <xsl:text>display:block;</xsl:text>
180 </xsl:attribute>
181 </xsl:when>
182 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or util:oidIsMatchOrParent(@nodeID, /page/pageResponse/document/@selectedNode)">
183 <xsl:attribute name="class">
184 <xsl:text>sectionContainer noText</xsl:text>
185 </xsl:attribute>
186 <xsl:attribute name="style">
187 <xsl:text>display:block;</xsl:text>
188 </xsl:attribute>
189 </xsl:when>
190 <xsl:otherwise>
191 <xsl:attribute name="class">
192 <xsl:text>sectionContainer noText</xsl:text>
193 </xsl:attribute>
194 <xsl:attribute name="style">
195 <xsl:text>display:none;</xsl:text>
196 </xsl:attribute>
197 </xsl:otherwise>
198 </xsl:choose>
199
200 <xsl:if 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))">
201 <table id="meta{@nodeID}">
202 <xsl:attribute name="style">
203 <xsl:choose>
204 <xsl:when test="/page/pageRequest/paramList/param[@name = 'dmd']/@value = 'true'">
205 <xsl:text>display:block;</xsl:text>
206 </xsl:when>
207 <xsl:otherwise>
208 <xsl:text>display:none;</xsl:text>
209 </xsl:otherwise>
210 </xsl:choose>
211 </xsl:attribute>
212 <xsl:value-of select="util:clearMetadataStorage()"/>
213 <xsl:for-each select="metadataList/metadata">
214 <xsl:sort select="@name"/>
215 <xsl:if test="util:checkMetadataNotDuplicate(@name, .)">
216 <tr>
217 <td class="metaTableCellName"><xsl:value-of select="@name"/></td>
218 <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>
219 </tr>
220 </xsl:if>
221 </xsl:for-each>
222 </table>
223 </xsl:if>
224 <xsl:choose>
225 <xsl:when test="../../document">
226 <xsl:call-template name="topLevelSectionContent"/>
227 </xsl:when>
228 <xsl:otherwise>
229 <xsl:call-template name="sectionContent"/>
230 </xsl:otherwise>
231 </xsl:choose>
232 <xsl:if test="documentNode">
233 <xsl:for-each select="documentNode">
234 <xsl:call-template name="wrapDocumentNodes"/>
235 </xsl:for-each>
236 </xsl:if>
237 </div>
238 </xsl:template>
239
240 <xsl:template name="javascriptForDocumentView">
241 <script type="text/javascript" src="interfaces/{$interface_name}/js/document_scripts.js"><xsl:text> </xsl:text></script>
242 <script type="text/javascript">
243 <xsl:text disable-output-escaping="yes">
244 function goToAnchor(sectionID,anchor)
245 {
246 var docIdentifier = '</xsl:text><xsl:value-of select="//documentNode[@nodeType = 'root']/@nodeID"/><xsl:text disable-output-escaping="yes">';
247 focusAnchor(docIdentifier + "."+ sectionID,0,1,anchor);
248 }
249 </xsl:text>
250 </script>
251 </xsl:template>
252 <xsl:template name="javascriptForDocumentEditing">
253 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentmaker_scripts.js"><xsl:text> </xsl:text></script>
254 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentmaker_scripts_util.js"><xsl:text> </xsl:text></script>
255 <script type="text/javascript" src="interfaces/{$interface_name}/js/hierarchy.js"><xsl:text> </xsl:text></script>
256 <script type="text/javascript">
257 <xsl:text disable-output-escaping="yes">
258
259 $(window).load(function()
260 {
261 if(gs.cgiParams.docEdit == "1")
262 {
263 readyPageForEditing();
264 }
265 });
266 </xsl:text>
267 <!-- download and process hierarchy files -->
268 <xsl:text disable-output-escaping="yes">$(document).ready(function(){</xsl:text>
269 <xsl:for-each select="//classifier[@hfile]">
270 <xsl:text disable-output-escaping="yes">downloadAndProcessHierarchyFile('</xsl:text>
271 <xsl:text>sites/localsite/collect/</xsl:text><xsl:value-of select="$collName"/><xsl:text>/etc/</xsl:text><xsl:value-of select="@hfile"/>
272 <xsl:text disable-output-escaping="yes">','</xsl:text><xsl:value-of select="@metadata"/><xsl:text disable-output-escaping="yes">');</xsl:text>
273 </xsl:for-each>
274 <xsl:text disable-output-escaping="yes">});</xsl:text>
275
276 </script>
277
278 </xsl:template>
279
280 <!-- the page content -->
281 <xsl:template match="/page/pageResponse/document">
282 <xsl:if test="$bookswitch = 'off'">
283 <xsl:call-template name="javascriptForDocumentView"/>
284 <gslib:langfrag name="doc"/>
285 <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
286 <script type="text/javascript">
287 <xsl:text disable-output-escaping="yes">
288 if(document.URL.indexOf("book=on") != -1)
289 {
290 loadBook();
291 }
292 </xsl:text>
293 </script>
294 </xsl:if>
295 </xsl:if>
296 <xsl:variable name="canDoEditing">
297 <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>
298 </xsl:variable>
299 <xsl:if test="$canDoEditing = 'true'">
300 <xsl:call-template name="javascriptForDocumentEditing"/>
301 <gsf:metadata name="all"/>
302 <gslib:langfrag name="dse"/>
303 <gslib:langfrag name="de"/>
304 </xsl:if>
305
306 <xsl:if test="$bookswitch = 'off'">
307 <div id="bookdiv" style="visibility:hidden; height:0px; display:inline;"><xsl:text> </xsl:text></div>
308
309 <div id="float-anchor" style="width: 30%; min-width:180px; float:right; margin: 0 0 10px 20px;">
310 <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))">
311 <xsl:call-template name="editBar"/>
312 </xsl:if>
313 <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'">
314 <xsl:call-template name="rightSidebar"/>
315 </xsl:if>
316 <!-- add in some text just in case nothing has been added to this div-->
317 <xsl:text> </xsl:text>
318 </div>
319 <script type="text/javascript">
320 if (keep_editing_controls_visible) {
321 $(function() {
322 moveScroller();
323 });
324 }
325 </script>
326 </xsl:if>
327
328 <!-- display the document -->
329 <xsl:choose>
330 <xsl:when test="@external != ''">
331 <xsl:call-template name="externalPage">
332 <xsl:with-param name="external" select="@external"/>
333 </xsl:call-template>
334 </xsl:when>
335 <xsl:when test="$bookswitch = 'flashxml'">
336 <xsl:call-template name="documentNodeFlashXML"/>
337 </xsl:when>
338 <xsl:when test="$bookswitch = 'on'">
339 <div id="bookdiv" style="display:inline;"><xsl:text> </xsl:text></div>
340 <!-- *** in document-scripts.js *** -->
341 <script type="text/javascript">
342 <xsl:text disable-output-escaping="yes">
343 if(document.URL.indexOf("book=on") != -1)
344 {
345 loadBook();
346 }
347 </xsl:text>
348 </script>
349 </xsl:when>
350 <!-- 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-->
351 <!-- This is the first choice from wrappedDocument template-->
352 <xsl:when test="$canDoEditing = 'true' and /page/pageRequest/paramList/param[@name='docEdit']/@value = '1'">
353 <div id="gs-document" style="width: 67%">
354 <xsl:call-template name="documentPre"/>
355 <div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
356 <xsl:choose>
357 <xsl:when test="@docType='simple'">
358 <xsl:call-template name="wrapDocumentNodes"/>
359 </xsl:when>
360 <xsl:otherwise>
361 <xsl:for-each select="documentNode">
362 <xsl:call-template name="wrapDocumentNodes"/>
363 </xsl:for-each>
364 </xsl:otherwise>
365 </xsl:choose>
366 </div>
367 </div>
368 </xsl:when>
369 <xsl:when test="@docType='simple'">
370 <xsl:call-template name="documentHeading"/><br/>
371 <xsl:call-template name="documentContent"/>
372 <br /><xsl:call-template name="userCommentsSection"/>
373 </xsl:when>
374 <xsl:otherwise> <!-- display the standard greenstone document -->
375 <xsl:call-template name="wrappedDocument"/>
376 </xsl:otherwise>
377 </xsl:choose>
378 </xsl:template>
379
380 <xsl:template name="wrappedDocument">
381 <xsl:choose>
382 <!-- NOTE: alb = ajax load bypass -->
383 <!--
384 If we have asked for expanded document, then do this.
385 OR If the docType is hierarchy and we want to bypass the ajax load then do this
386 OR If the docType is hierarchy and we have asked for the top level document then do this
387 -->
388 <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, '.')))))">
389 <div id="gs-document">
390 <xsl:call-template name="documentPre"/>
391 <div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
392 <xsl:for-each select="documentNode">
393 <xsl:call-template name="wrapDocumentNodes"/>
394 </xsl:for-each>
395 </div>
396 </div>
397 </xsl:when>
398 <xsl:when test="/page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'">
399 <div id="gs-document">
400 <div id="tocLoadingImage" style="text-align:center;">
401 <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>
402 </div>
403 </div>
404 <script type="text/javascript">
405 <xsl:text disable-output-escaping="yes">
406 $(window).load(function()
407 {
408 var sectionID = gs.cgiParams.d;
409 var callbackFunction = null;
410 if(sectionID.indexOf("\\.") == -1)
411 {
412 callbackFunction = function()
413 {
414 focusSection(sectionID);
415 };
416 }
417
418 var docID = sectionID.replace(/([^.]*)\..*/, "$1");
419 var url = gs.xsltParams.library_name + "?a=d&amp;c=" + gs.cgiParams.c + "&amp;excerptid=gs-document&amp;dt=hierarchy&amp;d=" + docID;
420 loadTopLevelPage(callbackFunction, url);
421 });
422 </xsl:text>
423 </script>
424 </xsl:when>
425 <xsl:otherwise>
426 <div id="gs-document">
427 <div id="tocLoadingImage" style="text-align:center;">
428 <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>
429 </div>
430 </div>
431 <script type="text/javascript">
432 <xsl:text disable-output-escaping="yes">
433 $(window).load(function()
434 {
435 loadTopLevelPage(function()
436 {
437 //Don't focus the section until the table of contents is loaded
438 var tocCheck = function()
439 {
440 if(gs.variables.tocLoaded)
441 {
442 focusSection("</xsl:text><xsl:value-of select="/page/pageResponse/document/@selectedNode"/><xsl:text disable-output-escaping="yes">");
443 }
444 else
445 {
446 setTimeout(tocCheck, 500);
447 }
448 }
449 tocCheck();
450 });
451 });
452 </xsl:text>
453 </script>
454 </xsl:otherwise>
455 </xsl:choose>
456
457 <div class="clear"><xsl:text> </xsl:text></div>
458 </xsl:template>
459
460 <xsl:template name="editBar">
461 <table style="width:100%; border:none;" id="editBar" class="ui-widget-content"><tr>
462 <td id="editBarLeft" style="width:70%"><xsl:text> </xsl:text></td>
463 <td id="editBarRight">
464 <div style="text-align:center;">
465 <!-- edit structure button -->
466 <!-- comment this out as its not working -->
467 <!-- <div style="margin:5px;" class="ui-state-default ui-corner-all">
468 <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>
469 </div>-->
470 <!-- edit content button -->
471 <div style="margin:5px;" class="ui-state-default ui-corner-all">
472 <a id="editContentButton" style="padding: 3px; text-decoration:none;">
473 <xsl:attribute name="href">
474 <xsl:value-of select="$library_name"/>
475 <xsl:text>/collection/</xsl:text>
476 <xsl:value-of select="$collName"/>
477 <xsl:text>/document/</xsl:text>
478 <xsl:choose>
479 <xsl:when test="count(//documentNode) > 0">
480 <xsl:value-of select="/page/pageResponse/document/documentNode/@nodeID"/>
481 </xsl:when>
482 <xsl:otherwise>
483 <xsl:value-of select="/page/pageResponse/document/@nodeID"/>
484 </xsl:otherwise>
485 </xsl:choose>
486 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1')">
487 <xsl:text>?ed=1&amp;docEdit=1</xsl:text>
488 </xsl:if>
489 </xsl:attribute>
490 <xsl:choose>
491 <xsl:when test="/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1'">
492 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.hide_editor')"/>
493 </xsl:when>
494 <xsl:otherwise>
495 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.edit_content')"/>
496 </xsl:otherwise>
497 </xsl:choose>
498 </a>
499 </div>
500 </div>
501 </td>
502 </tr></table>
503 <gslib:langfrag name="dse"/>
504 </xsl:template>
505
506 <!-- Highlight annotations if requested -->
507 <xsl:template name="displayAnnotation">
508 <xsl:choose>
509 <xsl:when test="/page/pageRequest/paramList/param[@name = 'hl']/@value = 'off' or /page/pageResponse/format[@type='display']/gsf:option[@name='disableSearchTermHighlighting']/@value='true'">
510 <span class="noTermHighlight"><xsl:value-of select="."/></span>
511 </xsl:when>
512 <xsl:otherwise>
513 <span class="termHighlight"><xsl:value-of select="."/></span>
514 </xsl:otherwise>
515 </xsl:choose>
516 </xsl:template>
517
518 <!-- The default template for displaying section titles -->
519 <xsl:template name="sectionTitle">
520 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
521 </xsl:template>
522
523 <xsl:template name="wrappedSectionImage">
524 <gsf:variable name="screenImageWidth"><gsf:metadata name="ScreenWidth"/></gsf:variable>
525 <gsf:variable name="screenImageHeight"><gsf:metadata name="ScreenHeight"/></gsf:variable>
526 <gsf:variable name="imageWidth"><gsf:metadata name="ImageWidth"/></gsf:variable>
527 <gsf:variable name="imageHeight"><gsf:metadata name="ImageHeight"/></gsf:variable>
528
529 <xsl:choose>
530 <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')">
531 <div id="image{@nodeID}">
532 <div id="wrap{util:replace(@nodeID, '.', '_')}" class="zoomImage" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
533 <div id="small{util:replace(@nodeID, '.', '_')}" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
534 <gsf:link type="source"><gsf:image type="screen"/></gsf:link>
535 </div>
536 <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;">
537 <div id="overlay{util:replace(@nodeID, '.', '_')}" style="width: 600px; height: 600px; position: absolute; top: 0; left: 0; z-index: 200;">
538 <xsl:text> </xsl:text>
539 </div>
540 <div id="large{util:replace(@nodeID, '.', '_')}" style="position: relative; width: {$imageWidth}px; height: {$imageHeight}px;">
541 <gsf:link type="source"><gsf:image type="source"/></gsf:link>
542 </div>
543 </div>
544 </div>
545 <script type="text/javascript">
546 <xsl:text disable-output-escaping="yes">
547 {
548 var nodeID = "</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">";
549 nodeID = nodeID.replace(/\./g, "_");
550
551 var bigHeight = </xsl:text><xsl:value-of select="$imageHeight"/><xsl:text disable-output-escaping="yes">;
552 var smallHeight = </xsl:text><xsl:value-of select="$screenImageHeight"/><xsl:text disable-output-escaping="yes">;
553
554 var multiplier = bigHeight / smallHeight;
555
556 $("#wrap" + nodeID).anythingZoomer({
557 smallArea: "#small" + nodeID,
558 largeArea: "#large" + nodeID,
559 zoomPort: "#overlay" + nodeID,
560 mover: "#mover" + nodeID,
561 expansionSize:50,
562 speedMultiplier:multiplier
563 });
564
565 $("#zoomOptions input").prop("checked", false);
566 $("#zoomOptions").css("display", "");
567 }
568 </xsl:text>
569 </script>
570 </div>
571 </xsl:when>
572 <xsl:otherwise>
573 <div id="image{@nodeID}">
574 <xsl:attribute name="style">
575 <xsl:choose>
576 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
577 <xsl:text>display:none;</xsl:text>
578 </xsl:when>
579 <xsl:otherwise>
580 <xsl:text>display:block;</xsl:text>
581 </xsl:otherwise>
582 </xsl:choose>
583 </xsl:attribute>
584 <xsl:call-template name="sectionImage"/><xsl:text> </xsl:text>
585 </div>
586 </xsl:otherwise>
587 </xsl:choose>
588 </xsl:template>
589
590 <!-- The default template for displaying the document node text -->
591 <!-- equivalent to gsf:text -->
592 <xsl:template name="documentNodeText">
593 <!-- Hides the "This document has no text." message -->
594 <xsl:variable name="noText"><gsf:metadata name="NoText"/></xsl:variable>
595 <xsl:choose>
596 <xsl:when test="not($noText = '1')">
597
598 <!-- Section text -->
599 <xsl:for-each select="nodeContent">
600 <xsl:for-each select="node()">
601 <xsl:choose>
602 <xsl:when test="not(name())">
603 <xsl:value-of select="." disable-output-escaping="yes"/>
604 </xsl:when>
605 <xsl:when test="name() = 'annotation'">
606 <xsl:call-template name="displayAnnotation"/>
607 </xsl:when>
608 <xsl:otherwise>
609 <xsl:apply-templates/>
610 </xsl:otherwise>
611 </xsl:choose>
612 </xsl:for-each>
613 </xsl:for-each>
614 </xsl:when>
615 <xsl:when test="$noText = '1' and not(metadataList/metadata[@name='Image'])">
616 <gsf:link type="source"><gsf:metadata name="Source"/></gsf:link>
617 </xsl:when>
618 </xsl:choose>
619 <xsl:text> </xsl:text>
620 </xsl:template>
621
622 <!-- Used to produce a version of the page in a format that can be read by the realistic books plugin -->
623 <xsl:template name="documentNodeFlashXML">
624 <xsl:text disable-output-escaping="yes">
625 &lt;Section&gt;
626 &lt;Description&gt;
627 &lt;Metadata name="Title"&gt;
628 </xsl:text>
629 <xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/>
630 <xsl:text disable-output-escaping="yes">
631 &lt;/Metadata&gt;
632 &lt;/Description&gt;
633 </xsl:text>
634
635 <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
636
637 <xsl:for-each select="documentNode">
638 <xsl:call-template name="documentNodeFlashXML"/>
639 </xsl:for-each>
640
641 <xsl:text disable-output-escaping="yes">
642 &lt;/Section&gt;
643 </xsl:text>
644 </xsl:template>
645
646 <xsl:template name="externalPage">
647 <xsl:param name="external"/>
648 <xsl:variable name="go_forward_link">
649 <a>
650 <xsl:attribute name="href">
651 <xsl:value-of select="$external"/>
652 </xsl:attribute>
653 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/>
654 </a>
655 </xsl:variable>
656 <h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
657 <p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/></p>
658 </xsl:template>
659
660 <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
661
662 <xsl:template name="documentPre">
663 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
664 <xsl:call-template name="mapFeatures"/>
665 </xsl:if>
666 </xsl:template>
667
668 <xsl:template name="mapFeatures">
669 <div id="map_canvas" class="map_canvas_full"><xsl:text> </xsl:text></div>
670
671 <xsl:choose>
672 <!-- HIERARCHICAL DOCUMENTS -->
673 <xsl:when test="count(//documentNode) > 0">
674 <xsl:for-each select="documentNode">
675 <xsl:call-template name="mapPlacesNearHere"/>
676 </xsl:for-each>
677 </xsl:when>
678 <!-- SIMPLE DOCUMENTS -->
679 <xsl:otherwise>
680 <xsl:call-template name="mapPlacesNearHere"/>
681 </xsl:otherwise>
682 </xsl:choose>
683
684 <div id="jsonNodes" style="display:none;">
685 <xsl:text>[</xsl:text>
686 <xsl:choose>
687 <!-- HIERARCHICAL DOCUMENTS -->
688 <xsl:when test="count(//documentNode) > 0">
689 <xsl:for-each select="//documentNode">
690 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
691 <xsl:text>{</xsl:text>
692 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">",</xsl:text>
693 <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>
694 <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>
695 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
696 <xsl:text>}</xsl:text>
697 <xsl:if test="not(position() = count(//documentNode))">
698 <xsl:text>,</xsl:text>
699 </xsl:if>
700 </xsl:if>
701 </xsl:for-each>
702 </xsl:when>
703 <!-- SIMPLE DOCUMENTS -->
704 <xsl:otherwise>
705 <xsl:for-each select="/page/pageResponse/document">
706 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
707 <xsl:text>{</xsl:text>
708 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@selectedNode"/><xsl:text disable-output-escaping="yes">",</xsl:text>
709 <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>
710 <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>
711 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
712 <xsl:text>}</xsl:text>
713 </xsl:if>
714 </xsl:for-each>
715 </xsl:otherwise>
716 </xsl:choose>
717 <xsl:text>]</xsl:text>
718 </div>
719 </xsl:template>
720
721 <xsl:template name="mapPlacesNearHere">
722 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
723 <div style="background:#BBFFBB; padding: 5px; margin:0px auto; width:890px;">
724 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.map_nearby_docs')"/>
725 <img id="nearbyDocumentsToggle" style="margin-left:5px;" src="interfaces/{$interface_name}/images/expand.png">
726 <xsl:attribute name="onclick">
727 <xsl:text>performDistanceSearch('</xsl:text>
728 <xsl:value-of select="@nodeID"/>
729 <xsl:text>', '</xsl:text>
730 <gsf:metadata name="Latitude"/>
731 <xsl:text>', '</xsl:text>
732 <gsf:metadata name="Longitude"/>
733 <xsl:text>', 2);</xsl:text>
734 </xsl:attribute>
735 </img>
736 <div id="nearbyDocuments"><xsl:text> </xsl:text></div>
737 </div>
738 </xsl:if>
739 </xsl:template>
740</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.