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

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