From: wolfgang Date: Mon, 17 Sep 2007 04:12:00 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1176 d1b88da0-ebda-0310... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8d6cc0449770984e50a84550d277cf4d007a260;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1176 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/ChangeLog b/ChangeLog index d879621d..613a3afc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2007-09-16 Wolfgang Sourdeau + + * SoObjects/Contacts/SOGoContactGCSFolder.m ([SOGoContactGCSFolder + -compare:otherFolder]): new overriden method that compares two + contact foldes based on their class and then transfer the control + to the super method in SOGoFolder. + + * SoObjects/Contacts/SOGoContactLDAPFolder.m + ([SOGoContactLDAPFolder -compare:otherFolder]): new method that + compare two contact folders based on their class and then their + display name. + + * SoObjects/SOGo/SOGoFolder.m ([SOGoFolder -compare:otherFolder]): + new method for sorting folders. The folders are compared based on + their ownership, whether they are a main folder and finally + depending on their display name. + + * SoObjects/SOGo/SOGoObject.m ([SOGoObject + -pathArrayToSOGoObject]): do not reorder the paths if the third + element is an instance of NSNull. + + * SoObjects/SOGo/SOGoParentFolder.m ([SOGoParentFolder + -subFolders]): returns a sorted array using the "compare:" + selector. + 2007-09-14 Wolfgang Sourdeau * UI/Scheduler/UIxCalendarSelector.m ([UIxCalendarSelector diff --git a/SoObjects/Contacts/SOGoContactGCSFolder.m b/SoObjects/Contacts/SOGoContactGCSFolder.m index e00e9674..b8856acd 100644 --- a/SoObjects/Contacts/SOGoContactGCSFolder.m +++ b/SoObjects/Contacts/SOGoContactGCSFolder.m @@ -251,6 +251,20 @@ // return r; // } +/* sorting */ +- (NSComparisonResult) compare: (id) otherFolder +{ + NSComparisonResult comparison; + + if ([NSStringFromClass([otherFolder class]) + isEqualToString: @"SOGoContactLDAPFolder"]) + comparison = NSOrderedAscending; + else + comparison = [super compare: otherFolder]; + + return comparison; +} + /* folder type */ - (NSString *) folderType diff --git a/SoObjects/Contacts/SOGoContactLDAPFolder.m b/SoObjects/Contacts/SOGoContactLDAPFolder.m index 459f2998..5f1ad9ec 100644 --- a/SoObjects/Contacts/SOGoContactLDAPFolder.m +++ b/SoObjects/Contacts/SOGoContactLDAPFolder.m @@ -256,6 +256,22 @@ return YES; } +/* sorting */ +- (NSComparisonResult) compare: (id) otherFolder +{ + NSComparisonResult comparison; + + if ([NSStringFromClass([otherFolder class]) + isEqualToString: @"SOGoContactGCSFolder"]) + comparison = NSOrderedDescending; + else + comparison + = [[self displayName] + localizedCaseInsensitiveCompare: [otherFolder displayName]]; + + return comparison; +} + /* acls */ - (NSString *) ownerInContext: (WOContext *) noContext { diff --git a/SoObjects/SOGo/SOGoFolder.h b/SoObjects/SOGo/SOGoFolder.h index ccca8e7d..c0b492e9 100644 --- a/SoObjects/SOGo/SOGoFolder.h +++ b/SoObjects/SOGo/SOGoFolder.h @@ -78,6 +78,9 @@ - (BOOL) folderIsMandatory; - (NSString *) folderType; +/* sorting */ +- (NSComparisonResult) compare: (SOGoFolder *) otherFolder; + - (BOOL) create; - (NSException *) delete; - (void) renameTo: (NSString *) newName; diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index e0845f82..9341e848 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -685,6 +685,77 @@ static NSString *defaultUserID = @""; return obj; } +- (NSComparisonResult) _compareByOrigin: (SOGoFolder *) otherFolder +{ + NSArray *thisElements, *otherElements; + unsigned thisCount, otherCount; + NSComparisonResult comparison; + + thisElements = [nameInContainer componentsSeparatedByString: @"_"]; + otherElements = [[otherFolder nameInContainer] + componentsSeparatedByString: @"_"]; + thisCount = [thisElements count]; + otherCount = [otherElements count]; + if (thisCount == otherCount) + { + if (thisCount == 1) + comparison = NSOrderedSame; + else + comparison = [[thisElements objectAtIndex: 0] + compare: [otherElements objectAtIndex: 0]]; + } + else + { + if (thisCount > otherCount) + comparison = NSOrderedDescending; + else + comparison = NSOrderedAscending; + } + + return comparison; +} + +- (NSComparisonResult) _compareByNameInContainer: (SOGoFolder *) otherFolder +{ + NSString *otherName; + NSComparisonResult comparison; + + otherName = [otherFolder nameInContainer]; + if ([nameInContainer hasSuffix: @"personal"]) + { + if ([otherName hasSuffix: @"personal"]) + comparison = [nameInContainer compare: otherName]; + else + comparison = NSOrderedAscending; + } + else + { + if ([otherName hasSuffix: @"personal"]) + comparison = NSOrderedDescending; + else + comparison = NSOrderedSame; + } + + return comparison; +} + +- (NSComparisonResult) compare: (SOGoFolder *) otherFolder +{ + NSComparisonResult comparison; + + comparison = [self _compareByOrigin: otherFolder]; + if (comparison == NSOrderedSame) + { + comparison = [self _compareByNameInContainer: otherFolder]; + if (comparison == NSOrderedSame) + comparison + = [[self displayName] + localizedCaseInsensitiveCompare: [otherFolder displayName]]; + } + + return comparison; +} + /* WebDAV */ - (NSArray *) davNamespaces diff --git a/SoObjects/SOGo/SOGoObject.m b/SoObjects/SOGo/SOGoObject.m index 31a6b6ce..abb9acb1 100644 --- a/SoObjects/SOGo/SOGoObject.m +++ b/SoObjects/SOGo/SOGoObject.m @@ -492,13 +492,16 @@ static BOOL kontactGroupDAV = YES; if ([realPathArray count] > 2) { objectName = [realPathArray objectAtIndex: 2]; - objectDescription = [objectName componentsSeparatedByString: @"_"]; - if ([objectDescription count] > 1) + if ([objectName isKindOfClass: [NSString class]]) { - [realPathArray replaceObjectAtIndex: 0 - withObject: [objectDescription objectAtIndex: 0]]; - [realPathArray replaceObjectAtIndex: 2 - withObject: [objectDescription objectAtIndex: 1]]; + objectDescription = [objectName componentsSeparatedByString: @"_"]; + if ([objectDescription count] > 1) + { + [realPathArray replaceObjectAtIndex: 0 + withObject: [objectDescription objectAtIndex: 0]]; + [realPathArray replaceObjectAtIndex: 2 + withObject: [objectDescription objectAtIndex: 1]]; + } } } diff --git a/SoObjects/SOGo/SOGoParentFolder.m b/SoObjects/SOGo/SOGoParentFolder.m index 6bdf0f78..37604a35 100644 --- a/SoObjects/SOGo/SOGoParentFolder.m +++ b/SoObjects/SOGo/SOGoParentFolder.m @@ -263,7 +263,8 @@ if (!subFolders) [self initSubFolders]; - return [subFolders allValues]; + return [[subFolders allValues] + sortedArrayUsingSelector: @selector (compare:)]; } /* acls */ diff --git a/UI/WebServerResources/UIxCalUserRightsEditor.css b/UI/WebServerResources/UIxCalUserRightsEditor.css index 3e7b6991..eb31488b 100644 --- a/UI/WebServerResources/UIxCalUserRightsEditor.css +++ b/UI/WebServerResources/UIxCalUserRightsEditor.css @@ -17,15 +17,10 @@ DIV.calendarUserRights DIV.calendarUserRights > TABLE { background-color: #fff; - width: 45em; + width: 480px; color: #999; border-collapse: collapse; - border-bottom: 1px solid #fff; - border-right: 1px solid #fff; - border-top: 2px solid #222; - border-left: 2px solid #222; - -moz-border-top-colors: #9c9a94 #000 transparent; - -moz-border-left-colors: #9c9a94 #000 transparent; } + border: 1px solid #222; } DIV.calendarUserRights > TABLE TR.permissions TH { color: #00f; @@ -33,11 +28,10 @@ DIV.calendarUserRights > TABLE TR.permissions TH */ border-bottom: 1px solid #999; } DIV.calendarUserRights > TABLE TH -{ width: 15em; } +{ width: 70px; } DIV.calendarUserRights > TABLE TD.eventType -{ width: 5em; - text-align: right; +{ text-align: right; border-right: 1px solid #999; } DIV.calendarUserRights > TABLE TD