source: main/trunk/greenstone3/web/interfaces/default_new/transform/classifiertools.xsl@ 29852

Last change on this file since 29852 was 29852, checked in by Georgiy Litvinov, 9 years ago

Ckeditor integration commit

File size: 9.0 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:java="http://xml.apache.org/xslt/java"
5 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
7 extension-element-prefixes="java util"
8 exclude-result-prefixes="java util gsf">
9
10
11 <xsl:template match="classifier">
12 <xsl:param name="collName"/>
13 <xsl:param name="serviceName"/>
14 <div id="classifiers">
15 <xsl:variable name="cl_name"><xsl:value-of select="@name"/></xsl:variable>
16 <xsl:choose>
17 <xsl:when test="@childType = 'HList'">
18 <xsl:call-template name="HList">
19 <xsl:with-param name='collName' select='$collName'/>
20 <xsl:with-param name='serviceName' select='$serviceName'/>
21 </xsl:call-template>
22 </xsl:when>
23 <xsl:otherwise>
24 <table id="classifiernodelist">
25 <xsl:call-template name="processNodeChildren">
26 <xsl:with-param name='collName' select='$collName'/>
27 <xsl:with-param name='serviceName' select='$serviceName'/>
28 </xsl:call-template>
29 </table>
30 </xsl:otherwise>
31 </xsl:choose>
32 </div>
33 </xsl:template>
34
35 <!-- 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 -->
36 <xsl:template name="documentNodeWrapper">
37 <xsl:param name="collName"/>
38 <xsl:param name="serviceName"/>
39 <xsl:apply-templates select=".">
40 <xsl:with-param name="collName" select="$collName"/>
41 <xsl:with-param name="serviceName" select="$serviceName"/>
42 </xsl:apply-templates>
43 <!-- The berry (optional) -->
44 <td>
45 <xsl:call-template name="documentBerryForClassifierOrSearchPage"/>
46 </td>
47 <xsl:call-template name="documentNodePost"/>
48 </xsl:template>
49
50
51 <xsl:template match="documentNode">
52 <xsl:param name="collName"/>
53 <xsl:param name="serviceName"/>
54 <a href="{$library_name}?a=d&amp;c={$collName}&amp;d={@nodeID}&amp;dt={@docType}&amp;p.a=b&amp;p.s={$serviceName}"><xsl:apply-templates select="." mode="displayNodeIcon"/></a><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
55 </xsl:template>
56
57
58 <!-- icon + title template-->
59 <xsl:template match="classifierNode">
60 <xsl:param name="collName"/>
61 <xsl:param name="serviceName"/>
62 <a><xsl:attribute name='href'><xsl:value-of select='$library_name'/>?a=b&amp;rt=r&amp;s=<xsl:value-of select='$serviceName'/>&amp;c=<xsl:value-of select='$collName'/>&amp;cl=<xsl:value-of select='@nodeID'/><xsl:if test="classifierNode|documentNode">.pr</xsl:if></xsl:attribute><xsl:call-template name="bookshelfimg"/></a><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
63 </xsl:template>
64
65
66 <!-- processing for the recursive bit -->
67 <xsl:template match="classifierNode" mode="process-all-children">
68 <xsl:param name="collName"/>
69 <xsl:param name="serviceName"/>
70 <xsl:call-template name="processNodeChildren">
71 <xsl:with-param name='collName' select='$collName'/>
72 <xsl:with-param name='serviceName' select='$serviceName'/>
73 </xsl:call-template>
74 </xsl:template>
75
76 <xsl:template name="HList">
77 <xsl:param name="collName"/>
78 <xsl:param name="serviceName"/>
79 <ul class="horizontalContainer">
80 <xsl:for-each select='classifierNode'>
81 <li>
82 <xsl:attribute name="class">
83 <xsl:if test="@nodeID = /page/pageRequest/paramList/param[@name = 'cl']/@value">selectedHorizontalClassifierNode </xsl:if>
84 <xsl:text>horizontalClassifierNode</xsl:text>
85 </xsl:attribute>
86 <xsl:apply-templates select='.'>
87 <xsl:with-param name='collName' select='$collName'/>
88 <xsl:with-param name='serviceName' select='$serviceName'/>
89 </xsl:apply-templates>
90 </li>
91 </xsl:for-each>
92 </ul>
93 <table id="classifiernodelist">
94 <xsl:for-each select='classifierNode'>
95 <xsl:call-template name="processNodeChildren">
96 <xsl:with-param name='collName' select='$collName'/>
97 <xsl:with-param name='serviceName' select='$serviceName'/>
98 </xsl:call-template>
99 </xsl:for-each>
100 </table>
101 </xsl:template>
102
103 <xsl:template name="processNodeChildren">
104 <xsl:param name="collName"/>
105 <xsl:param name="serviceName"/>
106
107 <xsl:choose>
108 <xsl:when test="@childType = 'VList' or @childType = 'DateList'">
109 <xsl:value-of select="util:storeString('prevMonth', '')"/>
110 <xsl:for-each select='classifierNode|documentNode'>
111 <tr>
112 <xsl:choose>
113 <xsl:when test="name()='documentNode'">
114 <xsl:if test="../@childType = 'DateList'">
115 <xsl:variable name="prevMonth"><xsl:value-of select="util:getString('prevMonth')"/></xsl:variable>
116 <xsl:variable name="currentDate"><gsf:metadata name="Date"/></xsl:variable>
117 <xsl:variable name="currentMonth"><xsl:value-of select="util:getDetailFromDate($currentDate, 'month', /page/@lang)"/></xsl:variable>
118 <xsl:value-of select="util:storeString('prevMonth', $currentMonth)"/>
119 <td>
120 <xsl:if test="not($currentMonth = $prevMonth)">
121 <xsl:value-of select="$currentMonth"/>
122 </xsl:if>
123 <xsl:text> </xsl:text>
124 </td>
125 </xsl:if>
126 <td>
127 <table id="div{@nodeID}"><tr>
128 <xsl:call-template name="documentNodeWrapper">
129 <xsl:with-param name='collName' select='$collName'/>
130 <xsl:with-param name='serviceName' select='$serviceName'/>
131 </xsl:call-template>
132 </tr></table>
133 </td>
134 </xsl:when>
135 <xsl:when test="name()='classifierNode' and @childType = 'VList'">
136 <td>
137 <table id="title{@nodeID}"><tr>
138 <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'">
139 <td class="headerTD">
140 <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
141 <xsl:attribute name="src">
142 <xsl:choose>
143 <xsl:when test="classifierNode or documentNode">
144 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
145 </xsl:when>
146 <xsl:otherwise>
147 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
148 </xsl:otherwise>
149 </xsl:choose>
150 </xsl:attribute>
151 </img>
152 </td>
153 </xsl:if>
154 <xsl:apply-templates select='.'>
155 <xsl:with-param name='collName' select='$collName'/>
156 <xsl:with-param name='serviceName' select='$serviceName'/>
157 </xsl:apply-templates>
158 </tr></table>
159 </td>
160 <xsl:if test="child::classifierNode or child::documentNode">
161 <!--recurse into the children-->
162 <tr><td><table class="childrenlist" id="div{@nodeID}">
163 <xsl:apply-templates select='.' mode='process-all-children'>
164 <xsl:with-param name='collName' select='$collName'/>
165 <xsl:with-param name='serviceName' select='$serviceName'/>
166 </xsl:apply-templates>
167 </table></td></tr>
168 </xsl:if>
169 </xsl:when>
170 <xsl:otherwise>Unknown classifier style specified</xsl:otherwise>
171 </xsl:choose>
172 </tr>
173 </xsl:for-each>
174 </xsl:when>
175 <xsl:otherwise/>
176 </xsl:choose>
177 </xsl:template>
178
179 <xsl:template name="bookshelfimg">
180 <xsl:param name="alt"/>
181 <xsl:param name="title"/>
182 <img border="0" width="20" height="16" src="interfaces/default/images/bshelf.gif" alt="{$alt}" title="{$title}"/>
183 </xsl:template>
184
185 <xsl:template name="documentNodePost">
186 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
187 <xsl:if test="metadataList/metadata[@name='Latitude' or @name='Longitude']">
188 <xsl:call-template name="mapFeaturesIcon"/>
189 </xsl:if>
190 </xsl:if>
191
192
193 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
194 <xsl:if test=" metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude'] and metadataList/metadata[@name = 'PhotoType']='Panorama'">
195 <xsl:call-template name="panoramaViewerFeaturesIcon"/>
196 </xsl:if>
197 </xsl:if>
198
199 </xsl:template>
200
201 <xsl:template name="mapFeaturesIcon">
202 <td style="padding-left:5px; padding-right:5px;" valign="top">
203 <a href="javascript:focusDocument('{@nodeID}');"><img src="interfaces/{$interface_name}/images/map_marker.png"/></a>
204 </td>
205 </xsl:template>
206
207
208 <xsl:template name="panoramaViewerFeaturesIcon">
209 <td style="padding-left:5px; padding-right:5px;" valign="top">
210 <a href="javascript:switchPanorama('{@nodeID}');">
211 <img src="interfaces/default/images/map_marker.png"/>
212 </a>
213 </td>
214 </xsl:template>
215
216</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.