From 065106259d0f837450c1fd66ad05834d3d668487 Mon Sep 17 00:00:00 2001 From: znek Date: Mon, 26 Jul 2004 17:30:47 +0000 Subject: [PATCH] more code for day overview and the usual fixes git-svn-id: http://svn.opengroupware.org/SOGo/trunk@156 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/Common/ChangeLog | 4 + SOGo/UI/Common/calendar.css | 34 ++++++ SOGo/UI/SOGoUI/ChangeLog | 9 ++ SOGo/UI/SOGoUI/UIxComponent.m | 21 ++-- SOGo/UI/Scheduler/ChangeLog | 14 +++ SOGo/UI/Scheduler/UIxAppointmentEditor.m | 5 +- SOGo/UI/Scheduler/UIxCalDayOverview.m | 122 +++++++++++++++++++++- SOGo/UI/Scheduler/UIxCalDayOverview.wox | 46 ++++++-- SOGo/UI/Scheduler/UIxCalDayView.m | 4 +- SOGo/UI/Scheduler/UIxCalMonthOverview.wox | 2 + SOGo/UI/Scheduler/UIxCalMonthView.m | 10 +- SOGo/UI/Scheduler/UIxCalView.h | 4 + SOGo/UI/Scheduler/UIxCalView.m | 12 +++ SOGo/UI/Scheduler/UIxCalWeekView.m | 7 +- SOGo/UI/Scheduler/Version | 2 +- 15 files changed, 266 insertions(+), 30 deletions(-) diff --git a/SOGo/UI/Common/ChangeLog b/SOGo/UI/Common/ChangeLog index 2cd35856..1431b1fa 100644 --- a/SOGo/UI/Common/ChangeLog +++ b/SOGo/UI/Common/ChangeLog @@ -1,3 +1,7 @@ +2004-07-26 Marcus Mueller + + * calendar.css: added styles for dayoverview's content. + 2004-07-23 Marcus Mueller * calendar.css: added styles for dayoverview's calendar. diff --git a/SOGo/UI/Common/calendar.css b/SOGo/UI/Common/calendar.css index c485a1dc..501f05c6 100644 --- a/SOGo/UI/Common/calendar.css +++ b/SOGo/UI/Common/calendar.css @@ -12,6 +12,40 @@ } +.dayoverview_content { + padding: 1px; + margin: 0px 0px 0px 0px; + vertical-align: top; + font-family: Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif; + letter-spacing: 0pt; + font-size: 9pt; +} + +.dayoverview_content_time { + background-color: #d2d2cc; + text-align: center; +} + +.dayoverview_content_time_link { + font-size: 8pt; +} +.dayoverview_content_time_link a { + color: #0033cc; + text-decoration: none; +} +.dayoverview_content_time_link a:hover { + color: #ff0000; + text-decoration: underline; +} + +.dayoverview_content_apts { + color: #0033cc; + background-color: #e8e8e0; + text-align: left; + vertical-align: top; +} + + .dayoverview_cal { color: #000000; font-family: Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif; diff --git a/SOGo/UI/SOGoUI/ChangeLog b/SOGo/UI/SOGoUI/ChangeLog index f66a857d..922b4408 100644 --- a/SOGo/UI/SOGoUI/ChangeLog +++ b/SOGo/UI/SOGoUI/ChangeLog @@ -1,3 +1,12 @@ +2004-07-26 Marcus Mueller + + * UIxComponent.m: added "hm" queryParameter to add hour/minute part to + selectedDate which is necessary for appointment proposals. Removed + all additional stuff from -dateForDateString: and moved this to + -selectedDate. IMHO this is always high-level behaviour which needs to + be refined in the appropriate high-level method, not at conversion + level. + 2004-07-21 Marcus Mueller * UIxComponent.[hm]: renamed some of the labels to better reflect the diff --git a/SOGo/UI/SOGoUI/UIxComponent.m b/SOGo/UI/SOGoUI/UIxComponent.m index 9ccbe480..8786220b 100644 --- a/SOGo/UI/SOGoUI/UIxComponent.m +++ b/SOGo/UI/SOGoUI/UIxComponent.m @@ -221,12 +221,23 @@ static NSMutableArray *abbrMonthLabelKeys = nil; - (NSCalendarDate *)selectedDate { NSString *s; NSCalendarDate *cdate; - + s = [self queryParameterForKey:@"day"]; cdate = ([s length] > 0) ? [self dateForDateString:s] : [NSCalendarDate date]; [cdate setTimeZone:[self viewTimeZone]]; + s = [self queryParameterForKey:@"hm"]; + if([s length] == 4) { + unsigned hour, minute; + + hour = [[s substringToIndex:2] unsignedIntValue]; + minute = [[s substringFromIndex:2] unsignedIntValue]; + cdate = [cdate hour:hour minute:minute]; + } + else { + cdate = [cdate hour:12 minute:0]; + } return cdate; } @@ -236,14 +247,8 @@ static NSMutableArray *abbrMonthLabelKeys = nil; } - (NSCalendarDate *)dateForDateString:(NSString *)_dateString { - NSTimeZone *tz; - - tz = [self viewTimeZone]; - /* Note: we should give a time, best is noon to avoid edge conditions */ - _dateString = [_dateString stringByAppendingFormat:@"12:00:00 %@", - [tz abbreviation]]; return [NSCalendarDate dateWithString:_dateString - calendarFormat:@"%Y%m%d %H:%M:%S %Z"]; + calendarFormat:@"%Y%m%d"]; } diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index 78abaa65..8f6d7682 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,3 +1,17 @@ +2004-07-26 Marcus Mueller + + * v0.9.7 + + * UIxCalView.[hm]: new methods for defaults access, -dayStartHour, + -dayEndHour and -shouldDisplayWeekend. + + * UIxCalDayOverview.[m|wox]: added content. CSS isn't 100% proper, yet. + + * UIxCalWeekView.m, UIxCalMonthView.m: set startDate/endDate properly. + + * UIxAppointmentEditor.m: fixed a subtle bug in -uriAsFormat that + prevented date information from being set properly in newAction:. + 2004-07-23 Marcus Mueller * v0.9.6 diff --git a/SOGo/UI/Scheduler/UIxAppointmentEditor.m b/SOGo/UI/Scheduler/UIxAppointmentEditor.m index 0eeb5058..ab9e5196 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentEditor.m +++ b/SOGo/UI/Scheduler/UIxAppointmentEditor.m @@ -181,12 +181,12 @@ NSRange r; uri = [[[self context] request] uri]; - + /* first: identify query parameters */ r = [uri rangeOfString:@"?" options:NSBackwardsSearch]; if (r.length > 0) { - uri = [uri substringToIndex:r.location]; qp = [uri substringFromIndex:r.location]; + uri = [uri substringToIndex:r.location]; } else qp = nil; @@ -231,7 +231,6 @@ nextMethod = [NSString stringWithFormat:@"%@/edit", objectId]; uriFormat = [self uriAsFormat]; uri = [[NSString alloc] initWithFormat:uriFormat, nextMethod]; - req = [[self context] request]; r = [WOResponse responseWithRequest:req]; [r setStatus:302 /* moved */]; diff --git a/SOGo/UI/Scheduler/UIxCalDayOverview.m b/SOGo/UI/Scheduler/UIxCalDayOverview.m index ed701e96..b5647dd9 100644 --- a/SOGo/UI/Scheduler/UIxCalDayOverview.m +++ b/SOGo/UI/Scheduler/UIxCalDayOverview.m @@ -22,10 +22,14 @@ #include "UIxCalDayView.h" +#include +#include + @interface UIxCalDayOverview : UIxCalDayView { - + NSCalendarDate *currentDate; + NSArray *currentApts; } @end @@ -33,4 +37,120 @@ @implementation UIxCalDayOverview +- (void)dealloc { + [self->currentDate release]; + [self->currentApts release]; + [super dealloc]; +} + +- (void)setCurrentDate:(NSCalendarDate *)_date { + ASSIGN(self->currentDate, _date); +} +- (NSCalendarDate *)currentDate { + return self->currentDate; +} + +- (void)setCurrentApts:(NSArray *)_apts { + ASSIGN(self->currentApts, _apts); +} +- (NSArray *)currentApts { + return self->currentApts; +} + +- (NSArray *)dateRange { + NSMutableArray *dateRange; + unsigned i, count, offset; + + offset = [self dayStartHour]; + count = [self dayEndHour] - offset; + dateRange = [[NSMutableArray alloc] initWithCapacity:count]; + for(i = 0; i < count; i++) { + NSCalendarDate *date; + + date = [[self startDate] hour:offset + i minute:0]; + [dateRange addObject:date]; + } + return [dateRange autorelease]; +} + + +- (NSArray *)aptsForCurrentDate { + NSArray *apts; + NSMutableArray *filtered; + unsigned i, count; + NSCalendarDate *start, *end; + + start = self->currentDate; + end = [start dateByAddingYears:0 + months:0 + days:0 + hours:0 + minutes:59 + seconds:59]; + + apts = [self appointments]; + filtered = [[NSMutableArray alloc] initWithCapacity:1]; + count = [apts count]; + for(i = 0; i < count; i++) { + id apt; + NSCalendarDate *aptStartDate; + + /* NOTE: appointments are totally opaque objects, we don't know much + about them. The reason for this is that they are backend-dependent + and we'd like to use UIx for SOGo *and* ZideStore also. + We have to accept the fact that we know just a little bit + of their API which is completely KVC driven. + */ + + apt = [apts objectAtIndex:i]; + aptStartDate = [apt valueForKey:@"startDate"]; + if([aptStartDate isGreaterThanOrEqualTo:start] && + [aptStartDate isLessThan:end]) { + [filtered addObject:apt]; + } + } + + return [filtered autorelease]; +} + +- (NSString *)shortTextForApt { + NSCalendarDate *startDate, *endDate; + NSString *ms; + + startDate = [[self appointment] valueForKey:@"startDate"]; + [startDate setTimeZone:[self viewTimeZone]]; + endDate = [[self appointment] valueForKey:@"endDate"]; + [endDate setTimeZone:[self viewTimeZone]]; + + ms = [NSString stringWithFormat:@"%02i:%02i %@", + [startDate hourOfDay], + [startDate minuteOfHour], + [[self appointment] valueForKey:@"title"]]; + return ms; +} + + +/* URLs */ + +- (NSDictionary *)currentDateQueryParameters { + NSMutableDictionary *qp; + NSString *hmString; + NSCalendarDate *date; + + date = [self currentDate]; + hmString = [NSString stringWithFormat:@"%02d%02d", + [date hourOfDay], [date minuteOfHour]]; + qp = [[self queryParameters] mutableCopy]; + [self setSelectedDateQueryParameter:date inDictionary:qp]; + [qp setObject:hmString forKey:@"hm"]; + return [qp autorelease]; +} + + +/* appointments */ + +- (NSArray *)appointments { + return [self fetchCoreInfos]; +} + @end diff --git a/SOGo/UI/Scheduler/UIxCalDayOverview.wox b/SOGo/UI/Scheduler/UIxCalDayOverview.wox index bdd4e8c6..89d65fbe 100644 --- a/SOGo/UI/Scheduler/UIxCalDayOverview.wox +++ b/SOGo/UI/Scheduler/UIxCalDayOverview.wox @@ -68,19 +68,19 @@ + label:title="Chart" + label:alt="Chart" + border="0" + valign="top" + /> + label:title="List" + label:alt="List" + border="0" + valign="top" + /> @@ -145,7 +145,31 @@ - TODO: Content + + + + + + + +
+ +
+ + [] + +
+ + +
+
+
diff --git a/SOGo/UI/Scheduler/UIxCalDayView.m b/SOGo/UI/Scheduler/UIxCalDayView.m index fcd872c2..a873ae2c 100644 --- a/SOGo/UI/Scheduler/UIxCalDayView.m +++ b/SOGo/UI/Scheduler/UIxCalDayView.m @@ -60,10 +60,10 @@ /* fetching */ - (NSCalendarDate *)startDate { - return [[self selectedDate] beginOfDay]; + return [[self selectedDate] hour:[self dayStartHour] minute:0]; } - (NSCalendarDate *)endDate { - return [[self startDate] endOfDay]; + return [[self startDate] hour:[self dayEndHour] minute:0]; } @end diff --git a/SOGo/UI/Scheduler/UIxCalMonthOverview.wox b/SOGo/UI/Scheduler/UIxCalMonthOverview.wox index 331aa8f2..df1d41e0 100644 --- a/SOGo/UI/Scheduler/UIxCalMonthOverview.wox +++ b/SOGo/UI/Scheduler/UIxCalMonthOverview.wox @@ -96,6 +96,7 @@ +
@@ -125,6 +126,7 @@ var:title="shortTextForApt" var:queryDictionary="currentDayQueryParameters" > +
diff --git a/SOGo/UI/Scheduler/UIxCalMonthView.m b/SOGo/UI/Scheduler/UIxCalMonthView.m index 09f93086..d2e1f73f 100644 --- a/SOGo/UI/Scheduler/UIxCalMonthView.m +++ b/SOGo/UI/Scheduler/UIxCalMonthView.m @@ -1,16 +1,22 @@ // $Id$ #include "UIxCalMonthView.h" +#include #include "common.h" + @implementation UIxCalMonthView - (NSCalendarDate *)startDate { - return [[[super startDate] firstDayOfMonth] beginOfDay]; + return [[[super startDate] firstDayOfMonth] + hour:[self dayStartHour] + minute:0]; } - (NSCalendarDate *)endDate { - NSCalendarDate *startDate = [[self startDate] endOfDay]; + NSCalendarDate *startDate = [[self startDate] + hour:[self dayEndHour] + minute:0]; return [startDate dateByAddingYears:0 months:0 days:[startDate numberOfDaysInMonth] diff --git a/SOGo/UI/Scheduler/UIxCalView.h b/SOGo/UI/Scheduler/UIxCalView.h index ae2e6592..25e32bbd 100644 --- a/SOGo/UI/Scheduler/UIxCalView.h +++ b/SOGo/UI/Scheduler/UIxCalView.h @@ -36,6 +36,10 @@ - (BOOL)showFullNames; - (BOOL)showAMPMDates; +- (unsigned)dayStartHour; +- (unsigned)dayEndHour; +- (BOOL)shouldDisplayWeekend; + - (NSCalendarDate *)referenceDateForFormatter; /* URLs */ diff --git a/SOGo/UI/Scheduler/UIxCalView.m b/SOGo/UI/Scheduler/UIxCalView.m index 69fa83ae..4404e324 100644 --- a/SOGo/UI/Scheduler/UIxCalView.m +++ b/SOGo/UI/Scheduler/UIxCalView.m @@ -108,6 +108,18 @@ return NO; } +- (unsigned)dayStartHour { + return 8; +} + +- (unsigned)dayEndHour { + return 19; +} + +- (BOOL)shouldDisplayWeekend { + return NO; +} + /* URLs */ diff --git a/SOGo/UI/Scheduler/UIxCalWeekView.m b/SOGo/UI/Scheduler/UIxCalWeekView.m index 5696cfa1..8d224074 100644 --- a/SOGo/UI/Scheduler/UIxCalWeekView.m +++ b/SOGo/UI/Scheduler/UIxCalWeekView.m @@ -1,17 +1,20 @@ // $Id$ #include "UIxCalWeekView.h" +#include #include "common.h" @implementation UIxCalWeekView - (NSCalendarDate *)startDate { - return [[[super startDate] mondayOfWeek] beginOfDay]; + return [[[super startDate] mondayOfWeek] hour:[self dayStartHour] + minute:0]; } - (NSCalendarDate *)endDate { return [[[self startDate] dateByAddingYears:0 months:0 days:7 - hours:0 minutes:0 seconds:0] endOfDay]; + hours:0 minutes:0 seconds:0] + hour:[self dayEndHour] minute:0]; } /* URLs */ diff --git a/SOGo/UI/Scheduler/Version b/SOGo/UI/Scheduler/Version index 3fc5892a..e852897c 100644 --- a/SOGo/UI/Scheduler/Version +++ b/SOGo/UI/Scheduler/Version @@ -1,5 +1,5 @@ # $Id$ -SUBMINOR_VERSION:=6 +SUBMINOR_VERSION:=7 # 1.1.0 requires NGObjWeb 4.2.202 -- 2.39.5