From 86e2425d525de96e2637a0764f869c92287cbbe3 Mon Sep 17 00:00:00 2001 From: znek Date: Tue, 5 Jul 2005 18:13:24 +0000 Subject: [PATCH] updated formatters to resemble OGo's style more closely, fixed bugs in displaying ranges in almost all views, properly style prioritized appointments, display private appointments according to Agenor's requirements git-svn-id: http://svn.opengroupware.org/SOGo/trunk@663 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/SoObjects/Appointments/ChangeLog | 5 + .../Appointments/SOGoAppointmentFolder.m | 2 +- SOGo/SoObjects/Appointments/Version | 2 +- SOGo/UI/Common/ChangeLog | 4 + SOGo/UI/Common/Version | 2 +- SOGo/UI/Common/calendar.css | 9 + SOGo/UI/SOGoUI/ChangeLog | 9 + SOGo/UI/SOGoUI/SOGoAptFormatter.h | 12 +- SOGo/UI/SOGoUI/SOGoAptFormatter.m | 220 ++++++++++++------ SOGo/UI/SOGoUI/Version | 2 +- SOGo/UI/Scheduler/ChangeLog | 26 +++ SOGo/UI/Scheduler/GNUmakefile | 1 + SOGo/UI/Scheduler/UIxCalDayChartview.m | 7 + SOGo/UI/Scheduler/UIxCalDayListview.m | 9 +- SOGo/UI/Scheduler/UIxCalDayOverview.m | 80 +++++++ SOGo/UI/Scheduler/UIxCalDayView.m | 92 +++++--- SOGo/UI/Scheduler/UIxCalInlineAptView.m | 23 +- SOGo/UI/Scheduler/UIxCalMonthOverview.m | 14 +- SOGo/UI/Scheduler/UIxCalView.m | 12 +- SOGo/UI/Scheduler/UIxCalWeekChartview.m | 26 ++- SOGo/UI/Scheduler/UIxCalWeekColumnsview.m | 7 + SOGo/UI/Scheduler/UIxCalWeekOverview.m | 7 + SOGo/UI/Scheduler/Version | 3 +- SOGo/UI/Scheduler/images/apt_icon_private.gif | Bin 0 -> 289 bytes SOGo/UI/Templates/ChangeLog | 11 + SOGo/UI/Templates/UIxAppointmentEditor.wox | 2 +- SOGo/UI/Templates/UIxCalDayChartview.wox | 1 + SOGo/UI/Templates/UIxCalDayListview.wox | 1 + SOGo/UI/Templates/UIxCalDayOverview.wox | 18 +- SOGo/UI/Templates/UIxCalInlineAptView.wox | 7 +- SOGo/UI/Templates/UIxCalMonthOverview.wox | 7 +- SOGo/UI/Templates/UIxCalWeekChartview.wox | 1 + SOGo/UI/Templates/UIxCalWeekColumnsview.wox | 2 + SOGo/UI/Templates/UIxCalWeekOverview.wox | 2 + 34 files changed, 472 insertions(+), 154 deletions(-) create mode 100644 SOGo/UI/Scheduler/images/apt_icon_private.gif diff --git a/SOGo/SoObjects/Appointments/ChangeLog b/SOGo/SoObjects/Appointments/ChangeLog index 59da00a7..4e8bb904 100644 --- a/SOGo/SoObjects/Appointments/ChangeLog +++ b/SOGo/SoObjects/Appointments/ChangeLog @@ -1,3 +1,8 @@ +2005-07-05 Marcus Mueller + + * SOGoAppointmentFolder.m: fetch new priority field in core infos + (v0.9.34) + 2005-07-04 Marcus Mueller * SOGoAppointmentFolder.m: fetch new priority field in overview infos diff --git a/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m b/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m index 8f63cef7..d0da865f 100644 --- a/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -413,7 +413,7 @@ static NSTimeZone *MET = nil; @"status", @"ispublic", @"isallday", @"isopaque", @"participants", @"partmails", - @"partstates", @"sequence", nil]; + @"partstates", @"sequence", @"priority", nil]; } return [self fetchFields:infos from:_startDate diff --git a/SOGo/SoObjects/Appointments/Version b/SOGo/SoObjects/Appointments/Version index c59b4fbb..9b34cb77 100644 --- a/SOGo/SoObjects/Appointments/Version +++ b/SOGo/SoObjects/Appointments/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=33 +SUBMINOR_VERSION:=34 # v0.9.32 requires libGDLContentStore v4.5.26 # v0.9.28 requires libNGiCal v4.5.47 diff --git a/SOGo/UI/Common/ChangeLog b/SOGo/UI/Common/ChangeLog index 2640b533..9d8455da 100644 --- a/SOGo/UI/Common/ChangeLog +++ b/SOGo/UI/Common/ChangeLog @@ -1,3 +1,7 @@ +2005-07-05 Marcus Mueller + + * calendar.css: added appointment priority styles (v0.9.37) + 2005-03-23 Marcus Mueller * renamed "default.strings" to "Localizable.strings" (v0.9.36) diff --git a/SOGo/UI/Common/Version b/SOGo/UI/Common/Version index 8f9b0cb1..b37763b2 100644 --- a/SOGo/UI/Common/Version +++ b/SOGo/UI/Common/Version @@ -1,5 +1,5 @@ # Version file -SUBMINOR_VERSION:=36 +SUBMINOR_VERSION:=37 # v0.9.28 requires NGExtensions v4.5.136 diff --git a/SOGo/UI/Common/calendar.css b/SOGo/UI/Common/calendar.css index 81ea3a6b..198eae4d 100644 --- a/SOGo/UI/Common/calendar.css +++ b/SOGo/UI/Common/calendar.css @@ -23,6 +23,15 @@ font-style: italic; } +.apt_prio0, .apt_prio5, .apt_prio6, .apt_prio7, .apt_prio8, .apt_prio9 { + font-weight: normal; +} + +.apt_prio1, .apt_prio2, .apt_prio3, .apt_prio4 { + font-weight: bold; +} + + .anais_me { color: #0000FF; } diff --git a/SOGo/UI/SOGoUI/ChangeLog b/SOGo/UI/SOGoUI/ChangeLog index e782f8c4..c2b37e12 100644 --- a/SOGo/UI/SOGoUI/ChangeLog +++ b/SOGo/UI/SOGoUI/ChangeLog @@ -1,3 +1,12 @@ +2005-07-05 Marcus Mueller + + * SOGoAptFormatter.[hm]: new API. -stringForObjectValue: is deprecated + now and should not be used anymore. Formatting needs a referenceDate + in order to properly display time ranges. Time ranges are currently + rendered in SOGoAptFormatter, but this should probably be delegated + to a natural language aware auxiliary (date-)formatter. Also, some + new formatting options have been introduced. (v0.9.24) + 2005-01-26 Marcus Mueller * SOGoDateFormatter.[hm]: new method -setFrenchDateFormat: to override diff --git a/SOGo/UI/SOGoUI/SOGoAptFormatter.h b/SOGo/UI/SOGoUI/SOGoAptFormatter.h index e4c0202a..c8106834 100644 --- a/SOGo/UI/SOGoUI/SOGoAptFormatter.h +++ b/SOGo/UI/SOGoUI/SOGoAptFormatter.h @@ -31,16 +31,19 @@ @interface SOGoAptFormatter : NSFormatter { NSTimeZone *tz; - SEL formatAction; - NSString *privateTitle; + SEL formatAction; + NSString *privateTitle; + BOOL omitsEndDate; } - (id)initWithDisplayTimeZone:(NSTimeZone *)_tz; - (void)setTooltip; +- (void)setSingleLineFullDetails; - (void)setFullDetails; - (void)setTitleOnly; - (void)setShortTitleOnly; +- (void)setOmitsEndDate; - (void)setPrivateTooltip; - (void)setPrivateDetails; @@ -49,7 +52,10 @@ - (void)setPrivateTitle:(NSString *)_privateTitle; - (NSString *)privateTitle; - + +- (NSString *)stringForObjectValue:(id)_obj + referenceDate:(NSCalendarDate *)_refDate; + @end #endif /* __SOGoAptFormatter_H_ */ diff --git a/SOGo/UI/SOGoUI/SOGoAptFormatter.m b/SOGo/UI/SOGoUI/SOGoAptFormatter.m index e468d783..750a0ee1 100644 --- a/SOGo/UI/SOGoUI/SOGoAptFormatter.m +++ b/SOGo/UI/SOGoUI/SOGoAptFormatter.m @@ -24,10 +24,22 @@ #include "common.h" @interface SOGoAptFormatter(PrivateAPI) -- (NSString *)titleForApt:(id)_apt; -- (NSString *)shortTitleForApt:(id)_apt; +- (NSString *)titleForApt:(id)_apt :(NSCalendarDate *)_refDate; +- (NSString *)shortTitleForApt:(id)_apt :(NSCalendarDate *)_refDate; - (NSTimeZone *)displayTZ; -- (void)appendTimeInfoFromApt:(id)_apt toBuffer:(NSMutableString *)_buf; + +- (void)appendTimeInfoForDate:(NSCalendarDate *)_date + usingReferenceDate:(NSCalendarDate *)_refDate + toBuffer:(NSMutableString *)_buf; + +- (void)appendTimeInfoFromApt:(id)_apt + usingReferenceDate:(NSCalendarDate *)_refDate + toBuffer:(NSMutableString *)_buf; +@end + +// TODO: Clean this up, put it into NGExtensions! +@interface NSCalendarDate (UIxCalMonthOverviewExtensions_UsedPrivates) +- (BOOL)isDateInSameMonth:(NSCalendarDate *)_other; @end @implementation SOGoAptFormatter @@ -49,35 +61,39 @@ /* accessors */ - (void)setTooltip { - self->formatAction = @selector(tooltipForApt:); + self->formatAction = @selector(tooltipForApt::); +} + +- (void)setSingleLineFullDetails { + self->formatAction = @selector(singleLineFullDetailsForApt::); } - (void)setFullDetails { - self->formatAction = @selector(fullDetailsForApt:); + self->formatAction = @selector(fullDetailsForApt::); } - (void)setPrivateTooltip { - self->formatAction = @selector(tooltipForPrivateApt:); + self->formatAction = @selector(tooltipForPrivateApt::); } - (void)setPrivateDetails { - self->formatAction = @selector(detailsForPrivateApt:); + self->formatAction = @selector(detailsForPrivateApt::); } - (void)setTitleOnly { - self->formatAction = @selector(titleForApt:); + self->formatAction = @selector(titleForApt::); } - (void)setShortTitleOnly { - self->formatAction = @selector(shortTitleForApt:); + self->formatAction = @selector(shortTitleForApt::); } - (void)setPrivateSuppressAll { - self->formatAction = @selector(suppressApt:); + self->formatAction = @selector(suppressApt::); } - (void)setPrivateTitleOnly { - self->formatAction = @selector(titleOnlyForPrivateApt:); + self->formatAction = @selector(titleOnlyForPrivateApt::); } - (void)setPrivateTitle:(NSString *)_privateTitle { @@ -87,8 +103,23 @@ return self->privateTitle; } +- (void)setOmitsEndDate { + self->omitsEndDate = YES; +} + - (NSString *)stringForObjectValue:(id)_obj { - return [self performSelector:self->formatAction withObject:_obj]; + [self warnWithFormat:@"%s called, please use " + @"stringForObjectValue:referenceDate: instead!", + __PRETTY_FUNCTION__]; + return [self stringForObjectValue:_obj referenceDate:nil]; +} + +- (NSString *)stringForObjectValue:(id)_obj + referenceDate:(NSCalendarDate *)_refDate +{ + return [self performSelector:self->formatAction + withObject:_obj + withObject:_refDate]; } /* Private */ @@ -97,71 +128,142 @@ return self->tz; } -- (void)appendTimeInfoFromApt:(id)_apt toBuffer:(NSMutableString *)_buf { - NSCalendarDate *startDate, *endDate; +- (void)appendTimeInfoForDate:(NSCalendarDate *)_date + usingReferenceDate:(NSCalendarDate *)_refDate + toBuffer:(NSMutableString *)_buf +{ + /* several cases: + * 12:00 + * 12:00 - 13:00 + * 12:00 (07-05) - 13:00 (07-07) + * 12:00 (12-30-2004) - 13:00 (01-01-2005) + */ + + [_buf appendFormat:@"%02i:%02i", + [_date hourOfDay], + [_date minuteOfHour]]; + if (_refDate && ![_date isDateOnSameDay:_refDate]) { + [_buf appendFormat:@" (%02i-%02i", + [_date monthOfYear], + [_date dayOfMonth]]; + if ([_date yearOfCommonEra] != [_refDate yearOfCommonEra]) + [_buf appendFormat:@"-%04i", [_date yearOfCommonEra]]; + [_buf appendString:@")"]; + } +} + +- (void)appendTimeInfoFromApt:(id)_apt + usingReferenceDate:(NSCalendarDate *)_refDate + toBuffer:(NSMutableString *)_buf +{ + NSCalendarDate *startDate, *endDate, *date; + NSTimeZone *dtz; BOOL spansRange; spansRange = NO; + dtz = [self displayTZ]; startDate = [_apt valueForKey:@"startDate"]; - [startDate setTimeZone:[self displayTZ]]; + [startDate setTimeZone:dtz]; endDate = [_apt valueForKey:@"endDate"]; if(endDate != nil) { - [endDate setTimeZone:[self displayTZ]]; + [endDate setTimeZone:dtz]; spansRange = ![endDate isEqualToDate:startDate]; } - [_buf appendFormat:@"%02i:%02i", - [startDate hourOfDay], - [startDate minuteOfHour]]; - if(spansRange) { - [_buf appendFormat:@", %02i:%02i", - [endDate hourOfDay], - [endDate minuteOfHour]]; + if (_refDate) + [_refDate setTimeZone:dtz]; + +#if 0 + if (!_refDate || [startDate isDateOnSameDay:_refDate]) + date = startDate; + else + date = [startDate hour:0 minute:0]; +#else + date = startDate; +#endif + + [self appendTimeInfoForDate:date + usingReferenceDate:_refDate + toBuffer:_buf]; + + if (spansRange && !self->omitsEndDate) { + [_buf appendString:@" - "]; +#if 0 + if (!_refDate || [endDate isDateOnSameDay:_refDate]) + date = endDate; + else + date = [endDate hour:23 minute:59]; +#else + date = endDate; +#endif + [self appendTimeInfoForDate:date + usingReferenceDate:_refDate + toBuffer:_buf]; } } -- (NSString *)titleForApt:(id)_apt { +- (NSString *)titleForApt:(id)_apt :(NSCalendarDate *)_refDate { return [_apt valueForKey:@"title"]; } -- (NSString *)shortTitleForApt:(id)_apt { +- (NSString *)shortTitleForApt:(id)_apt :(NSCalendarDate *)_refDate { NSString *title; - title = [self titleForApt:_apt]; + title = [self titleForApt:_apt :_refDate]; if ([title length] > 12) title = [[title substringToIndex:11] stringByAppendingString:@"..."]; return title; } -- (NSString *)fullDetailsForApt:(id)_apt { +- (NSString *)singleLineFullDetailsForApt:(id)_apt :(NSCalendarDate *)_refDate { NSMutableString *aptDescr; - NSString *s; + NSString *s; + + aptDescr = [NSMutableString stringWithCapacity:60]; + [self appendTimeInfoFromApt:_apt + usingReferenceDate:_refDate + toBuffer:aptDescr]; + if ((s = [_apt valueForKey:@"location"]) != nil) { + [aptDescr appendFormat:@"; (%@)", s]; + } + if ((s = [_apt valueForKey:@"title"]) != nil) + [aptDescr appendFormat:@"; %@", [self titleForApt:_apt :_refDate]]; + return aptDescr; +} + +- (NSString *)fullDetailsForApt:(id)_apt :(NSCalendarDate *)_refDate { + NSMutableString *aptDescr; + NSString *s; aptDescr = [NSMutableString stringWithCapacity:60]; - [self appendTimeInfoFromApt:_apt toBuffer:aptDescr]; + [self appendTimeInfoFromApt:_apt + usingReferenceDate:_refDate + toBuffer:aptDescr]; if ((s = [_apt valueForKey:@"location"]) != nil) { if([s length] > 12) s = [[s substringToIndex:11] stringByAppendingString:@"..."]; [aptDescr appendFormat:@" (%@)", s]; } if ((s = [_apt valueForKey:@"title"]) != nil) - [aptDescr appendFormat:@"
%@", [self shortTitleForApt:_apt]]; + [aptDescr appendFormat:@"
%@", [self shortTitleForApt:_apt :_refDate]]; return aptDescr; } -- (NSString *)detailsForPrivateApt:(id)_apt { +- (NSString *)detailsForPrivateApt:(id)_apt :(NSCalendarDate *)_refDate { NSMutableString *aptDescr; NSString *s; aptDescr = [NSMutableString stringWithCapacity:40]; - [self appendTimeInfoFromApt:_apt toBuffer:aptDescr]; + [self appendTimeInfoFromApt:_apt + usingReferenceDate:_refDate + toBuffer:aptDescr]; if ((s = [self privateTitle]) != nil) [aptDescr appendFormat:@"
%@", s]; return aptDescr; } -- (NSString *)titleOnlyForPrivateApt:(id)_apt { +- (NSString *)titleOnlyForPrivateApt:(id)_apt :(NSCalendarDate *)_refDate { NSString *s; s = [self privateTitle]; @@ -170,30 +272,14 @@ return s; } -- (NSString *)tooltipForApt:(id)_apt { - NSCalendarDate *startDate, *endDate; +- (NSString *)tooltipForApt:(id)_apt :(NSCalendarDate *)_refDate { NSMutableString *aptDescr; NSString *s; - BOOL spansRange; - - spansRange = NO; - startDate = [_apt valueForKey:@"startDate"]; - [startDate setTimeZone:[self displayTZ]]; - endDate = [_apt valueForKey:@"endDate"]; - if(endDate != nil) { - [endDate setTimeZone:[self displayTZ]]; - spansRange = ![endDate isEqualToDate:startDate]; - } + aptDescr = [NSMutableString stringWithCapacity:60]; - [aptDescr appendFormat:@"%02i:%02i", - [startDate hourOfDay], - [startDate minuteOfHour]]; - if (spansRange) { - [aptDescr appendFormat:@" - %02i:%02i", - [endDate hourOfDay], - [endDate minuteOfHour]]; - } - + [self appendTimeInfoFromApt:_apt + usingReferenceDate:_refDate + toBuffer:aptDescr]; if ((s = [_apt valueForKey:@"title"]) != nil) [aptDescr appendFormat:@"\n%@", s]; if ((s = [_apt valueForKey:@"location"]) != nil) @@ -202,37 +288,21 @@ return aptDescr; } -- (NSString *)tooltipForPrivateApt:(id)_apt { - NSCalendarDate *startDate, *endDate; +- (NSString *)tooltipForPrivateApt:(id)_apt :(NSCalendarDate *)_refDate { NSMutableString *aptDescr; NSString *s; - BOOL spansRange; - spansRange = NO; - startDate = [_apt valueForKey:@"startDate"]; - [startDate setTimeZone:[self displayTZ]]; - endDate = [_apt valueForKey:@"endDate"]; - if(endDate != nil) { - [endDate setTimeZone:[self displayTZ]]; - spansRange = ![endDate isEqualToDate:startDate]; - } aptDescr = [NSMutableString stringWithCapacity:25]; - [aptDescr appendFormat:@"%02i:%02i", - [startDate hourOfDay], - [startDate minuteOfHour]]; - if (spansRange) { - [aptDescr appendFormat:@" - %02i:%02i", - [endDate hourOfDay], - [endDate minuteOfHour]]; - } - + [self appendTimeInfoFromApt:_apt + usingReferenceDate:_refDate + toBuffer:aptDescr]; if ((s = [self privateTitle]) != nil) [aptDescr appendFormat:@"\n%@", s]; return aptDescr; } -- (NSString *)suppressApt:(id)_apt { +- (NSString *)suppressApt:(id)_apt :(NSCalendarDate *)_refDate { return @""; } diff --git a/SOGo/UI/SOGoUI/Version b/SOGo/UI/SOGoUI/Version index ebab15ba..78651189 100644 --- a/SOGo/UI/SOGoUI/Version +++ b/SOGo/UI/SOGoUI/Version @@ -1,5 +1,5 @@ # $Id$ -SUBMINOR_VERSION:=23 +SUBMINOR_VERSION:=24 # v0.9.18 requires NGExtensions v4.5.136 diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index 2284a2ce..a67b00ac 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,3 +1,29 @@ +2005-07-05 Marcus Mueller + + * v0.9.123 + + * UIxCalWeekOverview.m, UIxCalWeekColumnsview.m, + UIxCalDayChartview.m, UIxCalDayListview.m, + UIxCalMonthOverview.m, UIxCalDayOverview.m: properly adjust formatter + + * UIxCalDayOverview.m: fixed bugs in -aptsForCurrentDate and properly + override -allDayApts to also display appointments spanning ranges + + * UIxCalWeekChartview.m: fixed bugs in -isRowActive logic + + * UIxCalDayView.m: fixed bugs in filtering and range logic + + * UIxCalView.m: added a deprecation warning, some code cleanup + + * UIxCalInlineAptView.m: added new 'referenceDate' binding which will + be used with the revised appointment formatter to properly display + time ranges. Also adds 'priority' style information when this can + be found in the appointment. + + * GNUmakefile: added new image resource + + * images/apt_icon_private.gif: new resource for private appointments + 2005-03-23 Marcus Mueller * renamed "default.strings" to "Localizable.strings" (v0.9.122) diff --git a/SOGo/UI/Scheduler/GNUmakefile b/SOGo/UI/Scheduler/GNUmakefile index ff7b0494..e3f14068 100644 --- a/SOGo/UI/Scheduler/GNUmakefile +++ b/SOGo/UI/Scheduler/GNUmakefile @@ -105,6 +105,7 @@ SchedulerUI_RESOURCE_FILES += \ images/last.gif \ images/green_corner.gif \ images/invisible_space_2.gif \ + images/apt_icon_private.gif \ SchedulerUI_LOCALIZED_RESOURCE_FILES += \ Localizable.strings \ diff --git a/SOGo/UI/Scheduler/UIxCalDayChartview.m b/SOGo/UI/Scheduler/UIxCalDayChartview.m index a6e8d61f..feffaf07 100644 --- a/SOGo/UI/Scheduler/UIxCalDayChartview.m +++ b/SOGo/UI/Scheduler/UIxCalDayChartview.m @@ -31,9 +31,16 @@ @end #include "common.h" +#include @implementation UIxCalDayChartview +- (void)configureFormatters { + [super configureFormatters]; + + [self->aptFormatter setShortTitleOnly]; +} + - (NSArray *)columns { static NSArray *columns = nil; if(columns == nil) { diff --git a/SOGo/UI/Scheduler/UIxCalDayListview.m b/SOGo/UI/Scheduler/UIxCalDayListview.m index 437154c8..d0abf930 100644 --- a/SOGo/UI/Scheduler/UIxCalDayListview.m +++ b/SOGo/UI/Scheduler/UIxCalDayListview.m @@ -38,17 +38,24 @@ @end #include "common.h" +#include #include #include @implementation UIxCalDayListview - (void)dealloc { - [self->uids release]; + [self->uids release]; [self->currentUid release]; [super dealloc]; } +- (void)configureFormatters { + [super configureFormatters]; + + [self->aptFormatter setShortTitleOnly]; +} + /* accessors */ - (NSArray *)uids { diff --git a/SOGo/UI/Scheduler/UIxCalDayOverview.m b/SOGo/UI/Scheduler/UIxCalDayOverview.m index 3539b708..d1ea47ba 100644 --- a/SOGo/UI/Scheduler/UIxCalDayOverview.m +++ b/SOGo/UI/Scheduler/UIxCalDayOverview.m @@ -23,6 +23,7 @@ #include "UIxCalDayOverview.h" #include "common.h" +#include @implementation UIxCalDayOverview @@ -43,4 +44,83 @@ return count == 0 ? 1 : count; } +/* overriding */ + +- (void)configureFormatters { + [super configureFormatters]; + + [self->aptFormatter setSingleLineFullDetails]; + [self->aptTooltipFormatter setTooltip]; +} + +- (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; + + apt = [apts objectAtIndex:i]; + aptStartDate = [apt valueForKey:@"startDate"]; + if([aptStartDate isGreaterThanOrEqualTo:start] && + [aptStartDate isLessThan:end]) + { + [filtered addObject:apt]; + } + } + + return [filtered autorelease]; +} + +- (NSArray *)allDayApts { + NSCalendarDate *start; + NSArray *apts; + NSMutableArray *filtered; + unsigned i, count; + + if (self->allDayApts) + return self->allDayApts; + + start = [self startDate]; + apts = [self appointments]; + filtered = [[NSMutableArray alloc] initWithCapacity:1]; + count = [apts count]; + for (i = 0; i < count; i++) { + id apt; + NSNumber *bv; + + apt = [apts objectAtIndex:i]; + bv = [apt valueForKey:@"isallday"]; + if ([bv boolValue]) { + [filtered addObject:apt]; + } + else { + NSCalendarDate *aptStartDate; + + aptStartDate = [apt valueForKey:@"startDate"]; + if([aptStartDate isLessThan:start]) { + [filtered addObject:apt]; + } + } + } + + ASSIGN(self->allDayApts, filtered); + [filtered release]; + return self->allDayApts; +} + @end diff --git a/SOGo/UI/Scheduler/UIxCalDayView.m b/SOGo/UI/Scheduler/UIxCalDayView.m index b00caf8a..8ad071d5 100644 --- a/SOGo/UI/Scheduler/UIxCalDayView.m +++ b/SOGo/UI/Scheduler/UIxCalDayView.m @@ -71,20 +71,22 @@ or after are also fine */ NSCalendarDate *min, *max; - NSArray *aptDateRanges; + NSArray *aptDateRanges; min = [[self startDate] hour:[self dayStartHour] minute:0]; - max = [[self startDate] hour:[self dayEndHour] minute:0]; + max = [[self startDate] hour:[self dayEndHour] minute:0]; aptDateRanges = [[self appointments] valueForKey:@"startDate"]; if([aptDateRanges count] != 0) { NSCalendarDate *d; aptDateRanges = [aptDateRanges sortedArrayUsingSelector:@selector(compareAscending:)]; - d = [aptDateRanges objectAtIndex:0]; - min = (NSCalendarDate *)[d earlierDate:min]; - d = [aptDateRanges objectAtIndex:[aptDateRanges count] - 1]; - max = (NSCalendarDate *)[d laterDate:max]; + d = [aptDateRanges objectAtIndex:0]; + if ([d isDateOnSameDay:min]) + min = (NSCalendarDate *)[d earlierDate:min]; + d = [aptDateRanges objectAtIndex:[aptDateRanges count] - 1]; + if ([d isDateOnSameDay:max]) + max = (NSCalendarDate *)[d laterDate:max]; } return [self _getDatesFrom:min to:max]; @@ -92,11 +94,11 @@ - (NSArray *)_getDatesFrom:(NSCalendarDate *)_from to:(NSCalendarDate *)_to { NSMutableArray *dates; - unsigned i, count, offset; + unsigned i, count, offset; offset = [_from hourOfDay]; - count = ([_to hourOfDay] + 1) - offset; - dates = [[NSMutableArray alloc] initWithCapacity:count]; + count = ([_to hourOfDay] + 1) - offset; + dates = [[NSMutableArray alloc] initWithCapacity:count]; for(i = 0; i < count; i++) { NSCalendarDate *date; @@ -157,46 +159,60 @@ } - (NSArray *)aptsForCurrentDate { - NSArray *apts; - NSMutableArray *filtered; - unsigned i, count; - NSCalendarDate *start, *end; - - start = self->currentDate; - end = [start dateByAddingYears:0 + 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; - 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]; + /* 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]; + } + else { + /* multiple day range? */ + NSCalendarDate *aptEndDate; + + if ((aptEndDate = [apt valueForKey:@"endDate"])) { + if ([aptEndDate isLessThanOrEqualTo:end] || + ([aptStartDate isLessThan:start] && + [aptEndDate isGreaterThan:end])) + { + [filtered addObject:apt]; } + } } - - return [filtered autorelease]; + } + + return [filtered autorelease]; } - (BOOL)hasAptsForCurrentDate { - return [[self aptsForCurrentDate] count] != 0; + return [[self aptsForCurrentDate] count] != 0; } @end diff --git a/SOGo/UI/Scheduler/UIxCalInlineAptView.m b/SOGo/UI/Scheduler/UIxCalInlineAptView.m index 555254f9..5198e3da 100644 --- a/SOGo/UI/Scheduler/UIxCalInlineAptView.m +++ b/SOGo/UI/Scheduler/UIxCalInlineAptView.m @@ -30,12 +30,14 @@ id url; id style; id queryDictionary; + id referenceDate; BOOL canAccess; } @end #include "common.h" +#include @implementation UIxCalInlineAptView @@ -46,6 +48,7 @@ [self->url release]; [self->style release]; [self->queryDictionary release]; + [self->referenceDate release]; [super dealloc]; } @@ -81,6 +84,11 @@ ASSIGN(self->style, _style); } - (id)style { + NSNumber *prio; + + if ((prio = [self->appointment valueForKey:@"priority"])) { + return [NSString stringWithFormat:@"%@ apt_prio%@", self->style, prio]; + } return self->style; } @@ -91,6 +99,13 @@ return self->queryDictionary; } +- (void)setReferenceDate:(id)_referenceDate { + ASSIGN(self->referenceDate, _referenceDate); +} +- (id)referenceDate { + return self->referenceDate; +} + - (void)setCanAccess:(BOOL)_canAccess { self->canAccess = _canAccess; } @@ -100,8 +115,14 @@ /* helpers */ +- (NSString *)title { + return [self->formatter stringForObjectValue:self->appointment + referenceDate:[self referenceDate]]; +} + - (NSString *)tooltip { - return [self->tooltipFormatter stringForObjectValue:self->appointment]; + return [self->tooltipFormatter stringForObjectValue:self->appointment + referenceDate:[self referenceDate]]; } @end diff --git a/SOGo/UI/Scheduler/UIxCalMonthOverview.m b/SOGo/UI/Scheduler/UIxCalMonthOverview.m index 5d343807..7aca5917 100644 --- a/SOGo/UI/Scheduler/UIxCalMonthOverview.m +++ b/SOGo/UI/Scheduler/UIxCalMonthOverview.m @@ -1,14 +1,20 @@ // $Id$ #include "UIxCalMonthOverview.h" -#include +#include "common.h" +#include @implementation UIxCalMonthOverview - - (void)dealloc { - [self->currentWeekStart release]; - [super dealloc]; + [self->currentWeekStart release]; + [super dealloc]; +} + +- (void)configureFormatters { + [super configureFormatters]; + + [self->aptFormatter setShortTitleOnly]; } - (void)setDayIndex:(int)_idx { diff --git a/SOGo/UI/Scheduler/UIxCalView.m b/SOGo/UI/Scheduler/UIxCalView.m index ebf63146..d2095c88 100644 --- a/SOGo/UI/Scheduler/UIxCalView.m +++ b/SOGo/UI/Scheduler/UIxCalView.m @@ -26,7 +26,7 @@ static BOOL shouldDisplayWeekend = NO; self = [super init]; if(self) { NSTimeZone *tz; - + tz = [self viewTimeZone]; self->aptFormatter = [[SOGoAptFormatter alloc] initWithDisplayTimeZone:tz]; @@ -156,7 +156,9 @@ static BOOL shouldDisplayWeekend = NO; } - (NSString *)tooltipForApt { - return [[self aptTooltipFormatter] stringForObjectValue:self->appointment]; + [self warnWithFormat:@"%s IS DEPRECATED!", __PRETTY_FUNCTION__]; + return [[self aptTooltipFormatter] stringForObjectValue:self->appointment + referenceDate:[self currentDay]]; } - (NSString *)aptStyle { @@ -201,7 +203,7 @@ static BOOL shouldDisplayWeekend = NO; - (NSArray *)allDayApts { NSArray *apts; NSMutableArray *filtered; - unsigned i, count; + unsigned i, count; if (self->allDayApts) return self->allDayApts; @@ -210,11 +212,11 @@ static BOOL shouldDisplayWeekend = NO; count = [apts count]; filtered = [[NSMutableArray alloc] initWithCapacity:3]; for (i = 0; i < count; i++) { - id apt; + id apt; NSNumber *bv; apt = [apts objectAtIndex:i]; - bv = [apt valueForKey:@"isallday"]; + bv = [apt valueForKey:@"isallday"]; if ([bv boolValue]) [filtered addObject:apt]; } diff --git a/SOGo/UI/Scheduler/UIxCalWeekChartview.m b/SOGo/UI/Scheduler/UIxCalWeekChartview.m index da79ddbe..3d9e3253 100644 --- a/SOGo/UI/Scheduler/UIxCalWeekChartview.m +++ b/SOGo/UI/Scheduler/UIxCalWeekChartview.m @@ -94,16 +94,26 @@ /* row is active, if apt intersects hour range */ - (BOOL)isRowActive { - NSCalendarDate *aptStart, *aptEnd; - int aptStartHour, aptEndHour; - - aptStart = [self->appointment valueForKey:@"startDate"]; - aptEnd = [self->appointment valueForKey:@"endDate"]; + NSCalendarDate *aptStart, *aptEnd, *date; + int aptStartHour, aptEndHour; + BOOL isStartOnSameDay, isEndOnSameDay; + + aptStart = [self->appointment valueForKey:@"startDate"]; + aptEnd = [self->appointment valueForKey:@"endDate"]; + date = [self currentDay]; + isStartOnSameDay = [aptStart isDateOnSameDay:date]; + isEndOnSameDay = [aptEnd isDateOnSameDay:date]; + + if (!isStartOnSameDay && !isEndOnSameDay) + return YES; aptStartHour = [aptStart hourOfDay]; aptEndHour = [aptEnd hourOfDay]; - - return (([self hour] >= aptStartHour) && - ([self hour] <= aptEndHour)); + if (isStartOnSameDay && isEndOnSameDay) + return (([self hour] >= aptStartHour) && + ([self hour] <= aptEndHour)); + if (!isStartOnSameDay) + return [self hour] <= aptEndHour; + return [self hour] >= aptStartHour; } /* item is active, if apt's dateRange intersects the range diff --git a/SOGo/UI/Scheduler/UIxCalWeekColumnsview.m b/SOGo/UI/Scheduler/UIxCalWeekColumnsview.m index 7b381c9e..b279783b 100644 --- a/SOGo/UI/Scheduler/UIxCalWeekColumnsview.m +++ b/SOGo/UI/Scheduler/UIxCalWeekColumnsview.m @@ -31,9 +31,16 @@ @end #include "common.h" +#include @implementation UIxCalWeekColumnsview +- (void)configureFormatters { + [super configureFormatters]; + + [self->aptFormatter setOmitsEndDate]; +} + - (void)setDayIndex:(char)_idx { NSCalendarDate *d; diff --git a/SOGo/UI/Scheduler/UIxCalWeekOverview.m b/SOGo/UI/Scheduler/UIxCalWeekOverview.m index edaeb9e2..d8f16795 100644 --- a/SOGo/UI/Scheduler/UIxCalWeekOverview.m +++ b/SOGo/UI/Scheduler/UIxCalWeekOverview.m @@ -22,9 +22,16 @@ #include "UIxCalWeekOverview.h" #include "common.h" +#include @implementation UIxCalWeekOverview +- (void)configureFormatters { + [super configureFormatters]; + + [self->aptFormatter setOmitsEndDate]; +} + - (void)setDayIndex:(char)_idx { NSCalendarDate *d; diff --git a/SOGo/UI/Scheduler/Version b/SOGo/UI/Scheduler/Version index a7539b3f..82292a3e 100644 --- a/SOGo/UI/Scheduler/Version +++ b/SOGo/UI/Scheduler/Version @@ -1,7 +1,8 @@ # Version file -SUBMINOR_VERSION:=122 +SUBMINOR_VERSION:=123 +# v0.9.123 requires SOGoUI v0.9.24 # v0.9.115 requires NGiCal v4.5.44 # v0.9.113 requires libSOGo v0.9.30 # v0.9.112 requires SOGoLogic v0.9.12 diff --git a/SOGo/UI/Scheduler/images/apt_icon_private.gif b/SOGo/UI/Scheduler/images/apt_icon_private.gif new file mode 100644 index 0000000000000000000000000000000000000000..614079d2b37a1f40396d9de963e8ff8e37c16046 GIT binary patch literal 289 zcmZ?wbhEHb6ky?9@zQXWr6FQ@{0wFc4Cx#UD`QknOp2Lq z&$+-?tX`4v_NKb4tLwHE8n24sTpGmi{P={uHO7w)OkkiMQ2fcl$iSe^paU`zi*0sxWUvMRO~^+4 literal 0 HcmV?d00001 diff --git a/SOGo/UI/Templates/ChangeLog b/SOGo/UI/Templates/ChangeLog index 6cf78bb5..2f109869 100644 --- a/SOGo/UI/Templates/ChangeLog +++ b/SOGo/UI/Templates/ChangeLog @@ -1,3 +1,14 @@ +2005-07-05 Marcus Mueller + + * UIxCalDayOverview.wox, UIxCalInlineAptView.wox, + UIxCalWeekOverview.wox, UIxCalWeekColumnsview.wox, + UIxCalDayChartview.wox, UIxCalDayListview.wox, + UIxCalWeekChartview.wox, UIxCalMonthOverview.wox: added referenceDate + bindings for all UIxAptInlineViews + + * UIxAppointmentEditor.wox: added redirect in case user who is not + allowed to edit view tries to do so + 2005-07-04 Marcus Mueller * UIxCalDayOverview.wox, UIxCalWeekOverview.wox, diff --git a/SOGo/UI/Templates/UIxAppointmentEditor.wox b/SOGo/UI/Templates/UIxAppointmentEditor.wox index 12e7b7d4..3736a60b 100644 --- a/SOGo/UI/Templates/UIxAppointmentEditor.wox +++ b/SOGo/UI/Templates/UIxAppointmentEditor.wox @@ -335,6 +335,6 @@ - Forbidden + Forbidden ... diff --git a/SOGo/UI/Templates/UIxCalDayChartview.wox b/SOGo/UI/Templates/UIxCalDayChartview.wox index 20b869af..31bfc904 100644 --- a/SOGo/UI/Templates/UIxCalDayChartview.wox +++ b/SOGo/UI/Templates/UIxCalDayChartview.wox @@ -217,6 +217,7 @@ url="appointmentViewURL" style="aptStyle" queryDictionary="currentDayQueryParameters" + referenceDate="currentDate" canAccess="canAccessApt" /> diff --git a/SOGo/UI/Templates/UIxCalDayListview.wox b/SOGo/UI/Templates/UIxCalDayListview.wox index 078ede35..a96f4158 100644 --- a/SOGo/UI/Templates/UIxCalDayListview.wox +++ b/SOGo/UI/Templates/UIxCalDayListview.wox @@ -175,6 +175,7 @@ url="appointmentViewURL" style="aptStyle" queryDictionary="currentDayQueryParameters" + referenceDate="currentDate" canAccess="canAccessApt" /> diff --git a/SOGo/UI/Templates/UIxCalDayOverview.wox b/SOGo/UI/Templates/UIxCalDayOverview.wox index e5f76e04..d7dbcc4f 100644 --- a/SOGo/UI/Templates/UIxCalDayOverview.wox +++ b/SOGo/UI/Templates/UIxCalDayOverview.wox @@ -164,13 +164,16 @@ - +
@@ -200,6 +203,7 @@ url="appointmentViewURL" style="aptStyle" queryDictionary="currentDayQueryParameters" + referenceDate="currentDate" canAccess="canAccessApt" />
diff --git a/SOGo/UI/Templates/UIxCalInlineAptView.wox b/SOGo/UI/Templates/UIxCalInlineAptView.wox index 0e058bb5..501a36eb 100644 --- a/SOGo/UI/Templates/UIxCalInlineAptView.wox +++ b/SOGo/UI/Templates/UIxCalInlineAptView.wox @@ -9,15 +9,14 @@ - + diff --git a/SOGo/UI/Templates/UIxCalMonthOverview.wox b/SOGo/UI/Templates/UIxCalMonthOverview.wox index fffafb37..29e60365 100644 --- a/SOGo/UI/Templates/UIxCalMonthOverview.wox +++ b/SOGo/UI/Templates/UIxCalMonthOverview.wox @@ -119,6 +119,7 @@ tooltipFormatter="aptTooltipFormatter" url="appointmentViewURL" style="aptStyle" + referenceDate="currentDay" canAccess="canAccessApt" />
@@ -144,12 +145,13 @@ var:queryDictionary="currentDayQueryParameters" > -
+
diff --git a/SOGo/UI/Templates/UIxCalWeekChartview.wox b/SOGo/UI/Templates/UIxCalWeekChartview.wox index 69ffb7d0..4b52132c 100644 --- a/SOGo/UI/Templates/UIxCalWeekChartview.wox +++ b/SOGo/UI/Templates/UIxCalWeekChartview.wox @@ -200,6 +200,7 @@ url="appointmentViewURL" style="aptStyle" queryDictionary="currentDayQueryParameters" + referenceDate="currentDay" canAccess="canAccessApt" /> diff --git a/SOGo/UI/Templates/UIxCalWeekColumnsview.wox b/SOGo/UI/Templates/UIxCalWeekColumnsview.wox index 56e5b3df..38665dfb 100644 --- a/SOGo/UI/Templates/UIxCalWeekColumnsview.wox +++ b/SOGo/UI/Templates/UIxCalWeekColumnsview.wox @@ -219,6 +219,7 @@ url="appointmentViewURL" style="aptStyle" queryDictionary="currentDayQueryParameters" + referenceDate="currentDay" canAccess="canAccessApt" />
@@ -233,6 +234,7 @@ url="appointmentViewURL" style="aptStyle" queryDictionary="currentDayQueryParameters" + referenceDate="currentDay" canAccess="canAccessApt" />
diff --git a/SOGo/UI/Templates/UIxCalWeekOverview.wox b/SOGo/UI/Templates/UIxCalWeekOverview.wox index 74d235ab..581d2e11 100644 --- a/SOGo/UI/Templates/UIxCalWeekOverview.wox +++ b/SOGo/UI/Templates/UIxCalWeekOverview.wox @@ -158,6 +158,7 @@ tooltipFormatter="aptTooltipFormatter" url="appointmentViewURL" style="aptStyle" + referenceDate="currentDay" queryDictionary="currentDayQueryParameters" canAccess="canAccessApt" /> @@ -172,6 +173,7 @@ tooltipFormatter="aptTooltipFormatter" url="appointmentViewURL" style="aptStyle" + referenceDate="currentDay" canAccess="canAccessApt" />
-- 2.39.5