From: znek Date: Thu, 5 Aug 2004 17:55:50 +0000 (+0000) Subject: refactoring and implementation of daychartview. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a720236e3e14497ea96a3e8625480f21d29aefd2;p=scalable-opengroupware.org refactoring and implementation of daychartview. git-svn-id: http://svn.opengroupware.org/SOGo/trunk@165 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/Common/ChangeLog b/SOGo/UI/Common/ChangeLog index b3ed0163..c155e092 100644 --- a/SOGo/UI/Common/ChangeLog +++ b/SOGo/UI/Common/ChangeLog @@ -1,3 +1,11 @@ +2004-08-05 Marcus Mueller + + * v0.9.7 + + * calendar.css: commented some styles out, because they don't really do + what I think they should do. Someone with better knowledge of CSS should + look into this. + 2004-08-02 Marcus Mueller * v0.9.6 diff --git a/SOGo/UI/Common/Version b/SOGo/UI/Common/Version index 0eb47da3..cab297dc 100644 --- a/SOGo/UI/Common/Version +++ b/SOGo/UI/Common/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=6 +SUBMINOR_VERSION:=7 diff --git a/SOGo/UI/Common/calendar.css b/SOGo/UI/Common/calendar.css index b71267fc..dc846200 100644 --- a/SOGo/UI/Common/calendar.css +++ b/SOGo/UI/Common/calendar.css @@ -90,25 +90,25 @@ .dayoverview_cal_day_header { background-color: #d2d2cc; text-align: center; - vertical-align: middle; + vertical-align: top; font-size: 11pt; - width: 20px; - padding: 2px 2px 2px 2px; - margin: 2px 2px 2px 2px; +// width: 24px; +// padding: 2px 2px 2px 2px; +// margin: 2px 2px 2px 2px; } .dayoverview_cal_content { color: #0033cc; background-color: #e8e8e0; text-align: center; - vertical-align: middle; + vertical-align: top; } .dayoverview_cal_content_hilite { color: #0033cc; background-color: #fffff0; text-align: center; - vertical-align: middle; + vertical-align: top; } .dayoverview_cal_content_selected { @@ -125,7 +125,7 @@ color: #0033cc; background-color: #d2d2cc; text-align: center; - vertical-align: middle; + vertical-align: top; } .dayoverview_cal_content_dimmed a { color: #5a5a5a; diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index 4c9b43dd..5184b9fd 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,3 +1,21 @@ +2004-08-05 Marcus Mueller + + * v0.9.14 + + * UIxCalDayOverview.[hm]: refactored currentDate -> moved to + UIxCalDayView.[hm]. + + * UIxCalDayView.[hm]: added currentDate and accompanied functionality. + + * UIxCalView.[hm]: added -tooltipForApt. + + * UIxCalDayChartview.[wox|m]: implemented. + + * UIxCalInlineMonthOverview.wox: cosmetic changes. + + * UIxCalDayOverview.wox, UIxCalWeekOverview.wox, UIxCalMonthOverview.wox: + uses "tooltipForApt" for view hyperlinks. + 2004-08-02 Marcus Mueller * v0.9.13 diff --git a/SOGo/UI/Scheduler/UIxCalDayChartview.m b/SOGo/UI/Scheduler/UIxCalDayChartview.m index b7a01d7e..3938d9d7 100644 --- a/SOGo/UI/Scheduler/UIxCalDayChartview.m +++ b/SOGo/UI/Scheduler/UIxCalDayChartview.m @@ -34,4 +34,20 @@ @implementation UIxCalDayChartview +- (NSArray *)columns { + static NSArray *columns = nil; + if(columns == nil) { + columns = [[NSArray arrayWithObject:@"0"] retain]; + } + return columns; +} + +- (BOOL)isPadColumn { + return NO; +} + +- (NSString *)shortTextForApt { + return [[self appointment] valueForKey:@"title"]; +} + @end diff --git a/SOGo/UI/Scheduler/UIxCalDayChartview.wox b/SOGo/UI/Scheduler/UIxCalDayChartview.wox index 3418bb4f..34962970 100644 --- a/SOGo/UI/Scheduler/UIxCalDayChartview.wox +++ b/SOGo/UI/Scheduler/UIxCalDayChartview.wox @@ -7,7 +7,12 @@ className="UIxPageFrame" title="name" > - +
@@ -31,7 +36,10 @@
- +
TODO: controlsTODO: controls - +
-
+ - diff --git a/SOGo/UI/Scheduler/UIxCalDayOverview.h b/SOGo/UI/Scheduler/UIxCalDayOverview.h index f33cf01b..335cd215 100644 --- a/SOGo/UI/Scheduler/UIxCalDayOverview.h +++ b/SOGo/UI/Scheduler/UIxCalDayOverview.h @@ -26,22 +26,12 @@ @interface UIxCalDayOverview : UIxCalDayView { - NSCalendarDate *currentDate; NSArray *currentApts; } - -- (void)setCurrentDate:(NSCalendarDate *)_date; -- (NSCalendarDate *)currentDate; - - (void)setCurrentApts:(NSArray *)_apts; - (NSArray *)currentApts; -- (NSArray *)aptsForCurrentDate; - -- (BOOL)hasNoAptsForCurrentDate; - (int)minRequiredRowSpan; - -- (NSDictionary *)currentDateQueryParameters; @end diff --git a/SOGo/UI/Scheduler/UIxCalDayOverview.m b/SOGo/UI/Scheduler/UIxCalDayOverview.m index 75522a0e..1d446bbf 100644 --- a/SOGo/UI/Scheduler/UIxCalDayOverview.m +++ b/SOGo/UI/Scheduler/UIxCalDayOverview.m @@ -26,18 +26,10 @@ @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); } @@ -45,66 +37,9 @@ return self->currentApts; } -- (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]; -} - -- (BOOL)hasNoAptsForCurrentDate { - return [[self aptsForCurrentDate] count] == 0; -} - - (int)minRequiredRowSpan { unsigned count = [[self aptsForCurrentDate] count]; return count == 0 ? 1 : count; } -- (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]; -} - @end diff --git a/SOGo/UI/Scheduler/UIxCalDayOverview.wox b/SOGo/UI/Scheduler/UIxCalDayOverview.wox index 7cc732a0..703840f8 100644 --- a/SOGo/UI/Scheduler/UIxCalDayOverview.wox +++ b/SOGo/UI/Scheduler/UIxCalDayOverview.wox @@ -162,6 +162,7 @@
@@ -185,6 +186,7 @@
diff --git a/SOGo/UI/Scheduler/UIxCalDayView.h b/SOGo/UI/Scheduler/UIxCalDayView.h index 8b428bea..7f899291 100644 --- a/SOGo/UI/Scheduler/UIxCalDayView.h +++ b/SOGo/UI/Scheduler/UIxCalDayView.h @@ -29,10 +29,21 @@ @interface UIxCalDayView : UIxCalView { + NSCalendarDate *currentDate; } +- (void)setCurrentDate:(NSCalendarDate *)_date; +- (NSCalendarDate *)currentDate; +- (BOOL)isCurrentDateInApt; + +- (NSDictionary *)currentDateQueryParameters; + - (NSArray *)dateRange; +/* appointments */ +- (NSArray *)aptsForCurrentDate; +- (BOOL)hasAptsForCurrentDate; + @end #endif /* __UIxCalDayView_H_ */ diff --git a/SOGo/UI/Scheduler/UIxCalDayView.m b/SOGo/UI/Scheduler/UIxCalDayView.m index b072fafe..89c1f190 100644 --- a/SOGo/UI/Scheduler/UIxCalDayView.m +++ b/SOGo/UI/Scheduler/UIxCalDayView.m @@ -26,11 +26,55 @@ #include "common.h" @interface UIxCalDayView (PrivateAPI) +- (BOOL)isCurrentDateInApt:(id)_apt; - (NSArray *)_getDatesFrom:(NSCalendarDate *)_from to:(NSCalendarDate *)_to; @end @implementation UIxCalDayView +- (void)dealloc { + [self->currentDate release]; + [super dealloc]; +} + +- (void)setCurrentDate:(NSCalendarDate *)_date { + ASSIGN(self->currentDate, _date); +} +- (NSCalendarDate *)currentDate { + return self->currentDate; +} + +- (BOOL)isCurrentDateInApt { + return [self isCurrentDateInApt:[self appointment]]; +} + +- (BOOL)isCurrentDateInApt:(id)_apt { + NSCalendarDate *start, *end, *aptStartDate, *aptEndDate; + + start = self->currentDate; + end = [start dateByAddingYears:0 + months:0 + days:0 + hours:0 + minutes:59 + seconds:59]; + + aptStartDate = [_apt valueForKey:@"startDate"]; + aptEndDate = [_apt valueForKey:@"endDate"]; + + /* does apt fully enclose start/end? */ + if([start isGreaterThanOrEqualTo:aptStartDate] && + [end isLessThanOrEqualTo:aptEndDate]) + return YES; + if([aptStartDate isGreaterThanOrEqualTo:start] && + [aptStartDate isLessThan:end]) + return YES; + if([aptEndDate isGreaterThan:start] && + [aptEndDate isLessThanOrEqualTo:end]) + return YES; + + return NO; +} - (NSArray *)dateRange { /* default range is from dayStartHour to dayEndHour. Any values before @@ -128,6 +172,20 @@ return [self queryParametersBySettingSelectedDate:date]; } +- (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]; +} + /* fetching */ @@ -145,4 +203,47 @@ return [self fetchCoreInfos]; } +- (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]; +} + +- (BOOL)hasAptsForCurrentDate { + return [[self aptsForCurrentDate] count] != 0; +} + @end diff --git a/SOGo/UI/Scheduler/UIxCalInlineMonthOverview.wox b/SOGo/UI/Scheduler/UIxCalInlineMonthOverview.wox index aa6d005a..f12a0426 100644 --- a/SOGo/UI/Scheduler/UIxCalInlineMonthOverview.wox +++ b/SOGo/UI/Scheduler/UIxCalInlineMonthOverview.wox @@ -9,11 +9,14 @@ > @@ -41,7 +44,9 @@ var:queryDictionary="currentWeekQueryParameters" > - + @@ -53,7 +58,9 @@ var:queryDictionary="currentDayQueryParameters" > - + diff --git a/SOGo/UI/Scheduler/UIxCalMonthOverview.wox b/SOGo/UI/Scheduler/UIxCalMonthOverview.wox index b8dabadd..2db35fc0 100644 --- a/SOGo/UI/Scheduler/UIxCalMonthOverview.wox +++ b/SOGo/UI/Scheduler/UIxCalMonthOverview.wox @@ -145,7 +145,7 @@
diff --git a/SOGo/UI/Scheduler/UIxCalView.h b/SOGo/UI/Scheduler/UIxCalView.h index 65a17f7c..e53a4229 100644 --- a/SOGo/UI/Scheduler/UIxCalView.h +++ b/SOGo/UI/Scheduler/UIxCalView.h @@ -30,6 +30,7 @@ - (NSString *)aptTypeIcon; - (NSString *)shortTextForApt; - (NSString *)shortTitleForApt; +- (NSString *)tooltipForApt; - (NSString *)appointmentViewURL; - (id)holidayInfo; diff --git a/SOGo/UI/Scheduler/UIxCalView.m b/SOGo/UI/Scheduler/UIxCalView.m index 0fe828b4..3edb7567 100644 --- a/SOGo/UI/Scheduler/UIxCalView.m +++ b/SOGo/UI/Scheduler/UIxCalView.m @@ -67,6 +67,43 @@ return title; } +- (NSString *)tooltipForApt { + NSCalendarDate *startDate, *endDate; + NSMutableString *aptDescr; + NSString *s; + BOOL spansRange; + id apt; + + apt = [self appointment]; + spansRange = NO; + startDate = [apt valueForKey:@"startDate"]; + [startDate setTimeZone:[self viewTimeZone]]; + endDate = [apt valueForKey:@"endDate"]; + if(endDate != nil) { + [endDate setTimeZone:[self viewTimeZone]]; + spansRange = ![endDate isEqualToDate:startDate]; + } + aptDescr = [[NSMutableString alloc] init]; + [aptDescr appendString:[self labelForKey:@"appointment"]]; + [aptDescr appendFormat:@"\n%02i:%02i", + [startDate hourOfDay], + [startDate minuteOfHour]]; + if(spansRange) { + [aptDescr appendFormat:@" - %02i:%02i", + [endDate hourOfDay], + [endDate minuteOfHour]]; + } + s = [apt valueForKey:@"title"]; + if(s) { + [aptDescr appendFormat:@"\n%@", s]; + } + s = [apt valueForKey:@"location"]; + if(s) { + [aptDescr appendFormat:@"\n%@", s]; + } + return [aptDescr autorelease]; +} + - (NSCalendarDate *)referenceDateForFormatter { return [self selectedDate]; } diff --git a/SOGo/UI/Scheduler/UIxCalWeekOverview.wox b/SOGo/UI/Scheduler/UIxCalWeekOverview.wox index 6be563d0..99db42bd 100644 --- a/SOGo/UI/Scheduler/UIxCalWeekOverview.wox +++ b/SOGo/UI/Scheduler/UIxCalWeekOverview.wox @@ -161,6 +161,7 @@

diff --git a/SOGo/UI/Scheduler/Version b/SOGo/UI/Scheduler/Version index 92c8fa08..cc039aca 100644 --- a/SOGo/UI/Scheduler/Version +++ b/SOGo/UI/Scheduler/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=13 +SUBMINOR_VERSION:=14
- -
+ +
+ - - - - - - + + + + + + + + + +
+ + + -
[] -
- - -
-
-
- + - +