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

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

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

File size: 16.0 KB
RevLine 
[33755]1<?xml version="1.0" encoding="UTF-8"?>
[35812]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
[31554]4 <!-- use the 'main' layout -->
[35812]5 <xsl:import href="layouts/main.xsl" />
6 <xsl:import href="map-tools.xsl" />
7 <xsl:import href="panorama-viewer-tools.xsl" />
[19856]8
[31554]9 <!-- set page title -->
[35812]10 <xsl:template name="pageTitle">
11 <gslib:serviceName />
12 </xsl:template>
[19856]13
[31554]14 <!-- set page breadcrumbs -->
[35812]15 <xsl:template name="breadcrumbs">
16 <gslib:siteLink />
17 <gslib:rightArrow />
[36636]18 <gslib:groupLinks/>
[35812]19 <gslib:collectionNameLinked />
20 <gslib:rightArrow />
21 </xsl:template>
[19988]22
[31554]23 <!-- optional cgi-params for links to document pages -->
24 <xsl:variable name="opt-doc-link-args"></xsl:variable>
[31563]25
[31554]26 <!-- the page content -->
27 <xsl:template match="/page/pageResponse">
[35812]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">
[35827]32 <xsl:text> </xsl:text>
[35812]33 </script>
[36033]34 <gsf:script type="text/javascript">$(window).on("load", openStoredClassifiers);</gsf:script>
[35812]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
[31554]39 -->
40 <div id="results">
[35812]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>
[24340]47
[35812]48 <xsl:call-template name="classifierResultsPre" />
49
[31554]50 <xsl:apply-templates select="classifier">
[35812]51 <xsl:with-param name="collName" select="$collName" />
52 <xsl:with-param name="serviceName" select="$serviceName" />
[31554]53 </xsl:apply-templates>
54 </div>
[24997]55
[35812]56 <div class="clear">
[35827]57 <xsl:text> </xsl:text>
[35812]58 </div>
[31554]59 </xsl:template>
[19856]60
[34579]61 <xsl:template name="rightSidebar">
[36038]62 <div id="rightSidebar">
[34579]63 <xsl:comment>Filler to prevent empty div collapse, in event displayBasket empty</xsl:comment>
[35812]64 <gslib:displayBaskets />
[34579]65 </div>
66 </xsl:template>
67
[31554]68 <xsl:template match="classifier">
[35812]69 <xsl:param name="collName" />
70 <xsl:param name="serviceName" />
[31554]71 <div id="classifiers">
[35812]72 <xsl:variable name="cl_name">
73 <xsl:value-of select="@name" />
74 </xsl:variable>
[31554]75 <xsl:choose>
[35812]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">
[35827]84 <xsl:text> </xsl:text>
[35812]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>
[31554]91 </xsl:choose>
92 </div>
93 </xsl:template>
[35812]94
[31554]95 <xsl:template name="HList">
[35812]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>
[31554]101 <ul class="horizontalContainer">
102 <xsl:for-each select='classifierNode'>
[35812]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>
[31554]113 </xsl:for-each>
114 </ul>
[31850]115 <xsl:choose>
116 <!-- if the children are HLists-->
117 <xsl:when test="classifierNode[@childType = 'HList']">
[35812]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>
[31850]135 </xsl:otherwise>
136 </xsl:choose>
[35812]137 </xsl:template>
[31552]138
[36637]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
[31554]145 <xsl:template name="processNodeChildren">
[35812]146 <xsl:param name="collName" />
147 <xsl:param name="serviceName" />
[31552]148
[31554]149 <xsl:choose>
[35812]150
151 <xsl:when test="@childType = 'VList' or @childType = 'DateList'">
152 <!--
[32600]153 <xsl:when test="@childType = 'VList' or @childType = 'HList' or @childType = 'DateList'"> - - **** mod ???? - -
154 -->
[35812]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>
[35827]176 <xsl:text> </xsl:text>
[35812]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>
[31554]241 </xsl:when>
242 <xsl:when test="@childType = 'HTML'">
[35812]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>
[31554]253 </xsl:when>
[36637]254 <xsl:when test="@childType = 'Collage'">
255 <xsl:call-template name="Collage" />
256 </xsl:when>
[31554]257 <xsl:otherwise>
[35812]258 we are in the other wise
[31554]259 </xsl:otherwise>
260 </xsl:choose>
261 </xsl:template>
[31552]262
[31554]263 <!-- processing for the recursive bit -->
264 <xsl:template match="classifierNode" mode="process-all-children">
[35812]265 <xsl:param name="collName" />
266 <xsl:param name="serviceName" />
[32600]267
268 <!--
269 ***mod: previous, simpler version
[31554]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>
[32600]274 -->
275
[35812]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>
[32600]290
[31554]291 </xsl:template>
[31552]292
[31554]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">
[35812]295 <xsl:param name="collName" />
296 <xsl:param name="serviceName" />
[35813]297
[36083]298 <!-- The favourite star (optional) -->
299 <xsl:if test="$favouriteBasketOn">
300 <td valign="top">
[35812]301 <xsl:call-template name="documentFavouriteForClassifierOrSearchPage" />
[36083]302 </td>
303 </xsl:if>
[33261]304
[35813]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
[35812]310 <xsl:call-template name="documentNodePost" />
[31554]311 </xsl:template>
[31552]312
[31554]313 <!--
314 TEMPLATE FOR DOCUMENTS
315 -->
[32626]316 <xsl:template match="documentNode">
317 <td valign="top">
318 <gsf:link type="document">
[35812]319 <gsf:icon type="document" />
[32626]320 </gsf:link>
[31554]321 </td>
[32626]322 <td valign="top">
323 <gsf:link type="source">
[35812]324 <gsf:choose-metadata>
325 <gsf:metadata name="thumbicon" />
326 <gsf:metadata name="srcicon" />
327 </gsf:choose-metadata>
[32626]328 </gsf:link>
[31554]329 </td>
[32626]330 <td valign="top">
331 <gsf:link type="document">
[35812]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>
[32626]345 </gsf:link>
[31554]346 </td>
347 </xsl:template>
[19856]348
[31554]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'">
[33125]351 <xsl:if test="metadataList/metadata[@name='Latitude' or @name='Longitude' or @name='Coordinate']">
[35812]352 <xsl:call-template name="mapFeaturesIcon" />
[31554]353 </xsl:if>
354 </xsl:if>
[31552]355
[31554]356 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
[33148]357 <xsl:if test="metadataList/metadata[@name = 'PhotoType']='Panorama' and ( metadataList/metadata[@name = 'Coordinate'] or ( metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']))">
[35812]358 <xsl:call-template name="panoramaViewerFeaturesIcon" />
[31554]359 </xsl:if>
360 </xsl:if>
[31552]361
[31554]362 </xsl:template>
[31552]363
[31554]364 <!--
365 TEMPLATE FOR GROUPS OF DOCUMENTS
366 -->
[35812]367 <xsl:template match="classifierNode[@classifierStyle = 'HList']">
[31563]368 <gsf:link type="classifier" style="static">
[35812]369 <gsf:metadata name="Title" />
[31554]370 </gsf:link>
371 </xsl:template>
[31548]372
[31563]373 <xsl:template match="classifierNode">
[32626]374 <td valign="top">
[31563]375 <gsf:link type="classifier" style="static">
[35812]376 <gsf:icon type="classifier" />
[31563]377 </gsf:link>
[31554]378 </td>
[32626]379 <td valign="top">
[31563]380 <gsf:link type="classifier">
[35812]381 <gsf:metadata name="Title" />
[31563]382 </gsf:link>
[31554]383 </td>
384 </xsl:template>
[31563]385
[31554]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'">
[35812]388 <xsl:call-template name="mapFeaturesJSONNodes" />
[31554]389 </xsl:if>
[35812]390
[31554]391 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
[35812]392 <xsl:call-template name="panoramaViewerFeaturesJSONNodes" />
[31554]393 </xsl:if>
[35812]394
[31554]395 </xsl:template>
[35812]396
[31554]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'">
[35812]399 <xsl:call-template name="mapFeaturesMap" />
[31554]400 </xsl:if>
401 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
[35812]402 <xsl:call-template name="panoramaViewerFeatures" />
[31554]403 </xsl:if>
404 </xsl:template>
[35812]405
[31554]406 <xsl:template match="/page/xsltparams">
407 <!-- suppress xsltparam block in page -->
408 </xsl:template>
[31552]409
[36083]410</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.