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

Last change on this file since 31534 was 31534, checked in by kjdon, 7 years ago

changed the comment.

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