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

Last change on this file since 32058 was 32058, checked in by ak19, 4 years ago

Kathy fixed it so that when editing a document with GS3's online doc editor, the format statements that may modify the display of the document text in regular view, aren't used when displaying the text in doc editing view.

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