diff --git a/ChangeLog b/ChangeLog index a5dc22f30..63cd87af1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-11-07 Wolfgang Sourdeau + * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor + -newStartDate]): new method to determine the start date depending + on the URL parameters, the current day and the current time. + * UI/Scheduler/UIxTimeDateControl.m ([UIxTimeDateControl -setDayStartHour:aStartHour]): adjust the minutes to the next quarter of hour, if not already set to a quarter. diff --git a/UI/Scheduler/UIxComponentEditor.h b/UI/Scheduler/UIxComponentEditor.h index 4e256a59b..7071cfe99 100644 --- a/UI/Scheduler/UIxComponentEditor.h +++ b/UI/Scheduler/UIxComponentEditor.h @@ -92,6 +92,8 @@ - (void) setICalString: (NSString *) _s; - (NSString *) iCalString; +- (NSCalendarDate *) newStartDate; + - (void) setStartDate: (NSCalendarDate *) _date; - (NSCalendarDate *) startDate; diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 59fa47781..6adbafd58 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -556,7 +556,7 @@ iCalPerson *p; NSString *emailProp; - emailProp = [@"mailto:" stringByAppendingString:[self emailForUser]]; + emailProp = [@"MAILTO:" stringByAppendingString:[self emailForUser]]; p = [[[iCalPerson alloc] init] autorelease]; [p setEmail:emailProp]; [p setCn:[self cnForUser]]; @@ -597,6 +597,33 @@ } /* subclasses */ +- (NSCalendarDate *) newStartDate +{ + NSCalendarDate *newStartDate, *now; + BOOL hmSpecified; + int hour; + + newStartDate = [self selectedDate]; + hmSpecified = ([[self queryParameterForKey: @"hm"] length] > 0); + if (!hmSpecified) + { + now = [NSCalendarDate calendarDate]; + [now setTimeZone: [[self clientObject] userTimeZone]]; + if (!([[now hour: 8 minute: 0] earlierDate: newStartDate] == newStartDate)) + { + hour = [now hourOfDay]; + if (hour < 8) + newStartDate = [now hour: 8 minute: 0]; + else if (hour > 18) + newStartDate = [[now tomorrow] hour: 8 minute: 0]; + else + newStartDate = now; + } + } + + return newStartDate; +} + - (void) loadValuesFromComponent: (iCalRepeatableEntityObject *) component { iCalRecurrenceRule *rrule; @@ -609,9 +636,9 @@ startDate = [component startDate]; // if ((startDate = [component startDate]) == nil) // startDate = [[NSCalendarDate date] hour:11 minute:0]; + uTZ = [co userTimeZone]; if (startDate) { - uTZ = [co userTimeZone]; [startDate setTimeZone: uTZ]; [startDate retain]; } @@ -655,7 +682,7 @@ - (NSString *) iCalParticipantsStringFromQueryParameters { static NSString *iCalParticipantString = \ - @"ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=\"%@\":mailto:%@\r\n"; + @"ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=\"%@\":MAILTO:%@\r\n"; return [self iCalStringFromQueryParameter: @"ps" format: iCalParticipantString]; @@ -664,7 +691,7 @@ - (NSString *) iCalResourcesStringFromQueryParameters { static NSString *iCalResourceString = \ - @"ATTENDEE;ROLE=NON-PARTICIPANT;CN=\"%@\":mailto:%@\r\n"; + @"ATTENDEE;ROLE=NON-PARTICIPANT;CN=\"%@\":MAILTO:%@\r\n"; return [self iCalStringFromQueryParameter: @"rs" format: iCalResourceString]; @@ -699,7 +726,7 @@ - (NSString *) iCalOrganizerString { - return [NSString stringWithFormat: @"ORGANIZER;CN=\"%@\":mailto:%@\r\n", + return [NSString stringWithFormat: @"ORGANIZER;CN=\"%@\":MAILTO:%@\r\n", [self cnForUser], [self emailForUser]]; }