source: main/trunk/greenstone3/web/interfaces/default/transform/pages/classifier.xsl@ 36636

Last change on this file since 36636 was 36636, checked in by kjdon, 19 months ago

I want the group breadcrumbs to appear on all pages, so adding it into help, pref, classifier, query, document

File size: 15.3 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java="http://xml.apache.org/xslt/java" xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil" xmlns:gslib="http://www.greenstone.org/skinning" xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat" extension-element-prefixes="java util" exclude-result-prefixes="java util gsf">
3
4 <!-- use the 'main' layout -->
5 <xsl:import href="layouts/main.xsl" />
6 <xsl:import href="map-tools.xsl" />
7 <xsl:import href="panorama-viewer-tools.xsl" />
8
9 <!-- set page title -->
10 <xsl:template name="pageTitle">
11 <gslib:serviceName />
12 </xsl:template>
13
14 <!-- set page breadcrumbs -->
15 <xsl:template name="breadcrumbs">
16 <gslib:siteLink />
17 <gslib:rightArrow />
18 <gslib:groupLinks/>
19 <gslib:collectionNameLinked />
20 <gslib:rightArrow />
21 </xsl:template>
22
23 <!-- optional cgi-params for links to document pages -->
24 <xsl:variable name="opt-doc-link-args"></xsl:variable>
25
26 <!-- the page content -->
27 <xsl:template match="/page/pageResponse">
28 <xsl:call-template name="floatRightSidebar" />
29 <xsl:call-template name="classifierPre" />
30
31 <script type="text/javascript" src="interfaces/{$interface_name}/js/classifier_scripts.js">
32 <xsl:text> </xsl:text>
33 </script>
34 <gsf:script type="text/javascript">$(window).on("load", openStoredClassifiers);</gsf:script>
35
36 <!--
37 Show the clasifier results - you can change the appearance of the results
38 by editing the two templates at the bottom of this file
39 -->
40 <div id="results">
41 <xsl:variable name="collName">
42 <xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value" />
43 </xsl:variable>
44 <xsl:variable name="serviceName">
45 <xsl:value-of select="service/@name" />
46 </xsl:variable>
47
48 <xsl:call-template name="classifierResultsPre" />
49
50 <xsl:apply-templates select="classifier">
51 <xsl:with-param name="collName" select="$collName" />
52 <xsl:with-param name="serviceName" select="$serviceName" />
53 </xsl:apply-templates>
54 </div>
55
56 <div class="clear">
57 <xsl:text> </xsl:text>
58 </div>
59 </xsl:template>
60
61 <xsl:template name="rightSidebar">
62 <div id="rightSidebar">
63 <xsl:comment>Filler to prevent empty div collapse, in event displayBasket empty</xsl:comment>
64 <gslib:displayBaskets />
65 </div>
66 </xsl:template>
67
68 <xsl:template match="classifier">
69 <xsl:param name="collName" />
70 <xsl:param name="serviceName" />
71 <div id="classifiers">
72 <xsl:variable name="cl_name">
73 <xsl:value-of select="@name" />
74 </xsl:variable>
75 <xsl:choose>
76 <xsl:when test="@childType = 'HList'">
77 <xsl:call-template name="HList">
78 <xsl:with-param name='collName' select='$collName' />
79 <xsl:with-param name='serviceName' select='$serviceName' />
80 </xsl:call-template>
81 </xsl:when>
82 <xsl:otherwise>
83 <table id="classifiernodelist">
84 <xsl:text> </xsl:text>
85 <xsl:call-template name="processNodeChildren">
86 <xsl:with-param name='collName' select='$collName' />
87 <xsl:with-param name='serviceName' select='$serviceName' />
88 </xsl:call-template>
89 </table>
90 </xsl:otherwise>
91 </xsl:choose>
92 </div>
93 </xsl:template>
94
95 <xsl:template name="HList">
96 <xsl:param name="collName" />
97 <xsl:param name="serviceName" />
98 <xsl:variable name="selectedNode">
99 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'cl']/@value" />
100 </xsl:variable>
101 <ul class="horizontalContainer">
102 <xsl:for-each select='classifierNode'>
103 <li>
104 <xsl:attribute name="class">
105 <xsl:if test="$selectedNode = @nodeID or starts-with($selectedNode, concat(@nodeID, '.')) or (not(contains($selectedNode, '.')) and @nodeID = concat($selectedNode, '.1'))">selectedHorizontalClassifierNode </xsl:if>
106 <xsl:text>horizontalClassifierNode</xsl:text>
107 </xsl:attribute>
108 <xsl:apply-templates select='.'>
109 <xsl:with-param name='collName' select='$collName' />
110 <xsl:with-param name='serviceName' select='$serviceName' />
111 </xsl:apply-templates>
112 </li>
113 </xsl:for-each>
114 </ul>
115 <xsl:choose>
116 <!-- if the children are HLists-->
117 <xsl:when test="classifierNode[@childType = 'HList']">
118 <xsl:for-each select='classifierNode'>
119 <!-- there should be only one-->
120 <xsl:call-template name="HList">
121 <xsl:with-param name='collName' select='$collName' />
122 <xsl:with-param name='serviceName' select='$serviceName' />
123 </xsl:call-template>
124 </xsl:for-each>
125 </xsl:when>
126 <xsl:otherwise>
127 <table id="classifiernodelist">
128 <xsl:for-each select='classifierNode'>
129 <xsl:call-template name="processNodeChildren">
130 <xsl:with-param name='collName' select='$collName' />
131 <xsl:with-param name='serviceName' select='$serviceName' />
132 </xsl:call-template>
133 </xsl:for-each>
134 </table>
135 </xsl:otherwise>
136 </xsl:choose>
137 </xsl:template>
138
139 <xsl:template name="processNodeChildren">
140 <xsl:param name="collName" />
141 <xsl:param name="serviceName" />
142
143 <xsl:choose>
144
145 <xsl:when test="@childType = 'VList' or @childType = 'DateList'">
146 <!--
147 <xsl:when test="@childType = 'VList' or @childType = 'HList' or @childType = 'DateList'"> - - **** mod ???? - -
148 -->
149
150 <xsl:value-of select="util:storeString('prevMonth', '')" />
151 <xsl:for-each select='classifierNode|documentNode'>
152 <tr>
153 <xsl:choose>
154 <xsl:when test="name()='documentNode'">
155 <xsl:if test="../@childType = 'DateList'">
156 <xsl:variable name="prevMonth">
157 <xsl:value-of select="util:getString('prevMonth')" />
158 </xsl:variable>
159 <xsl:variable name="currentDate">
160 <gsf:metadata name="Date" pos="1" />
161 </xsl:variable> <!-- note pos=1 won't work if a document can be included in a datelist multiple times. currently only the first date is used...-->
162 <xsl:variable name="currentMonth">
163 <xsl:value-of select="util:getDetailFromDate($currentDate, 'month', /page/@lang)" />
164 </xsl:variable>
165 <xsl:value-of select="util:storeString('prevMonth', $currentMonth)" />
166 <td>
167 <xsl:if test="not($currentMonth = $prevMonth)">
168 <xsl:value-of select="$currentMonth" />
169 </xsl:if>
170 <xsl:text> </xsl:text>
171 </td>
172 </xsl:if>
173 <td>
174 <table id="div{@nodeID}">
175 <tr>
176 <xsl:call-template name="documentNodeWrapper">
177 <xsl:with-param name='collName' select='$collName' />
178 <xsl:with-param name='serviceName' select='$serviceName' />
179 </xsl:call-template>
180 </tr>
181 </table>
182 </td>
183 </xsl:when>
184 <xsl:when test="name()='classifierNode' and (@childType = 'VList' or @childType = 'HList')">
185 <!-- *** mod -->
186 <td>
187 <table id="title{@nodeID}">
188 <tr>
189 <xsl:if test="not(/page/pageResponse/format[@type='browse']/gsf:option[@name='turnstyleClassifiers']) or /page/pageResponse/format[@type='browse']/gsf:option[@name='turnstyleClassifiers']/@value='true'">
190 <td class="headerTD">
191 <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon turnstyleicon">
192 <xsl:attribute name="src">
193 <xsl:choose>
194 <xsl:when test="classifierNode or documentNode">
195 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')" />
196 </xsl:when>
197 <xsl:otherwise>
198 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')" />
199 </xsl:otherwise>
200 </xsl:choose>
201 </xsl:attribute>
202 </img>
203 </td>
204 </xsl:if>
205 <xsl:apply-templates select='.'>
206 <xsl:with-param name='collName' select='$collName' />
207 <xsl:with-param name='serviceName' select='$serviceName' />
208 </xsl:apply-templates>
209 </tr>
210 </table>
211 </td>
212 <xsl:if test="child::classifierNode or child::documentNode">
213 <!--recurse into the children-->
214 <tr>
215 <td>
216 <table class="childrenlist" id="div{@nodeID}">
217 <xsl:apply-templates select='.' mode='process-all-children'>
218 <xsl:with-param name='collName' select='$collName' />
219 <xsl:with-param name='serviceName' select='$serviceName' />
220 </xsl:apply-templates>
221 </table>
222 </td>
223 </tr>
224 </xsl:if>
225 </xsl:when>
226 <xsl:otherwise>
227 <td>
228 Unknown classifier style specified:
229 <xsl:value-of select="name()" />
230 </td>
231 </xsl:otherwise>
232 </xsl:choose>
233 </tr>
234 </xsl:for-each>
235 </xsl:when>
236 <xsl:when test="@childType = 'HTML'">
237 <xsl:variable name="URL">
238 <xsl:value-of select="documentNode/@nodeID" />
239 </xsl:variable>
240 <iframe width="100%" height="600" frameborder="0">
241 <xsl:attribute name="src">
242 <xsl:value-of select="$URL" />
243 </xsl:attribute>
244 Frame for
245 <xsl:value-of select="$URL" />
246 </iframe>
247 </xsl:when>
248 <xsl:otherwise>
249 we are in the other wise
250 </xsl:otherwise>
251 </xsl:choose>
252 </xsl:template>
253
254 <!-- processing for the recursive bit -->
255 <xsl:template match="classifierNode" mode="process-all-children">
256 <xsl:param name="collName" />
257 <xsl:param name="serviceName" />
258
259 <!--
260 ***mod: previous, simpler version
261 <xsl:call-template name="processNodeChildren">
262 <xsl:with-param name='collName' select='$collName'/>
263 <xsl:with-param name='serviceName' select='$serviceName'/>
264 </xsl:call-template>
265 -->
266
267 <xsl:choose>
268 <xsl:when test="@childType = 'HList'">
269 <xsl:call-template name="HList">
270 <xsl:with-param name='collName' select='$collName' />
271 <xsl:with-param name='serviceName' select='$serviceName' />
272 </xsl:call-template>
273 </xsl:when>
274 <xsl:otherwise>
275 <xsl:call-template name="processNodeChildren">
276 <xsl:with-param name='collName' select='$collName' />
277 <xsl:with-param name='serviceName' select='$serviceName' />
278 </xsl:call-template>
279 </xsl:otherwise>
280 </xsl:choose>
281
282 </xsl:template>
283
284 <!-- this is a wrapper node, which the interface can use to add stuff into the classifier display that isn't part of and doesn't depend on the documentNode template which may come from the collection -->
285 <xsl:template name="documentNodeWrapper">
286 <xsl:param name="collName" />
287 <xsl:param name="serviceName" />
288
289 <!-- The favourite star (optional) -->
290 <xsl:if test="$favouriteBasketOn">
291 <td valign="top">
292 <xsl:call-template name="documentFavouriteForClassifierOrSearchPage" />
293 </td>
294 </xsl:if>
295
296 <xsl:apply-templates select=".">
297 <xsl:with-param name="collName" select="$collName" />
298 <xsl:with-param name="serviceName" select="$serviceName" />
299 </xsl:apply-templates>
300
301 <xsl:call-template name="documentNodePost" />
302 </xsl:template>
303
304 <!--
305 TEMPLATE FOR DOCUMENTS
306 -->
307 <xsl:template match="documentNode">
308 <td valign="top">
309 <gsf:link type="document">
310 <gsf:icon type="document" />
311 </gsf:link>
312 </td>
313 <td valign="top">
314 <gsf:link type="source">
315 <gsf:choose-metadata>
316 <gsf:metadata name="thumbicon" />
317 <gsf:metadata name="srcicon" />
318 </gsf:choose-metadata>
319 </gsf:link>
320 </td>
321 <td valign="top">
322 <gsf:link type="document">
323 <!-- Defined in header.xsl -->
324 <xsl:call-template name="choose-title" />
325 <gsf:switch>
326 <gsf:metadata name="Source" />
327 <gsf:when test="exists">
328 <br />
329 <i>
330 (
331 <gsf:metadata name="Source" />
332 )
333 </i>
334 </gsf:when>
335 </gsf:switch>
336 </gsf:link>
337 </td>
338 </xsl:template>
339
340 <xsl:template name="documentNodePost">
341 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
342 <xsl:if test="metadataList/metadata[@name='Latitude' or @name='Longitude' or @name='Coordinate']">
343 <xsl:call-template name="mapFeaturesIcon" />
344 </xsl:if>
345 </xsl:if>
346
347 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
348 <xsl:if test="metadataList/metadata[@name = 'PhotoType']='Panorama' and ( metadataList/metadata[@name = 'Coordinate'] or ( metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']))">
349 <xsl:call-template name="panoramaViewerFeaturesIcon" />
350 </xsl:if>
351 </xsl:if>
352
353 </xsl:template>
354
355 <!--
356 TEMPLATE FOR GROUPS OF DOCUMENTS
357 -->
358 <xsl:template match="classifierNode[@classifierStyle = 'HList']">
359 <gsf:link type="classifier" style="static">
360 <gsf:metadata name="Title" />
361 </gsf:link>
362 </xsl:template>
363
364 <xsl:template match="classifierNode">
365 <td valign="top">
366 <gsf:link type="classifier" style="static">
367 <gsf:icon type="classifier" />
368 </gsf:link>
369 </td>
370 <td valign="top">
371 <gsf:link type="classifier">
372 <gsf:metadata name="Title" />
373 </gsf:link>
374 </td>
375 </xsl:template>
376
377 <xsl:template name="classifierPre">
378 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
379 <xsl:call-template name="mapFeaturesJSONNodes" />
380 </xsl:if>
381
382 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
383 <xsl:call-template name="panoramaViewerFeaturesJSONNodes" />
384 </xsl:if>
385
386 </xsl:template>
387
388 <xsl:template name="classifierResultsPre">
389 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
390 <xsl:call-template name="mapFeaturesMap" />
391 </xsl:if>
392 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
393 <xsl:call-template name="panoramaViewerFeatures" />
394 </xsl:if>
395 </xsl:template>
396
397 <xsl:template match="/page/xsltparams">
398 <!-- suppress xsltparam block in page -->
399 </xsl:template>
400
401</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.