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

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

add cleaned up metadata name as a class attribute to the metaTAbleCellArea. used if we have autocompletion for meta values

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