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

Last change on this file since 32133 was 32133, checked in by kjdon, 4 years ago

added a comment

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