]> err.no Git - sope/commitdiff
improved keypath handling in sortkeys
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Sat, 30 Sep 2006 16:37:54 +0000 (16:37 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Sat, 30 Sep 2006 16:37:54 +0000 (16:37 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1367 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-appserver/WEExtensions/ChangeLog
sope-appserver/WEExtensions/Version
sope-appserver/WEExtensions/WETableView/WETableCell.m
sope-appserver/WEExtensions/WETableView/WETableData.m

index 51fd5bb0fc603d624468254c6a70ea9325ee7dbc..4d336f7859e39e2cbc99d643506386fc14def5c6 100644 (file)
@@ -1,3 +1,8 @@
+2006-09-30  Helge Hess  <helge.hess@opengroupware.org>
+
+       * WETableView/WETableCell.m: improved sortkey handling for keypathes
+         (v4.5.91)
+
 2006-08-17  Wolfgang Sourdeau  <WSourdeau@Inverse.CA>
 
        * WECalendarField.m: do not use "<!--" in <style> tags, those comments
index 67c5dd5d8d96acd949b8c8e6695cffaa6104bf8d..9f6b1a6d078ab93395cbefa24c60dd550fd0c14a 100644 (file)
@@ -1,6 +1,6 @@
 # version file
 
-SUBMINOR_VERSION:=90
+SUBMINOR_VERSION:=91
 
 # v4.5.76 requires libNGObjWeb v4.5.176
 # v4.5.75 requires libNGObjWeb v4.5.174
index 7d1a2d54f1c214e8239421e224a4fe123662f36b..c31c4359756317c679c92a85fa02217ae1e7bc56 100644 (file)
@@ -88,6 +88,9 @@ static NSNumber *NoNumber  = nil;
   if (sk == nil)
     return;
   
+  if ([sk rangeOfString:@"."].length > 0)
+    sk = [sk stringByReplacingString:@"." withString:@"_"];
+  
   if (![sk isEqualToString:sortedKey])
     sortDir = 0;
   else if ( [_ctx objectForKey:WETableView_ISDESCENDING] == nil ||
@@ -121,7 +124,7 @@ static NSNumber *NoNumber  = nil;
   if (icon == nil)
     return;
 #endif
-
+  
   // append something like that: sort.name.down
   [_ctx appendElementIDComponent:@"sort"];
   [_ctx appendElementIDComponent:sk];     // remember sortKey
@@ -202,7 +205,7 @@ static NSNumber *NoNumber  = nil;
     [self->template takeValuesFromRequest:_req inContext:_ctx];
 }
 
-- (id)invokeActionForRequest:(WORequest *)_request inContext:(WOContext *)_ctx {
+- (id)invokeActionForRequest:(WORequest *)_rq inContext:(WOContext *)_ctx {
   WOComponent *cmp   = nil;
   NSString    *k, *tmp;
   BOOL        doNegate;
@@ -210,12 +213,16 @@ static NSNumber *NoNumber  = nil;
   cmp = [_ctx component];
   k   = [self->sortKey stringValueInComponent:cmp];
   if (!([[_ctx currentElementID] isEqual:@"sort"] && k != nil))
-    return [self->template invokeActionForRequest:_request inContext:_ctx];
-    
+    return [self->template invokeActionForRequest:_rq inContext:_ctx];
+  
   [_ctx consumeElementID];                 // consume "sort"
   [_ctx appendElementIDComponent:@"sort"]; // append  "sort"
   
+  if ([k rangeOfString:@"."].length > 0)
+    k = [k stringByReplacingString:@"." withString:@"_"];
+  
   tmp = [_ctx currentElementID];
+
   if (!(tmp != nil && [tmp isEqualToString:k])) {
     [_ctx deleteLastElementIDComponent]; // 'sort'
     return nil;
index a6eaad05146467883bc547f4ff574a3bb31c3db1..530f7eeee02ca4449d9e025aab471b4f2e09803d 100644 (file)
     self->title   = WOExtGetProperty(_config, @"title");
     self->align   = WOExtGetProperty(_config, @"align");
     self->valign  = WOExtGetProperty(_config, @"valign");
-    if (self->valign == nil) {
-      self->valign = [WOAssociation associationWithValue:@"TOP"];
-      RETAIN(self->valign);
-    }
+    if (self->valign == nil)
+      self->valign = [[WOAssociation associationWithValue:@"TOP"] retain];
   }
   return self;
 }
   /* cluster */
   if (([_config objectForKey:@"string"] != nil) ||
       ([_config objectForKey:@"value"] != nil)) {
-    RELEASE(self);
+    [self release];
     return [[_WEComplexTableData alloc] _initWithName:_name
                                         associations:_config
                                         template:_c];
   }
-  else
-    return [self _initWithName:_name associations:_config template:_c];
+
+  return [self _initWithName:_name associations:_config template:_c];
 }
 
 - (void)dealloc {
-  RELEASE(self->title);
-  RELEASE(self->isGroup);
-  RELEASE(self->align);
-  RELEASE(self->valign);
+  [self->title   release];
+  [self->isGroup release];
+  [self->align   release];
+  [self->valign  release];
   [super dealloc];
 }
 
   key       = [self->sortKey valueInComponent:cmp];
   sortedKey = [_ctx objectForKey:WETableView_SORTEDKEY];
 
-
+  
   if (infos == nil) {
-    infos = [NSMutableArray array];
+    infos = [NSMutableArray arrayWithCapacity:4];
     [_ctx setObject:infos forKey:WETableView_INFOS];
   }
-  info = [[WETableViewInfo allocWithZone:[self zone]] init];
+  info = [[WETableViewInfo alloc] init];
   info->rowSpan  = 1;
   info->isGroup  = [self->isGroup boolValueInComponent:cmp];
   info->isSorted = (key != nil && sortedKey != nil && [key isEqual:sortedKey]);
 
   [infos addObject:info];
-  AUTORELEASE(info);
+  [info release]; info = nil;
 }
 
 - (void)_appendHeader:(WOResponse *)_response inContext:(WOContext *)_ctx {
       if (self->formatter    != nil) num++;
       if (self->numberformat != nil) num++;
       if (self->dateformat   != nil) num++;
-      if (num > 1)
-        NSLog(@"WARNING: more than one formats specified in element %@", self);
+      if (num > 1) {
+        [self warnWithFormat:
+               @"more than one formats specified in element: %@", self];
+      }
     }
   }
   return self;