Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#include "WETabView.h"
#include "common.h"
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");
}
- (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];
}
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 {
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];