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

Last change on this file since 26140 was 26140, checked in by sjm84, 9 years ago

Some more fixes to help the editor work with simple documents

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