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

Last change on this file since 30382 was 30382, checked in by Georgiy Litvinov, 8 years ago

Added hierarchy menu with suggestions to metadata editor

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