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

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

we want to show duplicates of metadata when editing

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