From 9efef95ec7cfb252c4295863dc488b16f8852179 Mon Sep 17 00:00:00 2001 From: helge Date: Wed, 13 Oct 2004 16:25:10 +0000 Subject: [PATCH] fixed a warning git-svn-id: http://svn.opengroupware.org/SOPE/trunk@250 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 5 ++ .../NGObjWeb/DynamicElements/WOInput.m | 47 ++++++++++--------- sope-appserver/NGObjWeb/Version | 2 +- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 8cae8af9..d85374f3 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,8 @@ +2004-10-13 Helge Hess + + * DynamicElements/WOInput.m: minor code cleanups, be tolerant on + missing value binding (previously printed a warning) (v4.3.65) + 2004-10-12 Helge Hess * v4.3.64 diff --git a/sope-appserver/NGObjWeb/DynamicElements/WOInput.m b/sope-appserver/NGObjWeb/DynamicElements/WOInput.m index 6f049b43..34cb2e13 100644 --- a/sope-appserver/NGObjWeb/DynamicElements/WOInput.m +++ b/sope-appserver/NGObjWeb/DynamicElements/WOInput.m @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include "WOInput.h" #include "WOElement+private.h" @@ -26,6 +25,8 @@ @implementation WOInput +static BOOL takeValueDebugOn = NO; + + (int)version { return [super version] + 0 /* v2 */; } @@ -75,7 +76,7 @@ NSString *OWFormElementName(WOInput *self, WOContext *_ctx) { if (self->name == nil) return [_ctx elementID]; - if ((name = [self->name stringValueInComponent:[_ctx component]])) + if ((name = [self->name stringValueInComponent:[_ctx component]]) != nil) return name; [[_ctx component] @@ -86,9 +87,10 @@ NSString *OWFormElementName(WOInput *self, WOContext *_ctx) { return [_ctx elementID]; } -// ******************** responder ******************** +/* taking form values */ - (id)parseFormValue:(id)_value inContext:(WOContext *)_ctx { + /* redefined in subclasses */ return _value; } @@ -100,35 +102,36 @@ NSString *OWFormElementName(WOInput *self, WOContext *_ctx) { return; formName = OWFormElementName(self, _ctx); + if ((formValue = [_req formValueForKey:formName]) == nil) + // TODO: is this correct? + return; - if ((formValue = [_req formValueForKey:formName])) { -#if DEBUG && 0 - NSLog(@"%s(%@): form=%@ ctx=%@ value=%@ ..", __PRETTY_FUNCTION__, - [_ctx elementID], formName, [_ctx contextID], formValue); -#endif - - if ([self->value isValueSettable]) { - formValue = [self parseFormValue:formValue inContext:_ctx]; - [self->value setStringValue:formValue inComponent:[_ctx component]]; - } -#if DEBUG - else { - NSLog(@"%s: form value is not settable: %@", __PRETTY_FUNCTION__, - self->value); - } -#endif + if (takeValueDebugOn) { + [self logWithFormat: + @"%s(%@): form=%@ ctx=%@ value=%@ ..", __PRETTY_FUNCTION__, + [_ctx elementID], formName, [_ctx contextID], formValue]; + } + + if ([self->value isValueSettable]) { + formValue = [self parseFormValue:formValue inContext:_ctx]; + [self->value setStringValue:formValue inComponent:[_ctx component]]; + } + else if (self->value != nil) { + [self logWithFormat: + @"%s: form value is not settable: %@", __PRETTY_FUNCTION__, + self->value]; } } /* description */ - (NSString *)associationDescription { - NSMutableString *str = [NSMutableString stringWithCapacity:128]; - + NSMutableString *str; + + str = [NSMutableString stringWithCapacity:128]; if (self->value) [str appendFormat:@" value=%@", self->value]; if (self->name) [str appendFormat:@" name=%@", self->name]; if (self->disabled) [str appendFormat:@" disabled=%@", self->disabled]; - return str; } diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 7fa3a4aa..57118e1b 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=64 +SUBMINOR_VERSION:=65 # v4.3.42 requires libNGExtensions v4.3.116 # v4.3.40 requires libNGExtensions v4.3.115 -- 2.39.5