merge of '4dead0c3c1d9edc0c48e5bfb39f0ec7a89f28007'

and '72688cfe86ab1f4b8c8d1f0a9fab23384d7abaab'

Monotone-Parent: 4dead0c3c1d9edc0c48e5bfb39f0ec7a89f28007
Monotone-Parent: 72688cfe86ab1f4b8c8d1f0a9fab23384d7abaab
Monotone-Revision: f84a8ee34fde286386429490ca9126042402c390

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-04-04T14:11:45
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Francis Lachapelle 2011-04-04 14:11:45 +00:00
commit 02e551d324
8 changed files with 40 additions and 124 deletions

View File

@ -153,17 +153,6 @@
(-detectDoublesFromRecords:withQuickField:): added a quick field (-detectDoublesFromRecords:withQuickField:): added a quick field
parameter to enable the use of other fields than just c_mail. parameter to enable the use of other fields than just c_mail.
2011-03-27 Ludovic Marcotte <lmarcotte@inverse.ca>
* Added the SOGoLocalStorageURL preference that allows
one to set a different database where resource tables will
be created. If not set, it'll default to the database
specified in OCSFolderInfoURL. This is particularly useful
for multi-sites deployments where the sogo_folder_info and
sogo_user_profile are shared across sites but resources
tables are located at each sites, to minimize bandwitdh
requirements.
2011-03-24 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2011-03-24 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/Contacts/UIxContactsListView.m (-currentContactClasses): new * UI/Contacts/UIxContactsListView.m (-currentContactClasses): new

2
NEWS
View File

@ -7,8 +7,6 @@ Enhancements
- updated Spanish translation - updated Spanish translation
- "check while typing" is no longer enabled by default in HTML editor - "check while typing" is no longer enabled by default in HTML editor
- updated CKEditor to version 3.5.2 - updated CKEditor to version 3.5.2
- now possible to set a per-instance database storage using the
SOGoLocalStorageURL preference
- contact lists now have their own icons in the contacts web module - contact lists now have their own icons in the contacts web module
- added the ability to invite people and to answer invitations from the iOS - added the ability to invite people and to answer invitations from the iOS
Calendar Calendar

View File

@ -67,7 +67,7 @@
- (GCSFolder *)folderAtPath:(NSString *)_path; - (GCSFolder *)folderAtPath:(NSString *)_path;
- (NSException *)createFolderOfType:(NSString *)_type withName:(NSString *)_name atPath:(NSString *)_path andURL:(NSURL *) _url; - (NSException *)createFolderOfType:(NSString *)_type withName:(NSString *)_name atPath:(NSString *)_path;
- (NSException *)deleteFolderAtPath:(NSString *)_path; - (NSException *)deleteFolderAtPath:(NSString *)_path;
/* alarms */ /* alarms */

View File

