From c8814160e8f2e60e46c92128123a61eacf8c6015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Tue, 11 Dec 2012 09:33:50 +0000 Subject: [PATCH 1/2] remove dtend from th xCal export xCal is a direct port of iCal to XML. iCal only allows one of dtend and duration to be specified. The non-normative relax-ng schema in the relevant rfc reflects this. I removed the duration and not the dtend, as parsers have to support the datetime format anyways and there are parsers without support for the duration format. xCal [rfc 6321](https://tools.ietf.org/html/rfc6321#page-32): ``` (property-dtend | property-duration)? & ``` iCal [rfc 5545](https://tools.ietf.org/html/rfc5545#page52): ``` ; Either 'dtend' or 'duration' MAY appear in ; a 'eventprop', but 'dtend' and 'duration' ; MUST NOT occur in the same 'eventprop'. ; dtend / duration / ``` --- rails/app/views/xcal/conference.rxml | 1 - 1 file changed, 1 deletion(-) diff --git a/rails/app/views/xcal/conference.rxml b/rails/app/views/xcal/conference.rxml index 96c17ea8f..c7d8727dc 100644 --- a/rails/app/views/xcal/conference.rxml +++ b/rails/app/views/xcal/conference.rxml @@ -10,7 +10,6 @@ xml.tag!( "pentabarf:language-code", event.language ) xml.dtstart( event.start_datetime.strftime('%Y%m%dT%H%M%S') ) xml.dtend( event.end_datetime.strftime('%Y%m%dT%H%M%S') ) - xml.duration( event.duration.strftime('%HH%MM%SS') ) xml.summary( event.title + ( event.subtitle ? "- #{event.subtitle}" : "" ) ) xml.description( event.abstract ) xml.class( "PUBLIC" ) From bd1e4c4f8a5b3e20498dc80ced84983785357596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Tue, 11 Dec 2012 09:46:18 +0000 Subject: [PATCH 2/2] insert dtend instead of duration in iCal export There are iCal parsers without support for duration values. As dtend has the same format as dtstart, parsers which don't support it have no chance anyways. --- rails/app/controllers/ical_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rails/app/controllers/ical_controller.rb b/rails/app/controllers/ical_controller.rb index b63a0a97f..82f4887f7 100644 --- a/rails/app/controllers/ical_controller.rb +++ b/rails/app/controllers/ical_controller.rb @@ -41,7 +41,7 @@ def conference uid "#{event.event_id}@#{conf.acronym}@pentabarf.org" dtstamp Time.now.strftime('%Y%m%dT%H%M%S') dtstart event.start_datetime.strftime('%Y%m%dT%H%M%S'), {'TZID'=>tz.timezone} - duration sprintf( 'PT%dH%02dM', event.duration.hour, event.duration.min ) + dtend event.end_datetime.strftime('%Y%m%dT%H%M%S'), {'TZID'=>tz.timezone} summary event.title + ( event.subtitle ? " - #{event.subtitle}" : '') description event.abstract.to_s.gsub( "\n", '' ).gsub( "\r", '' ) add_category "Lecture"