From 6b1fc12af74026dd567282a7311b7ffc3e55d83c Mon Sep 17 00:00:00 2001 From: helge Date: Sun, 10 Sep 2006 10:51:01 +0000 Subject: [PATCH] added support for fragmentIdentifier git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1359 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 5 ++ .../NGObjWeb/DynamicElements/WOForm.h | 8 +- .../NGObjWeb/DynamicElements/WOForm.m | 75 ++++++++++++------- sope-appserver/NGObjWeb/Version | 2 +- 4 files changed, 60 insertions(+), 30 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 618a8e95..55f2510e 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,8 @@ +2006-09-10 Helge Hess + + * DynamicElements/WOForm.m: added 'fragmentIdentifier' binding to + generate actions which contains a named link (#tasks) (v4.5.248) + 2006-09-05 Helge Hess * DynamicElements/WOCheckBoxList.m: fixed a typo (v4.5.247) diff --git a/sope-appserver/NGObjWeb/DynamicElements/WOForm.h b/sope-appserver/NGObjWeb/DynamicElements/WOForm.h index 3822b675..dc692f4a 100644 --- a/sope-appserver/NGObjWeb/DynamicElements/WOForm.h +++ b/sope-appserver/NGObjWeb/DynamicElements/WOForm.h @@ -1,5 +1,6 @@ /* - Copyright (C) 2000-2005 SKYRIX Software AG + Copyright (C) 2000-2006 SKYRIX Software AG + Copyright (C) 2006 Helge Hess This file is part of SOPE. @@ -37,15 +38,16 @@ WOAssociation *pageName; WOElement *template; - // new in WO4: + /* new in WO4: */ WOAssociation *queryDictionary; NSDictionary *queryParameters; /* associations beginning with '?' */ WOAssociation *actionClass; WOAssociation *directActionName; BOOL sidInUrl; /* include session-id in wa URL ? */ - // skyrix + /* SOPE specific */ WOAssociation *method; + WOAssociation *fragmentIdentifier; } @end diff --git a/sope-appserver/NGObjWeb/DynamicElements/WOForm.m b/sope-appserver/NGObjWeb/DynamicElements/WOForm.m index c792924b..32f7fbfc 100644 --- a/sope-appserver/NGObjWeb/DynamicElements/WOForm.m +++ b/sope-appserver/NGObjWeb/DynamicElements/WOForm.m @@ -1,5 +1,6 @@ /* - Copyright (C) 2000-2005 SKYRIX Software AG + Copyright (C) 2000-2006 SKYRIX Software AG + Copyright (C) 2006 Helge Hess This file is part of SOPE. @@ -31,7 +32,7 @@ static int debugTakeValues = -1; + (int)version { - return 4; + return 5; } - (id)initWithName:(NSString *)_name @@ -51,15 +52,16 @@ static int debugTakeValues = -1; self->containsForm = YES; - sidInUrlAssoc = OWGetProperty(_config, @"?wosid"); - self->action = OWGetProperty(_config, @"action"); - self->href = OWGetProperty(_config, @"href"); - self->pageName = OWGetProperty(_config, @"pageName"); - self->queryDictionary = OWGetProperty(_config, @"queryDictionary"); - self->queryParameters = OWExtractQueryParameters(_config); - self->actionClass = OWGetProperty(_config, @"actionClass"); - self->directActionName = OWGetProperty(_config, @"directActionName"); - self->method = OWGetProperty(_config, @"method"); + sidInUrlAssoc = OWGetProperty(_config, @"?wosid"); + self->action = OWGetProperty(_config, @"action"); + self->href = OWGetProperty(_config, @"href"); + self->pageName = OWGetProperty(_config, @"pageName"); + self->queryDictionary = OWGetProperty(_config, @"queryDictionary"); + self->queryParameters = OWExtractQueryParameters(_config); + self->actionClass = OWGetProperty(_config, @"actionClass"); + self->directActionName = OWGetProperty(_config, @"directActionName"); + self->method = OWGetProperty(_config, @"method"); + self->fragmentIdentifier = OWGetProperty(_config, @"fragmentIdentifier"); self->sidInUrl = (sidInUrlAssoc != nil) ? [sidInUrlAssoc boolValueInComponent:nil] @@ -76,16 +78,17 @@ static int debugTakeValues = -1; } - (void)dealloc { - [self->method release]; - [self->template release]; - [self->actionClass release]; - [self->directActionName release]; - [self->queryDictionary release]; - [self->queryParameters release]; - [self->action release]; - [self->pageName release]; - [self->href release]; - [super dealloc]; + [self->fragmentIdentifier release]; + [self->method release]; + [self->template release]; + [self->actionClass release]; + [self->directActionName release]; + [self->queryDictionary release]; + [self->queryParameters release]; + [self->action release]; + [self->pageName release]; + [self->href release]; + [super dealloc]; } /* handle active form elements */ @@ -348,10 +351,16 @@ static int debugTakeValues = -1; return; } - [_ctx setInForm:YES]; - sComponent = [_ctx component]; + sComponent = [_ctx component]; + + if ([_ctx isInForm]) + [self warnWithFormat:@"detected nested WOForm, component: %@", sComponent]; + else + [_ctx setInForm:YES]; WOResponse_AddCString(_response, "
href != nil) queryString = [self _addHrefToResponse:_response inContext:_ctx]; @@ -359,12 +368,22 @@ static int debugTakeValues = -1; [self _addDirectActionToResponse:_response inContext:_ctx]; else queryString = [self _addActionToResponse:_response inContext:_ctx]; + + if (self->fragmentIdentifier != nil) { + NSString *f = [self->fragmentIdentifier stringValueInComponent:sComponent]; + if ([f isNotEmpty]) { + [_response appendContentCharacter:'#']; + WOResponse_AddString(_response, f); + } + } + + /* append the query string */ - if (queryString) { + if (queryString != nil) { [_response appendContentCharacter:'?']; WOResponse_AddString(_response, queryString); } - if (self->method) { + if (self->method != nil) { WOResponse_AddCString(_response, "\" method=\""); WOResponse_AddString(_response, [self->method stringValueInComponent:sComponent]); @@ -375,15 +394,19 @@ static int debugTakeValues = -1; [self appendExtraAttributesToResponse:_response inContext:_ctx]; - if (self->otherTagString) { + if (self->otherTagString != nil) { WOResponse_AddChar(_response, ' '); WOResponse_AddString(_response, [self->otherTagString stringValueInComponent: sComponent]); } WOResponse_AddChar(_response, '>'); + + /* render form content */ [self->template appendToResponse:_response inContext:_ctx]; + + /* close form */ WOResponse_AddCString(_response, "
"); [_ctx setInForm:NO]; diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index e07cb537..7e1713ab 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=247 +SUBMINOR_VERSION:=248 # v4.5.234 requires libDOM v4.5.21 # v4.5.214 requires libNGExtensions v4.5.179 -- 2.39.5