[Bps-public-commit] r9226 - in RT-Extension-iCal: .

alexmv at bestpractical.com alexmv at bestpractical.com
Thu Oct 4 15:52:19 EDT 2007


Author: alexmv
Date: Thu Oct  4 15:52:08 2007
New Revision: 9226

Modified:
   RT-Extension-iCal/   (props changed)
   RT-Extension-iCal/html/NoAuth/ical/dhandler

Log:
 r23414 at zoq-fot-pik:  chmrr | 2007-10-04 15:50:16 -0400
  * Swap to one event at start and end, rather than one for the whole duration


Modified: RT-Extension-iCal/html/NoAuth/ical/dhandler
==============================================================================
--- RT-Extension-iCal/html/NoAuth/ical/dhandler	(original)
+++ RT-Extension-iCal/html/NoAuth/ical/dhandler	Thu Oct  4 15:52:08 2007
@@ -40,30 +40,44 @@
 
 my $ic = sub {
     my $time = shift;
+    
     if (ref $time) {
-        return Date::ICal->new( epoch => $time->Unix )->ical;
+        $time = Date::ICal->new( epoch => $time->Unix )->ical;
     } else {
-        return Date::ICal->new( epoch => $time )->ical;
+        $time = Date::ICal->new( epoch => $time )->ical;
     }
+    $time =~ s/T.*// if shift;
+    return $time;
 };
 
 while (my $t = $tickets->Next) {
     next unless $t->DueObj->Unix > 0;
 
-    my $start = $t->StartsObj->Unix > 0 ? $t->StartsObj : $t->CreatedObj;
+    my $starttime = $t->StartsObj->Unix > 0 ? $t->StartsObj : $t->CreatedObj;
 
-    my $event = Data::ICal::Entry::Event->new;
-    $event->add_properties(
-        summary   => $t->Subject,
+    my $start = Data::ICal::Entry::Event->new;
+    my $end   = Data::ICal::Entry::Event->new;
+    $_->add_properties(
         url       => $RT::WebURL . "?q=".$t->id,
         organizer => $t->OwnerObj->Name,
         dtstamp   => $ic->(time),
         created   => $ic->($t->CreatedObj),
        'last-modified' => $ic->($t->LastUpdatedObj),
-        dtstart   => $ic->($start),
-        dtend     => $ic->($t->DueObj),
+    ) for $start, $end;
+
+    $start->add_properties(
+        summary   => "Start: ".$t->Subject,
+        dtstart   => $ic->($starttime, 1),
+        dtend     => $ic->($starttime, 1),
+    );
+    $end->add_properties(
+        summary   => "Due: ".$t->Subject,
+        dtstart   => $ic->($t->DueObj, 1),
+        dtend     => $ic->($t->DueObj, 1),
     );
-    $feed->add_entry($event);
+
+    $feed->add_entry($start);
+    $feed->add_entry($end);
 }
 
 $m->clear_buffer;



More information about the Bps-public-commit mailing list