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

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

added in customJavascriptForDocumentView, customJavascriptForDOcumentEditing templates, so if you want to add some just for a collection, you don't need to copy the entire javascriptForDocumentView/Editing templates. also removed <gsf:metadata name='all'/> - this gets seen whether we are editing or not so it was always loading all metadata

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