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

Last change on this file since 31938 was 31938, checked in by Georgiy Litvinov, 3 years ago

Prevent downloading all images in collapsed image collections

File size: 31.9 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
539 <div id="image{@nodeID}">
540 <xsl:if test="/page/pageRequest/paramList/param[@name = 'ed']/@value='1'">
541
542 <div id="wrap{util:replace(@nodeID, '.', '_')}" class="zoomImage" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
543 <div id="small{util:replace(@nodeID, '.', '_')}" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
544 <gsf:link type="source"><gsf:image type="screen"/></gsf:link>
545 </div>
546 <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;">
547 <div id="overlay{util:replace(@nodeID, '.', '_')}" style="width: 600px; height: 600px; position: absolute; top: 0; left: 0; z-index: 200;">
548 <xsl:text> </xsl:text>
549 </div>
550 <div id="large{util:replace(@nodeID, '.', '_')}" style="position: relative; width: {$imageWidth}px; height: {$imageHeight}px;">
551 <gsf:link type="source"><gsf:image type="source"/></gsf:link>
552 </div>
553 </div>
554 </div>
555 <script type="text/javascript">
556 <xsl:text disable-output-escaping="yes">
557 {
558 var nodeID = "</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">";
559 nodeID = nodeID.replace(/\./g, "_");
560
561 var bigHeight = </xsl:text><xsl:value-of select="$imageHeight"/><xsl:text disable-output-escaping="yes">;
562 var smallHeight = </xsl:text><xsl:value-of select="$screenImageHeight"/><xsl:text disable-output-escaping="yes">;
563
564 var multiplier = bigHeight / smallHeight;
565
566 $("#wrap" + nodeID).anythingZoomer({
567 smallArea: "#small" + nodeID,
568 largeArea: "#large" + nodeID,
569 zoomPort: "#overlay" + nodeID,
570 mover: "#mover" + nodeID,
571 expansionSize:50,
572 speedMultiplier:multiplier
573 });
574
575 $("#zoomOptions input").prop("checked", false);
576 $("#zoomOptions").css("display", "");
577 }
578 </xsl:text>
579 </script>
580 </xsl:if>
581 </div>
582 </xsl:when>
583 <xsl:otherwise>
584 <div id="image{@nodeID}">
585 <xsl:attribute name="style">
586 <xsl:choose>
587 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
588 <xsl:text>display:none;</xsl:text>
589 </xsl:when>
590 <xsl:otherwise>
591 <xsl:text>display:block;</xsl:text>
592 </xsl:otherwise>
593 </xsl:choose>
594 </xsl:attribute>
595 <xsl:call-template name="sectionImage"/><xsl:text> </xsl:text>
596 </div>
597 </xsl:otherwise>
598 </xsl:choose>
599 </xsl:template>
600
601 <!-- The default template for displaying the document node text -->
602 <!-- equivalent to gsf:text -->
603 <xsl:template name="documentNodeText">
604 <!-- Hides the "This document has no text." message -->
605 <xsl:variable name="noText"><gsf:metadata name="NoText"/></xsl:variable>
606 <xsl:choose>
607 <xsl:when test="not($noText = '1')">
608
609 <!-- Section text -->
610 <xsl:for-each select="nodeContent">
611 <xsl:for-each select="node()">
612 <xsl:choose>
613 <xsl:when test="not(name())">
614 <xsl:value-of select="." disable-output-escaping="yes"/>
615 </xsl:when>
616 <xsl:when test="name() = 'annotation'">
617 <xsl:call-template name="displayAnnotation"/>
618 </xsl:when>
619 <xsl:otherwise>
620 <xsl:apply-templates/>
621 </xsl:otherwise>
622 </xsl:choose>
623 </xsl:for-each>
624 </xsl:for-each>
625 </xsl:when>
626 <xsl:when test="$noText = '1' and not(metadataList/metadata[@name='Image'])">
627 <gsf:link type="source"><gsf:metadata name="Source"/></gsf:link>
628 </xsl:when>
629 </xsl:choose>
630 <xsl:text> </xsl:text>
631 </xsl:template>
632
633 <!-- The default template for displaying the document node text in
634 editing mode -->
635 <!-- equivalent to gsf:text -->
636 <xsl:template name="documentNodeTextForEditing">
637 <!-- Section text -->
638 <xsl:for-each select="nodeContent">
639 <xsl:for-each select="node()">
640 <xsl:choose>
641 <xsl:when test="not(name())">
642 <xsl:value-of select="." disable-output-escaping="yes"/>
643 </xsl:when>
644 <xsl:otherwise>
645 <xsl:apply-templates/>
646 </xsl:otherwise>
647 </xsl:choose>
648 </xsl:for-each>
649 </xsl:for-each>
650 </xsl:template>
651 <!-- Used to produce a version of the page in a format that can be read by the realistic books plugin -->
652 <xsl:template name="documentNodeFlashXML">
653 <xsl:text disable-output-escaping="yes">
654 &lt;Section&gt;
655 &lt;Description&gt;
656 &lt;Metadata name="Title"&gt;
657 </xsl:text>
658 <xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/>
659 <xsl:text disable-output-escaping="yes">
660 &lt;/Metadata&gt;
661 &lt;/Description&gt;
662 </xsl:text>
663
664 <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
665
666 <xsl:for-each select="documentNode">
667 <xsl:call-template name="documentNodeFlashXML"/>
668 </xsl:for-each>
669
670 <xsl:text disable-output-escaping="yes">
671 &lt;/Section&gt;
672 </xsl:text>
673 </xsl:template>
674
675 <xsl:template name="externalPage">
676 <xsl:param name="external"/>
677 <xsl:variable name="go_forward_link">
678 <a>
679 <xsl:attribute name="href">
680 <xsl:value-of select="$external"/>
681 </xsl:attribute>
682 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/>
683 </a>
684 </xsl:variable>
685 <h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
686 <p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/></p>
687 </xsl:template>
688
689 <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
690
691 <xsl:template name="documentPre">
692 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
693 <xsl:call-template name="mapFeatures"/>
694 </xsl:if>
695 </xsl:template>
696
697 <xsl:template name="mapFeatures">
698 <div id="map_canvas" class="map_canvas_full"><xsl:text> </xsl:text></div>
699
700 <xsl:choose>
701 <!-- HIERARCHICAL DOCUMENTS -->
702 <xsl:when test="count(//documentNode) > 0">
703 <xsl:for-each select="documentNode">
704 <xsl:call-template name="mapPlacesNearHere"/>
705 </xsl:for-each>
706 </xsl:when>
707 <!-- SIMPLE DOCUMENTS -->
708 <xsl:otherwise>
709 <xsl:call-template name="mapPlacesNearHere"/>
710 </xsl:otherwise>
711 </xsl:choose>
712
713 <div id="jsonNodes" style="display:none;">
714 <xsl:text>[</xsl:text>
715 <xsl:choose>
716 <!-- HIERARCHICAL DOCUMENTS -->
717 <xsl:when test="count(//documentNode) > 0">
718 <xsl:for-each select="//documentNode">
719 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
720 <xsl:text>{</xsl:text>
721 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">",</xsl:text>
722 <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>
723 <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>
724 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
725 <xsl:text>}</xsl:text>
726 <xsl:if test="not(position() = count(//documentNode))">
727 <xsl:text>,</xsl:text>
728 </xsl:if>
729 </xsl:if>
730 </xsl:for-each>
731 </xsl:when>
732 <!-- SIMPLE DOCUMENTS -->
733 <xsl:otherwise>
734 <xsl:for-each select="/page/pageResponse/document">
735 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
736 <xsl:text>{</xsl:text>
737 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@selectedNode"/><xsl:text disable-output-escaping="yes">",</xsl:text>
738 <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>
739 <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>
740 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
741 <xsl:text>}</xsl:text>
742 </xsl:if>
743 </xsl:for-each>
744 </xsl:otherwise>
745 </xsl:choose>
746 <xsl:text>]</xsl:text>
747 </div>
748 </xsl:template>
749
750 <xsl:template name="mapPlacesNearHere">
751 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
752 <div style="background:#BBFFBB; padding: 5px; margin:0px auto; width:890px;">
753 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.map_nearby_docs')"/>
754 <img id="nearbyDocumentsToggle" style="margin-left:5px;" src="interfaces/{$interface_name}/images/expand.png">
755 <xsl:attribute name="onclick">
756 <xsl:text>performDistanceSearch('</xsl:text>
757 <xsl:value-of select="@nodeID"/>
758 <xsl:text>', '</xsl:text>
759 <gsf:metadata name="Latitude"/>
760 <xsl:text>', '</xsl:text>
761 <gsf:metadata name="Longitude"/>
762 <xsl:text>', 2);</xsl:text>
763 </xsl:attribute>
764 </img>
765 <div id="nearbyDocuments"><xsl:text> </xsl:text></div>
766 </div>
767 </xsl:if>
768 </xsl:template>
769</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.