root/trunk/deployment/webuser/webapp/resources/demoskins/default/default/rss-list.xsl

Revision 3215 (checked in by johnsa, 2 years ago)

personal client: correct path to rss-list's strings template

Line 
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3     Licensed to Jasig under one or more contributor license
4     agreements. See the NOTICE file distributed with this work
5     for additional information regarding copyright ownership.
6     Jasig licenses this file to you under the Apache License,
7     Version 2.0 (the "License"); you may not use this file
8     except in compliance with the License. You may obtain a
9     copy of the License at:
10    
11     http://www.apache.org/licenses/LICENSE-2.0
12    
13     Unless required by applicable law or agreed to in writing,
14     software distributed under the License is distributed on
15     an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16     KIND, either express or implied. See the License for the
17     specific language governing permissions and limitations
18     under the License.
19 -->
20 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
21   <xsl:output method="xml" omit-xml-declaration="no" indent="yes"
22     media-type="text/xml" encoding="UTF-8" />
23
24    <!-- =========================================================
25
26                       BEDEWORK RSS FEED
27
28      RSS for the Bedework events calendar.
29
30      Call the feed with the listEvents action to return
31      the discrete events in the next seven days (seven days is default):
32      http://localhost:8080/cal/main/listEvents.do?setappvar=summaryMode(details)&skinName=rss-list
33
34      _________________________________________________________
35      Optional parameters that may be added to the query string:
36
37      days=n    To return n days from today into the future add this to the paramater list: &days=5
38
39      ===============================================================  -->
40
41    <xsl:include href="../strings.xsl"/>
42
43    <xsl:template match="/">
44      <rss version="2.0">
45       <channel>
46         <title>Bedework Events Calendar</title>
47         <link><xsl:value-of select="/bedework/urlprefix"/></link>
48         <description>
49           <xsl:choose>
50             <xsl:when test="/bedework/now/longdate = /bedework/events/event[position()=last()]/start/longdate"><xsl:value-of select="/bedework/now/longdate"/></xsl:when>
51             <xsl:otherwise><xsl:value-of select="/bedework/now/longdate"/> - <xsl:value-of select="/bedework/events/event[position()=last()]/start/longdate"/></xsl:otherwise>
52           </xsl:choose>
53         </description>
54         <pubDate><!-- takes the form: 11 Jan 2008 17:00:00 UT (note - do not output dayname - we only provide dayname in local time).
55           --><xsl:value-of select="substring(/bedework/now/utc,7,2)"/><xsl:text> </xsl:text><!--
56           --><xsl:call-template name="monthNumToName"><xsl:with-param name="monthNum" select="substring(/bedework/now/utc,5,2)"/></xsl:call-template><xsl:text> </xsl:text><!--
57           --><xsl:value-of select="substring(/bedework/now/utc,1,4)"/><xsl:text> </xsl:text><!--
58           --><xsl:value-of select="substring(/bedework/now/utc,10,2)"/>:<xsl:value-of select="substring(/bedework/now/utc,12,2)"/>:00 UT</pubDate>
59         <language>en-US</language>
60         <copyright>Copyright <xsl:value-of select="substring(/bedework/now/utc,1,4)"/>, Bedework</copyright>
61         <managingEditor>editor@mysite.edu (Editor Name)</managingEditor>
62         <xsl:choose>
63            <xsl:when test="/bedework/page='searchResult'">
64              <xsl:apply-templates select="/bedework/searchResults/searchResult"/>
65            </xsl:when>
66            <xsl:otherwise>
67              <xsl:apply-templates select="/bedework/events/event"/>
68            </xsl:otherwise>
69         </xsl:choose>
70       </channel>
71     </rss>
72   </xsl:template>
73
74   <xsl:template match="event">
75     <item>
76       <title><xsl:if test="status = 'CANCELLED'">CANCELED: </xsl:if><xsl:value-of select="summary"/> - <xsl:value-of select="substring(start/dayname,1,3)"/>, <xsl:value-of select="start/longdate"/></title>
77       <link><xsl:value-of select="/bedework/urlprefix"/>/event/eventView.do?calPath=<xsl:value-of select="calendar/encodedPath"/>&amp;guid=<xsl:value-of select="guid"/>&amp;recurrenceId=<xsl:value-of select="recurrenceId"/></link>
78       <guid><xsl:value-of select="/bedework/urlprefix"/>/event/eventView.do?calPath=<xsl:value-of select="calendar/encodedPath"/>&amp;guid=<xsl:value-of select="guid"/>&amp;recurrenceId=<xsl:value-of select="recurrenceId"/></guid>
79       <pubDate><!-- takes the form: 11 Jan 2008 17:00:00 UT (note - do not output dayname - we only provide dayname in local time).
80         --><xsl:value-of select="substring(start/utcdate,7,2)"/><xsl:text> </xsl:text><!--
81         --><xsl:call-template name="monthNumToName"><xsl:with-param name="monthNum" select="substring(start/utcdate,5,2)"/></xsl:call-template><xsl:text> </xsl:text><!--
82         --><xsl:value-of select="substring(start/utcdate,1,4)"/><xsl:text> </xsl:text><!--
83         --><xsl:value-of select="substring(start/utcdate,10,2)"/>:<xsl:value-of select="substring(start/utcdate,12,2)"/>:00 UT</pubDate>
84       <description>
85         <xsl:value-of select="start/dayname" />,
86         <xsl:value-of select="start/longdate" />
87         <xsl:text> </xsl:text>
88         <xsl:if test="start/allday = 'false'">
89           <xsl:value-of select="start/time" />
90         </xsl:if>
91         <xsl:if
92           test="(end/longdate != start/longdate) or
93                 ((end/longdate = start/longdate) and (end/time != start/time))">
94           -
95         </xsl:if>
96         <xsl:if test="end/longdate != start/longdate">
97           <xsl:value-of select="substring(end/dayname,1,3)" />
98           ,
99           <xsl:value-of select="end/longdate" />
100           <xsl:text> </xsl:text>
101         </xsl:if>
102         <xsl:choose>
103           <xsl:when test="start/allday = 'true'">
104             <xsl:copy-of select="$bwStr-SgEv-AllDay"/>
105           </xsl:when>
106           <xsl:when test="end/longdate != start/longdate">
107             <xsl:value-of select="end/time" />
108           </xsl:when>
109           <xsl:when test="end/time != start/time">
110
111               <xsl:value-of select="end/time" />
112
113           </xsl:when>
114         </xsl:choose>
115         <!-- if timezones are not local, or if floating add labels: -->
116         <xsl:if test="start/timezone/islocal = 'false' or end/timezone/islocal = 'false'">
117           <xsl:text> </xsl:text>
118           --
119           <xsl:choose>
120             <xsl:when test="start/floating = 'true'">
121               <xsl:copy-of select="$bwStr-SgEv-FloatingTime"/>
122             </xsl:when>
123             <xsl:otherwise>
124               <xsl:copy-of select="$bwStr-SgEv-LocalTime"/>
125             </xsl:otherwise>
126           </xsl:choose>
127         </xsl:if>
128         <!-- display in timezone if not local or floating time) -->
129         <xsl:if test="(start/timezone/islocal = 'false' or end/timezone/islocal = 'false') and start/floating = 'false'">
130           <xsl:choose>
131             <xsl:when test="start/timezone/id != end/timezone/id">
132               <!-- need to display both timezones if they differ from start to end -->
133               <div class="tzdates">
134                 <xsl:copy-of select="$bwStr-SgEv-Start"/><xsl:text> </xsl:text>
135                 <xsl:choose>
136                   <xsl:when test="start/timezone/islocal='true'">
137                     <xsl:value-of select="start/dayname"/>,
138                     <xsl:value-of select="start/longdate"/>
139                     <xsl:text> </xsl:text>
140                     <xsl:value-of select="start/time"/>
141                   </xsl:when>
142                   <xsl:otherwise>
143                     <xsl:value-of select="start/timezone/dayname"/>,
144                     <xsl:value-of select="start/timezone/longdate"/>
145                     <xsl:text> </xsl:text>
146                     <xsl:value-of select="start/timezone/time"/>
147                   </xsl:otherwise>
148                 </xsl:choose>
149                 --
150                 <strong><xsl:value-of select="start/timezone/id"/></strong>
151                 <xsl:copy-of select="$bwStr-SgEv-End"/><xsl:text> </xsl:text>
152                 <xsl:choose>
153                   <xsl:when test="end/timezone/islocal='true'">
154                     <xsl:value-of select="end/dayname"/>,
155                     <xsl:value-of select="end/longdate"/>
156                     <xsl:text> </xsl:text>
157                     <xsl:value-of select="end/time"/>
158                   </xsl:when>
159                   <xsl:otherwise>
160                     <xsl:value-of select="end/timezone/dayname"/>,
161                     <xsl:value-of select="end/timezone/longdate"/>
162                     <xsl:text> </xsl:text>
163                     <xsl:value-of select="end/timezone/time"/>
164                   </xsl:otherwise>
165                 </xsl:choose>
166                 --
167                 <strong><xsl:value-of select="end/timezone/id"/></strong>
168               </div>
169             </xsl:when>
170             <xsl:otherwise>
171               <!-- otherwise, timezones are the same: display as a single line  -->
172               <xsl:value-of select="start/timezone/dayname"/>, <xsl:value-of select="start/timezone/longdate"/><xsl:text> </xsl:text>
173               <xsl:if test="start/allday = 'false'">
174                 <xsl:value-of select="start/timezone/time"/>
175               </xsl:if>
176               <xsl:if test="(end/timezone/longdate != start/timezone/longdate) or
177                             ((end/timezone/longdate = start/timezone/longdate) and (end/timezone/time != start/timezone/time))"> - </xsl:if>
178               <xsl:if test="end/timezone/longdate != start/timezone/longdate">
179                 <xsl:value-of select="substring(end/timezone/dayname,1,3)"/>, <xsl:value-of select="end/timezone/longdate"/><xsl:text> </xsl:text>
180               </xsl:if>
181               <xsl:choose>
182                 <xsl:when test="start/allday = 'true'">
183                    <xsl:copy-of select="$bwStr-SgEv-AllDay"/>
184                 </xsl:when>
185                 <xsl:when test="end/timezone/longdate != start/timezone/longdate">
186                   <xsl:value-of select="end/timezone/time"/>
187                 </xsl:when>
188                 <xsl:when test="end/timezone/time != start/timezone/time">
189                   <xsl:value-of select="end/timezone/time"/>
190                 </xsl:when>
191               </xsl:choose>
192               <xsl:text> </xsl:text>
193               --
194               <strong><xsl:value-of select="start/timezone/id"/></strong>
195             </xsl:otherwise>
196           </xsl:choose>
197         </xsl:if>
198
199         <![CDATA[
200           <br/>
201         ]]>
202
203         <xsl:copy-of select="$bwStr-SgEv-Where"/><xsl:text> </xsl:text>
204         <xsl:choose>
205           <xsl:when test="location/link=''">
206             <xsl:value-of select="location/address" />
207             <xsl:text> </xsl:text>
208             <xsl:if test="location/subaddress!=''">
209               <xsl:text> </xsl:text>
210               <xsl:value-of select="location/subaddress" />
211             </xsl:if>
212           </xsl:when>
213           <xsl:otherwise>
214             <a>
215               <xsl:attribute name="href"><xsl:value-of select="location/link"/></xsl:attribute>
216               <xsl:value-of select="location/address"/>
217               <xsl:if test="location/subaddress!=''">
218                 <xsl:text> </xsl:text>
219                 <xsl:value-of select="location/subaddress" />
220               </xsl:if>
221             </a>
222           </xsl:otherwise>
223         </xsl:choose>
224
225         <![CDATA[
226           <br/>
227         ]]>
228
229         <xsl:if test="cost!=''">
230           <xsl:copy-of select="$bwStr-SgEv-Cost"/><xsl:text> </xsl:text>
231           <xsl:value-of select="cost" />
232           <![CDATA[
233             <br/>
234           ]]>
235         </xsl:if>
236
237         <xsl:copy-of select="$bwStr-SgEv-Description"/><xsl:text> </xsl:text>
238         <xsl:value-of select="description"/>
239
240         <![CDATA[
241           <br/>
242         ]]>
243
244         <xsl:if test="status !='' and status != 'CONFIRMED'">
245           <xsl:copy-of select="$bwStr-SgEv-STATUS"/><xsl:text> </xsl:text>
246           <xsl:value-of select="status" />
247           <![CDATA[
248             <br/>
249           ]]>
250         </xsl:if>
251
252         <xsl:if test="contact/name!='None'">
253           <xsl:copy-of select="$bwStr-SgEv-Contact"/><xsl:text> </xsl:text>
254           <xsl:value-of select="contact/name" />
255           <xsl:if test="contact/phone!=''">
256             <xsl:text> </xsl:text>
257             <xsl:value-of select="contact/phone" />
258           </xsl:if>
259           <![CDATA[
260             <br/>
261           ]]>
262         </xsl:if>
263
264         <xsl:if test="categories[1]/category">
265           <xsl:copy-of select="$bwStr-SgEv-Categories"/><xsl:text> </xsl:text>
266           <xsl:for-each select="categories/category">
267             <xsl:value-of select="value"/><xsl:if test="position() != last()">, </xsl:if>
268           </xsl:for-each>
269           <![CDATA[
270             <br/>
271           ]]>
272         </xsl:if>
273       </description>
274     </item>
275   </xsl:template>
276
277   <!-- convert 2-digit utc month numeric values to
278        short month names as expected by RFC 822 -->
279   <xsl:template name="monthNumToName">
280     <xsl:param name="monthNum">00</xsl:param>
281     <xsl:choose>
282       <xsl:when test="$monthNum = '01'">Jan</xsl:when>
283       <xsl:when test="$monthNum = '02'">Feb</xsl:when>
284       <xsl:when test="$monthNum = '03'">Mar</xsl:when>
285       <xsl:when test="$monthNum = '04'">Apr</xsl:when>
286       <xsl:when test="$monthNum = '05'">May</xsl:when>
287       <xsl:when test="$monthNum = '06'">Jun</xsl:when>
288       <xsl:when test="$monthNum = '07'">Jul</xsl:when>
289       <xsl:when test="$monthNum = '08'">Aug</xsl:when>
290       <xsl:when test="$monthNum = '09'">Sep</xsl:when>
291       <xsl:when test="$monthNum = '10'">Oct</xsl:when>
292       <xsl:when test="$monthNum = '11'">Nov</xsl:when>
293       <xsl:when test="$monthNum = '12'">Dec</xsl:when>
294       <xsl:otherwise>badMonthNum</xsl:otherwise>
295     </xsl:choose>
296   </xsl:template>
297 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.