From d6593dc63e21a514640dd9c48f5bbea878af1116 Mon Sep 17 00:00:00 2001 From: helge Date: Sun, 13 Nov 2005 19:05:10 +0000 Subject: [PATCH] changes to DA request handling added radio-button issue comments git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1174 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 11 ++++++ .../NGObjWeb/DynamicElements/WORadioButton.m | 18 ++++++++- sope-appserver/NGObjWeb/Version | 2 +- sope-appserver/NGObjWeb/WOApplication.m | 2 +- sope-appserver/NGObjWeb/WOSession.m | 37 +++++++++++++++++-- 5 files changed, 63 insertions(+), 7 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 5a91c5d1..a3f44cf4 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,14 @@ +2005-11-13 Helge Hess + + * DynamicElements/WORadioButton.m: added some comments and a warning + about issues wrt request handling (v4.5.211) + +2005-11-01 Helge Hess + + * WOSession.m ([WOSession -takeValuesFromRequest:inContext:]): changed + handling of -takeValues in combination with directaction components + (v4.5.210) + 2005-10-16 Jean-Alexis Montignies * DynamicElements/WOSwitchComponent.m: properly consume element-id diff --git a/sope-appserver/NGObjWeb/DynamicElements/WORadioButton.m b/sope-appserver/NGObjWeb/DynamicElements/WORadioButton.m index c1e22ec9..a514d2bf 100644 --- a/sope-appserver/NGObjWeb/DynamicElements/WORadioButton.m +++ b/sope-appserver/NGObjWeb/DynamicElements/WORadioButton.m @@ -73,15 +73,29 @@ // TODO: this seems to have issues formValue = [_req formValueForKey:OWFormElementName(self, _ctx)]; - - if (self->checked) { + +#warning FIXME, radio button form handling + + if (self->checked != nil) { // TODO: check needs element-ids? if ([self->checked isValueSettable]) { + // TODO: this only checks element-IDs! In case a value is assigned, it + // must check the value [self->checked setBoolValue:[formValue isEqual:[_ctx elementID]] inComponent:sComponent]; } } + /* + TODO + + This needs to check the value and compare it with the value of the form, + otherwise all radio elements will push the value, multiple times because + radio buttons always have the same name! + + Note that the actual result is usually OK, because all elements push the + _same_ value, the one from the form, not their own. + */ if ([self->selection isValueSettable]) [self->selection setValue:formValue inComponent:sComponent]; } diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index b80e40c6..09f51d76 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=209 +SUBMINOR_VERSION:=211 # v4.5.122 requires libNGExtensions v4.5.153 # v4.5.91 requires libNGExtensions v4.5.134 diff --git a/sope-appserver/NGObjWeb/WOApplication.m b/sope-appserver/NGObjWeb/WOApplication.m index 28b1ffbc..b71baa1d 100644 --- a/sope-appserver/NGObjWeb/WOApplication.m +++ b/sope-appserver/NGObjWeb/WOApplication.m @@ -910,7 +910,7 @@ nbuckets, nindices, narrays, idxsize); else { WOComponent *page; - if ((page = [_ctx page])) { + if ((page = [_ctx page]) != nil) { WOContext_enterComponent(_ctx, page, nil); [page takeValuesFromRequest:_req inContext:_ctx]; WOContext_leaveComponent(_ctx, page); diff --git a/sope-appserver/NGObjWeb/WOSession.m b/sope-appserver/NGObjWeb/WOSession.m index 8c17d610..f0e8f745 100644 --- a/sope-appserver/NGObjWeb/WOSession.m +++ b/sope-appserver/NGObjWeb/WOSession.m @@ -391,17 +391,48 @@ static Class NSDateClass = Nil; senderID = [_ctx senderID]; - if ([senderID length] == 0) + if ([senderID length] == 0) { /* no element URL is available */ + WOComponent *page; + + if ((page = [_ctx page]) != nil) { + /* + But we do have a page set in the context. This usually means that the + -takeValues got triggered by the WODirectActionRequestHandler in + combination with a WOComponent being the DirectAction object. + */ + NSTimeInterval st = 0.0; + + WOContext_enterComponent(_ctx, page, nil); + + if (profileComponents) + st = [[NSDateClass date] timeIntervalSince1970]; + + [page takeValuesFromRequest:_request inContext:_ctx]; + + if (profileComponents) { + NSTimeInterval diff; + + diff = [[NSDateClass date] timeIntervalSince1970] - st; + printf("prof[%s %s]: %0.3fs\n", + [[(WOComponent *)page name] cString], sel_get_name(_cmd), diff); + } + + WOContext_leaveComponent(_ctx, page); + } + return; + } if ([[_request method] isEqualToString:@"GET"]) { NSRange r; r = [[_request uri] rangeOfString:@"?"]; - if (r.length == 0) + if (r.length == 0) { /* no form content to apply */ + // TODO: we should run the takeValues nevertheless to clear values? return; + } } if ((reqCtxId = [_ctx currentElementID]) == nil) @@ -411,7 +442,7 @@ static Class NSDateClass = Nil; { WOComponent *page; - if ((page = [_ctx page])) { + if ((page = [_ctx page]) != nil) { NSTimeInterval st = 0.0; WOContext_enterComponent(_ctx, page, nil); -- 2.39.5