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

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

Some commits ahead of further changes: 1. Kathy came up with better name for GS2Construct.java method (to be refactored) that's more descriptive of the multiple tasks it performs. Removed unused paramter. 2. Javascript user_comments.js displays the heading for the comments section only when appropriate, which is when there is a comment history or when the form to add a comment is shown. Otherwise only the Add Comment link will be shown. 3. Changed core.css colours of links and headings in comments section to better match GS3. 4. document.xsl needs to display usercomments section not just for simple docs but also for wrapped docs.

File size: 31.4 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 <br /><xsl:call-template name="userCommentsSection"/>
377 </xsl:otherwise>
378 </xsl:choose>
379 </xsl:template>
380
381 <xsl:template name="wrappedDocument">
382 <xsl:choose>
383 <!-- NOTE: alb = ajax load bypass -->
384 <!--
385 If we have asked for expanded document, then do this.
386 OR If the docType is hierarchy and we want to bypass the ajax load then do this
387 OR If the docType is hierarchy and we have asked for the top level document then do this
388 -->
389 <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, '.')))))">
390 <div id="gs-document">
391 <xsl:call-template name="documentPre"/>
392 <div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
393 <xsl:for-each select="documentNode">
394 <xsl:call-template name="wrapDocumentNodes"/>
395 </xsl:for-each>
396 </div>
397 </div>
398 </xsl:when>
399 <xsl:when test="/page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'">
400 <div id="gs-document">
401 <div id="tocLoadingImage" style="text-align:center;">
402 <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>
403 </div>
404 </div>
405 <script type="text/javascript">
406 <xsl:text disable-output-escaping="yes">
407 $(window).load(function()
408 {
409 var sectionID = gs.cgiParams.d;
410 var callbackFunction = null;
411 if(sectionID.indexOf("\\.") == -1)
412 {
413 callbackFunction = function()
414 {
415 focusSection(sectionID);
416 };
417 }
418
419 var docID = sectionID.replace(/([^.]*)\..*/, "$1");
420 var url = gs.xsltParams.library_name + "?a=d&amp;c=" + gs.cgiParams.c + "&amp;excerptid=gs-document&amp;dt=hierarchy&amp;d=" + docID;
421 loadTopLevelPage(callbackFunction, url);
422 });
423 </xsl:text>
424 </script>
425 </xsl:when>
426 <xsl:otherwise>
427 <div id="gs-document">
428 <div id="tocLoadingImage" style="text-align:center;">
429 <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>
430 </div>
431 </div>
432 <script type="text/javascript">
433 <xsl:text disable-output-escaping="yes">
434 $(window).load(function()
435 {
436 loadTopLevelPage(function()
437 {
438 //Don't focus the section until the table of contents is loaded
439 var tocCheck = function()
440 {
441 if(gs.variables.tocLoaded)
442 {
443 focusSection("</xsl:text><xsl:value-of select="/page/pageResponse/document/@selectedNode"/><xsl:text disable-output-escaping="yes">");
444 }
445 else
446 {
447 setTimeout(tocCheck, 500);
448 }
449 }
450 tocCheck();
451 });
452 });
453 </xsl:text>
454 </script>
455 </xsl:otherwise>
456 </xsl:choose>
457
458 <div class="clear"><xsl:text> </xsl:text></div>
459 </xsl:template>
460
461 <xsl:template name="editBar">
462 <table style="width:100%; border:none;" id="editBar" class="ui-widget-content"><tr>
463 <td id="editBarLeft" style="width:70%"><xsl:text> </xsl:text></td>
464 <td id="editBarRight">
465 <div style="text-align:center;">
466 <!-- edit structure button -->
467 <!-- comment this out as its not working -->
468 <!-- <div style="margin:5px;" class="ui-state-default ui-corner-all">
469 <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>
470 </div>-->
471 <!-- edit content button -->
472 <div style="margin:5px;" class="ui-state-default ui-corner-all">
473 <a id="editContentButton" style="padding: 3px; text-decoration:none;">
474 <xsl:attribute name="href">
475 <xsl:value-of select="$library_name"/>
476 <xsl:text>/collection/</xsl:text>
477 <xsl:value-of select="$collName"/>
478 <xsl:text>/document/</xsl:text>
479 <xsl:choose>
480 <xsl:when test="count(//documentNode) > 0">
481 <xsl:value-of select="/page/pageResponse/document/documentNode/@nodeID"/>
482 </xsl:when>
483 <xsl:otherwise>
484 <xsl:value-of select="/page/pageResponse/document/@nodeID"/>
485 </xsl:otherwise>
486 </xsl:choose>
487 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1')">
488 <xsl:text>?ed=1&amp;docEdit=1</xsl:text>
489 </xsl:if>
490 </xsl:attribute>
491 <xsl:choose>
492 <xsl:when test="/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1'">
493 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.hide_editor')"/>
494 </xsl:when>
495 <xsl:otherwise>
496 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.edit_content')"/>
497 </xsl:otherwise>
498 </xsl:choose>
499 </a>
500 </div>
501 </div>
502 </td>
503 </tr></table>
504 <gslib:langfrag name="dse"/>
505 </xsl:template>
506
507 <!-- Highlight annotations if requested -->
508 <xsl:template name="displayAnnotation">
509 <xsl:choose>
510 <xsl:when test="/page/pageRequest/paramList/param[@name = 'hl']/@value = 'off' or /page/pageResponse/format[@type='display']/gsf:option[@name='disableSearchTermHighlighting']/@value='true'">
511 <span class="noTermHighlight"><xsl:value-of select="."/></span>
512 </xsl:when>
513 <xsl:otherwise>
514 <span class="termHighlight"><xsl:value-of select="."/></span>
515 </xsl:otherwise>
516 </xsl:choose>
517 </xsl:template>
518
519 <!-- The default template for displaying section titles -->
520 <xsl:template name="sectionTitle">
521 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
522 </xsl:template>
523
524 <xsl:template name="wrappedSectionImage">
525 <gsf:variable name="screenImageWidth"><gsf:metadata name="ScreenWidth"/></gsf:variable>
526 <gsf:variable name="screenImageHeight"><gsf:metadata name="ScreenHeight"/></gsf:variable>
527 <gsf:variable name="imageWidth"><gsf:metadata name="ImageWidth"/></gsf:variable>
528 <gsf:variable name="imageHeight"><gsf:metadata name="ImageHeight"/></gsf:variable>
529
530 <xsl:choose>
531 <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')">
532 <div id="image{@nodeID}">
533 <div id="wrap{util:replace(@nodeID, '.', '_')}" class="zoomImage" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
534 <div id="small{util:replace(@nodeID, '.', '_')}" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
535 <gsf:link type="source"><gsf:image type="screen"/></gsf:link>
536 </div>
537 <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;">
538 <div id="overlay{util:replace(@nodeID, '.', '_')}" style="width: 600px; height: 600px; position: absolute; top: 0; left: 0; z-index: 200;">
539 <xsl:text> </xsl:text>
540 </div>
541 <div id="large{util:replace(@nodeID, '.', '_')}" style="position: relative; width: {$imageWidth}px; height: {$imageHeight}px;">
542 <gsf:link type="source"><gsf:image type="source"/></gsf:link>
543 </div>
544 </div>
545 </div>
546 <script type="text/javascript">
547 <xsl:text disable-output-escaping="yes">
548 {
549 var nodeID = "</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">";
550 nodeID = nodeID.replace(/\./g, "_");
551
552 var bigHeight = </xsl:text><xsl:value-of select="$imageHeight"/><xsl:text disable-output-escaping="yes">;
553 var smallHeight = </xsl:text><xsl:value-of select="$screenImageHeight"/><xsl:text disable-output-escaping="yes">;
554
555 var multiplier = bigHeight / smallHeight;
556
557 $("#wrap" + nodeID).anythingZoomer({
558 smallArea: "#small" + nodeID,
559 largeArea: "#large" + nodeID,
560 zoomPort: "#overlay" + nodeID,
561 mover: "#mover" + nodeID,
562 expansionSize:50,
563 speedMultiplier:multiplier
564 });
565
566 $("#zoomOptions input").prop("checked", false);
567 $("#zoomOptions").css("display", "");
568 }
569 </xsl:text>
570 </script>
571 </div>
572 </xsl:when>
573 <xsl:otherwise>
574 <div id="image{@nodeID}">
575 <xsl:attribute name="style">
576 <xsl:choose>
577 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
578 <xsl:text>display:none;</xsl:text>
579 </xsl:when>
580 <xsl:otherwise>
581 <xsl:text>display:block;</xsl:text>
582 </xsl:otherwise>
583 </xsl:choose>
584 </xsl:attribute>
585 <xsl:call-template name="sectionImage"/><xsl:text> </xsl:text>
586 </div>
587 </xsl:otherwise>
588 </xsl:choose>
589 </xsl:template>
590
591 <!-- The default template for displaying the document node text -->
592 <!-- equivalent to gsf:text -->
593 <xsl:template name="documentNodeText">
594 <!-- Hides the "This document has no text." message -->
595 <xsl:variable name="noText"><gsf:metadata name="NoText"/></xsl:variable>
596 <xsl:choose>
597 <xsl:when test="not($noText = '1')">
598
599 <!-- Section text -->
600 <xsl:for-each select="nodeContent">
601 <xsl:for-each select="node()">
602 <xsl:choose>
603 <xsl:when test="not(name())">
604 <xsl:value-of select="." disable-output-escaping="yes"/>
605 </xsl:when>
606 <xsl:when test="name() = 'annotation'">
607 <xsl:call-template name="displayAnnotation"/>
608 </xsl:when>
609 <xsl:otherwise>
610 <xsl:apply-templates/>
611 </xsl:otherwise>
612 </xsl:choose>
613 </xsl:for-each>
614 </xsl:for-each>
615 </xsl:when>
616 <xsl:when test="$noText = '1' and not(metadataList/metadata[@name='Image'])">
617 <gsf:link type="source"><gsf:metadata name="Source"/></gsf:link>
618 </xsl:when>
619 </xsl:choose>
620 <xsl:text> </xsl:text>
621 </xsl:template>
622
623 <!-- Used to produce a version of the page in a format that can be read by the realistic books plugin -->
624 <xsl:template name="documentNodeFlashXML">
625 <xsl:text disable-output-escaping="yes">
626 &lt;Section&gt;
627 &lt;Description&gt;
628 &lt;Metadata name="Title"&gt;
629 </xsl:text>
630 <xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/>
631 <xsl:text disable-output-escaping="yes">
632 &lt;/Metadata&gt;
633 &lt;/Description&gt;
634 </xsl:text>
635
636 <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
637
638 <xsl:for-each select="documentNode">
639 <xsl:call-template name="documentNodeFlashXML"/>
640 </xsl:for-each>
641
642 <xsl:text disable-output-escaping="yes">
643 &lt;/Section&gt;
644 </xsl:text>
645 </xsl:template>
646
647 <xsl:template name="externalPage">
648 <xsl:param name="external"/>
649 <xsl:variable name="go_forward_link">
650 <a>
651 <xsl:attribute name="href">
652 <xsl:value-of select="$external"/>
653 </xsl:attribute>
654 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/>
655 </a>
656 </xsl:variable>
657 <h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
658 <p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/></p>
659 </xsl:template>
660
661 <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
662
663 <xsl:template name="documentPre">
664 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
665 <xsl:call-template name="mapFeatures"/>
666 </xsl:if>
667 </xsl:template>
668
669 <xsl:template name="mapFeatures">
670 <div id="map_canvas" class="map_canvas_full"><xsl:text> </xsl:text></div>
671
672 <xsl:choose>
673 <!-- HIERARCHICAL DOCUMENTS -->
674 <xsl:when test="count(//documentNode) > 0">
675 <xsl:for-each select="documentNode">
676 <xsl:call-template name="mapPlacesNearHere"/>
677 </xsl:for-each>
678 </xsl:when>
679 <!-- SIMPLE DOCUMENTS -->
680 <xsl:otherwise>
681 <xsl:call-template name="mapPlacesNearHere"/>
682 </xsl:otherwise>
683 </xsl:choose>
684
685 <div id="jsonNodes" style="display:none;">
686 <xsl:text>[</xsl:text>
687 <xsl:choose>
688 <!-- HIERARCHICAL DOCUMENTS -->
689 <xsl:when test="count(//documentNode) > 0">
690 <xsl:for-each select="//documentNode">
691 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
692 <xsl:text>{</xsl:text>
693 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">",</xsl:text>
694 <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>
695 <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>
696 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
697 <xsl:text>}</xsl:text>
698 <xsl:if test="not(position() = count(//documentNode))">
699 <xsl:text>,</xsl:text>
700 </xsl:if>
701 </xsl:if>
702 </xsl:for-each>
703 </xsl:when>
704 <!-- SIMPLE DOCUMENTS -->
705 <xsl:otherwise>
706 <xsl:for-each select="/page/pageResponse/document">
707 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
708 <xsl:text>{</xsl:text>
709 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@selectedNode"/><xsl:text disable-output-escaping="yes">",</xsl:text>
710 <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>
711 <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>
712 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
713 <xsl:text>}</xsl:text>
714 </xsl:if>
715 </xsl:for-each>
716 </xsl:otherwise>
717 </xsl:choose>
718 <xsl:text>]</xsl:text>
719 </div>
720 </xsl:template>
721
722 <xsl:template name="mapPlacesNearHere">
723 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
724 <div style="background:#BBFFBB; padding: 5px; margin:0px auto; width:890px;">
725 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.map_nearby_docs')"/>
726 <img id="nearbyDocumentsToggle" style="margin-left:5px;" src="interfaces/{$interface_name}/images/expand.png">
727 <xsl:attribute name="onclick">
728 <xsl:text>performDistanceSearch('</xsl:text>
729 <xsl:value-of select="@nodeID"/>
730 <xsl:text>', '</xsl:text>
731 <gsf:metadata name="Latitude"/>
732 <xsl:text>', '</xsl:text>
733 <gsf:metadata name="Longitude"/>
734 <xsl:text>', 2);</xsl:text>
735 </xsl:attribute>
736 </img>
737 <div id="nearbyDocuments"><xsl:text> </xsl:text></div>
738 </div>
739 </xsl:if>
740 </xsl:template>
741</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.