@ -725,46 +725,32 @@ static NSCharacterSet *asciiAlphaNumericCS = nil;
- (NSException *) _reallyCreateFolderWithName: (NSString *) folderName - (NSException *) _reallyCreateFolderWithName: (NSString *) folderName
andFolderType: (NSString *) folderType andFolderType: (NSString *) folderType
andType: (GCSFolderType *) ftype andType: (GCSFolderType *) ftype
andFolderChannel: (EOAdaptorChannel *) folderChannel andChannel: (EOAdaptorChannel *) channel
andFolderInfoChannel: (EOAdaptorChannel *) folderInfoChannel
atPath: (NSString *) path atPath: (NSString *) path
andURL: (NSURL *) url
{ {
NSString *baseURL, *tableName, *quickTableName, *aclTableName, *createQuery, *sql;
EOAdaptorContext *folderChannelContext, *folderInfoChannelContext;
GCSSpecialQueries *specialQuery;
NSMutableArray *paths;
NSException *error; NSException *error;
BOOL b; NSString *baseURL, *tableName, *quickTableName, *aclTableName, *createQuery,
*sql;
EOAdaptorContext *aContext;
NSMutableArray *paths;
GCSSpecialQueries *specialQuery;
paths paths
= [NSMutableArray arrayWithArray: [path componentsSeparatedByString: @"/"]]; = [NSMutableArray arrayWithArray: [path componentsSeparatedByString: @"/"]];
while ([paths count] < 5) while ([paths count] < 5)
[paths addObject: @"NULL"]; [paths addObject: @"NULL"];
// start a transaction to modify sogo_folder_info aContext = [channel adaptorContext];
folderInfoChannelContext = [folderInfoChannel adaptorContext]; [aContext beginTransaction];
[folderInfoChannelContext beginTransaction];
// if we use a different database for resource tables, we also start a transaction
if (folderChannel != folderInfoChannel)
{
folderChannelContext = [folderChannel adaptorContext];
[folderChannelContext beginTransaction];
b = YES;
}
tableName = [self baseTableNameWithUID: [paths objectAtIndex: 2]]; tableName = [self baseTableNameWithUID: [paths objectAtIndex: 2]];
quickTableName = [tableName stringByAppendingString: @"_quick"]; quickTableName = [tableName stringByAppendingString: @"_quick"];
aclTableName = [tableName stringByAppendingString: @"_acl"]; aclTableName = [tableName stringByAppendingString: @"_acl"];
// holds the path to the database
baseURL = [url absoluteString];
if (!url)
baseURL = [[folderInfoLocation absoluteString] stringByDeletingLastPathComponent];
// TBD: fix SQL injection issues // TBD: fix SQL injection issues
baseURL
= [[folderInfoLocation absoluteString] stringByDeletingLastPathComponent];
sql = [NSString stringWithFormat: @"INSERT INTO %@" sql = [NSString stringWithFormat: @"INSERT INTO %@"
@" (c_path, c_path1, c_path2, c_path3, c_path4," @" (c_path, c_path1, c_path2, c_path3, c_path4,"
@" c_foldername, c_location, c_quick_location," @" c_foldername, c_location, c_quick_location,"
@ -779,36 +765,29 @@ static NSCharacterSet *asciiAlphaNumericCS = nil;
baseURL, quickTableName, baseURL, quickTableName,
baseURL, aclTableName, baseURL, aclTableName,
folderType]; folderType];
error = [folderInfoChannel evaluateExpressionX: sql]; error = [channel evaluateExpressionX: sql];
if (!error) if (!error)
{ {
specialQuery = [folderChannel specialQueries]; specialQuery = [channel specialQueries];
createQuery = [specialQuery createFolderTableWithName: tableName]; createQuery = [specialQuery createFolderTableWithName: tableName];
error = [folderChannel evaluateExpressionX: createQuery]; error = [channel evaluateExpressionX: createQuery];
if (!error) if (!error)
{ {
sql = [ftype sqlQuickCreateWithTableName: quickTableName]; sql = [ftype sqlQuickCreateWithTableName: quickTableName];
error = [folderChannel evaluateExpressionX: sql]; error = [channel evaluateExpressionX: sql];
if (!error) if (!error)
{ {
createQuery = [specialQuery createFolderACLTableWithName: aclTableName]; createQuery = [specialQuery
error = [folderChannel evaluateExpressionX: createQuery]; createFolderACLTableWithName: aclTableName];
error = [channel evaluateExpressionX: createQuery];
} }
} }
} }
if (error) if (error)
{ [aContext rollbackTransaction];
[folderInfoChannelContext rollbackTransaction];
if (b)
[folderChannelContext rollbackTransaction];
}
else else
{ [aContext commitTransaction];
[folderInfoChannelContext commitTransaction];
if (b)
[folderChannelContext commitTransaction];
}
return error; return error;
} }
@ -816,11 +795,10 @@ static NSCharacterSet *asciiAlphaNumericCS = nil;
- (NSException *) createFolderOfType: (NSString *) _type - (NSException *) createFolderOfType: (NSString *) _type
withName: (NSString*) _name withName: (NSString*) _name
atPath: (NSString *) _path atPath: (NSString *) _path
andURL: (NSURL *) _url
{ {
// TBD: would be best to perform all operations as a single SQL statement. // TBD: would be best to perform all operations as a single SQL statement.
EOAdaptorChannel *folderChannel, *folderInfoChannel;
GCSFolderType *ftype; GCSFolderType *ftype;
EOAdaptorChannel *channel;
NSException *error; NSException *error;
// TBD: fix SQL injection issue! // TBD: fix SQL injection issue!
@ -833,34 +811,17 @@ static NSCharacterSet *asciiAlphaNumericCS = nil;
ftype = [self folderTypeWithName:_type]; ftype = [self folderTypeWithName:_type];
if (ftype) if (ftype)
{ {
folderInfoChannel = [self acquireOpenChannel]; channel = [self acquireOpenChannel];
folderChannel = nil; if (channel)
// We use the provided alternate database, if any. The content,
// quick and acl tables will be created in there.
if (_url)
folderChannel = [[self channelManager] acquireOpenChannelForURL: _url];
// Otherwise we use the same database used by sogo_folder_info
if (!folderChannel)
folderChannel = folderInfoChannel;
if (folderChannel)
{ {
error = [self _reallyCreateFolderWithName: _name error = [self _reallyCreateFolderWithName: _name
andFolderType: _type andFolderType: _type
andType: ftype andType: ftype andChannel: channel
andFolderChannel: folderChannel atPath: _path];
andFolderInfoChannel: folderInfoChannel
atPath: _path
andURL: _url];
if (error && [self folderExistsAtPath: _path]) if (error && [self folderExistsAtPath: _path])
error = nil; error = nil;
if (folderChannel != folderInfoChannel) [self releaseChannel: channel];
[self releaseChannel: folderChannel];
[self releaseChannel: folderInfoChannel];
} }
else else
error = [NSException exceptionWithName: @"GCSNoChannel" error = [NSException exceptionWithName: @"GCSNoChannel"

View File

@ -1,6 +1,6 @@
/* SOGoFolder.m - this file is part of SOGo /* SOGoFolder.m - this file is part of SOGo
* *
* Copyright (C) 2007-2011 Inverse inc. * Copyright (C) 2007-2009 Inverse inc.
* *
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca> * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* *

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2004-2005 SKYRIX Software AG Copyright (C) 2004-2005 SKYRIX Software AG
Copyright (C) 2006-2011 Inverse inc. Copyright (C) 2006-2010 Inverse inc.
This file is part of SOGo. This file is part of SOGo.

View File

@ -1,7 +1,7 @@
/* SOGoGCSFolder.m - this file is part of SOGo /* SOGoGCSFolder.m - this file is part of SOGo
* *
* Copyright (C) 2004-2005 SKYRIX Software AG * Copyright (C) 2004-2005 SKYRIX Software AG
* Copyright (C) 2006-2011 Inverse inc. * Copyright (C) 2006-2010 Inverse inc.
* *
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca> * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* *
@ -70,7 +70,6 @@
#import "SOGoParentFolder.h" #import "SOGoParentFolder.h"
#import "SOGoPermissions.h" #import "SOGoPermissions.h"
#import "SOGoUser.h" #import "SOGoUser.h"
#import "SOGoSystemDefaults.h"
#import "SOGoUserDefaults.h" #import "SOGoUserDefaults.h"
#import "SOGoUserSettings.h" #import "SOGoUserSettings.h"
#import "SOGoUserManager.h" #import "SOGoUserManager.h"
@ -526,34 +525,12 @@ static NSArray *childRecordFields = nil;
} }
} }
//
// This method honors the SOGoLocalStorageURL preference in order
// to create the database tables at the preferred location instead of
// creating them in the same database as the one specified in the
// OCSFolderInfoURL preference. This is particularly useful for
// multi-sites deployments.
//
- (BOOL) create - (BOOL) create
{ {
GCSFolderManager *folderManager;
EOAdaptorChannel *channel;
NSException *result; NSException *result;
NSString *s; result = [[self folderManager] createFolderOfType: [self folderType]
NSURL *url;
folderManager = [self folderManager];
channel = nil;
s = [[SOGoSystemDefaults sharedSystemDefaults] stringForKey: @"SOGoLocalStorageURL"];
url = nil;
if (s)
url = [NSURL URLWithString: s];
result = [folderManager createFolderOfType: [self folderType]
withName: displayName withName: displayName
atPath: ocsPath atPath: ocsPath];
andURL: url];
if (!result if (!result
&& [[context request] handledByDefaultHandler]) && [[context request] handledByDefaultHandler])

View File

@ -1,6 +1,6 @@
/* SOGoToolRestore.m - this file is part of SOGo /* SOGoToolRestore.m - this file is part of SOGo
* *
* Copyright (C) 2009-2011 Inverse inc. * Copyright (C) 2009-2010 Inverse inc.
* *
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca> * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* *
@ -36,7 +36,6 @@
#import <Appointments/iCalEntityObject+SOGo.h> #import <Appointments/iCalEntityObject+SOGo.h>
#import <SOGo/NSArray+Utilities.h> #import <SOGo/NSArray+Utilities.h>
#import <SOGo/SOGoProductLoader.h> #import <SOGo/SOGoProductLoader.h>
#import <SOGo/SOGoSystemDefaults.h>
#import <SOGo/SOGoUser.h> #import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h> #import <SOGo/SOGoUserDefaults.h>
#import <SOGo/SOGoUserManager.h> #import <SOGo/SOGoUserManager.h>
@ -383,10 +382,9 @@ typedef enum SOGoToolRestoreMode {
- (BOOL) createFolder: (NSString *) folder - (BOOL) createFolder: (NSString *) folder
withFM: (GCSFolderManager *) fm withFM: (GCSFolderManager *) fm
{ {
NSString *folderType, *s;
NSArray *pathElements; NSArray *pathElements;
NSException *error; NSException *error;
NSURL *url; NSString *folderType;
BOOL rc; BOOL rc;
pathElements = [folder componentsSeparatedByString: @"/"]; pathElements = [folder componentsSeparatedByString: @"/"];
@ -395,16 +393,9 @@ typedef enum SOGoToolRestoreMode {
else else
folderType = @"Appointment"; folderType = @"Appointment";
s = [[SOGoSystemDefaults sharedSystemDefaults] stringForKey: @"SOGoLocalStorageURL"];
url = nil;
if (s)
url = [NSURL URLWithString: s];
error = [fm createFolderOfType: folderType error = [fm createFolderOfType: folderType
withName: [pathElements objectAtIndex: 4] withName: [pathElements objectAtIndex: 4]
atPath: folder atPath: folder];
andURL: url];
if (error) if (error)
{ {
rc = NO; rc = NO;