mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-24 04:01:16 +00:00
fix rangeOfData:range: * GSWExtensions/GSWCollapsibleComponentContent.gswc/GSWCollapsibleComponentContent.gswd set framework binding * GSWExtensions/GSWCollapsibleComponentContent.[hm] handle framework binding * GSWExtensions/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.gswd set framework binding * GSWExtensions/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.gswd set framework binding * GSWExtensions/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.gswd set framework binding * GSWeb/GSWApplication.[hm] add -frameworkNameGSWExtensions * GSWeb/GSWPasswordField.m respect GNUstep coding standard (curly brackets placement, etc.) * GSWeb/GSWPasswordField.h remove unneeded declarations * GSWeb/GSWHiddenField.m fix * GSWeb/GSWHiddenField.h remove unneeded declarations * GSWeb/GSWString.m fix appendToResponse:inContext: when formattedValue is nil respect GNUstep coding standard (curly brackets placement, etc.) * GSWeb/GSWTemplateParser.m: fix exception error messages * GSWeb/GSWPopUpButton.m use GSWAssignAndRemoveAssociation() in initWithName:associations:template: clean code * GSWeb/GSWRepetition.m respect GNUstep coding standard (curly brackets placement, etc.) reimplement startIndex and stopIndex bindings clean code * GSWeb/GSWCheckBoxList.m fix -initWithName:...: prefix__Key duplicate, _value * GSWeb.framework/GSWRadioButtonList.m respect GNUstep coding standard (curly brackets placement, etc.) use GSWAssignAndRemoveAssociation() in initWithName:associations:template: Fix bug in -initWithName (valueAssoc) Fix bug in _slowTakeValuesFromRequest: (call NSStringWithObject()) * GSWeb/GSWTextField.m respect GNUstep coding standard (curly brackets placement, etc.) use GSWAssignAndRemoveAssociation() in initWithName:associations:template: Fix bug (call NSStringWithObject()) * GSWeb/GSWText.m respect GNUstep coding standard (curly brackets placement, etc.) clean code use GSWAssignAndRemoveAssociation() in initWithName:associations:template: Fix bug (call NSStringWithObject()) * GSWeb/GSWCheckBox.m respect GNUstep coding standard (curly brackets placement, etc.) clean code use GSWAssignAndRemoveAssociation() in initWithName:associations:template: * GSWeb/GSWRadioButton.m respect GNUstep coding standard (curly brackets placement, etc.) clean code use GSWAssignAndRemoveAssociation() in initWithName:associations:template: * GSWeb.framework/GSWInput.h remove initWithName:associations:contentElements: * GSWeb.framework/GSWInput.m respect GNUstep coding standard (curly brackets placement, etc.) use GSWAssignAndRemoveAssociation() in initWithName:associations:template: ensure name is a string in -nameInContext: fix name escaping in -_appendNameAttributeToResponse: ensure value is a string in _appendValueAttributeToResponse: remove initWithName:associations:contentElements: * GSWeb/GSWHTMLDynamicElement.m respect GNUstep coding standard (curly brackets placement, etc.) ensure string conversion in -_finishInitialization rename variables to make code understandable * GSWeb/GSWConditional.m respect GNUstep coding standard (curly brackets placement, etc.) * GSWeb/GSWActionImage.m respect GNUstep coding standard (curly brackets placement, etc.) fix secure stuff ensure string conversion * GSWeb/GSWActionURL.m respect GNUstep coding standard (curly brackets placement, etc.) ensure string conversion * GSWeb/GSWBody.h remove uneeded declarations * GSWeb/GSWBody.m remove uneeded stuff fix initWithName:... * GSWeb.framework/GSWBrowser.m respect GNUstep coding standard (curly brackets placement, etc.) use GSWAssignAndRemoveAssociation() in initWithName:associations:template: clean code rename variables to make code understandable Fix bugs * GSWeb.framework/GSWFileUpload.m respect GNUstep coding standard (curly brackets placement, etc.) use GSWAssignAndRemoveAssociation() in initWithName:associations:template: * GSWeb/GSWFrame.h remove uneeded declarations * GSWeb/GSWFrame.m respect GNUstep coding standard (curly brackets placement, etc.) clean code * GSWeb/GSWGenericContainer.h remove uneeded declarations change inheritence * GSWeb/GSWGenericContainer.m respect GNUstep coding standard (curly brackets placement, etc.) clean code * GSWeb/GSWGenericElement.h remove uneeded declarations change inheritence * GSWeb/GSWGenericElement.m respect GNUstep coding standard (curly brackets placement, etc.) clean code * GSWeb/GSWForm.h remove uneeded declarations * GSWeb/GSWForm.m respect GNUstep coding standard (curly brackets placement, etc.) use GSWAssignAndRemoveAssociation() in initWithName:associations:template: clean code ensure string conversion * GSWeb/GSWHTMLURLValuedElement.m respect GNUstep coding standard (curly brackets placement, etc.) use GSWAssignAndRemoveAssociation() in initWithName:associations:template: clean code ensure string conversion finish appendAttributesToResponse:inContext implementation * GSWeb/GSWHyperlink.m respect GNUstep coding standard (curly brackets placement, etc.) use GSWAssignAndRemoveAssociation() in initWithName:associations:template: clean code ensure string conversion * GSWeb/GSWImage.m respect GNUstep coding standard (curly brackets placement, etc.) use GSWAssignAndRemoveAssociation() in initWithName:associations:template: clean code * GSWeb/GSWClientSideScript.h remove uneeded declarations change inheritence add -setLanguage * GSWeb/GSWJavaScript.m clean and update code * GSWeb/GSWSubmitButton.m respect GNUstep coding standard (curly brackets placement, etc.) use GSWAssignAndRemoveAssociation() in initWithName:associations:template: clean code * GSWeb/GSWImageButton.m respect GNUstep coding standard (curly brackets placement, etc.) use GSWAssignAndRemoveAssociation() in initWithName:associations:template: * GSWeb/GSWSwitchComponent.m clean and update code * GSWeb/GSWJavaScript.m clean and update code * GSWeb/GSWContext.m clean & fix -computeQueryDictionaryWithPath:queryDictionary:otherQueryDictionary: fix componentActionURL... methods * GSWeb/GSWHTTPIO.m: use GSWeb_appendStringWithImpPtr() * GSWeb/GSWActionURL.h remove uneeded declarations * GSWeb/GSWPrivate.h add GSWeb_objectAtIndexWithImpPtr * GSWDatabase/WODisplayGroup.m Don't raise validation exceptions in _qualifierForKey:value:operatorSelector: git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@37899 72102866-910b-0410-8b05-ffd578937521
217 lines
6.3 KiB
Objective-C
217 lines
6.3 KiB
Objective-C
/** GSWSubmitButton.m - <title>GSWeb: Class GSWSubmitButton</title>
|
|
|
|
Copyright (C) 1999-2004 Free Software Foundation, Inc.
|
|
|
|
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
|
Date: Jan 1999
|
|
|
|
$Revision$
|
|
$Date$
|
|
|
|
This file is part of the GNUstep Web Library.
|
|
|
|
<license>
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Library General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Library General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
License along with this library; if not, write to the Free
|
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
</license>
|
|
**/
|
|
|
|
#include "config.h"
|
|
|
|
RCS_ID("$Id$")
|
|
|
|
#include "GSWeb.h"
|
|
|
|
//====================================================================
|
|
@implementation GSWSubmitButton
|
|
|
|
static GSWAssociation* static_defaultValueAssociation = nil;
|
|
|
|
//--------------------------------------------------------------------
|
|
+ (void) initialize
|
|
{
|
|
if (self == [GSWSubmitButton class])
|
|
{
|
|
if (!static_defaultValueAssociation)
|
|
{
|
|
ASSIGN(static_defaultValueAssociation,([GSWAssociation associationWithValue:@"Submit"]));
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------
|
|
-(id)initWithName:(NSString*)aName
|
|
associations:(NSDictionary*)associations
|
|
template:(GSWElement*)template
|
|
{
|
|
if ((self = [super initWithName:@"input"
|
|
associations:associations
|
|
template: nil]))
|
|
{
|
|
if (_value == nil)
|
|
ASSIGN(_value,static_defaultValueAssociation);
|
|
|
|
GSWAssignAndRemoveAssociation(&_action,_associations,action__Key);
|
|
GSWAssignAndRemoveAssociation(&_actionClass,_associations,actionClass__Key);
|
|
GSWAssignAndRemoveAssociation(&_directActionName,_associations,directActionName__Key);
|
|
|
|
if (_action != nil
|
|
&& [_action isValueConstant])
|
|
{
|
|
[NSException raise:NSInvalidArgumentException
|
|
format:@"%s: 'action' attribute is a constant",
|
|
__PRETTY_FUNCTION__];
|
|
}
|
|
if ((_action != nil && _directActionName != nil)
|
|
|| (_action != nil && _actionClass != nil))
|
|
{
|
|
[NSException raise:NSInvalidArgumentException
|
|
format:@"%s: Either 'action' and 'directActionName' both exist, or 'action' and 'actionClass' both exist",
|
|
__PRETTY_FUNCTION__];
|
|
}
|
|
}
|
|
return self;
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
-(void)dealloc
|
|
{
|
|
DESTROY(_action);
|
|
DESTROY(_actionClass);
|
|
DESTROY(_directActionName);
|
|
[super dealloc];
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
- (NSString*) type
|
|
{
|
|
return @"submit";
|
|
}
|
|
|
|
//--------------------------------------------------------------------
|
|
-(id) description
|
|
{
|
|
return [NSString stringWithFormat:@"<%s %p action: %@ actionClass: %@ directActionName:%@ disabled:%@ >",
|
|
object_getClassName(self),
|
|
(void*)self, _action, _actionClass, _directActionName,
|
|
_disabled];
|
|
};
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
-(void)takeValuesFromRequest:(GSWRequest*)request
|
|
inContext:(GSWContext*)aContext
|
|
{
|
|
//Does Nothing!
|
|
}
|
|
|
|
//--------------------------------------------------------------------
|
|
-(GSWElement*)invokeActionForRequest:(GSWRequest*) request
|
|
inContext:(GSWContext*) context
|
|
{
|
|
id actionValue=nil;
|
|
|
|
NS_DURING
|
|
{
|
|
GSWComponent * component = GSWContext_component(context);
|
|
if (! [self disabledInComponent: component]
|
|
&& [context _wasFormSubmitted])
|
|
{
|
|
if ([context _isMultipleSubmitForm])
|
|
{
|
|
if ([request formValueForKey:[self nameInContext:context]] != nil)
|
|
{
|
|
[context _setActionInvoked:YES];
|
|
if (_action != nil)
|
|
actionValue = [_action valueInComponent:component];
|
|
|
|
if (actionValue == nil)
|
|
actionValue = [context page];
|
|
}
|
|
}
|
|
else
|
|
{
|
|
[context _setActionInvoked:YES];
|
|
if (_action != nil)
|
|
actionValue = [_action valueInComponent:component];
|
|
|
|
if (actionValue == nil)
|
|
actionValue = [context page];
|
|
}
|
|
}
|
|
}
|
|
NS_HANDLER
|
|
{
|
|
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
|
|
@"In GSWSubmitButton invokeActionForRequest:inContext");
|
|
[localException raise];
|
|
}
|
|
NS_ENDHANDLER
|
|
return actionValue;
|
|
}
|
|
|
|
//--------------------------------------------------------------------
|
|
// PRIVATE used within dynamic elements
|
|
- (NSString*) _actionClassAndNameInContext:(GSWContext*) context
|
|
{
|
|
return [self computeActionStringWithActionClassAssociation: _actionClass
|
|
directActionNameAssociation: _directActionName
|
|
inContext: context];
|
|
}
|
|
|
|
//--------------------------------------------------------------------
|
|
- (void) _appendNameAttributeToResponse:(GSWResponse*)response
|
|
inContext:(GSWContext*)context
|
|
{
|
|
if (_directActionName != nil
|
|
|| _actionClass != nil)
|
|
{
|
|
GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(response,
|
|
name__Key,
|
|
[self _actionClassAndNameInContext:context],
|
|
NO);
|
|
}
|
|
else
|
|
{
|
|
[super _appendNameAttributeToResponse:response
|
|
inContext: context];
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------
|
|
- (void) appendToResponse:(GSWResponse*)response
|
|
inContext:(GSWContext*)context
|
|
{
|
|
[super appendToResponse:response inContext:context];
|
|
|
|
if (_directActionName != nil
|
|
|| _actionClass != nil)
|
|
{
|
|
GSWResponse_appendContentAsciiString(response,@"<input type=\"hidden\" name=\"WOSubmitAction\"");
|
|
GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(response,
|
|
value__Key,
|
|
[self _actionClassAndNameInContext:context],
|
|
NO);
|
|
GSWResponse_appendContentCharacter(response,'>');
|
|
}
|
|
}
|
|
|
|
-(void) _appendCloseTagToResponse:(GSWResponse *) response
|
|
inContext:(GSWContext*) context
|
|
{
|
|
}
|
|
|
|
@end
|
|
|
|
|