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

Last change on this file since 38885 was 38885, checked in by anupama, 3 months ago
  1. Simplified collage applet parameters for GS3. TODO: Just noticed I can remove sitename as it's now only used for href_musthave, which I can set as an official collage applet parameter, so moving that out of the Java code will also reduce my unncessary code additions. 2. Got the status bar working at last, which was a great pain, as it mattered when it was added and where in the code to get the sizing right without overlapping with the collage display (or being obscured entirely by it). It had to be added in main. TODO: a param to hide the status bar as my new code to the collage applet may be the only one to use it, and I only added the showStatus messages to test it works.
File size: 18.1 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 <!-- the page content -->
24 <xsl:template match="/page/pageResponse">
25 <xsl:call-template name="floatRightSidebar" />
26 <xsl:call-template name="classifierPre" />
27
28 <script type="text/javascript" src="interfaces/{$interface_name}/js/classifier_scripts.js">
29 <xsl:text> </xsl:text>
30 </script>
31 <gsf:script type="text/javascript">$(window).on("load", openStoredClassifiers);</gsf:script>
32
33 <!--
34 Show the clasifier results - you can change the appearance of the results
35 by editing the two templates at the bottom of this file
36 -->
37 <div id="results">
38 <xsl:variable name="collName">
39 <xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value" />
40 </xsl:variable>
41 <xsl:variable name="serviceName">
42 <xsl:value-of select="service/@name" />
43 </xsl:variable>
44
45 <xsl:call-template name="classifierResultsPre" />
46
47 <xsl:apply-templates select="classifier">
48 <xsl:with-param name="collName" select="$collName" />
49 <xsl:with-param name="serviceName" select="$serviceName" />
50 </xsl:apply-templates>
51
52 <xsl:call-template name="classifierResultsPost" />
53
54 <xsl:call-template name="classifierPost" />
55 </div>
56
57 <div class="clear">
58 <xsl:text> </xsl:text>
59 </div>
60 </xsl:template>
61
62 <xsl:template name="rightSidebar">
63 <div id="rightSidebar">
64 <xsl:comment>Filler to prevent empty div collapse, in event displayBasket empty</xsl:comment>
65 <gslib:displayBaskets />
66 </div>
67 </xsl:template>
68
69 <xsl:template match="classifier">
70 <xsl:param name="collName" />
71 <xsl:param name="serviceName" />
72 <div id="classifiers">
73 <xsl:variable name="cl_name">
74 <xsl:value-of select="@name" />
75 </xsl:variable>
76 <xsl:choose>
77 <xsl:when test="@childType = 'HList'">
78 <xsl:call-template name="HList">
79 <xsl:with-param name='collName' select='$collName' />
80 <xsl:with-param name='serviceName' select='$serviceName' />
81 </xsl:call-template>
82 </xsl:when>
83 <xsl:otherwise>
84 <table class="childrenlist" id="div{@nodeID}">
85
86 <!--<table id="classifiernodelist">-->
87 <xsl:text> </xsl:text>
88 <xsl:call-template name="processNodeChildren">
89 <xsl:with-param name='collName' select='$collName' />
90 <xsl:with-param name='serviceName' select='$serviceName' />
91 </xsl:call-template>
92 </table>
93 </xsl:otherwise>
94 </xsl:choose>
95 </div>
96 </xsl:template>
97
98 <xsl:template name="HList">
99 <xsl:param name="collName" />
100 <xsl:param name="serviceName" />
101 <xsl:variable name="selectedNode">
102 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'cl']/@value" />
103 </xsl:variable>
104
105 <ul class="horizontalContainer">
106 <xsl:for-each select='classifierNode'>
107 <li id="title{@nodeID}">
108 <xsl:attribute name="class">
109<!-- <xsl:if test="$selectedNode = @nodeID or starts-with($selectedNode, concat(@nodeID, '.')) or (not(contains($selectedNode, '.')) and @nodeID = concat($selectedNode, '.1'))">selectedHorizontalClassifierNode </xsl:if>-->
110 <xsl:if test="$selectedNode = @nodeID or starts-with($selectedNode, concat(@nodeID, '.')) or (@nodeID = concat($selectedNode, '.1'))">selectedHorizontalClassifierNode </xsl:if>
111 <xsl:text>horizontalClassifierNode</xsl:text>
112 </xsl:attribute>
113 <xsl:apply-templates select='.'>
114 <xsl:with-param name='collName' select='$collName' />
115 <xsl:with-param name='serviceName' select='$serviceName' />
116 </xsl:apply-templates>
117 </li>
118 </xsl:for-each>
119 </ul>
120 <xsl:choose>
121 <!-- if the children are HLists-->
122 <xsl:when test="classifierNode[@childType = 'HList']">
123 <xsl:for-each select='classifierNode'>
124 <!-- there should be only one-->
125 <xsl:call-template name="HList">
126 <xsl:with-param name='collName' select='$collName' />
127 <xsl:with-param name='serviceName' select='$serviceName' />
128 </xsl:call-template>
129 </xsl:for-each>
130 </xsl:when>
131 <xsl:otherwise>
132
133 <div id="classifiernodelist{@nodeID}">
134 <xsl:for-each select='classifierNode'>
135 <xsl:if test="classifierNode|documentNode">
136 <table class="childrenlist" id="div{@nodeID}">
137 <xsl:call-template name="processNodeChildren">
138 <xsl:with-param name='collName' select='$collName' />
139 <xsl:with-param name='serviceName' select='$serviceName' />
140 </xsl:call-template>
141 </table>
142 </xsl:if>
143 </xsl:for-each>
144 </div>
145 </xsl:otherwise>
146 </xsl:choose>
147 </xsl:template>
148
149 <xsl:template name="Collage">
150
151 <xsl:text>TODO: Here is the collage applet</xsl:text>
152 <!-- Copied from GS2.88's about.dm (document.dm has a more applet params).
153
154 Modified params: codebase, GsdlCollageApplet class' package, gwcgi, collection, classifier value="CL2.3", hrefMustHave value="cl=CL3.1". Param isJava2's value changed from auto to true.
155 And made all param XML elements self-closing.
156 -->
157 <!-- we seem to be in the web dir, so look in web/applet for the jar -->
158 <applet CODEBASE="applet"
159 code="org.greenstone.applet.GsdlCollageApplet.GsdlCollageApplet.class"
160 archive="GsdlCollageApplet.jar"
161 width="600" height="300">
162
163 <param name='gsdlversion' value='3' />
164 <param name='baseurl' value='http://localhost:8383/greenstone3/' />
165 <param name='sitename' value='localsite' />
166 <param name='library' value='library'/>
167 <param name="collection" value="smallbea"/>
168 <param name="classifier" value="CL2.3"/> <!-- 3.1 -->
169
170 <param name='documentroot' value='greenstone3'/>
171 <!--<param name="documentroot" value="/greenstone/web/images"/> for GS2-->
172
173 <param name='imageType' value='.jpg%.png' />
174 <param name='verbosity' value='3' />
175 <!--<param name="hrefMustHave" value="CL3"/>-->
176 <param name='imageMustNotHave' value='interfaces/' />
177 <param name="maxDepth" value="500"/>
178 <param name='maxDisplay' value='25' />
179 <param name="refreshDelay" value="1500"/>
180 <param name="isJava2" value="auto"/>
181 <param name='bgcolor' value='#96c29a' />
182The Collage Applet.
183
184 </applet>
185 </xsl:template>
186
187 <xsl:template name="Collage_javascript_deprecated">
188 <script type="text/javascript" src="interfaces/{$interface_name}/js/collage_scripts.js"><xsl:text> </xsl:text></script>
189 <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>
190
191 </xsl:template>
192
193 <xsl:template name="processNodeChildren">
194 <xsl:param name="collName" />
195 <xsl:param name="serviceName" />
196
197 <xsl:choose>
198
199 <xsl:when test="@childType = 'VList' or @childType = 'DateList'">
200 <!--
201 <xsl:when test="@childType = 'VList' or @childType = 'HList' or @childType = 'DateList'"> - - **** mod ???? - -
202 -->
203
204 <xsl:value-of select="util:storeString('prevMonth', '')" />
205 <xsl:for-each select='classifierNode|documentNode'>
206 <tr>
207 <xsl:choose>
208 <xsl:when test="name()='documentNode'">
209 <xsl:if test="../@childType = 'DateList'">
210 <xsl:variable name="prevMonth">
211 <xsl:value-of select="util:getString('prevMonth')" />
212 </xsl:variable>
213 <xsl:variable name="currentDate">
214 <gsf:metadata name="Date" pos="1" />
215 </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...-->
216 <xsl:variable name="currentMonth">
217 <xsl:value-of select="util:getDetailFromDate($currentDate, 'month', /page/@lang)" />
218 </xsl:variable>
219 <xsl:value-of select="util:storeString('prevMonth', $currentMonth)" />
220 <td>
221 <xsl:if test="not($currentMonth = $prevMonth)">
222 <xsl:value-of select="$currentMonth" />
223 </xsl:if>
224 <xsl:text> </xsl:text>
225 </td>
226 </xsl:if>
227 <td>
228 <table id="div{@nodeID}">
229 <tr>
230 <xsl:call-template name="documentNodeWrapper">
231 <xsl:with-param name='collName' select='$collName' />
232 <xsl:with-param name='serviceName' select='$serviceName' />
233 </xsl:call-template>
234 </tr>
235 </table>
236 </td>
237 </xsl:when>
238 <xsl:when test="name()='classifierNode' and (@childType = 'VList' or @childType = 'HList')">
239 <!-- *** mod -->
240 <td>
241 <table id="title{@nodeID}">
242 <tr>
243 <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'">
244 <td class="headerTD">
245 <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon turnstyleicon">
246 <xsl:attribute name="src">
247 <xsl:choose>
248 <xsl:when test="classifierNode or documentNode">
249 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')" />
250 </xsl:when>
251 <xsl:otherwise>
252 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')" />
253 </xsl:otherwise>
254 </xsl:choose>
255 </xsl:attribute>
256 </img>
257 </td>
258 </xsl:if>
259 <xsl:apply-templates select='.'>
260 <xsl:with-param name='collName' select='$collName' />
261 <xsl:with-param name='serviceName' select='$serviceName' />
262 </xsl:apply-templates>
263 </tr>
264 </table>
265 </td>
266 <xsl:if test="child::classifierNode or child::documentNode">
267 <!--recurse into the children-->
268 <tr>
269 <td>
270 <table class="childrenlist" id="div{@nodeID}">
271
272 <xsl:apply-templates select='.' mode='process-all-children'>
273 <xsl:with-param name='collName' select='$collName' />
274 <xsl:with-param name='serviceName' select='$serviceName' />
275 </xsl:apply-templates>
276 </table>
277 </td>
278 </tr>
279 </xsl:if>
280 </xsl:when>
281 <xsl:otherwise>
282 <td>
283 Unknown classifier style specified:
284 <xsl:value-of select="name()" />
285 </td>
286 </xsl:otherwise>
287 </xsl:choose>
288 </tr>
289 </xsl:for-each>
290 </xsl:when>
291 <xsl:when test="@childType = 'HTML'">
292 <xsl:variable name="URL">
293 <xsl:value-of select="documentNode/@nodeID" />
294 </xsl:variable>
295 <iframe width="100%" height="600" frameborder="0">
296 <xsl:attribute name="src">
297 <xsl:value-of select="$URL" />
298 </xsl:attribute>
299 Frame for
300 <xsl:value-of select="$URL" />
301 </iframe>
302 </xsl:when>
303 <xsl:when test="@childType = 'Collage'">
304 <xsl:call-template name="Collage" />
305 </xsl:when>
306 <xsl:otherwise>
307 we are in the other wise
308 </xsl:otherwise>
309 </xsl:choose>
310 </xsl:template>
311
312 <!-- processing for the recursive bit -->
313 <xsl:template match="classifierNode" mode="process-all-children">
314 <xsl:param name="collName" />
315 <xsl:param name="serviceName" />
316
317 <!--
318 ***mod: previous, simpler version
319 <xsl:call-template name="processNodeChildren">
320 <xsl:with-param name='collName' select='$collName'/>
321 <xsl:with-param name='serviceName' select='$serviceName'/>
322 </xsl:call-template>
323 -->
324
325 <xsl:choose>
326 <xsl:when test="@childType = 'HList'">
327 <tr><td>
328 <xsl:call-template name="HList">
329 <xsl:with-param name='collName' select='$collName' />
330 <xsl:with-param name='serviceName' select='$serviceName' />
331 </xsl:call-template>
332 </td></tr>
333 </xsl:when>
334 <xsl:otherwise>
335 <xsl:call-template name="processNodeChildren">
336 <xsl:with-param name='collName' select='$collName' />
337 <xsl:with-param name='serviceName' select='$serviceName' />
338 </xsl:call-template>
339 </xsl:otherwise>
340 </xsl:choose>
341
342 </xsl:template>
343
344 <!-- 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 -->
345 <xsl:template name="documentNodeWrapper">
346 <xsl:param name="collName" />
347 <xsl:param name="serviceName" />
348
349 <!-- The favourite star (optional) -->
350 <xsl:if test="$favouriteBasketOn">
351 <td valign="top">
352 <xsl:call-template name="documentFavouriteForClassifierOrSearchPage" />
353 </td>
354 </xsl:if>
355
356 <xsl:apply-templates select=".">
357 <xsl:with-param name="collName" select="$collName" />
358 <xsl:with-param name="serviceName" select="$serviceName" />
359 </xsl:apply-templates>
360
361 <xsl:call-template name="documentNodePost" />
362 </xsl:template>
363
364 <!--
365 TEMPLATE FOR DOCUMENTS
366 -->
367 <xsl:template match="documentNode">
368 <td valign="top">
369 <gsf:link type="document">
370 <gsf:icon type="document" />
371 </gsf:link>
372 </td>
373 <td valign="top">
374 <gsf:link type="source">
375 <gsf:choose-metadata>
376 <gsf:metadata name="thumbicon" />
377 <gsf:metadata name="srcicon" />
378 </gsf:choose-metadata>
379 </gsf:link>
380 </td>
381 <td valign="top">
382 <gsf:link type="document">
383 <!-- Defined in header.xsl -->
384 <xsl:call-template name="choose-title" />
385 <gsf:switch>
386 <gsf:metadata name="Source" />
387 <gsf:when test="exists">
388 <br />
389 <i>
390 (
391 <gsf:metadata name="Source" />
392 )
393 </i>
394 </gsf:when>
395 </gsf:switch>
396 </gsf:link>
397 </td>
398 </xsl:template>
399
400 <xsl:template name="documentNodePost">
401 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
402 <xsl:if test="metadataList/metadata[@name='Latitude' or @name='Longitude' or @name='Coordinate']">
403 <xsl:call-template name="mapFeaturesIcon" />
404 </xsl:if>
405 </xsl:if>
406
407 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
408 <xsl:if test="metadataList/metadata[@name = 'PhotoType']='Panorama' and ( metadataList/metadata[@name = 'Coordinate'] or ( metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']))">
409 <xsl:call-template name="panoramaViewerFeaturesIcon" />
410 </xsl:if>
411 </xsl:if>
412
413 </xsl:template>
414
415 <!--
416 TEMPLATE FOR GROUPS OF DOCUMENTS
417 -->
418 <xsl:template match="classifierNode[@classifierStyle = 'HList']">
419 <gsf:link type="classifier">
420 <gsf:metadata name="Title" />
421 </gsf:link>
422 </xsl:template>
423
424 <xsl:template match="classifierNode">
425 <td valign="top">
426 <gsf:link type="classifier" style="static">
427 <gsf:icon type="classifier" />
428 </gsf:link>
429 </td>
430 <td valign="top">
431 <gsf:link type="classifier">
432 <gsf:metadata name="Title" />
433 </gsf:link>
434 </td>
435 </xsl:template>
436
437 <xsl:template name="classifierPre">
438 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
439 <xsl:call-template name="mapFeaturesJSONNodes" />
440 </xsl:if>
441
442 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
443 <xsl:call-template name="panoramaViewerFeaturesJSONNodes" />
444 </xsl:if>
445
446 </xsl:template>
447
448 <xsl:template name="classifierResultsPre">
449 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
450 <xsl:call-template name="mapFeaturesMap" />
451 </xsl:if>
452 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
453 <xsl:call-template name="panoramaViewerFeatures" />
454 </xsl:if>
455 </xsl:template>
456
457 <xsl:template name="classifierResultsPost">
458 </xsl:template>
459
460 <xsl:template name="classifierPost">
461 </xsl:template>
462
463 <xsl:template match="/page/xsltparams">
464 <!-- suppress xsltparam block in page -->
465 </xsl:template>
466
467</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.