Add gloves 101 event
[www/www.git] / xsl / ics.xsl
index e05ee77..2735828 100644 (file)
@@ -11,31 +11,8 @@ VERSION:2.0
 X-WR-CALNAME:University of Waterloo Computer Science Club
 PRODID:-//Apple Computer, Inc//iCal 2.0//EN
 X-WR-RELCALID:3359A191-B19E-4B53-BADC-DFC084FC51C9
-X-WR-TIMEZONE:Canada/Eastern
 CALSCALE:GREGORIAN
 METHOD:PUBLISH
-BEGIN:VTIMEZONE
-TZID:Canada/Eastern
-LAST-MODIFIED:20060912T200739Z
-BEGIN:DAYLIGHT
-DTSTART:20060301T070000
-TZOFFSETTO:-0400
-TZOFFSETFROM:+0000
-TZNAME:EDT
-END:DAYLIGHT
-BEGIN:STANDARD
-DTSTART:20061029T020000
-TZOFFSETTO:-0500
-TZOFFSETFROM:-0400
-TZNAME:EST
-END:STANDARD
-BEGIN:DAYLIGHT
-DTSTART:20070311T010000
-TZOFFSETTO:-0400
-TZOFFSETFROM:-0500
-TZNAME:EDT
-END:DAYLIGHT
-END:VTIMEZONE
 <xsl:for-each select="eventitem"><xsl:call-template name="eventitem" /></xsl:for-each>
 END:VCALENDAR
 </xsl:template>
@@ -43,7 +20,6 @@ END:VCALENDAR
 <xsl:template name="eventitem">
 <xsl:variable name="room" select="@room" />
 <xsl:variable name="start" select="csc:ical-datetime(@date, @time)" />
-<xsl:variable name="end" select="csc:ical-datetime(@date, @time, 60)" />
 <xsl:variable name="title" select="csc:ical-escape(@title)" />
 <xsl:variable name="short" select="csc:ical-escape(string(short))"  />
 <xsl:variable name="abstract" select="csc:ical-escape(string(abstract))" />
@@ -52,10 +28,23 @@ LOCATION:University of Waterloo - <xsl:value-of select="$room" />
 DTSTAMP:20060912T200708Z
 UID:<xsl:value-of select="$start" />@csclub.uwaterloo.ca
 SEQUENCE:11
-DTSTART;TZID=Canada/Eastern:<xsl:value-of select="$start" />
-DTEND;TZID=Canada/Eastern:<xsl:value-of select="$end" />
-SUMMARY:<xsl:value-of select="$title" /><xsl:if test="$short != ''"> -- <xsl:value-of select="$short" /></xsl:if>
-DESCRIPTION:<xsl:value-of select="$abstract" />
+DTSTART:<xsl:value-of select="$start" />
+<xsl:choose>
+  <xsl:when test="(string(@edate) != '') and (string(@etime) != '')">
+    <xsl:variable name="end" select="csc:ical-datetime(@edate, @etime)" />
+DTEND:<xsl:value-of select="$end" />
+  </xsl:when>
+  <xsl:when test="string(@etime) != ''">
+    <xsl:variable name="end" select="csc:ical-datetime(@date, @etime)" />
+DTEND:<xsl:value-of select="$end" />
+  </xsl:when>
+  <xsl:otherwise>
+    <xsl:variable name="end" select="csc:ical-datetime(@date, @time, 60)" />
+DTEND:<xsl:value-of select="$end" />
+  </xsl:otherwise>
+</xsl:choose>
+SUMMARY:<xsl:value-of select="$title" />
+DESCRIPTION:<xsl:if test="$short != ''"><xsl:value-of select="$short" /></xsl:if><xsl:if test="$short = ''"><xsl:value-of select="$abstract" /></xsl:if>
 END:VEVENT
 </xsl:template>