merge of '5676ae3c13c58684d5b39a82a4ce2aeafdfc7040'

and 'c1871a78b402c35ce922ac5da7c7d2256dc9bb0c'

Monotone-Parent: 5676ae3c13c58684d5b39a82a4ce2aeafdfc7040
Monotone-Parent: c1871a78b402c35ce922ac5da7c7d2256dc9bb0c
Monotone-Revision: c43d9919f8f332369324d9caae4a46a303f32fa6

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-10-08T19:54:59
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-10-08 19:54:59 +00:00
6 changed files with 96 additions and 35 deletions

View File

@@ -9,6 +9,21 @@
2010-10-08 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentFolder.m
(-removeFolderSettings:withReference:): new method which removes
the settings for keys "FreeBusyExclusions", "FolderColors",
"FolderShowAlarms", "FolderShowTasks", "InactiveFolders",
"FolderSyncTags" and "FolderSynchronize". Code taken from
-[SOGoGCSFolder subscribeUser:reallyDo:].
* SoObjects/SOGo/SOGoGCSFolder.m
(-removeFolderSettings:withReference:): new overridable method
which enables the removal of user settings pertaining to a folder
and its type when deleting the folder or unsubscribing from it.
This implementation removes the folder reference from the
"FolderDisplayNames" key.
(-delete): make use of the new method above.
* UI/WebServerResources/ContactsUI.js: (setEventsOnAddressBook)
enable the "dblclick" event on non-owned addressbooks, except the
public ones (owned by "nobody")

View File

@@ -1,5 +1,9 @@
2010-10-08 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalEvent.m (-setAllDayWithStartDate:duration:): added a
work-around for bug 866, by adding one hour in addition to the
offset in days from the start date.
* NSString+NGCards.m (-unescapedFromCard): removed obsolete
method.
(-componentsWithSafeSeparator:): renamed to

View File

@@ -57,7 +57,9 @@
[(iCalDateTime *) [self uniqueChildWithTag: @"dtstart"]
setDate: newStartDate];
endDate = [newStartDate dateByAddingYears: 0 months: 0 days: days];
// HACK: we add 1 hour to avoid losing a day on time shift dates
endDate = [newStartDate dateByAddingYears: 0 months: 0 days: days
hours: 1 minutes: 0 seconds: 0];
[endDate setTimeZone: [newStartDate timeZone]];
[(iCalDateTime *) [self uniqueChildWithTag: @"dtend"]
setDate: endDate];

View File

