From 6aeca8b0b14a657865ee73323d8ebb0beb24511a Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 19 Jun 2007 18:08:16 +0000 Subject: [PATCH] Monotone-Parent: 7fbc310dbd531814ded84ae464d6b9f7f793be37 Monotone-Revision: 0a9e1bf24e4625bf9d860542966adcb75d55def5 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-06-19T18:08:16 Monotone-Branch: ca.inverse.sogo --- UI/Scheduler/GNUmakefile | 2 -- UI/Scheduler/UIxCalDayTable.h | 12 ++------- UI/Scheduler/UIxCalDayTable.m | 40 ++++++++--------------------- UI/Scheduler/UIxCalListingActions.h | 1 + UI/Scheduler/UIxCalListingActions.m | 38 +++++++++++++++++++-------- UI/Scheduler/product.plist | 23 ++++------------- 6 files changed, 47 insertions(+), 69 deletions(-) diff --git a/UI/Scheduler/GNUmakefile b/UI/Scheduler/GNUmakefile index b8f79463a..c03fc476b 100644 --- a/UI/Scheduler/GNUmakefile +++ b/UI/Scheduler/GNUmakefile @@ -33,10 +33,8 @@ SchedulerUI_OBJC_FILES = \ UIxAttendeesEditor.m \ UIxComponentEditor.m \ UIxCalendarSelector.m \ - UIxAppointmentView.m \ UIxAppointmentEditor.m \ UIxAppointmentProposal.m \ - UIxTaskView.m \ UIxTaskEditor.m \ UIxTaskProposal.m \ UIxCalDateLabel.m \ diff --git a/UI/Scheduler/UIxCalDayTable.h b/UI/Scheduler/UIxCalDayTable.h index 37f6364d6..cc5598e45 100644 --- a/UI/Scheduler/UIxCalDayTable.h +++ b/UI/Scheduler/UIxCalDayTable.h @@ -33,24 +33,16 @@ @interface UIxCalDayTable : UIxCalView { - SOGoDateFormatter *dateFormatter; int numberOfDays; NSCalendarDate *startDate; NSCalendarDate *currentTableDay; NSString *currentTableHour; NSMutableArray *daysToDisplay; NSMutableArray *hoursToDisplay; - - NSString *cssClass; - NSString *cssId; + NSArray *weekDays; + SOGoDateFormatter *dateFormatter; } -- (void) setCSSClass: (NSString *) aCssClass; -- (NSString *) cssClass; - -- (void) setCSSId: (NSString *) aCssId; -- (NSString *) cssId; - - (void) setNumberOfDays: (NSString *) aNumber; - (NSString *) numberOfDays; diff --git a/UI/Scheduler/UIxCalDayTable.m b/UI/Scheduler/UIxCalDayTable.m index aac4cf73f..3c5a35e6f 100644 --- a/UI/Scheduler/UIxCalDayTable.m +++ b/UI/Scheduler/UIxCalDayTable.m @@ -25,11 +25,13 @@ #import #import #import - -#import +#import #import -#import +#import + +#import +#import #import "UIxCalDayTable.h" @@ -41,15 +43,15 @@ { if ((self = [super init])) { -// allAppointments = nil; daysToDisplay = nil; hoursToDisplay = nil; numberOfDays = 1; startDate = nil; currentTableDay = nil; currentTableHour = nil; - dateFormatter = [[SOGoDateFormatter alloc] - initWithLocale: [self locale]]; + weekDays = [[context valueForKey: @"locale"] objectForKey: NSShortWeekDayNameArray]; + [weekDays retain]; + dateFormatter = [[context activeUser] dateFormatterInContext: context]; } return self; @@ -59,32 +61,12 @@ { // if (allAppointments) // [allAppointments release]; + [weekDays release]; [daysToDisplay release]; [hoursToDisplay release]; - [dateFormatter release]; [super dealloc]; } -- (void) setCSSClass: (NSString *) aCssClass -{ - cssClass = aCssClass; -} - -- (NSString *) cssClass -{ - return cssClass; -} - -- (void) setCSSId: (NSString *) aCssId -{ - cssId = aCssId; -} - -- (NSString *) cssId -{ - return cssId; -} - - (void) setNumberOfDays: (NSString *) aNumber { numberOfDays = [aNumber intValue]; @@ -194,12 +176,12 @@ - (NSString *) labelForDay { - return [dateFormatter shortDayOfWeek: [currentTableDay dayOfWeek]]; + return [weekDays objectAtIndex: [currentTableDay dayOfWeek]]; } - (NSString *) labelForDate { - return [dateFormatter stringForObjectValue: currentTableDay]; + return [dateFormatter shortFormattedDate: currentTableDay]; } // - (NSDictionary *) _adjustedAppointment: (NSDictionary *) anAppointment diff --git a/UI/Scheduler/UIxCalListingActions.h b/UI/Scheduler/UIxCalListingActions.h index ed455673f..7ef811d3d 100644 --- a/UI/Scheduler/UIxCalListingActions.h +++ b/UI/Scheduler/UIxCalListingActions.h @@ -44,6 +44,7 @@ NSString *userLogin; WORequest *request; SOGoDateFormatter *dateFormatter; + NSTimeZone *userTimeZone; } - (WOResponse *) eventsListAction; diff --git a/UI/Scheduler/UIxCalListingActions.m b/UI/Scheduler/UIxCalListingActions.m index d946a13da..bcbb66bcd 100644 --- a/UI/Scheduler/UIxCalListingActions.m +++ b/UI/Scheduler/UIxCalListingActions.m @@ -33,12 +33,12 @@ #import #import +#import #import #import #import #import -#import "../SOGoUI/SOGoDateFormatter.h" #import "NSArray+Scheduler.h" #import "UIxCalListingActions.h" @@ -47,7 +47,7 @@ - (id) initWithRequest: (WORequest *) newRequest { - NSDictionary *locale; + SOGoUser *user; if ((self = [super initWithRequest: newRequest])) { @@ -55,9 +55,9 @@ startDate = nil; endDate = nil; ASSIGN (request, newRequest); - locale = [[self context] valueForKey: @"locale"]; - dateFormatter = [[SOGoDateFormatter alloc] initWithLocale: locale]; - [dateFormatter setFullWeekdayNameAndDetails]; + user = [[self context] activeUser]; + dateFormatter = [user dateFormatterInContext: context]; + ASSIGN (userTimeZone, [user timeZone]); } return self; @@ -70,6 +70,7 @@ [componentsData release]; [startDate release]; [endDate release]; + [userTimeZone release]; [super dealloc]; } @@ -297,13 +298,29 @@ return response; } +- (NSString *) _formattedDateForSeconds: (unsigned int) seconds + forAllDay: (BOOL) forAllDay +{ + NSCalendarDate *date; + NSString *formattedDate; + + date = [NSCalendarDate dateWithTimeIntervalSince1970: seconds]; + [date setTimeZone: userTimeZone]; + if (forAllDay) + formattedDate = [dateFormatter formattedDate: date]; + else + formattedDate = [dateFormatter formattedDateAndTime: date]; + + return formattedDate; +} + - (WOResponse *) eventsListAction { NSArray *fields, *oldEvent; NSEnumerator *events; - NSString *date; NSMutableArray *newEvents, *newEvent; unsigned int interval; + BOOL isAllDay; [self _setupContext]; @@ -317,12 +334,13 @@ while (oldEvent) { newEvent = [NSMutableArray arrayWithArray: oldEvent]; + isAllDay = [[oldEvent objectAtIndex: 7] boolValue]; interval = [[oldEvent objectAtIndex: 4] intValue]; - date = [dateFormatter stringForSecondsSinceThe70s: interval]; - [newEvent addObject: date]; + [newEvent addObject: [self _formattedDateForSeconds: interval + forAllDay: isAllDay]]; interval = [[oldEvent objectAtIndex: 5] intValue]; - date = [dateFormatter stringForSecondsSinceThe70s: interval]; - [newEvent addObject: date]; + [newEvent addObject: [self _formattedDateForSeconds: interval + forAllDay: isAllDay]]; [newEvents addObject: newEvent]; oldEvent = [events nextObject]; diff --git a/UI/Scheduler/product.plist b/UI/Scheduler/product.plist index 63d85f5ef..2041d7570 100644 --- a/UI/Scheduler/product.plist +++ b/UI/Scheduler/product.plist @@ -130,15 +130,6 @@ }; }; methods = { - view = { - protectedBy = "ViewAllComponent"; - pageName = "UIxAppointmentView"; - }; - delete = { - protectedBy = "Delete Objects"; - pageName = "UIxAppointmentView"; - actionName = "delete"; - }; edit = { protectedBy = "ViewAllComponent"; pageName = "UIxAppointmentEditor"; @@ -178,15 +169,11 @@ }; }; methods = { - view = { - protectedBy = "ViewAllComponent"; - pageName = "UIxTaskView"; - }; - delete = { - protectedBy = "Delete Objects"; - pageName = "UIxTaskView"; - actionName = "delete"; - }; +// delete = { +// protectedBy = "Delete Objects"; +// pageName = "UIxTaskView"; +// actionName = "delete"; +// }; edit = { protectedBy = "ViewAllComponent"; pageName = "UIxTaskEditor";