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

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

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

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