Have the Calendar iCal feed pass along the timeZone of events. Fixes bug #12030.

Squashed commit of the following:

commit ce957db5311c7fb11c7d780b9f63c1b0adc17cda
Author: Colin Kuskie <colink@perldreamer.com>
Date:   Mon Jan 31 19:00:23 2011 -0800

    Changelog notice for the ical bugfix with timezones.

commit 24a3bc1c74b20ca6ba689641fa0187b659dc3c5e
Author: Colin Kuskie <colink@perldreamer.com>
Date:   Mon Jan 31 15:32:50 2011 -0800

    Transfer the time zone as one of the WebGUI specific items for the Event.

commit 36f87539ba8b090a5e5c9f1879cd40b6f6e69afc
Author: Colin Kuskie <colink@perldreamer.com>
Date:   Sun Jan 30 21:18:12 2011 -0800

    Refactor the code so that the Event adds itself to a calendar object, giving it access to add other things to the calendar, like a timezone definition.

commit f401966bd53b51950f1402a5a19b92b13dcc6b06
Author: Colin Kuskie <colink@perldreamer.com>
Date:   Sun Jan 30 19:42:49 2011 -0800

    Document which version of Data::ICal that we're now using.

commit 689522e30b26fc445da5b59b81789c0d72e157d4
Author: Colin Kuskie <colink@perldreamer.com>
Date:   Sat Jan 29 14:27:25 2011 -0800

    Fix a typo in the Event preventing menuTitle from being sent out.  Fix issue with the menuTitle being set twice.  Update the test to fix long string handling.

commit 59043eee1536e60d92f23313a33dc54da6f15122
Author: Colin Kuskie <colink@perldreamer.com>
Date:   Fri Jan 28 19:48:16 2011 -0800

    Move iCal generation over to Data::ICal.  Give each event the ability to return itself as an Data::ICal::Entry::Event object.

commit eec448b38c101b599c0fb695f442012e311385fb
Author: Colin Kuskie <colink@perldreamer.com>
Date:   Fri Jan 28 19:47:14 2011 -0800

    Document new testing module.  It't only required if you're doing testing.

commit 3d1e82229423834330dcdd31c0a81df986df0f32
Author: Colin Kuskie <colink@perldreamer.com>
Date:   Fri Jan 28 17:05:09 2011 -0800

    Fix setting the title in the iCal feed.

commit 458f4d2e0e1faa1cc6dcb7107040d06b51b97d36
Author: Colin Kuskie <colink@perldreamer.com>
Date:   Fri Jan 28 13:37:52 2011 -0800

    Rewrite of CalendarUpdateFeeds to use Data::ICal

commit 1a271ebc78bbe8b21a26f7a0dba61d1462922f30
Author: Colin Kuskie <colink@perldreamer.com>
Date:   Fri Jan 28 10:49:27 2011 -0800

    Begin building an ICal object for parsing the ical feeds.
This commit is contained in:
Colin Kuskie 2011-01-31 19:05:04 -08:00
parent 93646ad8e6
commit 8ae16ba37c
8 changed files with 110 additions and 161 deletions

View file

@ -28,6 +28,7 @@ use WebGUI::Storage;
use Test::Deep::NoTest qw(eq_deeply);
use DateTime::Event::ICal;
use DateTime::Set;
use Data::ICal::Entry::Event;
use base 'WebGUI::Asset';
@ -74,6 +75,54 @@ sub addRevision {
return $newRev;
}
####################################################################
=head2 add_to_calendar ($iCal)
Build a Data::ICal::Entry::Event object that contains the information for this
event and add it to the Data::ICal calendar
=head3 $iCal
A Data::ICal object, representing the top-level calendar instance.
=cut
sub add_to_calendar {
my $self = shift;
my $session = $self->session;
my $calendar = shift;
my $event = Data::ICal::Entry::Event->new();
$event->add_properties(
'last-modified' => WebGUI::DateTime->new($session, $event->get("revisionDate"))->toIcal,
created => WebGUI::DateTime->new($session, $event->get("creationDate"))->toIcal,
sequence => $self->get('iCalSequenceNumber'),
summary => $self->get('title'),
description => $self->get('description'),
location => $self->get('location'),
uid => $self->get('feedUid')
? $self->get('feedUid')
: $self->get('assetId') . '@'. $session->config->get("sitename")->[0],
);
##WebGUI Specific fields
foreach my $prop (qw/groupIdView groupIdEdit url menuTitle timeZone/) {
$event->add_property( 'x-webgui-'.lc($prop) => $self->get($prop));
}
my $eventStart = $self->getIcalStart;
my $start_parameters = {};
if (! $eventStart =~ /T/) {
$start_parameters->{VALUE} = 'DATE';
}
$event->add_property(dtstart => [ $eventStart, $start_parameters ]);
my $eventEnd = $self->getIcalEnd;
my $end_parameters = {};
if (! $eventEnd =~ /T/) {
$end_parameters->{VALUE} = 'DATE';
}
$event->add_property(dtend => [ $eventEnd, $end_parameters ]);
$calendar->add_entry($event);
}
{
my %dayNamesToICal = (