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

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

added the collage mods from classifier.xsl-for-gs311 into classifier.xsl, and removed the former file

File size: 16.0 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="Collage">
140 <script type="text/javascript" src="interfaces/{$interface_name}/js/collage_scripts.js"><xsl:text> </xsl:text></script>
141 <div id="collagewrapper" style="width: 800px; height: 643px; position: relative; background-image:url('sites/{$site_name}/collect/twso/images/oldimagebackground1.png'); text-align: center;" alt="Click to start/stop a collage of images" title="Click to start/stop a collage of images" onmouseover="" onmouseout=""><xsl:text> </xsl:text></div>
142
143 </xsl:template>
144
145 <xsl:template name="processNodeChildren">
146 <xsl:param name="collName" />
147 <xsl:param name="serviceName" />
148
149 <xsl:choose>
150
151 <xsl:when test="@childType = 'VList' or @childType = 'DateList'">
152 <!--
153 <xsl:when test="@childType = 'VList' or @childType = 'HList' or @childType = 'DateList'"> - - **** mod ???? - -
154 -->
155
156 <xsl:value-of select="util:storeString('prevMonth', '')" />
157 <xsl:for-each select='classifierNode|documentNode'>
158 <tr>
159 <xsl:choose>
160 <xsl:when test="name()='documentNode'">
161 <xsl:if test="../@childType = 'DateList'">
162 <xsl:variable name="prevMonth">
163 <xsl:value-of select="util:getString('prevMonth')" />
164 </xsl:variable>
165 <xsl:variable name="currentDate">
166 <gsf:metadata name="Date" pos="1" />
167 </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...-->
168 <xsl:variable name="currentMonth">
169 <xsl:value-of select="util:getDetailFromDate($currentDate, 'month', /page/@lang)" />
170 </xsl:variable>
171 <xsl:value-of select="util:storeString('prevMonth', $currentMonth)" />
172 <td>
173 <xsl:if test="not($currentMonth = $prevMonth)">
174 <xsl:value-of select="$currentMonth" />
175 </xsl:if>
176 <xsl:text> </xsl:text>
177 </td>
178 </xsl:if>
179 <td>
180 <table id="div{@nodeID}">
181 <tr>
182 <xsl:call-template name="documentNodeWrapper">
183 <xsl:with-param name='collName' select='$collName' />
184 <xsl:with-param name='serviceName' select='$serviceName' />
185 </xsl:call-template>
186 </tr>
187 </table>
188 </td>
189 </xsl:when>
190 <xsl:when test="name()='classifierNode' and (@childType = 'VList' or @childType = 'HList')">
191 <!-- *** mod -->
192 <td>
193 <table id="title{@nodeID}">
194 <tr>
195 <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'">
196 <td class="headerTD">
197 <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon turnstyleicon">
198 <xsl:attribute name="src">
199 <xsl:choose>
200 <xsl:when test="classifierNode or documentNode">
201 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')" />
202 </xsl:when>
203 <xsl:otherwise>
204 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')" />
205 </xsl:otherwise>
206 </xsl:choose>
207 </xsl:attribute>
208 </img>
209 </td>
210 </xsl:if>
211 <xsl:apply-templates select='.'>
212 <xsl:with-param name='collName' select='$collName' />
213 <xsl:with-param name='serviceName' select='$serviceName' />
214 </xsl:apply-templates>
215 </tr>
216 </table>
217 </td>
218 <xsl:if test="child::classifierNode or child::documentNode">
219 <!--recurse into the children-->
220 <tr>
221 <td>
222 <table class="childrenlist" id="div{@nodeID}">
223 <xsl:apply-templates select='.' mode='process-all-children'>
224 <xsl:with-param name='collName' select='$collName' />
225 <xsl:with-param name='serviceName' select='$serviceName' />
226 </xsl:apply-templates>
227 </table>
228 </td>
229 </tr>
230 </xsl:if>
231 </xsl:when>
232 <xsl:otherwise>
233 <td>
234 Unknown classifier style specified:
235 <xsl:value-of select="name()" />
236 </td>
237 </xsl:otherwise>
238 </xsl:choose>
239 </tr>
240 </xsl:for-each>
241 </xsl:when>
242 <xsl:when test="@childType = 'HTML'">
243 <xsl:variable name="URL">
244 <xsl:value-of select="documentNode/@nodeID" />
245 </xsl:variable>
246 <iframe width="100%" height="600" frameborder="0">
247 <xsl:attribute name="src">
248 <xsl:value-of select="$URL" />
249 </xsl:attribute>
250 Frame for
251 <xsl:value-of select="$URL" />
252 </iframe>
253 </xsl:when>
254 <xsl:when test="@childType = 'Collage'">
255 <xsl:call-template name="Collage" />
256 </xsl:when>
257 <xsl:otherwise>
258 we are in the other wise
259 </xsl:otherwise>
260 </xsl:choose>
261 </xsl:template>
262
263 <!-- processing for the recursive bit -->
264 <xsl:template match="classifierNode" mode="process-all-children">
265 <xsl:param name="collName" />
266 <xsl:param name="serviceName" />
267
268 <!--
269 ***mod: previous, simpler version
270 <xsl:call-template name="processNodeChildren">
271 <xsl:with-param name='collName' select='$collName'/>
272 <xsl:with-param name='serviceName' select='$serviceName'/>
273 </xsl:call-template>
274 -->
275
276 <xsl:choose>
277 <xsl:when test="@childType = 'HList'">
278 <xsl:call-template name="HList">
279 <xsl:with-param name='collName' select='$collName' />
280 <xsl:with-param name='serviceName' select='$serviceName' />
281 </xsl:call-template>
282 </xsl:when>
283 <xsl:otherwise>
284 <xsl:call-template name="processNodeChildren">
285 <xsl:with-param name='collName' select='$collName' />
286 <xsl:with-param name='serviceName' select='$serviceName' />
287 </xsl:call-template>
288 </xsl:otherwise>
289 </xsl:choose>
290
291 </xsl:template>
292
293 <!-- 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 -->
294 <xsl:template name="documentNodeWrapper">
295 <xsl:param name="collName" />
296 <xsl:param name="serviceName" />
297
298 <!-- The favourite star (optional) -->
299 <xsl:if test="$favouriteBasketOn">
300 <td valign="top">
301 <xsl:call-template name="documentFavouriteForClassifierOrSearchPage" />
302 </td>
303 </xsl:if>
304
305 <xsl:apply-templates select=".">
306 <xsl:with-param name="collName" select="$collName" />
307 <xsl:with-param name="serviceName" select="$serviceName" />
308 </xsl:apply-templates>
309
310 <xsl:call-template name="documentNodePost" />
311 </xsl:template>
312
313 <!--
314 TEMPLATE FOR DOCUMENTS
315 -->
316 <xsl:template match="documentNode">
317 <td valign="top">
318 <gsf:link type="document">
319 <gsf:icon type="document" />
320 </gsf:link>
321 </td>
322 <td valign="top">
323 <gsf:link type="source">
324 <gsf:choose-metadata>
325 <gsf:metadata name="thumbicon" />
326 <gsf:metadata name="srcicon" />
327 </gsf:choose-metadata>
328 </gsf:link>
329 </td>
330 <td valign="top">
331 <gsf:link type="document">
332 <!-- Defined in header.xsl -->
333 <xsl:call-template name="choose-title" />
334 <gsf:switch>
335 <gsf:metadata name="Source" />
336 <gsf:when test="exists">
337 <br />
338 <i>
339 (
340 <gsf:metadata name="Source" />
341 )
342 </i>
343 </gsf:when>
344 </gsf:switch>
345 </gsf:link>
346 </td>
347 </xsl:template>
348
349 <xsl:template name="documentNodePost">
350 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
351 <xsl:if test="metadataList/metadata[@name='Latitude' or @name='Longitude' or @name='Coordinate']">
352 <xsl:call-template name="mapFeaturesIcon" />
353 </xsl:if>
354 </xsl:if>
355
356 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
357 <xsl:if test="metadataList/metadata[@name = 'PhotoType']='Panorama' and ( metadataList/metadata[@name = 'Coordinate'] or ( metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']))">
358 <xsl:call-template name="panoramaViewerFeaturesIcon" />
359 </xsl:if>
360 </xsl:if>
361
362 </xsl:template>
363
364 <!--
365 TEMPLATE FOR GROUPS OF DOCUMENTS
366 -->
367 <xsl:template match="classifierNode[@classifierStyle = 'HList']">
368 <gsf:link type="classifier" style="static">
369 <gsf:metadata name="Title" />
370 </gsf:link>
371 </xsl:template>
372
373 <xsl:template match="classifierNode">
374 <td valign="top">
375 <gsf:link type="classifier" style="static">
376 <gsf:icon type="classifier" />
377 </gsf:link>
378 </td>
379 <td valign="top">
380 <gsf:link type="classifier">
381 <gsf:metadata name="Title" />
382 </gsf:link>
383 </td>
384 </xsl:template>
385
386 <xsl:template name="classifierPre">
387 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
388 <xsl:call-template name="mapFeaturesJSONNodes" />
389 </xsl:if>
390
391 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
392 <xsl:call-template name="panoramaViewerFeaturesJSONNodes" />
393 </xsl:if>
394
395 </xsl:template>
396
397 <xsl:template name="classifierResultsPre">
398 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
399 <xsl:call-template name="mapFeaturesMap" />
400 </xsl:if>
401 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
402 <xsl:call-template name="panoramaViewerFeatures" />
403 </xsl:if>
404 </xsl:template>
405
406 <xsl:template match="/page/xsltparams">
407 <!-- suppress xsltparam block in page -->
408 </xsl:template>
409
410</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.