source: main/trunk/greenstone3/web/interfaces/default/transform/classifiertools.xsl@ 26484

Last change on this file since 26484 was 26280, checked in by sjm84, 12 years ago

The current horizontal classifier will be bolded

File size: 7.8 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 <table id="classifiernodelist">
17 <xsl:call-template name="processNodeChildren">
18 <xsl:with-param name='collName' select='$collName'/>
19 <xsl:with-param name='serviceName' select='$serviceName'/>
20 </xsl:call-template>
21 </table>
22 </div>
23 </xsl:template>
24
25 <!-- this is a wrapper node, which the interface can use to add stuff into the query results that isn't part of and doesn't depend on the documentNode template which may come from the collection -->
26 <xsl:template name="documentNodeWrapper">
27 <xsl:param name="collName"/>
28 <xsl:param name="serviceName"/>
29 <xsl:apply-templates select=".">
30 <xsl:with-param name="collName" select="$collName"/>
31 <xsl:with-param name="serviceName" select="$serviceName"/>
32 </xsl:apply-templates>
33 <!-- The berry (optional) -->
34 <td>
35 <xsl:call-template name="documentBerryForClassifierOrSearchPage"/>
36 </td>
37 <xsl:call-template name="documentNodePost"/>
38 </xsl:template>
39
40
41 <xsl:template match="documentNode">
42 <xsl:param name="collName"/>
43 <xsl:param name="serviceName"/>
44 <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']"/>
45 </xsl:template>
46
47
48 <!-- icon + title template-->
49 <xsl:template match="classifierNode">
50 <xsl:param name="collName"/>
51 <xsl:param name="serviceName"/>
52 <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']"/>
53 </xsl:template>
54
55
56 <!-- processing for the recursive bit -->
57 <xsl:template match="classifierNode" mode="process-all-children">
58 <xsl:param name="collName"/>
59 <xsl:param name="serviceName"/>
60 <xsl:call-template name="processNodeChildren">
61 <xsl:with-param name='collName' select='$collName'/>
62 <xsl:with-param name='serviceName' select='$serviceName'/>
63 </xsl:call-template>
64 </xsl:template>
65
66
67 <xsl:template name="processNodeChildren">
68 <xsl:param name="collName"/>
69 <xsl:param name="serviceName"/>
70
71 <xsl:choose>
72 <xsl:when test="@childType = 'VList' or @childType = 'DateList'">
73 <xsl:value-of select="util:storeString('prevMonth', '')"/>
74 <xsl:for-each select='classifierNode|documentNode'>
75 <tr>
76 <xsl:choose>
77 <xsl:when test="name()='documentNode'">
78 <xsl:if test="../@childType = 'DateList'">
79 <xsl:variable name="prevMonth"><xsl:value-of select="util:getString('prevMonth')"/></xsl:variable>
80 <xsl:variable name="currentDate"><gsf:metadata name="Date"/></xsl:variable>
81 <xsl:variable name="currentMonth"><xsl:value-of select="util:getDetailFromDate($currentDate, 'month', /page/@lang)"/></xsl:variable>
82 <xsl:value-of select="util:storeString('prevMonth', $currentMonth)"/>
83 <td>
84 <xsl:if test="not($currentMonth = $prevMonth)">
85 <xsl:value-of select="$currentMonth"/>
86 </xsl:if>
87 <xsl:text> </xsl:text>
88 </td>
89 </xsl:if>
90 <td>
91 <table id="div{@nodeID}"><tr>
92 <xsl:call-template name="documentNodeWrapper">
93 <xsl:with-param name='collName' select='$collName'/>
94 <xsl:with-param name='serviceName' select='$serviceName'/>
95 </xsl:call-template>
96 </tr></table>
97 </td>
98 </xsl:when>
99 <xsl:when test="name()='classifierNode' and @childType = 'VList'">
100 <td>
101 <table id="title{@nodeID}"><tr>
102 <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'">
103 <td class="headerTD">
104 <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
105 <xsl:attribute name="src">
106 <xsl:choose>
107 <xsl:when test="classifierNode or documentNode">
108 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
109 </xsl:when>
110 <xsl:otherwise>
111 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
112 </xsl:otherwise>
113 </xsl:choose>
114 </xsl:attribute>
115 </img>
116 </td>
117 </xsl:if>
118 <xsl:apply-templates select='.'>
119 <xsl:with-param name='collName' select='$collName'/>
120 <xsl:with-param name='serviceName' select='$serviceName'/>
121 </xsl:apply-templates>
122 </tr></table>
123 </td>
124 <xsl:if test="child::classifierNode or child::documentNode">
125 <!--recurse into the children-->
126 <tr><td><table class="childrenlist" id="div{@nodeID}">
127 <xsl:apply-templates select='.' mode='process-all-children'>
128 <xsl:with-param name='collName' select='$collName'/>
129 <xsl:with-param name='serviceName' select='$serviceName'/>
130 </xsl:apply-templates>
131 </table></td></tr>
132 </xsl:if>
133 </xsl:when>
134 <xsl:otherwise>Unknown classifier style specified</xsl:otherwise>
135 </xsl:choose>
136 </tr>
137 </xsl:for-each>
138 </xsl:when>
139 <xsl:when test="@childType = 'HList'">
140 <ul class="horizontalContainer">
141 <xsl:for-each select='classifierNode'>
142 <li>
143 <xsl:attribute name="class">
144 <xsl:if test="@nodeID = /page/pageRequest/paramList/param[@name = 'cl']/@value">selectedHorizontalClassifierNode </xsl:if>
145 <xsl:text>horizontalClassifierNode</xsl:text>
146 </xsl:attribute>
147 <xsl:apply-templates select='.'>
148 <xsl:with-param name='collName' select='$collName'/>
149 <xsl:with-param name='serviceName' select='$serviceName'/>
150 </xsl:apply-templates>
151 </li>
152 </xsl:for-each>
153 </ul>
154 <xsl:for-each select='classifierNode'>
155 <xsl:call-template name="processNodeChildren">
156 <xsl:with-param name='collName' select='$collName'/>
157 <xsl:with-param name='serviceName' select='$serviceName'/>
158 </xsl:call-template>
159 </xsl:for-each>
160 </xsl:when>
161 </xsl:choose>
162 </xsl:template>
163
164 <xsl:template name="bookshelfimg">
165 <xsl:param name="alt"/>
166 <xsl:param name="title"/>
167 <img border="0" width="20" height="16" src="interfaces/default/images/bshelf.gif" alt="{$alt}" title="{$title}"/>
168 </xsl:template>
169
170 <xsl:template name="documentNodePost">
171 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
172 <xsl:if test="metadataList/metadata[@name='Latitude' or @name='Longitude']">
173 <xsl:call-template name="mapFeatures"/>
174 </xsl:if>
175 </xsl:if>
176 </xsl:template>
177
178 <xsl:template name="mapFeatures">
179 <td style="padding-left:5px; padding-right:5px;" valign="top">
180 <a href="javascript:focusDocument('{@nodeID}');"><img src="interfaces/{$interface_name}/images/map_marker.png"/></a>
181 </td>
182 </xsl:template>
183</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.