From 065a544f08a1e719b07100141a49c2655844a8e6 Mon Sep 17 00:00:00 2001 From: helge Date: Thu, 26 Aug 2004 12:38:50 +0000 Subject: [PATCH] added an ivar to WOComponent, minor cleanups git-svn-id: http://svn.opengroupware.org/SOPE/trunk@59 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 10 ++++++ .../NGObjWeb/DynamicElements/WOBody.m | 26 +++++++-------- .../NGObjWeb/DynamicElements/WOHtml.m | 32 +++++++++---------- .../NGObjWeb/NGObjWeb/WOComponent.h | 1 + sope-appserver/NGObjWeb/TODO | 2 +- sope-appserver/NGObjWeb/Version | 2 +- sope-appserver/NGObjWeb/WOApplication.m | 1 - sope-appserver/NGObjWeb/WOComponent.m | 4 +-- sope-appserver/NGObjWeb/WOContext.m | 10 +++--- sope-appserver/NGObjWeb/WODynamicElement.m | 4 +-- 10 files changed, 49 insertions(+), 43 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index b555a397..32eef602 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,13 @@ +2004-08-26 Helge Hess + + * v4.3.14 + + * WOComponent.m, WOContext.m: added ivar for _ODCycleCtx, _without_ + increasing class version (so that we don't need to touch every + component in OGo :-| ) + + * DynamicElements/WOHtml.m, WOBody.m: minor code cleanups + 2004-08-25 Helge Hess * v4.3.13 diff --git a/sope-appserver/NGObjWeb/DynamicElements/WOBody.m b/sope-appserver/NGObjWeb/DynamicElements/WOBody.m index bd0473c9..11b81006 100644 --- a/sope-appserver/NGObjWeb/DynamicElements/WOBody.m +++ b/sope-appserver/NGObjWeb/DynamicElements/WOBody.m @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include "WOElement+private.h" #include "WOHTMLDynamicElement.h" @@ -55,31 +54,29 @@ self->src = OWGetProperty(_config, @"src"); self->value = OWGetProperty(_config, @"value"); - self->template = RETAIN(_c); + self->template = [_c retain]; if (self->value) NSLog(@"WARNING: value not yet supported !"); } return self; } -#if !LIB_FOUNDATION_BOEHM_GC - (void)dealloc { - RELEASE(self->template); - RELEASE(self->framework); - RELEASE(self->filename); - RELEASE(self->src); - RELEASE(self->value); + [self->template release]; + [self->framework release]; + [self->filename release]; + [self->src release]; + [self->value release]; [super dealloc]; } -#endif -// accessors +/* accessors */ - (WOElement *)template { return self->template; } -// ******************** responder ******************** +/* handling requests */ - (void)takeValuesFromRequest:(WORequest *)_req inContext:(WOContext *)_ctx { [self->template takeValuesFromRequest:_req inContext:_ctx]; @@ -88,6 +85,8 @@ return [self->template invokeActionForRequest:_req inContext:_ctx]; } +/* generating response */ + - (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx { NSString *uUri; NSString *uFi; @@ -162,8 +161,9 @@ /* description */ - (NSString *)associationDescription { - NSMutableString *str = [NSMutableString stringWithCapacity:128]; - + NSMutableString *str; + + str = [NSMutableString stringWithCapacity:128]; if (self->filename) [str appendFormat:@" filename=%@", self->filename]; if (self->framework) [str appendFormat:@" framework=%@", self->framework]; if (self->src) [str appendFormat:@" src=%@", self->src]; diff --git a/sope-appserver/NGObjWeb/DynamicElements/WOHtml.m b/sope-appserver/NGObjWeb/DynamicElements/WOHtml.m index 183b6718..b0fcdfed 100644 --- a/sope-appserver/NGObjWeb/DynamicElements/WOHtml.m +++ b/sope-appserver/NGObjWeb/DynamicElements/WOHtml.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,13 +18,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ -#include "WOElement+private.h" #include "WOHTMLDynamicElement.h" -#include -#include -#include "common.h" @class WOAssociation; @@ -37,6 +32,11 @@ } @end +#include "WOElement+private.h" +#include +#include +#include "common.h" + @implementation WOHtml - (id)initWithName:(NSString *)_name @@ -44,25 +44,23 @@ template:(WOElement *)_c { if ((self = [super initWithName:_name associations:_config template:_c])) { - self->template = RETAIN(_c); + self->template = [_c retain]; } return self; } -#if !LIB_FOUNDATION_BOEHM_GC - (void)dealloc { - RELEASE(self->template); + [self->template release]; [super dealloc]; } -#endif -// accessors +/* accessors */ - (WOElement *)template { return self->template; } -// ******************** responder ******************** +/* handling requests */ - (void)takeValuesFromRequest:(WORequest *)_req inContext:(WOContext *)_ctx { [self->template takeValuesFromRequest:_req inContext:_ctx]; @@ -71,6 +69,8 @@ return [self->template invokeActionForRequest:_req inContext:_ctx]; } +/* generating response */ + - (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx { if ([[_ctx request] isFromClientComponent]) { [self->template appendToResponse:_response inContext:_ctx]; @@ -78,19 +78,17 @@ } WOResponse_AddCString(_response, ""); - [self->template appendToResponse:_response inContext:_ctx]; - WOResponse_AddCString(_response, ""); } /* description */ - (NSString *)associationDescription { - NSMutableString *str = [NSMutableString stringWithCapacity:128]; + NSMutableString *str; + str = [NSMutableString stringWithCapacity:128]; if (self->template) [str appendFormat:@" template=%@", self->template]; - return str; } diff --git a/sope-appserver/NGObjWeb/NGObjWeb/WOComponent.h b/sope-appserver/NGObjWeb/NGObjWeb/WOComponent.h index 17bb9e4d..bcdf6953 100644 --- a/sope-appserver/NGObjWeb/NGObjWeb/WOComponent.h +++ b/sope-appserver/NGObjWeb/NGObjWeb/WOComponent.h @@ -50,6 +50,7 @@ WOSession *session; NSURL *wocBaseURL; + id cycleContext; // was: _ODCycleCtx } - (id)initWithContext:(WOContext *)_ctx; diff --git a/sope-appserver/NGObjWeb/TODO b/sope-appserver/NGObjWeb/TODO index 1a6764ac..092706e6 100644 --- a/sope-appserver/NGObjWeb/TODO +++ b/sope-appserver/NGObjWeb/TODO @@ -31,7 +31,7 @@ currently stored in extended attributes or userInfo: - WORequestStartDate [done: startDate] - WORequestStartProcStatistics [done: startStatistics] - WOComponent: - - _ODCycleCtx (used for cursor) TODO: isn't that a WOComponent ivar? + - _ODCycleCtx (used for cursor) [done] TODO: isn't that a WOContext ivar? => needs to be documented and explained first - component definition during init (currently wosVariables) - WOContext diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 955909db..9e39bed6 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=12 +SUBMINOR_VERSION:=14 # v4.2.413 requires libSaxObjC v4.2.33 # v4.2.341 requires libNGExtensions v4.2.77 diff --git a/sope-appserver/NGObjWeb/WOApplication.m b/sope-appserver/NGObjWeb/WOApplication.m index 64dc6924..6f98a42e 100644 --- a/sope-appserver/NGObjWeb/WOApplication.m +++ b/sope-appserver/NGObjWeb/WOApplication.m @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id: WOApplication.m 1 2004-08-20 10:08:27Z znek $ #include #include "WOContext+private.h" diff --git a/sope-appserver/NGObjWeb/WOComponent.m b/sope-appserver/NGObjWeb/WOComponent.m index c83c66f9..b81edcd1 100644 --- a/sope-appserver/NGObjWeb/WOComponent.m +++ b/sope-appserver/NGObjWeb/WOComponent.m @@ -62,7 +62,7 @@ static BOOL abortOnMissingCtx = NO; static BOOL wakeupPageOnCreation = NO; + (int)version { - // TODO: is really v3 for baseURL ivar change + // TODO: is really v4 for baseURL/cycleContext ivar changes return [super version] + 0 /* v2 */; } + (void)initialize { @@ -793,7 +793,7 @@ static inline id _getExtraVar(WOComponent *self, NSString *_key) { if (parent == nil) return nil; if (action == NULL) return nil; - + NSAssert(parent != self, @"parent component equals current component"); if (![parent respondsToSelector:action]) { diff --git a/sope-appserver/NGObjWeb/WOContext.m b/sope-appserver/NGObjWeb/WOContext.m index d5403214..f6b07745 100644 --- a/sope-appserver/NGObjWeb/WOContext.m +++ b/sope-appserver/NGObjWeb/WOContext.m @@ -1000,10 +1000,8 @@ void WOContext_leaveComponent(WOContext *self, WOComponent *_component) { if (debugCursor) [self logWithFormat:@"enter cursor: %@", _obj]; - if ((ctxStack = [self objectForKey:@"_ODCycleCtx"]) == nil) { - ctxStack = [NSMutableArray arrayWithCapacity:8]; - [self setObject:ctxStack forKey:@"_ODCycleCtx"]; - } + if ((ctxStack = self->cycleContext) == nil) + self->cycleContext = [[NSMutableArray alloc] initWithCapacity:8]; /* add to cursor stack */ [ctxStack addObject:(_obj ? _obj : [NSNull null])]; @@ -1022,7 +1020,7 @@ void WOContext_leaveComponent(WOContext *self, WOComponent *_component) { [self setObject:nil forKey:@"_"]; /* restore old ctx */ - if ((ctxStack = [self objectForKey:@"_ODCycleCtx"])) { + if ((ctxStack = self->cycleContext) != nil) { unsigned count; if ((count = [ctxStack count]) > 0) { @@ -1058,7 +1056,7 @@ void WOContext_leaveComponent(WOContext *self, WOComponent *_component) { // TODO: why do we check for _ODCycleCtx, if we query '_' ? - if ((ctxStack = [self objectForKey:@"_ODCycleCtx"]) == nil) + if ((ctxStack = self->cycleContext) == nil) /* no cycle context setup for component ... */ return self; if ([ctxStack count] == 0) diff --git a/sope-appserver/NGObjWeb/WODynamicElement.m b/sope-appserver/NGObjWeb/WODynamicElement.m index 1141b0a2..395a354f 100644 --- a/sope-appserver/NGObjWeb/WODynamicElement.m +++ b/sope-appserver/NGObjWeb/WODynamicElement.m @@ -117,7 +117,7 @@ static Class FormElementClass = Nil; [self->otherTagString release]; - if ((ea = self->extraAttributes)) { // GC + if ((ea = self->extraAttributes) != nil) { // GC register unsigned short i; [ea->extraString release]; @@ -145,7 +145,7 @@ static Class FormElementClass = Nil; NSEnumerator *ke; NSString *key; NSMutableString *es; - + if ([_extras count] == 0) /* no extra attributes ... */ return; -- 2.39.5