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

Last change on this file since 38853 was 38853, checked in by anupama, 7 weeks ago

Copied the GsdlCollageApplet package from GS2 into GS3's src/java/org/greenstone/applet folder and adjusted the package names in the classes accordingly. Also made GsdlCollageApplet into a JApplet (no actual awt GUI classes appear to be used, so this was easy). Added compile code into build.xml and there are still deprecated warnings I want to iron out, but only after I can see it working in the appletviewer where things are still not working. Also adjusted classifier.xsl in interfaces/default to move the JavaScript collage work out of the way and instead push out the old applet code with values hardcoded to what I imagine they must be. But as I said, I can't get the appletviewer to display the applet yet. Running the appletviewer on the small beatles collection's Collage classifier page, throws up an error in the terminal: java.lang.ClassFormatError: Incompatible magic value 1008813135 in class file org/greenstone/applet/GsdlCollageApplet/GsdlCollageApplet. It is unclear yet what is causing this error.

File size: 17.6 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 TODO: Here is the collage applet
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, hrefMustHave. 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" code="org.greenstone.applet.GsdlCollageApplet.GsdlCollageApplet.class"
159 archive="GsdlCollageApplet.jar" width="445" height="250">
160
161 <param name="gwcgi" value="http://localhost:8383/greenstone3/library"/>
162 <param name="collection" value="smallbea"/>
163 <param name="classifier" value="CL2.3"/>
164
165 <param name="hrefMustHave" value="smallbea"/>
166 <param name="imageMustNotHave" value="hl=%x=%gt=%gc=%.pr"/>
167
168 <param name="imageType" value=".jpg%.png"/>
169 <param name="verbosity" value="5"/>
170 <param name="maxDepth" value="3"/>
171 <param name="refreshDelay" value="1500"/>
172 <param name="isJava2" value="true"/>
173
174 </applet>
175 </xsl:template>
176
177 <xsl:template name="Collage_javascript_deprecated">
178 <script type="text/javascript" src="interfaces/{$interface_name}/js/collage_scripts.js"><xsl:text> </xsl:text></script>
179 <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>
180
181 </xsl:template>
182
183 <xsl:template name="processNodeChildren">
184 <xsl:param name="collName" />
185 <xsl:param name="serviceName" />
186
187 <xsl:choose>
188
189 <xsl:when test="@childType = 'VList' or @childType = 'DateList'">
190 <!--
191 <xsl:when test="@childType = 'VList' or @childType = 'HList' or @childType = 'DateList'"> - - **** mod ???? - -
192 -->
193
194 <xsl:value-of select="util:storeString('prevMonth', '')" />
195 <xsl:for-each select='classifierNode|documentNode'>
196 <tr>
197 <xsl:choose>
198 <xsl:when test="name()='documentNode'">
199 <xsl:if test="../@childType = 'DateList'">
200 <xsl:variable name="prevMonth">
201 <xsl:value-of select="util:getString('prevMonth')" />
202 </xsl:variable>
203 <xsl:variable name="currentDate">
204 <gsf:metadata name="Date" pos="1" />
205 </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...-->
206 <xsl:variable name="currentMonth">
207 <xsl:value-of select="util:getDetailFromDate($currentDate, 'month', /page/@lang)" />
208 </xsl:variable>
209 <xsl:value-of select="util:storeString('prevMonth', $currentMonth)" />
210 <td>
211 <xsl:if test="not($currentMonth = $prevMonth)">
212 <xsl:value-of select="$currentMonth" />
213 </xsl:if>
214 <xsl:text> </xsl:text>
215 </td>
216 </xsl:if>
217 <td>
218 <table id="div{@nodeID}">
219 <tr>
220 <xsl:call-template name="documentNodeWrapper">
221 <xsl:with-param name='collName' select='$collName' />
222 <xsl:with-param name='serviceName' select='$serviceName' />
223 </xsl:call-template>
224 </tr>
225 </table>
226 </td>
227 </xsl:when>
228 <xsl:when test="name()='classifierNode' and (@childType = 'VList' or @childType = 'HList')">
229 <!-- *** mod -->
230 <td>
231 <table id="title{@nodeID}">
232 <tr>
233 <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'">
234 <td class="headerTD">
235 <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon turnstyleicon">
236 <xsl:attribute name="src">
237 <xsl:choose>
238 <xsl:when test="classifierNode or documentNode">
239 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')" />
240 </xsl:when>
241 <xsl:otherwise>
242 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')" />
243 </xsl:otherwise>
244 </xsl:choose>
245 </xsl:attribute>
246 </img>
247 </td>
248 </xsl:if>
249 <xsl:apply-templates select='.'>
250 <xsl:with-param name='collName' select='$collName' />
251 <xsl:with-param name='serviceName' select='$serviceName' />
252 </xsl:apply-templates>
253 </tr>
254 </table>
255 </td>
256 <xsl:if test="child::classifierNode or child::documentNode">
257 <!--recurse into the children-->
258 <tr>
259 <td>
260 <table class="childrenlist" id="div{@nodeID}">
261
262 <xsl:apply-templates select='.' mode='process-all-children'>
263 <xsl:with-param name='collName' select='$collName' />
264 <xsl:with-param name='serviceName' select='$serviceName' />
265 </xsl:apply-templates>
266 </table>
267 </td>
268 </tr>
269 </xsl:if>
270 </xsl:when>
271 <xsl:otherwise>
272 <td>
273 Unknown classifier style specified:
274 <xsl:value-of select="name()" />
275 </td>
276 </xsl:otherwise>
277 </xsl:choose>
278 </tr>
279 </xsl:for-each>
280 </xsl:when>
281 <xsl:when test="@childType = 'HTML'">
282 <xsl:variable name="URL">
283 <xsl:value-of select="documentNode/@nodeID" />
284 </xsl:variable>
285 <iframe width="100%" height="600" frameborder="0">
286 <xsl:attribute name="src">
287 <xsl:value-of select="$URL" />
288 </xsl:attribute>
289 Frame for
290 <xsl:value-of select="$URL" />
291 </iframe>
292 </xsl:when>
293 <xsl:when test="@childType = 'Collage'">
294 <xsl:call-template name="Collage" />
295 </xsl:when>
296 <xsl:otherwise>
297 we are in the other wise
298 </xsl:otherwise>
299 </xsl:choose>
300 </xsl:template>
301
302 <!-- processing for the recursive bit -->
303 <xsl:template match="classifierNode" mode="process-all-children">
304 <xsl:param name="collName" />
305 <xsl:param name="serviceName" />
306
307 <!--
308 ***mod: previous, simpler version
309 <xsl:call-template name="processNodeChildren">
310 <xsl:with-param name='collName' select='$collName'/>
311 <xsl:with-param name='serviceName' select='$serviceName'/>
312 </xsl:call-template>
313 -->
314
315 <xsl:choose>
316 <xsl:when test="@childType = 'HList'">
317 <tr><td>
318 <xsl:call-template name="HList">
319 <xsl:with-param name='collName' select='$collName' />
320 <xsl:with-param name='serviceName' select='$serviceName' />
321 </xsl:call-template>
322 </td></tr>
323 </xsl:when>
324 <xsl:otherwise>
325 <xsl:call-template name="processNodeChildren">
326 <xsl:with-param name='collName' select='$collName' />
327 <xsl:with-param name='serviceName' select='$serviceName' />
328 </xsl:call-template>
329 </xsl:otherwise>
330 </xsl:choose>
331
332 </xsl:template>
333
334 <!-- 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 -->
335 <xsl:template name="documentNodeWrapper">
336 <xsl:param name="collName" />
337 <xsl:param name="serviceName" />
338
339 <!-- The favourite star (optional) -->
340 <xsl:if test="$favouriteBasketOn">
341 <td valign="top">
342 <xsl:call-template name="documentFavouriteForClassifierOrSearchPage" />
343 </td>
344 </xsl:if>
345
346 <xsl:apply-templates select=".">
347 <xsl:with-param name="collName" select="$collName" />
348 <xsl:with-param name="serviceName" select="$serviceName" />
349 </xsl:apply-templates>
350
351 <xsl:call-template name="documentNodePost" />
352 </xsl:template>
353
354 <!--
355 TEMPLATE FOR DOCUMENTS
356 -->
357 <xsl:template match="documentNode">
358 <td valign="top">
359 <gsf:link type="document">
360 <gsf:icon type="document" />
361 </gsf:link>
362 </td>
363 <td valign="top">
364 <gsf:link type="source">
365 <gsf:choose-metadata>
366 <gsf:metadata name="thumbicon" />
367 <gsf:metadata name="srcicon" />
368 </gsf:choose-metadata>
369 </gsf:link>
370 </td>
371 <td valign="top">
372 <gsf:link type="document">
373 <!-- Defined in header.xsl -->
374 <xsl:call-template name="choose-title" />
375 <gsf:switch>
376 <gsf:metadata name="Source" />
377 <gsf:when test="exists">
378 <br />
379 <i>
380 (
381 <gsf:metadata name="Source" />
382 )
383 </i>
384 </gsf:when>
385 </gsf:switch>
386 </gsf:link>
387 </td>
388 </xsl:template>
389
390 <xsl:template name="documentNodePost">
391 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
392 <xsl:if test="metadataList/metadata[@name='Latitude' or @name='Longitude' or @name='Coordinate']">
393 <xsl:call-template name="mapFeaturesIcon" />
394 </xsl:if>
395 </xsl:if>
396
397 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
398 <xsl:if test="metadataList/metadata[@name = 'PhotoType']='Panorama' and ( metadataList/metadata[@name = 'Coordinate'] or ( metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']))">
399 <xsl:call-template name="panoramaViewerFeaturesIcon" />
400 </xsl:if>
401 </xsl:if>
402
403 </xsl:template>
404
405 <!--
406 TEMPLATE FOR GROUPS OF DOCUMENTS
407 -->
408 <xsl:template match="classifierNode[@classifierStyle = 'HList']">
409 <gsf:link type="classifier">
410 <gsf:metadata name="Title" />
411 </gsf:link>
412 </xsl:template>
413
414 <xsl:template match="classifierNode">
415 <td valign="top">
416 <gsf:link type="classifier" style="static">
417 <gsf:icon type="classifier" />
418 </gsf:link>
419 </td>
420 <td valign="top">
421 <gsf:link type="classifier">
422 <gsf:metadata name="Title" />
423 </gsf:link>
424 </td>
425 </xsl:template>
426
427 <xsl:template name="classifierPre">
428 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
429 <xsl:call-template name="mapFeaturesJSONNodes" />
430 </xsl:if>
431
432 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
433 <xsl:call-template name="panoramaViewerFeaturesJSONNodes" />
434 </xsl:if>
435
436 </xsl:template>
437
438 <xsl:template name="classifierResultsPre">
439 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
440 <xsl:call-template name="mapFeaturesMap" />
441 </xsl:if>
442 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
443 <xsl:call-template name="panoramaViewerFeatures" />
444 </xsl:if>
445 </xsl:template>
446
447 <xsl:template name="classifierResultsPost">
448 </xsl:template>
449
450 <xsl:template name="classifierPost">
451 </xsl:template>
452
453 <xsl:template match="/page/xsltparams">
454 <!-- suppress xsltparam block in page -->
455 </xsl:template>
456
457</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.