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

Last change on this file since 32627 was 32627, checked in by kjdon, 5 years ago

making default templates in the interface xsl files, the format statements in the model col collectionConfig.xml, and GLI default formats in Format4gs3Manager all match up

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