From dcfb1be7f3cd1e45b81e408ac4f13a4bdc58acc2 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 19 Oct 2006 14:40:24 +0000 Subject: [PATCH] Monotone-Parent: 25201eca7a2d2327ce725455760027b032810d78 Monotone-Revision: beff03702ba361b408bf967b4f807a2fec161392 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-10-19T14:40:24 Monotone-Branch: ca.inverse.sogo --- UI/Scheduler/UIxTaskEditor.h | 2 + UI/Scheduler/UIxTaskEditor.m | 79 +++++-- UI/Templates/SchedulerUI/UIxTaskEditor.wox | 25 ++- UI/WebServerResources/UIxTaskEditor.js | 235 +++++++++++---------- 4 files changed, 207 insertions(+), 134 deletions(-) diff --git a/UI/Scheduler/UIxTaskEditor.h b/UI/Scheduler/UIxTaskEditor.h index 7509525ee..ea6e93a10 100644 --- a/UI/Scheduler/UIxTaskEditor.h +++ b/UI/Scheduler/UIxTaskEditor.h @@ -33,6 +33,8 @@ @interface UIxTaskEditor : UIxComponentEditor { NSCalendarDate *dueDate; + BOOL hasStartDate; + BOOL hasDueDate; } - (void) setTaskStartDate: (NSCalendarDate *) _date; diff --git a/UI/Scheduler/UIxTaskEditor.m b/UI/Scheduler/UIxTaskEditor.m index 052224a6e..22cafcc4d 100644 --- a/UI/Scheduler/UIxTaskEditor.m +++ b/UI/Scheduler/UIxTaskEditor.m @@ -77,8 +77,6 @@ @"STATUS:NEEDS-ACTION\r\n" /* confirmed by default */ @"PERCENT-COMPLETE:0\r\n" @"DTSTAMP:%@Z\r\n" - @"DTSTART:%@\r\n" - @"DUE:%@\r\n" @"SEQUENCE:1\r\n" @"PRIORITY:5\r\n" @"%@" /* organizer */ @@ -86,7 +84,7 @@ @"END:VTODO\r\n" @"END:VCALENDAR"; - NSCalendarDate *lStartDate, *lDueDate, *stamp; + NSCalendarDate *stamp; NSString *template, *s; unsigned minutes; @@ -97,19 +95,13 @@ else { minutes = 60; } - lStartDate = [self selectedDate]; - lDueDate = [lStartDate dateByAddingYears:0 months:0 days:0 - hours:0 minutes:minutes seconds:0]; - stamp = [NSCalendarDate calendarDate]; [stamp setTimeZone: [NSTimeZone timeZoneWithName: @"GMT"]]; - s = [self iCalParticipantsAndResourcesStringFromQueryParameters]; + s = [self iCalParticipantsAndResourcesStringFromQueryParameters]; template = [NSString stringWithFormat:iCalStringTemplate, [[self clientObject] nameInContainer], [stamp iCalFormattedDateTimeString], - [lStartDate iCalFormattedDateTimeString], - [lDueDate iCalFormattedDateTimeString], [self iCalOrganizerString], s]; return template; @@ -182,12 +174,14 @@ uTZ = [[self clientObject] userTimeZone]; dueDate = [_task due]; - if (!dueDate) - dueDate = [[self startDate] dateByAddingYears: 0 months: 0 days: 0 - hours: 1 minutes: 0 seconds: 0]; - - [dueDate setTimeZone: uTZ]; - [dueDate retain]; +// if (!dueDate) +// dueDate = [[self startDate] dateByAddingYears: 0 months: 0 days: 0 +// hours: 1 minutes: 0 seconds: 0]; + if (dueDate) + { + [dueDate setTimeZone: uTZ]; + [dueDate retain]; + } } - (void) saveValuesIntoTask: (iCalToDo *) _task @@ -195,9 +189,18 @@ /* merge in form values */ NSArray *attendees, *lResources; iCalRecurrenceRule *rrule; - - [_task setStartDate: [self taskStartDate]]; - [_task setDue: [self taskDueDate]]; + NSCalendarDate *dateTime; + + if (hasStartDate) + dateTime = [self taskStartDate]; + else + dateTime = nil; + [_task setStartDate: dateTime]; + if (hasDueDate) + dateTime = [self taskDueDate]; + else + dateTime = nil; + [_task setDue: dateTime]; [_task setSummary: [self title]]; [_task setLocation: [self location]]; @@ -444,4 +447,42 @@ return [self redirectToLocation: [self completeURIForMethod:@"../view"]]; } +- (void) setHasStartDate: (BOOL) aBool +{ + hasStartDate = aBool; +} + +- (BOOL) hasStartDate +{ + return ([self taskStartDate] != nil); +} + +- (BOOL) startDateDisabled +{ + return ![self hasStartDate]; +} + +- (void) setHasDueDate: (BOOL) aBool +{ + hasDueDate = aBool; +} + +- (BOOL) hasDueDate +{ + return ([self taskDueDate] != nil); +} + +- (BOOL) dueDateDisabled +{ + return ![self hasDueDate]; +} + +- (void) setDueDateDisabled: (BOOL) aBool +{ +} + +- (void) setStartDateDisabled: (BOOL) aBool +{ +} + @end /* UIxTaskEditor */ diff --git a/UI/Templates/SchedulerUI/UIxTaskEditor.wox b/UI/Templates/SchedulerUI/UIxTaskEditor.wox index 9d524a9a1..75c5de370 100644 --- a/UI/Templates/SchedulerUI/UIxTaskEditor.wox +++ b/UI/Templates/SchedulerUI/UIxTaskEditor.wox @@ -35,17 +35,26 @@ var:checked="isPrivate" /> - - - - + + +