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

Last change on this file since 31416 was 31416, checked in by Georgiy Litvinov, 7 years ago

JS code for links between sections.

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