+2007-09-16 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * 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 <wsourdeau@inverse.ca>
* UI/Scheduler/UIxCalendarSelector.m ([UIxCalendarSelector
// 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
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
{
- (BOOL) folderIsMandatory;
- (NSString *) folderType;
+/* sorting */
+- (NSComparisonResult) compare: (SOGoFolder *) otherFolder;
+
- (BOOL) create;
- (NSException *) delete;
- (void) renameTo: (NSString *) newName;
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
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]];
+ }
}
}
if (!subFolders)
[self initSubFolders];
- return [subFolders allValues];
+ return [[subFolders allValues]
+ sortedArrayUsingSelector: @selector (compare:)];
}
/* acls */
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;
*/ 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