Disgusting implemention of flexible endings for the website.
authorMichael Gregson <mgregson@csclub.uwaterloo.ca>
Fri, 27 Feb 2009 04:55:02 +0000 (23:55 -0500)
committerMichael Gregson <mgregson@csclub.uwaterloo.ca>
Fri, 27 Feb 2009 04:55:02 +0000 (23:55 -0500)
xsl/ics.xsl

index fe2470b..80ce230 100644 (file)
@@ -20,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))" />
@@ -30,7 +29,20 @@ DTSTAMP:20060912T200708Z
 UID:<xsl:value-of select="$start" />@csclub.uwaterloo.ca
 SEQUENCE:11
 DTSTART:<xsl:value-of select="$start" />
+<xsl:choose>
+  <xsl:when test="@edate and @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" /><xsl:if test="$short != ''"> -- <xsl:value-of select="$short" /></xsl:if>
 DESCRIPTION:<xsl:value-of select="$abstract" />
 END:VEVENT