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