@@ -2247,6 +2247,37 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
return rc;
}
- (void) removeFolderSettings: (NSMutableDictionary *) moduleSettings
withReference: (NSString *) reference
{
NSMutableArray *refArray;
NSMutableDictionary *refDict;
refDict = [moduleSettings objectForKey: @"FreeBusyExclusions"];
[refDict removeObjectForKey: reference];
refDict = [moduleSettings objectForKey: @"FolderColors"];
[refDict removeObjectForKey: reference];
refDict = [moduleSettings objectForKey: @"FolderShowAlarms"];
[refDict removeObjectForKey: reference];
refDict = [moduleSettings objectForKey: @"FolderShowTasks"];
[refDict removeObjectForKey: reference];
refArray = [moduleSettings objectForKey: @"InactiveFolders"];
[refArray removeObject: nameInContainer];
refDict = [moduleSettings objectForKey: @"FolderSyncTags"];
[refDict removeObjectForKey: reference];
refDict = [moduleSettings objectForKey: @"FolderSynchronize"];
[refDict removeObjectForKey: reference];
[super removeFolderSettings: moduleSettings
withReference: reference];
}
- (id) lookupHomeFolderForUID: (NSString *) _uid
inContext: (id)_ctx
{

View File

@@ -93,6 +93,9 @@
- (NSException *) delete;
- (void) renameTo: (NSString *) newName;
- (void) removeFolderSettings: (NSMutableDictionary *) moduleSettings
withReference: (NSString *) reference;
- (BOOL) subscribeUser: (NSString *) subscribingUser
reallyDo: (BOOL) reallyDo;
- (BOOL) userIsSubscriber: (NSString *) subscribingUser;

View File

@@ -533,6 +533,8 @@ static NSArray *childRecordFields = nil;
- (NSException *) delete
{
NSException *error;
SOGoUserSettings *us;
NSMutableDictionary *moduleSettings;
// We just fetch our displayName since our table will use it!
[self displayName];
@@ -543,8 +545,17 @@ static NSArray *childRecordFields = nil;
else
error = [[self folderManager] deleteFolderAtPath: ocsPath];
if (!error && [[context request] handledByDefaultHandler])
[self sendFolderAdvisoryTemplate: @"Removal"];
if (!error)
{
us = [[SOGoUser userWithLogin: owner] userSettings];
moduleSettings = [us objectForKey: [container nameInContainer]];
[self removeFolderSettings: moduleSettings
withReference: [self folderReference]];
[us synchronize];
if ([[context request] handledByDefaultHandler])
[self sendFolderAdvisoryTemplate: @"Removal"];
}
return error;
}
@@ -839,7 +850,7 @@ static NSArray *childRecordFields = nil;
NSDictionary *moduleSettings;
NSArray *folderSubscription;
sogoUser = [SOGoUser userWithLogin: subscribingUser roles: nil];
sogoUser = [SOGoUser userWithLogin: subscribingUser];
moduleSettings = [[sogoUser userSettings]
objectForKey: [container nameInContainer]];
folderSubscription = [moduleSettings objectForKey: @"SubscribedFolders"];
@@ -850,10 +861,10 @@ static NSArray *childRecordFields = nil;
- (BOOL) subscribeUser: (NSString *) subscribingUser
reallyDo: (BOOL) reallyDo
{
NSMutableArray *folderSubscription, *tmpA;
NSMutableArray *folderSubscription;
NSString *subscriptionPointer;
SOGoUserSettings *us;
NSMutableDictionary *moduleSettings, *tmpD;
NSMutableDictionary *moduleSettings;
SOGoUser *sogoUser;
BOOL rc;
@@ -871,43 +882,29 @@ static NSArray *childRecordFields = nil;
folderSubscription
= [moduleSettings objectForKey: @"SubscribedFolders"];
if (!(folderSubscription
&& [folderSubscription isKindOfClass: [NSMutableArray class]]))
{
folderSubscription = [NSMutableArray array];
[moduleSettings setObject: folderSubscription
forKey: @"SubscribedFolders"];
}
subscriptionPointer = [self folderReference];
if (reallyDo)
[folderSubscription addObjectUniquely: subscriptionPointer];
{
if (!(folderSubscription
&& [folderSubscription isKindOfClass: [NSMutableArray class]]))
{
folderSubscription = [NSMutableArray array];
[moduleSettings setObject: folderSubscription
forKey: @"SubscribedFolders"];
}
[folderSubscription addObjectUniquely: subscriptionPointer];
}
else
{
tmpD = [moduleSettings objectForKey: @"FolderColors"];
if (tmpD)
[tmpD removeObjectForKey: subscriptionPointer];
tmpD = [moduleSettings objectForKey: @"FolderShowAlarms"];
if (tmpD)
[tmpD removeObjectForKey: subscriptionPointer];
tmpD = [moduleSettings objectForKey: @"FolderShowTasks"];
if (tmpD)
[tmpD removeObjectForKey: subscriptionPointer];
tmpA = [moduleSettings objectForKey: @"InactiveFolders"];
if (tmpA)
[tmpA removeObject: nameInContainer];
tmpD = [moduleSettings objectForKey: @"FolderSyncTags"];
if (tmpD)
[tmpD removeObjectForKey: subscriptionPointer];
[self removeFolderSettings: moduleSettings
withReference: subscriptionPointer];
[folderSubscription removeObject: subscriptionPointer];
}
[us synchronize];
rc = YES;
}
else
@@ -916,6 +913,15 @@ static NSArray *childRecordFields = nil;
return rc;
}
- (void) removeFolderSettings: (NSMutableDictionary *) moduleSettings
withReference: (NSString *) reference
{
NSMutableDictionary *refDict;
refDict = [moduleSettings objectForKey: @"FolderDisplayNames"];
[refDict removeObjectForKey: reference];
}
- (NSArray *) _parseDAVDelegatedUsers
{
id <DOMDocument> document;