From 9b5e7361e38ccab6a8904d5eb12cd5de900d0b51 Mon Sep 17 00:00:00 2001 From: C Robert Date: Tue, 30 Jun 2009 20:10:09 +0000 Subject: [PATCH 1/8] Monotone-Parent: 77d6f1cf85f2204c8e5f316ee513551508049ec9 Monotone-Revision: 1487f5359ed75a8c1f5df8db9a25b561e7e5978c Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-06-30T20:10:09 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 2 ++ UI/MailerUI/UIxMailListView.m | 34 +++++++++++++++++++---- UI/Templates/MailerUI/UIxMailListView.wox | 8 +++++- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 277457780..e32b66a51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * UI/WebServerResources/MailerUI.js: Added drag & drop support! * UI/MailPartViewers/UIxMailPartHTMLViewer.m: Removed an extra NSLog + * UI/MailerUI/UIxMailListView.m: Added support for "Size" column, fixed a + bug when number of columns != 7. 2009-06-29 Cyril Robert diff --git a/UI/MailerUI/UIxMailListView.m b/UI/MailerUI/UIxMailListView.m index e560af6c4..8ec17ca3a 100644 --- a/UI/MailerUI/UIxMailListView.m +++ b/UI/MailerUI/UIxMailListView.m @@ -110,6 +110,18 @@ return [dateFormatter formattedDateAndTime: messageDate]; } +- (NSString *) messageSize +{ + NSString *rc; + int size; + + size = [[message valueForKey: @"size"] intValue]; + + rc = [NSString stringWithFormat: @"%dK", size/1024]; + + return rc; +} + // // Priorities are defined like this: // @@ -651,7 +663,7 @@ searchValue = [request formValueForKey: @"value"]; if ([searchValue length]) [self _setQualifierForCriteria: searchCriteria - andValue: searchValue]; + andValue: searchValue]; firstMessageNumber = ((specificMessage) @@ -761,6 +773,13 @@ [columnsMetaData setObject: [NSDictionary dictionaryWithObjects: tmpColumns forKeys: tmpKeys] forKey: @"Priority"]; + + tmpColumns + = [NSArray arrayWithObjects: @"tbtv_headercell", @"sizeHeader", + @"Size", nil]; + [columnsMetaData setObject: [NSDictionary dictionaryWithObjects: tmpColumns + forKeys: tmpKeys] + forKey: @"Size"]; return columnsMetaData; } @@ -777,11 +796,11 @@ if (![defaultsOrder count]) { defaultsOrder = [[NSUserDefaults standardUserDefaults] - arrayForKey: @"SOGoMailListViewColumnsOrder"]; + arrayForKey: @"SOGoMailListViewColumnsOrder"]; if (![defaultsOrder count]) - defaultsOrder = [NSArray arrayWithObjects: @"Invisible", - @"Attachment", @"Subject", @"From", - @"Unread", @"Date", @"Priority", nil]; + defaultsOrder = [NSArray arrayWithObjects: @"Invisible", + @"Attachment", @"Subject", @"From", + @"Unread", @"Date", @"Priority", nil]; } userDefinedOrder = [NSMutableArray arrayWithArray: defaultsOrder]; @@ -802,6 +821,11 @@ notFoundMarker: @""]; } +- (NSString *) columnsDisplayCount +{ + return [NSString stringWithFormat: @"%d", [[self columnsDisplayOrder] count]]; +} + - (NSString *) columnTitle { return [self labelForKey: [currentColumn objectForKey: @"value"]]; diff --git a/UI/Templates/MailerUI/UIxMailListView.wox b/UI/Templates/MailerUI/UIxMailListView.wox index 40c6a9451..e47b64c5a 100644 --- a/UI/Templates/MailerUI/UIxMailListView.wox +++ b/UI/Templates/MailerUI/UIxMailListView.wox @@ -31,7 +31,7 @@ | @@ -132,6 +132,12 @@ > From c619a07d57209860d32abf6ec3e5b191fd3a14a5 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 30 Jun 2009 21:21:50 +0000 Subject: [PATCH 2/8] Monotone-Parent: db6101745dbd661ce3278ea7f4c6bb9837382a4f Monotone-Revision: 70ad94d55908966fdc416a1daead1a79c3ee8cd3 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-06-30T21:21:50 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 9 +++++++++ SoObjects/Appointments/SOGoAppointmentFolder.m | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e32b66a51..6405b737e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-06-30 Wolfgang Sourdeau + + * SoObjects/Appointments/SOGoAppointmentFolder.m + (-davCalendarMultiget, -davCalendarQuery): certain dav attribute + methods do not necessitate additional fields, we declare their + corresponding fields to "". Also, we make sure those fake fields + are not specified in the SQL query and we ensure all the fields + are only requested once each. + 2009-06-30 Cyril Robert * UI/WebServerResources/MailerUI.js: Added drag & drop support! diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 1f088b3ae..b3aa10786 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -1579,13 +1579,17 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir NSMutableArray *fields; NSDictionary *currentFilter; NSEnumerator *filterList; - NSString *additionalFilters, *baseURL; + NSString *additionalFilters, *baseURL, *currentField; NSMutableString *buffer; NSString **propertiesArray; + NSEnumerator *addFields; unsigned int count, max, propertiesCount; fields = [NSMutableArray arrayWithObjects: @"c_name", @"c_component", nil]; - [fields addObjectsFromArray: [properties allValues]]; + addFields = [[properties allValues] objectEnumerator]; + while ((currentField = [addFields nextObject])) + if ([currentField length]) + [fields addObjectUniquely: currentField]; baseURL = [[self davURL] absoluteString]; propertiesArray = [[properties allKeys] asPointersOfObjects]; @@ -1798,11 +1802,12 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir { NSObject *element; NSDictionary *currentComponent, *components; - NSString *currentURL, *baseURL; + NSString *currentURL, *baseURL, *currentField; NSString **propertiesArray; NSMutableArray *urls, *fields; NSMutableString *buffer; unsigned int count, max, propertiesCount; + NSEnumerator *addFields; baseURL = [[self davURL] absoluteString]; @@ -1819,7 +1824,10 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir propertiesCount = [properties count]; fields = [NSMutableArray arrayWithObjects: @"c_name", @"c_component", nil]; - [fields addObjectsFromArray: [properties allValues]]; + addFields = [[properties allValues] objectEnumerator]; + while ((currentField = [addFields nextObject])) + if ([currentField length]) + [fields addObjectUniquely: currentField]; components = [self _fetchComponentsMatchingURLs: urls fields: fields]; max = [urls count]; From ffc3f67ff491c1ad4f5fecf9c75b11860c35291e Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 30 Jun 2009 21:34:02 +0000 Subject: [PATCH 3/8] Monotone-Parent: 70ad94d55908966fdc416a1daead1a79c3ee8cd3 Monotone-Revision: 4fa44f713c3899d8e5db6b47ffb8672ce37547d5 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-06-30T21:34:02 Monotone-Branch: ca.inverse.sogo --- SoObjects/SOGo/SOGoWebDAVAclManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SoObjects/SOGo/SOGoWebDAVAclManager.m b/SoObjects/SOGo/SOGoWebDAVAclManager.m index 297e2c87c..ba5949353 100644 --- a/SoObjects/SOGo/SOGoWebDAVAclManager.m +++ b/SoObjects/SOGo/SOGoWebDAVAclManager.m @@ -64,7 +64,7 @@ static NSNumber *yesObject = nil; defaultRolesForPermission: permission]; if ([roles firstObjectCommonWithArray: userRoles]) { - NSLog (@"matched '%@': %@", permission, roles); +// NSLog (@"matched '%@': %@", permission, roles); result = YES; } else From b5a2244030407c316e612bdc26b4f305f7ce2818 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 30 Jun 2009 21:34:17 +0000 Subject: [PATCH 4/8] Monotone-Parent: 4fa44f713c3899d8e5db6b47ffb8672ce37547d5 Monotone-Revision: f3b827c36d50cd87aed46a81e25ef2e3cc3a7e58 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-06-30T21:34:17 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 2 ++ SoObjects/Appointments/SOGoAppointmentFolder.m | 1 + 2 files changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6405b737e..d747b426d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ corresponding fields to "". Also, we make sure those fake fields are not specified in the SQL query and we ensure all the fields are only requested once each. + (-davCalendarComponentSet): we need to retain the returned + array to avoid a crash during the next access to the attribute. 2009-06-30 Cyril Robert diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index b3aa10786..7a6295296 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -2252,6 +2252,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir XMLNS_CALDAV, components) asWebDAVValue]; + [componentSet retain]; } return componentSet; From 809d315ea097fad601a12eb9e1eafbbaddb4c435 Mon Sep 17 00:00:00 2001 From: C Robert Date: Wed, 1 Jul 2009 14:03:58 +0000 Subject: [PATCH 5/8] Monotone-Parent: f3b827c36d50cd87aed46a81e25ef2e3cc3a7e58 Monotone-Revision: 1b7361c719f9b3c85edd777474664dadd07b72b3 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-07-01T14:03:58 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 + SoObjects/SOGo/SOGoGCSFolder.m | 308 +++++++++++++++++---------------- 2 files changed, 161 insertions(+), 152 deletions(-) diff --git a/ChangeLog b/ChangeLog index d747b426d..e636756ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-07-01 Cyril Robert + + * SoObjects/SOGo/SOGoGCSFolder.m: Remove color from user settings on + unsubscribe. + 2009-06-30 Wolfgang Sourdeau * SoObjects/Appointments/SOGoAppointmentFolder.m diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index b30f6409b..cac055133 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -651,9 +651,9 @@ static NSArray *childRecordFields = nil; #warning this code should be cleaned up - (void) _subscribeUser: (SOGoUser *) subscribingUser - reallyDo: (BOOL) reallyDo + reallyDo: (BOOL) reallyDo fromMailInvitation: (BOOL) isMailInvitation - inResponse: (WOResponse *) response + inResponse: (WOResponse *) response { NSMutableArray *folderSubscription; NSString *subscriptionPointer, *mailInvitationURL; @@ -664,101 +664,105 @@ static NSArray *childRecordFields = nil; { [response setStatus: 403]; [response appendContentString: - @"You cannot (un)subscribe to a folder that you own!"]; + @"You cannot (un)subscribe to a folder that you own!"]; } else { ud = [subscribingUser userSettings]; moduleSettings = [ud objectForKey: [container nameInContainer]]; if (!(moduleSettings - && [moduleSettings isKindOfClass: [NSMutableDictionary class]])) - { - moduleSettings = [NSMutableDictionary dictionary]; - [ud setObject: moduleSettings forKey: [container nameInContainer]]; - } + && [moduleSettings isKindOfClass: [NSMutableDictionary class]])) + { + moduleSettings = [NSMutableDictionary dictionary]; + [ud setObject: moduleSettings forKey: [container nameInContainer]]; + } folderSubscription - = [moduleSettings objectForKey: @"SubscribedFolders"]; + = [moduleSettings objectForKey: @"SubscribedFolders"]; if (!(folderSubscription - && [folderSubscription isKindOfClass: [NSMutableArray class]])) - { - folderSubscription = [NSMutableArray array]; - [moduleSettings setObject: folderSubscription - forKey: @"SubscribedFolders"]; - } + && [folderSubscription isKindOfClass: [NSMutableArray class]])) + { + folderSubscription = [NSMutableArray array]; + [moduleSettings setObject: folderSubscription + forKey: @"SubscribedFolders"]; + } subscriptionPointer = [self folderReference]; if (reallyDo) - [folderSubscription addObjectUniquely: subscriptionPointer]; + [folderSubscription addObjectUniquely: subscriptionPointer]; else - [folderSubscription removeObject: subscriptionPointer]; + { + [[moduleSettings objectForKey: @"FolderColors"] + removeObjectForKey: subscriptionPointer]; + [folderSubscription removeObject: subscriptionPointer]; + } [ud synchronize]; if (isMailInvitation) - { - mailInvitationURL = [[self soURLToBaseContainerForCurrentUser] - absoluteString]; - [response setStatus: 302]; - [response setHeader: mailInvitationURL - forKey: @"location"]; - } + { + mailInvitationURL = [[self soURLToBaseContainerForCurrentUser] + absoluteString]; + [response setStatus: 302]; + [response setHeader: mailInvitationURL + forKey: @"location"]; + } else - [response setStatus: 204]; + [response setStatus: 204]; } } - (WOResponse *) subscribe: (BOOL) reallyDo - inTheNamesOf: (NSArray *) delegatedUsers - fromMailInvitation: (BOOL) isMailInvitation - inContext: (WOContext *) localContext + inTheNamesOf: (NSArray *) delegatedUsers + fromMailInvitation: (BOOL) isMailInvitation + inContext: (WOContext *) localContext { WOResponse *response; SOGoUser *currentUser; response = [localContext response]; [response setHeader: @"text/plain; charset=utf-8" - forKey: @"Content-Type"]; + forKey: @"Content-Type"]; currentUser = [localContext activeUser]; if ([delegatedUsers count]) { if (![currentUser isSuperUser]) - { - [response setStatus: 403]; - [response appendContentString: - @"You cannot subscribe another user to any folder" - @" unless you are a super-user."]; - } + { + [response setStatus: 403]; + [response appendContentString: + @"You cannot subscribe another user to any folder" + @" unless you are a super-user."]; + } else - { - // The current user is a superuser... - SOGoUser *subscriptionUser; - int i; + { + // The current user is a superuser... + SOGoUser *subscriptionUser; + int i; - for (i = 0; i < [delegatedUsers count]; i++) - { - // We trust the passed user ID here as it might generate tons or LDAP - // call but more importantly, cache propagation calls that will create - // contention on GDNC. - subscriptionUser = [SOGoUser userWithLogin: [delegatedUsers objectAtIndex: i] - roles: nil - trust: YES]; - - [self _subscribeUser: subscriptionUser - reallyDo: reallyDo - fromMailInvitation: isMailInvitation - inResponse: response]; - } - } + for (i = 0; i < [delegatedUsers count]; i++) + { + // We trust the passed user ID here as it might generate tons or LDAP + // call but more importantly, cache propagation calls that will create + // contention on GDNC. + subscriptionUser = [SOGoUser userWithLogin: [delegatedUsers objectAtIndex: i] + roles: nil + trust: YES]; + + [self _subscribeUser: subscriptionUser + reallyDo: reallyDo + fromMailInvitation: isMailInvitation + inResponse: response]; + } + } } else { [self _subscribeUser: currentUser - reallyDo: reallyDo - fromMailInvitation: isMailInvitation - inResponse: response]; + reallyDo: reallyDo + fromMailInvitation: isMailInvitation + inResponse: response]; } return response; @@ -773,9 +777,9 @@ static NSArray *childRecordFields = nil; attrs = [[document documentElement] attributes]; o = [attrs namedItem: @"users"]; - + if (o) return [[o nodeValue] componentsSeparatedByString: @","]; - + return nil; } @@ -783,16 +787,16 @@ static NSArray *childRecordFields = nil; { return [self subscribe: YES inTheNamesOf: [self _parseDAVDelegatedUser: queryContext] - fromMailInvitation: NO - inContext: queryContext]; + fromMailInvitation: NO + inContext: queryContext]; } - (id ) davUnsubscribe: (WOContext *) queryContext { return [self subscribe: NO inTheNamesOf: [self _parseDAVDelegatedUser: queryContext] - fromMailInvitation: NO - inContext: queryContext]; + fromMailInvitation: NO + inContext: queryContext]; } - (NSDictionary *) davSQLFieldsTable @@ -828,7 +832,7 @@ static NSArray *childRecordFields = nil; [davSQLFields setObject: sqlField forKey: property]; else [self errorWithFormat: @"DAV property '%@' has no matching SQL field," - @" response could be incomplete", property]; + @" response could be incomplete", property]; } return davSQLFields; @@ -857,9 +861,9 @@ static NSArray *childRecordFields = nil; if (qualifier) fetchSpec = [EOFetchSpecification - fetchSpecificationWithEntityName: [folder folderName] - qualifier: qualifier - sortOrderings: nil]; + fetchSpecificationWithEntityName: [folder folderName] + qualifier: qualifier + sortOrderings: nil]; else fetchSpec = nil; @@ -882,7 +886,7 @@ static NSArray *childRecordFields = nil; NSString *currentField; fields = [NSMutableArray arrayWithObjects: @"c_name", @"c_component", - @"c_creationdate", @"c_lastmodified", nil]; + @"c_creationdate", @"c_lastmodified", nil]; addFields = [[properties allValues] objectEnumerator]; while ((currentField = [addFields nextObject])) if ([currentField length]) @@ -891,17 +895,17 @@ static NSArray *childRecordFields = nil; if (syncToken) { qualifier = [EOQualifier qualifierWithQualifierFormat: - @"c_lastmodified > %d", syncToken]; + @"c_lastmodified > %d", syncToken]; mRecords = [NSMutableArray arrayWithArray: [self _fetchFields: fields - withQualifier: qualifier - ignoreDeleted: YES]]; + withQualifier: qualifier + ignoreDeleted: YES]]; qualifier = [EOQualifier qualifierWithQualifierFormat: - @"c_lastmodified > %d and c_deleted == 1", - syncToken]; + @"c_lastmodified > %d and c_deleted == 1", + syncToken]; fields = [NSMutableArray arrayWithObjects: @"c_name", @"c_deleted", nil]; [mRecords addObjectsFromArray: [self _fetchFields: fields - withQualifier: qualifier - ignoreDeleted: NO]]; + withQualifier: qualifier + ignoreDeleted: NO]]; records = mRecords; } else @@ -948,30 +952,30 @@ static NSArray *childRecordFields = nil; { if (selectors[count] && [sogoObject respondsToSelector: selectors[count]]) - result = [sogoObject performSelector: selectors[count]]; + result = [sogoObject performSelector: selectors[count]]; else result = nil; if (result) { propContent = [[davProperties objectAtIndex: count] - asWebDAVTupleWithContent: result]; + asWebDAVTupleWithContent: result]; [properties200 addObject: propContent]; } else { propContent = [[davProperties objectAtIndex: count] - asWebDAVTuple]; + asWebDAVTuple]; [properties404 addObject: propContent]; } } if ([properties200 count]) [propstats addObject: [self _davPropstat: properties200 - withStatus: @"HTTP/1.1 200 OK"]]; + withStatus: @"HTTP/1.1 200 OK"]]; if ([properties404 count]) [propstats addObject: [self _davPropstat: properties404 - withStatus: @"HTTP/1.1 404 Not Found"]]; + withStatus: @"HTTP/1.1 404 Not Found"]]; return propstats; } @@ -983,15 +987,15 @@ static NSArray *childRecordFields = nil; andBaseURL: (NSString *) baseURL { static NSString *status[] = { @"HTTP/1.1 404 Not Found", - @"HTTP/1.1 201 Created", - @"HTTP/1.1 200 OK" }; + @"HTTP/1.1 201 Created", + @"HTTP/1.1 200 OK" }; NSMutableArray *children; NSString *href; unsigned int statusIndex; children = [NSMutableArray arrayWithCapacity: 3]; href = [NSString stringWithFormat: @"%@%@", - baseURL, [record objectForKey: @"c_name"]]; + baseURL, [record objectForKey: @"c_name"]]; [children addObject: davElementWithContent (@"href", XMLNS_WEBDAV, href)]; if (syncToken) @@ -1010,14 +1014,14 @@ static NSArray *childRecordFields = nil; else statusIndex = 1; -// NSLog (@"webdav sync: %@ (%@)", href, status[statusIndex]); + // NSLog (@"webdav sync: %@ (%@)", href, status[statusIndex]); [children addObject: davElementWithContent (@"status", XMLNS_WEBDAV, status[statusIndex])]; if (statusIndex) [children addObjectsFromArray: [self _davPropstatsWithProperties: properties - andMethodSelectors: selectors - fromRecord: record]]; + andMethodSelectors: selectors + fromRecord: record]]; return davElementWithContent (@"sync-response", XMLNS_WEBDAV, children); } @@ -1055,10 +1059,10 @@ static NSArray *childRecordFields = nil; if (newToken < currentLM) newToken = currentLM; [syncResponses addObject: [self _syncResponseWithProperties: properties - andMethodSelectors: selectors - fromRecord: record - withToken: syncToken - andBaseURL: baseURL]]; + andMethodSelectors: selectors + fromRecord: record + withToken: syncToken + andBaseURL: baseURL]]; } NSZoneFree (NULL, selectors); @@ -1130,9 +1134,9 @@ static NSArray *childRecordFields = nil; not "ObjectCreator" because the latter doesn't imply we can read properties from subobjects or even know their existence. */ userCanAccessAllObjects = ([[self ownerInContext: localContext] - isEqualToString: login] + isEqualToString: login] || [[self aclsForUser: login] - containsObject: SOGoRole_ObjectEraser]); + containsObject: SOGoRole_ObjectEraser]); } } @@ -1145,7 +1149,7 @@ static NSArray *childRecordFields = nil; NSArray *records, *uids; qs = [NSString stringWithFormat: @"c_object = '/%@'", - [objectPathArray componentsJoinedByString: @"/"]]; + [objectPathArray componentsJoinedByString: @"/"]]; qualifier = [EOQualifier qualifierWithQualifierFormat: qs]; records = [[self ocsFolder] fetchAclMatchingQualifier: qualifier]; uids = [[records valueForKey: @"c_uid"] uniqueObjects]; @@ -1154,7 +1158,7 @@ static NSArray *childRecordFields = nil; } - (NSArray *) _fetchAclsForUser: (NSString *) uid - forObjectAtPath: (NSString *) objectPath + forObjectAtPath: (NSString *) objectPath { EOQualifier *qualifier; NSArray *records; @@ -1163,7 +1167,7 @@ static NSArray *childRecordFields = nil; // We look for the exact uid or any uid that begins with "@" (corresponding to groups) qs = [NSString stringWithFormat: @"(c_object = '/%@') AND (c_uid = '%@' OR c_uid LIKE '@%%')", - objectPath, uid]; + objectPath, uid]; qualifier = [EOQualifier qualifierWithQualifierFormat: qs]; records = [[self ocsFolder] fetchAclMatchingQualifier: qualifier]; acls = [NSMutableArray array]; @@ -1180,31 +1184,31 @@ static NSArray *childRecordFields = nil; record = [records objectAtIndex: i]; currentUid = [record valueForKey: @"c_uid"]; if ([currentUid isEqualToString: uid]) - [acls addObject: [record valueForKey: @"c_role"]]; + [acls addObject: [record valueForKey: @"c_role"]]; else - { - group = [SOGoGroup groupWithIdentifier: currentUid]; - if (group) - { - members = [group members]; - for (j = 0; j < [members count]; j++) - { - user = [members objectAtIndex: j]; - if ([[user login] isEqualToString: uid]) - { - [acls addObject: [record valueForKey: @"c_role"]]; - break; - } - } - } - } + { + group = [SOGoGroup groupWithIdentifier: currentUid]; + if (group) + { + members = [group members]; + for (j = 0; j < [members count]; j++) + { + user = [members objectAtIndex: j]; + if ([[user login] isEqualToString: uid]) + { + [acls addObject: [record valueForKey: @"c_role"]]; + break; + } + } + } + } } - + return [acls uniqueObjects]; } - (void) _cacheRoles: (NSArray *) roles - forUser: (NSString *) uid + forUser: (NSString *) uid forObjectAtPath: (NSString *) objectPath { NSMutableDictionary *aclsForObject; @@ -1239,23 +1243,23 @@ static NSArray *childRecordFields = nil; { acls = [self _fetchAclsForUser: uid forObjectAtPath: objectPath]; if (!acls) - acls = [NSArray array]; + acls = [NSArray array]; [self _cacheRoles: acls forUser: uid forObjectAtPath: objectPath]; } if (!([acls count] || [uid isEqualToString: defaultUserID])) - acls = [self aclsForUser: defaultUserID - forObjectAtPath: objectPathArray]; + acls = [self aclsForUser: defaultUserID + forObjectAtPath: objectPathArray]; // If we still don't have ACLs defined for this particular resource, // let's go get the system-wide defaults, if any. if (![acls count]) { if ([[container nameInContainer] isEqualToString: @"Calendar"] - || [[container nameInContainer] isEqualToString: @"Contacts"]) - acls = [[NSUserDefaults standardUserDefaults] - objectForKey: [NSString stringWithFormat: @"SOGo%@DefaultRoles", - [container nameInContainer]]]; + || [[container nameInContainer] isEqualToString: @"Contacts"]) + acls = [[NSUserDefaults standardUserDefaults] + objectForKey: [NSString stringWithFormat: @"SOGo%@DefaultRoles", + [container nameInContainer]]]; } return acls; @@ -1275,33 +1279,33 @@ static NSArray *childRecordFields = nil; { usersAndGroups = [NSMutableArray arrayWithArray: users]; for (i = 0; i < [usersAndGroups count]; i++) - { - uid = [usersAndGroups objectAtIndex: i]; - if (![uid hasPrefix: @"@"]) - { - // Prefix the UID with the character "@" when dealing with a group - group = [SOGoGroup groupWithIdentifier: uid]; - if (group) - [usersAndGroups replaceObjectAtIndex: i - withObject: [NSString stringWithFormat: @"@%@", uid]]; - } - } + { + uid = [usersAndGroups objectAtIndex: i]; + if (![uid hasPrefix: @"@"]) + { + // Prefix the UID with the character "@" when dealing with a group + group = [SOGoGroup groupWithIdentifier: uid]; + if (group) + [usersAndGroups replaceObjectAtIndex: i + withObject: [NSString stringWithFormat: @"@%@", uid]]; + } + } objectPath = [objectPathArray componentsJoinedByString: @"/"]; aclsForObject = [aclCache objectForKey: objectPath]; if (aclsForObject) - [aclsForObject removeObjectsForKeys: usersAndGroups]; + [aclsForObject removeObjectsForKeys: usersAndGroups]; uids = [usersAndGroups componentsJoinedByString: @"') OR (c_uid = '"]; qs = [NSString - stringWithFormat: @"(c_object = '/%@') AND ((c_uid = '%@'))", - objectPath, uids]; + stringWithFormat: @"(c_object = '/%@') AND ((c_uid = '%@'))", + objectPath, uids]; qualifier = [EOQualifier qualifierWithQualifierFormat: qs]; [[self ocsFolder] deleteAclMatchingQualifier: qualifier]; } } - (void) _commitRoles: (NSArray *) roles - forUID: (NSString *) uid - forObject: (NSString *) objectPath + forUID: (NSString *) uid + forObject: (NSString *) objectPath { EOAdaptorChannel *channel; GCSFolder *folder; @@ -1315,10 +1319,10 @@ static NSArray *childRecordFields = nil; while ((currentRole = [userRoles nextObject])) { SQL = [NSString stringWithFormat: @"INSERT INTO %@" - @" (c_object, c_uid, c_role)" - @" VALUES ('/%@', '%@', '%@')", - [folder aclTableName], - objectPath, uid, currentRole]; + @" (c_object, c_uid, c_role)" + @" VALUES ('/%@', '%@', '%@')", + [folder aclTableName], + objectPath, uid, currentRole]; [channel evaluateExpressionX: SQL]; } @@ -1340,17 +1344,17 @@ static NSArray *childRecordFields = nil; // Prefix the UID with the character "@" when dealing with a group group = [SOGoGroup groupWithIdentifier: uid]; if (group) - aUID = [NSString stringWithFormat: @"@%@", uid]; + aUID = [NSString stringWithFormat: @"@%@", uid]; } [self removeAclsForUsers: [NSArray arrayWithObject: aUID] - forObjectAtPath: objectPathArray]; + forObjectAtPath: objectPathArray]; newRoles = [NSMutableArray arrayWithArray: roles]; [newRoles removeObject: SOGoRole_AuthorizedSubscriber]; [newRoles removeObject: SOGoRole_None]; objectPath = [objectPathArray componentsJoinedByString: @"/"]; [self _cacheRoles: newRoles forUser: uid - forObjectAtPath: objectPath]; + forObjectAtPath: objectPath]; if (![newRoles count]) [newRoles addObject: SOGoRole_None]; @@ -1375,11 +1379,11 @@ static NSArray *childRecordFields = nil; { containerAcls = [container aclsForUser: uid]; if ([containerAcls count] > 0) - { + { #warning this should be checked - if ([containerAcls containsObject: SOGoRole_ObjectEraser]) - [acls addObject: SOGoRole_ObjectEraser]; - } + if ([containerAcls containsObject: SOGoRole_ObjectEraser]) + [acls addObject: SOGoRole_ObjectEraser]; + } } return acls; @@ -1389,14 +1393,14 @@ static NSArray *childRecordFields = nil; forUser: (NSString *) uid { return [self setRoles: roles - forUser: uid - forObjectAtPath: [self pathArrayToFolder]]; + forUser: uid + forObjectAtPath: [self pathArrayToFolder]]; } - (void) removeAclsForUsers: (NSArray *) users { return [self removeAclsForUsers: users - forObjectAtPath: [self pathArrayToFolder]]; + forObjectAtPath: [self pathArrayToFolder]]; } - (NSString *) defaultUserID @@ -1409,7 +1413,7 @@ static NSArray *childRecordFields = nil; - (void) appendAttributesToDescription: (NSMutableString *) _ms { [super appendAttributesToDescription:_ms]; - + [_ms appendFormat:@" ocs=%@", [self ocsPath]]; } From 5e3c9c538e7aae812e5fd40dac1d3105fc2e9dec Mon Sep 17 00:00:00 2001 From: C Robert Date: Wed, 1 Jul 2009 14:07:46 +0000 Subject: [PATCH 6/8] Monotone-Parent: 1b7361c719f9b3c85edd777474664dadd07b72b3 Monotone-Revision: 3ac570e4fa8c731e64772136171a4d88a10439c6 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-07-01T14:07:46 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/UIxPreferences.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/UI/WebServerResources/UIxPreferences.js b/UI/WebServerResources/UIxPreferences.js index 745fa2cc7..eee8082b2 100644 --- a/UI/WebServerResources/UIxPreferences.js +++ b/UI/WebServerResources/UIxPreferences.js @@ -1,7 +1,9 @@ /* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */ function savePreferences(sender) { - $("signaturePlacementList").disabled=false; + var sigList = $("signaturePlacementList"); + if (sigList) + sigList.disabled=false; $("mainForm").submit(); return false; From bcb1bf15241c4e421fe1247d40b24edbbf76463a Mon Sep 17 00:00:00 2001 From: C Robert Date: Wed, 1 Jul 2009 14:25:29 +0000 Subject: [PATCH 7/8] Monotone-Parent: 3ac570e4fa8c731e64772136171a4d88a10439c6 Monotone-Revision: 54bb84ab8b59e2b96267864370c2253fbc5d3ba3 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-07-01T14:25:29 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/UIxPreferences.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/UI/WebServerResources/UIxPreferences.js b/UI/WebServerResources/UIxPreferences.js index eee8082b2..7d5af1fe9 100644 --- a/UI/WebServerResources/UIxPreferences.js +++ b/UI/WebServerResources/UIxPreferences.js @@ -32,7 +32,12 @@ function onChoiceChanged(event) { } function initPreferences() { - CKEDITOR.replace('signature', + _setupEvents(true); + if (typeof (initAdditionalPreferences) != "undefined") + initAdditionalPreferences(); + + if ($("signature")) { + CKEDITOR.replace('signature', { skin: "v2", height: "90px", @@ -44,18 +49,16 @@ function initPreferences() { } ); - _setupEvents(true); - if (typeof (initAdditionalPreferences) != "undefined") - initAdditionalPreferences(); - $("replyPlacementList").observe ("change", onReplyPlacementListChange); - onReplyPlacementListChange(); + $("replyPlacementList").observe ("change", onReplyPlacementListChange); + onReplyPlacementListChange(); - $("composeMessagesType").observe ("change", onComposeMessagesTypeChange); + $("composeMessagesType").observe ("change", onComposeMessagesTypeChange); - if (!UserDefaults["ComposeMessagesType"]) - UserDefaults["ComposeMessagesType"] = "text"; + if (!UserDefaults["ComposeMessagesType"]) + UserDefaults["ComposeMessagesType"] = "text"; - onComposeMessagesTypeChange (); + onComposeMessagesTypeChange (); + } } function onReplyPlacementListChange() { From a40feed75ca62027c505187311f213c18bf452ec Mon Sep 17 00:00:00 2001 From: C Robert Date: Wed, 1 Jul 2009 15:09:45 +0000 Subject: [PATCH 8/8] Monotone-Parent: 54bb84ab8b59e2b96267864370c2253fbc5d3ba3 Monotone-Revision: 52e582748151e87bfde51bfd7c475d994270767b Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-07-01T15:09:45 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/MailerUI.js | 33 ++++++++++++++++++------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index 91bcdca26..4ae23cb17 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -728,21 +728,26 @@ function statusFoldersCallback(http) { function updateStatusFolders(count, isDelta) { var span = $("unseenCount"); - var counter = span.select("SPAN").first(); + var counter = null; + + if (span) + counter = span.select("SPAN").first(); - if (typeof count == "undefined") - count = parseInt(counter.innerHTML); - else if (isDelta) - count += parseInt(counter.innerHTML); - counter.update(count); - if (count > 0) { - span.setStyle({ display: "inline" }); - span.up("SPAN").addClassName("unseen"); - } - else { - span.setStyle({ display: "none" }); - span.up("SPAN").removeClassName("unseen"); - } + if (counter && span) { + if (typeof count == "undefined") + count = parseInt(counter.innerHTML); + else if (isDelta) + count += parseInt(counter.innerHTML); + counter.update(count); + if (count > 0) { + span.setStyle({ display: "inline" }); + span.up("SPAN").addClassName("unseen"); + } + else { + span.setStyle({ display: "none" }); + span.up("SPAN").removeClassName("unseen"); + } + } } function onMessageContextMenu(event) {