From 434dd7a7c9b973b0adb23bc95729e75592e436cc Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 24 Aug 2005 19:48:40 +0000 Subject: [PATCH] EXDATE fixes --- perl/schedproc | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/perl/schedproc b/perl/schedproc index 5af5954..1c94288 100755 --- a/perl/schedproc +++ b/perl/schedproc @@ -137,7 +137,7 @@ sub next_class { return undef; } -sub ical_datetime { +sub vcal_datetime { my $date=shift; my $time=shift; $date =~ /(\d\d\d\d)(\d\d)(\d\d)/; @@ -379,18 +379,18 @@ sub do_vcalendar_schedule { print "BEGIN:VCALENDAR\r\nVERSION:1.0\r\n"; foreach my $row (@schedule) { map { s/\n/-/g; $_} %$row; + my ($starttime, $stoptime)=($row->{'begin'}, $row->{'end'}); + my ($startdate, $stopdate)=split(/-/, $row->{'duration'}); + $starttime =~ s/://; + $stoptime =~ s/://; + my $first = first_class(%$row); my @day = (); @day = @{$row->{'off'}} if ($row->{'off'}); my $day = ""; if(exists($day[0])) { $day = join(";", @day); - $day =~ s/\b(\d{8})\b/$1T000000/g; + $day =~ s/\b(\d{8})\b/$1T${starttime}00/g; } - my ($starttime, $stoptime)=($row->{'begin'}, $row->{'end'}); - my ($startdate, $stopdate)=split(/-/, $row->{'duration'}); - $starttime =~ s/://; - $stoptime =~ s/://; - my $first = first_class(%$row); if(defined($file) && (-d $file)) { open FH, ">$file/" . $row->{'id'} . ".vcs" or die "$!"; select FH; @@ -401,9 +401,10 @@ sub do_vcalendar_schedule { print "DESCRIPTION:", $row->{'id'}, "\r\n"; print "LOCATION:", $row->{'location'}, "\r\n"; print "CATEGORIES:Education\r\n"; - #print "DTSTART:", ical_datetime(first_class(%$row),$starttime), "\r\n"; - print "DTSTART:", $first."T".$starttime, "00\r\n"; - print "DTEND:", $first."T".$stoptime, "00\r\n"; + print "DTSTART:", vcal_datetime($first,$starttime), "\r\n"; + print "DTEND:", vcal_datetime($first,$stoptime), "\r\n"; + #print "DTSTART:", $first."T".$starttime, "00\r\n"; + #print "DTEND:", $first."T".$stoptime, "00\r\n"; $row->{'days'} =~ s/([MTWRFS])/ $days{$1}/g; $row->{'days'} =~ s/^ //; print "RRULE:W1 ", $row->{'days'} . " $stopdate", "T000000\r\n"; @@ -455,25 +456,25 @@ EOF print "BEGIN:VCALENDAR$r\nVERSION:2.0$r\nMETHOD:PUBLISH$r\n$timezone"; foreach my $row (@schedule) { map { s/\n/-/g; $_} %$row; + my ($starttime, $stoptime)=($row->{'begin'}, $row->{'end'}); + my ($startdate, $stopdate)=split(/-/, $row->{'duration'}); + $starttime =~ s/://; + $stoptime =~ s/://; + my $first = first_class(%$row); my @day = (); @day = @{$row->{'off'}} if ($row->{'off'}); my $day = ""; if(exists($day[0])) { $day = join(",", @day); - $day =~ s/\b(\d{8})\b/$1T000000/g; + #$day =~ s/\b(\d{8})\b/$1T${starttime}00/g; } - my ($starttime, $stoptime)=($row->{'begin'}, $row->{'end'}); - my ($startdate, $stopdate)=split(/-/, $row->{'duration'}); - $starttime =~ s/://; - $stoptime =~ s/://; - my $first = first_class(%$row); if(defined($file) && (-d $file)) { open FH, ">$file/" . $row->{'id'} . ".vcs" or die "$!"; select FH; print "BEGIN:VCALENDAR$r\nVERSION:2.0$r\nMETHOD:PUBLISH$r\n$timezone"; } print "BEGIN:VEVENT$r\n"; - print "ORGANIZER:MAILTO:" . $opts{'email'} . "$r\n" if $opts{'email'}; + print "ORGANIZER:mailto:" . $opts{'email'} . "$r\n" if $opts{'email'}; print "UID:" . $row->{'id'} . "\@from.sctweb$r\n"; print "DTSTAMP:$now$r\n"; print "SUMMARY:", $row->{'title'}, "$r\n"; @@ -481,15 +482,14 @@ EOF print "LOCATION:", $row->{'location'}, "$r\n"; print "CATEGORIES:Education$r\n"; print "TRANSP:OPAQUE$r\n"; - #print "DTSTART;$tzn$first,$starttime), "$r\n"; - #print "DTEND;$tzn$first,$stoptime), "$r\n"; print "DTSTART;TZID=\"$tzn\":", $first."T".$starttime, "00$r\n"; print "DTEND;TZID=\"$tzn\":", $first."T".$stoptime, "00$r\n"; $row->{'days'} =~ s/([MTWRFS])/,$days{$1}/g; $row->{'days'} =~ s/^,//; #$stopdate++; print "RRULE:FREQ=WEEKLY;UNTIL=${stopdate}T000000Z;BYDAY=", $row->{'days'}, "$r\n"; - print("EXDATE;TZID=\"$tzn\":$day$r\n") if($day); + #print("EXDATE;TZID=\"$tzn\":$day$r\n") if($day); + print("EXDATE;VALUE=DATE:$day$r\n") if($day); print "ATTENDEE;CN=".$row->{'instructor'}.";RSVP=FALSE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:" . (get_faculty_email($row->{'instructor'}) || "fake\@ddress"), "$r\n"; print "ATTENDEE;CN=".$opts{'name'}.";RSVP=FALSE;PARTSTAT=ACCEPTED;ROLE=REQ-PARTICIPANT:mailto:" . ($opts{'email'} || "fake\@ddress"), "$r\n" if $opts{'name'}; print "END:VEVENT$r\n"; -- 2.30.2