source: main/trunk/greenstone3/web/interfaces/default/transform/layouts/toc.xsl@ 29520

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

removed extraneous ')'

  • Property svn:executable set to *
File size: 15.9 KB
Line 
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 <xsl:template name="rightSidebar">
12 <div id="rightSidebar">
13 <xsl:choose>
14 <xsl:when test="@docType = 'simple'">
15 <xsl:for-each select=".">
16 <xsl:call-template name="displayCoverImage"/>
17 </xsl:for-each>
18 <xsl:call-template name="viewOptions"/>
19 <!--<xsl:text> </xsl:text>-->
20 </xsl:when>
21 <xsl:otherwise>
22 <xsl:for-each select="documentNode[1]">
23 <xsl:call-template name="displayCoverImage"/>
24 </xsl:for-each>
25 <xsl:call-template name="viewOptions"/>
26 <xsl:call-template name="displayTOC"/>
27 </xsl:otherwise>
28 </xsl:choose>
29 </div>
30 </xsl:template>
31
32 <!-- this is called in the context of the top level node with the metadataList. For a simple doc, this is the document node. For a comples document, this is the first documentNode hcild of the document node. -->
33 <xsl:template name="displayCoverImage">
34 <xsl:variable name="hasCover"><gsf:metadata name="hascover"/></xsl:variable>
35 <xsl:if test="$hasCover = '1' and (not(/page/pageResponse/format[@type='display']/gsf:option[@name='coverImage']) or /page/pageResponse/format[@type='display']/gsf:option[@name='coverImage']/@value='true')">
36 <!-- the book's cover image -->
37 <div id="coverImage">
38 <img>
39 <xsl:attribute name="src"><xsl:value-of select="$httpPath"/>/index/assoc/<gsf:metadata name="assocfilepath" pos="1"/>/cover.jpg</xsl:attribute>
40 </img><xsl:text> </xsl:text>
41 </div>
42 </xsl:if>
43 </xsl:template>
44
45 <xsl:template name="displayTOC">
46 <xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='TOC']) or /page/pageResponse/format[@type='display']/gsf:option[@name='TOC']/@value='true'">
47 <div class="tableOfContentsContainer ui-state-default">
48 <table class="tocTable ui-widget-content">
49 <tr>
50 <td id="unfloatTOCButton" style="display:none;">
51 <a href="javascript:floatMenu(false);">
52 <img class="icon" style="padding-top:3px;">
53 <xsl:attribute name="src">
54 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'left_arrow_image')"/>
55 </xsl:attribute>
56 </img>
57 </a>
58 </td>
59 <td style="vertical-align:top; text-align:right;">
60 <a id="sidebarMinimizeButton" href="javascript:minimizeSidebar();" style="float: right; font-size:0.6em;">
61 <img class="icon" style="padding-top:3px;">
62 <xsl:attribute name="src">
63 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
64 </xsl:attribute>
65 </img>
66 </a>
67 <a id="sidebarMaximizeButton" href="javascript:maximizeSidebar();" style="float: right; font-size:0.6em; display:none;">
68 <img class="icon" style="padding-top:3px;">
69 <xsl:attribute name="src">
70 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
71 </xsl:attribute>
72 </img>
73 </a>
74 </td>
75 </tr>
76 <tr><td>
77 <div id="contentsArea">
78 <!-- show the berry basket if it's turned on -->
79 <gslib:berryBasket/>
80
81 <!-- the contents (if enabled) -->
82 <xsl:choose>
83 <xsl:when test="/page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'">
84 <gsf:image type="Thumb"/>
85 <!-- Table of contents will be dynamically retrieved when viewing a paged document -->
86 <script type="text/javascript">
87 <xsl:text disable-output-escaping="yes">
88 $(window).load(function()
89 {
90 retrieveTableOfContentsAndTitles();
91 });
92 </xsl:text>
93 </script>
94 <div id="tableOfContents"><xsl:text> </xsl:text></div>
95 <div id="tocLoadingImage" style="text-align:center;">
96 <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>
97 </div>
98 <table style="width:100%;"><tbody><tr>
99 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.filter_pages')"/><xsl:text>: </xsl:text><input id="filterText" type="text" size="27"/></td>
100 </tr>
101 <xsl:if test="/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true'">
102 <tr><td><a href="javascript:extractFilteredPagesToOwnDocument();"><button id="extractDocButton">Extract these pages to document</button></a></td></tr>
103 </xsl:if>
104 </tbody></table>
105 </xsl:when>
106 <xsl:when test="not(/page/pageRequest/paramList/param[@name = 'ed']/@value = '1')">
107 <div id="tableOfContents">
108 <div id="tocLoadingImage" style="text-align:center;">
109 <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>
110 </div>
111 </div>
112 <script type="text/javascript">
113 <xsl:text disable-output-escaping="yes">
114 $(window).load(function()
115 {
116 retrieveFullTableOfContents();
117 });
118 </xsl:text>
119 </script>
120 </xsl:when>
121 <xsl:otherwise>
122 <div id="tableOfContents">
123 <xsl:attribute name="class">
124 <xsl:choose>
125 <xsl:when test="count(//documentNode) > 1 and not(/page/pageResponse/format[@type='display']/gsf:option[@name='TOC']) or /page/pageResponse/format[@type='display']/gsf:option[@name='TOC']/@value='true'">visible</xsl:when>
126 <xsl:otherwise>hidden</xsl:otherwise>
127 </xsl:choose>
128 </xsl:attribute>
129 <xsl:for-each select="documentNode">
130 <xsl:call-template name="documentNodeTOC"/>
131 </xsl:for-each>
132 </div>
133 </xsl:otherwise>
134 </xsl:choose>
135 </div>
136 </td></tr>
137 </table>
138 </div>
139 </xsl:if>
140 </xsl:template>
141
142 <!-- This template is used to display the table of contents -->
143 <xsl:template name="documentNodeTOC">
144
145 <!-- check if this is the currently selected table of contents item -->
146 <xsl:variable name="isCurrent" select="nodeContent"/>
147
148 <!-- formulate the link -->
149 <xsl:variable name="contentsLink">
150 <xsl:value-of select='$library_name'/>?a=d&amp;c=<gslib:collectionNameShort/>&amp;d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if>&amp;sib=1
151 </xsl:variable>
152
153 <ul>
154 <table><tr>
155 <!-- The expand/collapse button (not displayed for the top level node) -->
156 <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'">
157 <td>
158 <xsl:choose>
159 <xsl:when test="not(nodeContent and not(documentNode))">
160 <img id="ttoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
161 <xsl:attribute name="src">
162 <xsl:choose>
163 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or /page/pageResponse/document/@selectedNode = @nodeID">
164 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
165 </xsl:when>
166 <xsl:otherwise>
167 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
168 </xsl:otherwise>
169 </xsl:choose>
170 </xsl:attribute>
171 </img>
172 </xsl:when>
173 <xsl:otherwise>
174 <xsl:attribute name="class">emptyIcon</xsl:attribute>
175 </xsl:otherwise>
176 </xsl:choose>
177 </td>
178 </xsl:if>
179
180 <!-- The chapter/page icon -->
181 <td>
182 <img>
183 <xsl:if test="nodeContent and not(documentNode)">
184 <xsl:attribute name="class">leafNode</xsl:attribute>
185 </xsl:if>
186
187 <xsl:attribute name="src">
188 <xsl:choose>
189 <xsl:when test="nodeContent and not(documentNode)">
190 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_image')"/>
191 </xsl:when>
192 <xsl:otherwise>
193 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'chapter_image')"/>
194 </xsl:otherwise>
195 </xsl:choose>
196 </xsl:attribute>
197 </img>
198 </td>
199
200 <!-- The section name, links to the section in the document -->
201 <td class="tocTextCell">
202 <a id="toclink{@nodeID}" href="javascript:focusSection('{@nodeID}');">
203 <xsl:if test="util:hashToSectionId(@nodeID)">
204 <xsl:value-of select="util:hashToSectionId(@nodeID)"/>
205 <xsl:text> </xsl:text>
206 </xsl:if>
207 <xsl:call-template name="sectionHeading"/>
208 </a>
209 </td>
210 </tr></table>
211
212 <!-- display any child items -->
213 <xsl:if test="documentNode">
214 <li id="toc{@nodeID}">
215 <xsl:attribute name="style">
216 <xsl:choose>
217 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or /page/pageResponse/document/@selectedNode = @nodeID">
218 <xsl:text>display:block;</xsl:text>
219 </xsl:when>
220 <xsl:otherwise>
221 <xsl:text>display:none;</xsl:text>
222 </xsl:otherwise>
223 </xsl:choose>
224 </xsl:attribute>
225 <xsl:for-each select="documentNode">
226 <xsl:call-template name="documentNodeTOC"/>
227 </xsl:for-each>
228 </li>
229 </xsl:if>
230
231 </ul>
232 </xsl:template>
233
234 <xsl:template name="viewOptions">
235 <div id="viewAndZoomOptions" class="ui-state-default ui-corner-all">
236 <ul id="viewOptions">
237 <!-- Paged-image document options -->
238 <xsl:if test="count(//documentNode/metadataList/metadata[@name = 'Screen']) > 0 or /page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'">
239 <!-- view selection option -->
240 <xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='ViewSelection']) or /page/pageResponse/format[@type='display']/gsf:option[@name='ViewSelection']/@value='true'">
241 <li id="pagedImageOptions">
242 <select id="viewSelection" onchange="changeView();">
243 <xsl:choose>
244 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'image'">
245 <option>Default view</option>
246 <option selected="true">Image view</option>
247 <option>Text view</option>
248 </xsl:when>
249 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
250 <option>Default view</option>
251 <option>Image view</option>
252 <option selected="true">Text view</option>
253 </xsl:when>
254 <xsl:otherwise>
255 <option selected="true">Default view</option>
256 <option>Image view</option>
257 <option>Text view</option>
258 </xsl:otherwise>
259 </xsl:choose>
260 </select>
261 </li>
262 </xsl:if>
263 <!-- Slide-show options -->
264 <xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='SlideShow']) or /page/pageResponse/format[@type='display']/gsf:option[@name='SlideShow']/@value='true'">
265 <li id="slideShowOptions">
266 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.slideshowTooltip')"/></xsl:attribute>
267 <img onclick="showSlideShow()">
268 <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'slideshow_image')"/></xsl:attribute>
269 </img>
270 </li>
271 </xsl:if>
272 </xsl:if>
273 <!-- Realistic books link -->
274 <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
275 <li>
276 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.realisticBooksTooltip')"/></xsl:attribute>
277 <img id="rbOptionImage" onclick="bookInit();">
278 <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'realistic_books_image')"/></xsl:attribute>
279 </img>
280 <input id="rbOption" type="checkbox" onclick="bookInit();" class="optionCheckBox"/>
281 </li>
282 </xsl:if>
283
284 <!-- Highlight on/off button -->
285 <xsl:if test="util:contains(/page/pageRequest/paramList/param[@name = 'p.s']/@value, 'Query') and not(metadataList/metadata[@name='NoText'])">
286 <li>
287 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.highlightTooltip')"/></xsl:attribute>
288 <img onclick="swapHighlight(true);">
289 <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'highlight_image')"/></xsl:attribute>
290 </img>
291 <input id="highlightOption" type="checkbox" class="optionCheckBox" onclick="swapHighlight(false);">
292 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 'hl']/@value = 'off')">
293 <xsl:attribute name="checked">checked</xsl:attribute>
294 </xsl:if>
295 </input>
296 </li>
297 </xsl:if><xsl:text> </xsl:text>
298
299 <!-- Zoom on/off button -->
300 <li id="zoomOptions" style="display:none;">
301 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.zoomTooltip')"/></xsl:attribute>
302 <img id="zoomToggleImage">
303 <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'zoom_image')"/></xsl:attribute>
304 </img>
305 <input id="zoomToggle" type="checkbox"/>
306 <script type="text/javascript">
307 <xsl:text disable-output-escaping="yes">
308 $("#zoomToggle").change(function()
309 {
310 _imageZoomEnabled = $("#zoomToggle").prop("checked");
311 });
312
313 $("#zoomToggleImage").click(function()
314 {
315 $("#zoomToggle").prop("checked", !$("#zoomToggle").prop("checked"));
316 _imageZoomEnabled = $("#zoomToggle").prop("checked");
317 });
318 </xsl:text>
319 </script>
320 </li>
321
322 <!-- Floating TOC on/off button -->
323 <xsl:if test="count(//documentNode) > 0 and (not(/page/pageResponse/format[@type='display']/gsf:option[@name='TOC']) or /page/pageResponse/format[@type='display']/gsf:option[@name='TOC']/@value='true')">
324 <li id="floatingTOCOptions">
325 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.floatingTooltip')"/></xsl:attribute>
326 <img id="floatTOCToggleImage">
327 <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'float_toc_image')"/></xsl:attribute>
328 </img>
329 <input id="floatTOCToggle" type="checkbox"/>
330 <script type="text/javascript">
331 <xsl:text disable-output-escaping="yes">
332 $("#floatTOCToggle").prop("checked", false);
333 $("#floatTOCToggle").click(function()
334 {
335 floatMenu($("#floatTOCToggle").prop("checked"));
336 });
337
338 $("#floatTOCToggleImage").click(function()
339 {
340 $("#floatTOCToggle").prop("checked", !$("#floatTOCToggle").prop("checked"))
341 floatMenu($("#floatTOCToggle").prop("checked"));
342 });
343 </xsl:text>
344 </script>
345 </li>
346 <xsl:if test="/page/pageRequest/paramList/param[@name='ftoc']/@value = '1'">
347 <script type="text/javascript">
348 <xsl:text disable-output-escaping="yes">
349 $(window).load(function()
350 {
351 $("#floatTOCToggle").prop("checked", true);
352 floatMenu(true);
353 });
354 </xsl:text>
355 </script>
356 </xsl:if>
357 </xsl:if>
358 </ul>
359 <div style="clear:both;"><xsl:text> </xsl:text></div>
360 </div>
361 </xsl:template>
362</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.