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

Last change on this file since 29440 was 29440, checked in by kjdon, 6 years ago

the float-anchor div screws up the page if it is empty, so adding in a space just in case it is empty

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