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

Last change on this file since 31769 was 31769, checked in by kjdon, 7 years ago

we want to show duplicates of metadata when editing

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