From: wolfgang Date: Wed, 20 Jun 2007 14:06:45 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1087 d1b88da0-ebda-0310... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a618da690a9beadcefd0ea89a921900e3897ce8;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1087 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/ChangeLog b/ChangeLog index 4ba41102..f08a575f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +2007-06-19 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoUser.m ([SOGoUser + -setCurrentPassword:newPassword]): new stub method. + ([SOGoUser -dateFormatterInContext:context]): new method that + returns an instance of SOGoDateFormatter configured based on the + user defaults. + + * UI/Common/UIxPageFrame.m ([UIxPageFrame + -relativePreferencesPath]): new method. + + * UI/Scheduler/UIxComponentEditor.m ([-titleDateFormatter]): + removed useless method. + + * SoObjects/SOGo/SOGoDateFormatter.m: rewrote class to accept + different configurable formats (long and short date + time). + + * SoObjects/SOGo/SOGoDateFormatter.[hm]: moved from UI/SOGoUI/. + + * SoObjects/Mailer/SOGoMailAccounts.m ([SOGoMailAccounts + -isInternetRequest]): removed method. + + * SoObjects/SOGo/AgenorUserDefaults.m ([AgenorUserDefaults + -jsonRepresentation]): new method with an explicit name. + + * UI/PreferencesUI/product.plist: new bundle that provides a web + ui for handling user defaults. + + * UI/Scheduler/UIxTaskView.[hm]: removed unused module. + + * UI/Scheduler/UIxAppointmentView.[hm]: removed unused module. + + * SoObjects/SOGo/WOContext+Agenor.[hm]: removed unused module. + +2007-06-14 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoLRUCache.m: removed unused module. + 2007-06-13 Wolfgang Sourdeau * UI/Scheduler/NSArray+Scheduler.m ([NSArray diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index fb871988..92e99648 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -19,21 +19,38 @@ 02111-1307, USA. */ -#include "SOGoDraftObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "common.h" +#import +#import +#import +#import +#import +#import + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#import + +#import "SOGoDraftObject.h" static NSString *contentTypeValue = @"text/plain; charset=utf-8"; @@ -70,7 +87,6 @@ static NSString *userAgent = @"SOGoMail 1.0"; static BOOL draftDeleteDisabled = NO; // for debugging static BOOL debugOn = NO; static BOOL showTextAttachmentsInline = NO; -static NSString *fromInternetSuffixPattern = nil; + (int)version { return [super version] + 0 /* v1 */; @@ -89,14 +105,6 @@ static NSString *fromInternetSuffixPattern = nil; if ((draftDeleteDisabled = [ud boolForKey:@"SOGoNoDraftDeleteAfterSend"])) NSLog(@"WARNING: draft delete is disabled! (SOGoNoDraftDeleteAfterSend)"); - fromInternetSuffixPattern = [ud stringForKey:@"SOGoInternetMailSuffix"]; - if ([fromInternetSuffixPattern length] == 0) - NSLog(@"Note: no 'SOGoInternetMailSuffix' is configured."); - else { - fromInternetSuffixPattern = - [@"\n" stringByAppendingString:fromInternetSuffixPattern]; - } - TextPlainType = [[NGMimeType mimeType:@"text" subType:@"plain"] copy]; MultiMixedType = [[NGMimeType mimeType:@"multipart" subType:@"mixed"] copy]; } @@ -341,49 +349,31 @@ static NSString *fromInternetSuffixPattern = nil; { NSDictionary *lInfo; NGMimeMessage *message; - NSString *fromInternetSuffix; BOOL addSuffix; id body; if ((lInfo = [self fetchInfo]) == nil) return nil; - addSuffix = [context isAccessFromIntranet] ? NO : YES; - if (addSuffix) { - fromInternetSuffix = - [fromInternetSuffixPattern stringByReplacingVariablesWithBindings: - [context request] - stringForUnknownBindings:@""]; - - addSuffix = [fromInternetSuffix length] > 0 ? YES : NO; - } - - [map setObject:@"text/plain" forKey:@"content-type"]; + [map setObject: @"text/plain" forKey: @"content-type"]; if ((body = [lInfo objectForKey:@"text"]) != nil) { - if ([body isKindOfClass:[NSString class]]) { - if (addSuffix) - body = [body stringByAppendingString:fromInternetSuffix]; - + if ([body isKindOfClass:[NSString class]]) /* Note: just 'utf8' is displayed wrong in Mail.app */ [map setObject: contentTypeValue forKey: @"content-type"]; // body = [body dataUsingEncoding:NSUTF8StringEncoding]; - } else if ([body isKindOfClass:[NSData class]] && addSuffix) { body = [[body mutableCopy] autorelease]; - [(NSMutableData *)body - appendData: [fromInternetSuffix dataUsingEncoding:NSUTF8StringEncoding]]; } else if (addSuffix) { [self warnWithFormat:@"Note: cannot add Internet marker to body: %@", NSStringFromClass([body class])]; } } - else if (addSuffix) - body = fromInternetSuffix; message = [[[NGMimeMessage alloc] initWithHeader:map] autorelease]; [message setBody:body]; + return message; } @@ -934,7 +924,8 @@ static NSString *fromInternetSuffixPattern = nil; return [NSNumber numberWithBool:YES]; /* delete worked out ... */ } -- (id)GETAction:(id)_ctx { +- (id) GETAction: (id) _ctx +{ /* Override, because SOGoObject's GETAction uses the less efficient -contentAsString method. diff --git a/SoObjects/Mailer/SOGoMailAccounts.m b/SoObjects/Mailer/SOGoMailAccounts.m index 8e7c8a58..bb3ac3ba 100644 --- a/SoObjects/Mailer/SOGoMailAccounts.m +++ b/SoObjects/Mailer/SOGoMailAccounts.m @@ -23,18 +23,11 @@ #include "SOGoUser+Mail.h" #include "common.h" #include -#include @implementation SOGoMailAccounts static NSString *AgenorShareLoginMarker = @".-."; -/* detect webmail being accessed from the outside */ - -- (BOOL)isInternetRequest { - return ([context isAccessFromIntranet] ? NO : YES); -} - /* listing the available mailboxes */ - (BOOL) isInHomeFolderBranchOfLoggedInAccount: (NSString *) userLogin @@ -71,9 +64,6 @@ static NSString *AgenorShareLoginMarker = @".-."; account = [user primaryIMAP4AccountString]; if ([account isNotNull]) account = [NSArray arrayWithObject:account]; - if ([self isInternetRequest]) /* only show primary mailbox in Internet */ - return account; - shares = [user valueForKey:@"additionalIMAP4AccountStrings"]; return ([shares count] == 0) ? account @@ -156,19 +146,10 @@ static NSString *AgenorShareLoginMarker = @".-."; } if ([self isValidMailAccountName:_key]) { - /* forbid shares for requests coming from the Internet */ BOOL isSharedKey; isSharedKey = [_key rangeOfString:AgenorShareLoginMarker].length > 0; - if ([self isInternetRequest]) { - if (isSharedKey) { - return [NSException exceptionWithHTTPStatus:403 /* Forbidden */ - reason: - @"Access to shares forbidden from the Internet"]; - } - } - return isSharedKey ? [self sharedMailAccountWithName:_key inContext:_ctx] : [self mailAccountWithName:_key inContext:_ctx]; diff --git a/SoObjects/Mailer/common.h b/SoObjects/Mailer/common.h index a11785e5..c694a6dc 100644 --- a/SoObjects/Mailer/common.h +++ b/SoObjects/Mailer/common.h @@ -19,6 +19,8 @@ 02111-1307, USA. */ +#warning importing common is baaad + #import #import diff --git a/SoObjects/SOGo/AgenorUserDefaults.h b/SoObjects/SOGo/AgenorUserDefaults.h index 7bdbca78..e2f1085a 100644 --- a/SoObjects/SOGo/AgenorUserDefaults.h +++ b/SoObjects/SOGo/AgenorUserDefaults.h @@ -78,6 +78,8 @@ - (void) setFloat: (float) value forKey: (NSString *) key; - (void) setInteger: (int) value forKey: (NSString *) key; +- (NSString *) jsonRepresentation; + /* saving changes */ - (BOOL) synchronize; diff --git a/SoObjects/SOGo/AgenorUserDefaults.m b/SoObjects/SOGo/AgenorUserDefaults.m index d904acbc..c1104ceb 100644 --- a/SoObjects/SOGo/AgenorUserDefaults.m +++ b/SoObjects/SOGo/AgenorUserDefaults.m @@ -19,14 +19,21 @@ 02111-1307, USA. */ +#import +#import #import + +#import +#import + #import #import #import #import #import -#import "common.h" +#import "NSObject+Utilities.h" + #import "AgenorUserDefaults.h" @implementation AgenorUserDefaults @@ -320,6 +327,13 @@ static NSString *uidColumnName = @"uid"; return (values || [self primaryFetchProfile]); } +- (NSString *) jsonRepresentation +{ + [self fetchProfile]; + + return [values jsonRepresentation]; +} + /* value access */ - (void) setObject: (id) value diff --git a/SoObjects/SOGo/GNUmakefile b/SoObjects/SOGo/GNUmakefile index 03916b35..39f6dca1 100644 --- a/SoObjects/SOGo/GNUmakefile +++ b/SoObjects/SOGo/GNUmakefile @@ -30,9 +30,8 @@ libSOGo_HEADER_FILES = \ \ LDAPUserManager.h \ LDAPSource.h \ + SOGoDateFormatter.h \ SOGoPermissions.h \ - SOGoLRUCache.h \ - WOContext+Agenor.h \ SOGoDAVRendererTypes.h \ NSArray+Utilities.h \ NSDictionary+URL.h \ @@ -56,11 +55,10 @@ libSOGo_OBJC_FILES = \ SOGoGroupFolder.m \ SOGoCustomGroupFolder.m \ \ + SOGoDateFormatter.m \ SOGoPermissions.m \ - SOGoLRUCache.m \ LDAPUserManager.m \ LDAPSource.m \ - WOContext+Agenor.m \ SOGoDAVRendererTypes.m \ AgenorUserDefaults.m \ NSArray+Utilities.m \ diff --git a/SoObjects/SOGo/SOGoAuthenticator.h b/SoObjects/SOGo/SOGoAuthenticator.h index a56ac426..3ada0735 100644 --- a/SoObjects/SOGo/SOGoAuthenticator.h +++ b/SoObjects/SOGo/SOGoAuthenticator.h @@ -38,17 +38,11 @@ @interface SOGoAuthenticator : SoHTTPAuthenticator { - NSUserDefaults *ud; NSString *authMethod; - NSString *LDAPBaseDN; - NSString *LDAPHost; - int LDAPPort; } + (id) sharedSOGoAuthenticator; -- (BOOL) LDAPCheckLogin: (NSString *) _login password: (NSString *) _pwd; - - (SOGoUser *) userInContext: (WOContext *) _ctx; @end diff --git a/SoObjects/SOGo/SOGoAuthenticator.m b/SoObjects/SOGo/SOGoAuthenticator.m index 134dba02..0c8d5c0a 100644 --- a/SoObjects/SOGo/SOGoAuthenticator.m +++ b/SoObjects/SOGo/SOGoAuthenticator.m @@ -19,43 +19,41 @@ 02111-1307, USA. */ +#import +#import +#import + +#import +#import #import -#import "SOGoPermissions.h" #import "LDAPUserManager.h" +#import "SOGoPermissions.h" +#import "SOGoUser.h" #import "SOGoAuthenticator.h" -#import "SOGoUser.h" -#import "common.h" @implementation SOGoAuthenticator -static SOGoAuthenticator *auth = nil; - + (id) sharedSOGoAuthenticator { - if (auth == nil) - auth = [[self alloc] init]; + static SOGoAuthenticator *auth = nil; + + if (!auth) + auth = [self new]; + return auth; } - (id) init { + NSUserDefaults *ud; + if ((self = [super init])) { ud = [NSUserDefaults standardUserDefaults]; - LDAPBaseDN = nil; - LDAPHost = nil; - LDAPPort = -1; - authMethod = [[ud stringForKey:@"AuthentificationMethod"] retain]; - if ([authMethod isEqualToString: @"LDAP"]) - { -// LDAPBaseDN = [[ud stringForKey:@"LDAPRootDN"] retain]; -// LDAPHost = [[ud stringForKey:@"LDAPHost"] retain]; -// LDAPPort = [ud integerForKey:@"LDAPPort"]; - } } return self; @@ -63,10 +61,6 @@ static SOGoAuthenticator *auth = nil; - (void) dealloc { - if (LDAPBaseDN) - [LDAPBaseDN release]; - if (LDAPHost) - [LDAPHost release]; [authMethod release]; [super dealloc]; } @@ -75,25 +69,36 @@ static SOGoAuthenticator *auth = nil; password: (NSString *) _pwd { BOOL accept; + LDAPUserManager *um; if ([authMethod isEqualToString: @"LDAP"]) - accept = [self LDAPCheckLogin: _login password: _pwd]; + { + um = [LDAPUserManager sharedUserManager]; + accept = [um checkLogin: _login andPassword: _pwd]; + } else accept = ([_login length] > 0); - return (([_login isEqualToString: @"freebusy"] - && [_pwd isEqualToString: @"freebusy"]) - || accept); + return (accept + || ([_login isEqualToString: @"freebusy"] + && [_pwd isEqualToString: @"freebusy"])); } -- (BOOL) LDAPCheckLogin: (NSString *) _login - password: (NSString *) _pwd +- (NSString *) _passwordInContext: (WOContext *) context { - LDAPUserManager *um; - - um = [LDAPUserManager sharedUserManager]; + NSString *auth, *password; + NSArray *creds; - return [um checkLogin: _login andPassword: _pwd]; + password = nil; + auth = [[context request] headerForKey:@"authorization"]; + if (auth) + { + creds = [self parseCredentials: auth]; + if ([creds count] > 1) + password = [creds objectAtIndex: 1]; + } + + return password; } /* create SOGoUser */ @@ -126,8 +131,11 @@ static SOGoAuthenticator *auth = nil; user = anonymous; } else - user = [SOGoUser userWithLogin: login - roles: [self rolesForLogin: login]]; + { + user = [SOGoUser userWithLogin: login + roles: [self rolesForLogin: login]]; + [user setCurrentPassword: [self _passwordInContext: _ctx]]; + } } else user = nil; diff --git a/SoObjects/SOGo/SOGoContentObject.m b/SoObjects/SOGo/SOGoContentObject.m index 344e9c28..945382da 100644 --- a/SoObjects/SOGo/SOGoContentObject.m +++ b/SoObjects/SOGo/SOGoContentObject.m @@ -19,9 +19,16 @@ 02111-1307, USA. */ +#import +#import +#import + +#import +#import +#import +#import #import -#import "common.h" #import "SOGoFolder.h" #import "SOGoUser.h" #import "SOGoPermissions.h" diff --git a/SoObjects/SOGo/SOGoCustomGroupFolder.m b/SoObjects/SOGo/SOGoCustomGroupFolder.m index 3e39df8d..3ad33b95 100644 --- a/SoObjects/SOGo/SOGoCustomGroupFolder.m +++ b/SoObjects/SOGo/SOGoCustomGroupFolder.m @@ -18,10 +18,13 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id: SOGoCustomGroupFolder.m 115 2004-06-30 11:57:37Z helge $ -#include "SOGoCustomGroupFolder.h" -#include "common.h" +#import +#import + +#import + +#import "SOGoCustomGroupFolder.h" @implementation SOGoCustomGroupFolder diff --git a/SoObjects/SOGo/SOGoDateFormatter.h b/SoObjects/SOGo/SOGoDateFormatter.h new file mode 100644 index 00000000..3889bff5 --- /dev/null +++ b/SoObjects/SOGo/SOGoDateFormatter.h @@ -0,0 +1,68 @@ +/* + Copyright (C) 2004 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo 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 Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#ifndef __SOGoDateFormatter_H_ +#define __SOGoDateFormatter_H_ + +#import + +@class NSCalendarDate; +@class NSDictionary; +@class NSString; + +@interface SOGoDateFormatter : NSFormatter +{ + NSDictionary *locale; + NSString *shortDateFormat; + NSString *longDateFormat; + NSString *timeFormat; +} + +- (void) setLocale: (NSDictionary *) newLocale; +- (void) setShortDateFormat: (NSString *) newDateFormat; +- (void) setLongDateFormat: (NSString *) newDateFormat; +- (void) setTimeFormat: (NSString *) newDateFormat; + +- (NSString *) shortFormattedDate: (NSCalendarDate *) date; +- (NSString *) formattedDate: (NSCalendarDate *) date; +- (NSString *) formattedTime: (NSCalendarDate *) date; +- (NSString *) formattedDateAndTime: (NSCalendarDate *) date; + +- (NSString *) stringForObjectValue: (id) date; + +// - (void) setFullWeekdayNameAndDetails; + +// - (NSString *) date: (NSCalendarDate *) date +// withFormat: (unsigned int) format; +// - (NSString *) date: (NSCalendarDate *) date +// withNSFormat: (NSNumber *) format; + + +// - (NSString *) shortDayOfWeek: (int)_day; +// - (NSString *) fullDayOfWeek: (int)_day; +// - (NSString *) shortMonthOfYear: (int)_month; +// - (NSString *) fullMonthOfYear: (int)_month; + +// - (NSString *) fullWeekdayNameAndDetailsForDate: (NSCalendarDate *)_date; + +@end + +#endif /* __SOGoDateFormatter_H_ */ diff --git a/SoObjects/SOGo/SOGoDateFormatter.m b/SoObjects/SOGo/SOGoDateFormatter.m new file mode 100644 index 00000000..9bddd762 --- /dev/null +++ b/SoObjects/SOGo/SOGoDateFormatter.m @@ -0,0 +1,251 @@ +/* + Copyright (C) 2004 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo 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 Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#import +#import + +#import "SOGoDateFormatter.h" + +@implementation SOGoDateFormatter + +- (id) init +{ + if ((self = [super init])) + { + locale = nil; +// locale = [_locale retain]; + +// if ([[locale objectForKey:@"NSLocaleCode"] isEqualToString: @"fr"]) +// shortDateFormat = SOGoDateDMYFormat; +// else +// shortDateFormat = SOGoDateISOFormat; + shortDateFormat = nil; + longDateFormat = nil; + timeFormat = nil; + } + + return self; +} + +- (void) dealloc +{ + [longDateFormat release]; + [shortDateFormat release]; + [timeFormat release]; + [locale release]; + [super dealloc]; +} + +/* accessors */ + +- (void) setLocale: (NSDictionary *) newLocale +{ + ASSIGN (locale, newLocale); + ASSIGN (shortDateFormat, [locale objectForKey: NSShortDateFormatString]); + ASSIGN (longDateFormat, [locale objectForKey: NSDateFormatString]); + ASSIGN (timeFormat, [locale objectForKey: NSTimeFormatString]); +} + +- (void) setShortDateFormat: (NSString *) newFormat +{ + ASSIGN (shortDateFormat, newFormat); +} + +- (void) setLongDateFormat: (NSString *) newFormat +{ + ASSIGN (longDateFormat, newFormat); +} + +- (void) setTimeFormat: (NSString *) newFormat +{ + ASSIGN (timeFormat, newFormat); +} + +// - (void) setFullWeekdayNameAndDetails +// { +// auxFormatAction = formatAction; +// formatAction = @selector(fullWeekdayNameAndDetailsForDate:); +// } + +/* operation */ + +- (NSString *) _date: (NSCalendarDate *) date + withFormat: (NSString *) format +{ + NSString *formattedDate; + + if (format && locale) + formattedDate + = [date descriptionWithCalendarFormat: format locale: locale]; + else + formattedDate = nil; + + return formattedDate; +} + +- (NSString *) shortFormattedDate: (NSCalendarDate *) date +{ + return [self _date: date withFormat: shortDateFormat]; +} + +- (NSString *) formattedDate: (NSCalendarDate *) date +{ + return [self _date: date withFormat: longDateFormat]; +} + +- (NSString *) formattedTime: (NSCalendarDate *) date +{ + return [self _date: date withFormat: timeFormat]; +} + +- (NSString *) formattedDateAndTime: (NSCalendarDate *) date +{ + NSString *format; + + format = [NSString stringWithFormat: @"%@ %@ %%Z", + longDateFormat, timeFormat]; + + return [self _date: date withFormat: format]; +} + +- (NSString *) stringForObjectValue: (id) object +{ + NSString *formattedString; + + if ([object isKindOfClass: [NSCalendarDate class]]) + formattedString = [self formattedDateAndTime: object]; + else + formattedString = nil; + + return formattedString; +} + +// /* Helpers */ + +// - (NSString *)shortDayOfWeek:(int)_day { +// return [[locale objectForKey:@"NSShortWeekDayNameArray"] +// objectAtIndex:_day]; +// } + +// - (NSString *)fullDayOfWeek:(int)_day { +// return [[locale objectForKey:@"NSWeekDayNameArray"] +// objectAtIndex:_day]; +// } + +// - (NSString *)shortMonthOfYear:(int)_month { +// return [[locale objectForKey:@"NSShortMonthNameArray"] +// objectAtIndex:_month - 1]; +// } + +// - (NSString *)fullMonthOfYear:(int)_month { +// return [[locale objectForKey:@"NSMonthNameArray"] +// objectAtIndex:_month - 1]; +// } + + +/* Private API */ + +// - (NSString *) fullWeekdayNameAndDetailsForDate: (NSCalendarDate *) _date +// { +// NSMutableString *desc; + +// if (_date) +// { +// desc = [NSMutableString stringWithCapacity:24]; +// [desc appendString:[self fullDayOfWeek:[_date dayOfWeek]]]; +// [desc appendString:@", "]; +// [desc appendString:[self performSelector:auxFormatAction +// withObject:_date]]; +// [desc appendString:@" "]; +// [desc appendFormat:@"%02d:%02d ", [_date hourOfDay], [_date minuteOfHour]]; +// [desc appendString:[[_date timeZone] abbreviation]]; +// } +// else +// desc = nil; + +// return desc; +// } + +// - (NSString *) _separatorForFormat: (unsigned int) format +// { +// NSString *separator; + +// switch (format & (3)) +// { +// case SOGoDateDotFormat: +// separator = @"."; +// break; +// case SOGoDateDashFormat: +// separator = @"."; +// break; +// default: +// separator = @"/"; +// } + +// return separator; +// } + +// - (NSString *) _dateFormatForDate: (NSCalendarDate *) date +// withFormat: (unsigned int) format +// andSeparator: (NSString *) separator +// { +// NSString *day, *month, *year; +// NSString *formattedDate; + +// day = [NSString stringWithFormat: @"%.2d", [date dayOfMonth]]; +// month = [NSString stringWithFormat: @"%.2d", [date monthOfYear]]; +// if (format & SOGoDateTwoDigitsYearFormat) +// year = [NSString stringWithFormat: @"%.2d", [date yearOfCommonEra] % 100]; +// else +// year = [NSString stringWithFormat: @"%.4d", [date yearOfCommonEra]]; + +// if (format & SOGoDateDMYFormat) +// formattedDate = [NSString stringWithFormat: @"%@%@%@%@%@", +// day, separator, month, separator, year]; +// else if (format & SOGoDateMDYFormat) +// formattedDate = [NSString stringWithFormat: @"%@%@%@%@%@", +// month, separator, day, separator, year]; +// else +// formattedDate = [NSString stringWithFormat: @"%@%@%@%@%@", +// year, separator, month, separator, day]; + +// return formattedDate; +// } + +// - (NSString *) date: (NSCalendarDate *) date +// withFormat: (unsigned int) format +// { +// NSString *separator; + +// separator = [self _separatorForFormat: format]; + +// return [self _dateFormatForDate: date +// withFormat: format +// andSeparator: separator]; +// } + +// - (NSString *) date: (NSCalendarDate *) date +// withNSFormat: (NSNumber *) format +// { +// return [self date: date withFormat: [format unsignedIntValue]]; +// } + +@end /* SOGoDateFormatter */ diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index db2a8946..7d914d39 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -19,7 +19,18 @@ 02111-1307, USA. */ +#import +#import + +#import +#import +#import +#import + #import +#import +#import +#import #import #import #import @@ -27,10 +38,8 @@ #import #import "SOGoPermissions.h" + #import "SOGoFolder.h" -#import "common.h" -#import -#import static NSString *defaultUserID = @""; diff --git a/SoObjects/SOGo/SOGoGroupFolder.m b/SoObjects/SOGo/SOGoGroupFolder.m index 054e4681..cda067f1 100644 --- a/SoObjects/SOGo/SOGoGroupFolder.m +++ b/SoObjects/SOGo/SOGoGroupFolder.m @@ -18,29 +18,40 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id: SOGoGroupFolder.m 115 2004-06-30 11:57:37Z helge $ -#include "SOGoGroupFolder.h" -#include "common.h" +#import +#import + +#import +#import + +#import +#import +#import +#import +#import + +#import "SOGoGroupFolder.h" @implementation SOGoGroupFolder static NGLogger *logger = nil; -+ (void)initialize { ++ (void) initialize +{ NGLoggerManager *lm; - static BOOL didInit = NO; - - if (didInit) return; - didInit = YES; - - lm = [NGLoggerManager defaultLoggerManager]; - logger = [lm loggerForDefaultKey:@"SOGoGroupFolderDebugEnabled"]; + + if (!logger) + { + lm = [NGLoggerManager defaultLoggerManager]; + logger = [lm loggerForDefaultKey:@"SOGoGroupFolderDebugEnabled"]; + } } -- (void)dealloc { - [self->uidToFolder release]; - [self->folders release]; +- (void) dealloc +{ + [uidToFolder release]; + [folders release]; [super dealloc]; } @@ -97,7 +108,7 @@ static NGLogger *logger = nil; NSArray *luids; unsigned i, count; - if (self->uidToFolder != nil) + if (uidToFolder != nil) return; if ((luids = [self uids]) == nil) return; @@ -122,13 +133,13 @@ static NGLogger *logger = nil; } /* fix results */ - self->uidToFolder = [md copy]; - self->folders = [[NSArray alloc] initWithArray:ma]; + uidToFolder = [md copy]; + folders = [[NSArray alloc] initWithArray:ma]; } - (NSArray *)memberFolders { [self _setupFolders]; - return self->folders; + return folders; } - (id)folderForUID:(NSString *)_uid { @@ -137,27 +148,34 @@ static NGLogger *logger = nil; if ([_uid length] == 0) return nil; - return [self->uidToFolder objectForKey:_uid]; + return [uidToFolder objectForKey:_uid]; } -- (void)resetFolderCaches { - [self->uidToFolder release]; self->uidToFolder = nil; - [self->folders release]; self->folders = nil; +- (void) resetFolderCaches +{ + [uidToFolder release]; + uidToFolder = nil; + [folders release]; + folders = nil; } -- (void)sleep { + +- (void) sleep +{ [self resetFolderCaches]; [super sleep]; } /* SOPE */ -- (BOOL)isFolderish { +- (BOOL) isFolderish +{ return YES; } /* looking up shared objects */ -- (SOGoGroupsFolder *)lookupGroupsFolder { +- (SOGoGroupsFolder *) lookupGroupsFolder +{ return [[self container] lookupGroupsFolder]; } @@ -165,7 +183,9 @@ static NGLogger *logger = nil; /* name lookup */ -- (id)groupCalendar:(NSString *)_key inContext:(id)_ctx { +- (id) groupCalendar: (NSString *) _key + inContext: (id) _ctx +{ static Class calClass = Nil; id calendar; @@ -184,7 +204,10 @@ static NGLogger *logger = nil; return [calendar autorelease]; } -- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag { +- (id) lookupName: (NSString *) _key + inContext: (id) _ctx + acquire: (BOOL) _flag +{ id obj; /* first check attributes directly bound to the application */ diff --git a/SoObjects/SOGo/SOGoGroupsFolder.m b/SoObjects/SOGo/SOGoGroupsFolder.m index ee71c7f7..b29aeb66 100644 --- a/SoObjects/SOGo/SOGoGroupsFolder.m +++ b/SoObjects/SOGo/SOGoGroupsFolder.m @@ -18,28 +18,31 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id: SOGoGroupsFolder.m 115 2004-06-30 11:57:37Z helge $ -#include "SOGoGroupsFolder.h" -#include "common.h" +#import +#import + +#import "SOGoGroupsFolder.h" @implementation SOGoGroupsFolder -- (void)dealloc { - [super dealloc]; -} +// - (void)dealloc { +// [super dealloc]; +// } /* accessors */ /* SOPE */ -- (BOOL)isFolderish { +- (BOOL) isFolderish +{ return YES; } /* looking up shared objects */ -- (SOGoGroupsFolder *)lookupGroupsFolder { +- (SOGoGroupsFolder *) lookupGroupsFolder +{ return self; } @@ -47,33 +50,42 @@ /* name lookup */ -- (id)customGroup:(NSString *)_key inContext:(id)_ctx { +- (id) customGroup: (NSString *) _key + inContext: (id) _ctx +{ static Class groupClass = Nil; id group; - - if (groupClass == Nil) + + if (!groupClass) groupClass = NSClassFromString(@"SOGoCustomGroupFolder"); - if (groupClass == Nil) { - [self logWithFormat:@"ERROR: missing SOGoCustomGroupFolder class!"]; - return nil; - } - - group = [[groupClass alloc] initWithName:_key inContainer:self]; - return [group autorelease]; + if (!groupClass) + { + [self logWithFormat:@"ERROR: missing SOGoCustomGroupFolder class!"]; + group = nil; + } + else + group = [groupClass objectWithName: _key inContainer: self]; + + return group; } -- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag { +- (id) lookupName: (NSString *) _key + inContext: (id) _ctx + acquire: (BOOL) _flag +{ id obj; /* first check attributes directly bound to the application */ - if ((obj = [super lookupName:_key inContext:_ctx acquire:NO])) - return obj; - - if ([_key hasPrefix:@"_custom_"]) - return [self customGroup:_key inContext:_ctx]; - - /* return 404 to stop acquisition */ - return [NSException exceptionWithHTTPStatus:404 /* Not Found */]; + obj = [super lookupName: _key inContext: _ctx acquire: NO]; + if (!obj) + { + if ([_key hasPrefix: @"_custom_"]) + obj = [self customGroup: _key inContext: _ctx]; + else + obj = [NSException exceptionWithHTTPStatus:404 /* Not Found */]; + } + + return obj; } @end /* SOGoGroupsFolder */ diff --git a/SoObjects/SOGo/SOGoLRUCache.h b/SoObjects/SOGo/SOGoLRUCache.h deleted file mode 100644 index a7cee3c2..00000000 --- a/SoObjects/SOGo/SOGoLRUCache.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2000-2004 SKYRIX Software AG - - This file is part of OGo - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo 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 Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. - */ - -#ifndef __SOGoLRUCache_H_ -#define __SOGoLRUCache_H_ - -#import - -@interface SOGoLRUCache : NSObject -{ - unsigned size; - NSMutableDictionary *entries; -} - -- (id)initWithCacheSize:(unsigned)_size; - -- (void)addObject:(id)_obj forKey:(id)_key; -- (id)objectForKey:(id)_key; - -@end - -#endif /* __SOGoLRUCache_H_ */ diff --git a/SoObjects/SOGo/SOGoLRUCache.m b/SoObjects/SOGo/SOGoLRUCache.m deleted file mode 100644 index 9fdacf5c..00000000 --- a/SoObjects/SOGo/SOGoLRUCache.m +++ /dev/null @@ -1,112 +0,0 @@ -/* - Copyright (C) 2000-2004 SKYRIX Software AG - - This file is part of OGo - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo 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 Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. - */ - -#include "SOGoLRUCache.h" -#include "common.h" - -@interface SOGoLRUCacheItem : NSObject -{ - id object; - unsigned useCount; -} - -- (id)initWithObject:(id)_obj; -- (id)object; - -- (unsigned)useCount; - -@end - -@implementation SOGoLRUCacheItem - -- (id)initWithObject:(id)_obj { - self = [super init]; - if(self) { - ASSIGN(self->object, _obj); - self->useCount = 1; - } - return self; -} - -- (id)object { - self->useCount++; - return self->object; -} - -- (unsigned)useCount { - return self->useCount; -} - -@end - -@implementation SOGoLRUCache - -- (id)initWithCacheSize:(unsigned)_size { - self = [super init]; - if(self) { - self->size = _size; - self->entries = [[NSMutableDictionary alloc] initWithCapacity:_size]; - } - return self; -} - -- (void)dealloc { - [self->entries release]; - [super dealloc]; -} - -- (void)addObject:(id)_obj forKey:(id)_key { - SOGoLRUCacheItem *item; - - NSAssert(_obj, @"Attempt to insert nil object!"); - - if([self->entries count] >= self->size) { - /* need to find minimum and get rid of it */ - NSEnumerator *keyEnum; - SOGoLRUCacheItem *item; - id key, leastUsedItemKey; - unsigned minimumUseCount = INT_MAX; - - keyEnum = [self->entries keyEnumerator]; - while((key = [keyEnum nextObject])) { - item = [self->entries objectForKey:key]; - if([item useCount] < minimumUseCount) { - minimumUseCount = [item useCount]; - leastUsedItemKey = key; - } - } - [self->entries removeObjectForKey:leastUsedItemKey]; - } - item = [[SOGoLRUCacheItem alloc] initWithObject:_obj]; - [self->entries setObject:item forKey:_key]; - [item release]; -} - -- (id)objectForKey:(id)_key { - SOGoLRUCacheItem *item; - - item = [self->entries objectForKey:_key]; - if(!item) - return nil; - return [item object]; -} - -@end diff --git a/SoObjects/SOGo/SOGoUser.h b/SoObjects/SOGo/SOGoUser.h index c41acfc9..7d681642 100644 --- a/SoObjects/SOGo/SOGoUser.h +++ b/SoObjects/SOGo/SOGoUser.h @@ -22,7 +22,7 @@ #ifndef __SOGoUser_H__ #define __SOGoUser_H__ -#include +#import /* SOGoUser @@ -41,19 +41,29 @@ @class NSUserDefaults; @class NSTimeZone; @class WOContext; +@class SOGoDateFormatter; + +extern NSString *SOGoWeekStartHideWeekNumbers; +extern NSString *SOGoWeekStartJanuary1; +extern NSString *SOGoWeekStartFirst4DayWeek; +extern NSString *SOGoWeekStartFirstFullWeek; @interface SOGoUser : SoUser { + NSString *currentPassword; NSString *cn; NSString *language; NSArray *allEmails; NSUserDefaults *userDefaults; NSUserDefaults *userSettings; NSTimeZone *userTimeZone; + SOGoDateFormatter *dateFormatter; } + (SOGoUser *) userWithLogin: (NSString *) login roles: (NSArray *) roles; +- (void) setCurrentPassword: (NSString *) newPassword; +- (NSString *) currentPassword; /* properties */ @@ -68,6 +78,8 @@ - (NSString *) cn; - (NSURL *) freeBusyURL; +- (SOGoDateFormatter *) dateFormatterInContext: (WOContext *) context; + /* shares and identities */ - (NSString *) primaryIMAP4AccountString; diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index d60b5dc2..a79694b9 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -29,7 +29,8 @@ #import "AgenorUserDefaults.h" #import "LDAPUserManager.h" -#import "SOGoContentObject.h" +#import "SOGoDateFormatter.h" +#import "SOGoObject.h" #import "SOGoPermissions.h" #import "NSArray+Utilities.h" @@ -40,6 +41,11 @@ static NSString *fallbackIMAP4Server = nil; static NSString *defaultLanguage = nil; static NSURL *AgenorProfileURL = nil; +NSString *SOGoWeekStartHideWeekNumbers = @"HideWeekNumbers"; +NSString *SOGoWeekStartJanuary1 = @"January1"; +NSString *SOGoWeekStartFirst4DayWeek = @"First4DayWeek"; +NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; + @interface NSObject (SOGoRoles) - (NSArray *) rolesOfUser: (NSString *) uid; @@ -98,6 +104,8 @@ static NSURL *AgenorProfileURL = nil; userSettings = nil; allEmails = nil; language = nil; + currentPassword = nil; + dateFormatter = nil; } return self; @@ -125,13 +133,25 @@ static NSURL *AgenorProfileURL = nil; - (void) dealloc { + [currentPassword release]; [userDefaults release]; [userSettings release]; [allEmails release]; [language release]; + [dateFormatter release]; [super dealloc]; } +- (void) setCurrentPassword: (NSString *) newPassword +{ + ASSIGN (currentPassword, newPassword); +} + +- (NSString *) currentPassword +{ + return currentPassword; +} + - (id) _fetchFieldForUser: (NSString *) field { NSDictionary *contactInfos; @@ -232,6 +252,30 @@ static NSURL *AgenorProfileURL = nil; return nil; } +- (SOGoDateFormatter *) dateFormatterInContext: (WOContext *) context +{ + NSString *format; + NSUserDefaults *ud; + + if (!dateFormatter) + { + dateFormatter = [SOGoDateFormatter new]; + [dateFormatter setLocale: [context valueForKey: @"locale"]]; + ud = [self userDefaults]; + format = [ud stringForKey: @"ShortDateFormat"]; + if (format) + [dateFormatter setShortDateFormat: format]; + format = [ud stringForKey: @"LongDateFormat"]; + if (format) + [dateFormatter setLongDateFormat: format]; + format = [ud stringForKey: @"TimeFormat"]; + if (format) + [dateFormatter setTimeFormat: format]; + } + + return dateFormatter; +} + /* defaults */ - (NSUserDefaults *) userDefaults @@ -309,8 +353,10 @@ static NSURL *AgenorProfileURL = nil; if ([folder isKindOfClass:[NSException class]]) return folder; - [(WOContext *)_ctx setObject:folder ? folder : [NSNull null] - forKey: @"ActiveUserHomeFolder"]; + [(WOContext *)_ctx setObject: ((folder) + ? folder + : [NSNull null]) + forKey: @"ActiveUserHomeFolder"]; return folder; } diff --git a/SoObjects/SOGo/SOGoUserFolder.m b/SoObjects/SOGo/SOGoUserFolder.m index 8664beed..3fc0684e 100644 --- a/SoObjects/SOGo/SOGoUserFolder.m +++ b/SoObjects/SOGo/SOGoUserFolder.m @@ -19,15 +19,19 @@ 02111-1307, USA. */ -#import "WOContext+Agenor.h" -#import "common.h" -#import "SOGoUser.h" +#import +#import + +#import +#import + +#import +#import +#import +#import -#import "Appointments/SOGoAppointmentFolder.h" -#import "Appointments/SOGoFreeBusyObject.h" -#import "Contacts/SOGoContactFolders.h" -#import "Mailer/SOGoMailAccounts.h" #import "SOGoPermissions.h" +#import "SOGoUser.h" #import "SOGoUserFolder.h" diff --git a/SoObjects/SOGo/WOContext+Agenor.h b/SoObjects/SOGo/WOContext+Agenor.h deleted file mode 100644 index 759e3fc9..00000000 --- a/SoObjects/SOGo/WOContext+Agenor.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo 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 Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SOGo_WOContext_Agenor_H_ -#define __SOGo_WOContext_Agenor_H_ - -#include - -@interface WOContext (Agenor) - -- (BOOL)isAccessFromIntranet; - -@end - -#endif /* __SOGo_WOContext_Agenor_H_ */ diff --git a/SoObjects/SOGo/WOContext+Agenor.m b/SoObjects/SOGo/WOContext+Agenor.m deleted file mode 100644 index f8d246fd..00000000 --- a/SoObjects/SOGo/WOContext+Agenor.m +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo 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 Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "WOContext+Agenor.h" -#include "common.h" - -@implementation WOContext(Agenor) - -static EOQualifier *internetDetectQualifier = nil; - -static EOQualifier *getInternetDetectQualifier(void) { - static BOOL didCheck = NO; - NSUserDefaults *ud; - NSString *s; - - if (didCheck) return internetDetectQualifier; - - ud = [NSUserDefaults standardUserDefaults]; - - if ((s = [ud stringForKey:@"SOGoInternetDetectQualifier"]) != nil) { - internetDetectQualifier = - [[EOQualifier qualifierWithQualifierFormat:s] retain]; - if (internetDetectQualifier == nil) - NSLog(@"ERROR: could not parse qualifier: '%@'", s); - } - if (internetDetectQualifier == nil) - NSLog(@"Note: no 'SOGoInternetDetectQualifier' configured."); - else { - NSLog(@"Note: detect Internet access using: %@", - internetDetectQualifier); - } - - didCheck = YES; - return internetDetectQualifier; -} - -- (BOOL)isAccessFromIntranet { - id q; - NSNumber *bv; - WORequest *rq; - BOOL ok; - - if ((bv = [self objectForKey:@"_agenorUnrestricedAccess"]) != nil) - return [bv boolValue]; - - if ((rq = [self request]) == nil) { - [self logWithFormat:@"ERROR: got no request for context!"]; - return NO; - } - - - if ((q = (id)getInternetDetectQualifier()) == nil) - /* if no qualifier is set, allow access */ - ok = YES; - else - /* is Internet request? */ - ok = [q evaluateWithObject:[rq headers]] ? NO : YES; - - bv = [NSNumber numberWithBool:ok]; - [self setObject:bv forKey:@"_agenorUnrestricedAccess"]; - return ok; -} - -@end /* WOContext(Agenor) */ diff --git a/SoObjects/SOGo/common.h b/SoObjects/SOGo/common.h deleted file mode 100644 index f6659b74..00000000 --- a/SoObjects/SOGo/common.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (C) 2002-2004 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo 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 Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ -// $Id$ - -#import - -#if NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY -# include -# include -#endif - -#include -#include -#include diff --git a/UI/Common/UIxPageFrame.m b/UI/Common/UIxPageFrame.m index e01a23f3..77209b05 100644 --- a/UI/Common/UIxPageFrame.m +++ b/UI/Common/UIxPageFrame.m @@ -131,6 +131,11 @@ return [self relativePathToUserFolderSubPath: @"Mail/"]; } +- (NSString *) relativePreferencesPath +{ + return [self relativePathToUserFolderSubPath: @"preferences"]; +} + - (NSString *) logoffPath { return [self relativePathToUserFolderSubPath: @"logoff"]; diff --git a/UI/GNUmakefile b/UI/GNUmakefile index 89d5e12b..9521d488 100644 --- a/UI/GNUmakefile +++ b/UI/GNUmakefile @@ -4,13 +4,14 @@ include $(GNUSTEP_MAKEFILES)/common.make SUBPROJECTS += \ - SOGoUI \ - MainUI \ Common \ - Scheduler \ Contacts \ MailerUI \ MailPartViewers \ + MainUI \ + PreferencesUI \ + Scheduler \ + SOGoUI \ Templates include $(GNUSTEP_MAKEFILES)/aggregate.make diff --git a/UI/MailPartViewers/UIxMailPartICalViewer.m b/UI/MailPartViewers/UIxMailPartICalViewer.m index 494d21d4..bd698739 100644 --- a/UI/MailPartViewers/UIxMailPartICalViewer.m +++ b/UI/MailPartViewers/UIxMailPartICalViewer.m @@ -119,10 +119,10 @@ - (SOGoDateFormatter *)dateFormatter { if (self->dateFormatter == nil) { - self->dateFormatter = - [[SOGoDateFormatter alloc] initWithLocale:[self locale]]; - [self->dateFormatter setFullWeekdayNameAndDetails]; + dateFormatter = [[context activeUser] dateFormatterInContext: context]; + [dateFormatter retain]; } + return self->dateFormatter; } diff --git a/UI/MailerUI/UIxMailEditor.m b/UI/MailerUI/UIxMailEditor.m index cb4954e4..6b530be2 100644 --- a/UI/MailerUI/UIxMailEditor.m +++ b/UI/MailerUI/UIxMailEditor.m @@ -40,7 +40,6 @@ #import #import #import -#import #import /* @@ -226,19 +225,6 @@ static NSArray *infoKeys = nil; return [self labelForKey:@"Compose Mail"]; } -/* detect webmail being accessed from the outside */ - -- (BOOL)isInternetRequest { - // DEPRECATED - return [[self context] isAccessFromIntranet] ? NO : YES; -} - -- (BOOL)showInternetMarker { - if (!showInternetMarker) - return NO; - return [[self context] isAccessFromIntranet] ? NO : YES; -} - /* info loading */ - (void)loadInfo:(NSDictionary *)_info { @@ -507,7 +493,6 @@ static NSArray *infoKeys = nil; { NSException *error; NSString *mailPath; - NSDictionary *h; id result; // TODO: need to validate whether we have a To etc @@ -529,12 +514,10 @@ static NSArray *infoKeys = nil; /* setup some extra headers if required */ - h = [[self context] isAccessFromIntranet] ? nil : internetMailHeaders; - /* save mail to file (so that we can upload the mail to Cyrus) */ // TODO: all this could be handled by the SOGoDraftObject? - mailPath = [[self clientObject] saveMimeMessageToTemporaryFileWithHeaders:h]; + mailPath = [[self clientObject] saveMimeMessageToTemporaryFileWithHeaders: internetMailHeaders]; /* then, send mail */ diff --git a/UI/MailerUI/UIxMailListView.h b/UI/MailerUI/UIxMailListView.h index c98cb4ba..7d7fd458 100644 --- a/UI/MailerUI/UIxMailListView.h +++ b/UI/MailerUI/UIxMailListView.h @@ -22,9 +22,10 @@ #ifndef UIXMAILLISTVIEW_H #define UIXMAILLISTVIEW_H -#include +#import @class EOQualifier; +@class SOGoDateFormatter; @interface UIxMailListView : UIxComponent { @@ -33,6 +34,8 @@ unsigned firstMessageNumber; id message; EOQualifier *qualifier; + SOGoDateFormatter *dateFormatter; + NSTimeZone *userTimeZone; } - (NSString *)defaultSortKey; diff --git a/UI/MailerUI/UIxMailListView.m b/UI/MailerUI/UIxMailListView.m index 86844b86..f0a2ff93 100644 --- a/UI/MailerUI/UIxMailListView.m +++ b/UI/MailerUI/UIxMailListView.m @@ -26,15 +26,24 @@ object. */ -#define messagesPerPage 50 - -#include "common.h" -#include -#include -#include +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#import +#import +#import +#import #import "UIxMailListView.h" +#define messagesPerPage 50 static int attachmentFlagSize = 8096; @implementation UIxMailListView @@ -45,6 +54,8 @@ static int attachmentFlagSize = 8096; [self->sortedUIDs release]; [self->messages release]; [self->message release]; + [dateFormatter release]; + [userTimeZone release]; [super dealloc]; } @@ -71,6 +82,16 @@ static int attachmentFlagSize = 8096; return self->message; } +- (NSString *) messageDate +{ + NSCalendarDate *messageDate; + + messageDate = [[message objectForKey: @"envelope"] date]; + [messageDate setTimeZone: userTimeZone]; + + return [dateFormatter formattedDateAndTime: messageDate]; +} + - (void) setQualifier: (EOQualifier *) _msg { ASSIGN(self->qualifier, _msg); @@ -309,10 +330,17 @@ static int attachmentFlagSize = 8096; NSArray *msgs; NSRange r; unsigned len; + SOGoUser *user; if (self->messages != nil) return self->messages; - + + user = [context activeUser]; + if (!dateFormatter) + dateFormatter = [user dateFormatterInContext: context]; + if (!userTimeZone) + ASSIGN (userTimeZone, [user timeZone]); + r = [self fetchBlock]; uids = [self sortedUIDs]; if ((len = [uids count]) > r.length) diff --git a/UI/MainUI/English.lproj/Locale b/UI/MainUI/English.lproj/Locale index ac087fc2..35be0ce4 100644 --- a/UI/MainUI/English.lproj/Locale +++ b/UI/MainUI/English.lproj/Locale @@ -1,35 +1,35 @@ /* English */ { - NSLanguageName = "English"; - NSFormalName = "English"; - NSLocaleCode = "en"; /* ISO 639-1 */ - NSLanguageCode = "eng"; /* ISO 639-2 */ - NSParentContext = ""; + NSLanguageName = "English"; + NSFormalName = "English"; + NSLocaleCode = "en"; /* ISO 639-1 */ + NSLanguageCode = "eng"; /* ISO 639-2 */ + NSParentContext = ""; - NSAMPMDesignation = (AM, PM); - NSCurrencySymbol = "$"; - NSDateFormatString = "%A, %B %e, %Y"; - NSDateTimeOrdering = MDYH; - NSDecimalDigits = ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"); - NSDecimalSeparator = "."; - NSEarlierTimeDesignations = (prior, last, past, ago); - NSHourNameDesignations = ((0, midnight), (10, morning), (12, noon, lunch), (14, afternoon), (19, dinner)); - NSInternationalCurrencyString = USD; /* ISO 4217 */ - NSLaterTimeDesignations = (next); - NSMonthNameArray = (January, February, March, April, May, June, July, August, September, October, November, December); - NSNextDayDesignations = (tomorrow); - NSNextNextDayDesignations = (nextday); - NSPriorDayDesignations = (yesterday); - NSShortDateFormatString = "%1m/%e/%y"; - NSShortMonthNameArray = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec); - NSShortTimeDateFormatString = "%1m/%e/%y %1I:%M %p"; - NSShortWeekDayNameArray = (Sun, Mon, Tue, Wed, Thu, Fri, Sat); - NSThisDayDesignations = (today, now); - NSThousandsSeparator = ","; - NSTimeDateFormatString = "%A, %B %e, %Y %1I:%M:%S %p %Z"; - NSTimeFormatString = "%1I:%M:%S %p"; - NSWeekDayNameArray = (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday); - NSYearMonthWeekDesignations = (year, month, week); - NSPositiveCurrencyFormatString = "$9,999.00"; - NSNegativeCurrencyFormatString = "-$9,999.00"; + NSAMPMDesignation = (AM, PM); + NSCurrencySymbol = "$"; + NSDateFormatString = "%A, %B %e, %Y"; + NSDateTimeOrdering = MDYH; + NSDecimalDigits = ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"); + NSDecimalSeparator = "."; + NSEarlierTimeDesignations = (prior, last, past, ago); + NSHourNameDesignations = ((0, midnight), (10, morning), (12, noon, lunch), (14, afternoon), (19, dinner)); + NSInternationalCurrencyString = USD; /* ISO 4217 */ + NSLaterTimeDesignations = (next); + NSMonthNameArray = (January, February, March, April, May, June, July, August, September, October, November, December); + NSNextDayDesignations = (tomorrow); + NSNextNextDayDesignations = (nextday); + NSPriorDayDesignations = (yesterday); + NSShortDateFormatString = "%m/%e/%y"; + NSShortMonthNameArray = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec); + NSShortTimeDateFormatString = "%m/%e/%y %I:%M %p"; + NSShortWeekDayNameArray = (Sun, Mon, Tue, Wed, Thu, Fri, Sat); + NSThisDayDesignations = (today, now); + NSThousandsSeparator = ","; + NSTimeDateFormatString = "%A, %B %e, %Y %I:%M:%S %p %Z"; + NSTimeFormatString = "%I:%M:%S %p"; + NSWeekDayNameArray = (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday); + NSYearMonthWeekDesignations = (year, month, week); + NSPositiveCurrencyFormatString = "$9,999.00"; + NSNegativeCurrencyFormatString = "-$9,999.00"; } diff --git a/UI/MainUI/French.lproj/Locale b/UI/MainUI/French.lproj/Locale index 70b8a2f6..38525b19 100644 --- a/UI/MainUI/French.lproj/Locale +++ b/UI/MainUI/French.lproj/Locale @@ -1,35 +1,35 @@ /* French */ { - NSLanguageName = "French"; - NSFormalName = "Français"; - NSLocaleCode = "fr"; /* ISO 639-1 */ - NSLanguageCode = "fra"; /* ISO 639-2 */ - NSParentContext = ""; + NSLanguageName = "French"; + NSFormalName = "Français"; + NSLocaleCode = "fr"; /* ISO 639-1 */ + NSLanguageCode = "fra"; /* ISO 639-2 */ + NSParentContext = ""; - NSCurrencySymbol = " €"; - NSDateFormatString = "%A %e %B %Y"; - NSDateTimeOrdering = DMYH; - NSDecimalDigits = ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"); - NSDecimalSeparator = ","; - NSEarlierTimeDesignations = (dernier, "dernière", derniers, "dernières"); - NSHourNameDesignations = ((0, minuit), (12, midi), (10, matin), (14, "après-midi"), (19, soir)); - NSInternationalCurrencyString = EUR; /* ISO 4217 */ - NSLaterTimeDesignations = (prochain, prochaine, prochains, prochaines); - NSMonthNameArray = (Janvier, "Février", Mars, Avril, Mai, Juin, Juillet, "Août", Septembre, Octobre, Novembre, "Décembre"); - NSNextDayDesignations = (demain); - NSNextNextDayDesignations = ("après-demain"); - NSPriorDayDesignations = (hier); - NSShortDateFormatString = "%e/%m/%y"; - NSShortMonthNameArray = (Jan, "Fév", Mar, Avr, Mai, Jun, Jul, "Aoû", Sep, Oct, Nov, "Déc"); - NSShortTimeDateFormatString = "%e/%m/%y %1H:%M"; - NSShortWeekDayNameArray = (Dim, Lun, Mar, Mer, Jeu, Ven, Sam); - NSThisDayDesignations = ("aujourd'hui"); - NSThousandsSeparator = " "; /* space */ - NSTimeDateFormatString = "%A %e %B %Y %1H:%M:%S %Z"; - NSTimeFormatString = "%1H:%M:%S"; /* no space before and after colons*/ - NSWeekDayNameArray = (Dimanche, Lundi, Mardi, Mercredi, Jeudi, Vendredi, Samedi); - NSYearMonthWeekDesignations = ("année", mois, semaine); - NSAMPMDesignation = (AM, PM); - NSPositiveCurrencyFormatString = "9,999.00$"; - NSNegativeCurrencyFormatString = "-9,999.00$"; + NSCurrencySymbol = " €"; + NSDateFormatString = "%A %e %B %Y"; + NSDateTimeOrdering = DMYH; + NSDecimalDigits = ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"); + NSDecimalSeparator = ","; + NSEarlierTimeDesignations = (dernier, "dernière", derniers, "dernières"); + NSHourNameDesignations = ((0, minuit), (12, midi), (10, matin), (14, "après-midi"), (19, soir)); + NSInternationalCurrencyString = EUR; /* ISO 4217 */ + NSLaterTimeDesignations = (prochain, prochaine, prochains, prochaines); + NSMonthNameArray = (Janvier, "Février", Mars, Avril, Mai, Juin, Juillet, "Août", Septembre, Octobre, Novembre, "Décembre"); + NSNextDayDesignations = (demain); + NSNextNextDayDesignations = ("après-demain"); + NSPriorDayDesignations = (hier); + NSShortDateFormatString = "%e/%m/%y"; + NSShortMonthNameArray = (Jan, "Fév", Mar, Avr, Mai, Jun, Jul, "Aoû", Sep, Oct, Nov, "Déc"); + NSShortTimeDateFormatString = "%e/%m/%y %H:%M"; + NSShortWeekDayNameArray = (Dim, Lun, Mar, Mer, Jeu, Ven, Sam); + NSThisDayDesignations = ("aujourd'hui"); + NSThousandsSeparator = " "; /* space */ + NSTimeDateFormatString = "%A %e %B %Y %H:%M:%S %Z"; + NSTimeFormatString = "%H:%M:%S"; /* no space before and after colons*/ + NSWeekDayNameArray = (Dimanche, Lundi, Mardi, Mercredi, Jeudi, Vendredi, Samedi); + NSYearMonthWeekDesignations = ("année", mois, semaine); + NSAMPMDesignation = (AM, PM); + NSPositiveCurrencyFormatString = "9,999.00$"; + NSNegativeCurrencyFormatString = "-9,999.00$"; } diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings new file mode 100644 index 00000000..28a5e753 --- /dev/null +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -0,0 +1,73 @@ +/* toolbar */ +"Save and Close" = "Save and Close"; +"Close" = "Close"; + +/* tabs */ +"Out of Office" = "Out of Office"; +"Date and Time" = "Date and Time"; +"Calendar Options" = "Calendar Options"; +"Password" = "Password"; + +/* ooo */ +"I'm currently in the office" = "I'm currently in the office"; +"I'm currently out of the office" = "I'm currently out of the office"; +"AutoReply only once to each sender with the following text :" += "AutoReply only once to each sender with the following text :"; + +/* d & t */ +"Current Time Zone :" = "Current Time Zone :"; +"Short Date Format :" = "Short Date Format :"; +"Long Date Format :" = "Long Date Format :"; +"Time Format :" = "Time Format :"; + +"shortDateFmt_0" = "%m/%e/%Y"; +"shortDateFmt_1" = "%m/%e/%y"; +"shortDateFmt_2" = "%m/%d/%Y"; +"shortDateFmt_3" = "%m/%d/%y"; +"shortDateFmt_4" = "%y/%m/%d"; +"shortDateFmt_5" = "%Y-%m-%d"; +"shortDateFmt_6" = "%d-%b-%y"; +"shortDateFmt_7" = ""; + +"longDateFmt_0" = "%A, %B %d, %Y"; +"longDateFmt_1" = "%B %d, %Y"; +"longDateFmt_2" = "%A, %d %B, %Y"; +"longDateFmt_3" = "%d %B, %Y"; +"longDateFmt_4" = ""; + +"timeFmt_0" = "%I:%M %p"; +"timeFmt_1" = "%H:%M"; +"timeFmt_2" = ""; + +/* calendar */ +"Week begins on :" = "Week begins on :"; +"Day start time :" = "Day start time :"; +"Day end time :" = "Day end time :"; +"First week of year :" = "First week of year :"; +"Enable reminders for Calendar items" = "Enable reminders for Calendar items"; +"Play a sound when a reminder comes due" += "Play a sound when a reminder comes due"; +"Default reminder :" = "Default reminder :"; + +"firstWeekOfYear_HideWeekNumbers" = "Do not display week numbers"; +"firstWeekOfYear_January1" = "Starts on january 1"; +"firstWeekOfYear_First4DayWeek" = "First 4-day week"; +"firstWeekOfYear_FirstFullWeek" = "First full week"; + +"reminderTime_0000" = "0 minutes"; +"reminderTime_0005" = "5 minutes"; +"reminderTime_0010" = "10 minutes"; +"reminderTime_0015" = "15 minutes"; +"reminderTime_0030" = "30 minutes"; +"reminderTime_0100" = "1 hour"; +"reminderTime_0200" = "2 hours"; +"reminderTime_0400" = "2 hours"; +"reminderTime_0800" = "2 hours"; +"reminderTime_1200" = "1/2 day"; +"reminderTime_2400" = "1 day"; +"reminderTime_4800" = "2 days"; + +/* password */ +"New password:" = "New password:"; +"Confirmation:" = "Confirmation:"; +"Change" = "Change"; diff --git a/UI/PreferencesUI/French.lproj/Localizable.strings b/UI/PreferencesUI/French.lproj/Localizable.strings new file mode 100644 index 00000000..74b46dd5 --- /dev/null +++ b/UI/PreferencesUI/French.lproj/Localizable.strings @@ -0,0 +1,70 @@ +/* toolbar */ +"Save and Close" = "Enregistrer et fermer"; +"Close" = "Fermer"; + +/* tabs */ +"Out of Office" = "Absence du bureau"; +"Date and Time" = "Date et heure"; +"Calendar Options" = "Calendrier"; +"Password" = "Mot de passe"; + +/* ooo */ +"I'm currently in the office" = "Je suis présent"; +"I'm currently out of the office" = "Je suis absent"; +"AutoReply only once to each sender with the following text :" += "Répondre automatiquement avec le texte suivant, une seule fois par expéditeur :"; + +/* d & t */ +"Current Time Zone :" = "Fuseau horaire en cours :"; +"Short Date Format :" = "Style de date courte :"; +"Long Date Format :" = "Style de date longue :"; +"Time Format :" = "Style de l'heure :"; + +"shortDateFmt_0" = "%d/%m/%Y"; +"shortDateFmt_1" = "%d/%m/%y"; +"shortDateFmt_2" = "%d.%m.%y"; +"shortDateFmt_3" = "%d-%m-%y"; +"shortDateFmt_4" = "%Y-%m-%d"; +"shortDateFmt_5" = ""; + +"longDateFmt_0" = "%A %e %B %Y"; +"longDateFmt_1" = "%e %b. %Y"; +"longDateFmt_2" = "%e %B %Y"; +"longDateFmt_3" = ""; + +"timeFmt_0" = "%H:%M"; +"timeFmt_1" = "%H.%M"; +"timeFmt_2" = "%H h. %M"; +"timeFmt_3" = ""; + +/* calendar */ +"Week begins on :" = "Premier jour de la semaine :"; +"Day start time :" = "Début de la journée :"; +"Day end time :" = "Fin de la journée :"; +"First week of year :" = "Première semaine de l'année :"; +"Enable reminders for Calendar items" = "Activer les rappels pour les éléments du calendrier"; +"Play a sound when a reminder comes due" = "Émettre un signal sonore à l'échéance du rappel"; +"Default reminder :" = "Rappel par défaut :"; + +"firstWeekOfYear_HideWeekNumbers" = "Ne pas afficher le numéro des semaines"; +"firstWeekOfYear_January1" = "Commence le 1er janvier"; +"firstWeekOfYear_First4DayWeek" = "Première semaine de 4 jours"; +"firstWeekOfYear_FirstFullWeek" = "Première semaine entière"; + +"reminderTime_0000" = "0 minutes"; +"reminderTime_0005" = "5 minutes"; +"reminderTime_0010" = "10 minutes"; +"reminderTime_0015" = "15 minutes"; +"reminderTime_0030" = "30 minutes"; +"reminderTime_0100" = "1 heure"; +"reminderTime_0200" = "2 heures"; +"reminderTime_0400" = "2 heures"; +"reminderTime_0800" = "2 heures"; +"reminderTime_1200" = "1/2 journée"; +"reminderTime_2400" = "1 journée"; +"reminderTime_4800" = "2 journées"; + +/* password */ +"New password:" = "Nouveau mot de passe :"; +"Confirmation:" = "Confirmation :"; +"Change" = "Changer"; diff --git a/UI/PreferencesUI/GNUmakefile b/UI/PreferencesUI/GNUmakefile new file mode 100644 index 00000000..86fe2827 --- /dev/null +++ b/UI/PreferencesUI/GNUmakefile @@ -0,0 +1,32 @@ +# GNUstep makefile + +include ../common.make + +BUNDLE_NAME = PreferencesUI + +PreferencesUI_PRINCIPAL_CLASS = PreferencesUIProduct + +PreferencesUI_LANGUAGES = English French + +PreferencesUI_OBJC_FILES = \ + PreferencesUIProduct.m \ + \ + UIxJSONPreferences.m \ + UIxPreferences.m + +PreferencesUI_RESOURCE_FILES += \ + Version \ + product.plist + +PreferencesUI_RESOURCE_FILES += \ + Toolbars/UIxPreferences.toolbar + +PreferencesUI_LOCALIZED_RESOURCE_FILES += \ + Localizable.strings \ + +-include GNUmakefile.preamble +include $(GNUSTEP_MAKEFILES)/bundle.make +-include GNUmakefile.postamble +include ../../fhsbundle.make + + diff --git a/UI/PreferencesUI/PreferencesUIProduct.m b/UI/PreferencesUI/PreferencesUIProduct.m new file mode 100644 index 00000000..9f569d1a --- /dev/null +++ b/UI/PreferencesUI/PreferencesUIProduct.m @@ -0,0 +1,33 @@ +/* PreferencesUIProduct.m - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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. + */ + +#import + +@interface PreferencesUIProduct : NSObject +{ +} + +@end + +@implementation PreferencesUIProduct + +@end diff --git a/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar b/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar new file mode 100644 index 00000000..b30200e8 --- /dev/null +++ b/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar @@ -0,0 +1,12 @@ +( /* the toolbar groups -*-cperl-*- */ + ( { link = "#"; + label = "Save and Close"; + onclick = "return savePreferences();"; + image = "tb-compose-save-flat-24x24.png"; }, + { link = "#"; + isSafe = NO; + label = "Close"; + onclick = "window.close(); return false;"; + image = "tb-mail-stop-flat-24x24.png"; } + ) +) diff --git a/UI/PreferencesUI/UIxJSONPreferences.h b/UI/PreferencesUI/UIxJSONPreferences.h new file mode 100644 index 00000000..df398205 --- /dev/null +++ b/UI/PreferencesUI/UIxJSONPreferences.h @@ -0,0 +1,32 @@ +/* UIxJSONPreferences.h - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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 UIXJSONPREFERENCES_H +#define UIXJSONPREFERENCES_H + +#import + +@interface UIxJSONPreferences : WODirectAction + +@end + +#endif /* UIXJSONSETTINGS_H */ diff --git a/UI/PreferencesUI/UIxJSONPreferences.m b/UI/PreferencesUI/UIxJSONPreferences.m new file mode 100644 index 00000000..96f1d35f --- /dev/null +++ b/UI/PreferencesUI/UIxJSONPreferences.m @@ -0,0 +1,52 @@ +/* UIxJSONPreferences.m - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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. + */ + +#import + +#import +#import + +#import + +#import "UIxJSONPreferences.h" + +@implementation UIxJSONPreferences + +- (WOResponse *) jsonDefaultsAction +{ + NSUserDefaults *defaults; + + defaults = [[context activeUser] userDefaults]; + + return [defaults jsonRepresentation]; +} + +- (WOResponse *) jsonSettingsAction +{ + NSUserDefaults *settings; + + settings = [[context activeUser] userSettings]; + + return [settings jsonRepresentation]; +} + +@end diff --git a/UI/PreferencesUI/UIxPreferences.h b/UI/PreferencesUI/UIxPreferences.h new file mode 100644 index 00000000..5570fbc7 --- /dev/null +++ b/UI/PreferencesUI/UIxPreferences.h @@ -0,0 +1,45 @@ +/* UIxPreferences.h - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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 UIXPREFERENCES_H +#define UIXPREFERENCES_H + +#import + +@class NSString; +@class NSUserDefaults; + +@class SOGoUser; + +@interface UIxPreferences : UIxComponent +{ + NSString *item; + SOGoUser *user; + NSUserDefaults *userDefaults; + NSCalendarDate *today; + NSMutableArray *hours; + NSArray *daysOfWeek; +} + +@end + +#endif /* UIXPREFERENCES_H */ diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m new file mode 100644 index 00000000..2c8c486b --- /dev/null +++ b/UI/PreferencesUI/UIxPreferences.m @@ -0,0 +1,429 @@ +/* UIxPreferences.m - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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. + */ + +#import +#import +#import +#import + +#import +#import + +#import + +#import "UIxPreferences.h" + +#warning this class is not finished +/* remaining: + default event length + default snooze length + refresh calendar every X minutes + workweek = from -> to + identities */ + +@implementation UIxPreferences + +- (id) init +{ + NSDictionary *locale; + + if ((self = [super init])) + { + item = nil; + hours = nil; + ASSIGN (user, [context activeUser]); + ASSIGN (userDefaults, [user userDefaults]); + ASSIGN (today, [NSCalendarDate date]); + locale = [context valueForKey: @"locale"]; + ASSIGN (daysOfWeek, + [locale objectForKey: NSWeekDayNameArray]); + } + + return self; +} + +- (void) dealloc +{ + [today release]; + [item release]; + [user release]; + [userDefaults release]; + [hours release]; + [daysOfWeek release]; + [super dealloc]; +} + +- (void) setItem: (NSString *) newItem +{ + ASSIGN (item, newItem); +} + +- (NSString *) item +{ + return item; +} + +- (NSString *) inTheOffice +{ + NSString *inTheOffice; + + inTheOffice = [userDefaults objectForKey: @"InTheOffice"]; + + return ((!inTheOffice || [inTheOffice boolValue]) + ? @"YES" : @"NO"); +} + +- (void) setInTheOffice: (NSString *) newValue +{ + [userDefaults setObject: newValue forKey: @"InTheOffice"]; +} + +- (void) setAutoReplyText: (NSString *) newAutoReplyText +{ + [userDefaults setObject: newAutoReplyText forKey: @"AutoReplyText"]; +} + +- (NSString *) autoReplyText +{ + return [userDefaults objectForKey: @"AutoReplyText"]; +} + +- (NSArray *) timeZonesList +{ + return [NSTimeZone knownTimeZoneNames]; +} + +- (NSString *) userTimeZone +{ + return [[user timeZone] timeZoneName]; +} + +- (void) setUserTimeZone: (NSString *) newUserTimeZone +{ + [userDefaults setObject: newUserTimeZone forKey: @"TimeZone"]; +} + +- (NSArray *) shortDateFormatsList +{ + NSMutableArray *shortDateFormatsList = nil; + NSString *key, *currentFormat; + unsigned int nbr; + BOOL done; + + shortDateFormatsList = [NSMutableArray array]; + + nbr = 0; + done = NO; + while (!done) + { + key = [NSString stringWithFormat: @"shortDateFmt_%d", nbr]; + currentFormat = [self labelForKey: key]; + if ([currentFormat length] > 0) + { + [shortDateFormatsList addObject: currentFormat]; + nbr++; + } + else + done = YES; + } + + return shortDateFormatsList; +} + +- (NSString *) itemShortDateFormatText +{ + return [today descriptionWithCalendarFormat: item + locale: [context valueForKey: @"locale"]]; +} + +- (NSString *) userShortDateFormat +{ + return [userDefaults objectForKey: @"ShortDateFormat"]; +} + +- (void) setUserShortDateFormat: (NSString *) newFormat +{ + [userDefaults setObject: newFormat forKey: @"ShortDateFormat"]; +} + +- (NSArray *) longDateFormatsList +{ + NSMutableArray *longDateFormatsList = nil; + NSString *key, *currentFormat; + unsigned int nbr; + BOOL done; + + longDateFormatsList = [NSMutableArray array]; + + nbr = 0; + done = NO; + while (!done) + { + key = [NSString stringWithFormat: @"longDateFmt_%d", nbr]; + currentFormat = [self labelForKey: key]; + if ([currentFormat length] > 0) + { + [longDateFormatsList addObject: currentFormat]; + nbr++; + } + else + done = YES; + } + + return longDateFormatsList; +} + +- (NSString *) itemLongDateFormatText +{ + return [today descriptionWithCalendarFormat: item + locale: [context valueForKey: @"locale"]]; +} + +- (NSString *) userLongDateFormat +{ + return [userDefaults objectForKey: @"LongDateFormat"]; +} + +- (void) setUserLongDateFormat: (NSString *) newFormat +{ + [userDefaults setObject: newFormat forKey: @"LongDateFormat"]; +} + +- (NSArray *) timeFormatsList +{ + NSMutableArray *timeFormatsList = nil; + NSString *key, *currentFormat; + unsigned int nbr; + BOOL done; + + timeFormatsList = [NSMutableArray array]; + + nbr = 0; + done = NO; + while (!done) + { + key = [NSString stringWithFormat: @"timeFmt_%d", nbr]; + currentFormat = [self labelForKey: key]; + if ([currentFormat length] > 0) + { + [timeFormatsList addObject: currentFormat]; + nbr++; + } + else + done = YES; + } + + return timeFormatsList; +} + +- (NSString *) itemTimeFormatText +{ + return [today descriptionWithCalendarFormat: item + locale: [context valueForKey: @"locale"]]; +} + +- (NSString *) userTimeFormat +{ + return [userDefaults objectForKey: @"TimeFormat"]; +} + +- (void) setUserTimeFormat: (NSString *) newFormat +{ + [userDefaults setObject: newFormat forKey: @"TimeFormat"]; +} + +- (NSArray *) daysList +{ + NSMutableArray *daysList; + unsigned int currentDay; + + daysList = [NSMutableArray new]; + [daysList autorelease]; + for (currentDay = 0; currentDay < 7; currentDay++) + [daysList addObject: [NSString stringWithFormat: @"%d", currentDay]]; + + return daysList; +} + +- (NSString *) itemWeekStartDay +{ + return [daysOfWeek objectAtIndex: [item intValue]]; +} + +- (NSString *) userWeekStartDay +{ + return [userDefaults objectForKey: @"WeekStartDay"]; +} + +- (void) setUserWeekStartDay: (NSString *) newDay +{ + [userDefaults setObject: newDay forKey: @"WeekStartDay"]; +} + +- (NSArray *) hoursList +{ + unsigned int currentHour; + + if (!hours) + { + hours = [[NSMutableArray alloc] initWithCapacity: 24]; + for (currentHour = 0; currentHour < 24; currentHour++) + [hours addObject: [NSString stringWithFormat: @"%.2d:00", + currentHour]]; + } + + return hours; +} + +- (NSString *) userDayStartTime +{ + NSString *time; + + time = [userDefaults objectForKey: @"DayStartTime"]; + if (!time) + time = @"08:00"; + + return time; +} + +- (void) setUserDayStartTime: (NSString *) newTime +{ + [userDefaults setObject: newTime forKey: @"DayStartTime"]; +} + +- (NSString *) userDayEndTime +{ + NSString *time; + + time = [userDefaults objectForKey: @"DayEndTime"]; + if (!time) + time = @"18:00"; + + return time; +} + +- (void) setUserDayEndTime: (NSString *) newTime +{ + [userDefaults setObject: newTime forKey: @"DayEndTime"]; +} + +- (NSArray *) firstWeekList +{ + return [NSArray arrayWithObjects: SOGoWeekStartHideWeekNumbers, + SOGoWeekStartJanuary1, + SOGoWeekStartFirst4DayWeek, + SOGoWeekStartFirstFullWeek, nil]; +} + +- (NSString *) itemFirstWeekText +{ + return [self labelForKey: [NSString stringWithFormat: @"firstWeekOfYear_%@", + item]]; +} + +- (NSString *) userFirstWeek +{ + return [userDefaults objectForKey: @"FirstWeek"]; +} + +- (void) setUserFirstWeek: (NSString *) newFirstWeek +{ + [userDefaults setObject: newFirstWeek forKey: @"FirstWeek"]; +} + +- (NSString *) reminderEnabled +{ + NSString *reminderEnabled; + + reminderEnabled = [userDefaults objectForKey: @"ReminderEnabled"]; + + return ((!reminderEnabled || [reminderEnabled boolValue]) + ? @"YES" : @"NO"); +} + +- (void) setReminderEnabled: (NSString *) newValue +{ + [userDefaults setObject: newValue forKey: @"ReminderEnabled"]; +} + +- (NSString *) remindWithASound +{ + NSString *remindWithASound; + + remindWithASound = [userDefaults objectForKey: @"RemindWithASound"]; + + return ((!remindWithASound || [remindWithASound boolValue]) + ? @"YES" : @"NO"); +} + +- (void) setRemindWithASound: (NSString *) newValue +{ + [userDefaults setObject: newValue forKey: @"RemindWithASound"]; +} + +- (NSArray *) reminderTimesList +{ + return [NSArray arrayWithObjects: @"0000", @"0005", @"0010", @"0015", + @"0030", @"0100", @"0200", @"0400", @"0800", @"1200", + @"2400", @"4800", nil]; +} + +- (NSString *) itemReminderTimeText +{ + return [self labelForKey: + [NSString stringWithFormat: @"reminderTime_%@", item]]; +} + +- (NSString *) userReminderTime +{ + return [userDefaults objectForKey: @"ReminderTime"]; +} + +- (void) setReminderTime: (NSString *) newTime +{ + [userDefaults setObject: newTime forKey: @"ReminderTime"]; +} + +- (id ) defaultAction +{ + id results; + WORequest *request; + + request = [context request]; + if ([[request method] isEqualToString: @"POST"]) + { + [userDefaults synchronize]; + results = [self jsCloseWithRefreshMethod: nil]; + } + else + results = self; + + return results; +} + +- (BOOL) shouldTakeValuesFromRequest: (WORequest *) request + inContext: (WOContext*) context +{ + return [[request method] isEqualToString: @"POST"]; +} + +@end diff --git a/UI/PreferencesUI/Version b/UI/PreferencesUI/Version new file mode 100644 index 00000000..b2a4ba59 --- /dev/null +++ b/UI/PreferencesUI/Version @@ -0,0 +1 @@ +# nothing here diff --git a/UI/PreferencesUI/product.plist b/UI/PreferencesUI/product.plist new file mode 100644 index 00000000..de4a1d90 --- /dev/null +++ b/UI/PreferencesUI/product.plist @@ -0,0 +1,36 @@ +{ /* -*-javascript-*- */ + requires = ( MAIN, MainUI, CommonUI ); + + publicResources = ( + ); + + factories = { + }; + + categories = { + SOGoUserFolder = { + slots = { + toolbar = { + protectedBy = "View"; + value = "UIxPreferences.toolbar"; + }; + }; + methods = { + preferences = { + protectedBy = "View"; + pageName = "UIxPreferences"; + }; + jsonDefaults = { + protectedBy = "View"; + actionClass = "UIxJSONPreferences"; + actionName = "jsonDefaults"; + }; + jsonSettings = { + protectedBy = "View"; + actionClass = "UIxJSONPreferences"; + actionName = "jsonSettings"; + }; + }; + }; + }; +} diff --git a/UI/SOGoUI/GNUmakefile b/UI/SOGoUI/GNUmakefile index 172d94a3..554741b5 100644 --- a/UI/SOGoUI/GNUmakefile +++ b/UI/SOGoUI/GNUmakefile @@ -16,7 +16,6 @@ libSOGoUI_HEADER_FILES += \ \ UIxJSClose.h \ UIxComponent.h \ - SOGoDateFormatter.h \ SOGoAptFormatter.h \ SOGoJSStringFormatter.h \ WOContext+UIx.h \ @@ -25,7 +24,6 @@ libSOGoUI_OBJC_FILES += \ \ UIxJSClose.m \ UIxComponent.m \ - SOGoDateFormatter.m \ SOGoAptFormatter.m \ SOGoJSStringFormatter.m \ WOContext+UIx.m \ diff --git a/UI/SOGoUI/SOGoDateFormatter.h b/UI/SOGoUI/SOGoDateFormatter.h deleted file mode 100644 index 2e084842..00000000 --- a/UI/SOGoUI/SOGoDateFormatter.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (C) 2004 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo 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 Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SOGoDateFormatter_H_ -#define __SOGoDateFormatter_H_ - -#import - -@class NSString, NSCalendarDate, NSDictionary; - -@interface SOGoDateFormatter : NSFormatter -{ - NSDictionary *locale; - SEL formatAction; - SEL auxFormatAction; -} - -- (id)initWithLocale:(NSDictionary *)_locale; - -- (void)setISODateFormat; -- (void)setFrenchDateFormat; - -- (void)setFullWeekdayNameAndDetails; - -- (NSString *)stringForObjectValue:(id)_obj; -- (NSString *) stringForSecondsSinceThe70s: (unsigned int) seconds; - -- (NSString *)shortDayOfWeek:(int)_day; -- (NSString *)fullDayOfWeek:(int)_day; -- (NSString *)shortMonthOfYear:(int)_month; -- (NSString *)fullMonthOfYear:(int)_month; - -- (NSString *)isoDateFormatForDate:(NSCalendarDate *)_date; -- (NSString *)fullWeekdayNameAndDetailsForDate:(NSCalendarDate *)_date; - -@end - -#endif /* __SOGoDateFormatter_H_ */ diff --git a/UI/SOGoUI/SOGoDateFormatter.m b/UI/SOGoUI/SOGoDateFormatter.m deleted file mode 100644 index c618be41..00000000 --- a/UI/SOGoUI/SOGoDateFormatter.m +++ /dev/null @@ -1,134 +0,0 @@ -/* - Copyright (C) 2004 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo 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 Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "SOGoDateFormatter.h" -#include "common.h" - -@implementation SOGoDateFormatter - -- (id)initWithLocale:(NSDictionary *)_locale { - if ((self = [super init])) { - self->locale = [_locale retain]; - - if ([[self->locale objectForKey:@"NSLocaleCode"] isEqualToString:@"fr"]) - [self setFrenchDateFormat]; - else - [self setISODateFormat]; - } - return self; -} - -- (void)dealloc { - [self->locale release]; - [super dealloc]; -} - -/* accessors */ - -- (void)setISODateFormat { - self->formatAction = @selector(isoDateFormatForDate:); -} - -- (void)setFrenchDateFormat { - self->formatAction = @selector(frenchDateFormatForDate:); -} - -- (void)setFullWeekdayNameAndDetails { - self->auxFormatAction = self->formatAction; - self->formatAction = @selector(fullWeekdayNameAndDetailsForDate:); -} - -/* operation */ - -- (NSString *) stringForObjectValue: (id) _obj -{ - return [self performSelector:self->formatAction - withObject:_obj]; -} - -- (NSString *) stringForSecondsSinceThe70s: (unsigned int) seconds -{ - return [self stringForObjectValue: - [NSCalendarDate dateWithTimeIntervalSince1970: seconds]]; -} - -/* Helpers */ - -- (NSString *)shortDayOfWeek:(int)_day { - return [[self->locale objectForKey:@"NSShortWeekDayNameArray"] - objectAtIndex:_day]; -} - -- (NSString *)fullDayOfWeek:(int)_day { - return [[self->locale objectForKey:@"NSWeekDayNameArray"] - objectAtIndex:_day]; -} - -- (NSString *)shortMonthOfYear:(int)_month { - return [[self->locale objectForKey:@"NSShortMonthNameArray"] - objectAtIndex:_month - 1]; -} - -- (NSString *)fullMonthOfYear:(int)_month { - return [[self->locale objectForKey:@"NSMonthNameArray"] - objectAtIndex:_month - 1]; -} - - -/* Private API */ - -- (NSString *)isoDateFormatForDate:(NSCalendarDate *)_date { - char buf[16]; - - if (_date == nil) return nil; - snprintf(buf, sizeof(buf), - "%04d-%02d-%02d", - [_date yearOfCommonEra], [_date monthOfYear], [_date dayOfMonth]); - return [NSString stringWithCString:buf]; -} - -- (NSString *)frenchDateFormatForDate:(NSCalendarDate *)_date { - char buf[16]; - - if (_date == nil) return nil; - snprintf(buf, sizeof(buf), - "%02d/%02d/%04d", - [_date dayOfMonth], [_date monthOfYear], [_date yearOfCommonEra]); - return [NSString stringWithCString:buf]; -} - -- (NSString *)fullWeekdayNameAndDetailsForDate:(NSCalendarDate *)_date { - NSMutableString *desc; - - if (_date == nil) return nil; - - desc = [NSMutableString stringWithCapacity:24]; - [desc appendString:[self fullDayOfWeek:[_date dayOfWeek]]]; - [desc appendString:@", "]; - [desc appendString:[self performSelector:self->auxFormatAction - withObject:_date]]; - [desc appendString:@" "]; - [desc appendFormat:@"%02d:%02d ", [_date hourOfDay], [_date minuteOfHour]]; - [desc appendString:[[_date timeZone] abbreviation]]; - return desc; -} - -@end /* SOGoDateFormatter */ diff --git a/UI/Scheduler/GNUmakefile b/UI/Scheduler/GNUmakefile index b8f79463..c03fc476 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/UIxAppointmentView.h b/UI/Scheduler/UIxAppointmentView.h deleted file mode 100644 index f1d23785..00000000 --- a/UI/Scheduler/UIxAppointmentView.h +++ /dev/null @@ -1,40 +0,0 @@ -// $Id$ - -#ifndef __SOGo_UIxAppointmentView_H__ -#define __SOGo_UIxAppointmentView_H__ - -#include - -@class NSCalendarDate; -@class iCalEvent; -@class iCalPerson; -@class SOGoDateFormatter; - -@interface UIxAppointmentView : UIxComponent -{ - iCalEvent* appointment; - iCalPerson* attendee; - SOGoDateFormatter *dateFormatter; - id item; -} - -- (iCalEvent *) appointment; - -/* permissions */ -- (BOOL) canAccessApt; -- (BOOL) canEditApt; - -- (SOGoDateFormatter *) dateFormatter; -- (NSCalendarDate *) startTime; -- (NSCalendarDate *) endTime; - -- (NSString *) attributesTabLink; -- (NSString *) participantsTabLink; - -- (NSString *) completeHrefForMethod: (NSString *) _method - withParameter: (NSString *) _param - forKey: (NSString *) _key; - -@end - -#endif /* __SOGo_UIxAppointmentView_H__ */ diff --git a/UI/Scheduler/UIxAppointmentView.m b/UI/Scheduler/UIxAppointmentView.m deleted file mode 100644 index 4814f714..00000000 --- a/UI/Scheduler/UIxAppointmentView.m +++ /dev/null @@ -1,292 +0,0 @@ -/* - Copyright (C) 2004-2005 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo 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 Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#import "UIxAppointmentView.h" -#import -#import -#import -#import -#import -#import "UIxComponent+Scheduler.h" -#import "common.h" - -@interface UIxAppointmentView (PrivateAPI) -- (BOOL)isAttendeeActiveUser; -@end - -@implementation UIxAppointmentView - -- (void)dealloc { - [appointment release]; - [attendee release]; - [dateFormatter release]; - [item release]; - [super dealloc]; -} - -/* accessors */ - -- (NSString *)tabSelection { - NSString *selection; - - selection = [self queryParameterForKey:@"tab"]; - if (selection == nil) - selection = @"attributes"; - return selection; -} - -- (void)setAttendee:(id)_attendee { - ASSIGN(attendee, _attendee); -} -- (id)attendee { - return attendee; -} - -- (BOOL)isAttendeeActiveUser { - NSString *email, *attEmail; - - email = [[[self context] activeUser] primaryEmail]; - attendee = [self attendee]; - attEmail = [attendee rfc822Email]; - - return [email isEqualToString: attEmail]; -} - -- (BOOL)showAcceptButton { - return [[self attendee] participationStatus] != iCalPersonPartStatAccepted; -} -- (BOOL)showRejectButton { - return [[self attendee] participationStatus] != iCalPersonPartStatDeclined; -} -- (NSString *)attendeeStatusColspan { - return [self isAttendeeActiveUser] ? @"1" : @"2"; -} - -- (void)setItem:(id)_item { - ASSIGN(item, _item); -} -- (id)item { - return item; -} - -- (SOGoDateFormatter *)dateFormatter { - if (dateFormatter == nil) { - dateFormatter = - [[SOGoDateFormatter alloc] initWithLocale:[self locale]]; - [dateFormatter setFullWeekdayNameAndDetails]; - } - return dateFormatter; -} - -- (NSCalendarDate *)startTime { - NSCalendarDate *date; - NSTimeZone *timeZone; - - timeZone = [[context activeUser] timeZone]; - date = [[self appointment] startDate]; - [date setTimeZone: timeZone]; - - return date; -} - -- (NSCalendarDate *)endTime { - NSCalendarDate *date; - NSTimeZone *timeZone; - - timeZone = [[context activeUser] timeZone]; - date = [[self appointment] endDate]; - [date setTimeZone: timeZone]; - - return date; -} - -- (NSString *)resourcesAsString { - NSArray *resources, *cns; - - resources = [[self appointment] resources]; - cns = [resources valueForKey:@"cnForDisplay"]; - return [cns componentsJoinedByString:@"
"]; -} - -- (NSString *) categoriesAsString -{ - NSEnumerator *categories; - NSArray *rawCategories; - NSMutableArray *l10nCategories; - NSString *currentCategory, *l10nCategory; - - rawCategories - = [[appointment categories] componentsSeparatedByString: @","]; - l10nCategories = [NSMutableArray arrayWithCapacity: [rawCategories count]]; - categories = [rawCategories objectEnumerator]; - currentCategory = [categories nextObject]; - while (currentCategory) - { - l10nCategory - = [self labelForKey: [currentCategory stringByTrimmingSpaces]]; - if (l10nCategory) - [l10nCategories addObject: l10nCategory]; - currentCategory = [categories nextObject]; - } - - return [l10nCategories componentsJoinedByString: @", "]; -} - -// appointment.organizer.cnForDisplay -- (NSString *) eventOrganizer -{ - CardElement *organizer; - - organizer = [[self appointment] uniqueChildWithTag: @"organizer"]; - - return [organizer value: 0 ofAttribute: @"cn"]; -} - -- (NSString *) priorityLabelKey -{ - return [NSString stringWithFormat: @"prio_%@", [appointment priority]]; -} - -/* backend */ - -- (iCalEvent *) appointment -{ - SOGoAppointmentObject *clientObject; - - if (!appointment) - { - clientObject = [self clientObject]; - appointment = (iCalEvent *) [clientObject component: NO]; - [appointment retain]; - } - - return appointment; -} - -/* hrefs */ - -- (NSString *)attributesTabLink { - return [self completeHrefForMethod:[self ownMethodName] - withParameter:@"attributes" - forKey:@"tab"]; -} - -- (NSString *)participantsTabLink { - return [self completeHrefForMethod:[self ownMethodName] - withParameter:@"participants" - forKey:@"tab"]; -} - -- (NSString *)debugTabLink { - return [self completeHrefForMethod:[self ownMethodName] - withParameter:@"debug" - forKey:@"tab"]; -} - -- (NSString *)completeHrefForMethod:(NSString *)_method - withParameter:(NSString *)_param - forKey:(NSString *)_key -{ - NSString *href; - - [self setQueryParameter:_param forKey:_key]; - href = [self completeHrefForMethod:[self ownMethodName]]; - [self setQueryParameter:nil forKey:_key]; - return href; -} - - -/* access */ - -- (BOOL)isMyApt { - NSString *email; - iCalPerson *organizer; - - email = [[[self context] activeUser] primaryEmail]; - organizer = [[self appointment] organizer]; - if (!organizer) return YES; // assume this is correct to do, right? - return [[organizer rfc822Email] isEqualToString:email]; -} - -- (BOOL)canAccessApt { - NSString *email; - NSArray *partMails; - - if ([self isMyApt]) - return YES; - - /* not my apt - can access if it's public */ - if ([[[self appointment] accessClass] isEqualToString: @"PUBLIC"]) - return YES; - - /* can access it if I'm invited :-) */ - email = [[[self context] activeUser] primaryEmail]; - partMails = [[[self appointment] participants] valueForKey:@"rfc822Email"]; - return [partMails containsObject:email]; -} - -- (BOOL)canEditApt { - return [self isMyApt]; -} - - -/* action */ - -- (id)defaultAction { - if ([self appointment] == nil) { - return [NSException exceptionWithHTTPStatus:404 /* Not Found */ - reason:@"could not locate appointment"]; - } - - return self; -} - -- (BOOL)isDeletableClientObject { - return [[self clientObject] respondsToSelector:@selector(delete)]; -} - -- (id)deleteAction { - NSException *ex; - id url; - - if ([self appointment] == nil) { - return [NSException exceptionWithHTTPStatus:404 /* Not Found */ - reason:@"could not locate appointment"]; - } - - if (![self isDeletableClientObject]) { - /* return 400 == Bad Request */ - return [NSException exceptionWithHTTPStatus:400 - reason:@"method cannot be invoked on " - @"the specified object"]; - } - - if ((ex = [[self clientObject] delete]) != nil) { - // TODO: improve error handling - [self debugWithFormat:@"failed to delete: %@", ex]; - return ex; - } - - url = [[[self clientObject] container] baseURLInContext:[self context]]; - return [self redirectToLocation:url]; -} - -@end /* UIxAppointmentView */ diff --git a/UI/Scheduler/UIxCalDayTable.h b/UI/Scheduler/UIxCalDayTable.h index 37f6364d..cc5598e4 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 aac4cf73..3c5a35e6 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 ed455673..7ef811d3 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 d946a13d..bcbb66bc 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/UIxCalMonthView.h b/UI/Scheduler/UIxCalMonthView.h index 48190556..830c17ca 100644 --- a/UI/Scheduler/UIxCalMonthView.h +++ b/UI/Scheduler/UIxCalMonthView.h @@ -44,6 +44,9 @@ NSArray *daysToDisplay; NSCalendarDate *currentTableDay; NSArray *currentTableColumn; + + NSArray *dayNames; + NSArray *monthNames; } - (NSDictionary *) monthBeforePrevMonthQueryParameters; diff --git a/UI/Scheduler/UIxCalMonthView.m b/UI/Scheduler/UIxCalMonthView.m index 9f307665..0bd425d9 100644 --- a/UI/Scheduler/UIxCalMonthView.m +++ b/UI/Scheduler/UIxCalMonthView.m @@ -36,13 +36,20 @@ - (id) init { + NSDictionary *locale; + if ((self = [super init])) { - monthAptFormatter - = [[SOGoAptFormatter alloc] initWithDisplayTimeZone: timeZone]; - [monthAptFormatter setShortMonthTitleOnly]; - dateFormatter = [[SOGoDateFormatter alloc] - initWithLocale: [self locale]]; +// monthAptFormatter +// = [[SOGoAptFormatter alloc] initWithDisplayTimeZone: timeZone]; +// [monthAptFormatter setShortMonthTitleOnly]; +// dateFormatter = [[SOGoDateFormatter alloc] +// initWithLocale: [self locale]]; + locale = [context valueForKey: @"locale"]; + dayNames = [locale objectForKey: NSWeekDayNameArray]; + [dayNames retain]; + monthNames = [locale objectForKey: NSMonthNameArray]; + [monthNames retain]; sortedAppointments = [NSMutableDictionary new]; daysToDisplay = nil; } @@ -50,16 +57,18 @@ return self; } -- (SOGoAptFormatter *) monthAptFormatter -{ - return monthAptFormatter; -} +// - (SOGoAptFormatter *) monthAptFormatter +// { +// return monthAptFormatter; +// } - (void) dealloc { + [monthNames release]; + [dayNames release]; [daysToDisplay release]; - [monthAptFormatter release]; - [dateFormatter release]; +// [monthAptFormatter release]; +// [dateFormatter release]; [sortedAppointments release]; [super dealloc]; } @@ -111,7 +120,7 @@ - (NSString *) labelForCurrentDayToDisplay { - return [dateFormatter fullDayOfWeek: [currentTableDay dayOfWeek]]; + return [dayNames objectAtIndex: [currentTableDay dayOfWeek]]; } - (NSDictionary *) _dateQueryParametersWithOffset: (int) monthsOffset @@ -211,7 +220,7 @@ || [currentTableDay isDateOnSameDay: lastDayOfMonth]) { monthOfYear - = [dateFormatter shortMonthOfYear: [currentTableDay monthOfYear]]; + = [monthNames objectAtIndex: [currentTableDay monthOfYear]]; label = [NSString stringWithFormat: @"%d %@", dayOfMonth, monthOfYear]; } else diff --git a/UI/Scheduler/UIxComponentEditor.h b/UI/Scheduler/UIxComponentEditor.h index 087fc1f0..71c511a6 100644 --- a/UI/Scheduler/UIxComponentEditor.h +++ b/UI/Scheduler/UIxComponentEditor.h @@ -28,7 +28,6 @@ @class NSArray; @class NSCalendarDate; @class NSDictionary; -@class NSFormatter; @class NSString; @class iCalPerson; @@ -132,7 +131,6 @@ - (BOOL) canEditComponent; /* helpers */ -- (NSFormatter *) titleDateFormatter; - (NSString *) completeURIForMethod: (NSString *) _method; - (BOOL) isWriteableClientObject; - (NSException *) validateObjectForStatusChange; diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index d81be971..08ef2092 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -41,7 +41,6 @@ #import #import -#import #import #import #import @@ -589,17 +588,6 @@ } /* helpers */ -- (NSFormatter *) titleDateFormatter -{ - SOGoDateFormatter *fmt; - - fmt = [[SOGoDateFormatter alloc] initWithLocale: [self locale]]; - [fmt autorelease]; - [fmt setFullWeekdayNameAndDetails]; - - return fmt; -} - - (NSString *) completeURIForMethod: (NSString *) _method { NSString *uri; diff --git a/UI/Scheduler/UIxTaskView.h b/UI/Scheduler/UIxTaskView.h deleted file mode 100644 index 51678d71..00000000 --- a/UI/Scheduler/UIxTaskView.h +++ /dev/null @@ -1,40 +0,0 @@ -// $Id: UIxTaskView.h 768 2005-07-15 00:13:01Z helge $ - -#ifndef __SOGo_UIxTaskView_H__ -#define __SOGo_UIxTaskView_H__ - -#include - -@class NSCalendarDate; -@class iCalToDo; -@class iCalPerson; -@class SOGoDateFormatter; - -@interface UIxTaskView : UIxComponent -{ - iCalToDo* task; - iCalPerson* attendee; - SOGoDateFormatter *dateFormatter; - id item; -} - -- (iCalToDo *) task; - -/* permissions */ -- (BOOL)canAccessApt; -- (BOOL)canEditApt; - -- (SOGoDateFormatter *)dateFormatter; -- (NSCalendarDate *)startTime; -- (NSCalendarDate *)endTime; - -- (NSString *)attributesTabLink; -- (NSString *)participantsTabLink; - -- (NSString *)completeHrefForMethod:(NSString *)_method - withParameter:(NSString *)_param - forKey:(NSString *)_key; - -@end - -#endif /* __SOGo_UIxTaskView_H__ */ diff --git a/UI/Scheduler/UIxTaskView.m b/UI/Scheduler/UIxTaskView.m deleted file mode 100644 index 0af81407..00000000 --- a/UI/Scheduler/UIxTaskView.m +++ /dev/null @@ -1,294 +0,0 @@ -/* - Copyright (C) 2004-2005 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo 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 Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#import "UIxTaskView.h" -#import -#import -#import -#import -#import -#import "UIxComponent+Scheduler.h" -#import "common.h" - -@interface UIxTaskView (PrivateAPI) -- (BOOL)isAttendeeActiveUser; -@end - -@implementation UIxTaskView - -- (void)dealloc { - [task release]; - [attendee release]; - [dateFormatter release]; - [item release]; - [super dealloc]; -} - -/* accessors */ - -- (NSString *)tabSelection { - NSString *selection; - - selection = [self queryParameterForKey:@"tab"]; - if (selection == nil) - selection = @"attributes"; - return selection; -} - -- (void)setAttendee:(id)_attendee { - ASSIGN(attendee, _attendee); -} -- (id)attendee { - return attendee; -} - -- (BOOL)isAttendeeActiveUser { - NSString *email, *attEmail; - - email = [[[self context] activeUser] primaryEmail]; - attendee = [self attendee]; - attEmail = [attendee rfc822Email]; - - return [email isEqualToString: attEmail]; -} - -- (BOOL)showAcceptButton { - return [[self attendee] participationStatus] != iCalPersonPartStatAccepted; -} -- (BOOL)showRejectButton { - return [[self attendee] participationStatus] != iCalPersonPartStatDeclined; -} -- (NSString *)attendeeStatusColspan { - return [self isAttendeeActiveUser] ? @"1" : @"2"; -} - -- (void)setItem:(id)_item { - ASSIGN(item, _item); -} -- (id)item { - return item; -} - -- (SOGoDateFormatter *)dateFormatter { - if (dateFormatter == nil) { - dateFormatter = - [[SOGoDateFormatter alloc] initWithLocale:[self locale]]; - [dateFormatter setFullWeekdayNameAndDetails]; - } - return dateFormatter; -} - -- (NSCalendarDate *) startTime -{ - NSCalendarDate *date; - NSTimeZone *timeZone; - - timeZone = [[context activeUser] timeZone]; - date = [[self task] startDate]; - [date setTimeZone: timeZone]; - - return date; -} - -- (NSCalendarDate *) endTime -{ - NSCalendarDate *date; - NSTimeZone *timeZone; - - timeZone = [[context activeUser] timeZone]; - date = [[self task] due]; - [date setTimeZone: timeZone]; - - return date; -} - -- (NSString *)resourcesAsString { - NSArray *resources, *cns; - - resources = [[self task] resources]; - cns = [resources valueForKey:@"cnForDisplay"]; - return [cns componentsJoinedByString:@"
"]; -} - -- (NSString *) categoriesAsString -{ - NSEnumerator *categories; - NSArray *rawCategories; - NSMutableArray *l10nCategories; - NSString *currentCategory, *l10nCategory; - - rawCategories - = [[task categories] componentsSeparatedByString: @","]; - l10nCategories = [NSMutableArray arrayWithCapacity: [rawCategories count]]; - categories = [rawCategories objectEnumerator]; - currentCategory = [categories nextObject]; - while (currentCategory) - { - l10nCategory - = [self labelForKey: [currentCategory stringByTrimmingSpaces]]; - if (l10nCategory) - [l10nCategories addObject: l10nCategory]; - currentCategory = [categories nextObject]; - } - - return [l10nCategories componentsJoinedByString: @", "]; -} - -// task.organizer.cnForDisplay -- (NSString *) eventOrganizer -{ - CardElement *organizer; - - organizer = [[self task] uniqueChildWithTag: @"organizer"]; - - return [organizer value: 0 ofAttribute: @"cn"]; -} - -- (NSString *) priorityLabelKey -{ - return [NSString stringWithFormat: @"prio_%@", [task priority]]; -} - -/* backend */ - -- (iCalToDo *) task -{ - SOGoTaskObject *clientObject; - - if (!task) - { - clientObject = [self clientObject]; - task = (iCalToDo *) [clientObject component: NO]; - [task retain]; - } - - return task; -} - -/* hrefs */ - -- (NSString *)attributesTabLink { - return [self completeHrefForMethod:[self ownMethodName] - withParameter:@"attributes" - forKey:@"tab"]; -} - -- (NSString *)participantsTabLink { - return [self completeHrefForMethod:[self ownMethodName] - withParameter:@"participants" - forKey:@"tab"]; -} - -- (NSString *)debugTabLink { - return [self completeHrefForMethod:[self ownMethodName] - withParameter:@"debug" - forKey:@"tab"]; -} - -- (NSString *)completeHrefForMethod:(NSString *)_method - withParameter:(NSString *)_param - forKey:(NSString *)_key -{ - NSString *href; - - [self setQueryParameter:_param forKey:_key]; - href = [self completeHrefForMethod:[self ownMethodName]]; - [self setQueryParameter:nil forKey:_key]; - return href; -} - - -/* access */ - -- (BOOL)isMyApt { - NSString *email; - iCalPerson *organizer; - - email = [[[self context] activeUser] primaryEmail]; - organizer = [[self task] organizer]; - if (!organizer) return YES; // assume this is correct to do, right? - return [[organizer rfc822Email] isEqualToString:email]; -} - -- (BOOL)canAccessApt { - NSString *email; - NSArray *partMails; - - if ([self isMyApt]) - return YES; - - /* not my apt - can access if it's public */ - if ([[[self task] accessClass] isEqualToString: @"PUBLIC"]) - return YES; - - /* can access it if I'm invited :-) */ - email = [[[self context] activeUser] primaryEmail]; - partMails = [[[self task] participants] valueForKey:@"rfc822Email"]; - return [partMails containsObject: email]; -} - -- (BOOL)canEditApt { - return [self isMyApt]; -} - - -/* action */ - -- (id)defaultAction { - if ([self task] == nil) { - return [NSException exceptionWithHTTPStatus:404 /* Not Found */ - reason:@"could not locate task"]; - } - - return self; -} - -- (BOOL)isDeletableClientObject { - return [[self clientObject] respondsToSelector:@selector(delete)]; -} - -- (id)deleteAction { - NSException *ex; - id url; - - if ([self task] == nil) { - return [NSException exceptionWithHTTPStatus:404 /* Not Found */ - reason:@"could not locate task"]; - } - - if (![self isDeletableClientObject]) { - /* return 400 == Bad Request */ - return [NSException exceptionWithHTTPStatus:400 - reason:@"method cannot be invoked on " - @"the specified object"]; - } - - if ((ex = [[self clientObject] delete]) != nil) { - // TODO: improve error handling - [self debugWithFormat:@"failed to delete: %@", ex]; - return ex; - } - - url = [[[self clientObject] container] baseURLInContext:[self context]]; - return [self redirectToLocation:url]; -} - -@end /* UIxTaskView */ diff --git a/UI/Scheduler/product.plist b/UI/Scheduler/product.plist index 63d85f5e..2041d757 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"; diff --git a/UI/Templates/MailerUI/UIxMailListView.wox b/UI/Templates/MailerUI/UIxMailListView.wox index 55d2d69a..741252ca 100644 --- a/UI/Templates/MailerUI/UIxMailListView.wox +++ b/UI/Templates/MailerUI/UIxMailListView.wox @@ -120,8 +120,7 @@ > + + +
+
+
    +
  • +
  • +
  • +
  • +
+
+
+
+
+
+