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

Last change on this file since 31791 was 31791, checked in by kjdon, 4 years ago

we have a separate template for displayign the text for editing. We need to display the text as is, otherwise we are not editing the right thing

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