/*
- 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.
static int debugTakeValues = -1;
+ (int)version {
- return 4;
+ return 5;
}
- (id)initWithName:(NSString *)_name
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]
}
- (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 */
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, "<form action=\"");
+
+ /* add URL to response and return the query string */
if (self->href != nil)
queryString = [self _addHrefToResponse:_response inContext:_ctx];
[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]);
[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, "</form>");
[_ctx setInForm:NO];