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

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

how embarrassing. Fixing another bug I mistakenly introduced in previous large commit. The default value for the force param should be 0, not 1

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