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

Last change on this file since 31533 was 31533, checked in by kjdon, 7 years ago

if ed=1 for paged document, want to go through the nodes and process them.

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