From 8f2410b815024aa1fa9c71e247f2c4101237015f Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 16 Aug 2004 12:31:46 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/trunk@257 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/Scheduler/ChangeLog | 13 ++- SOGo/UI/Scheduler/UIxAppointmentProposal.m | 109 ++++++++++++------- SOGo/UI/Scheduler/UIxAppointmentProposal.wox | 21 ++-- 3 files changed, 88 insertions(+), 55 deletions(-) diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index 557b2a5e..17d41229 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,8 +1,11 @@ -2004-08-16 Marcus Mueller +2004-08-16 Helge Hess - * v0.9.60 + * UIxAppointmentProposal: proper vertical/horizontal row generation + (v0.9.61) - * UIxAppointmentView.m: fixed redirect in deleteAction. +2004-08-16 Marcus Mueller + + * UIxAppointmentView.m: fixed redirect in deleteAction. (v0.9.60) * v0.9.59 @@ -12,9 +15,7 @@ * UIxAppointmentProposal.wox, UIxAppointmentEditor.wox: fixed cancel button urls. - * v0.9.58 - - * UIxAppointmentProposal.[wox,m]: fixed date/time fields. + * UIxAppointmentProposal.[wox,m]: fixed date/time fields. (v0.9.58) 2004-08-16 Helge Hess diff --git a/SOGo/UI/Scheduler/UIxAppointmentProposal.m b/SOGo/UI/Scheduler/UIxAppointmentProposal.m index c4005ea7..4ea4faef 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentProposal.m +++ b/SOGo/UI/Scheduler/UIxAppointmentProposal.m @@ -30,12 +30,12 @@ /* individual values */ id startDateHour; id startDateMinute; + id endDateHour; + id endDateMinute; + id startDateDay; id startDateMonth; id startDateYear; - - id endDateHour; - id endDateMinute; id endDateDay; id endDateMonth; id endDateYear; @@ -88,64 +88,64 @@ } - (void)setStartDateHour:(id)_startDateHour { - ASSIGN(self->startDateHour, _startDateHour); + ASSIGN(self->startDateHour, _startDateHour); } - (id)startDateHour { - return self->startDateHour; + return self->startDateHour; } - (void)setStartDateMinute:(id)_startDateMinute { - ASSIGN(self->startDateMinute, _startDateMinute); + ASSIGN(self->startDateMinute, _startDateMinute); } - (id)startDateMinute { - return self->startDateMinute; + return self->startDateMinute; } - (void)setStartDateDay:(id)_startDateDay { - ASSIGN(self->startDateDay, _startDateDay); + ASSIGN(self->startDateDay, _startDateDay); } - (id)startDateDay { - return self->startDateDay; + return self->startDateDay; } - (void)setStartDateMonth:(id)_startDateMonth { - ASSIGN(self->startDateMonth, _startDateMonth); + ASSIGN(self->startDateMonth, _startDateMonth); } - (id)startDateMonth { - return self->startDateMonth; + return self->startDateMonth; } - (void)setStartDateYear:(id)_startDateYear { - ASSIGN(self->startDateYear, _startDateYear); + ASSIGN(self->startDateYear, _startDateYear); } - (id)startDateYear { - return self->startDateYear; + return self->startDateYear; } - (void)setEndDateHour:(id)_endDateHour { - ASSIGN(self->endDateHour, _endDateHour); + ASSIGN(self->endDateHour, _endDateHour); } - (id)endDateHour { - return self->endDateHour; + return self->endDateHour; } - (void)setEndDateMinute:(id)_endDateMinute { - ASSIGN(self->endDateMinute, _endDateMinute); + ASSIGN(self->endDateMinute, _endDateMinute); } - (id)endDateMinute { - return self->endDateMinute; + return self->endDateMinute; } - (void)setEndDateDay:(id)_endDateDay { - ASSIGN(self->endDateDay, _endDateDay); + ASSIGN(self->endDateDay, _endDateDay); } - (id)endDateDay { - return self->endDateDay; + return self->endDateDay; } - (void)setEndDateMonth:(id)_endDateMonth { - ASSIGN(self->endDateMonth, _endDateMonth); + ASSIGN(self->endDateMonth, _endDateMonth); } - (id)endDateMonth { - return self->endDateMonth; + return self->endDateMonth; } - (void)setEndDateYear:(id)_endDateYear { - ASSIGN(self->endDateYear, _endDateYear); + ASSIGN(self->endDateYear, _endDateYear); } - (id)endDateYear { - return self->endDateYear; + return self->endDateYear; } - (void)setStartDate:(NSCalendarDate *)_date { @@ -157,12 +157,12 @@ } - (NSCalendarDate *)startDate { return [NSCalendarDate dateWithYear:[[self startDateYear] intValue] - month:[[self startDateMonth] intValue] - day:[[self startDateDay] intValue] - hour:[[self startDateHour] intValue] - minute:[[self startDateMinute] intValue] - second:0 - timeZone:[self viewTimeZone]]; + month:[[self startDateMonth] intValue] + day:[[self startDateDay] intValue] + hour:[[self startDateHour] intValue] + minute:[[self startDateMinute] intValue] + second:0 + timeZone:[self viewTimeZone]]; } - (void)setEndDate:(NSCalendarDate *)_date { [self setEndDateHour:[NSNumber numberWithInt:[_date hourOfDay]]]; @@ -172,13 +172,13 @@ [self setEndDateYear:[NSNumber numberWithInt:[_date yearOfCommonEra]]]; } - (NSCalendarDate *)endDate { - return [NSCalendarDate dateWithYear:[[self endDateYear] intValue] - month:[[self endDateMonth] intValue] - day:[[self endDateDay] intValue] - hour:[[self endDateHour] intValue] - minute:[[self endDateMinute] intValue] - second:59 - timeZone:[self viewTimeZone]]; + return [NSCalendarDate dateWithYear:[[self endDateYear] intValue] + month:[[self endDateMonth] intValue] + day:[[self endDateDay] intValue] + hour:[[self endDateHour] intValue] + minute:[[self endDateMinute] intValue] + second:59 + timeZone:[self viewTimeZone]]; } - (void)setDuration:(id)_duration { @@ -196,10 +196,13 @@ - (NSString *)itemDurationText { // TODO: use a formatter + // TODO: localize switch ([[self item] intValue]) { case 30: return @"30 minutes"; case 60: return @"1 hour"; case 120: return @"2 hours"; + case 240: return @"4 hours"; + case 480: return @"8 hours"; default: return [NSString stringWithFormat:@"%@ minutes", [self item]]; } @@ -240,6 +243,11 @@ unsigned lStartHour = 9, lEndHour = 17, i; NSMutableArray *ma; + lStartHour = [[self startDateHour] intValue]; + lEndHour = [[self endDateHour] intValue]; + if (lStartHour < 1) lStartHour = 1; + if (lEndHour < lStartHour) lEndHour = lStartHour + 1; + ma = [NSMutableArray arrayWithCapacity:lEndHour - lStartHour + 2]; for (i = lStartHour; i <= lEndHour; i++) [ma addObject:[NSNumber numberWithInt:i]]; @@ -248,12 +256,36 @@ - (NSArray *)days { // TODO: from startdate to enddate - return [NSArray arrayWithObjects:@"2004-08-15", nil]; + NSMutableArray *ma; + NSCalendarDate *base, *stop, *current; + + base = [NSCalendarDate dateWithYear:[[self startDateYear] intValue] + month:[[self startDateMonth] intValue] + day:[[self startDateDay] intValue] + hour:12 minute:0 second:0 + timeZone:[self viewTimeZone]]; + stop = [NSCalendarDate dateWithYear:[[self endDateYear] intValue] + month:[[self endDateMonth] intValue] + day:[[self endDateDay] intValue] + hour:12 minute:0 second:0 + timeZone:[self viewTimeZone]]; + + ma = [NSMutableArray arrayWithCapacity:16]; + + current = base; + while ([current compare:stop] != NSOrderedDescending) { + [ma addObject:current]; + + /* Note: remember the timezone behaviour of the method below! */ + current = [current dateByAddingYears:0 months:0 days:1]; + } + return ma; } - (NSArray *)durationSteps { // TODO: make configurable - return [NSArray arrayWithObjects:@"30", @"60", @"120", nil]; + return [NSArray arrayWithObjects: + @"30", @"60", @"120", @"240", @"480", nil]; } /* slots */ @@ -285,6 +317,7 @@ now = [NSCalendarDate date]; + [self setDuration:@"120"]; /* 1 hour as default */ [self setStartDate:[now hour:9 minute:0]]; [self setEndDate:[now hour:18 minute:0]]; diff --git a/SOGo/UI/Scheduler/UIxAppointmentProposal.wox b/SOGo/UI/Scheduler/UIxAppointmentProposal.wox index 1f29e8a5..01a8ba66 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentProposal.wox +++ b/SOGo/UI/Scheduler/UIxAppointmentProposal.wox @@ -29,8 +29,8 @@ -
- + +
-
@@ -75,9 +75,7 @@
: @@ -190,11 +188,11 @@
-
+ -
- +
+
@@ -223,7 +221,8 @@ @@ -249,8 +248,8 @@ - -
+ >
+ + -- 2.39.5