From b83e708b702dc123390da8275d72139499d1f444 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 7 Nov 2007 15:58:43 +0000 Subject: [PATCH] Monotone-Parent: 38816d5f2c5865f939ccd8290226d22c43482e08 Monotone-Revision: 1960a36a480c2b580275d8352c65f53c16c80b5a Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-07T15:58:43 Monotone-Branch: ca.inverse.sogo --- .../Appointments/SOGoAppointmentFolder.m | 39 ++-- .../Appointments/SOGoAppointmentObject.m | 35 ++-- SoObjects/Appointments/SOGoFreeBusyObject.m | 20 +- SoObjects/Appointments/product.plist | 2 +- SoObjects/Contacts/SOGoContactGCSFolder.h | 4 +- SoObjects/Contacts/product.plist | 4 +- SoObjects/Mailer/SOGoMailAccounts.h | 4 +- SoObjects/Mailer/SOGoMailAccounts.m | 20 -- SoObjects/Mailer/product.plist | 2 +- SoObjects/SOGo/GNUmakefile | 1 + .../SOGo/{SOGoFolder.h => SOGoGCSFolder.h} | 25 +-- .../SOGo/{SOGoFolder.m => SOGoGCSFolder.m} | 184 ++++-------------- SoObjects/SOGo/SOGoParentFolder.h | 8 +- SoObjects/SOGo/SOGoParentFolder.m | 74 ++++--- SoObjects/SOGo/SOGoUserFolder.h | 5 - SoObjects/SOGo/SOGoUserFolder.m | 45 +---- UI/Common/UIxFolderActions.m | 4 +- UI/Common/product.plist | 2 +- UI/Contacts/UIxContactFoldersView.m | 2 +- UI/Contacts/product.plist | 12 +- 20 files changed, 173 insertions(+), 319 deletions(-) rename SoObjects/SOGo/{SOGoFolder.h => SOGoGCSFolder.h} (82%) rename SoObjects/SOGo/{SOGoFolder.m => SOGoGCSFolder.m} (89%) diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index a2306fba6..395d92e80 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -52,6 +52,7 @@ #import #import "SOGoAppointmentObject.h" +#import "SOGoAppointmentFolders.h" #import "SOGoTaskObject.h" #import "SOGoAppointmentFolder.h" @@ -1001,20 +1002,29 @@ static NSNumber *sharedYes = nil; - (SOGoAppointmentFolder *) lookupCalendarFolderForUID: (NSString *) uid { - SOGoFolder *upperContainer; - SOGoUserFolder *userFolder; - SOGoAppointmentFolder *calendarFolder; + SOGoFolder *currentContainer; + SOGoAppointmentFolders *parent; + NSException *error; - upperContainer = [[self container] container]; - userFolder = [SOGoUserFolder objectWithName: uid - inContainer: upperContainer]; - calendarFolder = [SOGoAppointmentFolder objectWithName: @"Calendar" - inContainer: userFolder]; - [calendarFolder - setOCSPath: [NSString stringWithFormat: @"/Users/%@/Calendar/personal", uid]]; - [calendarFolder setOwner: uid]; + currentContainer = [[container container] container]; + currentContainer = [currentContainer lookupName: uid + inContext: context + acquire: NO]; + parent = [currentContainer lookupName: @"Calendar" inContext: context + acquire: NO]; + currentContainer = [parent lookupName: @"personal" inContext: context + acquire: NO]; + if (!currentContainer) + { + error = [parent newFolderWithName: [parent defaultFolderName] + andNameInContainer: @"personal"]; + if (!error) + currentContainer = [parent lookupName: @"personal" + inContext: context + acquire: NO]; + } - return calendarFolder; + return (SOGoAppointmentFolder *) currentContainer; } - (NSArray *) lookupCalendarFoldersForUIDs: (NSArray *) _uids @@ -1041,8 +1051,9 @@ static NSNumber *sharedYes = nil; if (![folder isNotNull]) [self logWithFormat:@"Note: did not find folder for uid: '%@'", uid]; } - - [folders addObject: folder]; + + if (folder) + [folders addObject: folder]; } return folders; diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index c4c943714..59f96d69e 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -147,30 +147,33 @@ return allErrors; } -- (NSException *)deleteInUIDs:(NSArray *)_uids { +- (NSException *) deleteInUIDs: (NSArray *) _uids +{ NSEnumerator *e; id folder; NSException *allErrors = nil; + NSException *error; + SOGoAppointmentObject *apt; e = [[container lookupCalendarFoldersForUIDs:_uids inContext: context] objectEnumerator]; - while ((folder = [e nextObject])) { - NSException *error; - SOGoAppointmentObject *apt; + while ((folder = [e nextObject])) + { + apt = [folder lookupName: [self nameInContainer] + inContext: context + acquire:NO]; + if ([apt isKindOfClass: [NSException class]]) { + [self logWithFormat: @"%@", [(NSException *) apt reason]]; + continue; + } - apt = [folder lookupName:[self nameInContainer] inContext: context - acquire:NO]; - if ([apt isKindOfClass: [NSException class]]) { - [self logWithFormat: @"%@", [(NSException *) apt reason]]; - continue; + if ((error = [apt primaryDelete]) != nil) { + [self logWithFormat:@"Note: failed to delete in folder: %@", folder]; + // TODO: make compound + allErrors = error; + } } - - if ((error = [apt primaryDelete]) != nil) { - [self logWithFormat:@"Note: failed to delete in folder: %@", folder]; - // TODO: make compound - allErrors = error; - } - } + return allErrors; } diff --git a/SoObjects/Appointments/SOGoFreeBusyObject.m b/SoObjects/Appointments/SOGoFreeBusyObject.m index ef40274dc..80390a733 100644 --- a/SoObjects/Appointments/SOGoFreeBusyObject.m +++ b/SoObjects/Appointments/SOGoFreeBusyObject.m @@ -47,12 +47,6 @@ @implementation SOGoFreeBusyObject -- (NSString *) iCalString -{ - // for UI-X appointment viewer - return [self contentAsString]; -} - - (NSString *) contentAsString { NSCalendarDate *today, *startDate, *endDate; @@ -103,6 +97,12 @@ return infos; } +- (NSString *) iCalString +{ + // for UI-X appointment viewer + return [self contentAsString]; +} + /* Private API */ - (iCalFreeBusyType) _fbTypeForEventStatus: (NSNumber *) eventStatus { @@ -194,7 +194,8 @@ WOResponse *r; NSData *contentData; - contentData = [[self contentAsString] dataUsingEncoding: NSUTF8StringEncoding]; + contentData = [[self contentAsString] + dataUsingEncoding: NSUTF8StringEncoding]; r = [(WOContext *) _ctx response]; [r setHeader: @"text/calendar" forKey: @"content-type"]; @@ -209,4 +210,9 @@ return @"text/calendar"; } +- (NSArray *) aclsForUser: (NSString *) uid +{ + return nil; +} + @end diff --git a/SoObjects/Appointments/product.plist b/SoObjects/Appointments/product.plist index 1fdd67e88..f2a5b7fe3 100644 --- a/SoObjects/Appointments/product.plist +++ b/SoObjects/Appointments/product.plist @@ -12,7 +12,7 @@ superclass = "SOGoParentFolder"; }; SOGoAppointmentFolder = { - superclass = "SOGoFolder"; + superclass = "SOGoGCSFolder"; defaultRoles = { /* "FreeBusyLookup" = ( "Owner", "FreeBusy", "AuthorizedSubscriber" ); */ "ViewWholePublicRecords" = ( "Owner", "PublicResponder", "PublicModifier", "PublicViewer" ); diff --git a/SoObjects/Contacts/SOGoContactGCSFolder.h b/SoObjects/Contacts/SOGoContactGCSFolder.h index 9ac8fb1fe..a6f6f0eed 100644 --- a/SoObjects/Contacts/SOGoContactGCSFolder.h +++ b/SoObjects/Contacts/SOGoContactGCSFolder.h @@ -22,7 +22,7 @@ #ifndef __Contacts_SOGoContactGCSFolder_H__ #define __Contacts_SOGoContactGCSFolder_H__ -#import +#import #import "SOGoContactFolder.h" #import "NSObject+CardDAV.h" @@ -30,7 +30,7 @@ @class NSArray; @class NSString; -@interface SOGoContactGCSFolder : SOGoFolder +@interface SOGoContactGCSFolder : SOGoGCSFolder @end diff --git a/SoObjects/Contacts/product.plist b/SoObjects/Contacts/product.plist index e1557d613..f30359029 100644 --- a/SoObjects/Contacts/product.plist +++ b/SoObjects/Contacts/product.plist @@ -12,13 +12,13 @@ superclass = "SOGoParentFolder"; }; SOGoContactGCSFolder = { - superclass = "SOGoFolder"; + superclass = "SOGoGCSFolder"; }; SOGoContactGCSEntry = { superclass = "SOGoContentObject"; }; SOGoContactLDAPFolder = { - superclass = "SOGoFolder"; + superclass = "SOGoGCSFolder"; protectedBy = "Access Contents Information"; defaultRoles = { "Access Contents Information" = ( "Authenticated" ); diff --git a/SoObjects/Mailer/SOGoMailAccounts.h b/SoObjects/Mailer/SOGoMailAccounts.h index 96475f7ac..623ffcb2f 100644 --- a/SoObjects/Mailer/SOGoMailAccounts.h +++ b/SoObjects/Mailer/SOGoMailAccounts.h @@ -22,7 +22,7 @@ #ifndef __Mailer_SOGoMailAccounts_H__ #define __Mailer_SOGoMailAccounts_H__ -#import +#import /* SOGoMailAccounts @@ -39,7 +39,7 @@ @class NSArray; -@interface SOGoMailAccounts : SOGoObject +@interface SOGoMailAccounts : SOGoFolder @end diff --git a/SoObjects/Mailer/SOGoMailAccounts.m b/SoObjects/Mailer/SOGoMailAccounts.m index 66e2948be..b09e9092b 100644 --- a/SoObjects/Mailer/SOGoMailAccounts.m +++ b/SoObjects/Mailer/SOGoMailAccounts.m @@ -127,24 +127,4 @@ static NSString *AgenorShareLoginMarker = @".-."; return [NSException exceptionWithHTTPStatus:404 /* Not Found */]; } -/* WebDAV */ - -- (BOOL) davIsCollection -{ - return YES; -} - -- (NSString *) davContentType -{ - return @"httpd/unix-directory"; -} - -/* acls */ - -- (NSArray *) aclsForUser: (NSString *) uid -{ - return nil; -} - - @end /* SOGoMailAccounts */ diff --git a/SoObjects/Mailer/product.plist b/SoObjects/Mailer/product.plist index 9e202f3e7..2a93d2b7a 100644 --- a/SoObjects/Mailer/product.plist +++ b/SoObjects/Mailer/product.plist @@ -12,7 +12,7 @@ superclass = "SOGoObject"; }; SOGoMailAccounts = { - superclass = "SOGoMailBaseObject"; + superclass = "SOGoFolder"; defaultRoles = { "View" = ( "Owner", "AuthorizedSubscriber" ); "Access Contents Information" = ( "Owner", "AuthorizedSubscriber" ); diff --git a/SoObjects/SOGo/GNUmakefile b/SoObjects/SOGo/GNUmakefile index 7d15b89f5..46c94b95b 100644 --- a/SoObjects/SOGo/GNUmakefile +++ b/SoObjects/SOGo/GNUmakefile @@ -53,6 +53,7 @@ libSOGo_OBJC_FILES = \ SOGoObject.m \ SOGoContentObject.m \ SOGoFolder.m \ + SOGoGCSFolder.m \ SOGoParentFolder.m \ SOGoUserFolder.m \ SOGoGroupsFolder.m \ diff --git a/SoObjects/SOGo/SOGoFolder.h b/SoObjects/SOGo/SOGoGCSFolder.h similarity index 82% rename from SoObjects/SOGo/SOGoFolder.h rename to SoObjects/SOGo/SOGoGCSFolder.h index c0b492e98..9e331452e 100644 --- a/SoObjects/SOGo/SOGoFolder.h +++ b/SoObjects/SOGo/SOGoGCSFolder.h @@ -19,10 +19,10 @@ 02111-1307, USA. */ -#ifndef __SOGo_SOGoFolder_H__ -#define __SOGo_SOGoFolder_H__ +#ifndef __SOGo_SOGoGCSFolder_H__ +#define __SOGo_SOGoGCSFolder_H__ -#import "SOGoObject.h" +#import "SOGoFolder.h" @class NSArray; @class NSDictionary; @@ -32,7 +32,7 @@ @class GCSFolder; /* - SOGoFolder + SOGoGCSFolder A common superclass for folders stored in GCS. Already deals with all GCS folder specific things. @@ -41,9 +41,8 @@ cyclic references. */ -@interface SOGoFolder : SOGoObject +@interface SOGoGCSFolder : SOGoFolder { - NSMutableString *displayName; NSString *ocsPath; GCSFolder *ocsFolder; NSMutableDictionary *aclCache; @@ -54,9 +53,6 @@ /* accessors */ -- (void) setDisplayName: (NSString *) newDisplayName; -- (NSString *) displayName; - - (void) setOCSPath: (NSString *)_Path; - (NSString *) ocsPath; @@ -73,19 +69,14 @@ /* folder type */ -- (NSString *) outlookFolderClass; - - (BOOL) folderIsMandatory; -- (NSString *) folderType; /* sorting */ -- (NSComparisonResult) compare: (SOGoFolder *) otherFolder; +- (NSComparisonResult) compare: (SOGoGCSFolder *) otherFolder; - (BOOL) create; - (NSException *) delete; - (void) renameTo: (NSString *) newName; -/* dav */ -- (NSArray *) davNamespaces; /* acls as a container */ - (NSArray *) aclUsersForObjectAtPath: (NSArray *) objectPathArray; @@ -99,10 +90,10 @@ @end -@interface SOGoFolder (GroupDAVExtensions) +@interface SOGoGCSFolder (GroupDAVExtensions) - (NSString *) groupDavResourceType; @end -#endif /* __SOGo_SOGoFolder_H__ */ +#endif /* __SOGo_SOGoGCSFolder_H__ */ diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m similarity index 89% rename from SoObjects/SOGo/SOGoFolder.m rename to SoObjects/SOGo/SOGoGCSFolder.m index 3ff95dae3..2caaa6878 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -29,7 +29,6 @@ #import #import #import -#import #import #import #import @@ -51,23 +50,11 @@ #import "SOGoPermissions.h" #import "SOGoUser.h" -#import "SOGoFolder.h" +#import "SOGoGCSFolder.h" static NSString *defaultUserID = @""; -@implementation SOGoFolder - -+ (int) version -{ - return [super version] + 0 /* v0 */; -} - -+ (void) initialize -{ - NSAssert2([super version] == 0, - @"invalid superclass (%@) version %i !", - NSStringFromClass([self superclass]), [super version]); -} +@implementation SOGoGCSFolder + (id) folderWithSubscriptionReference: (NSString *) reference inContainer: (id) aContainer @@ -120,46 +107,6 @@ static NSString *defaultUserID = @""; /* accessors */ -- (BOOL) isFolderish -{ - return YES; -} - -- (void) setOCSPath: (NSString *) _path -{ - if (![ocsPath isEqualToString:_path]) - { - if (ocsPath) - [self warnWithFormat: @"GCS path is already set! '%@'", _path]; - ASSIGN (ocsPath, _path); - } -} - -- (NSString *) ocsPath -{ - return ocsPath; -} - -- (GCSFolderManager *) folderManager -{ - static GCSFolderManager *folderManager = nil; - - if (!folderManager) - folderManager = [GCSFolderManager defaultFolderManager]; - - return folderManager; -} - -- (GCSFolder *) ocsFolderForPath: (NSString *) _path -{ - return [[self folderManager] folderAtPath: _path]; -} - -- (BOOL) folderIsMandatory -{ - return [nameInContainer isEqualToString: @"personal"]; -} - - (void) _setDisplayNameFromRow: (NSDictionary *) row { NSString *currentLogin, *ownerLogin; @@ -209,11 +156,6 @@ static NSString *defaultUserID = @""; } } -- (void) setDisplayName: (NSString *) newDisplayName -{ - ASSIGN (displayName, newDisplayName); -} - - (NSString *) displayName { if (!displayName) @@ -222,6 +164,41 @@ static NSString *defaultUserID = @""; return displayName; } +- (void) setOCSPath: (NSString *) _path +{ + if (![ocsPath isEqualToString:_path]) + { + if (ocsPath) + [self warnWithFormat: @"GCS path is already set! '%@'", _path]; + ASSIGN (ocsPath, _path); + } +} + +- (NSString *) ocsPath +{ + return ocsPath; +} + +- (GCSFolderManager *) folderManager +{ + static GCSFolderManager *folderManager = nil; + + if (!folderManager) + folderManager = [GCSFolderManager defaultFolderManager]; + + return folderManager; +} + +- (GCSFolder *) ocsFolderForPath: (NSString *) _path +{ + return [[self folderManager] folderAtPath: _path]; +} + +- (BOOL) folderIsMandatory +{ + return [nameInContainer isEqualToString: @"personal"]; +} + - (NSString *) davDisplayName { return [self displayName]; @@ -237,7 +214,7 @@ static NSString *defaultUserID = @""; ocsFolder = [self ocsFolderForPath: [self ocsPath]]; userLogin = [[context activeUser] login]; if (!ocsFolder -/* && [userLogin isEqualToString: [self ownerInContext: context]] */ + && [userLogin isEqualToString: [self ownerInContext: context]] && [self folderIsMandatory] && [self create]) ocsFolder = [self ocsFolderForPath: [self ocsPath]]; @@ -252,11 +229,6 @@ static NSString *defaultUserID = @""; return folder; } -- (NSString *) folderType -{ - return @""; -} - - (void) sendFolderAdvisoryTemplate: (NSString *) template { NSString *pageName; @@ -428,11 +400,6 @@ static NSString *defaultUserID = @""; return rType; } -- (NSString *) davContentType -{ - return @"httpd/unix-directory"; -} - - (NSArray *) toOneRelationshipKeys { /* toOneRelationshipKeys are the 'files' contained in a folder */ @@ -668,51 +635,6 @@ static NSString *defaultUserID = @""; return defaultUserID; } -- (NSString *) httpURLForAdvisoryToUser: (NSString *) uid -{ - return [[self soURL] absoluteString]; -} - -- (NSString *) resourceURLForAdvisoryToUser: (NSString *) uid -{ - return [[self davURL] absoluteString]; -} - -- (id) lookupName: (NSString *) lookupName - inContext: (id) localContext - acquire: (BOOL) acquire -{ - id obj; - NSArray *davNamespaces; - NSDictionary *davInvocation; - NSString *objcMethod; - - obj = [super lookupName: lookupName inContext: localContext - acquire: acquire]; - if (!obj) - { - davNamespaces = [self davNamespaces]; - if ([davNamespaces count] > 0) - { - davInvocation = [lookupName asDavInvocation]; - if (davInvocation - && [davNamespaces - containsObject: [davInvocation objectForKey: @"ns"]]) - { - objcMethod = [[davInvocation objectForKey: @"method"] - davMethodToObjC]; - obj = [[SoSelectorInvocation alloc] - initWithSelectorNamed: - [NSString stringWithFormat: @"%@:", objcMethod] - addContextParameter: YES]; - [obj autorelease]; - } - } - } - - return obj; -} - - (NSComparisonResult) _compareByOrigin: (SOGoFolder *) otherFolder { NSArray *thisElements, *otherElements; @@ -767,7 +689,7 @@ static NSString *defaultUserID = @""; return comparison; } -- (NSComparisonResult) compare: (SOGoFolder *) otherFolder +- (NSComparisonResult) compare: (SOGoGCSFolder *) otherFolder { NSComparisonResult comparison; @@ -784,27 +706,6 @@ static NSString *defaultUserID = @""; return comparison; } -/* WebDAV */ - -- (NSArray *) davNamespaces -{ - return nil; -} - -- (BOOL) davIsCollection -{ - return [self isFolderish]; -} - -/* folder type */ - -- (NSString *) outlookFolderClass -{ - [self subclassResponsibility: _cmd]; - - return nil; -} - /* description */ - (void) appendAttributesToDescription: (NSMutableString *) _ms @@ -814,11 +715,4 @@ static NSString *defaultUserID = @""; [_ms appendFormat:@" ocs=%@", [self ocsPath]]; } -- (NSString *) loggingPrefix -{ - return [NSString stringWithFormat:@"<0x%08X[%@]:%@>", - self, NSStringFromClass([self class]), - [self nameInContainer]]; -} - @end /* SOGoFolder */ diff --git a/SoObjects/SOGo/SOGoParentFolder.h b/SoObjects/SOGo/SOGoParentFolder.h index c54d08f87..3001e6b3b 100644 --- a/SoObjects/SOGo/SOGoParentFolder.h +++ b/SoObjects/SOGo/SOGoParentFolder.h @@ -23,13 +23,13 @@ #ifndef SOGOPARENTFOLDERS_H #define SOGOPARENTFOLDERS_H -#import "SOGoObject.h" +#import "SOGoFolder.h" @class NSMutableDictionary; @class NSString; @class WOResponse; -@interface SOGoParentFolder : SOGoObject +@interface SOGoParentFolder : SOGoFolder { NSMutableDictionary *subFolders; NSString *OCSPath; @@ -39,10 +39,14 @@ + (NSString *) gcsFolderType; + (Class) subFolderClass; +- (NSString *) defaultFolderName; + - (void) setBaseOCSPath: (NSString *) newOCSPath; - (NSArray *) subFolders; +- (NSException *) newFolderWithName: (NSString *) name + andNameInContainer: (NSString *) newNameInContainer; - (NSException *) newFolderWithName: (NSString *) name nameInContainer: (NSString **) newNameInContainer; diff --git a/SoObjects/SOGo/SOGoParentFolder.m b/SoObjects/SOGo/SOGoParentFolder.m index 224fffbaf..a06e39c9c 100644 --- a/SoObjects/SOGo/SOGoParentFolder.m +++ b/SoObjects/SOGo/SOGoParentFolder.m @@ -31,7 +31,7 @@ #import #import -#import "SOGoFolder.h" +#import "SOGoGCSFolder.h" #import "SOGoUser.h" #import "SOGoParentFolder.h" @@ -86,9 +86,9 @@ { NSArray *attrs; NSDictionary *row; - SOGoFolder *folder; + SOGoGCSFolder *folder; BOOL hasPersonal; - NSString *key, *path, *personalName; + NSString *key; if (!subFolderClass) subFolderClass = [[self class] subFolderClass]; @@ -111,17 +111,17 @@ row = [fc fetchAttributes: attrs withZone: NULL]; } - if (!hasPersonal) - { - folder = [subFolderClass objectWithName: @"personal" inContainer: self]; - personalName = [self labelForKey: [self defaultFolderName]]; - [folder setDisplayName: personalName]; - path = [NSString stringWithFormat: @"/Users/%@/%@/personal", - [self ownerInContext: context], - nameInContainer]; - [folder setOCSPath: path]; - [subFolders setObject: folder forKey: @"personal"]; - } +// if (!hasPersonal) +// { +// folder = [subFolderClass objectWithName: @"personal" inContainer: self]; +// personalName = [self labelForKey: [self defaultFolderName]]; +// [folder setDisplayName: personalName]; +// path = [NSString stringWithFormat: @"/Users/%@/%@/personal", +// [self ownerInContext: context], +// nameInContainer]; +// [folder setOCSPath: path]; +// [subFolders setObject: folder forKey: @"personal"]; +// } } - (void) appendPersonalSources @@ -163,7 +163,7 @@ NSUserDefaults *settings; NSEnumerator *allKeys; NSString *currentKey; - SOGoFolder *subscribedFolder; + SOGoGCSFolder *subscribedFolder; settings = [[context activeUser] userSettings]; subscribedReferences = [[settings objectForKey: nameInContainer] @@ -185,17 +185,15 @@ } - (NSException *) newFolderWithName: (NSString *) name - nameInContainer: (NSString **) newNameInContainer + andNameInContainer: (NSString *) newNameInContainer { NSString *newFolderID; - SOGoFolder *newFolder; + SOGoGCSFolder *newFolder; NSException *error; if (!subFolderClass) subFolderClass = [[self class] subFolderClass]; - *newNameInContainer = nil; - newFolderID = [self globallyUniqueObjectId]; newFolder = [subFolderClass objectWithName: newFolderID inContainer: self]; if ([newFolder isKindOfClass: [NSException class]]) error = (NSException *) newFolder; @@ -205,10 +203,7 @@ [newFolder setOCSPath: [NSString stringWithFormat: @"%@/%@", OCSPath, newFolderID]]; if ([newFolder create]) - { - error = nil; - *newNameInContainer = newFolderID; - } + error = nil; else error = [NSException exceptionWithHTTPStatus: 400 reason: @"The new folder could not be created"]; @@ -217,6 +212,23 @@ return error; } +- (NSException *) newFolderWithName: (NSString *) name + nameInContainer: (NSString **) newNameInContainer +{ + NSString *newFolderID; + NSException *error; + + newFolderID = [self globallyUniqueObjectId]; + error = [self newFolderWithName: name + andNameInContainer: newFolderID]; + if (error) + *newNameInContainer = nil; + else + *newNameInContainer = newFolderID; + + return error; +} + - (void) initSubFolders { NSString *login; @@ -268,20 +280,4 @@ sortedArrayUsingSelector: @selector (compare:)]; } -/* acls */ -- (NSArray *) aclsForUser: (NSString *) uid -{ - return nil; -} - -- (BOOL) davIsCollection -{ - return YES; -} - -- (NSString *) davContentType -{ - return @"httpd/unix-directory"; -} - @end diff --git a/SoObjects/SOGo/SOGoUserFolder.h b/SoObjects/SOGo/SOGoUserFolder.h index 7f52d41f1..970f5e843 100644 --- a/SoObjects/SOGo/SOGoUserFolder.h +++ b/SoObjects/SOGo/SOGoUserFolder.h @@ -49,11 +49,6 @@ - (NSString *) ownerInContext: (WOContext *) _ctx; -/* pathes */ - -- (NSString *) ocsUserPath; -- (NSString *) ocsPrivateCalendarPath; - /* TODO: not implemented, bad bad */ // - (id)lookupFreeBusyObject; diff --git a/SoObjects/SOGo/SOGoUserFolder.m b/SoObjects/SOGo/SOGoUserFolder.m index 84297af23..5003c54d2 100644 --- a/SoObjects/SOGo/SOGoUserFolder.m +++ b/SoObjects/SOGo/SOGoUserFolder.m @@ -68,7 +68,8 @@ if (!children) children = [[NSArray alloc] initWithObjects: - @"Calendar", @"Contacts", @"Mail", nil]; + @"Calendar", @"Contacts", @"Mail", + @"Preferences", nil]; return children; } @@ -92,39 +93,6 @@ // return [self lookupName: @"Groups" inContext: nil acquire: NO]; // } -/* pathes */ - -- (void) setOCSPath: (NSString *) _path -{ - [self warnWithFormat: - @"rejected attempt to reset user-folder path: '%@'", _path]; -} - -- (NSString *) ocsPath -{ - return [NSString stringWithFormat: @"/Users/%@", nameInContainer]; -} - -- (NSString *) ocsUserPath -{ - return [self ocsPath]; -} - -- (BOOL) folderIsMandatory -{ - return NO; -} - -- (NSString *) ocsPrivateCalendarPath -{ - return [[self ocsUserPath] stringByAppendingString:@"/Calendar"]; -} - -- (NSString *) ocsPrivateContactsPath -{ - return [[self ocsUserPath] stringByAppendingString:@"/Contacts"]; -} - /* name lookup */ // - (NSString *) permissionForKey: (NSString *) key @@ -140,7 +108,8 @@ SOGoAppointmentFolders *calendars; calendars = [$(@"SOGoAppointmentFolders") objectWithName: _key inContainer: self]; - [calendars setBaseOCSPath: [self ocsPrivateCalendarPath]]; + [calendars setBaseOCSPath: [NSString stringWithFormat: @"/Users/%@/Calendar", + nameInContainer]]; return calendars; } @@ -151,7 +120,8 @@ SOGoContactFolders *contacts; contacts = [$(@"SOGoContactFolders") objectWithName:_key inContainer: self]; - [contacts setBaseOCSPath: [self ocsPrivateContactsPath]]; + [contacts setBaseOCSPath: [NSString stringWithFormat: @"/Users/%@/Contacts", + nameInContainer]]; return contacts; } @@ -195,6 +165,9 @@ // obj = [self groupsFolder: _key inContext: _ctx]; else if ([_key isEqualToString: @"Mail"]) obj = [self mailAccountsFolder: _key inContext: _ctx]; + else if ([_key isEqualToString: @"Preferences"]) + obj = [$(@"SOGoPreferencesFolder") objectWithName: _key + inContainer: self]; else if ([_key isEqualToString: @"freebusy.ifb"]) obj = [self freeBusyObject:_key inContext: _ctx]; else diff --git a/UI/Common/UIxFolderActions.m b/UI/Common/UIxFolderActions.m index 1c2d59b05..44d21f6d3 100644 --- a/UI/Common/UIxFolderActions.m +++ b/UI/Common/UIxFolderActions.m @@ -35,9 +35,9 @@ #import #import -#import -#import +#import #import +#import #import "WODirectAction+SOGo.h" diff --git a/UI/Common/product.plist b/UI/Common/product.plist index b9b6d7e7e..157e7ace7 100644 --- a/UI/Common/product.plist +++ b/UI/Common/product.plist @@ -71,7 +71,7 @@ }; }; }; - SOGoFolder = { + SOGoGCSFolder = { methods = { subscribe = { protectedBy = ""; diff --git a/UI/Contacts/UIxContactFoldersView.m b/UI/Contacts/UIxContactFoldersView.m index fa43d8109..8adba727c 100644 --- a/UI/Contacts/UIxContactFoldersView.m +++ b/UI/Contacts/UIxContactFoldersView.m @@ -177,7 +177,7 @@ { NSMutableArray *folders; NSEnumerator *subfolders; - SOGoFolder *currentFolder; + SOGoGCSFolder *currentFolder; NSString *folderName; NSMutableDictionary *currentDictionary; SoSecurityManager *securityManager; diff --git a/UI/Contacts/product.plist b/UI/Contacts/product.plist index 3602be7ae..1168ddcf2 100644 --- a/UI/Contacts/product.plist +++ b/UI/Contacts/product.plist @@ -136,7 +136,7 @@ actionName = "delete"; }; edit = { - protectedBy = "Change Images And Files"; + protectedBy = "Access Contents Information"; pageName = "UIxContactEditor"; }; save = { @@ -158,16 +158,16 @@ protectedBy = ""; pageName = "UIxContactView"; }; - delete = { +/* delete = { protectedBy = "View"; pageName = "UIxContactView"; actionName = "delete"; - }; + }; */ edit = { - protectedBy = "View"; + protectedBy = "Access Contents Information"; pageName = "UIxContactEditor"; }; - save = { +/* save = { protectedBy = "View"; pageName = "UIxContactEditor"; actionName = "save"; @@ -176,7 +176,7 @@ protectedBy = "View"; pageName = "UIxContactEditor"; actionName = "write"; - }; + }; */ }; }; };