Monotone-Parent: 2fdf0ead0781ef2362dd389811d5db44ca4cc84a

Monotone-Revision: c91eef7edcfd08d414664c25a590b6268a7e58e2

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2009-11-29T04:19:32
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau committed 2009-11-29 04:19:32 +00:00
1 parent 3821d1aa7f
commit b79a7e5a00
129 files changed
+4402 -3316

No files matched your search

+2 -2
View File
@@ -26,18 +26,18 @@
#import <NGObjWeb/WODirectAction.h>
@class NSString;
@class NSUserDefaults;
@class NSMutableString;
@class NSMutableDictionary;
@class LDAPUserManager;
@class SOGoGCSFolder;
@class SOGoUserSettings;
@interface UIxFolderActions : WODirectAction
{
SOGoGCSFolder *clientObject;
LDAPUserManager *um;
NSUserDefaults *ud;
SOGoUserSettings *us;
NSString *owner;
NSString *login;
NSString *baseFolder;
+5 -5
View File
@@ -23,7 +23,6 @@
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSURL.h>
#import <Foundation/NSValue.h>
@@ -42,6 +41,7 @@
#import <SoObjects/SOGo/SOGoParentFolder.h>
#import <SoObjects/SOGo/SOGoPermissions.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/SOGoUserSettings.h>
#import "WODirectAction+SOGo.h"
@@ -62,11 +62,11 @@
baseFolder = [[clientObject container] nameInContainer];
um = [SOGoUserManager sharedUserManager];
ud = [activeUser userSettings];
moduleSettings = [ud objectForKey: baseFolder];
us = [activeUser userSettings];
moduleSettings = [us objectForKey: baseFolder];
if (!moduleSettings)
moduleSettings = [NSMutableDictionary dictionary];
[ud setObject: moduleSettings forKey: baseFolder];
[us setObject: moduleSettings forKey: baseFolder];
mailInvitationParam
= [[context request] formValueForKey: @"mail-invitation"];
@@ -174,7 +174,7 @@
else
[folderSubscription addObjectUniquely: folderName];
[ud synchronize];
[us synchronize];
return [self responseWith204];
}
-1
View File
@@ -22,7 +22,6 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/WORequest.h>
+27 -32
View File
@@ -1,3 +1,4 @@
/*
Copyright (C) 2004-2005 SKYRIX Software AG
@@ -21,30 +22,21 @@
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import <NGObjWeb/WOResourceManager.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGo/SOGoUserProfile.h>
#import <SOGo/SOGoUserSettings.h>
#import <SOGo/SOGoSystemDefaults.h>
#import <SOGo/SOGoWebAuthenticator.h>
#import "UIxPageFrame.h"
static NSString *siteFavicon = nil;
@implementation UIxPageFrame
+ (void) initialize
{
NSUserDefaults *ud;
ud = [NSUserDefaults standardUserDefaults];
siteFavicon = [ud stringForKey: @"SOGoFaviconRelativeURL"];
[siteFavicon retain];
}
- (id) init
{
if ((self = [super init]))
@@ -184,7 +176,14 @@ static NSString *siteFavicon = nil;
- (NSString *) siteFavicon
{
return (!siteFavicon ? [self urlForResourceFilename: @"sogo.ico"] : siteFavicon);
NSString *siteFavicon;
siteFavicon = [[SOGoSystemDefaults sharedSystemDefaults]
faviconRelativeURL];
return (siteFavicon
? siteFavicon
: [self urlForResourceFilename: @"sogo.ico"]);
}
/* page based JavaScript */
@@ -192,13 +191,13 @@ static NSString *siteFavicon = nil;
- (NSString *) _stringsForFramework: (NSString *) framework
{
NSString *language, *frameworkName;
SOGoUserDefaults *ud;
id table;
frameworkName = [NSString stringWithFormat: @"%@.SOGo",
(framework ? framework : [self frameworkName])];
language = [[context activeUser] language];
if (!language)
language = [SOGoUser language];
ud = [[context activeUser] userDefaults];
language = [ud language];
table
= [[self resourceManager] stringTableWithName: @"Localizable"
@@ -438,24 +437,21 @@ static NSString *siteFavicon = nil;
- (NSString *) userLanguage
{
NSString *language;
SOGoUserDefaults *ud;
language = [[context activeUser] language];
if (!language)
language = [SOGoUser language];
ud = [[context activeUser] userDefaults];
return language;
return [ud language];
}
- (NSString *) userSettings
{
SOGoUserDefaults *userSettings;
SOGoUserSettings *us;
NSString *jsonResult;
userSettings = (SOGoUserDefaults *)[[context activeUser] userSettings];
if (userSettings)
jsonResult = [userSettings jsonRepresentation];
else
us = [[context activeUser] userSettings];
jsonResult = [[us source] jsonRepresentation];
if (!jsonResult)
jsonResult = @"{}";
return jsonResult;
@@ -463,13 +459,12 @@ static NSString *siteFavicon = nil;
- (NSString *) userDefaults
{
SOGoUserDefaults *userDefaults;
SOGoUserDefaults *ud;
NSString *jsonResult;
userDefaults = (SOGoUserDefaults *)[[context activeUser] userDefaults];
if (userDefaults)
jsonResult = [userDefaults jsonRepresentation];
else
ud = [[context activeUser] userDefaults];
jsonResult = [[ud source] jsonRepresentation];
if (!jsonResult)
jsonResult = @"{}";
return jsonResult;
+18 -26
View File
@@ -24,28 +24,19 @@
#import <NGObjWeb/WOApplication.h>
#import <NGObjWeb/WOResponse.h>
#import <NGObjWeb/WORequest.h>
#import <SoObjects/SOGo/SOGoUserManager.h>
#import <SoObjects/SOGo/SOGoPermissions.h>
#import <SoObjects/SOGo/SOGoObject.h>
#import <SoObjects/SOGo/SOGoGroup.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SOGo/SOGoDomainDefaults.h>
#import <SOGo/SOGoGroup.h>
#import <SOGo/SOGoObject.h>
#import <SOGo/SOGoPermissions.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/SOGoUserManager.h>
#import <UI/SOGoUI/SOGoACLAdvisory.h>
#import <Foundation/NSUserDefaults.h>
#import "UIxUserRightsEditor.h"
static BOOL sendACLAdvisories = NO;
@implementation UIxUserRightsEditor
+ (void) initialize
{
NSUserDefaults *ud;
ud = [NSUserDefaults standardUserDefaults];
sendACLAdvisories = [ud boolForKey: @"SOGoACLsSendEMailNotifications"];
}
- (id) init
{
if ((self = [super init]))
@@ -93,7 +84,7 @@ static BOOL sendACLAdvisories = NO;
- (BOOL) _initRights
{
BOOL response;
NSString *newUID;
NSString *newUID, *domain;
SOGoUserManager *um;
SOGoObject *clientObject;
SOGoGroup *group;
@@ -112,7 +103,8 @@ static BOOL sendACLAdvisories = NO;
{
if (![newUID hasPrefix: @"@"])
{
group = [SOGoGroup groupWithIdentifier: newUID];
domain = [[context activeUser] domain];
group = [SOGoGroup groupWithIdentifier: newUID inDomain: domain];
if (group)
newUID = [NSString stringWithFormat: @"@%@", newUID];
}
@@ -147,12 +139,12 @@ static BOOL sendACLAdvisories = NO;
- (void) sendACLAdvisoryTemplateForObject: (id) theObject
{
NSString *language, *pageName;
SOGoUser *user;
SOGoUserDefaults *ud;
SOGoACLAdvisory *page;
WOApplication *app;
user = [SOGoUser userWithLogin: uid roles: nil];
language = [user language];
ud = [[SOGoUser userWithLogin: uid roles: nil] userDefaults];
language = [ud language];
pageName = [NSString stringWithFormat: @"SOGoACL%@ModificationAdvisory",
language];
@@ -166,6 +158,7 @@ static BOOL sendACLAdvisories = NO;
- (id <WOActionResults>) saveUserRightsAction
{
id <WOActionResults> response;
SOGoDomainDefaults *dd;
if (![self _initRights])
response = [NSException exceptionWithHTTPStatus: 403
@@ -179,11 +172,10 @@ static BOOL sendACLAdvisories = NO;
[self updateRights];
[[self clientObject] setRoles: userRights forUser: uid];
if (![o isEqualToArray: userRights] && sendACLAdvisories)
{
[self sendACLAdvisoryTemplateForObject: [self clientObject]];
}
dd = [[context activeUser] domainDefaults];
if (![o isEqualToArray: userRights] && [dd aclSendEMailNotifications])
[self sendACLAdvisoryTemplateForObject: [self clientObject]];
response = [self jsCloseWithRefreshMethod: nil];
}
+4 -1
View File
@@ -28,6 +28,7 @@
#import <SoObjects/SOGo/NSObject+Utilities.h>
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/SOGoUserDefaults.h>
#import "WODirectAction+SOGo.h"
@@ -88,12 +89,14 @@
NSArray *paths;
NSBundle *bundle;
NSDictionary *strings;
SOGoUserDefaults *ud;
bundle = [NSBundle bundleForClass: [self class]];
if (!bundle)
bundle = [NSBundle mainBundle];
userLanguage = [[context activeUser] language];
ud = [[context activeUser] userDefaults];
userLanguage = [ud language];
paths = [bundle pathsForResourcesOfType: @"strings"
inDirectory: [NSString stringWithFormat: @"%@.lproj",
userLanguage]
+1 -1
View File
@@ -28,7 +28,7 @@
@interface UIxContactFoldersView : UIxComponent
{
NSUserDefaults *ud;
SOGoUserSettings *us;
NSString *selectorComponentClass;
NSMutableDictionary *moduleSettings;
id currentFolder;
+40 -41
View File
@@ -24,7 +24,6 @@
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import <NGObjWeb/NSException+HTTP.h>
#import <NGObjWeb/SoObject.h>
@@ -38,16 +37,17 @@
#import <GDLContentStore/GCSFolder.h>
#import <GDLContentStore/GCSFolderManager.h>
#import <SoObjects/SOGo/SOGoUserManager.h>
#import <SoObjects/SOGo/SOGoPermissions.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
#import <SoObjects/SOGo/NSString+Utilities.h>
#import <SoObjects/Contacts/SOGoContactFolders.h>
#import <SoObjects/Contacts/SOGoContactFolder.h>
#import <SoObjects/Contacts/SOGoContactGCSFolder.h>
#import <SoObjects/Contacts/SOGoContactSourceFolder.h>
#import <SOGo/SOGoPermissions.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/SOGoUserManager.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGo/NSString+Utilities.h>
#import <Contacts/SOGoContactFolders.h>
#import <Contacts/SOGoContactFolder.h>
#import <Contacts/SOGoContactGCSFolder.h>
#import <Contacts/SOGoContactSourceFolder.h>
#import "UIxContactFoldersView.h"
@@ -64,11 +64,11 @@
module = [clientObject nameInContainer];
ud = [activeUser userSettings];
moduleSettings = [ud objectForKey: module];
us = [activeUser userSettings];
moduleSettings = [us objectForKey: module];
if (!moduleSettings)
moduleSettings = [NSMutableDictionary dictionary];
[ud setObject: moduleSettings forKey: module];
[us setObject: moduleSettings forKey: module];
}
- (id <WOActionResults>) mailerContactsAction
@@ -139,18 +139,14 @@
- (NSArray *) _responseForResults: (NSArray *) results
{
NSEnumerator *contacts;
NSString *email, *infoKey, *info;
NSString *email, *info;
NSDictionary *contact;
NSMutableArray *formattedContacts;
NSMutableDictionary *formattedContact;
NSUserDefaults *sud;
formattedContacts = [NSMutableArray arrayWithCapacity: [results count]];
if ([results count] > 0)
{
sud = [NSUserDefaults standardUserDefaults];
infoKey = [[sud stringForKey: @"SOGoLDAPContactInfoAttribute"] lowercaseString];
contacts = [results objectEnumerator];
contact = [contacts nextObject];
while (contact)
@@ -165,13 +161,10 @@
forKey: @"name"];
[formattedContact setObject: email
forKey: @"email"];
if ([infoKey length] > 0)
{
info = [contact objectForKey: infoKey];
if (info != nil)
[formattedContact setObject: info
forKey: @"contactInfo"];
}
info = [contact objectForKey: @"c_info"];
if (info != nil)
[formattedContact setObject: info
forKey: @"contactInfo"];
[formattedContacts addObject: formattedContact];
}
contact = [contacts nextObject];
@@ -276,7 +269,7 @@
{
NSDictionary *data;
NSArray *contacts;
NSString *searchText;
NSString *searchText, *domain;
id <WOActionResults> result;
SOGoUserManager *um;
@@ -284,11 +277,14 @@
if ([searchText length] > 0)
{
um = [SOGoUserManager sharedUserManager];
domain = [[context activeUser] domain];
contacts
= [self _responseForResults: [um fetchContactsMatching: searchText]];
data = [NSDictionary dictionaryWithObjectsAndKeys: searchText, @"searchText",
contacts, @"contacts",
nil];
= [self _responseForResults: [um fetchContactsMatching: searchText
inDomain: domain]];
data = [NSDictionary dictionaryWithObjectsAndKeys:
searchText, @"searchText",
contacts, @"contacts",
nil];
result = [self responseWithStatus: 200];
[(WOResponse*)result appendContentString: [data jsonRepresentation]];
}
@@ -367,18 +363,15 @@
- (void) checkDefaultModulePreference
{
NSUserDefaults *clientUD;
NSString *pref;
SOGoUserDefaults *ud;
if (![self isPopup])
{
clientUD = [[context activeUser] userDefaults];
pref = [clientUD stringForKey: @"SOGoUIxDefaultModule"];
if (pref && [pref isEqualToString: @"Last"])
ud = [[context activeUser] userDefaults];
if ([ud rememberLastModule])
{
[clientUD setObject: @"Contacts" forKey: @"SOGoUIxLastModule"];
[clientUD synchronize];
[ud setLoginModule: @"Contacts"];
[ud synchronize];
}
}
}
@@ -392,7 +385,6 @@
{
SOGoContactFolders *folderContainer;
[self checkDefaultModulePreference];
folderContainer = [self clientObject];
return [folderContainer subFolders];
@@ -436,9 +428,16 @@
else
return [self responseWithStatus: 400];
[ud synchronize];
[us synchronize];
return [self responseWithStatus: 204];
}
- (id) defaultAction
{
[self checkDefaultModulePreference];
return [super defaultAction];
}
@end
+15 -14
View File
@@ -37,14 +37,15 @@
#import <NGCards/iCalPerson.h>
#import <NGCards/iCalDateTime.h>
#import <SoObjects/SOGo/SOGoDateFormatter.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/iCalEntityObject+Utilities.h>
#import <SoObjects/Appointments/iCalEntityObject+SOGo.h>
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
#import <SoObjects/Appointments/SOGoAppointmentObject.h>
#import <SoObjects/Mailer/SOGoMailObject.h>
#import <SoObjects/Mailer/SOGoMailBodyPart.h>
#import <SOGo/SOGoDateFormatter.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/iCalEntityObject+Utilities.h>
#import <Appointments/iCalEntityObject+SOGo.h>
#import <Appointments/SOGoAppointmentFolder.h>
#import <Appointments/SOGoAppointmentObject.h>
#import <Mailer/SOGoMailObject.h>
#import <Mailer/SOGoMailBodyPart.h>
#import "UIxMailPartICalViewer.h"
@@ -167,11 +168,11 @@
- (NSCalendarDate *) startCalendarDate
{
NSCalendarDate *date;
NSTimeZone *timeZone;
SOGoUserDefaults *ud;
date = [[self inEvent] startDate];
timeZone = [[context activeUser] timeZone];
[date setTimeZone: timeZone];
ud = [[context activeUser] userDefaults];
[date setTimeZone: [ud timeZone]];
return date;
}
@@ -189,11 +190,11 @@
- (NSCalendarDate *) endCalendarDate
{
NSCalendarDate *date;
NSTimeZone *timeZone;
SOGoUserDefaults *ud;
date = [[self inEvent] endDate];
timeZone = [[context activeUser] timeZone];
[date setTimeZone: timeZone];
ud = [[context activeUser] userDefaults];
[date setTimeZone: [ud timeZone]];
return date;
}
+15 -13
View File
@@ -23,7 +23,6 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import <NGObjWeb/WOContext+SoObjects.h>
@@ -34,13 +33,15 @@
#import <EOControl/EOQualifier.h>
#import <SoObjects/Mailer/SOGoMailAccount.h>
#import <SoObjects/Mailer/SOGoDraftObject.h>
#import <SoObjects/Mailer/SOGoDraftsFolder.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
#import <SoObjects/SOGo/NSObject+Utilities.h>
#import <SoObjects/SOGo/NSString+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <Mailer/SOGoMailAccount.h>
#import <Mailer/SOGoDraftObject.h>
#import <Mailer/SOGoDraftsFolder.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/NSObject+Utilities.h>
#import <SOGo/NSString+Utilities.h>
#import <SOGo/SOGoDomainDefaults.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import "../Common/WODirectAction+SOGo.h"
@@ -189,13 +190,12 @@
SOGoMailFolder *inbox;
NGImap4Client *client;
NSString *inboxName;
NSUserDefaults *ud;
SOGoDomainDefaults *dd;
id infos;
float quota;
ud = [NSUserDefaults standardUserDefaults];
quota = [ud floatForKey: @"SOGoSoftQuotaRatio"];
dd = [[context activeUser] domainDefaults];
quota = [dd softQuotaRatio];
inbox = [co inboxFolderInContext: context];
inboxName = [NSString stringWithFormat: @"/%@", [inbox relativeImap4Name]];
client = [[inbox imap4Connection] client];
@@ -232,6 +232,7 @@
{
SOGoDraftsFolder *drafts;
SOGoDraftObject *newDraftMessage;
SOGoUserDefaults *ud;
NSString *urlBase, *url, *value, *signature;
NSArray *mailTo;
NSMutableDictionary *headers;
@@ -261,7 +262,8 @@
if (save)
[newDraftMessage setHeaders: headers];
signature = [[context activeUser] signature];
ud = [[context activeUser] userDefaults];
signature = [ud mailSignature];
if ([signature length])
{
[newDraftMessage
+5 -21
View File
@@ -23,7 +23,6 @@
#import <Foundation/NSFileManager.h>
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import <NGObjWeb/NSException+HTTP.h>
#import <NGObjWeb/SoSubContext.h>
@@ -78,30 +77,15 @@
@implementation UIxMailEditor
static BOOL showInternetMarker = NO;
static NSDictionary *internetMailHeaders = nil;
static NSArray *infoKeys = nil;
+ (void) initialize
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
infoKeys = [[NSArray alloc] initWithObjects:
@"subject", @"to", @"cc", @"bcc",
@"from", @"replyTo", @"inReplyTo",
@"priority", nil];
/* Internet mail settings */
showInternetMarker = [ud boolForKey:@"SOGoShowInternetMarker"];
if (!showInternetMarker)
NSLog(@"Note: visual Internet marker on mail editor disabled "
@"(SOGoShowInternetMarker)");
internetMailHeaders =
[[ud dictionaryForKey:@"SOGoInternetMailHeaders"] copy];
NSLog (@"Note: specified %d headers for mails send via the Internet.",
[internetMailHeaders count]);
if (!infoKeys)
infoKeys = [[NSArray alloc] initWithObjects:
@"subject", @"to", @"cc", @"bcc",
@"from", @"replyTo", @"inReplyTo",
@"priority", nil];
}
- (id) init
+5 -6
View File
@@ -24,7 +24,6 @@
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSURL.h>
#import <Foundation/NSUserDefaults.h>
#import <NGObjWeb/WOContext.h>
#import <NGObjWeb/WOContext+SoObjects.h>
@@ -319,21 +318,21 @@
{
SOGoMailFolder *co;
WOResponse *response;
NSUserDefaults *ud;
SOGoUserSettings *us;
NSMutableDictionary *mailSettings;
co = [self clientObject];
if ([NSStringFromClass ([co class]) isEqualToString: @"SOGoMailFolder"])
{
ud = [[context activeUser] userSettings];
mailSettings = [ud objectForKey: @"Mail"];
us = [[context activeUser] userSettings];
mailSettings = [us objectForKey: @"Mail"];
if (!mailSettings)
mailSettings = [NSMutableDictionary dictionary];
[ud setObject: mailSettings forKey: @"Mail"];
[us setObject: mailSettings forKey: @"Mail"];
[mailSettings setObject: [co traversalFromMailAccount]
forKey: [NSString stringWithFormat: @"%@Folder",
purpose]];
[ud synchronize];
[us synchronize];
response = [self responseWith204];
}
else
+1 -1
View File
@@ -32,7 +32,7 @@
{
NSArray *sortedUIDs; /* we always need to retrieve all anyway! */
NSArray *messages;
NSMutableArray *userDefinedOrder;
NSArray *columnsOrder;
unsigned firstMessageNumber;
id message;
EOQualifier *qualifier;
+40 -78
View File
@@ -32,7 +32,6 @@
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSTimeZone.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import <NGObjWeb/WOResponse.h>
@@ -45,44 +44,22 @@
#import <EOControl/EOQualifier.h>
#import <SoObjects/Mailer/NSString+Mail.h>
#import <SoObjects/Mailer/SOGoDraftsFolder.h>
#import <SoObjects/Mailer/SOGoMailFolder.h>
#import <SoObjects/Mailer/SOGoMailObject.h>
#import <SoObjects/Mailer/SOGoSentFolder.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
#import <SoObjects/SOGo/SOGoDateFormatter.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/SOGoUserDefaults.h>
#import <Mailer/NSString+Mail.h>
#import <Mailer/SOGoDraftsFolder.h>
#import <Mailer/SOGoMailFolder.h>
#import <Mailer/SOGoMailObject.h>
#import <Mailer/SOGoSentFolder.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/SOGoDateFormatter.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import "UIxMailListView.h"
static NSArray *defaultColumnOrder = nil;
static NSArray *udColumnOrder = nil;
#define messagesPerPage 50
@implementation UIxMailListView
+ (void) initialize
{
if (!defaultColumnOrder)
{
defaultColumnOrder = [NSArray arrayWithObjects: @"Flagged",
@"Attachment", @"Subject", @"From",
@"Unread", @"Date", @"Priority", @"Size",
nil];
[defaultColumnOrder retain];
}
if (!udColumnOrder)
{
udColumnOrder = [[NSUserDefaults standardUserDefaults]
arrayForKey: @"SOGoMailListViewColumnsOrder"];
[udColumnOrder retain];
}
}
- (id) init
{
SOGoUser *user;
@@ -92,8 +69,8 @@ static NSArray *udColumnOrder = nil;
qualifier = nil;
user = [context activeUser];
ASSIGN (dateFormatter, [user dateFormatterInContext: context]);
ASSIGN (userTimeZone, [user timeZone]);
userDefinedOrder = nil;
ASSIGN (userTimeZone, [[user userDefaults] timeZone]);
columnsOrder = nil;
folderType = 0;
currentColumn = nil;
}
@@ -110,7 +87,7 @@ static NSArray *udColumnOrder = nil;
[dateFormatter release];
[userTimeZone release];
[currentColumn release];
[userDefinedOrder release];
[columnsOrder release];
[super dealloc];
}
@@ -504,21 +481,6 @@ static NSArray *udColumnOrder = nil;
return 1;
}
- (void) checkDefaultModulePreference
{
NSUserDefaults *ud;
NSString *pref;
ud = [[context activeUser] userDefaults];
pref = [ud stringForKey: @"SOGoUIxDefaultModule"];
if (pref && [pref isEqualToString: @"Last"])
{
[ud setObject: @"Mail" forKey: @"SOGoUIxLastModule"];
[ud synchronize];
}
}
- (NSArray *) messages
{
NSMutableArray *unsortedMsgs;
@@ -529,8 +491,6 @@ static NSArray *udColumnOrder = nil;
unsigned len, i, count;
NSRange r;
[self checkDefaultModulePreference];
if (!messages)
{
r = [self fetchBlock];
@@ -836,51 +796,53 @@ static NSArray *udColumnOrder = nil;
- (NSArray *) columnsDisplayOrder
{
NSMutableArray *testColumns;
NSArray *defaultsOrder;
NSUserDefaults *ud;
NSMutableArray *finalOrder, *invalid;
NSArray *available;
NSDictionary *metaData;
SOGoUserDefaults *ud;
unsigned int i;
if (!userDefinedOrder)
if (!columnsOrder)
{
ud = [[context activeUser] userSettings];
defaultsOrder = [ud arrayForKey: @"SOGoMailListViewColumnsOrder"];
if (![defaultsOrder count])
{
defaultsOrder = udColumnOrder;
if (![defaultsOrder count])
defaultsOrder = defaultColumnOrder;
}
userDefinedOrder = [defaultsOrder mutableCopy];
ud = [[context activeUser] userDefaults];
columnsOrder = [ud mailListViewColumnsOrder];
testColumns = [userDefinedOrder mutableCopy];
[testColumns removeObjectsInArray: defaultColumnOrder];
if ([testColumns count] > 0)
metaData = [self columnsMetaData];
invalid = [columnsOrder mutableCopy];
[invalid autorelease];
available = [metaData allKeys];
[invalid removeObjectsInArray: available];
if ([invalid count] > 0)
{
[self errorWithFormat: @"one or more column names specified in"
[self errorWithFormat: @"those column names specified in"
@" SOGoMailListViewColumnsOrder are invalid: '%@'",
[testColumns componentsJoinedByString: @"', '"]];
[invalid componentsJoinedByString: @"', '"]];
[self errorWithFormat: @" falling back on hardcoded column order"];
userDefinedOrder = [defaultColumnOrder mutableCopy];
columnsOrder = available;
}
[testColumns release];
finalOrder = [columnsOrder mutableCopy];
[finalOrder autorelease];
if ([self showToAddress])
{
i = [userDefinedOrder indexOfObject: @"From"];
i = [finalOrder indexOfObject: @"From"];
if (i != NSNotFound)
[userDefinedOrder replaceObjectAtIndex: i withObject: @"To"];
[finalOrder replaceObjectAtIndex: i withObject: @"To"];
}
else
{
i = [userDefinedOrder indexOfObject: @"To"];
i = [finalOrder indexOfObject: @"To"];
if (i != NSNotFound)
[userDefinedOrder replaceObjectAtIndex: i withObject: @"From"];
[finalOrder replaceObjectAtIndex: i withObject: @"From"];
}
columnsOrder = [[self columnsMetaData] objectsForKeys: finalOrder
notFoundMarker: @""];
[columnsOrder retain];
}
return [[self columnsMetaData] objectsForKeys: userDefinedOrder
notFoundMarker: @""];
return columnsOrder;
}
- (NSString *) columnsDisplayCount
+1 -1
View File
@@ -27,7 +27,7 @@
@interface UIxMailMainFrame : UIxComponent
{
NSUserDefaults *ud;
SOGoUserSettings *us;
NSMutableDictionary *moduleSettings;
}
+34 -28
View File
@@ -22,7 +22,6 @@
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSUserDefaults.h>
#import <NGCards/NGVCard.h>
#import <NGCards/NGVCardReference.h>
@@ -39,15 +38,16 @@
#import <Contacts/SOGoContactFolders.h>
#import <Contacts/SOGoContactLDIFEntry.h>
#import <SoObjects/Mailer/SOGoMailObject.h>
#import <SoObjects/Mailer/SOGoMailAccount.h>
#import <SoObjects/Mailer/SOGoMailAccounts.h>
#import <SoObjects/SOGo/NSDictionary+URL.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
#import <SoObjects/SOGo/NSString+Utilities.h>
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/SOGoUserFolder.h>
#import <Mailer/SOGoMailObject.h>
#import <Mailer/SOGoMailAccount.h>
#import <Mailer/SOGoMailAccounts.h>
#import <SOGo/NSDictionary+URL.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/NSString+Utilities.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/SOGoUserFolder.h>
#import <SOGoUI/UIxComponent.h>
#import "UIxMailMainFrame.h"
@@ -60,7 +60,6 @@
@end
@implementation UIxMailMainFrame
- (void) _setupContext
@@ -75,12 +74,12 @@
module = [clientObject nameInContainer];
ud = [activeUser userSettings];
moduleSettings = [ud objectForKey: module];
us = [activeUser userSettings];
moduleSettings = [us objectForKey: module];
if (!moduleSettings)
{
moduleSettings = [NSMutableDictionary dictionary];
[ud setObject: moduleSettings forKey: module];
[us setObject: moduleSettings forKey: module];
}
}
@@ -113,18 +112,11 @@
- (NSString *) defaultColumnsOrder
{
NSArray *defaultColumnsOrder;
NSUserDefaults *sud;
sud = [NSUserDefaults standardUserDefaults];
defaultColumnsOrder = [NSArray arrayWithArray: [sud arrayForKey: @"SOGoMailListViewColumnsOrder"]];
if ( [defaultColumnsOrder count] == 0 )
{
defaultColumnsOrder = [NSArray arrayWithObjects: @"Flagged", @"Attachment", @"Subject",
@"From", @"Unread", @"Date", @"Priority", nil];
}
return [defaultColumnsOrder jsonRepresentation];
SOGoDomainDefaults *dd;
dd = [[context activeUser] domainDefaults];
return [[dd mailListViewColumnsOrder] jsonRepresentation];
}
- (NSString *) pageFormURL
@@ -372,7 +364,7 @@
else
return [self responseWithStatus: 400];
[ud synchronize];
[us synchronize];
return [self responseWithStatus: 204];
}
@@ -389,9 +381,23 @@
[moduleSettings setObject: expandedFolders
forKey: @"ExpandedFolders"];
[ud synchronize];
[us synchronize];
return [self responseWithStatus: 204];
}
- (id) defaultAction
{
SOGoUserDefaults *ud;
ud = [[context activeUser] userDefaults];
if ([ud rememberLastModule])
{
[ud setLoginModule: @"Mail"];
[ud synchronize];
}
return [super defaultAction];
}
@end /* UIxMailMainFrame */
+6 -5
View File
@@ -23,8 +23,9 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSEnumerator.h>
#import <NGObjWeb/WORequest.h>
#import <SoObjects/Mailer/SOGoMailFolder.h>
#import <SoObjects/SOGo/SOGoPermissions.h>
#import <Mailer/SOGoMailAccount.h>
#import <Mailer/SOGoMailFolder.h>
#import <SOGo/SOGoPermissions.h>
#import "UIxMailUserRightsEditor.h"
@@ -32,11 +33,11 @@
- (BOOL) conformsToRFC4314
{
SOGoMailFolder *co;
SOGoMailAccount *mailAccount;
co = [self clientObject];
mailAccount = [[self clientObject] mailAccountFolder];
return ([[co class] imapAclStyle] == rfc4314);
return ([mailAccount imapAclStyle] == rfc4314);
}
- (void) setUserCanReadMails: (BOOL) userCanReadMails
+28 -40
View File
@@ -20,7 +20,6 @@
*/
#import <Foundation/NSException.h>
#import <Foundation/NSUserDefaults.h>
#import <NGObjWeb/NSException+HTTP.h>
#import <NGObjWeb/WORequest.h>
#import <NGObjWeb/WOResponse.h>
@@ -51,18 +50,11 @@ static NSString *mailETag = nil;
+ (void) initialize
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
if ([ud boolForKey:@"SOGoDontUseETagsForMailViewer"])
NSLog(@"Note: usage of constant etag for mailer viewer is disabled.");
else
{
mailETag = [[NSString alloc] initWithFormat:@"\"imap4url_%d_%d_%03d\"",
UIX_MAILER_MAJOR_VERSION,
UIX_MAILER_MINOR_VERSION,
UIX_MAILER_SUBMINOR_VERSION];
NSLog(@"Note: using constant etag for mail viewer: '%@'", mailETag);
}
mailETag = [[NSString alloc] initWithFormat:@"\"imap4url_%d_%d_%03d\"",
UIX_MAILER_MAJOR_VERSION,
UIX_MAILER_MINOR_VERSION,
UIX_MAILER_SUBMINOR_VERSION];
NSLog(@"Note: using constant etag for mail viewer: '%@'", mailETag);
}
/* accessors */
@@ -146,33 +138,30 @@ static NSString *mailETag = nil;
NSString *s;
/* check etag to see whether we really must rerender */
if (mailETag)
/*
Note: There is one thing which *can* change for an existing message,
those are the IMAP4 flags (and annotations, which we do not use).
Since we don't render the flags, it should be OK, if this changes
we must embed the flagging into the etag.
*/
s = [[context request] headerForKey: @"if-none-match"];
if (s)
{
/*
Note: There is one thing which *can* change for an existing message,
those are the IMAP4 flags (and annotations, which we do not use).
Since we don't render the flags, it should be OK, if this changes
we must embed the flagging into the etag.
*/
s = [[context request] headerForKey: @"if-none-match"];
if (s)
{
if ([s rangeOfString:mailETag].length > 0) /* not perfectly correct */
{
/* client already has the proper entity */
// [self logWithFormat:@"MATCH: %@ (tag %@)", s, mailETag];
if (![[self clientObject] doesMailExist]) {
return [NSException exceptionWithHTTPStatus:404 /* Not Found */
reason:@"message got deleted"];
}
if ([s rangeOfString:mailETag].length > 0) /* not perfectly correct */
{
/* client already has the proper entity */
// [self logWithFormat:@"MATCH: %@ (tag %@)", s, mailETag];
if (![[self clientObject] doesMailExist]) {
return [NSException exceptionWithHTTPStatus:404 /* Not Found */
reason:@"message got deleted"];
}
response = [context response];
[response setStatus: 304 /* Not Modified */];
response = [context response];
[response setStatus: 304 /* Not Modified */];
return response;
}
}
return response;
}
}
if (![self message]) // TODO: redirect to proper error
@@ -211,8 +200,7 @@ static NSString *mailETag = nil;
request = [_ctx request];
if (mailETag != nil)
[[_ctx response] setHeader:mailETag forKey:@"etag"];
[[_ctx response] setHeader:mailETag forKey:@"etag"];
mctx = [[UIxMailRenderingContext alloc] initWithViewer: self
context: _ctx];
+18 -27
View File
@@ -20,7 +20,6 @@
*/
#import <Foundation/NSException.h>
#import <Foundation/NSUserDefaults.h>
#import <NGObjWeb/WOApplication.h>
#import <NGObjWeb/WOContext.h>
@@ -33,13 +32,13 @@
#import <NGExtensions/NSString+misc.h>
#import <NGExtensions/NSObject+Logs.h>
#import <SoObjects/SOGo/SOGoWebAuthenticator.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SOGo/SOGoDomainDefaults.h>
#import <SOGo/SOGoSystemDefaults.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoWebAuthenticator.h>
#import "SOGoRootPage.h"
static NSArray *supportedLanguages = nil;
@interface SOGoRootPage (crashAdditions)
- (void) segfault;
@@ -48,12 +47,6 @@ static NSArray *supportedLanguages = nil;
@implementation SOGoRootPage
+ (void) initialize
{
if (!supportedLanguages)
supportedLanguages = [NSArray arrayWithObjects: @"Czech", @"Welsh", @"English", @"Spanish", @"French", @"German", @"Italian", @"Hungarian", @"Dutch", @"BrazilianPortuguese", @"Russian", @"Swedish", nil];
}
/* accessors */
- (NSString *) connectURL
@@ -68,9 +61,10 @@ static NSArray *supportedLanguages = nil;
WORequest *request;
WOCookie *authCookie;
SOGoWebAuthenticator *auth;
SOGoUser *user;
SOGoUserDefaults *ud;
NSString *cookieValue, *cookieString;
NSString *userName, *password, *language;
NSArray *supportedLanguages;
auth = [[WOApplication application]
authenticatorInContext: context];
@@ -93,12 +87,14 @@ static NSArray *supportedLanguages = nil;
[authCookie setIsSecure: YES]; */
[response addCookie: authCookie];
supportedLanguages = [[SOGoSystemDefaults sharedSystemDefaults]
supportedLanguages];
if (language && [supportedLanguages containsObject: language])
{
user = [SOGoUser userWithLogin: userName roles: nil];
[[user userDefaults] setObject: language forKey: @"Language"];
[[user userDefaults] synchronize];
[user invalidateLanguage];
ud = [[SOGoUser userWithLogin: userName roles: nil]
userDefaults];
[ud setLanguage: language];
[ud synchronize];
}
}
else
@@ -160,11 +156,7 @@ static NSArray *supportedLanguages = nil;
- (NSString *) loginSuffix
{
NSUserDefaults *ud;
ud = [NSUserDefaults standardUserDefaults];
return [ud stringForKey: @"SOGoLoginSuffix"];
return [[SOGoSystemDefaults sharedSystemDefaults] loginSuffix];
}
- (BOOL) hasLoginSuffix
@@ -184,13 +176,13 @@ static NSArray *supportedLanguages = nil;
- (NSArray *) languages
{
return supportedLanguages;
return [[SOGoSystemDefaults sharedSystemDefaults] supportedLanguages];
}
- (NSString *) language
{
return [SOGoUser language];
}
// - (NSString *) language
// {
// return [SOGoUser language];
// }
- (NSString *) languageText
{
@@ -213,5 +205,4 @@ static NSArray *supportedLanguages = nil;
return aString;
}
@end /* SOGoRootPage */
+22 -58
View File
@@ -26,7 +26,6 @@
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSURL.h>
#import <Foundation/NSTimeZone.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import <NGObjWeb/NSException+HTTP.h>
#import <NGObjWeb/WOCookie.h>
@@ -36,74 +35,43 @@
#import <NGExtensions/NSObject+Logs.h>
#import <Appointments/SOGoFreeBusyObject.h>
#import <SoObjects/SOGo/SOGoUserManager.h>
#import <SoObjects/SOGo/SOGoWebAuthenticator.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/SOGoUserFolder.h>
#import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
#import <SOGo/SOGoUserManager.h>
#import <SOGo/SOGoWebAuthenticator.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/SOGoUserFolder.h>
#import <SOGo/NSCalendarDate+SOGo.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGoUI/UIxComponent.h>
#define intervalSeconds 900 /* 15 minutes */
static NSString *defaultModule = nil;
static NSString *LDAPContactInfoAttribute = nil;
@interface SOGoUserHomePage : UIxComponent
@end
@implementation SOGoUserHomePage
+ (void) initialize
{
NSUserDefaults *ud;
if (!defaultModule)
{
ud = [NSUserDefaults standardUserDefaults];
defaultModule = [ud stringForKey: @"SOGoUIxDefaultModule"];
if (defaultModule)
{
if (!([defaultModule isEqualToString: @"Calendar"]
|| [defaultModule isEqualToString: @"Contacts"]
|| [defaultModule isEqualToString: @"Mail"]))
{
[self logWithFormat: @"default module '%@' not accepted (must be"
@"'Calendar', 'Contacts' or 'Mail')", defaultModule];
defaultModule = @"Calendar";
}
}
else
defaultModule = @"Calendar";
[self logWithFormat: @"default module set to '%@'", defaultModule];
[defaultModule retain];
LDAPContactInfoAttribute = [ud stringForKey: @"SOGoLDAPContactInfoAttribute"];
[LDAPContactInfoAttribute retain];
}
}
- (id <WOActionResults>) defaultAction
{
SOGoUserFolder *co;
NSUserDefaults *ud;
NSString *userDefinedModule;
NSString *loginModule;
SOGoUserDefaults *ud;
NSURL *moduleURL;
ud = [[context activeUser] userDefaults];
userDefinedModule = [ud stringForKey: @"SOGoUIxDefaultModule"];
if (userDefinedModule)
loginModule = [ud loginModule];
if (!([loginModule isEqualToString: @"Calendar"]
|| [loginModule isEqualToString: @"Contacts"]
|| [loginModule isEqualToString: @"Mail"]))
{
if ([userDefinedModule isEqualToString: @"Last"])
userDefinedModule = [ud stringForKey: @"SOGoUIxLastModule"];
[self errorWithFormat: @"login module '%@' not accepted (must be"
@"'Calendar', 'Contacts' or 'Mail')", loginModule];
loginModule = @"Calendar";
}
if (!userDefinedModule)
userDefinedModule = defaultModule;
co = [self clientObject];
moduleURL = [NSURL URLWithString: userDefinedModule
moduleURL = [NSURL URLWithString: loginModule
relativeToURL: [co soURL]];
return [self redirectToLocation: [moduleURL absoluteString]];
@@ -219,7 +187,7 @@ static NSString *LDAPContactInfoAttribute = nil;
co = [self clientObject];
user = [context activeUser];
uTZ = [user timeZone];
uTZ = [[user userDefaults] timeZone];
queryDay = [self queryParameterForKey: @"sday"];
if ([queryDay length])
@@ -338,13 +306,8 @@ static NSString *LDAPContactInfoAttribute = nil;
// We do NOT return the current authenticated user.
if (![uid isEqualToString: login])
{
if ([LDAPContactInfoAttribute length])
{
contactInfo = [contact objectForKey: [LDAPContactInfoAttribute lowercaseString]];
if (!contactInfo)
contactInfo = @"";
}
else
contactInfo = [contact objectForKey: @"c_info"];
if (!contactInfo)
contactInfo = @"";
[responseString appendFormat: @"%@:%@:%@:%@\n", uid,
[contact objectForKey: @"cn"],
@@ -359,7 +322,7 @@ static NSString *LDAPContactInfoAttribute = nil;
- (id <WOActionResults>) usersSearchAction
{
NSString *contact;
NSString *contact, *domain;
id <WOActionResults> result;
SOGoUserManager *um;
@@ -367,6 +330,7 @@ static NSString *LDAPContactInfoAttribute = nil;
contact = [self queryParameterForKey: @"search"];
if ([contact length])
{
domain = [[context activeUser] domain];
result
= [self _usersResponseForResults: [um fetchUsersMatching: contact]];
}
+11 -10
View File
@@ -20,47 +20,48 @@
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSUserDefaults.h>
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/WODirectAction.h>
#import <NGObjWeb/WOResponse.h>
#import <SoObjects/SOGo/NSObject+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SOGo/NSObject+Utilities.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/SOGoUserSettings.h>
#import <SOGo/SOGoUserProfile.h>
#import "UIxJSONPreferences.h"
@implementation UIxJSONPreferences
- (WOResponse *) _makeResponse: (NSUserDefaults *) defaults
- (WOResponse *) _makeResponse: (SOGoUserProfile *) profile
{
WOResponse *response;
response = [context response];
[response setHeader: @"text/plain; charset=utf-8"
forKey: @"content-type"];
[response appendContentString: [defaults jsonRepresentation]];
[response appendContentString: [profile jsonRepresentation]];
return response;
}
- (WOResponse *) jsonDefaultsAction
{
NSUserDefaults *defaults;
SOGoUserDefaults *defaults;
defaults = [[context activeUser] userDefaults];
return [self _makeResponse: defaults];
return [self _makeResponse: [defaults source]];
}
- (WOResponse *) jsonSettingsAction
{
NSUserDefaults *settings;
SOGoUserSettings *settings;
settings = [[context activeUser] userSettings];
return [self _makeResponse: settings];
return [self _makeResponse: [settings source]];
}
@end
+2 -3
View File
@@ -26,7 +26,7 @@
#import <SOGoUI/UIxComponent.h>
@class NSString;
@class NSUserDefaults;
@class SOGoUserDefaults;
@class SOGoUser;
@@ -35,9 +35,8 @@
id item;
SOGoUser *user;
NSDictionary *locale;
NSUserDefaults *userDefaults;
SOGoUserDefaults *userDefaults;
NSCalendarDate *today;
NSMutableArray *hours;
NSArray *daysOfWeek, *daysBetweenResponsesList;
NSMutableDictionary *vacationOptions, *forwardOptions;
BOOL hasChanged, composeMessageTypeHasChanged;
+180 -225
View File
@@ -23,7 +23,7 @@
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSString.h>
#import <Foundation/NSTimeZone.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSUserDefaults.h> /* for locale strings */
#import <Foundation/NSPropertyList.h>
#import <Foundation/NSValue.h>
@@ -32,12 +32,15 @@
#import <NGExtensions/NSObject+Logs.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
#import <SoObjects/SOGo/NSString+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/SOGoUserFolder.h>
#import <SoObjects/Mailer/SOGoMailAccount.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGo/NSString+Utilities.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/SOGoDomainDefaults.h>
#import <SOGo/SOGoSystemDefaults.h>
#import <SOGo/SOGoUserFolder.h>
#import <Mailer/SOGoMailAccount.h>
#import "../../Main/SOGo.h"
#import "UIxPreferences.h"
@@ -50,75 +53,48 @@
workweek = from -> to
identities */
static BOOL defaultsRead = NO;
static BOOL shouldDisplayPasswordChange = NO;
static BOOL shouldDisplayAdditionalPreferences = NO;
static BOOL defaultShowSubscribedFoldersOnly = NO;
static BOOL vacationEnabled = NO;
static BOOL forwardEnabled = NO;
@implementation UIxPreferences
+ (void) initialize
{
NSUserDefaults *ud;
if (!defaultsRead)
{
ud = [NSUserDefaults standardUserDefaults];
shouldDisplayPasswordChange
= [ud boolForKey: @"SOGoUIxUserCanChangePassword"];
shouldDisplayAdditionalPreferences
= [ud boolForKey: @"SOGoUIxAdditionalPreferences"];
defaultShowSubscribedFoldersOnly
= [ud boolForKey: @"SOGoMailShowSubscribedFoldersOnly"];
vacationEnabled
= [ud boolForKey: @"SOGoVacationEnabled"];
forwardEnabled
= [ud boolForKey: @"SOGoForwardEnabled"];
defaultsRead = YES;
}
}
- (id) init
{
//NSDictionary *locale;
SOGoDomainDefaults *dd;
NSString *language;
if ((self = [super init]))
{
language = [[context activeUser] language];
item = nil;
hours = nil;
ASSIGN (user, [context activeUser]);
ASSIGN (userDefaults, [user userDefaults]);
ASSIGN (today, [NSCalendarDate date]);
//locale = [context valueForKey: @"locale"];
ASSIGN (locale, [[WOApplication application] localeForLanguageNamed: language]);
ASSIGN (daysOfWeek,
[locale objectForKey: NSWeekDayNameArray]);
language = [userDefaults language];
ASSIGN (locale,
[[WOApplication application] localeForLanguageNamed: language]);
ASSIGN (daysOfWeek, [locale objectForKey: NSWeekDayNameArray]);
hasChanged = NO;
composeMessageTypeHasChanged = NO;
if (vacationEnabled)
dd = [user domainDefaults];
if ([dd vacationEnabled])
{
vacationOptions = [userDefaults objectForKey: @"Vacation"];
vacationOptions = [userDefaults vacationOptions];
if (!vacationOptions)
{
vacationOptions = [NSMutableDictionary dictionary];
[userDefaults setObject: vacationOptions forKey: @"Vacation"];
[userDefaults setVacationOptions: vacationOptions];
}
[vacationOptions retain];
}
if (forwardEnabled)
if ([dd forwardEnabled])
{
forwardOptions = [userDefaults objectForKey: @"Forward"];
forwardOptions = [userDefaults forwardOptions];
if (!forwardOptions)
{
forwardOptions = [NSMutableDictionary dictionary];
[userDefaults setObject: forwardOptions forKey: @"Forward"];
[userDefaults setForwardOptions: forwardOptions];
}
[forwardOptions retain];
}
@@ -135,7 +111,6 @@ static BOOL forwardEnabled = NO;
[userDefaults release];
[vacationOptions release];
[forwardOptions release];
[hours release];
[daysOfWeek release];
[locale release];
[super dealloc];
@@ -169,12 +144,12 @@ static BOOL forwardEnabled = NO;
- (NSString *) userTimeZone
{
return [[user timeZone] timeZoneName];
return [userDefaults timeZoneName];
}
- (void) setUserTimeZone: (NSString *) newUserTimeZone
{
[userDefaults setObject: newUserTimeZone forKey: @"TimeZone"];
[userDefaults setTimeZoneName: newUserTimeZone];
}
- (NSArray *) shortDateFormatsList
@@ -225,22 +200,12 @@ static BOOL forwardEnabled = NO;
- (NSString *) userShortDateFormat
{
NSString *shortDateFormat;
shortDateFormat = [userDefaults objectForKey: @"ShortDateFormat"];
if (!shortDateFormat)
shortDateFormat = @"default";
return shortDateFormat;
return [userDefaults shortDateFormat];
}
- (void) setUserShortDateFormat: (NSString *) newFormat
{
if ([newFormat isEqualToString: @"default"])
[userDefaults removeObjectForKey: @"ShortDateFormat"];
else
[userDefaults setObject: newFormat forKey: @"ShortDateFormat"];
[userDefaults setShortDateFormat: newFormat];
}
- (NSArray *) longDateFormatsList
@@ -296,8 +261,7 @@ static BOOL forwardEnabled = NO;
{
NSString *longDateFormat;
longDateFormat = [userDefaults objectForKey: @"LongDateFormat"];
longDateFormat = [userDefaults longDateFormat];
if (!longDateFormat)
longDateFormat = @"default";
@@ -307,9 +271,9 @@ static BOOL forwardEnabled = NO;
- (void) setUserLongDateFormat: (NSString *) newFormat
{
if ([newFormat isEqualToString: @"default"])
[userDefaults removeObjectForKey: @"LongDateFormat"];
[userDefaults unsetLongDateFormat];
else
[userDefaults setObject: newFormat forKey: @"LongDateFormat"];
[userDefaults setLongDateFormat: newFormat];
}
- (NSArray *) timeFormatsList
@@ -360,15 +324,15 @@ static BOOL forwardEnabled = NO;
- (NSString *) userTimeFormat
{
return [user timeFormat];
return [userDefaults timeFormat];
}
- (void) setUserTimeFormat: (NSString *) newFormat
{
if ([newFormat isEqualToString: @"default"])
[userDefaults removeObjectForKey: @"TimeFormat"];
[userDefaults unsetTimeFormat];
else
[userDefaults setObject: newFormat forKey: @"TimeFormat"];
[userDefaults setTimeFormat: newFormat];
}
- (NSArray *) daysList
@@ -390,16 +354,17 @@ static BOOL forwardEnabled = NO;
- (NSString *) userWeekStartDay
{
return [NSString stringWithFormat: @"%d", [user firstDayOfWeek]];
return [NSString stringWithFormat: @"%d", [userDefaults firstDayOfWeek]];
}
- (void) setUserWeekStartDay: (NSString *) newDay
{
[userDefaults setObject: newDay forKey: @"WeekStartDay"];
[userDefaults setFirstDayOfWeek: [newDay intValue]];
}
- (NSArray *) hoursList
{
static NSMutableArray *hours = nil;
unsigned int currentHour;
if (!hours)
@@ -415,22 +380,24 @@ static BOOL forwardEnabled = NO;
- (NSString *) userDayStartTime
{
return [NSString stringWithFormat: @"%02d:00", [user dayStartHour]];
return [NSString stringWithFormat: @"%02d:00",
[userDefaults dayStartHour]];
}
- (void) setUserDayStartTime: (NSString *) newTime
{
[userDefaults setObject: newTime forKey: @"DayStartTime"];
[userDefaults setDayStartTime: newTime];
}
- (NSString *) userDayEndTime
{
return [NSString stringWithFormat: @"%02d:00", [user dayEndHour]];
return [NSString stringWithFormat: @"%02d:00",
[userDefaults dayEndHour]];
}
- (void) setUserDayEndTime: (NSString *) newTime
{
[userDefaults setObject: newTime forKey: @"DayEndTime"];
[userDefaults setDayEndTime: newTime];
}
- (NSArray *) firstWeekList
@@ -450,49 +417,48 @@ static BOOL forwardEnabled = NO;
- (NSString *) userFirstWeek
{
return [userDefaults objectForKey: @"FirstWeek"];
return [userDefaults firstWeekOfYear];
}
- (void) setUserFirstWeek: (NSString *) newFirstWeek
{
[userDefaults setObject: newFirstWeek forKey: @"FirstWeek"];
[userDefaults setFirstWeekOfYear: newFirstWeek];
}
- (NSString *) reminderEnabled
- (BOOL) reminderEnabled
{
NSString *reminderEnabled;
reminderEnabled = [userDefaults objectForKey: @"ReminderEnabled"];
return ((!reminderEnabled || [reminderEnabled boolValue])
? @"YES" : @"NO");
return [userDefaults reminderEnabled];
}
- (void) setReminderEnabled: (NSString *) newValue
- (void) setReminderEnabled: (BOOL) newValue
{
[userDefaults setObject: newValue forKey: @"ReminderEnabled"];
[userDefaults setReminderEnabled: newValue];
}
- (NSString *) remindWithASound
- (BOOL) remindWithASound
{
NSString *remindWithASound;
remindWithASound = [userDefaults objectForKey: @"RemindWithASound"];
return ((!remindWithASound || [remindWithASound boolValue])
? @"YES" : @"NO");
return [userDefaults remindWithASound];
}
- (void) setRemindWithASound: (NSString *) newValue
- (void) setRemindWithASound: (BOOL) newValue
{
[userDefaults setObject: newValue forKey: @"RemindWithASound"];
[userDefaults setRemindWithASound: newValue];
}
- (NSArray *) reminderTimesList
{
return [NSArray arrayWithObjects: @"0000", @"0005", @"0010", @"0015",
@"0030", @"0100", @"0200", @"0400", @"0800", @"1200",
@"2400", @"4800", nil];
static NSArray *reminderTimesList = nil;
if (!reminderTimesList)
{
reminderTimesList = [NSArray arrayWithObjects: @"0000", @"0005",
@"0010", @"0015", @"0030", @"0100",
@"0200", @"0400", @"0800", @"1200",
@"2400", @"4800", nil];
[reminderTimesList retain];
}
return reminderTimesList;
}
- (NSString *) itemReminderTimeText
@@ -503,70 +469,56 @@ static BOOL forwardEnabled = NO;
- (NSString *) userReminderTime
{
return [userDefaults objectForKey: @"ReminderTime"];
return [userDefaults reminderTime];
}
- (void) setReminderTime: (NSString *) newTime
{
[userDefaults setObject: newTime forKey: @"ReminderTime"];
[userDefaults setReminderTime: newTime];
}
/* Mailer */
- (void) setShowSubscribedFoldersOnly: (BOOL) showSubscribedFoldersOnly
{
[userDefaults setBool: showSubscribedFoldersOnly forKey: @"showSubscribedFoldersOnly"]; // should be capitalized ..
[userDefaults setMailShowSubscribedFoldersOnly: showSubscribedFoldersOnly];
}
- (BOOL) showSubscribedFoldersOnly
{
NSString *showSubscribedFoldersOnly;
BOOL r;
showSubscribedFoldersOnly = [userDefaults stringForKey: @"showSubscribedFoldersOnly"];
if (showSubscribedFoldersOnly)
r = [showSubscribedFoldersOnly boolValue];
else
r = defaultShowSubscribedFoldersOnly;
return r;
return [userDefaults mailShowSubscribedFoldersOnly];
}
- (NSArray *) messageCheckList
{
NSArray *defaultList;
NSMutableArray *rc;
NSString *tmp;
int i, count;
NSArray *intervalsList;
NSMutableArray *messageCheckList;
NSString *value;
int count, max, interval;
defaultList = [NSMutableArray arrayWithArray:
[[NSUserDefaults standardUserDefaults]
arrayForKey: @"SOGoMailPollingIntervals"]];
if ([defaultList count] > 0)
intervalsList = [[user domainDefaults] mailPollingIntervals];
messageCheckList = [NSMutableArray arrayWithObjects: @"manually", nil];
max = [intervalsList count];
for (count = 0; count < max; count++)
{
rc = [NSMutableArray arrayWithObjects: @"manually", nil];
count = [defaultList count];
for (i = 0; i < count; i++)
interval = [[intervalsList objectAtIndex: count] intValue];
value = nil;
if (interval == 1)
value = @"every_minute";
else if (interval == 60)
value = @"once_per_hour";
else if (interval == 2 || interval == 5 || interval == 10
|| interval == 20 || interval == 30)
value = [NSString stringWithFormat: @"every_%d_minutes", interval];
else
{
int value = [[defaultList objectAtIndex: i] intValue];
tmp = nil;
if (value == 1)
tmp = @"every_minute";
else if (value == 60)
tmp = @"once_per_hour";
else if (value == 2 || value == 5 || value == 10
|| value == 20 || value == 30)
tmp = [NSString stringWithFormat: @"every_%d_minutes", value];
if (tmp)
[rc addObject: tmp];
[self warnWithFormat: @"interval '%d' not handled", interval];
value = nil;
}
if (value)
[messageCheckList addObject: value];
}
else
rc = [NSArray arrayWithObjects: @"manually", @"every_minute",
@"every_2_minutes", @"every_5_minutes", @"every_10_minutes",
@"every_20_minutes", @"every_30_minutes", @"once_per_hour",
nil];
return rc;
return messageCheckList;
}
- (NSString *) itemMessageCheckText
@@ -577,12 +529,12 @@ static BOOL forwardEnabled = NO;
- (NSString *) userMessageCheck
{
return [userDefaults stringForKey: @"MessageCheck"];
return [userDefaults mailMessageCheck];
}
- (void) setUserMessageCheck: (NSString *) newMessageCheck
{
[userDefaults setObject: newMessageCheck forKey: @"MessageCheck"];
[userDefaults setMailMessageCheck: newMessageCheck];
}
- (NSArray *) messageForwardingList
@@ -598,14 +550,15 @@ static BOOL forwardEnabled = NO;
- (NSString *) userMessageForwarding
{
return [user messageForwarding];
return [userDefaults mailMessageForwarding];
}
- (void) setUserMessageForwarding: (NSString *) newMessageForwarding
{
[userDefaults setObject: newMessageForwarding forKey: @"MessageForwarding"];
[userDefaults setMailMessageForwarding: newMessageForwarding];
}
/*
// <label><var:string label:value="Default identity:"/>
// <var:popup list="identitiesList" item="item"
// string="itemIdentityText" selection="defaultIdentity"/></label>
@@ -622,17 +575,16 @@ static BOOL forwardEnabled = NO;
- (NSString *) itemIdentityText
{
return [(NSDictionary *) item keysWithFormat: @"%{fullName} <%{email}>"];
}
} */
- (NSString *) signature
{
[user migrateSignature];
return [userDefaults stringForKey: @"MailSignature"];
return [userDefaults mailSignature];
}
- (void) setSignature: (NSString *) newSignature
{
[userDefaults setObject: newSignature forKey: @"MailSignature"];
[userDefaults setMailSignature: newSignature];
}
- (NSArray *) replyPlacementList
@@ -648,17 +600,12 @@ static BOOL forwardEnabled = NO;
- (NSString *) userReplyPlacement
{
return [user replyPlacement];
return [userDefaults mailReplyPlacement];
}
- (void) setUserReplyPlacement: (NSString *) newReplyPlacement
{
[userDefaults setObject: newReplyPlacement forKey: @"ReplyPlacement"];
}
- (NSArray *) signaturePlacementList
{
return [NSArray arrayWithObjects: @"above", @"below", nil];
[userDefaults setMailReplyPlacement: newReplyPlacement];
}
- (NSString *) itemSignaturePlacementText
@@ -667,9 +614,19 @@ static BOOL forwardEnabled = NO;
[NSString stringWithFormat: @"signatureplacement_%@", item]];
}
- (NSArray *) signaturePlacementList
{
return [NSArray arrayWithObjects: @"above", @"below", nil];
}
- (void) setUserSignaturePlacement: (NSString *) newSignaturePlacement
{
[userDefaults setMailSignaturePlacement: newSignaturePlacement];
}
- (NSString *) userSignaturePlacement
{
return [user signaturePlacement];
return [userDefaults mailSignaturePlacement];
}
- (NSArray *) composeMessagesType
@@ -679,46 +636,33 @@ static BOOL forwardEnabled = NO;
- (NSString *) itemComposeMessagesText
{
return [self labelForKey: [NSString stringWithFormat: @"composemessagestype_%@", item]];
return [self labelForKey: [NSString stringWithFormat:
@"composemessagestype_%@", item]];
}
- (NSString *) userComposeMessagesType
{
NSString *userComposeMessagesType;
userComposeMessagesType
= [userDefaults stringForKey: @"ComposeMessagesType"];
if (!userComposeMessagesType)
userComposeMessagesType = @"text";
return userComposeMessagesType;
return [userDefaults mailComposeMessageType];
}
- (void) setUserComposeMessagesType: (NSString *) newType
{
if (![[self userComposeMessagesType] isEqualToString: newType])
{
composeMessageTypeHasChanged = YES;
[userDefaults setObject: newType forKey: @"ComposeMessagesType"];
}
}
- (void) setUserSignaturePlacement: (NSString *) newSignaturePlacement
{
[userDefaults setObject: newSignaturePlacement forKey: @"SignaturePlacement"];
composeMessageTypeHasChanged = YES;
[userDefaults setMailComposeMessageType: newType];
}
/* mail autoreply (vacation) */
- (BOOL) isVacationEnabled
{
return vacationEnabled;
return [[user domainDefaults] vacationEnabled];
}
- (void) setEnableVacation: (BOOL) enableVacation
{
[vacationOptions setObject: [NSNumber numberWithBool: enableVacation]
forKey: @"enabled"];
forKey: @"enabled"];
}
- (BOOL) enableVacation
@@ -728,8 +672,7 @@ static BOOL forwardEnabled = NO;
- (void) setAutoReplyText: (NSString *) theText
{
[vacationOptions setObject: theText
forKey: @"autoReplyText"];
[vacationOptions setObject: theText forKey: @"autoReplyText"];
}
- (NSString *) autoReplyText
@@ -741,8 +684,8 @@ static BOOL forwardEnabled = NO;
{
NSArray *addresses;
addresses = [[theAddresses componentsSeparatedByString: @","] trimmedComponents];
addresses = [[theAddresses componentsSeparatedByString: @","]
trimmedComponents];
[vacationOptions setObject: addresses
forKey: @"autoReplyEmailAddresses"];
}
@@ -756,7 +699,7 @@ static BOOL forwardEnabled = NO;
uniqueAddressesList = [NSMutableArray array];
addressesList = [NSMutableArray arrayWithArray: [user allEmails]];
for (i = 0; i < [addressesList count]; i++)
for (i = 0; i < [addressesList count]; i++)
{
address = [addressesList objectAtIndex: i];
if (![uniqueAddressesList containsObject: address])
@@ -772,17 +715,19 @@ static BOOL forwardEnabled = NO;
addressesList = [vacationOptions objectForKey: @"autoReplyEmailAddresses"];
return (addressesList?
[addressesList componentsJoinedByString: @", "] : [self defaultEmailAddresses]);
return (addressesList
? [addressesList componentsJoinedByString: @", "]
: [self defaultEmailAddresses]);
}
- (NSArray *) daysBetweenResponsesList
{
static NSArray* daysBetweenResponses = nil;
static NSArray *daysBetweenResponses = nil;
if (!daysBetweenResponses)
{
daysBetweenResponses = [NSArray arrayWithObjects: @"1", @"2", @"3", @"5", @"7", @"14", @"21", @"30", nil];
daysBetweenResponses = [NSArray arrayWithObjects: @"1", @"2", @"3",
@"5", @"7", @"14", @"21", @"30", nil];
[daysBetweenResponses retain];
}
@@ -831,7 +776,7 @@ static BOOL forwardEnabled = NO;
- (BOOL) isForwardEnabled
{
return forwardEnabled;
return [[user domainDefaults] forwardEnabled];
}
- (void) setEnableForward: (BOOL) enableForward
@@ -871,18 +816,22 @@ static BOOL forwardEnabled = NO;
- (NSArray *) availableModules
{
NSMutableArray *rc, *modules;
int i, count;
NSMutableArray *availableModules, *modules;
NSString *module;
int count, max;
modules = [NSMutableArray arrayWithObjects: @"Calendar", @"Mail", nil];
rc = [NSMutableArray arrayWithObjects: @"Last", @"Contacts", nil];
count = [modules count];
availableModules = [NSMutableArray arrayWithObjects: @"Last", @"Contacts",
nil];
max = [modules count];
for (count = 0; count < max; count++)
{
module = [modules objectAtIndex: count];
if ([user canAccessModule: module])
[availableModules addObject: module];
}
for (i = 0; i < count; i++)
if ([user canAccessModule: [modules objectAtIndex: i]])
[rc addObject: [modules objectAtIndex: i]];
return rc;
return availableModules;
}
- (NSString *) itemModuleText
@@ -892,17 +841,25 @@ static BOOL forwardEnabled = NO;
- (NSString *) userDefaultModule
{
NSUserDefaults *ud;
ud = [user userDefaults];
NSString *userDefaultModule;
return [ud stringForKey: @"SOGoUIxDefaultModule"];
if ([userDefaults rememberLastModule])
userDefaultModule = @"Last";
else
userDefaultModule = [userDefaults loginModule];
return userDefaultModule;
}
- (void) setUserDefaultModule: (NSString *) newValue
{
NSUserDefaults *ud;
ud = [user userDefaults];
[ud setObject: newValue forKey: @"SOGoUIxDefaultModule"];
if ([newValue isEqualToString: @"Last"])
[userDefaults setRememberLastModule: YES];
else
{
[userDefaults setRememberLastModule: NO];
[userDefaults setLoginModule: newValue];
}
}
- (id <WOActionResults>) defaultAction
@@ -922,10 +879,10 @@ static BOOL forwardEnabled = NO;
mailAccounts = [[[context activeUser] mailAccounts] objectAtIndex: 0];
folder = [[self clientObject] mailAccountsFolder: @"Mail"
inContext: context];
inContext: context];
account = [folder lookupName: [[mailAccounts objectForKey: @"name"] asCSSIdentifier]
inContext: context
acquire: NO];
inContext: context
acquire: NO];
[account updateFilters];
@@ -966,12 +923,14 @@ static BOOL forwardEnabled = NO;
- (BOOL) shouldDisplayAdditionalPreferences
{
return shouldDisplayAdditionalPreferences;
return [[SOGoSystemDefaults sharedSystemDefaults]
uixAdditionalPreferences];
}
- (BOOL) shouldDisplayPasswordChange
{
return shouldDisplayPasswordChange;
return [[SOGoSystemDefaults sharedSystemDefaults]
userCanChangePassword];
}
- (NSString *) nameLabel
@@ -987,26 +946,25 @@ static BOOL forwardEnabled = NO;
- (NSArray *) categories
{
NSDictionary *element;
NSArray *k, *v, *names;
NSMutableArray *rc, *colors;
NSArray *k, *v, *names, *colors;
NSMutableArray *categories, *newColors;
int i, count;
names = [userDefaults arrayForKey: @"CalendarCategories"];
names = [userDefaults calendarCategories];
if (names)
colors = [NSMutableArray arrayWithArray:
[userDefaults arrayForKey: @"CalendarCategoriesColors"]];
colors = [userDefaults calendarCategoriesColors];
else
{
names = [[self labelForKey: @"category_labels"]
componentsSeparatedByString: @","];
count = [names count];
colors = [NSMutableArray arrayWithCapacity: count];
newColors = [NSMutableArray arrayWithCapacity: count];
for (i = 0; i < count; i++)
[colors addObject: @"#F0F0F0"];
[newColors addObject: @"#F0F0F0"];
colors = newColors;
}
rc = [NSMutableArray array];
categories = [NSMutableArray array];
k = [NSArray arrayWithObjects: @"name", @"color", nil];
count = [names count];
@@ -1017,10 +975,10 @@ static BOOL forwardEnabled = NO;
element = [NSDictionary dictionaryWithObjects: v
forKeys: k];
[rc addObject: element];
[categories addObject: element];
}
return rc;
return categories;
}
@@ -1049,29 +1007,26 @@ static BOOL forwardEnabled = NO;
}
else
{
[userDefaults setObject: [plist objectAtIndex: 0]
forKey: @"CalendarCategories"];
[userDefaults setObject: [plist objectAtIndex: 1]
forKey: @"CalendarCategoriesColors"];
[userDefaults setCalendarCategories: [plist objectAtIndex: 0]];
[userDefaults setCalendarCategoriesColors: [plist objectAtIndex: 1]];
}
}
- (NSArray *) languages
{
return [NSArray arrayWithObjects: @"Czech", @"Dutch", @"English", @"French",
@"German", @"Hungarian", @"Italian", @"BrazilianPortuguese",
@"Russian", @"Spanish", @"Welsh", nil];
return [[SOGoSystemDefaults sharedSystemDefaults]
supportedLanguages];
}
- (NSString *) language
{
return [userDefaults objectForKey: @"Language"];
return [userDefaults language];
}
- (void) setLanguage: (NSString *) newLanguage
{
if ([[self languages] containsObject: newLanguage])
[userDefaults setObject: newLanguage forKey: @"Language"];
[userDefaults setLanguage: newLanguage];
}
- (NSString *) languageText
+1 -3
View File
@@ -16,8 +16,7 @@ libSOGoUI_HEADER_FILES += \
\
UIxJSClose.h \
UIxComponent.h \
SOGoAptFormatter.h \
WOContext+UIx.h \
SOGoAptFormatter.h
libSOGoUI_OBJC_FILES += \
\
@@ -25,7 +24,6 @@ libSOGoUI_OBJC_FILES += \
UIxComponent.m \
UIxModuleAccessDenied.m \
SOGoAptFormatter.m \
WOContext+UIx.m \
SOGoACLAdvisory.m \
SOGoFolderAdvisory.m
+5 -3
View File
@@ -193,6 +193,7 @@
NGMutableHashMap *headerMap;
NGMimeMessage *message;
NGMimeMultipartBody *body;
SOGoMailer *mailer;
SOGoUser *activeUser;
NSDictionary *identity;
NSString *from, *fullMail;
@@ -222,9 +223,10 @@
[message setBody: body];
[body release];
[[SOGoMailer sharedMailer] sendMimePart: message
toRecipients: [NSArray arrayWithObject: recipient]
sender: from];
mailer = [SOGoMailer mailerWithDomainDefaults: [activeUser domainDefaults]];
[mailer sendMimePart: message
toRecipients: [NSArray arrayWithObject: recipient]
sender: from];
}
@end
+6 -3
View File
@@ -172,6 +172,7 @@
NGMutableHashMap *headerMap;
NGMimeMessage *message;
NGMimeMultipartBody *body;
SOGoDomainDefaults *dd;
SOGoUser *activeUser;
NSDictionary *identity;
NSString *from, *fullMail;
@@ -201,9 +202,11 @@
[message setBody: body];
[body release];
[[SOGoMailer sharedMailer] sendMimePart: message
toRecipients: [NSArray arrayWithObject: recipient]
sender: from];
dd = [activeUser domainDefaults];
[[SOGoMailer mailerWithDomainDefaults: dd]
sendMimePart: message
toRecipients: [NSArray arrayWithObject: recipient]
sender: from];
}
@end
+21 -23
View File
@@ -22,7 +22,6 @@
#import <Foundation/NSDictionary.h>
#import <Foundation/NSException.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSPathUtilities.h>
#import <Foundation/NSString.h>
@@ -39,14 +38,15 @@
#import <NGExtensions/NSString+misc.h>
#import <NGExtensions/NSURL+misc.h>
#import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
#import <SoObjects/SOGo/NSObject+Utilities.h>
#import <SoObjects/SOGo/NSString+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/SOGoObject.h>
#import <SoObjects/SOGo/SOGoContentObject.h>
// #import <SoObjects/SOGo/SOGoCustomGroupFolder.h>
#import <SoObjects/SOGo/SOGoPermissions.h>
#import <SOGo/NSCalendarDate+SOGo.h>
#import <SOGo/NSObject+Utilities.h>
#import <SOGo/NSString+Utilities.h>
#import <SOGo/SOGoContentObject.h>
#import <SOGo/SOGoObject.h>
#import <SOGo/SOGoPermissions.h>
#import <SOGo/SOGoSystemDefaults.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import "UIxJSClose.h"
@@ -64,21 +64,15 @@ static NSMutableArray *abbrDayLabelKeys = nil;
static NSMutableArray *monthLabelKeys = nil;
static NSMutableArray *abbrMonthLabelKeys = nil;
static BOOL uixDebugEnabled = NO;
+ (int)version {
return [super version] + 0 /* v2 */;
}
+ (void)initialize {
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
NSAssert2([super version] == 2,
@"invalid superclass (%@) version %i !",
NSStringFromClass([self superclass]), [super version]);
uixDebugEnabled = [ud boolForKey:@"SOGoUIxDebugEnabled"];
if (dayLabelKeys == nil) {
dayLabelKeys = [[NSMutableArray alloc] initWithCapacity:7];
[dayLabelKeys addObject:@"Sunday"];
@@ -409,16 +403,16 @@ static BOOL uixDebugEnabled = NO;
- (NSCalendarDate *) selectedDate
{
NSTimeZone *userTimeZone;
SOGoUserDefaults *ud;
if (!_selectedDate)
{
userTimeZone = [[context activeUser] timeZone];
ud = [[context activeUser] userDefaults];
_selectedDate
= [NSCalendarDate
dateFromShortDateString: [self queryParameterForKey: @"day"]
andShortTimeString: [self queryParameterForKey: @"hm"]
inTimeZone: userTimeZone];
inTimeZone: [ud timeZone]];
[_selectedDate retain];
}
@@ -427,10 +421,10 @@ static BOOL uixDebugEnabled = NO;
- (NSString *) dateStringForDate: (NSCalendarDate *) _date
{
NSTimeZone *userTimeZone;
SOGoUserDefaults *ud;
userTimeZone = [[context activeUser] timeZone];
[_date setTimeZone: userTimeZone];
ud = [[context activeUser] userDefaults];
[_date setTimeZone: [ud timeZone]];
return [_date descriptionWithCalendarFormat: @"%Y%m%d"];
}
@@ -659,9 +653,13 @@ static BOOL uixDebugEnabled = NO;
return SOGoBuildDate;
}
- (BOOL)isUIxDebugEnabled
- (BOOL) isUIxDebugEnabled
{
return uixDebugEnabled;
SOGoSystemDefaults *sd;
sd = [SOGoSystemDefaults sharedSystemDefaults];
return [sd uixDebugEnabled];
}
@end /* UIxComponent */
-33
View File
@@ -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 __SOGoUI_WOContext_UIx_H_
#define __SOGoUI_WOContext_UIx_H_
#include <NGObjWeb/WOContext.h>
@interface WOContext (UIx)
- (BOOL)isUIxDebugEnabled;
@end
#endif /* __SOGoUI_WOContext_UIx_H_ */
-44
View File
@@ -1,44 +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.
*/
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import "WOContext+UIx.h"
@implementation WOContext (UIx)
- (BOOL)isUIxDebugEnabled {
NSNumber *bv;
if ((bv = [self objectForKey:@"_isUIxDebugEnabled"]) == nil) {
NSUserDefaults *ud;
BOOL uixDebugEnabled;
ud = [NSUserDefaults standardUserDefaults];
uixDebugEnabled = [ud boolForKey:@"SOGoUIxDebugEnabled"];
bv = [NSNumber numberWithBool:uixDebugEnabled];
[self setObject:bv forKey:@"_isUIxDebugEnabled"];
}
return [bv boolValue];
}
@end
+33 -21
View File
@@ -43,17 +43,18 @@
#import <NGCards/iCalTimeZone.h>
#import <NGCards/iCalDateTime.h>
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/SOGoDateFormatter.h>
#import <SoObjects/SOGo/SOGoContentObject.h>
#import <SoObjects/SOGo/SOGoPermissions.h>
#import <SoObjects/Appointments/iCalPerson+SOGo.h>
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
#import <SoObjects/Appointments/SOGoAppointmentObject.h>
#import <SoObjects/Appointments/SOGoAppointmentOccurence.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGo/SOGoContentObject.h>
#import <SOGo/SOGoDateFormatter.h>
#import <SOGo/SOGoPermissions.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <Appointments/iCalPerson+SOGo.h>
#import <Appointments/SOGoAppointmentFolder.h>
#import <Appointments/SOGoAppointmentObject.h>
#import <Appointments/SOGoAppointmentOccurence.h>
#import <SoObjects/Appointments/SOGoComponentOccurence.h>
#import <Appointments/SOGoComponentOccurence.h>
#import "UIxComponentEditor.h"
#import "UIxAppointmentEditor.h"
@@ -207,22 +208,22 @@
{
NSCalendarDate *newStartDate, *now;
NSTimeZone *timeZone;
SOGoUser *user;
SOGoUserDefaults *ud;
int hour;
unsigned int uStart, uEnd;
newStartDate = [self selectedDate];
if (![[self queryParameterForKey: @"hm"] length])
{
ud = [[context activeUser] userDefaults];
timeZone = [ud timeZone];
now = [NSCalendarDate calendarDate];
timeZone = [[context activeUser] timeZone];
[now setTimeZone: timeZone];
user = [context activeUser];
uStart = [user dayStartHour];
uStart = [ud dayStartHour];
if ([now isDateOnSameDay: newStartDate])
{
uEnd = [user dayEndHour];
uEnd = [ud dayEndHour];
hour = [now hourOfDay];
if (hour < uStart)
newStartDate = [now hour: uStart minute: 0];
@@ -245,10 +246,13 @@
NSTimeZone *timeZone;
unsigned int minutes;
SOGoObject <SOGoComponentOccurence> *co;
SOGoUserDefaults *ud;
[self event];
co = [self clientObject];
timeZone = [[context activeUser] timeZone];
ud = [[context activeUser] userDefaults];
timeZone = [ud timeZone];
if ([co isNew]
&& [co isKindOfClass: [SOGoCalendarComponent class]])
@@ -343,8 +347,13 @@
iCalRecurrenceRule *rule;
NSEnumerator *rules;
NSCalendarDate *untilDate;
SOGoUserDefaults *ud;
NSTimeZone *timeZone;
rules = [[event recurrenceRules] objectEnumerator];
ud = [[context activeUser] userDefaults];
timeZone = [ud timeZone];
while ((rule = [rules nextObject]))
{
untilDate = [rule untilDate];
@@ -354,7 +363,7 @@
NSCalendarDate *date;
date = [[event startDate] copy];
[date setTimeZone: [[context activeUser] timeZone]];
[date setTimeZone: timeZone];
untilDate = [untilDate dateByAddingYears:0
months:0
days:0
@@ -431,7 +440,7 @@
NSDictionary *data;
NSCalendarDate *firstDate, *eventDate;
NSTimeZone *timeZone;
SOGoUser *user;
SOGoUserDefaults *ud;
SOGoCalendarComponent *co;
iCalEvent *master;
BOOL resetAlarm;
@@ -440,8 +449,8 @@
[self event];
result = [self responseWithStatus: 200];
user = [context activeUser];
timeZone = [user timeZone];
ud = [[context activeUser] userDefaults];
timeZone = [ud timeZone];
eventDate = [event startDate];
[eventDate setTimeZone: timeZone];
co = [self clientObject];
@@ -504,6 +513,7 @@
inContext: (WOContext *) _ctx
{
int nbrDays;
SOGoUserDefaults *ud;
[self event];
@@ -526,8 +536,10 @@
if ([[self clientObject] isNew])
{
iCalTimeZone *tz;
ud = [[context activeUser] userDefaults];
tz = [iCalTimeZone timeZoneForName: [[[context activeUser] timeZone] name]];
tz = [iCalTimeZone timeZoneForName: [ud timeZoneName]];
[[event parent] addTimeZone: tz];
[(iCalDateTime *)[event uniqueChildWithTag: @"dtstart"] setTimeZone: tz];
[(iCalDateTime *)[event uniqueChildWithTag: @"dtend"] setTimeZone: tz];
+12 -3
View File
@@ -23,7 +23,8 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <Common/UIxPageFrame.h>
#import "UIxAttendeesEditor.h"
@@ -79,12 +80,20 @@
- (unsigned int) dayStartHour
{
return [[context activeUser] dayStartHour];
SOGoUserDefaults *ud;
ud = [[context activeUser] userDefaults];
return [ud dayStartHour];
}
- (unsigned int) dayEndHour
{
return [[context activeUser] dayEndHour];
SOGoUserDefaults *ud;
ud = [[context activeUser] userDefaults];
return [ud dayEndHour];
}
@end
+7 -1
View File
@@ -22,6 +22,8 @@
#import <NGExtensions/NSCalendarDate+misc.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/NSCalendarDate+SOGo.h>
#import "UIxCalDateSelector.h"
@@ -95,7 +97,11 @@
- (unsigned int) firstDayOfWeek
{
return [[context activeUser] firstDayOfWeek];
SOGoUserDefaults *ud;
ud = [[context activeUser] userDefaults];
return [ud firstDayOfWeek];
}
/* labels */
-1
View File
@@ -43,7 +43,6 @@
NSMutableArray *hoursToDisplay;
NSArray *weekDays;
SOGoDateFormatter *dateFormatter;
NSUserDefaults *ud;
NSString *timeFormat;
}
+19 -16
View File
@@ -25,14 +25,15 @@
#import <Foundation/NSDictionary.h>
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSUserDefaults.h> /* for locale string constants */
#import <Foundation/NSValue.h>
#import <NGExtensions/NSCalendarDate+misc.h>
#import <EOControl/EOQualifier.h>
#import <SoObjects/SOGo/SOGoDateFormatter.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SOGo/SOGoDateFormatter.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import "../../Main/SOGo.h"
@@ -44,12 +45,17 @@
- (id) init
{
NSDictionary *locale;
NSString *language;
SOGoUser *user;
SOGoUserDefaults *ud;
if ((self = [super init]))
{
NSDictionary *locale;
NSString *language;
language = [[context activeUser] language];
user = [context activeUser];
ud = [user userDefaults];
ASSIGN (timeFormat, [ud timeFormat]);
language = [ud language];
locale = [[WOApplication application] localeForLanguageNamed: language];
daysToDisplay = nil;
@@ -60,10 +66,10 @@
currentTableHour = nil;
weekDays = [locale objectForKey: NSShortWeekDayNameArray];
[weekDays retain];
dateFormatter = [[context activeUser] dateFormatterInContext: context];
dateFormatter = [user dateFormatterInContext: context];
[dateFormatter retain];
}
return self;
}
@@ -75,6 +81,7 @@
[daysToDisplay release];
[hoursToDisplay release];
[dateFormatter release];
[timeFormat release];
[super dealloc];
}
@@ -120,9 +127,6 @@
{
unsigned int currentHour, lastHour;
// For later in method currentTableHour
timeFormat = [[context activeUser] timeFormat];
if (!hoursToDisplay)
{
hoursToDisplay = [NSMutableArray new];
@@ -333,14 +337,13 @@
{
NSMutableString *cellClass;
int hour;
SOGoUser *user;
SOGoUserDefaults *ud;
cellClass = [NSMutableString string];
hour = [currentTableHour intValue];
user = [context activeUser];
ud = [[context activeUser] userDefaults];
[cellClass appendFormat: @"clickableHourCell clickableHourCell%d", hour];
if (hour < [user dayStartHour]
|| hour > [user dayEndHour] - 1)
if (hour < [ud dayStartHour] || hour > [ud dayEndHour] - 1)
[cellClass appendString: @" outOfDay"];
return cellClass;
+3 -4
View File
@@ -24,7 +24,6 @@
#import <Foundation/NSDictionary.h>
#import <Foundation/NSString.h>
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSUserDefaults.h>
#import <NGObjWeb/WOContext.h>
@@ -113,13 +112,13 @@ static NSArray *filters = nil;
- (NSString *) selectedFilter
{
NSString *selectedFilter;
NSUserDefaults *ud;
SOGoUserSettings *us;
selectedFilter = [self queryParameterForKey: @"filterpopup"];
if (![selectedFilter length])
{
ud = [[context activeUser] userDefaults];
selectedFilter = [ud objectForKey: @"CalendarDefaultFilter"];
us = [[context activeUser] userSettings];
selectedFilter = [us objectForKey: @"CalendarDefaultFilter"];
}
if (![selectedFilter length])
selectedFilter = @"view_today";
+34 -37
View File
@@ -27,7 +27,6 @@
#import <Foundation/NSString.h>
#import <Foundation/NSTimeZone.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSUserDefaults.h>
#import <NGObjWeb/WOContext.h>
#import <NGObjWeb/WOContext+SoObjects.h>
@@ -40,15 +39,17 @@
#import <NGExtensions/NSCalendarDate+misc.h>
#import <NGExtensions/NSObject+Logs.h>
#import <SoObjects/SOGo/SOGoDateFormatter.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/SOGoUserFolder.h>
#import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
#import <SoObjects/SOGo/NSObject+Utilities.h>
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
#import <SoObjects/Appointments/SOGoAppointmentFolders.h>
#import <SoObjects/Appointments/SOGoAppointmentObject.h>
#import <SOGo/SOGoDateFormatter.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/SOGoUserFolder.h>
#import <SOGo/SOGoUserSettings.h>
#import <SOGo/NSCalendarDate+SOGo.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/NSObject+Utilities.h>
#import <Appointments/SOGoAppointmentFolder.h>
#import <Appointments/SOGoAppointmentFolders.h>
#import <Appointments/SOGoAppointmentObject.h>
#import <Appointments/SOGoFreeBusyObject.h>
#import <UI/Common/WODirectAction+SOGo.h>
@@ -104,7 +105,7 @@ static NSArray *tasksFields = nil;
ASSIGN (request, newRequest);
user = [[self context] activeUser];
ASSIGN (dateFormatter, [user dateFormatterInContext: context]);
ASSIGN (userTimeZone, [user timeZone]);
ASSIGN (userTimeZone, [[user userDefaults] timeZone]);
dayBasedView = NO;
}
@@ -193,17 +194,15 @@ static NSArray *tasksFields = nil;
- (void) _setupContext
{
SOGoUser *user;
NSTimeZone *userTZ;
NSString *param;
user = [context activeUser];
userLogin = [user login];
userTZ = [user timeZone];
param = [request formValueForKey: @"filterpopup"];
if ([param length])
{
[self _setupDatesWithPopup: param andUserTZ: userTZ];
[self _setupDatesWithPopup: param andUserTZ: userTimeZone];
title = [request formValueForKey: @"search"];
}
else
@@ -212,7 +211,7 @@ static NSArray *tasksFields = nil;
if ([param length] > 0)
startDate = [[NSCalendarDate dateFromShortDateString: param
andShortTimeString: nil
inTimeZone: userTZ] beginOfDay];
inTimeZone: userTimeZone] beginOfDay];
else
startDate = nil;
@@ -220,7 +219,7 @@ static NSArray *tasksFields = nil;
if ([param length] > 0)
endDate = [[NSCalendarDate dateFromShortDateString: param
andShortTimeString: nil
inTimeZone: userTZ] endOfDay];
inTimeZone: userTimeZone] endOfDay];
else
endDate = nil;
@@ -462,16 +461,16 @@ static NSArray *tasksFields = nil;
- (void) checkFilterValue
{
NSString *filter;
NSUserDefaults *ud;
SOGoUserSettings *us;
filter = [[context request] formValueForKey: @"filterpopup"];
if ([filter length]
if ([filter length]
&& ![filter isEqualToString: @"view_all"]
&& ![filter isEqualToString: @"view_future"])
{
ud = [[context activeUser] userDefaults];
[ud setObject: filter forKey: @"CalendarDefaultFilter"];
[ud synchronize];
us = [[context activeUser] userSettings];
[us setObject: filter forKey: @"CalendarDefaultFilter"];
[us synchronize];
}
}
@@ -986,10 +985,10 @@ _computeBlocksPosition (NSArray *blocks)
- (WOResponse *) tasksListAction
{
NSUserDefaults *ud;
SOGoUserSettings *us;
NSEnumerator *tasks;
NSMutableArray *filteredTasks, *filteredTask;
BOOL showCompleted, setUserDefault;
BOOL showCompleted;
NSArray *task;
int statusCode;
unsigned int endDateStamp;
@@ -999,19 +998,17 @@ _computeBlocksPosition (NSArray *blocks)
[self _setupContext];
#warning see TODO in SchedulerUI.js about "setud"
showCompleted = [[request formValueForKey: @"show-completed"] intValue];
if ([request formValueForKey: @"setud"])
{
us = [[context activeUser] userSettings];
[us setBool: showCompleted forKey: @"ShowCompletedTasks"];
[us synchronize];
}
tasks = [[self _fetchFields: tasksFields
forComponentOfType: @"vtodo"] objectEnumerator];
showCompleted = [[request formValueForKey: @"show-completed"] intValue];
setUserDefault = [[request formValueForKey: @"setud"] intValue];
if (setUserDefault)
{
ud = [[context activeUser] userDefaults];
[ud setBool: showCompleted
forKey: @"ShowCompletedTasks"];
[ud synchronize];
}
while ((task = [tasks nextObject]))
{
statusCode = [[task objectAtIndex: 2] intValue];
@@ -1256,7 +1253,7 @@ _computeBlocksPosition (NSArray *blocks)
- (NSArray *) _loadScheduleLimitsForUsers: (NSArray *) users
{
NSUserDefaults *ud;
SOGoUserDefaults *ud;
NSCalendarDate *from, *to, *maxFrom, *maxTo;
int count;
@@ -1271,9 +1268,9 @@ _computeBlocksPosition (NSArray *blocks)
roles: nil] userDefaults];
if (ud)
{
from = [NSCalendarDate dateWithString: [ud objectForKey: @"DayStartTime"]
from = [NSCalendarDate dateWithString: [ud dayStartTime]
calendarFormat: @"%H:%M"];
to = [NSCalendarDate dateWithString: [ud objectForKey: @"DayEndTime"]
to = [NSCalendarDate dateWithString: [ud dayEndTime]
calendarFormat: @"%H:%M"];
maxFrom = (NSCalendarDate *)[from laterDate: maxFrom];
maxTo = (NSCalendarDate *)[to earlierDate: maxTo];
+25 -27
View File
@@ -27,15 +27,34 @@
#import <NGObjWeb/WORequest.h>
#import <NGObjWeb/WOResponse.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
#import <SoObjects/Appointments/SOGoWebAppointmentFolder.h>
#import <SoObjects/Appointments/SOGoAppointmentFolders.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserSettings.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <Appointments/SOGoWebAppointmentFolder.h>
#import <Appointments/SOGoAppointmentFolders.h>
#import "UIxCalMainActions.h"
@implementation UIxCalMainActions
- (NSString *) displayNameForUrl: (NSString *) calendarURL
{
NSString *rc, *tmp;
tmp = [calendarURL lastPathComponent];
if (tmp)
{
if ([[tmp pathExtension] caseInsensitiveCompare: @"ics"] == NSOrderedSame)
rc = [tmp substringToIndex: [tmp length] - 4];
else
rc = tmp;
}
else
rc = [self labelForKey: @"Web Calendar"];
return rc;
}
- (WOResponse *) addWebCalendarAction
{
WORequest *r;
@@ -85,29 +104,10 @@
return response;
}
- (NSString *) displayNameForUrl: (NSString *) calendarURL
{
NSString *rc, *tmp;
tmp = [calendarURL lastPathComponent];
if (tmp)
{
if ([[tmp pathExtension] caseInsensitiveCompare: @"ics"] == NSOrderedSame)
rc = [tmp substringToIndex: [tmp length] - 4];
else
rc = tmp;
}
else
rc = [self labelForKey: @"Web Calendar"];
return rc;
}
- (void) saveUrl: (NSURL *) calendarURL
forCalendar: (NSString *) calendarName
{
NSUserDefaults *settings;
SOGoUserSettings *settings;
NSMutableDictionary *calSettings, *webCalendars;
settings = [[context activeUser] userSettings];
@@ -124,7 +124,7 @@
- (WOResponse *) reloadWebCalendarsAction
{
NSUserDefaults *settings;
SOGoUserSettings *settings;
NSMutableDictionary *calSettings, *webCalendars;
NSArray *calendarIds;
SOGoWebAppointmentFolder *folder;
@@ -154,6 +154,4 @@
return [self responseWith204];
}
@end
+1 -1
View File
@@ -33,7 +33,7 @@
{
NSString *monthMenuItem;
NSNumber *yearMenuItem;
NSUserDefaults *ud;
SOGoUserSettings *us;
NSMutableDictionary *moduleSettings;
}
+20 -18
View File
@@ -25,7 +25,6 @@
#import <Foundation/NSDictionary.h>
#import <Foundation/NSString.h>
#import <Foundation/NSTimeZone.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import <NGObjWeb/SoSecurityManager.h>
@@ -34,6 +33,7 @@
#import <SOGo/SOGoPermissions.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
@@ -45,17 +45,11 @@
- (void) checkDefaultModulePreference
{
NSUserDefaults *userd;
NSString *pref;
SOGoUserDefaults *ud;
userd = [[context activeUser] userDefaults];
pref = [userd stringForKey: @"SOGoUIxDefaultModule"];
if (pref && [pref isEqualToString: @"Last"])
{
[userd setObject: @"Calendar" forKey: @"SOGoUIxLastModule"];
[userd synchronize];
}
ud = [[context activeUser] userDefaults];
if ([ud rememberLastModule])
[ud setLoginModule: @"Calendar"];
}
- (void) _setupContext
@@ -71,12 +65,12 @@
module = [clientObject nameInContainer];
ud = [activeUser userSettings];
moduleSettings = [ud objectForKey: module];
us = [activeUser userSettings];
moduleSettings = [us objectForKey: module];
if (!moduleSettings)
{
moduleSettings = [NSMutableDictionary dictionary];
[ud setObject: moduleSettings forKey: module];
[us setObject: moduleSettings forKey: module];
}
}
@@ -84,7 +78,7 @@
{
static NSMutableArray *monthMenuItems = nil;
unsigned int count;
if (!monthMenuItems)
{
monthMenuItems = [[NSMutableArray alloc] initWithCapacity: 12];
@@ -184,19 +178,27 @@
else
return [self responseWithStatus: 400];
[ud synchronize];
[us synchronize];
return [self responseWithStatus: 204];
}
- (unsigned int) firstDayOfWeek
{
return [[context activeUser] firstDayOfWeek];
SOGoUserDefaults *ud;
ud = [[context activeUser] userDefaults];
return [ud firstDayOfWeek];
}
- (unsigned int) dayStartHour
{
return [[context activeUser] dayStartHour];
SOGoUserDefaults *ud;
ud = [[context activeUser] userDefaults];
return [ud dayStartHour];
}
- (NSString *) currentView
-1
View File
@@ -24,7 +24,6 @@
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import <NGExtensions/NSCalendarDate+misc.h>
-1
View File
@@ -86,7 +86,6 @@
- (BOOL) showAMPMDates;
- (unsigned) dayStartHour;
- (unsigned) dayEndHour;
- (BOOL) shouldDisplayWeekend;
- (BOOL) shouldDisplayRejectedAppointments;
- (NSCalendarDate *) referenceDateForFormatter;
+18 -40
View File
@@ -21,9 +21,9 @@
*/
#import <Foundation/Foundation.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
#import <SoObjects/SOGo/NSString+Utilities.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGo/NSString+Utilities.h>
#import <NGObjWeb/SoSecurityManager.h>
#import <NGObjWeb/SoUser.h>
@@ -36,11 +36,12 @@
#import <NGExtensions/NSString+misc.h>
#import <NGCards/NGCards.h>
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
#import <SoObjects/Appointments/SOGoAppointmentObject.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/SOGoObject.h>
#import <Appointments/SOGoAppointmentFolder.h>
#import <Appointments/SOGoAppointmentObject.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/SOGoObject.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGoUI/SOGoAptFormatter.h>
@@ -56,27 +57,15 @@
@implementation UIxCalView
static BOOL shouldDisplayWeekend = NO;
+ (void) initialize
{
static BOOL didInit = NO;
NSUserDefaults *ud;
if (didInit) return;
ud = [NSUserDefaults standardUserDefaults];
shouldDisplayWeekend = [ud boolForKey: @"SOGoShouldDisplayWeekend"];
didInit = YES;
}
- (id) init
{
SOGoUserDefaults *ud;
self = [super init];
if (self)
{
timeZone = [[context activeUser] timeZone];
[timeZone retain];
ud = [[context activeUser] userDefaults];
ASSIGN (timeZone, [ud timeZone]);
aptFormatter
= [[SOGoAptFormatter alloc] initWithDisplayTimeZone: timeZone];
aptTooltipFormatter
@@ -355,7 +344,7 @@ static BOOL shouldDisplayWeekend = NO;
{
SOGoUser *activeUser;
NSString *module;
NSUserDefaults *ud;
SOGoUserSettings *us;
NSMutableDictionary *moduleSettings;
SOGoAppointmentFolders *clientObject;
@@ -364,18 +353,18 @@ static BOOL shouldDisplayWeekend = NO;
module = [clientObject nameInContainer];
ud = [activeUser userSettings];
moduleSettings = [ud objectForKey: module];
us = [activeUser userSettings];
moduleSettings = [us objectForKey: module];
if (!moduleSettings)
{
moduleSettings = [NSMutableDictionary dictionary];
[ud setObject: moduleSettings forKey: module];
[us setObject: moduleSettings forKey: module];
}
if (![theView isEqualToString: (NSString*)[moduleSettings objectForKey: @"View"]])
{
[moduleSettings setObject: theView
forKey: @"View"];
[ud synchronize];
[us synchronize];
}
}
@@ -471,17 +460,6 @@ static BOOL shouldDisplayWeekend = NO;
return 23;
}
- (BOOL) shouldDisplayWeekend
{
return shouldDisplayWeekend;
}
- (BOOL) shouldHideWeekend
{
return ![self shouldDisplayWeekend];
}
/* URLs */
- (NSString *) appointmentViewURL
+9 -6
View File
@@ -29,7 +29,8 @@
#import <EOControl/EOQualifier.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#include "UIxCalWeekView.h"
@@ -54,15 +55,17 @@
- (NSCalendarDate *) endDate
{
unsigned offset;
if ([self shouldDisplayWeekend])
SOGoUserDefaults *ud;
ud = [[context activeUser] userDefaults];
if ([ud calendarShouldDisplayWeekend])
offset = 7;
else
offset = 5;
return [[[self startDate] dateByAddingYears:0 months:0 days:offset
hours:0 minutes:0 seconds:0]
endOfDay];
return [[[self startDate] dateByAddingYears: 0 months: 0 days: offset
hours: 0 minutes: 0 seconds: 0]
endOfDay];
}
// - (NSArray *) appointments
+5 -4
View File
@@ -25,8 +25,9 @@
#import <NGObjWeb/WORequest.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserSettings.h>
#import <Appointments/SOGoAppointmentFolder.h>
#import "UIxCalendarProperties.h"
@@ -100,7 +101,7 @@
- (NSString *) allCalendarSyncTags
{
NSUserDefaults *settings;
SOGoUserSettings *settings;
NSMutableDictionary *calendarSettings;
NSMutableDictionary *syncTags;
NSEnumerator *keysList;
@@ -174,7 +175,7 @@
- (NSString *) webCalendarURL
{
NSUserDefaults *settings;
SOGoUserSettings *settings;
NSMutableDictionary *calendarSettings;
NSMutableDictionary *webCalendars;
NSString *rc;
+16 -9
View File
@@ -28,7 +28,6 @@
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSURL.h>
#import <NGCards/iCalAlarm.h>
@@ -55,12 +54,13 @@
#import <Appointments/SOGoAppointmentOccurence.h>
#import <Appointments/SOGoTaskObject.h>
#import <SOGo/iCalEntityObject+Utilities.h>
#import <SOGo/SOGoUserManager.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/NSDictionary+BSJSONAdditions.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGo/NSString+Utilities.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/SOGoUserManager.h>
#import <SOGo/SOGoPermissions.h>
#import "../../Main/SOGo.h"
@@ -315,6 +315,8 @@ iRANGE(2);
- (void) _loadRRules
{
SOGoUserDefaults *ud;
// We initialize our repeat ivars
if ([component hasRecurrenceRules])
{
@@ -421,7 +423,9 @@ iRANGE(2);
repeat = @"CUSTOM";
date = [[rule untilDate] copy];
[date setTimeZone: [[context activeUser] timeZone]];
ud = [[context activeUser] userDefaults];
[date setTimeZone: [ud timeZone]];
[self setRange1: @"2"];
[self setRange2: [date descriptionWithCalendarFormat: dateFormat]];
[date release];
@@ -825,10 +829,10 @@ iRANGE(2);
{
NSMutableArray *categoryList;
NSArray *categoryLabels;
NSUserDefaults *defaults;
SOGoUserDefaults *defaults;
defaults = [[context activeUser] userDefaults];
categoryLabels = [defaults arrayForKey: @"CalendarCategories"];
categoryLabels = [defaults calendarCategories];
if (!categoryLabels)
categoryLabels = [[self labelForKey: @"category_labels"]
componentsSeparatedByString: @","];
@@ -1610,12 +1614,15 @@ RANGE(2);
else if (range == 2)
{
NSCalendarDate *date;
SOGoUser *user;
user = [context activeUser];
SOGoUserDefaults *ud;
NSDictionary *locale;
ud = [[context activeUser] userDefaults];
locale = [[WOApplication application]
localeForLanguageNamed: [ud language]];
date = [NSCalendarDate dateWithString: [self range2]
calendarFormat: dateFormat
locale: [[WOApplication application] localeForLanguageNamed: [user language]]];
locale: locale];
[theRule setUntilDate: date];
}
// No end date.
+23 -18
View File
@@ -38,12 +38,13 @@
#import <NGCards/iCalTimeZone.h>
#import <NGCards/iCalDateTime.h>
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/SOGoContentObject.h>
#import <SoObjects/SOGo/SOGoDateFormatter.h>
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
#import <SoObjects/Appointments/SOGoTaskObject.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGo/SOGoContentObject.h>
#import <SOGo/SOGoDateFormatter.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <Appointments/SOGoAppointmentFolder.h>
#import <Appointments/SOGoTaskObject.h>
#import "UIxComponentEditor.h"
#import "UIxTaskEditor.h"
@@ -255,22 +256,22 @@
{
NSCalendarDate *newStartDate, *now;
NSTimeZone *timeZone;
SOGoUser *user;
SOGoUserDefaults *ud;
int hour;
unsigned int uStart, uEnd;
newStartDate = [self selectedDate];
if (![[self queryParameterForKey: @"hm"] length])
{
ud = [[context activeUser] userDefaults];
timeZone = [ud timeZone];
now = [NSCalendarDate calendarDate];
timeZone = [[context activeUser] timeZone];
[now setTimeZone: timeZone];
user = [context activeUser];
uStart = [user dayStartHour];
uStart = [ud dayStartHour];
if ([now isDateOnSameDay: newStartDate])
{
uEnd = [user dayEndHour];
uEnd = [ud dayEndHour];
hour = [now hourOfDay];
if (hour < uStart)
newStartDate = [now hour: uStart minute: 0];
@@ -291,12 +292,14 @@
NSCalendarDate *startDate, *dueDate;
NSString *duration;
NSTimeZone *timeZone;
SOGoUserDefaults *ud;
unsigned int minutes;
ud = [[context activeUser] userDefaults];
timeZone = [ud timeZone];
[self todo];
if (todo)
{
timeZone = [[context activeUser] timeZone];
startDate = [todo startDate];
dueDate = [todo due];
hasStartDate = (startDate != nil);
@@ -430,14 +433,14 @@
NSDictionary *data;
NSCalendarDate *startDate, *dueDate;
NSTimeZone *timeZone;
SOGoUser *user;
SOGoUserDefaults *ud;
BOOL resetAlarm;
[self todo];
result = [self responseWithStatus: 200];
user = [context activeUser];
timeZone = [user timeZone];
ud = [[context activeUser] userDefaults];
timeZone = [ud timeZone];
startDate = [todo startDate];
[startDate setTimeZone: timeZone];
dueDate = [todo due];
@@ -489,6 +492,9 @@
- (void) takeValuesFromRequest: (WORequest *) _rq
inContext: (WOContext *) _ctx
{
SOGoUserDefaults *ud;
iCalTimeZone *tz;
[self todo];
[super takeValuesFromRequest: _rq inContext: _ctx];
@@ -523,9 +529,8 @@
if ([[self clientObject] isNew])
{
iCalTimeZone *tz;
tz = [iCalTimeZone timeZoneForName: [[[context activeUser] timeZone] name]];
ud = [[context activeUser] userDefaults];
tz = [iCalTimeZone timeZoneForName: [ud timeZoneName]];
if (hasStartDate || hasDueDate)
{
+8 -6
View File
@@ -25,6 +25,8 @@
#import <NGObjWeb/SoObjects.h>
#import <SOGo/NSCalendarDate+SOGo.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import "UIxTimeDateControl.h"
@@ -69,14 +71,14 @@
- (void) setDate: (NSCalendarDate *) _date
{
NSTimeZone *timeZone;
SOGoUserDefaults *ud;
int minuteValue;
timeZone = [[context activeUser] timeZone];
ud = [[context activeUser] userDefaults];
if (!_date)
_date = [NSCalendarDate date];
[_date setTimeZone: timeZone];
[_date setTimeZone: [ud timeZone]];
[self _setDate: _date];
@@ -248,9 +250,9 @@
{
NSCalendarDate *d;
unsigned _year, _month, _day, _hour, _minute, _second;
NSTimeZone *timeZone;
SOGoUserDefaults *ud;
timeZone = [[context activeUser] timeZone];
ud = [[context activeUser] userDefaults];
/* call super, so that the form values are applied on the popups */
[super takeValuesFromRequest:_rq inContext:_ctx];
@@ -269,7 +271,7 @@
d = [NSCalendarDate dateWithYear: _year month:_month day:_day
hour:_hour minute:_minute second:_second
timeZone: timeZone];
timeZone: [ud timeZone]];
[self _setDate: d];
}
}
+3 -3
View File
@@ -647,7 +647,7 @@ function messageListCallback(http) {
var div = $('mailboxContent');
var table = $('messageList');
var columnsOrder = UserSettings["SOGoMailListViewColumnsOrder"];
var columnsOrder = UserDefaults["SOGoMailListViewColumnsOrder"];
if ( typeof(columnsOrder) == "undefined" ) {
columnsOrder = defaultColumnsOrder;
}
@@ -1524,7 +1524,7 @@ function configureMessageListBodyEvents(table) {
// 4 => Unread
// 5 => Date
// 6 => Priority
var columnsOrder = UserSettings["SOGoMailListViewColumnsOrder"];
var columnsOrder = UserDefaults["SOGoMailListViewColumnsOrder"];
if ( typeof(columnsOrder) == "undefined" ) {
columnsOrder = defaultColumnsOrder;
}
@@ -1646,7 +1646,7 @@ function initMailer(event) {
}
function initMessageCheckTimer() {
var messageCheck = UserDefaults["MessageCheck"];
var messageCheck = UserDefaults["SOGoMailMessageCheck"];
if (messageCheck && messageCheck != "manually") {
var interval;
if (messageCheck == "once_per_hour")
+8 -2
View File
@@ -7,7 +7,7 @@ var listFilter = 'view_today';
var listOfSelection = null;
var selectedCalendarCell;
var showCompletedTasks;;
var showCompletedTasks;
var currentDay = '';
@@ -1402,6 +1402,10 @@ function refreshEvents() {
function refreshTasks(setUserDefault) {
var url = "taskslist?show-completed=" + showCompletedTasks;
/* TODO: the logic behind this should be reimplemented properly:
the "taskslist" method should save the status when the 'show-completed'
is set to true and revert to the current status when that parameter is
NOT passed via the url. */
if (setUserDefault == 1)
url += "&setud=1";
refreshAlarms();
@@ -2100,7 +2104,7 @@ function onFolderSubscribeCB(folderData) {
appendCalendar(folderData["folderName"], folderData["folder"]);
refreshEvents();
refreshTasks();
changeCalendarDisplay();
changeCalendarDisplay();
}
}
@@ -2276,6 +2280,8 @@ function drawNowLine () {
function initCalendars() {
sorting["attribute"] = "start";
sorting["ascending"] = true;
/* FIXME: does this work at all? ShowCompletedTasks is in
UserSettings["Calendar"]... */
showCompletedTasks = UserDefaults['ShowCompletedTasks'];
if (!$(document.body).hasClassName("popup")) {
+5 -5
View File
@@ -235,7 +235,7 @@ function onTextFocus(event) {
if (MailEditor.textFirstFocus) {
// On first focus, position the caret at the proper position
var content = this.getValue();
var replyPlacement = UserDefaults["ReplyPlacement"];
var replyPlacement = UserDefaults["SOGoMailReplyPlacement"];
if (replyPlacement == "above" || !mailIsReply) { // for forwards, place caret at top unconditionally
this.setCaretTo(0);
}
@@ -337,7 +337,7 @@ function initMailEditor() {
if (sigLimit > -1)
MailEditor.signatureLength = (textContent.length - sigLimit);
}
if (UserDefaults["ReplyPlacement"] != "above") {
if (UserDefaults["SOGoMailReplyPlacement"] != "above") {
textarea.scrollTop = textarea.scrollHeight;
}
textarea.observe("focus", onTextFocus);
@@ -359,7 +359,7 @@ function initMailEditor() {
initializePriorityMenu();
var composeMode = UserDefaults["ComposeMessagesType"];
var composeMode = UserDefaults["SOGoMailComposeMessageType"];
if (composeMode == "html") {
CKEDITOR.replace('text',
{
@@ -470,7 +470,7 @@ function lineBreakCount(str){
function hasSignature() {
try {
return(UserDefaults["MailSignature"].length > 0);
return(UserDefaults["SOGoMailSignature"].length > 0);
} catch(e) {
return false;
}
@@ -548,7 +548,7 @@ function onWindowResize(event) {
textarea.setStyle({ 'top': hr.offsetTop + 'px' });
// Resize the textarea (message content)
var composeMode = UserDefaults["ComposeMessagesType"];
var composeMode = UserDefaults["SOGoMailComposeMessageType"];
if (composeMode == "html") {
var editor = $('cke_text');
if (editor == null) {