diff --git a/ChangeLog b/ChangeLog index cddc5fcfd..c7be8c25a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-06-07 Wolfgang Sourdeau + + * UI/Scheduler/UIxAppointmentEditor.m ([UIxAppointmentEditor + -takeValuesFromRequest:_rqinContext:_ctx]): take the new ivar + "isAllDay" into account and compute the amount of days to pass to + the iCalEvent. + 2007-06-06 Francis Lachapelle * SoObjects/SOGo/NSNumber+Utilities.m: initial import. diff --git a/UI/Scheduler/UIxAppointmentEditor.h b/UI/Scheduler/UIxAppointmentEditor.h index 7254f5d67..e90745500 100644 --- a/UI/Scheduler/UIxAppointmentEditor.h +++ b/UI/Scheduler/UIxAppointmentEditor.h @@ -31,6 +31,7 @@ @interface UIxAppointmentEditor : UIxComponent { iCalEvent *event; + BOOL isAllDay; NSCalendarDate *aptStartDate; NSCalendarDate *aptEndDate; NSString *item; diff --git a/UI/Scheduler/UIxAppointmentEditor.m b/UI/Scheduler/UIxAppointmentEditor.m index 3c4d20e9f..1725abe45 100644 --- a/UI/Scheduler/UIxAppointmentEditor.m +++ b/UI/Scheduler/UIxAppointmentEditor.m @@ -20,6 +20,8 @@ * Boston, MA 02111-1307, USA. */ +#include + #import #import #import @@ -46,6 +48,7 @@ aptEndDate = nil; item = nil; event = nil; + isAllDay = NO; } return self; @@ -66,11 +69,12 @@ /* icalendar values */ - (BOOL) isAllDay { - return NO; + return isAllDay; } - (void) setIsAllDay: (BOOL) newIsAllDay { + isAllDay = newIsAllDay; } - (void) setAptStartDate: (NSCalendarDate *) newAptStartDate @@ -263,6 +267,7 @@ ASSIGN (aptStartDate, startDate); ASSIGN (aptEndDate, endDate); + /* here comes the code for initializing repeat, reminder and isAllDay... */ return self; @@ -313,14 +318,25 @@ inContext: (WOContext *) _ctx { SOGoAppointmentObject *clientObject; + int nbrDays; clientObject = [self clientObject]; event = (iCalEvent *) [clientObject component: YES]; [super takeValuesFromRequest: _rq inContext: _ctx]; - [event setStartDate: aptStartDate]; - [event setEndDate: aptEndDate]; + if (isAllDay) + { + nbrDays = ((float) abs ([aptEndDate timeIntervalSinceDate: aptStartDate]) + / 86400) + 1; + [event setAllDayWithStartDate: aptStartDate + duration: nbrDays]; + } + else + { + [event setStartDate: aptStartDate]; + [event setEndDate: aptEndDate]; + } if ([clientObject isNew]) [event setTransparency: @"OPAQUE"]; } diff --git a/UI/Templates/SchedulerUI/UIxAppointmentEditor.wox b/UI/Templates/SchedulerUI/UIxAppointmentEditor.wox index d918e7bd6..533f88b0a 100644 --- a/UI/Templates/SchedulerUI/UIxAppointmentEditor.wox +++ b/UI/Templates/SchedulerUI/UIxAppointmentEditor.wox @@ -10,14 +10,9 @@ className="UIxComponentEditor" var:component="event" var:saveURL="saveURL"> -