]> err.no Git - sope/commitdiff
added support for href and direct actions in tab items
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Tue, 23 Nov 2004 22:31:55 +0000 (22:31 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Tue, 23 Nov 2004 22:31:55 +0000 (22:31 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@409 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-appserver/WEExtensions/ChangeLog
sope-appserver/WEExtensions/Version
sope-appserver/WEExtensions/WETabItem.m
sope-appserver/WEExtensions/WETabView.h

index 8b998d78da65fdc77c6b8227cce14e8fc9ee65aa..b0cfd5317b0b614e1e1bff7ef547f4c53a7e7733 100644 (file)
@@ -1,5 +1,7 @@
 2004-11-23  Helge Hess  <helge.hess@opengroupware.org>
-
+       
+       * WETabItem.[hm]: added support for href and direct actions (v4.5.64)
+       
        * v4.5.63
        
        * removed WEClientCapabilities.h (lives in NGObjWeb for quite some time          now)
index 645b0033f8950f99fd834a9346f6527653b302c2..c41a410afe17ef80110f2389ce30444bb7fee116 100644 (file)
@@ -1,3 +1,3 @@
 # version file
 
-SUBMINOR_VERSION:=63
+SUBMINOR_VERSION:=64
index 06a899d12fc8ddf0eb4cb42c83430583ad74560a..fbd499c66347e01ebc38de644af2e8017963ed3d 100644 (file)
@@ -18,7 +18,6 @@
   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.
 */
-// $Id$
 
 #include "WETabView.h"
 #include "common.h"
@@ -75,7 +74,11 @@ static NSString *retStrForInt(int i) {
     self->label    = WOExtGetProperty(_config, @"label");
     self->action   = WOExtGetProperty(_config, @"action");
     self->isScript = WOExtGetProperty(_config, @"isScript");
-
+    
+    self->href             = WOExtGetProperty(_config, @"href");
+    self->directActionName = WOExtGetProperty(_config, @"directActionName");
+    self->actionClass      = WOExtGetProperty(_config, @"actionClass");
+    
     self->tabIcon         = WOExtGetProperty(_config, @"tabIcon");
     self->leftTabIcon     = WOExtGetProperty(_config, @"leftTabIcon");
     self->selectedTabIcon = WOExtGetProperty(_config, @"selectedTabIcon");
@@ -92,24 +95,23 @@ static NSString *retStrForInt(int i) {
 }
 
 - (void)dealloc {
-  [self->action   release];
-  [self->label    release];
-  [self->icon     release];
-  [self->key      release];
-  [self->isScript release];
-  [self->template release];
-
-  [self->leftTabIcon     release];
-  [self->selectedTabIcon release];
-  [self->tabIcon         release];
-
-  [self->asBackground release];
-  [self->width        release];
-  [self->height       release];
-
-  [self->activeBgColor   release];
-  [self->inactiveBgColor release];
-  
+  [self->href             release];
+  [self->directActionName release];
+  [self->actionClass      release];
+  [self->action           release];
+  [self->label            release];
+  [self->icon             release];
+  [self->key              release];
+  [self->isScript         release];
+  [self->template         release];
+  [self->leftTabIcon      release];
+  [self->selectedTabIcon  release];
+  [self->tabIcon          release];
+  [self->asBackground     release];
+  [self->width            release];
+  [self->height           release];
+  [self->activeBgColor    release];
+  [self->inactiveBgColor  release];
   [super dealloc];
 }
 
@@ -194,6 +196,35 @@ static NSString *retStrForInt(int i) {
   return result;
 }
 
+/* URLs */
+
+- (NSString *)urlForTabItemInContext:(WOContext *)_ctx {
+  if (self->href != nil)
+    return [self->href stringValueInComponent:[_ctx component]];
+  
+  if (self->directActionName != nil || self->actionClass != nil) {
+    NSDictionary *qd = nil;
+    NSString *daClass = nil;
+    NSString *daName  = nil;
+    
+    daClass = [self->actionClass      stringValueInComponent:[_ctx component]];
+    daName  = [self->directActionName stringValueInComponent:[_ctx component]];
+
+    if (daClass != nil) {
+      if (daName != nil) {
+       if (![daClass isEqualToString:@"DirectAction"])
+         daName = [NSString stringWithFormat:@"%@/%@", daClass, daName];
+      }
+      else
+       daName = daClass;
+    }
+    
+    return [_ctx directActionURLForActionNamed:daName queryDictionary:qd];
+  }
+  
+  return [_ctx componentActionURL];
+}
+
 /* info collection */
 
 - (void)_collectInContext:(WOContext *)_ctx key:(NSString *)k {
@@ -220,11 +251,11 @@ static NSString *retStrForInt(int i) {
   
   info = [[WETabItemInfo alloc] init];
   info->key      = [k copy];
-  info->label    = [[self->label stringValueInComponent:cmp] copy];
-  info->icon     = [[self->icon  stringValueInComponent:cmp] copy];
-  info->uri      = [[_ctx componentActionURL] copy];
-  info->isScript = [self->isScript boolValueInComponent:cmp];
-  info->tabIcon  = [[self->tabIcon stringValueInComponent:cmp] copy];
+  info->uri      = [[self urlForTabItemInContext:_ctx] copy];
+  info->label    = [[self->label       stringValueInComponent:cmp] copy];
+  info->icon     = [[self->icon        stringValueInComponent:cmp] copy];
+  info->isScript = [self->isScript     boolValueInComponent:cmp];
+  info->tabIcon  = [[self->tabIcon     stringValueInComponent:cmp] copy];
   info->leftIcon = [[self->leftTabIcon stringValueInComponent:cmp] copy];
   info->selIcon  = [[self->selectedTabIcon stringValueInComponent:cmp]
                                            copy];
index c12ecc3dd20ecffd65b5e8b64d6fa448a7625c3f..0dc57e6d72d884d447b3a8e70f156fa74d5df2f0 100644 (file)
   WOAssociation *label;
   WOAssociation *action;
   WOAssociation *isScript;
-
+  WOAssociation *href;
+  WOAssociation *actionClass;
+  WOAssociation *directActionName;
+  
   /* config: */
   WOAssociation *tabIcon;
   WOAssociation *leftTabIcon;