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

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

when viewing an image with zoom enabled, and the image doesn't fit into the space beside the sidebar box, then the image moves underneath. Fine, except that the divs for the zoom functionality don't move with it. The next seciton title ends up underneath the image, and the zooming thing doesn't line up with the actual image. Added javascript to put a div style=clear:both; before the image if its needed. This moved everything down underneath the side bar.

File size: 34.4 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="tidyDiv"/>
558 <!-- adding a div with clear:both when the image doesn't nicely fit in beside the side bar. Otherwise, the divs stays up, but the image moves down and everything looks and acts weird. -->
559 <script type="text/javascript">
560 <xsl:text disable-output-escaping="yes">
561
562 var containerWidth = document.getElementById("container").offsetWidth;
563 var sidebarWidth = document.getElementById("rightSidebar").offsetWidth;
564 if (containerWidth - sidebarWidth &lt; </xsl:text><xsl:value-of select="$screenImageWidth"/><xsl:text disable-output-escaping="yes">) {
565 $("#tidyDiv").css("clear", "both");
566 }
567 </xsl:text>
568 </script>
569 <div id="image{@nodeID}">
570 <!-- 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 -->
571 <xsl:if test="/page/pageResponse/document[@docType='simple'] or /page/pageRequest/paramList/param[@name = 'ed']/@value='1'">
572
573 <div id="wrap{util:replace(@nodeID, '.', '_')}" class="zoomImage" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
574 <div id="small{util:replace(@nodeID, '.', '_')}" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
575 <gsf:link type="source" target="_blank"><gsf:image type="screen"/></gsf:link>
576 </div>
577 <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;">
578 <div id="overlay{util:replace(@nodeID, '.', '_')}" style="width: 600px; height: 600px; position: absolute; top: 0; left: 0; z-index: 200;">
579 <xsl:text> </xsl:text>
580 </div>
581 <div id="large{util:replace(@nodeID, '.', '_')}" style="position: relative; width: {$imageWidth}px; height: {$imageHeight}px;">
582 <gsf:link type="source"><gsf:image type="source"/></gsf:link>
583 </div>
584 </div>
585 </div>
586 <script type="text/javascript">
587 <xsl:text disable-output-escaping="yes">
588 {
589 var nodeID = "</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">";
590 nodeID = nodeID.replace(/\./g, "_");
591
592 var bigHeight = </xsl:text><xsl:value-of select="$imageHeight"/><xsl:text disable-output-escaping="yes">;
593 var smallHeight = </xsl:text><xsl:value-of select="$screenImageHeight"/><xsl:text disable-output-escaping="yes">;
594
595 var multiplier = bigHeight / smallHeight;
596
597 $("#wrap" + nodeID).anythingZoomer({
598 smallArea: "#small" + nodeID,
599 largeArea: "#large" + nodeID,
600 zoomPort: "#overlay" + nodeID,
601 mover: "#mover" + nodeID,
602 expansionSize:50,
603 speedMultiplier:multiplier
604 });
605
606 $("#zoomOptions input").prop("checked", false);
607 $("#zoomOptions").css("display", "");
608 }
609 </xsl:text>
610 </script>
611 </xsl:if>
612 </div>
613 </xsl:when>
614 <xsl:otherwise>
615 <div id="image{@nodeID}">
616 <xsl:attribute name="style">
617 <xsl:choose>
618 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
619 <xsl:text>display:none;</xsl:text>
620 </xsl:when>
621 <xsl:otherwise>
622 <xsl:text>display:block;</xsl:text>
623 </xsl:otherwise>
624 </xsl:choose>
625 </xsl:attribute>
626 <xsl:call-template name="sectionImage"/><xsl:text> </xsl:text>
627 </div>
628 </xsl:otherwise>
629 </xsl:choose>
630 </xsl:template>
631
632 <!-- The default template for displaying the document node text -->
633 <!-- equivalent to gsf:text -->
634 <xsl:template name="documentNodeText">
635 <xsl:param name="force">0</xsl:param>
636 <!-- Hides the "This document has no text." message -->
637 <xsl:variable name="noText"><gsf:metadata name="NoText"/></xsl:variable>
638 <xsl:choose>
639 <xsl:when test="$force = '1' or not($noText = '1')">
640
641 <!-- Section text -->
642 <xsl:for-each select="nodeContent">
643 <xsl:call-template name="displayMarkedUpTextAndAnnotations"/>
644 </xsl:for-each>
645 </xsl:when>
646 <xsl:when test="$noText = '1' and not(metadataList/metadata[@name='ImageType'])">
647 <gsf:link type="source"><gsf:metadata name="Source"/></gsf:link>
648 </xsl:when>
649 </xsl:choose>
650 <xsl:text> </xsl:text>
651 </xsl:template>
652
653 <!-- display the text content of a node (content node or metadata node), marking up the annotations -->
654 <xsl:template name="displayMarkedUpTextAndAnnotations">
655 <xsl:variable name="annotation_class">
656 <xsl:choose>
657 <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>
658 <xsl:otherwise>termHighlight</xsl:otherwise>
659 </xsl:choose>
660 </xsl:variable>
661 <xsl:for-each select="node()">
662 <xsl:choose>
663 <xsl:when test="not(name())">
664 <xsl:value-of select="." disable-output-escaping="yes"/>
665 </xsl:when>
666 <xsl:when test="name() = 'annotation'">
667 <span class="{$annotation_class}"><xsl:value-of select="."/></span>
668 </xsl:when>
669 <xsl:otherwise>
670 <xsl:apply-templates/>
671 </xsl:otherwise>
672 </xsl:choose>
673 </xsl:for-each>
674 </xsl:template>
675
676
677 <!-- The default template for displaying the document node text in
678 editing mode -->
679 <!-- 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. -->
680 <!-- equivalent to gsf:text -->
681 <xsl:template name="documentNodeTextForEditing">
682 <!-- Section text -->
683 <xsl:for-each select="nodeContent">
684 <xsl:if test="not(node())"><gsf:space/></xsl:if>
685 <xsl:for-each select="node()">
686 <xsl:choose>
687 <xsl:when test="not(name())">
688 <xsl:value-of select="." disable-output-escaping="yes"/>
689 </xsl:when>
690 <xsl:otherwise>
691 <xsl:apply-templates/>
692 </xsl:otherwise>
693 </xsl:choose>
694 </xsl:for-each>
695 </xsl:for-each>
696 </xsl:template>
697
698 <!-- Used to produce a version of the page in a format that can be read by the realistic books plugin -->
699 <xsl:template name="documentNodeFlashXML">
700 <xsl:text disable-output-escaping="yes">
701 &lt;Section&gt;
702 &lt;Description&gt;
703 &lt;Metadata name="Title"&gt;
704 </xsl:text>
705 <xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/>
706 <xsl:text disable-output-escaping="yes">
707 &lt;/Metadata&gt;
708 &lt;/Description&gt;
709 </xsl:text>
710
711 <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
712
713 <xsl:for-each select="documentNode">
714 <xsl:call-template name="documentNodeFlashXML"/>
715 </xsl:for-each>
716
717 <xsl:text disable-output-escaping="yes">
718 &lt;/Section&gt;
719 </xsl:text>
720 </xsl:template>
721
722 <xsl:template name="externalPage">
723 <xsl:param name="external"/>
724 <xsl:variable name="go_forward_link">
725 <a>
726 <xsl:attribute name="href">
727 <xsl:value-of select="$external"/>
728 </xsl:attribute>
729 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/>
730 </a>
731 </xsl:variable>
732 <h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
733 <p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/></p>
734 </xsl:template>
735
736 <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
737
738 <xsl:template name="documentPre">
739 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
740 <xsl:call-template name="mapFeatures"/>
741 </xsl:if>
742 </xsl:template>
743
744 <xsl:template name="mapFeatures">
745 <div id="map_canvas" class="map_canvas_full"><xsl:text> </xsl:text></div>
746
747 <xsl:choose>
748 <!-- HIERARCHICAL DOCUMENTS -->
749 <xsl:when test="count(//documentNode) > 0">
750 <xsl:for-each select="documentNode">
751 <xsl:call-template name="mapPlacesNearHere"/>
752 </xsl:for-each>
753 </xsl:when>
754 <!-- SIMPLE DOCUMENTS -->
755 <xsl:otherwise>
756 <xsl:call-template name="mapPlacesNearHere"/>
757 </xsl:otherwise>
758 </xsl:choose>
759
760 <div id="jsonNodes" style="display:none;">
761 <xsl:text>[</xsl:text>
762 <xsl:choose>
763 <!-- HIERARCHICAL DOCUMENTS -->
764 <xsl:when test="count(//documentNode) > 0">
765 <xsl:for-each select="//documentNode">
766 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
767 <xsl:text>{</xsl:text>
768 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">",</xsl:text>
769 <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>
770 <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>
771 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
772 <xsl:text>}</xsl:text>
773 <xsl:if test="not(position() = count(//documentNode))">
774 <xsl:text>,</xsl:text>
775 </xsl:if>
776 </xsl:if>
777 </xsl:for-each>
778 </xsl:when>
779 <!-- SIMPLE DOCUMENTS -->
780 <xsl:otherwise>
781 <xsl:for-each select="/page/pageResponse/document">
782 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
783 <xsl:text>{</xsl:text>
784 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@selectedNode"/><xsl:text disable-output-escaping="yes">",</xsl:text>
785 <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>
786 <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>
787 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
788 <xsl:text>}</xsl:text>
789 </xsl:if>
790 </xsl:for-each>
791 </xsl:otherwise>
792 </xsl:choose>
793 <xsl:text>]</xsl:text>
794 </div>
795 </xsl:template>
796
797 <xsl:template name="mapPlacesNearHere">
798 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
799 <div style="background:#BBFFBB; padding: 5px; margin:0px auto; width:890px;">
800 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.map_nearby_docs')"/>
801 <img id="nearbyDocumentsToggle" style="margin-left:5px;" src="interfaces/{$interface_name}/images/expand.png">
802 <xsl:attribute name="onclick">
803 <xsl:text>performDistanceSearch('</xsl:text>
804 <xsl:value-of select="@nodeID"/>
805 <xsl:text>', '</xsl:text>
806 <gsf:metadata name="Latitude"/>
807 <xsl:text>', '</xsl:text>
808 <gsf:metadata name="Longitude"/>
809 <xsl:text>', 2);</xsl:text>
810 </xsl:attribute>
811 </img>
812 <div id="nearbyDocuments"><xsl:text> </xsl:text></div>
813 </div>
814 </xsl:if>
815 </xsl:template>
816</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.