From: helge Date: Tue, 28 Sep 2004 11:41:57 +0000 (+0000) Subject: added support for component-action less wetreeview X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=038d6c91cb68bb8f972471e35d77ddb16f8df7ae;p=sope added support for component-action less wetreeview git-svn-id: http://svn.opengroupware.org/SOPE/trunk@180 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-appserver/WEExtensions/ChangeLog b/sope-appserver/WEExtensions/ChangeLog index 99ae7705..42eff02f 100644 --- a/sope-appserver/WEExtensions/ChangeLog +++ b/sope-appserver/WEExtensions/ChangeLog @@ -1,3 +1,9 @@ +2004-09-28 Helge Hess + + * WETreeData.m: added new 'treeLink' association which can be used to + override the componentActionURL used for expand/collapse and therfore + allow for session less tree generation (v4.3.59) + 2004-09-21 Marcus Mueller * WEExtensions.xcode: Fixed dependencies to resemble the make process diff --git a/sope-appserver/WEExtensions/Version b/sope-appserver/WEExtensions/Version index 296d4b3c..de3d3ecd 100644 --- a/sope-appserver/WEExtensions/Version +++ b/sope-appserver/WEExtensions/Version @@ -1,3 +1,3 @@ -# $Id$ +# version file -SUBMINOR_VERSION:=58 +SUBMINOR_VERSION:=59 diff --git a/sope-appserver/WEExtensions/WETreeData.m b/sope-appserver/WEExtensions/WETreeData.m index 4adb50a0..1e2d1e87 100644 --- a/sope-appserver/WEExtensions/WETreeData.m +++ b/sope-appserver/WEExtensions/WETreeData.m @@ -30,6 +30,7 @@ cornerIcon title string + treeLink (do not generate a -componentActionURL but use the specified link) Example: TreeDataCell: WETreeData { @@ -55,6 +56,7 @@ WOAssociation *string; WOAssociation *icon; WOAssociation *cornerIcon; + WOAssociation *treeLink; BOOL doTable; WOElement *template; @@ -84,6 +86,7 @@ static Class StrClass = Nil; self->cornerIcon = WOExtGetProperty(_config, @"cornerIcon"); self->title = WOExtGetProperty(_config, @"title"); self->string = WOExtGetProperty(_config, @"string"); + self->treeLink = WOExtGetProperty(_config, @"treeLink"); self->template = [_root retain]; } @@ -92,6 +95,7 @@ static Class StrClass = Nil; - (void)dealloc { [self->isTreeElement release]; + [self->treeLink release]; [self->icon release]; [self->cornerIcon release]; [self->title release]; @@ -130,11 +134,13 @@ static Class StrClass = Nil; - (void)_appendLink:(NSString *)_icon resp:(WOResponse *)_response ctx:(WOContext *)_ctx { - BOOL doForm = [_ctx isInForm]; - + BOOL doForm; + + // doForm = [_ctx isInForm]; doForm = NO; if (doForm) { + // TODO: we might want to support an assoc to provide the name [_response appendContentString:@""]; } else { + NSString *link; + [_ctx appendElementIDComponent:WETreeView_ZOOM_ACTION_ID]; - [_response appendContentString:@""]; + + link = (self->treeLink != nil) + ? [self->treeLink stringValueInComponent:[_ctx component]] + : [_ctx componentActionURL]; + + if ([link length] > 0) { + [_response appendContentString:@""]; + } [self _appendIcon:_icon alt:@"z" toResponse:_response inContext:_ctx]; - [_response appendContentString:@""]; + if ([link length] > 0) + [_response appendContentString:@""]; + [_ctx deleteLastElementIDComponent]; } } @@ -159,13 +176,24 @@ static Class StrClass = Nil; { BOOL doLink; NSString *img; + NSString *link; + + // TODO: we need to patch this for stateless operation + link = nil; doLink = (_key == WETreeView_Plus || _key == WETreeView_CornerPlus || _key == WETreeView_Minus || _key == WETreeView_CornerMinus); + if (doLink) { + if (self->treeLink) { + link = [self->treeLink stringValueInComponent:[_ctx component]]; + if (link == nil) + doLink = NO; + } + } + + img = [_ctx objectForKey:_key]; + img = WEUriOfResource(img, _ctx); - img = [_ctx objectForKey:_key]; - img = WEUriOfResource(img, _ctx); - if (_key == WETreeView_Leaf) { NSString *tmp = [self->icon stringValueInComponent:[_ctx component]]; @@ -182,16 +210,16 @@ static Class StrClass = Nil; if (doLink) { [_ctx appendElementIDComponent:WETreeView_ZOOM_ACTION_ID]; [_response appendContentString:@""]; if (_key == WETreeView_Plus || _key == WETreeView_CornerPlus) [_response appendContentString:@"[+]"]; else if (_key == WETreeView_Minus || _key == WETreeView_CornerMinus) [_response appendContentString:@"[-]"]; - + [_response appendContentString:@""]; - [_ctx deleteLastElementIDComponent]; + [_ctx deleteLastElementIDComponent]; /* WETreeView_ZOOM_ACTION_ID */ } else if (_key == WETreeView_Leaf) [_response appendContentString:@"-- "]; @@ -215,10 +243,14 @@ static Class StrClass = Nil; } - (void)appendHeader:(WOResponse *)_response inContext:(WOContext *)_ctx { - WOComponent *cmp = [_ctx component]; - NSString *tmp = [self->title stringValueInComponent:cmp]; - BOOL isTree = [self->isTreeElement boolValueInComponent:cmp];; - + WOComponent *cmp; + NSString *tmp; + BOOL isTree; + + cmp = [_ctx component]; + tmp = [self->title stringValueInComponent:cmp]; + isTree = [self->isTreeElement boolValueInComponent:cmp];; + if (tmp == nil) return; @@ -231,10 +263,10 @@ static Class StrClass = Nil; [_ctx component]]]; } if (isTree) { - [_response appendContentString:@" colspan=\""]; - [_response appendContentString: + [_response appendContentString:@" colspan=\""]; + [_response appendContentString: [[_ctx objectForKey:WETreeView_HEADER_MODE] stringValue]]; - [_response appendContentString:@"\">"]; + [_response appendContentString:@"\">"]; } else [_response appendContentString:@">"]; diff --git a/sope-appserver/samples/WOxExtTest/TreeView.m b/sope-appserver/samples/WOxExtTest/TreeView.m index 2040543c..f5993bc6 100644 --- a/sope-appserver/samples/WOxExtTest/TreeView.m +++ b/sope-appserver/samples/WOxExtTest/TreeView.m @@ -1,7 +1,7 @@ /* - Copyright (C) 2000-2003 SKYRIX Software AG + Copyright (C) 2000-2004 SKYRIX Software AG - This file is part of OGo + This file is part of OpenGroupware.org. OGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include diff --git a/sope-appserver/samples/WOxExtTest/TreeView.wox b/sope-appserver/samples/WOxExtTest/TreeView.wox index 429b5716..808031eb 100644 --- a/sope-appserver/samples/WOxExtTest/TreeView.wox +++ b/sope-appserver/samples/WOxExtTest/TreeView.wox @@ -30,7 +30,8 @@ - + tree cell