diff --git a/ChangeLog b/ChangeLog index 022d30775..6c7c31ef6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor -_handleCustomRRule:]): set the proper timezone for the end date. ([UIxComponentEditor -_loadRRules]): idem. + ([UIxComponentEditor -init): instanciates an UIxDatePicker object + to retrieve the proper date format. * UI/Scheduler/UIxAppointmentEditor.m ([UIxAppointmentEditor -saveAction]): for recurrent events with an end date, the method diff --git a/UI/Scheduler/UIxComponentEditor.h b/UI/Scheduler/UIxComponentEditor.h index 75c05bf3c..4ecd84ec6 100644 --- a/UI/Scheduler/UIxComponentEditor.h +++ b/UI/Scheduler/UIxComponentEditor.h @@ -60,6 +60,7 @@ NSString *cycleEnd; iCalPerson *organizer; NSString *componentOwner; + NSString *dateFormat; NSString *attendeesNames; NSString *attendeesUIDs; diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 0d4d210aa..a8375cfe0 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -57,6 +57,7 @@ #import #import "UIxComponentEditor.h" +#import "UIxDatePicker.h" #define iREPEAT(X) \ - (NSString *) repeat##X; \ @@ -66,6 +67,7 @@ - (NSString *) range##X; \ - (void) setRange##X: (NSString *) theValue + @interface UIxComponentEditor (Private) iREPEAT(1); @@ -94,6 +96,13 @@ iRANGE(2); { if ((self = [super init])) { + UIxDatePicker *datePicker; + + // We must instanciate a UIxDatePicker object to retrieve + // the proper date format to use. + datePicker = [[UIxDatePicker alloc] initWithContext: context]; + dateFormat = [datePicker dateFormat]; + component = nil; [self setPrivacy: @"PUBLIC"]; [self setIsCycleEndNever]; @@ -117,6 +126,8 @@ iRANGE(2); repeat7 = nil; range1 = nil; range2 = nil; + + [datePicker release]; } return self; @@ -342,11 +353,11 @@ iRANGE(2); else if ([rule untilDate]) { NSCalendarDate *date; - + date = [[rule untilDate] copy]; [date setTimeZone: [[context activeUser] timeZone]]; [self setRange1: @"2"]; - [self setRange2: [date descriptionWithCalendarFormat: @"%Y-%m-%d"]]; + [self setRange2: [date descriptionWithCalendarFormat: dateFormat]]; [date release]; } else @@ -1395,11 +1406,11 @@ RANGE(2); { NSCalendarDate *date; SOGoUser *user; - + user = [context activeUser]; date = [NSCalendarDate dateWithString: [self range2] - calendarFormat: @"%Y-%m-%d" - locale: [[WOApplication application] localeForLanguageNamed: [user language]]]; + calendarFormat: dateFormat + locale: [[WOApplication application] localeForLanguageNamed: [user language]]]; [theRule setUntilDate: date]; } // No end date. diff --git a/UI/Scheduler/UIxDatePicker.h b/UI/Scheduler/UIxDatePicker.h new file mode 100644 index 000000000..dcfd2cf46 --- /dev/null +++ b/UI/Scheduler/UIxDatePicker.h @@ -0,0 +1,46 @@ +/* UIxDatePicker.h - this file is part of SOGo + * + * Copyright (C) 2009 Inverse inc. + * + * Author: Francis Lachapelle + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef UIXDATEPICKER_H +#define UIXDATEPICKER_H + +#import + +@class NSString; + +@interface UIxDatePicker : WOComponent +{ + NSString *dateID; + id day; + id month; + id year; + NSString *label; + BOOL isDisabled; +} + +- (NSString *) dateID; +- (NSString *) dateFormat; +- (NSString *) jsDateFormat; +- (BOOL) useISOFormats; +@end + +#endif /* UIXDATEPICKER_H */ diff --git a/UI/Scheduler/UIxDatePicker.m b/UI/Scheduler/UIxDatePicker.m index 82893b4c5..d74d4c1a5 100644 --- a/UI/Scheduler/UIxDatePicker.m +++ b/UI/Scheduler/UIxDatePicker.m @@ -22,28 +22,11 @@ #import #import -#import #import #import #import -@class NSString; - -@interface UIxDatePicker : WOComponent -{ - NSString *dateID; - id day; - id month; - id year; - NSString *label; - BOOL isDisabled; -} - -- (NSString *) dateID; -- (NSString *) dateFormat; -- (NSString *) jsDateFormat; -- (BOOL) useISOFormats; -@end +#import "UIxDatePicker.h" @implementation UIxDatePicker