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

Last change on this file since 26279 was 26279, checked in by sjm84, 8 years ago

Adding months to date list

File size: 7.5 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 <xsl:choose>
71 <xsl:when test="@childType = 'VList' or @childType = 'DateList'">
72 <xsl:for-each select='classifierNode|documentNode'>
73 <tr>
74 <xsl:choose>
75 <xsl:when test="name()='documentNode'">
76 <xsl:if test="../@childType = 'DateList'">
77 <xsl:variable name="prevMonth"><xsl:value-of select="util:getString('prevMonth')"/></xsl:variable>
78 <xsl:variable name="currentDate"><gsf:metadata name="Date"/></xsl:variable>
79 <xsl:variable name="currentMonth"><xsl:value-of select="util:getDetailFromDate($currentDate, 'month', /page/@lang)"/></xsl:variable>
80 <xsl:value-of select="util:storeString('prevMonth', $currentMonth)"/>
81 <td>
82 <xsl:if test="not($currentMonth = $prevMonth)">
83 <xsl:value-of select="$currentMonth"/>
84 </xsl:if>
85 <xsl:text> </xsl:text>
86 </td>
87 </xsl:if>
88 <td>
89 <table id="div{@nodeID}"><tr>
90 <xsl:call-template name="documentNodeWrapper">
91 <xsl:with-param name='collName' select='$collName'/>
92 <xsl:with-param name='serviceName' select='$serviceName'/>
93 </xsl:call-template>
94 </tr></table>
95 </td>
96 </xsl:when>
97 <xsl:when test="name()='classifierNode' and @childType = 'VList'">
98 <td>
99 <table id="title{@nodeID}"><tr>
100 <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'">
101 <td class="headerTD">
102 <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
103 <xsl:attribute name="src">
104 <xsl:choose>
105 <xsl:when test="classifierNode or documentNode">
106 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
107 </xsl:when>
108 <xsl:otherwise>
109 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
110 </xsl:otherwise>
111 </xsl:choose>
112 </xsl:attribute>
113 </img>
114 </td>
115 </xsl:if>
116 <xsl:apply-templates select='.'>
117 <xsl:with-param name='collName' select='$collName'/>
118 <xsl:with-param name='serviceName' select='$serviceName'/>
119 </xsl:apply-templates>
120 </tr></table>
121 </td>
122 <xsl:if test="child::classifierNode or child::documentNode">
123 <!--recurse into the children-->
124 <tr><td><table class="childrenlist" id="div{@nodeID}">
125 <xsl:apply-templates select='.' mode='process-all-children'>
126 <xsl:with-param name='collName' select='$collName'/>
127 <xsl:with-param name='serviceName' select='$serviceName'/>
128 </xsl:apply-templates>
129 </table></td></tr>
130 </xsl:if>
131 </xsl:when>
132 <xsl:otherwise>Unknown classifier style specified</xsl:otherwise>
133 </xsl:choose>
134 </tr>
135 </xsl:for-each>
136 </xsl:when>
137 <xsl:when test="@childType = 'HList'">
138 <ul class="horizontalContainer">
139 <xsl:for-each select='classifierNode'>
140 <li class="horizontalClassifierNode">
141 <xsl:apply-templates select='.'>
142 <xsl:with-param name='collName' select='$collName'/>
143 <xsl:with-param name='serviceName' select='$serviceName'/>
144 </xsl:apply-templates>
145 </li>
146 </xsl:for-each>
147 </ul>
148 <xsl:for-each select='classifierNode'>
149 <xsl:call-template name="processNodeChildren">
150 <xsl:with-param name='collName' select='$collName'/>
151 <xsl:with-param name='serviceName' select='$serviceName'/>
152 </xsl:call-template>
153 </xsl:for-each>
154 </xsl:when>
155 </xsl:choose>
156 </xsl:template>
157
158 <xsl:template name="bookshelfimg">
159 <xsl:param name="alt"/>
160 <xsl:param name="title"/>
161 <img border="0" width="20" height="16" src="interfaces/default/images/bshelf.gif" alt="{$alt}" title="{$title}"/>
162 </xsl:template>
163
164 <xsl:template name="documentNodePost">
165 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
166 <xsl:if test="metadataList/metadata[@name='Latitude' or @name='Longitude']">
167 <xsl:call-template name="mapFeatures"/>
168 </xsl:if>
169 </xsl:if>
170 </xsl:template>
171
172 <xsl:template name="mapFeatures">
173 <td style="padding-left:5px; padding-right:5px;" valign="top">
174 <a href="javascript:focusDocument('{@nodeID}');"><img src="interfaces/{$interface_name}/images/map_marker.png"/></a>
175 </td>
176 </xsl:template>
177</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.