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

Last change on this file since 31818 was 31818, checked in by kjdon, 4 years ago

changing ViewSelection to viewSelection and SlideShow to slideShow to match other option names. only display zoom option if disableZoom not set

  • Property svn:executable set to *
File size: 17.0 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 <xsl:call-template name="berryBasket"/>
80 <!-- add in expand and contract document links -->
81 <xsl:call-template name="expandContractDocumentLinks"/>
82 <!-- dynamically get the contents (if enabled) -->
83 <xsl:choose>
84 <xsl:when test="/page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'">
85 <gsf:image type="Thumb"/>
86 <!-- Table of contents will be dynamically retrieved when viewing a paged document -->
87 <script type="text/javascript">
88 <xsl:text disable-output-escaping="yes">
89 $(window).load(function()
90 {
91 retrieveTableOfContentsAndTitles();
92 <!--setUpFilterButtons();-->
93 });
94 </xsl:text>
95 </script>
96
97 <div id="tableOfContents"><xsl:text> </xsl:text></div>
98 <div id="tocLoadingImage" style="text-align:center;">
99 <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>
100 </div>
101 <label for="filterText"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.filter_pages')"/><xsl:text>: </xsl:text></label><span id="filterOnButtons" style="float: right;">...</span><input id="filterText" type="text" style="width: 100%;"/>
102 <xsl:if test="/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true'">
103 <a href="javascript:extractFilteredPagesToOwnDocument();"><button id="extractDocButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.extract_pages')"/></button></a>
104 </xsl:if>
105 </xsl:when>
106 <xsl:when test="not(/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or /page/pageRequest/paramList/param[@name = 'ec']/@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
123 <div id="tableOfContents">
124 <!-- if ed=1 or ec=1 then we have the complete section hierarchy in the page xml source, so we don't need an ajax call to get the table of contents, we just generate it from the list of nodes -->
125 <xsl:attribute name="class"> <!-- do we ever need this ?? -->
126 <xsl:choose>
127 <xsl:when test="count(//documentNode) > 1">visible</xsl:when>
128 <xsl:otherwise>hidden</xsl:otherwise>
129 </xsl:choose>
130 </xsl:attribute>
131 <xsl:for-each select="documentNode">
132 <xsl:call-template name="documentNodeTOC"/>
133 </xsl:for-each>
134 </div>
135 </xsl:otherwise>
136 </xsl:choose>
137 </div>
138 </td></tr>
139 </table>
140 </div>
141 </xsl:if>
142 </xsl:template>
143
144 <!-- This template is used to display the table of contents -->
145 <xsl:template name="documentNodeTOC">
146 <ul>
147 <table><tr>
148 <!-- The expand/collapse button (not displayed for the top level node) -->
149 <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'">
150 <td>
151 <xsl:choose>
152 <xsl:when test="documentNode">
153 <img id="ttoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
154 <xsl:attribute name="src">
155 <xsl:choose>
156 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or /page/pageResponse/document/@selectedNode = @nodeID">
157 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
158 </xsl:when>
159 <xsl:otherwise>
160 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
161 </xsl:otherwise>
162 </xsl:choose>
163 </xsl:attribute>
164 </img>
165 </xsl:when>
166 <xsl:otherwise>
167 <xsl:attribute name="class">emptyIcon</xsl:attribute>
168 </xsl:otherwise>
169 </xsl:choose>
170 </td>
171 </xsl:if>
172
173 <!-- The chapter/page icon -->
174 <td>
175 <img>
176 <xsl:if test="not(documentNode)">
177 <xsl:attribute name="class">leafNode</xsl:attribute>
178 </xsl:if>
179
180 <xsl:attribute name="src">
181 <xsl:choose>
182 <xsl:when test="not(documentNode)">
183 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_image')"/>
184 </xsl:when>
185 <xsl:otherwise>
186 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'chapter_image')"/>
187 </xsl:otherwise>
188 </xsl:choose>
189 </xsl:attribute>
190 </img>
191 </td>
192
193 <!-- The section name, links to the section in the document -->
194 <td class="tocTextCell">
195 <a id="toclink{@nodeID}" href="javascript:focusSection('{@nodeID}');">
196 <xsl:if test="util:hashToSectionId(@nodeID)">
197 <span class="tocSectionNumber"><xsl:value-of select="util:hashToSectionId(@nodeID)"/><!--<xsl:text> </xsl:text>--></span></xsl:if><span class="tocSectionTitle"><xsl:call-template name="sectionHeading"/></span></a>
198
199 </td>
200 </tr></table>
201
202 <!-- display any child items -->
203 <xsl:if test="documentNode">
204 <li id="toc{@nodeID}">
205 <xsl:attribute name="style">
206 <xsl:choose>
207 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or /page/pageResponse/document/@selectedNode = @nodeID">
208 <xsl:text>display:block;</xsl:text>
209 </xsl:when>
210 <xsl:otherwise>
211 <xsl:text>display:none;</xsl:text>
212 </xsl:otherwise>
213 </xsl:choose>
214 </xsl:attribute>
215 <xsl:for-each select="documentNode">
216 <xsl:call-template name="documentNodeTOC"/>
217 </xsl:for-each>
218 </li>
219 </xsl:if>
220
221 </ul>
222 </xsl:template>
223
224 <xsl:template name="viewOptions">
225 <div id="viewAndZoomOptions" class="ui-state-default ui-corner-all">
226 <ul id="viewOptions">
227 <!-- Paged-image document options -->
228 <xsl:if test="count(//documentNode/metadataList/metadata[@name = 'Screen']) > 0 or /page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'">
229 <!-- view selection option -->
230 <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'">
231 <li id="pagedImageOptions">
232 <select id="viewSelection" onchange="changeView();">
233 <xsl:choose>
234 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'image'">
235 <option><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.default_view')"/></option>
236 <option selected="true"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.image_view')"/></option>
237 <option><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.text_view')"/></option>
238 </xsl:when>
239 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
240 <option><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.default_view')"/></option>
241 <option><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.image_view')"/></option>
242 <option selected="true"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.text_view')"/></option>
243 </xsl:when>
244 <xsl:otherwise>
245 <option selected="true"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.default_view')"/></option>
246 <option><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.image_view')"/></option>
247 <option><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.text_view')"/></option>
248 </xsl:otherwise>
249 </xsl:choose>
250 </select>
251 </li>
252 </xsl:if>
253 <!-- Slide-show options -->
254 <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'">
255 <li id="slideShowOptions">
256 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.slideshowTooltip')"/></xsl:attribute>
257 <img onclick="showSlideShow()">
258 <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'slideshow_image')"/></xsl:attribute>
259 </img>
260 </li>
261 </xsl:if>
262 </xsl:if>
263 <!-- Realistic books link -->
264 <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
265 <li>
266 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.realisticBooksTooltip')"/></xsl:attribute>
267 <img id="rbOptionImage" onclick="bookInit();">
268 <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'realistic_books_image')"/></xsl:attribute>
269 </img>
270 <input id="rbOption" type="checkbox" onclick="bookInit();" class="optionCheckBox"/>
271 </li>
272 </xsl:if>
273
274 <!-- Highlight on/off button -->
275 <xsl:if test="util:contains(/page/pageRequest/paramList/param[@name = 'p.s']/@value, 'Query') and not(metadataList/metadata[@name='NoText']) and not(/page/pageResponse/format[@type='display']/gsf:option[@name='disableSearchTermHighlighting']/@value='true')">
276 <li>
277 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.highlightTooltip')"/></xsl:attribute>
278 <img onclick="swapHighlight(true);">
279 <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'highlight_image')"/></xsl:attribute>
280 </img>
281 <input id="highlightOption" type="checkbox" class="optionCheckBox" onclick="swapHighlight(false);">
282 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 'hl']/@value = 'off')">
283 <xsl:attribute name="checked">checked</xsl:attribute>
284 </xsl:if>
285 </input>
286 </li>
287 </xsl:if><xsl:text> </xsl:text>
288
289 <!-- Zoom on/off button -->
290 <xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='disableZoom']) or /page/pageResponse/format[@type='display']/gsf:option[@name='disableZoom']/@value='false'">
291
292 <li id="zoomOptions" style="display:none;">
293 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.zoomTooltip')"/></xsl:attribute>
294 <img id="zoomToggleImage">
295 <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'zoom_image')"/></xsl:attribute>
296 </img>
297 <input id="zoomToggle" type="checkbox"/>
298 <script type="text/javascript">
299 <xsl:text disable-output-escaping="yes">
300 $("#zoomToggle").change(function()
301 {
302 _imageZoomEnabled = $("#zoomToggle").prop("checked");
303 });
304
305 $("#zoomToggleImage").click(function()
306 {
307 $("#zoomToggle").prop("checked", !$("#zoomToggle").prop("checked"));
308 _imageZoomEnabled = $("#zoomToggle").prop("checked");
309 });
310 </xsl:text>
311 </script>
312 </li>
313 </xsl:if>
314 <!-- Floating TOC on/off button -->
315 <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')">
316 <li id="floatingTOCOptions">
317 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.floatingTooltip')"/></xsl:attribute>
318 <img id="floatTOCToggleImage">
319 <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'float_toc_image')"/></xsl:attribute>
320 </img>
321 <input id="floatTOCToggle" type="checkbox"/>
322 <script type="text/javascript">
323 <xsl:text disable-output-escaping="yes">
324 $("#floatTOCToggle").prop("checked", false);
325 $("#floatTOCToggle").click(function()
326 {
327 floatMenu($("#floatTOCToggle").prop("checked"));
328 });
329
330 $("#floatTOCToggleImage").click(function()
331 {
332 $("#floatTOCToggle").prop("checked", !$("#floatTOCToggle").prop("checked"))
333 floatMenu($("#floatTOCToggle").prop("checked"));
334 });
335 </xsl:text>
336 </script>
337 </li>
338 <xsl:if test="/page/pageRequest/paramList/param[@name='ftoc']/@value = '1'">
339 <script type="text/javascript">
340 <xsl:text disable-output-escaping="yes">
341 $(window).load(function()
342 {
343 $("#floatTOCToggle").prop("checked", true);
344 floatMenu(true);
345 });
346 </xsl:text>
347 </script>
348 </xsl:if>
349 </xsl:if>
350 </ul>
351 <div style="clear:both;"><xsl:text> </xsl:text></div>
352 </div>
353 </xsl:template>
354</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.