]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1176 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 17 Sep 2007 04:12:00 +0000 (04:12 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 17 Sep 2007 04:12:00 +0000 (04:12 +0000)
ChangeLog
SoObjects/Contacts/SOGoContactGCSFolder.m
SoObjects/Contacts/SOGoContactLDAPFolder.m
SoObjects/SOGo/SOGoFolder.h
SoObjects/SOGo/SOGoFolder.m
SoObjects/SOGo/SOGoObject.m
SoObjects/SOGo/SOGoParentFolder.m
UI/WebServerResources/UIxCalUserRightsEditor.css

index d879621d3d744018c797a4ff91eb6b9f30b13868..613a3afc63c95e49310732c3799f08c26d73d722 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+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
index e00e9674992cf3fba3f42ca299eff5c280bb1bb8..b8856acd973a8bc0ce89ec396594e43364b17e91 100644 (file)
 //   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
index 459f2998eb8512021ae5b1e7f4f5ed73f9170d08..5f1ad9ecbace020ad1343e09b656ab61e088efd2 100644 (file)
   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
 {
index ccca8e7d7f095bf9174cd2db2adb0e81a81f7c03..c0b492e98a2c7905d96b3c186809cdd7e72fb30c 100644 (file)
@@ -78,6 +78,9 @@
 - (BOOL) folderIsMandatory;
 - (NSString *) folderType;
 
+/* sorting */
+- (NSComparisonResult) compare: (SOGoFolder *) otherFolder;
+
 - (BOOL) create;
 - (NSException *) delete;
 - (void) renameTo: (NSString *) newName;
index e0845f826cb9d546f09745bdaf30fac44d7b6427..9341e848822ca88980c658eb4e42a9e6457804ce 100644 (file)
@@ -685,6 +685,77 @@ static NSString *defaultUserID = @"<default>";
   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
index 31a6b6ce6e9ab4f304df2d436e5322ff65964643..abb9acb1f9641ccad2538bd8e470716220555f09 100644 (file)
@@ -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]];
+           }
        }
     }
 
index 6bdf0f783dd0eaf6809d33342fa97f1c6b5e55b9..37604a352797619d8566a65f3cdd1f685ed0d16e 100644 (file)
   if (!subFolders)
     [self initSubFolders];
 
-  return [subFolders allValues];
+  return [[subFolders allValues]
+          sortedArrayUsingSelector: @selector (compare:)];
 }
 
 /* acls */
index 3e7b6991bc56e2530abd68afa4c19bd055a0ecd9..eb31488b45e9c673de45396f4d42451db05c78a6 100644 (file)
@@ -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