From 56ccb283b1a6d8b8a4e3e96d7ddcdbf405b6a442 Mon Sep 17 00:00:00 2001 From: znek Date: Fri, 8 Jul 2005 15:48:48 +0000 Subject: [PATCH] added 'show/hide rejected appointments' functionality git-svn-id: http://svn.opengroupware.org/SOGo/trunk@707 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/SoObjects/Appointments/ChangeLog | 5 + .../Appointments/SOGoAppointmentFolder.m | 4 +- SOGo/SoObjects/Appointments/Version | 2 +- SOGo/UI/Scheduler/ChangeLog | 16 ++++ .../English.lproj/Localizable.strings | 3 +- SOGo/UI/Scheduler/UIxCalView.h | 3 +- SOGo/UI/Scheduler/UIxCalView.m | 94 ++++++++++++++++++- SOGo/UI/Scheduler/UIxCalWeekListview.m | 5 +- SOGo/UI/Scheduler/Version | 2 +- SOGo/UI/Templates/ChangeLog | 8 ++ SOGo/UI/Templates/UIxCalDayChartview.wox | 7 ++ SOGo/UI/Templates/UIxCalDayListview.wox | 7 ++ SOGo/UI/Templates/UIxCalDayOverview.wox | 7 ++ SOGo/UI/Templates/UIxCalMonthOverview.wox | 7 ++ SOGo/UI/Templates/UIxCalWeekChartview.wox | 7 ++ SOGo/UI/Templates/UIxCalWeekColumnsview.wox | 8 +- SOGo/UI/Templates/UIxCalWeekListview.wox | 8 +- SOGo/UI/Templates/UIxCalWeekOverview.wox | 8 +- SOGo/UI/Templates/UIxPageFrame.wox | 10 ++ 19 files changed, 197 insertions(+), 14 deletions(-) diff --git a/SOGo/SoObjects/Appointments/ChangeLog b/SOGo/SoObjects/Appointments/ChangeLog index 81ccb122..9efea09c 100644 --- a/SOGo/SoObjects/Appointments/ChangeLog +++ b/SOGo/SoObjects/Appointments/ChangeLog @@ -1,3 +1,8 @@ +2005-07-08 Marcus Mueller + + * SOGoAppointmentFolder.m: added 'partmails' and 'partstates' to + infos returned by -fetchOverviewInfosFrom:to: (v0.9.36) + 2005-07-06 Marcus Mueller * v0.9.35 diff --git a/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m b/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m index ebd25966..e85d762a 100644 --- a/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -396,7 +396,9 @@ static NSTimeZone *MET = nil; infos = [[NSArray alloc] initWithObjects: @"title", @"location", @"orgmail", @"status", @"ispublic", - @"isallday", @"priority", nil]; + @"isallday", @"priority", + @"partmails", @"partstates", + nil]; } return [self fetchFields:infos from:_startDate diff --git a/SOGo/SoObjects/Appointments/Version b/SOGo/SoObjects/Appointments/Version index ffe201b8..b1ee3cc9 100644 --- a/SOGo/SoObjects/Appointments/Version +++ b/SOGo/SoObjects/Appointments/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=35 +SUBMINOR_VERSION:=36 # v0.9.32 requires libGDLContentStore v4.5.26 # v0.9.28 requires libNGiCal v4.5.47 diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index 7b80d28c..71a3dc46 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,5 +1,21 @@ 2005-07-08 Marcus Mueller + * v0.9.127 + + * UIxCalView.[hm]: added -shouldDisplayRejectedAppointments API. Added + toggling of hide/show rejected appointments via form values. Added + new -filterAppointments: method to support filtering of appointments + (currently used for rejected appointments). Fixed -fetchCoreInfos + to use proper accessor method. Fixed aptFlags logic to allow access + to appointments that don't belong to user but which user is invited + to. Cleaned up +initialize a bit. + + * UIxCalWeekListview.m: added comment and slightly changed + -fetchCoreInfos to do the proper thing + + * English.lproj/Localizable.strings: added labels 'show_rejected_apts' + and 'hide_rejected_apts' + * v0.9.126 * UIxComponent+Agenor.[hm]: new method -isAccessRestricted, uses the diff --git a/SOGo/UI/Scheduler/English.lproj/Localizable.strings b/SOGo/UI/Scheduler/English.lproj/Localizable.strings index 88e4cebc..8e481dc8 100644 --- a/SOGo/UI/Scheduler/English.lproj/Localizable.strings +++ b/SOGo/UI/Scheduler/English.lproj/Localizable.strings @@ -84,7 +84,8 @@ "proposal" = "proposal"; "Save" = "Save"; "Cancel" = "Cancel"; - +"show_rejected_apts" = "Show rejected appointments"; +"hide_rejected_apts" = "Hide rejected appointments"; /* Schedule */ diff --git a/SOGo/UI/Scheduler/UIxCalView.h b/SOGo/UI/Scheduler/UIxCalView.h index 74b0c6bc..cb3486e1 100644 --- a/SOGo/UI/Scheduler/UIxCalView.h +++ b/SOGo/UI/Scheduler/UIxCalView.h @@ -73,7 +73,8 @@ - (unsigned)dayStartHour; - (unsigned)dayEndHour; - (BOOL)shouldDisplayWeekend; - +- (BOOL)shouldDisplayRejectedAppointments; + - (NSCalendarDate *)referenceDateForFormatter; - (NSCalendarDate *)thisMonth; diff --git a/SOGo/UI/Scheduler/UIxCalView.m b/SOGo/UI/Scheduler/UIxCalView.m index d2095c88..98875146 100644 --- a/SOGo/UI/Scheduler/UIxCalView.m +++ b/SOGo/UI/Scheduler/UIxCalView.m @@ -7,6 +7,7 @@ #include #include #include +#include #include "UIxComponent+Agenor.h" @interface UIxCalView (PrivateAPI) @@ -18,8 +19,13 @@ static BOOL shouldDisplayWeekend = NO; + (void)initialize { - NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; - shouldDisplayWeekend = [ud boolForKey:@"SOGoShouldDisplayWeekend"]; + static BOOL didInit = NO; + NSUserDefaults *ud; + + if (didInit) return; + + ud = [NSUserDefaults standardUserDefaults]; + shouldDisplayWeekend = [ud boolForKey:@"SOGoShouldDisplayWeekend"]; } - (id)init { @@ -67,9 +73,55 @@ static BOOL shouldDisplayWeekend = NO; [self->privateAptTooltipFormatter setPrivateTitle:title]; } +- (NSArray *)filterAppointments:(NSArray *)_apts { + NSMutableArray *filtered; + unsigned i, count; + NSString *email; + + count = [_apts count]; + if (!count) return _apts; + if ([self shouldDisplayRejectedAppointments]) return _apts; + + filtered = [[[NSMutableArray alloc] initWithCapacity:count] autorelease]; + email = [self emailForUser]; + + for (i = 0; i < count; i++) { + NSDictionary *info; + NSArray *partmails; + unsigned p, pCount; + BOOL shouldAdd; + + shouldAdd = NO; + info = [_apts objectAtIndex:i]; + partmails = [[info objectForKey:@"partmails"] + componentsSeparatedByString:@"\n"]; + pCount = [partmails count]; + for (p = 0; p < pCount; p++) { + NSString *pEmail; + + pEmail = [partmails objectAtIndex:p]; + if ([pEmail isEqualToString:email]) { + NSArray *partstates; + NSString *state; + + partstates = [[info objectForKey:@"partstates"] + componentsSeparatedByString:@"\n"]; + state = [partstates objectAtIndex:p]; + if ([state intValue] != iCalPersonPartStatDeclined) + shouldAdd = YES; + break; + } + } + if (shouldAdd) + [filtered addObject:info]; + } + return filtered; +} + /* accessors */ - (void)setAppointments:(NSArray *)_apts { + _apts = [self filterAppointments:_apts]; ASSIGN(self->appointments, _apts); } - (NSArray *)appointments { @@ -91,8 +143,15 @@ static BOOL shouldDisplayWeekend = NO; self->aptFlags.canAccessApt = YES; } else { - self->aptFlags.isMyApt = NO; - self->aptFlags.canAccessApt = [[_apt valueForKey:@"ispublic"] boolValue]; + NSString *partmails; + + self->aptFlags.isMyApt = NO; + + partmails = [_apt valueForKey:@"partmails"]; + if ([partmails rangeOfString:myEmail].length) + self->aptFlags.canAccessApt = YES; + else + self->aptFlags.canAccessApt = [[_apt valueForKey:@"ispublic"] boolValue]; } } - (id)appointment { @@ -313,11 +372,36 @@ static BOOL shouldDisplayWeekend = NO; folder = [self clientObject]; sd = [self startDate]; ed = [self endDate]; - self->appointments = [[folder fetchOverviewInfosFrom:sd to:ed] retain]; + [self setAppointments:[folder fetchOverviewInfosFrom:sd to:ed]]; } return self->appointments; } +/* query parameters */ + +- (BOOL)shouldDisplayRejectedAppointments { + NSString *bv; + + bv = [[[self context] request] formValueForKey:@"dr"]; + if (!bv) return NO; + return [bv boolValue]; +} + +- (NSDictionary *)toggleShowRejectedAptsQueryParameters { + NSMutableDictionary *qp; + BOOL shouldDisplay; + + shouldDisplay = ![self shouldDisplayRejectedAppointments]; + qp = [[[self queryParameters] mutableCopy] autorelease]; + [qp setObject:shouldDisplay ? @"1" : @"0" forKey:@"dr"]; + return qp; +} + +- (NSString *)toggleShowRejectedAptsLabel { + if (![self shouldDisplayRejectedAppointments]) + return @"show_rejected_apts"; + return @"hide_rejected_apts"; +} /* date selection & conversion */ diff --git a/SOGo/UI/Scheduler/UIxCalWeekListview.m b/SOGo/UI/Scheduler/UIxCalWeekListview.m index fcf4d689..e5931b8d 100644 --- a/SOGo/UI/Scheduler/UIxCalWeekListview.m +++ b/SOGo/UI/Scheduler/UIxCalWeekListview.m @@ -49,6 +49,9 @@ /* fetching */ +/* NOTE: this fetches coreInfos instead of overviewInfos + * as is done in the superclass! + */ - (NSArray *)fetchCoreInfos { if (!self->appointments) { id folder; @@ -57,7 +60,7 @@ folder = [self clientObject]; sd = [self startDate]; ed = [self endDate]; - self->appointments = [[folder fetchCoreInfosFrom:sd to:ed] retain]; + [self setAppointments:[folder fetchCoreInfosFrom:sd to:ed]]; } return self->appointments; } diff --git a/SOGo/UI/Scheduler/Version b/SOGo/UI/Scheduler/Version index 05f29d4d..762af823 100644 --- a/SOGo/UI/Scheduler/Version +++ b/SOGo/UI/Scheduler/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=126 +SUBMINOR_VERSION:=127 # v0.9.123 requires Appointments v0.9.35 # v0.9.123 requires SOGoUI v0.9.24 diff --git a/SOGo/UI/Templates/ChangeLog b/SOGo/UI/Templates/ChangeLog index 7e7065b0..6c75b528 100644 --- a/SOGo/UI/Templates/ChangeLog +++ b/SOGo/UI/Templates/ChangeLog @@ -1,5 +1,13 @@ 2005-07-08 Marcus Mueller + * UIxCalDayOverview.wox, UIxCalWeekOverview.wox, + UIxCalWeekColumnsview.wox, UIxCalDayChartview.wox, + UIxCalDayListview.wox, UIxCalWeekChartview.wox, + UIxCalMonthOverview.wox, UIxCalWeekListview.wox: + added 'hide/show rejected apts' toggle to all views + + * UIxPageFrame.wox: added 'headers' to the debug output + * UIxAppointmentEditor.wox: removed conditionals from UI as they were wrongly placed in the template, component does now deal with it diff --git a/SOGo/UI/Templates/UIxCalDayChartview.wox b/SOGo/UI/Templates/UIxCalDayChartview.wox index 31bfc904..c0090694 100644 --- a/SOGo/UI/Templates/UIxCalDayChartview.wox +++ b/SOGo/UI/Templates/UIxCalDayChartview.wox @@ -101,6 +101,13 @@ + + + diff --git a/SOGo/UI/Templates/UIxCalDayListview.wox b/SOGo/UI/Templates/UIxCalDayListview.wox index a96f4158..02ab86ae 100644 --- a/SOGo/UI/Templates/UIxCalDayListview.wox +++ b/SOGo/UI/Templates/UIxCalDayListview.wox @@ -93,6 +93,13 @@
+ +
+ diff --git a/SOGo/UI/Templates/UIxCalDayOverview.wox b/SOGo/UI/Templates/UIxCalDayOverview.wox index d7dbcc4f..add8d753 100644 --- a/SOGo/UI/Templates/UIxCalDayOverview.wox +++ b/SOGo/UI/Templates/UIxCalDayOverview.wox @@ -88,6 +88,13 @@
+ +
+ diff --git a/SOGo/UI/Templates/UIxCalMonthOverview.wox b/SOGo/UI/Templates/UIxCalMonthOverview.wox index 29e60365..327e6227 100644 --- a/SOGo/UI/Templates/UIxCalMonthOverview.wox +++ b/SOGo/UI/Templates/UIxCalMonthOverview.wox @@ -65,6 +65,13 @@ >
+ + - + - + - + -- 2.39.5
+ + diff --git a/SOGo/UI/Templates/UIxCalWeekChartview.wox b/SOGo/UI/Templates/UIxCalWeekChartview.wox index 4b52132c..0d74bb71 100644 --- a/SOGo/UI/Templates/UIxCalWeekChartview.wox +++ b/SOGo/UI/Templates/UIxCalWeekChartview.wox @@ -96,6 +96,13 @@
+ + diff --git a/SOGo/UI/Templates/UIxCalWeekColumnsview.wox b/SOGo/UI/Templates/UIxCalWeekColumnsview.wox index 38665dfb..243b1632 100644 --- a/SOGo/UI/Templates/UIxCalWeekColumnsview.wox +++ b/SOGo/UI/Templates/UIxCalWeekColumnsview.wox @@ -99,7 +99,13 @@
+ + diff --git a/SOGo/UI/Templates/UIxCalWeekListview.wox b/SOGo/UI/Templates/UIxCalWeekListview.wox index 05c69f54..390fd4b1 100644 --- a/SOGo/UI/Templates/UIxCalWeekListview.wox +++ b/SOGo/UI/Templates/UIxCalWeekListview.wox @@ -109,7 +109,13 @@
+ + diff --git a/SOGo/UI/Templates/UIxCalWeekOverview.wox b/SOGo/UI/Templates/UIxCalWeekOverview.wox index 581d2e11..db627bde 100644 --- a/SOGo/UI/Templates/UIxCalWeekOverview.wox +++ b/SOGo/UI/Templates/UIxCalWeekOverview.wox @@ -88,7 +88,13 @@
+ + diff --git a/SOGo/UI/Templates/UIxPageFrame.wox b/SOGo/UI/Templates/UIxPageFrame.wox index 40a3286b..26270767 100644 --- a/SOGo/UI/Templates/UIxPageFrame.wox +++ b/SOGo/UI/Templates/UIxPageFrame.wox @@ -137,6 +137,16 @@ >NO + + + +
Headers: + + + +