2002-04-15 Manuel Guesdon <mguesdon@orange-concept.com>

* GSWDynamicURLString.h:
		o remove NSMutableString protocol
	* GSWUtils.m
		o removed NSString and NSMutableString protocol use
	* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd:
		o change .png to .mng
	* GSWExtensions.framework/GSWCollapsibleComponentContent.gswc/GSWCollapsibleComponentContent.gswd:
		o added framework for image
	* GSWeb.framework/GSWDisplayGroup.h:
		o aded -setQueryOperator:
		o added -initWithKeyValueUnarchiver:
	* GSWeb.framework/GSWDisplayGroup.m:
		o added -setQueryOperator:
		o unarchive queryOperator
		o changed hasMultipleBatches implementation
	* GSWeb.framework/GSWBody.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWImage.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWResourceURL.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWFrame.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWElement.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWDynamicElement.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWGenericElement.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWHTMLStaticElement.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWElementIDString.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
		o removed logs
	* GSWeb.framework/GSWActionURL.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
		o removed logs
	* GSWeb.framework/GSWHyperlink.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWHTMLStaticGroup.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWInput.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWText.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWTextField.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWFileUpload.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWBrowser.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWCheckBox.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWCheckBoxList.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWPopUpButton.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWRadioButton.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWRadioButtonList.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWSubmitButton.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWHiddenField.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWPasswordField.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWString.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc
	* GSWeb.framework/GSWImageButton.h,.m:
		o ivar names changes to conform to coding standards
		o headers changed for gsdoc


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@13471 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Manuel Guesdon 2002-04-15 14:33:16 +00:00
parent afcf1c4e8d
commit 7151edc54d
64 changed files with 5979 additions and 5449 deletions

100
ChangeLog
View file

@ -1,3 +1,103 @@
2002-04-15 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWDynamicURLString.h:
o remove NSMutableString protocol
* GSWUtils.m
o removed NSString and NSMutableString protocol use
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd:
o change .png to .mng
* GSWExtensions.framework/GSWCollapsibleComponentContent.gswc/GSWCollapsibleComponentContent.gswd:
o added framework for image
* GSWeb.framework/GSWDisplayGroup.h:
o aded -setQueryOperator:
o added -initWithKeyValueUnarchiver:
* GSWeb.framework/GSWDisplayGroup.m:
o added -setQueryOperator:
o unarchive queryOperator
o changed hasMultipleBatches implementation
* GSWeb.framework/GSWBody.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWImage.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWResourceURL.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWFrame.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWElement.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWDynamicElement.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWGenericElement.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWHTMLStaticElement.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWElementIDString.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
o removed logs
* GSWeb.framework/GSWActionURL.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
o removed logs
* GSWeb.framework/GSWHyperlink.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWHTMLStaticGroup.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWInput.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWText.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWTextField.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWFileUpload.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWBrowser.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWCheckBox.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWCheckBoxList.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWPopUpButton.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWRadioButton.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWRadioButtonList.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWSubmitButton.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWHiddenField.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWPasswordField.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWString.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
* GSWeb.framework/GSWImageButton.h,.m:
o ivar names changes to conform to coding standards
o headers changed for gsdoc
2002-03-25 Manuel Guesdon <mguesdon@orange-concept.com> 2002-03-25 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWAdaptors/common/GSWConfig.c: changed comments * GSWAdaptors/common/GSWConfig.c: changed comments

View file

@ -7,6 +7,7 @@ Link: GSWHyperlink
Image: GSWImage Image: GSWImage
{ {
filename = imageFileName; filename = imageFileName;
framework = "GSWExtensions";
alt = helpString; alt = helpString;
name = helpString; name = helpString;
border = "0"; border = "0";

View file

@ -1,6 +1,6 @@
ExclamationImage: GSWImage ExclamationImage: GSWImage
{ {
filename = "exclamation.png"; filename = "exclamation.mng";
framework = "GSWExtensions"; framework = "GSWExtensions";
border = 0; border = 0;
} }

View file

@ -1,11 +1,16 @@
/* GSWActionURL.h - GSWeb: Class GSWActionURL /** GSWActionURL.h - <title>GSWeb: Class GSWActionURL</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Sept 1999 Date: Sept 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -27,15 +33,15 @@
#define _GSWActionURL_h__ #define _GSWActionURL_h__
@interface GSWActionURL: GSWHyperlink @interface GSWActionURL: GSWHyperlink
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
template:(GSWElement*)template_; template:(GSWElement*)template;
-(NSString*)elementName; -(NSString*)elementName;
@end @end
@interface GSWActionURL (GSWActionURLA) @interface GSWActionURL (GSWActionURLA)
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
+(BOOL)hasGSWebObjectsAssociations; +(BOOL)hasGSWebObjectsAssociations;
@end @end

View file

@ -1,11 +1,16 @@
/* GSWActionURL.h - GSWeb: Class GSWActionURL /** GSWActionURL.h - <title>GSWeb: Class GSWActionURL</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Sep 1999 Date: Sep 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,17 +35,19 @@ static char rcsId[] = "$Id$";
@implementation GSWActionURL @implementation GSWActionURL
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
template:(GSWElement*)template_ template:(GSWElement*)template
{ {
IM_StartC("ActionURL"); IM_StartC("ActionURL");
MDumpInputObject(name_); MDumpInputObject(name);
MDumpInputObject(associations_); MDumpInputObject(associations);
MDumpInputObject(template_); MDumpInputObject(template);
self=[super initWithName:name_ if ((self=[super initWithName:name
associations:associations_ associations:associations
template:template_]; template:template]))
{
};
IM_StopC("ActionURL"); IM_StopC("ActionURL");
return self; return self;
}; };
@ -67,14 +75,12 @@ static char rcsId[] = "$Id$";
@implementation GSWActionURL (GSWActionURLA) @implementation GSWActionURL (GSWActionURLA)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
IM_StartC("ActionURL"); IM_StartC("ActionURL");
MDumpInputObject(response_); [super appendToResponse:response
MDumpInputObject(context_); inContext:context];
[super appendToResponse:response_
inContext:context_];
IM_StopC("ActionURL"); IM_StopC("ActionURL");
}; };

View file

@ -605,7 +605,8 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
id EONullNull=[NSNull null]; id EONullNull=[NSNull null];
#endif #endif
LOGClassFnStart(); LOGClassFnStart();
NSDebugMLLog(@"associations",@"GSWAssociation: keyPath_=%@ object_=%p",keyPath_,(void*)object_); NSDebugMLLog(@"associations",@"GSWAssociation: keyPath_=%@ object_=%p (class: %@)",
keyPath_,object_,[object_ class]);
if (keyPath_ && object_ && object_!=EONullNull) if (keyPath_ && object_ && object_!=EONullNull)
{ {
#if GDL2 #if GDL2

View file

@ -1,11 +1,16 @@
/* GSWBody.h - GSWeb: Class GSWBody /** GSWBody.h - <title>GSWeb: Class GSWBody</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,9 +35,9 @@
//==================================================================== //====================================================================
@interface GSWBody: GSWHTMLURLValuedElement @interface GSWBody: GSWHTMLURLValuedElement
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(void)dealloc; -(void)dealloc;
-(NSString*)valueAttributeName; -(NSString*)valueAttributeName;
-(NSString*)urlAttributeName; -(NSString*)urlAttributeName;

View file

@ -1,11 +1,16 @@
/* GSWBody.m - GSWeb: Class GSWBody /** GSWBody.m - <title>GSWeb: Class GSWBody</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,15 +35,15 @@ static char rcsId[] = "$Id$";
@implementation GSWBody @implementation GSWBody
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
if ((self=[super initWithName:name_ if ((self=[super initWithName:name
associations:associations_ associations:associations
contentElements:elements_])) contentElements:elements]))
{ {
}; };
return self; return self;
}; };
@ -69,8 +75,8 @@ static char rcsId[] = "$Id$";
-(NSString*)description -(NSString*)description
{ {
return [NSString stringWithFormat:@"<%s %p>", return [NSString stringWithFormat:@"<%s %p>",
object_get_class_name(self), object_get_class_name(self),
(void*)self]; (void*)self];
}; };

View file

@ -1,11 +1,16 @@
/* GSWBrowser.h - GSWeb: Class GSWBrowser /** GSWBrowser.h - <title>GSWeb: Class GSWBrowser</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,54 +35,56 @@
//OK //OK
@interface GSWBrowser: GSWInput @interface GSWBrowser: GSWInput
{ {
GSWAssociation* list; GSWAssociation* _list;
GSWAssociation* item; GSWAssociation* _item;
GSWAssociation* displayString; GSWAssociation* _displayString;
GSWAssociation* selections; GSWAssociation* _selections;
//GSWeb Additions { //GSWeb Additions {
GSWAssociation* selectionValues; GSWAssociation* _selectionValues;
// } // }
GSWAssociation* selectedValues; GSWAssociation* _selectedValues;
GSWAssociation* size; GSWAssociation* _size;
GSWAssociation* multiple; GSWAssociation* _multiple;
GSWAssociation* escapeHTML; GSWAssociation* _escapeHTML;
BOOL autoValue;//?? BOOL _autoValue;//??
}; };
-(void)dealloc; -(void)dealloc;
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(NSString*)description; -(NSString*)description;
-(NSString*)elementName; -(NSString*)elementName;
@end @end
@interface GSWBrowser (GSWBrowserA) @interface GSWBrowser (GSWBrowserA)
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_
inContext:(GSWContext*)context_; -(void)_slowTakeValuesFromRequest:(GSWRequest*)request
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ inContext:(GSWContext*)context;
inContext:(GSWContext*)context_;
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context;
@end @end
@interface GSWBrowser (GSWBrowserB) @interface GSWBrowser (GSWBrowserB)
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)appendValueToResponse:(GSWResponse*)response_ -(void)appendValueToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
@end @end
@interface GSWBrowser (GSWBrowserC) @interface GSWBrowser (GSWBrowserC)
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping; withMapping:(char*)mapping;
@end @end
#endif //_GSWBrowser_h__ #endif //_GSWBrowser_h__

View file

@ -1,11 +1,16 @@
/* GSWBrowser.m - GSWeb: Class GSWBrowser /** GSWBrowser.m - <title>GSWeb: Class GSWBrowser</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,61 +35,62 @@ static char rcsId[] = "$Id$";
@implementation GSWBrowser @implementation GSWBrowser
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
//OK //OK
NSMutableDictionary* _associations=nil; NSMutableDictionary* tmpAssociations=nil;
LOGObjectFnStartC("GSWBrowser"); LOGObjectFnStartC("GSWBrowser");
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements=%@",name_,associations_,elements_); NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",
_associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; aName,associations,elements);
[_associations removeObjectForKey:list__Key]; tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
[_associations removeObjectForKey:item__Key]; [tmpAssociations removeObjectForKey:list__Key];
[_associations removeObjectForKey:displayString__Key]; [tmpAssociations removeObjectForKey:item__Key];
[_associations removeObjectForKey:selections__Key]; [tmpAssociations removeObjectForKey:displayString__Key];
[tmpAssociations removeObjectForKey:selections__Key];
if (!WOStrictFlag) if (!WOStrictFlag)
[_associations removeObjectForKey:selectionValues__Key]; [tmpAssociations removeObjectForKey:selectionValues__Key];
[_associations removeObjectForKey:selectedValues__Key]; [tmpAssociations removeObjectForKey:selectedValues__Key];
[_associations removeObjectForKey:size__Key]; [tmpAssociations removeObjectForKey:size__Key];
[_associations removeObjectForKey:multiple__Key]; [tmpAssociations removeObjectForKey:multiple__Key];
[_associations removeObjectForKey:escapeHTML__Key]; [tmpAssociations removeObjectForKey:escapeHTML__Key];
if ((self=[super initWithName:name_ if ((self=[super initWithName:aName
associations:_associations associations:tmpAssociations
contentElements:nil])) contentElements:nil]))
{ {
list=[[associations_ objectForKey:list__Key _list=[[associations objectForKey:list__Key
withDefaultObject:[list autorelease]] retain]; withDefaultObject:[_list autorelease]] retain];
item=[[associations_ objectForKey:item__Key _item=[[associations objectForKey:item__Key
withDefaultObject:[item autorelease]] retain]; withDefaultObject:[_item autorelease]] retain];
displayString=[[associations_ objectForKey:displayString__Key _displayString=[[associations objectForKey:displayString__Key
withDefaultObject:[displayString autorelease]] retain]; withDefaultObject:[_displayString autorelease]] retain];
selections=[[associations_ objectForKey:selection__Key _selections=[[associations objectForKey:selection__Key
withDefaultObject:[selections autorelease]] retain]; withDefaultObject:[_selections autorelease]] retain];
if (selections && ![selections isValueSettable]) if (_selections && ![_selections isValueSettable])
{ {
//TODO //TODO
}; };
if (!WOStrictFlag) if (!WOStrictFlag)
{ {
selectionValues=[[associations_ objectForKey:selectionValue__Key _selectionValues=[[associations objectForKey:selectionValue__Key
withDefaultObject:[selectionValues autorelease]] retain]; withDefaultObject:[_selectionValues autorelease]] retain];
if (selectionValues && ![selectionValues isValueSettable]) if (_selectionValues && ![_selectionValues isValueSettable])
{ {
//TODO //TODO
}; };
}; };
selectedValues=[[associations_ objectForKey:selectedValues__Key _selectedValues=[[associations objectForKey:selectedValues__Key
withDefaultObject:[selectedValues autorelease]] retain]; withDefaultObject:[_selectedValues autorelease]] retain];
size=[[associations_ objectForKey:size__Key _size=[[associations objectForKey:size__Key
withDefaultObject:[size autorelease]] retain]; withDefaultObject:[_size autorelease]] retain];
multiple=[[associations_ objectForKey:multiple__Key _multiple=[[associations objectForKey:multiple__Key
withDefaultObject:[multiple autorelease]] retain]; withDefaultObject:[_multiple autorelease]] retain];
escapeHTML=[[associations_ objectForKey:escapeHTML__Key _escapeHTML=[[associations objectForKey:escapeHTML__Key
withDefaultObject:[escapeHTML autorelease]] retain]; withDefaultObject:[_escapeHTML autorelease]] retain];
}; };
LOGObjectFnStopC("GSWBrowser"); LOGObjectFnStopC("GSWBrowser");
return self; return self;
@ -92,15 +99,15 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(list); DESTROY(_list);
DESTROY(item); DESTROY(_item);
DESTROY(displayString); DESTROY(_displayString);
DESTROY(selections); DESTROY(_selections);
DESTROY(selectionValues); DESTROY(_selectionValues);
DESTROY(selectedValues); DESTROY(_selectedValues);
DESTROY(size); DESTROY(_size);
DESTROY(multiple); DESTROY(_multiple);
DESTROY(escapeHTML); DESTROY(_escapeHTML);
[super dealloc]; [super dealloc];
}; };
@ -123,315 +130,315 @@ static char rcsId[] = "$Id$";
//==================================================================== //====================================================================
@implementation GSWBrowser (GSWBrowserA) @implementation GSWBrowser (GSWBrowserA)
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
GSWRequest* _request=nil; GSWRequest* request=nil;
BOOL _isFromClientComponent=NO; BOOL isFromClientComponent=NO;
GSWComponent* _component=nil; GSWComponent* component=nil;
NSArray* _listValue=nil; NSArray* listValue=nil;
id _selectionsValue=nil; id selectionsValue=nil;
id _selectedValuesValue=nil; id selectedValuesValue=nil;
id _valueValue=nil; id valueValue=nil;
id _itemValue=nil; id itemValue=nil;
id _displayStringValue=nil; id displayStringValue=nil;
BOOL _escapeHTML=YES; BOOL escapeHTMLBoolValue=YES;
id _escapeHTMLValue=nil; id escapeHTMLValue=nil;
BOOL _isMultiple=NO; BOOL isMultiple=NO;
int i=0; int i=0;
BOOL _inOptGroup=NO; BOOL inOptGroup=NO;
#ifndef ENABLE_OPTGROUP #ifndef ENABLE_OPTGROUP
BOOL _optGroupLabel=NO; BOOL optGroupLabel=NO;
#endif #endif
LOGObjectFnStartC("GSWBrowser"); LOGObjectFnStartC("GSWBrowser");
[self resetAutoValue]; [self resetAutoValue];
autoValue = NO; _autoValue = NO;
_request=[context_ request]; request=[context request];
_isFromClientComponent=[_request isFromClientComponent]; isFromClientComponent=[request isFromClientComponent];
_component=[context_ component]; component=[context component];
//TODO: multiple //TODO: multiple
[super appendToResponse:response_ [super appendToResponse:response
inContext:context_]; inContext:context];
_listValue=[list valueInComponent:_component]; listValue=[_list valueInComponent:component];
NSDebugMLLog(@"gswdync",@"_listValue=%@",_listValue); NSDebugMLLog(@"gswdync",@"listValue=%@",listValue);
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'", @"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
list, _list,
_listValue, listValue,
[_listValue class]); [listValue class]);
_selectionsValue=[selections valueInComponent:_component]; selectionsValue=[_selections valueInComponent:component];
NSDebugMLLog(@"gswdync",@"selections=%@",selections); NSDebugMLLog(@"gswdync",@"selections=%@",_selections);
NSDebugMLLog(@"gswdync",@"_selectionsValue=%@",_selectionsValue); NSDebugMLLog(@"gswdync",@"selectionsValue=%@",selectionsValue);
_selectedValuesValue=[selectedValues valueInComponent:_component]; selectedValuesValue=[_selectedValues valueInComponent:component];
NSDebugMLLog(@"gswdync",@"selectedValues=%@",selectedValues); NSDebugMLLog(@"gswdync",@"selectedValues=%@",_selectedValues);
NSDebugMLLog(@"gswdync",@"_selectedValuesValue=%@",_selectedValuesValue); NSDebugMLLog(@"gswdync",@"selectedValuesValue=%@",selectedValuesValue);
if (escapeHTML) if (_escapeHTML)
{ {
_escapeHTMLValue=[escapeHTML valueInComponent:_component]; escapeHTMLValue=[_escapeHTML valueInComponent:component];
_escapeHTML=boolValueFor(_escapeHTMLValue); escapeHTMLBoolValue=boolValueFor(escapeHTMLValue);
}; };
if (multiple) if (_multiple)
{ {
id _multipleValue=nil; id multipleValue=nil;
_multipleValue=[multiple valueInComponent:_component]; multipleValue=[_multiple valueInComponent:component];
_isMultiple=boolValueFor(_multipleValue); isMultiple=boolValueFor(multipleValue);
}; };
for(i=0;i<[_listValue count];i++) for(i=0;i<[listValue count];i++)
{ {
NSDebugMLLog(@"gswdync",@"_inOptGroup=%s",(_inOptGroup ? "YES" : "NO")); NSDebugMLLog(@"gswdync",@"inOptGroup=%s",(inOptGroup ? "YES" : "NO"));
_itemValue=[_listValue objectAtIndex:i]; itemValue=[listValue objectAtIndex:i];
if (item) if (_item)
[item setValue:_itemValue [_item setValue:itemValue
inComponent:_component]; inComponent:component];
NSDebugMLLog(@"gswdync",@"_itemValue=%@",_itemValue); NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
if (_itemValue) if (itemValue)
{ {
NSDebugMLLog(@"gswdync",@"value=%@",value); NSDebugMLLog(@"gswdync",@"value=%@",_value);
_valueValue=[self valueInContext:context_]; valueValue=[self valueInContext:context];
NSDebugMLLog(@"gswdync",@"_valueValue=%@",_valueValue); NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (_valueValue) if (valueValue)
{ {
BOOL _isEqual; BOOL isEqual;
NSDebugMLLog0(@"gswdync",@"Adding OPTION"); NSDebugMLLog0(@"gswdync",@"Adding OPTION");
[response_ _appendContentAsciiString:@"\n<OPTION"]; [response _appendContentAsciiString:@"\n<OPTION"];
if (selections) if (_selections)
{ {
if(value) if(_value)
_isEqual=SBIsValueIsIn(_valueValue,_selectionsValue); isEqual=SBIsValueIsIn(valueValue,selectionsValue);
else else
_isEqual=SBIsValueIsIn(_itemValue,_selectionsValue); isEqual=SBIsValueIsIn(itemValue,selectionsValue);
if (_isEqual) if (isEqual)
{ {
[response_ appendContentCharacter:' ']; [response appendContentCharacter:' '];
[response_ _appendContentAsciiString:@"selected"]; [response _appendContentAsciiString:@"selected"];
}; };
}; };
if (_isEqual == NO && selectedValues) if (isEqual == NO && _selectedValues)
{ {
if(value) if(_value)
_isEqual=SBIsValueIsIn(_valueValue,_selectedValuesValue); isEqual=SBIsValueIsIn(valueValue,selectedValuesValue);
else else
_isEqual=SBIsValueIsIn(_itemValue,_selectedValuesValue); isEqual=SBIsValueIsIn(itemValue,selectedValuesValue);
if (_isEqual) if (isEqual)
{ {
[response_ appendContentCharacter:' ']; [response appendContentCharacter:' '];
[response_ _appendContentAsciiString:@"selected"]; [response _appendContentAsciiString:@"selected"];
}; };
}; };
if (value == nil) if (_value == nil)
autoValue = YES; _autoValue = YES;
if (_valueValue) if (valueValue)
{ {
[response_ _appendContentAsciiString:@" value=\""]; [response _appendContentAsciiString:@" value=\""];
[response_ _appendContentAsciiString:_valueValue]; [response _appendContentAsciiString:valueValue];
[response_ appendContentCharacter:'"']; [response appendContentCharacter:'"'];
}; };
[response_ appendContentCharacter:'>']; [response appendContentCharacter:'>'];
}; };
_displayStringValue=nil; displayStringValue=nil;
if (displayString) if (_displayString)
{ {
NSDebugMLLog(@"gswdync",@"displayString=%@",displayString); NSDebugMLLog(@"gswdync",@"displayString=%@",_displayString);
_displayStringValue=[displayString valueInComponent:_component]; displayStringValue=[_displayString valueInComponent:component];
NSDebugMLLog(@"gswdync",@"_displayStringValue=%@",_displayStringValue); NSDebugMLLog(@"gswdync",@"displayStringValue=%@",displayStringValue);
}; };
if (_displayStringValue) if (displayStringValue)
{ {
if (!_valueValue) if (!valueValue)
{ {
if (_inOptGroup) if (inOptGroup)
{ {
NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP"); NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP");
#ifdef ENABLE_OPTGROUP #ifdef ENABLE_OPTGROUP
[response_ _appendContentAsciiString:@"\n</OPTGROUP>"]; [response _appendContentAsciiString:@"\n</OPTGROUP>"];
#endif #endif
_inOptGroup=NO; inOptGroup=NO;
}; };
NSDebugMLLog0(@"gswdync",@"Adding OPTGROUP"); NSDebugMLLog0(@"gswdync",@"Adding OPTGROUP");
#ifdef ENABLE_OPTGROUP #ifdef ENABLE_OPTGROUP
[response_ _appendContentAsciiString:@"\n<OPTGROUP label=\""]; [response _appendContentAsciiString:@"\n<OPTGROUP label=\""];
#else #else
#if 0 #if 0
[response_ _appendContentAsciiString:@"\n<OPTION>-- "]; [response _appendContentAsciiString:@"\n<OPTION>-- "];
_optGroupLabel=YES; optGroupLabel=YES;
#else #else
[response_ _appendContentAsciiString:@"\n<OPTION>"]; [response _appendContentAsciiString:@"\n<OPTION>"];
#endif #endif
_optGroupLabel=YES; optGroupLabel=YES;
#endif #endif
_inOptGroup=YES; inOptGroup=YES;
}; };
//<OPTGROUP label="PortMaster 3"> //<OPTGROUP label="PortMaster 3">
if (_escapeHTML) if (escapeHTMLBoolValue)
_displayStringValue=[GSWResponse stringByEscapingHTMLString:_displayStringValue]; displayStringValue=[GSWResponse stringByEscapingHTMLString:displayStringValue];
NSDebugMLLog(@"gswdync",@"_displayStringValue=%@",_displayStringValue); NSDebugMLLog(@"gswdync",@"displayStringValue=%@",displayStringValue);
#ifndef ENABLE_OPTGROUP #ifndef ENABLE_OPTGROUP
if (_optGroupLabel) if (optGroupLabel)
{ {
_displayStringValue=[NSString stringWithFormat:@"%@ --",_displayStringValue]; displayStringValue=[NSString stringWithFormat:@"%@ --",displayStringValue];
}; };
#endif #endif
[response_ appendContentHTMLString:_displayStringValue]; [response appendContentHTMLString:displayStringValue];
}; };
if (_valueValue) if (valueValue)
{ {
//NSDebugMLLog0(@"gswdync",@"Adding /OPTION"); //NSDebugMLLog0(@"gswdync",@"Adding /OPTION");
// K2- No /OPTION TAG // K2- No /OPTION TAG
//[response_ _appendContentAsciiString:@"</OPTION>"]; //[response _appendContentAsciiString:@"</OPTION>"];
} }
else else
{ {
NSDebugMLLog0(@"gswdync",@"Adding > or </OPTION>"); NSDebugMLLog0(@"gswdync",@"Adding > or </OPTION>");
#ifdef ENABLE_OPTGROUP #ifdef ENABLE_OPTGROUP
[response_ _appendContentAsciiString:@"\">"]; [response _appendContentAsciiString:@"\">"];
#else #else
if (_optGroupLabel) if (optGroupLabel)
{ {
//[response_ _appendContentAsciiString:@"</OPTION>"]; //[response _appendContentAsciiString:@"</OPTION>"];
_optGroupLabel=NO; optGroupLabel=NO;
}; };
#endif #endif
}; };
}; };
}; };
if (_inOptGroup) if (inOptGroup)
{ {
#ifdef ENABLE_OPTGROUP #ifdef ENABLE_OPTGROUP
NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP"); NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP");
[response_ _appendContentAsciiString:@"\n</OPTGROUP>"]; [response _appendContentAsciiString:@"\n</OPTGROUP>"];
#endif #endif
_inOptGroup=NO; inOptGroup=NO;
}; };
[response_ _appendContentAsciiString:@"</SELECT>"]; [response _appendContentAsciiString:@"</SELECT>"];
LOGObjectFnStopC("GSWBrowser"); LOGObjectFnStopC("GSWBrowser");
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
LOGObjectFnStartC("GSWPopUpButton"); LOGObjectFnStartC("GSWPopUpButton");
[self _slowTakeValuesFromRequest:request_ [self _slowTakeValuesFromRequest:request
inContext:context_]; inContext:context];
LOGObjectFnStopC("GSWPopUpButton"); LOGObjectFnStopC("GSWPopUpButton");
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_ -(void)_slowTakeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
BOOL _disabled=NO; BOOL disabledValue=NO;
BOOL _wasFormSubmitted=NO; BOOL wasFormSubmitted=NO;
LOGObjectFnStartC("GSWPopUpButton"); LOGObjectFnStartC("GSWPopUpButton");
[self resetAutoValue]; [self resetAutoValue];
_disabled=[self disabledInContext:context_]; disabledValue=[self disabledInContext:context];
if (!_disabled) if (!disabledValue)
{ {
_wasFormSubmitted=[context_ _wasFormSubmitted]; wasFormSubmitted=[context _wasFormSubmitted];
if (_wasFormSubmitted) if (wasFormSubmitted)
{ {
BOOL _isMultiple=NO; BOOL isMultiple=NO;
NSArray* _foundValues=nil; NSArray* foundValues=nil;
NSMutableArray* _mutableFoundValues=[NSMutableArray array]; NSMutableArray* mutableFoundValues=[NSMutableArray array];
GSWComponent* _component=nil; GSWComponent* component=nil;
NSArray* _listValue=nil; NSArray* listValue=nil;
id _valueValue=nil; id valueValue=nil;
id _itemValue=nil; id itemValue=nil;
NSString* _name=nil; NSString* name=nil;
NSArray* _formValues=nil; NSArray* formValues=nil;
id _formValue=nil; id formValue=nil;
BOOL _found=NO; BOOL found=NO;
int i=0; int i=0;
_component=[context_ component]; component=[context component];
_name=[self nameInContext:context_]; name=[self nameInContext:context];
NSDebugMLLog(@"gswdync",@"_name=%@",_name); NSDebugMLLog(@"gswdync",@"name=%@",name);
if (multiple) if (_multiple)
{ {
id _multipleValue=[multiple valueInComponent:_component]; id multipleValue=[_multiple valueInComponent:component];
_isMultiple=boolValueFor(_multipleValue); isMultiple=boolValueFor(multipleValue);
}; };
_formValues=[request_ formValuesForKey:_name]; formValues=[request formValuesForKey:name];
NSDebugMLLog(@"gswdync",@"_formValues=%@",_formValues); NSDebugMLLog(@"gswdync",@"formValues=%@",formValues);
if (_formValues && [_formValues count]) if (formValues && [formValues count])
{ {
BOOL _isEqual=NO; BOOL isEqual=NO;
_formValue=[_formValues objectAtIndex:0]; formValue=[formValues objectAtIndex:0];
NSDebugMLLog(@"gswdync",@"_formValue=%@",_formValue); NSDebugMLLog(@"gswdync",@"formValue=%@",formValue);
_listValue=[list valueInComponent:_component]; listValue=[_list valueInComponent:component];
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'", @"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
list, _list,
_listValue, listValue,
[_listValue class]); [listValue class]);
for(i=0;(!_found || _isMultiple) && i<[_listValue count];i++) for(i=0;(!found || isMultiple) && i<[listValue count];i++)
{ {
_itemValue=[_listValue objectAtIndex:i]; itemValue=[listValue objectAtIndex:i];
NSDebugMLLog(@"gswdync",@"_itemValue=%@",_itemValue); NSDebugMLLog(@"gswdync",@"_itemValue=%@",itemValue);
NSDebugMLLog(@"gswdync",@"item=%@",item); NSDebugMLLog(@"gswdync",@"item=%@",_item);
if (item) if (_item)
[item setValue:_itemValue [_item setValue:itemValue
inComponent:_component]; inComponent:component];
NSDebugMLLog(@"gswdync",@"value=%@",value); NSDebugMLLog(@"gswdync",@"value=%@",_value);
_valueValue=[self valueInContext:context_]; valueValue=[self valueInContext:context];
NSDebugMLLog(@"gswdync",@"_valueValue=%@ [class=%@] _formValue=%@ [class=%@]", NSDebugMLLog(@"gswdync",@"_valueValue=%@ [class=%@] _formValue=%@ [class=%@]",
_valueValue,[_valueValue class], valueValue,[valueValue class],
_formValue,[_formValue class]); formValue,[formValue class]);
_isEqual=SBIsValueIsIn(_valueValue,_formValue); isEqual=SBIsValueIsIn(valueValue,formValue);
if (_isEqual) if (isEqual)
{ {
if(autoValue == NO) if(_autoValue == NO)
_itemValue = _valueValue; itemValue = valueValue;
[_mutableFoundValues addObject:_itemValue]; [mutableFoundValues addObject:itemValue];
_found=YES; found=YES;
}; };
}; };
}; };
_foundValues=[NSArray arrayWithArray:_mutableFoundValues]; foundValues=[NSArray arrayWithArray:mutableFoundValues];
NSDebugMLLog(@"gswdync",@"_found=%s",(_found ? "YES" : "NO")); NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO"));
if (selections) if (_selections)
{ {
if (!WOStrictFlag) if (!WOStrictFlag)
{ {
NS_DURING NS_DURING
{ {
[selections setValue:_foundValues [_selections setValue:foundValues
inComponent:_component]; inComponent:component];
}; };
NS_HANDLER NS_HANDLER
{ {
[self handleValidationException:localException [self handleValidationException:localException
inContext:context_]; inContext:context];
} }
NS_ENDHANDLER; NS_ENDHANDLER;
} }
else else
{ {
[selections setValue:_foundValues [_selections setValue:foundValues
inComponent:_component]; inComponent:component];
}; };
}; };
if (!WOStrictFlag) if (!WOStrictFlag)
{ {
if (selectionValues) if (_selectionValues)
{ {
NS_DURING NS_DURING
{ {
[selectionValues setValue:_foundValues [_selectionValues setValue:foundValues
inComponent:_component]; inComponent:component];
}; };
NS_HANDLER NS_HANDLER
{ {
[self handleValidationException:localException [self handleValidationException:localException
inContext:context_]; inContext:context];
} }
NS_ENDHANDLER; NS_ENDHANDLER;
}; };
@ -442,8 +449,8 @@ static char rcsId[] = "$Id$";
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ -(void)_fastTakeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
}; };
@ -453,16 +460,16 @@ static char rcsId[] = "$Id$";
//==================================================================== //====================================================================
@implementation GSWBrowser (GSWBrowserB) @implementation GSWBrowser (GSWBrowserB)
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendValueToResponse:(GSWResponse*)response_ -(void)appendValueToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
}; };

View file

@ -1,11 +1,16 @@
/* GSWCheckBox.h - GSWeb: Class GSWCheckBox /** GSWCheckBox.h - <title>GSWeb: Class GSWCheckBox</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,13 +35,13 @@
//==================================================================== //====================================================================
@interface GSWCheckBox: GSWInput @interface GSWCheckBox: GSWInput
{ {
GSWAssociation* checked; GSWAssociation* _checked;
GSWAssociation* selection; GSWAssociation* _selection;
}; };
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(void)dealloc; -(void)dealloc;
-(NSString*)description; -(NSString*)description;
@ -44,14 +50,14 @@
//==================================================================== //====================================================================
@interface GSWCheckBox (GSWCheckBoxA) @interface GSWCheckBox (GSWCheckBoxA)
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
@end @end
//==================================================================== //====================================================================
@interface GSWCheckBox (GSWCheckBoxB) @interface GSWCheckBox (GSWCheckBoxB)
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
@end @end

View file

@ -1,11 +1,16 @@
/* GSWCheckBox.m - GSWeb: Class GSWCheckBox /** GSWCheckBox.m - <title>GSWeb: Class GSWCheckBox</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,42 +35,42 @@ static char rcsId[] = "$Id$";
@implementation GSWCheckBox @implementation GSWCheckBox
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)_elements contentElements:(NSArray*)elements
{ {
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
LOGObjectFnStartC("GSWCheckBox"); LOGObjectFnStartC("GSWCheckBox");
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements); NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ _elements=%@",aName,associations,elements);
[_associations setObject:[GSWAssociation associationWithValue:@"checkbox"] [tmpAssociations setObject:[GSWAssociation associationWithValue:@"checkbox"]
forKey:@"type"]; forKey:@"type"];
[_associations removeObjectForKey:selection__Key]; [tmpAssociations removeObjectForKey:selection__Key];
[_associations removeObjectForKey:checked__Key]; [tmpAssociations removeObjectForKey:checked__Key];
if ((self=[super initWithName:name_ if ((self=[super initWithName:aName
associations:_associations associations:tmpAssociations
contentElements:nil])) contentElements:nil]))
{ {
//TODOV //TODOV
selection=[[associations_ objectForKey:selection__Key _selection=[[associations objectForKey:selection__Key
withDefaultObject:[selection autorelease]] retain]; withDefaultObject:[_selection autorelease]] retain];
if (selection && ![selection isValueSettable]) if (_selection && ![_selection isValueSettable])
{ {
ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable"); ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable");
}; };
checked=[[associations_ objectForKey:checked__Key _checked=[[associations objectForKey:checked__Key
withDefaultObject:[checked autorelease]] retain]; withDefaultObject:[_checked autorelease]] retain];
if (checked && ![checked isValueSettable]) if (_checked && ![_checked isValueSettable])
{ {
ExceptionRaise0(@"GSWCheckBox",@"'checked' parameter must be settable"); ExceptionRaise0(@"GSWCheckBox",@"'checked' parameter must be settable");
}; };
if (!checked) if (!_checked)
{ {
if (!value || !selection) if (!_value || !_selection)
{ {
ExceptionRaise0(@"GSWCheckBox",@"If you don't specify 'checked' parameter, you have to specify 'value' and 'selection' parameter"); ExceptionRaise0(@"GSWCheckBox",@"If you don't specify 'checked' parameter, you have to specify 'value' and 'selection' parameter");
}; };
}; };
}; };
LOGObjectFnStopC("GSWCheckBox"); LOGObjectFnStopC("GSWCheckBox");
return self; return self;
}; };
@ -72,8 +78,8 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(checked); DESTROY(_checked);
DESTROY(selection); DESTROY(_selection);
[super dealloc]; [super dealloc];
}; };
@ -81,8 +87,8 @@ static char rcsId[] = "$Id$";
-(NSString*)description -(NSString*)description
{ {
return [NSString stringWithFormat:@"<%s %p>", return [NSString stringWithFormat:@"<%s %p>",
object_get_class_name(self), object_get_class_name(self),
(void*)self]; (void*)self];
}; };
@ -92,37 +98,37 @@ static char rcsId[] = "$Id$";
@implementation GSWCheckBox (GSWCheckBoxA) @implementation GSWCheckBox (GSWCheckBoxA)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)_response -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
GSWComponent* _component=nil; GSWComponent* component=nil;
BOOL _disabledInContext=NO; BOOL disabledInContext=NO;
LOGObjectFnStartC("GSWCheckBox"); LOGObjectFnStartC("GSWCheckBox");
_component=[context_ component]; component=[context component];
_disabledInContext=[self disabledInContext:context_]; disabledInContext=[self disabledInContext:context];
if (!_disabledInContext) if (!disabledInContext)
{ {
BOOL _checked=NO; BOOL checkedValue=NO;
[self appendValueToResponse:_response [self appendValueToResponse:response
inContext:context_]; inContext:context];
[self appendNameToResponse:_response [self appendNameToResponse:response
inContext:context_]; inContext:context];
if (checked) if (_checked)
{ {
_checked=[self evaluateCondition:checked checkedValue=[self evaluateCondition:_checked
inContext:context_]; inContext:context];
} }
else if (value) else if (_value)
{ {
id _valueValue=[value valueInComponent:_component]; id valueValue=[_value valueInComponent:component];
id _selectionValue=[selection valueInComponent:_component]; id selectionValue=[_selection valueInComponent:component];
_checked=SBIsValueEqual(_selectionValue,_valueValue); checkedValue=SBIsValueEqual(selectionValue,valueValue);
}; };
if (_checked) if (checkedValue)
[_response _appendContentAsciiString:@" checked"]; [response _appendContentAsciiString:@" checked"];
}; };
LOGObjectFnStopC("GSWCheckBox"); LOGObjectFnStopC("GSWCheckBox");
}; };
@ -132,83 +138,80 @@ static char rcsId[] = "$Id$";
@implementation GSWCheckBox (GSWCheckBoxB) @implementation GSWCheckBox (GSWCheckBoxB)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
BOOL _disabledInContext=NO; BOOL disabledInContext=NO;
LOGObjectFnStartC("GSWCheckBox"); LOGObjectFnStartC("GSWCheckBox");
_disabledInContext=[self disabledInContext:context_]; disabledInContext=[self disabledInContext:context];
if (!_disabledInContext) if (!disabledInContext)
{ {
if ([context_ _wasFormSubmitted]) if ([context _wasFormSubmitted])
{ {
GSWComponent* _component=[context_ component]; GSWComponent* component=[context component];
NSString* _name=nil; NSString* name=nil;
NSArray* _formValues=nil; NSArray* formValues=nil;
// GSWElementIDString* _elementID=nil; BOOL checkChecked=NO;
BOOL _checkChecked=NO; name=[self nameInContext:context];
_name=[self nameInContext:context_]; NSDebugMLLog(@"gswdync",@"name=%@",name);
NSDebugMLLog(@"gswdync",@"_name=%@",_name); formValues=[request formValuesForKey:name];
_formValues=[request_ formValuesForKey:_name]; NSDebugMLLog(@"gswdync",@"formValues=%@",formValues);
// _elementID=[[context_ elementID] copy]; //!! when release ? if (formValues && [formValues count])
//??? {
NSDebugMLLog(@"gswdync",@"_formValues=%@",_formValues); NSDebugMLLog(@"gswdync",@"[formValues objectAtIndex:0]=%@",[formValues objectAtIndex:0]);
if (_formValues && [_formValues count]) checkChecked=YES;
{ if (_selection)
NSDebugMLLog(@"gswdync",@"[_formValues objectAtIndex:0]=%@",[_formValues objectAtIndex:0]); {
_checkChecked=YES; //TODOV
if (selection) id valueValue=[_value valueInComponent:component];
{ if (!WOStrictFlag)
//TODOV {
id _valueValue=[value valueInComponent:_component]; NS_DURING
if (!WOStrictFlag) {
{ [_selection setValue:valueValue
NS_DURING inComponent:component];
{ };
[selection setValue:_valueValue NS_HANDLER
inComponent:_component]; {
}; [self handleValidationException:localException
NS_HANDLER inContext:context];
{ }
[self handleValidationException:localException NS_ENDHANDLER;
inContext:context_]; }
} else
NS_ENDHANDLER; {
} [_selection setValue:valueValue
else inComponent:component];
{ };
[selection setValue:_valueValue };
inComponent:_component]; };
}; if (_checked)
}; {
}; id checkedValue=[NSNumber numberWithBool:checkChecked];
if (checked) NSDebugMLLog(@"gswdync",@"checkedValue=%@",checkedValue);
{ if (!WOStrictFlag)
id _checkedValue=[NSNumber numberWithBool:_checkChecked]; {
NSDebugMLLog(@"gswdync",@"_checkedValue=%@",_checkedValue); NS_DURING
if (!WOStrictFlag) {
{ [_checked setValue:checkedValue
NS_DURING inComponent:component];
{ };
[checked setValue:_checkedValue NS_HANDLER
inComponent:_component]; {
}; [self handleValidationException:localException
NS_HANDLER inContext:context];
{ }
[self handleValidationException:localException NS_ENDHANDLER;
inContext:context_]; }
} else
NS_ENDHANDLER; {
} [_checked setValue:checkedValue
else inComponent:component];
{ };
[checked setValue:_checkedValue };
inComponent:_component]; };
}; };
};
};
};
LOGObjectFnStopC("GSWCheckBox"); LOGObjectFnStopC("GSWCheckBox");
}; };

View file

@ -1,11 +1,16 @@
/* GSWCheckBoxList.h - GSWeb: Class GSWCheckBoxList /** GSWCheckBoxList.h - <title>GSWeb: Class GSWCheckBoxList</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,22 +35,22 @@
//==================================================================== //====================================================================
@interface GSWCheckBoxList: GSWInput @interface GSWCheckBoxList: GSWInput
{ {
GSWAssociation* list; GSWAssociation* _list;
GSWAssociation* item; GSWAssociation* _item;
GSWAssociation* index; GSWAssociation* _index;
GSWAssociation* selections; GSWAssociation* _selections;
GSWAssociation* prefix; GSWAssociation* _prefix;
GSWAssociation* suffix; GSWAssociation* _suffix;
GSWAssociation* displayString; GSWAssociation* _displayString;
GSWAssociation* escapeHTML; GSWAssociation* _escapeHTML;
GSWAssociation* itemDisabled; GSWAssociation* _itemDisabled;
BOOL defaultEscapeHTML; BOOL _defaultEscapeHTML;
BOOL autoValue; BOOL _autoValue;
}; };
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(void)dealloc; -(void)dealloc;
-(NSString*)description; -(NSString*)description;
@ -55,29 +61,31 @@
//==================================================================== //====================================================================
@interface GSWCheckBoxList (GSWCheckBoxListA) @interface GSWCheckBoxList (GSWCheckBoxListA)
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_
inContext:(GSWContext*)context_; -(void)_slowTakeValuesFromRequest:(GSWRequest*)request
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ inContext:(GSWContext*)context;
inContext:(GSWContext*)context_;
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context;
@end @end
//==================================================================== //====================================================================
@interface GSWCheckBoxList (GSWCheckBoxListB) @interface GSWCheckBoxList (GSWCheckBoxListB)
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
@end @end
//==================================================================== //====================================================================
@interface GSWCheckBoxList (GSWCheckBoxListC) @interface GSWCheckBoxList (GSWCheckBoxListC)
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping; withMapping:(char*)mapping;
-(BOOL)appendStringAtLeft:(id)_unkwnon -(BOOL)appendStringAtLeft:(id)unkwnon
withMapping:(char*)_mapping; withMapping:(char*)mapping;
-(BOOL)compactHTMLTags; -(BOOL)compactHTMLTags;
@end @end

View file

@ -1,11 +1,16 @@
/* GSWCheckBoxList.m - GSWeb: Class GSWCheckBoxList /** GSWCheckBoxList.m - <title>GSWeb: Class GSWCheckBoxList</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,79 +35,79 @@ static char rcsId[] = "$Id$";
@implementation GSWCheckBoxList @implementation GSWCheckBoxList
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements_
{ {
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_); NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements_=%@",aName,associations,elements_);
defaultEscapeHTML=1; _defaultEscapeHTML=1;
[_associations removeObjectForKey:list__Key]; [tmpAssociations removeObjectForKey:list__Key];
[_associations removeObjectForKey:item__Key]; [tmpAssociations removeObjectForKey:item__Key];
[_associations removeObjectForKey:index__Key]; [tmpAssociations removeObjectForKey:index__Key];
[_associations removeObjectForKey:prefix__Key]; [tmpAssociations removeObjectForKey:prefix__Key];
[_associations removeObjectForKey:suffix__Key]; [tmpAssociations removeObjectForKey:suffix__Key];
[_associations removeObjectForKey:selections__Key]; [tmpAssociations removeObjectForKey:selections__Key];
[_associations removeObjectForKey:displayString__Key]; [tmpAssociations removeObjectForKey:displayString__Key];
[_associations removeObjectForKey:disabled__Key]; [tmpAssociations removeObjectForKey:disabled__Key];
[_associations removeObjectForKey:escapeHTML__Key]; [tmpAssociations removeObjectForKey:escapeHTML__Key];
if ((self=[super initWithName:name_ if ((self=[super initWithName:aName
associations:_associations associations:tmpAssociations
contentElements:nil])) contentElements:nil]))
{ {
list = [[associations_ objectForKey:list__Key _list = [[associations objectForKey:list__Key
withDefaultObject:[list autorelease]] retain]; withDefaultObject:[_list autorelease]] retain];
NSDebugMLLog(@"gswdync",@"list=%@",list); NSDebugMLLog(@"gswdync",@"list=%@",_list);
item = [[associations_ objectForKey:item__Key _item = [[associations objectForKey:item__Key
withDefaultObject:[item autorelease]] retain]; withDefaultObject:[_item autorelease]] retain];
NSDebugMLLog(@"gswdync",@"item=%@",item); NSDebugMLLog(@"gswdync",@"item=%@",_item);
if (item && ![item isValueSettable]) if (_item && ![_item isValueSettable])
{ {
ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable"); ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable");
}; };
value = [[associations_ objectForKey:value__Key _value = [[associations objectForKey:value__Key
withDefaultObject:[value autorelease]] retain]; withDefaultObject:[_value autorelease]] retain];
NSDebugMLLog(@"gswdync",@"value=%@",value); NSDebugMLLog(@"gswdync",@"value=%@",_value);
index = [[associations_ objectForKey:index__Key _index = [[associations objectForKey:index__Key
withDefaultObject:[index autorelease]] retain]; withDefaultObject:[_index autorelease]] retain];
NSDebugMLLog(@"gswdync",@"index=%@",index); NSDebugMLLog(@"gswdync",@"index=%@",_index);
if (index && ![index isValueSettable]) if (_index && ![_index isValueSettable])
{ {
ExceptionRaise0(@"GSWCheckBox",@"'index' parameter must be settable"); ExceptionRaise0(@"GSWCheckBox",@"'index' parameter must be settable");
}; };
prefix = [[associations_ objectForKey:prefix__Key _prefix = [[associations objectForKey:prefix__Key
withDefaultObject:[prefix autorelease]] retain]; withDefaultObject:[_prefix autorelease]] retain];
NSDebugMLLog(@"gswdync",@"prefix=%@",prefix); NSDebugMLLog(@"gswdync",@"prefix=%@",_prefix);
suffix = [[associations_ objectForKey:suffix__Key _suffix = [[associations objectForKey:suffix__Key
withDefaultObject:[suffix autorelease]] retain]; withDefaultObject:[_suffix autorelease]] retain];
NSDebugMLLog(@"gswdync",@"suffix=%@",suffix); NSDebugMLLog(@"gswdync",@"suffix=%@",_suffix);
selections = [[associations_ objectForKey:selections__Key _selections = [[associations objectForKey:selections__Key
withDefaultObject:[selections autorelease]] retain]; withDefaultObject:[_selections autorelease]] retain];
NSDebugMLLog(@"gswdync",@"selections=%@",selections); NSDebugMLLog(@"gswdync",@"selections=%@",_selections);
if (![selections isValueSettable]) if (![_selections isValueSettable])
{ {
ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable"); ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable");
}; };
displayString = [[associations_ objectForKey:displayString__Key _displayString = [[associations objectForKey:displayString__Key
withDefaultObject:[displayString autorelease]] retain]; withDefaultObject:[_displayString autorelease]] retain];
NSDebugMLLog(@"gswdync",@"displayString=%@",displayString); NSDebugMLLog(@"gswdync",@"displayString=%@",_displayString);
itemDisabled = [[associations_ objectForKey:disabled__Key _itemDisabled = [[associations objectForKey:disabled__Key
withDefaultObject:[itemDisabled autorelease]] retain]; withDefaultObject:[_itemDisabled autorelease]] retain];
NSDebugMLLog(@"gswdync",@"itemDisabled=%@",itemDisabled); NSDebugMLLog(@"gswdync",@"itemDisabled=%@",_itemDisabled);
escapeHTML = [[associations_ objectForKey:escapeHTML__Key _escapeHTML = [[associations objectForKey:escapeHTML__Key
withDefaultObject:[escapeHTML autorelease]] retain]; withDefaultObject:[_escapeHTML autorelease]] retain];
NSDebugMLLog(@"gswdync",@"escapeHTML=%@",escapeHTML); NSDebugMLLog(@"gswdync",@"escapeHTML=%@",_escapeHTML);
}; };
LOGObjectFnStop(); LOGObjectFnStop();
return self; return self;
}; };
@ -109,15 +115,15 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(list); DESTROY(_list);
DESTROY(item); DESTROY(_item);
DESTROY(index); DESTROY(_index);
DESTROY(selections); DESTROY(_selections);
DESTROY(prefix); DESTROY(_prefix);
DESTROY(suffix); DESTROY(_suffix);
DESTROY(displayString); DESTROY(_displayString);
DESTROY(itemDisabled); DESTROY(_itemDisabled);
DESTROY(escapeHTML); DESTROY(_escapeHTML);
[super dealloc]; [super dealloc];
} }
@ -125,8 +131,8 @@ static char rcsId[] = "$Id$";
-(NSString*)description -(NSString*)description
{ {
return [NSString stringWithFormat:@"<%s %p>", return [NSString stringWithFormat:@"<%s %p>",
object_get_class_name(self), object_get_class_name(self),
(void*)self]; (void*)self];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -141,106 +147,105 @@ static char rcsId[] = "$Id$";
@implementation GSWCheckBoxList (GSWCheckBoxListA) @implementation GSWCheckBoxList (GSWCheckBoxListA)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
LOGObjectFnStartC("GSWCheckBoxList"); LOGObjectFnStartC("GSWCheckBoxList");
[self _slowTakeValuesFromRequest:request_ [self _slowTakeValuesFromRequest:request
inContext:context_]; inContext:context];
LOGObjectFnStopC("GSWCheckBoxList"); LOGObjectFnStopC("GSWCheckBoxList");
}; };
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_ -(void)_slowTakeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
BOOL _disabledInContext=NO; BOOL disabledInContext=NO;
LOGObjectFnStartC("GSWCheckBoxList"); LOGObjectFnStartC("GSWCheckBoxList");
[self resetAutoValue]; [self resetAutoValue];
_disabledInContext=[self disabledInContext:context_]; disabledInContext=[self disabledInContext:context];
if (!_disabledInContext) if (!disabledInContext)
{ {
if ([context_ _wasFormSubmitted]) if ([context _wasFormSubmitted])
{ {
GSWComponent* _component=[context_ component]; GSWComponent* component=[context component];
NSArray* _listValue=nil; NSArray* listValue=nil;
NSMutableArray* _selections=nil; NSMutableArray* selectionsValues=nil;
NSString* _name=nil; NSString* name=nil;
NSArray* _formValues=nil; NSArray* formValues=nil;
id _valueValue=nil; id valueValue=nil;
int i=0; int i=0;
_name=[self nameInContext:context_]; name=[self nameInContext:context];
NSDebugMLLog(@"gswdync",@"_name=%@",_name); NSDebugMLLog(@"gswdync",@"name=%@",name);
_formValues=[request_ formValuesForKey:_name]; formValues=[request formValuesForKey:name];
NSDebugMLLog(@"gswdync",@"_formValues=%@",_formValues); NSDebugMLLog(@"gswdync",@"formValues=%@",formValues);
_listValue=[list valueInComponent:_component]; listValue=[_list valueInComponent:component];
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'", @"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
list, _list,
_listValue, listValue,
[_listValue class]); [listValue class]);
NSDebugMLLog(@"gswdync",@"_listValue=%@",_listValue); NSDebugMLLog(@"gswdync",@"listValue=%@",listValue);
for(i=0;i<[_listValue count];i++) for(i=0;i<[listValue count];i++)
{ {
NSDebugMLLog(@"gswdync",@"item=%@",item); NSDebugMLLog(@"gswdync",@"item=%@",_item);
NSDebugMLLog(@"gswdync",@"index=%@",index); NSDebugMLLog(@"gswdync",@"index=%@",_index);
if (item) if (_item)
[item setValue:[_listValue objectAtIndex:i] [_item setValue:[listValue objectAtIndex:i]
inComponent:_component]; inComponent:component];
else if (index) else if (_index)
[index setValue:[NSNumber numberWithShort:i] [_index setValue:[NSNumber numberWithShort:i]
inComponent:_component]; inComponent:component];
NSDebugMLLog(@"gswdync",@"value=%@",value); NSDebugMLLog(@"gswdync",@"value=%@",_value);
_valueValue=[self valueInContext:context_]; valueValue=[self valueInContext:context];
NSDebugMLLog(@"gswdync",@"_valueValue=%@",_valueValue); NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (_valueValue) if (valueValue)
{ {
BOOL _found=[_formValues containsObject:_valueValue]; BOOL found=[formValues containsObject:valueValue];
NSDebugMLLog(@"gswdync",@"_found=%s",(_found ? "YES" : "NO")); NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO"));
if (_found) if (found)
{ {
if (!_selections) if (!selectionsValues)
_selections=[NSMutableArray array]; selectionsValues=[NSMutableArray array];
if(autoValue == NO) if(_autoValue == NO)
[_selections addObject:_valueValue]; [selectionsValues addObject:valueValue];
else else
[_selections [selectionsValues addObject:[listValue objectAtIndex:i]];
addObject:[_listValue objectAtIndex:i]];
}; };
}; };
}; };
NSDebugMLLog(@"gswdync",@"_component=%@",_component); NSDebugMLLog(@"gswdync",@"component=%@",component);
NSDebugMLLog(@"gswdync",@"_selections=%d",_selections); NSDebugMLLog(@"gswdync",@"selectionsValues=%d",selectionsValues);
NSDebugMLLog(@"gswdync",@"selections=%@",selections); NSDebugMLLog(@"gswdync",@"selections=%@",_selections);
GSWLogAssertGood(_component); GSWLogAssertGood(component);
if (!WOStrictFlag) if (!WOStrictFlag)
{ {
NS_DURING NS_DURING
{ {
[selections setValue:_selections [_selections setValue:selectionsValues
inComponent:_component]; inComponent:component];
}; };
NS_HANDLER NS_HANDLER
{ {
[self handleValidationException:localException [self handleValidationException:localException
inContext:context_]; inContext:context];
} }
NS_ENDHANDLER; NS_ENDHANDLER;
} }
else else
{ {
[selections setValue:_selections [_selections setValue:selectionsValues
inComponent:_component]; inComponent:component];
}; };
}; };
}; };
@ -248,96 +253,95 @@ static char rcsId[] = "$Id$";
}; };
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ -(void)_fastTakeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnStartC("GSWCheckBoxList"); LOGObjectFnStartC("GSWCheckBoxList");
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
LOGObjectFnStopC("GSWCheckBoxList"); LOGObjectFnStopC("GSWCheckBoxList");
}; };
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
GSWRequest* _request=nil; GSWRequest* request=nil;
BOOL _isFromClientComponent=NO; BOOL isFromClientComponent=NO;
NSString* _name=nil; NSString* name=nil;
GSWComponent* _component=nil; GSWComponent* component=nil;
NSArray* _selectionsValue=nil; NSArray* selectionsValue=nil;
BOOL _isEqual=NO; BOOL isEqual=NO;
LOGObjectFnStartC("GSWCheckBoxList"); LOGObjectFnStartC("GSWCheckBoxList");
[self resetAutoValue]; [self resetAutoValue];
autoValue = NO; _autoValue = NO;
_request=[context_ request]; request=[context request];
_isFromClientComponent=[_request isFromClientComponent]; isFromClientComponent=[request isFromClientComponent];
_name=[self nameInContext:context_]; name=[self nameInContext:context];
_component=[context_ component]; component=[context component];
_selectionsValue=[selections valueInComponent:_component]; selectionsValue=[_selections valueInComponent:component];
if (_selectionsValue && ![_selectionsValue isKindOfClass:[NSArray class]]) if (selectionsValue && ![selectionsValue isKindOfClass:[NSArray class]])
{ {
ExceptionRaise(@"GSWCheckBoxList", ExceptionRaise(@"GSWCheckBoxList",
@"GSWCheckBoxList: selections is not a NSArray: %@ %@", @"GSWCheckBoxList: selections is not a NSArray: %@ %@",
_selectionsValue, selectionsValue,
[_selectionsValue class]); [selectionsValue class]);
} }
else else
{ {
int i=0; int i=0;
id _displayStringValue=nil; id displayStringValue=nil;
id _prefixValue=nil; id prefixValue=nil;
id _suffixValue=nil; id suffixValue=nil;
id _valueValue=nil; id valueValue=nil;
BOOL _disableValue=NO; BOOL disableValue=NO;
NSArray* _listValue=[list valueInComponent:_component]; NSArray* listValue=[_list valueInComponent:component];
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'", @"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
list, _list,
_listValue, listValue,
[_listValue class]); [listValue class]);
for(i=0;i<[_listValue count];i++) for(i=0;i<[listValue count];i++)
{ {
[item setValue:[_listValue objectAtIndex:i] [_item setValue:[listValue objectAtIndex:i]
inComponent:_component]; inComponent:component];
_prefixValue=[prefix valueInComponent:_component]; prefixValue=[_prefix valueInComponent:component];
_suffixValue=[suffix valueInComponent:_component]; suffixValue=[_suffix valueInComponent:component];
_disableValue=[itemDisabled valueInComponent:_component]; disableValue=[_itemDisabled valueInComponent:component];
[index setValue:[NSNumber numberWithShort:i] [_index setValue:[NSNumber numberWithShort:i]
inComponent:_component]; inComponent:component];
_displayStringValue=[displayString valueInComponent:_component]; displayStringValue=[_displayString valueInComponent:component];
[response_ appendContentString:@"<INPUT NAME=\""]; [response appendContentString:@"<INPUT NAME=\""];
[response_ appendContentString:_name]; [response appendContentString:name];
[response_ appendContentString:@"\" TYPE=checkbox VALUE=\""]; [response appendContentString:@"\" TYPE=checkbox VALUE=\""];
_valueValue = [self valueInContext:context_]; valueValue = [self valueInContext:context];
[response_ appendContentHTMLAttributeValue:_valueValue]; [response appendContentHTMLAttributeValue:valueValue];
[response_ appendContentCharacter:'"']; [response appendContentCharacter:'"'];
//TODOV //TODOV
if(value) if(_value)
_isEqual = [_selectionsValue containsObject:_valueValue]; isEqual = [selectionsValue containsObject:valueValue];
else else
{ {
_isEqual = [_selectionsValue isEqual = [selectionsValue containsObject:[listValue objectAtIndex:i]];
containsObject:[_listValue objectAtIndex:i]];
autoValue = YES; _autoValue = YES;
} }
if(_isEqual) if(isEqual)
[response_ appendContentString:@"\" CHECKED"]; [response appendContentString:@"\" CHECKED"];
if (_disableValue) if (disableValue)
[response_ appendContentString:@"\" DISABLED"]; [response appendContentString:@"\" DISABLED"];
[response_ appendContentCharacter:'>']; [response appendContentCharacter:'>'];
[response_ appendContentString:_prefixValue]; [response appendContentString:prefixValue];
[response_ appendContentHTMLString:_displayStringValue]; [response appendContentHTMLString:displayStringValue];
[response_ appendContentString:_suffixValue]; [response appendContentString:suffixValue];
}; };
}; };
LOGObjectFnStopC("GSWCheckBoxList"); LOGObjectFnStopC("GSWCheckBoxList");
@ -347,8 +351,8 @@ static char rcsId[] = "$Id$";
//==================================================================== //====================================================================
@implementation GSWCheckBoxList (GSWCheckBoxListB) @implementation GSWCheckBoxList (GSWCheckBoxListB)
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
}; };
@ -358,14 +362,14 @@ static char rcsId[] = "$Id$";
//==================================================================== //====================================================================
@implementation GSWCheckBoxList (GSWCheckBoxListC) @implementation GSWCheckBoxList (GSWCheckBoxListC)
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)_unkwnon
withMapping:(char*)_mapping withMapping:(char*)_mapping
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return NO; return NO;
}; };
-(BOOL)appendStringAtLeft:(id)_unkwnon -(BOOL)appendStringAtLeft:(id)_unkwnon
withMapping:(char*)_mapping withMapping:(char*)_mapping
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return NO; return NO;

View file

@ -143,6 +143,7 @@
- (unsigned)indexOfFirstDisplayedObject; - (unsigned)indexOfFirstDisplayedObject;
- (unsigned)indexOfLastDisplayedObject; - (unsigned)indexOfLastDisplayedObject;
- (id)init; - (id)init;
- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver*)unarchiver;
- (void)awakeFromKeyValueUnarchiver:(EOKeyValueUnarchiver*)object_; - (void)awakeFromKeyValueUnarchiver:(EOKeyValueUnarchiver*)object_;
- (NSMutableDictionary *)inputObjectForQualifier; - (NSMutableDictionary *)inputObjectForQualifier;
- (BOOL)inQueryMode; - (BOOL)inQueryMode;
@ -191,6 +192,7 @@
- (void)setFetchesOnLoad:(BOOL)flag; - (void)setFetchesOnLoad:(BOOL)flag;
- (void)setInQueryMode:(BOOL)flag; - (void)setInQueryMode:(BOOL)flag;
- (void)setInsertedObjectDefaultValues:(NSDictionary *)defaultValues; - (void)setInsertedObjectDefaultValues:(NSDictionary *)defaultValues;
-(void)setQueryOperator:(NSDictionary*)qo;
- (void)setLocalKeys:(NSArray *)keys; - (void)setLocalKeys:(NSArray *)keys;
- (void)setMasterObject:(id)masterObject; - (void)setMasterObject:(id)masterObject;
- (void)setNumberOfObjectsPerBatch:(unsigned)count; - (void)setNumberOfObjectsPerBatch:(unsigned)count;

View file

@ -46,7 +46,9 @@ static char rcsId[] = "$Id$";
_queryMatch = [[NSMutableDictionary alloc] initWithCapacity:8]; _queryMatch = [[NSMutableDictionary alloc] initWithCapacity:8];
_queryMin = [[NSMutableDictionary alloc] initWithCapacity:8]; _queryMin = [[NSMutableDictionary alloc] initWithCapacity:8];
_queryMax = [[NSMutableDictionary alloc] initWithCapacity:8]; _queryMax = [[NSMutableDictionary alloc] initWithCapacity:8];
NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator);
_queryOperator = [[NSMutableDictionary alloc] initWithCapacity:8]; _queryOperator = [[NSMutableDictionary alloc] initWithCapacity:8];
NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator);
_queryBindings = [[NSMutableDictionary alloc] initWithCapacity:8]; _queryBindings = [[NSMutableDictionary alloc] initWithCapacity:8];
@ -123,8 +125,9 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
[unarchiver decodeObjectForKey:@"formatForLikeQualifier"]]; [unarchiver decodeObjectForKey:@"formatForLikeQualifier"]];
[self setInsertedObjectDefaultValues: [self setInsertedObjectDefaultValues:
[unarchiver decodeObjectForKey:@"insertedObjectDefaultValues"]]; [unarchiver decodeObjectForKey:@"insertedObjectDefaultValues"]];
[self setQueryOperator:[unarchiver decodeObjectForKey:@"queryOperator"]];
[self finishInitialization]; [self finishInitialization];
NSDebugMLLog(@"gswdisplaygroup",@"GSWDisplayGroup %p : %@",self,self);
LOGObjectFnStop(); LOGObjectFnStop();
}; };
return self; return self;
@ -159,6 +162,8 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
_defaultStringMatchFormat]; _defaultStringMatchFormat];
_dscr=[_dscr stringByAppendingFormat:@"insertedObjectDefaultValues:[%@]\n", _dscr=[_dscr stringByAppendingFormat:@"insertedObjectDefaultValues:[%@]\n",
_insertedObjectDefaultValues]; _insertedObjectDefaultValues];
_dscr=[_dscr stringByAppendingFormat:@"queryOperator:[%@]\n",
_queryOperator];
return _dscr; return _dscr;
}; };
@ -269,6 +274,7 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
NSString* fvalue=value; NSString* fvalue=value;
//VERIFY!! //VERIFY!!
NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator);
op = [_queryOperator objectForKey:key]; op = [_queryOperator objectForKey:key];
NSDebugMLLog(@"gswdisplaygroup",@"op=%@",op); NSDebugMLLog(@"gswdisplaygroup",@"op=%@",op);
if(op) if(op)
@ -281,7 +287,7 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
if (_defaultStringMatchFormat) if (_defaultStringMatchFormat)
fvalue=[NSString stringWithFormat:_defaultStringMatchFormat, fvalue=[NSString stringWithFormat:_defaultStringMatchFormat,
value];//VERIFY !!! value];//VERIFY !!!
NSDebugMLLog(@"gswdisplaygroup",@"fvalue=%@",fvalue); NSDebugMLLog(@"gswdisplaygroup",@"fvalue=%@",fvalue);
qualifier=[[[EOKeyValueQualifier alloc] qualifier=[[[EOKeyValueQualifier alloc]
initWithKey:key initWithKey:key
@ -955,11 +961,12 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// hasMultipleBatches /** returns YES if the displayGroup paginates display (batchCount>1), false otherwise **/
- (BOOL)hasMultipleBatches - (BOOL)hasMultipleBatches
{ {
return !_flags.fetchAll; //return !_flags.fetchAll;
return ([self batchCount]>1);
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -1759,6 +1766,18 @@ self setSelectionIndexes:indexes of objects in objects? //ret 1
LOGObjectFnStop(); LOGObjectFnStop();
} }
//--------------------------------------------------------------------
/** sets query operators **/
-(void)setQueryOperator:(NSDictionary*)qo
{
NSAssert1((!qo || [qo isKindOfClass:[NSDictionary class]]),
@"queryOperator is not a dictionary but a %@",
[qo class]);
[_queryOperator removeAllObjects];
if (qo)
[_queryOperator addEntriesFromDictionary:qo];
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// setMasterObject: // setMasterObject:

View file

@ -1,11 +1,16 @@
/* GSWDynamicElement.h - GSWeb: Class GSWDynamicElement /** GSWDynamicElement.h - <title>GSWeb: Class GSWDynamicElement</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -33,16 +39,16 @@
NSString* _definitionName; // Name of element in def file (.gswd) - Mainly for debugging purpose NSString* _definitionName; // Name of element in def file (.gswd) - Mainly for debugging purpose
}; };
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
template:(GSWElement*)template_; template:(GSWElement*)template;
-(NSString*)definitionName; -(NSString*)definitionName;
-(void)setDefinitionName:(NSString*)definitionName; -(void)setDefinitionName:(NSString*)definitionName;
@end @end
//==================================================================== //====================================================================
@interface GSWDynamicElement (GSWDynamicElement) @interface GSWDynamicElement (GSWDynamicElement)
-(BOOL)evaluateCondition:(id)condition_ -(BOOL)evaluateCondition:(id)condition
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
@end @end
#endif //_GSWDynamicElement_h__ #endif //_GSWDynamicElement_h__

View file

@ -1,11 +1,16 @@
/* GSWDynamicElement.m - GSWeb: Class GSWDynamicElement /** GSWDynamicElement.m - <title>GSWeb: Class GSWDynamicElement</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -32,14 +38,14 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// initWithName:associations:template: // initWithName:associations:template:
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
template:(GSWElement*)template_ template:(GSWElement*)template
{ {
//OK //OK
if ((self=[super init])) if ((self=[super init]))
{ {
}; };
return self; return self;
}; };
@ -62,9 +68,11 @@ static char rcsId[] = "$Id$";
-(void)setDefinitionName:(NSString*)definitionName -(void)setDefinitionName:(NSString*)definitionName
{ {
NSDebugMLLog(@"gswdync",@"setDefinitionName1 in %p: %p %@",self,definitionName,definitionName); NSDebugMLLog(@"gswdync",@"setDefinitionName1 in %p: %p %@",
self,definitionName,definitionName);
ASSIGN(_definitionName,definitionName); ASSIGN(_definitionName,definitionName);
NSDebugMLLog(@"gswdync",@"setDefinitionName2 in %p: %p %@",self,_definitionName,_definitionName); NSDebugMLLog(@"gswdync",@"setDefinitionName2 in %p: %p %@",
self,_definitionName,_definitionName);
}; };
@end @end
@ -72,30 +80,30 @@ static char rcsId[] = "$Id$";
@implementation GSWDynamicElement (GSWDynamicElement) @implementation GSWDynamicElement (GSWDynamicElement)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(BOOL)evaluateCondition:(id)condition_ -(BOOL)evaluateCondition:(id)condition
inContext:(GSWContext*)_context inContext:(GSWContext*)context
{ {
//OK //OK
BOOL _result=NO; BOOL result=NO;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"condition_=%@", NSDebugMLLog(@"gswdync",@"condition_=%@",
condition_); condition);
if (condition_) if (condition)
{ {
GSWComponent* _component=[_context component]; GSWComponent* component=[context component];
id _value=[condition_ valueInComponent:_component]; id value=[condition valueInComponent:component];
NSDebugMLLog(@"gswdync",@"_value=%@ class=%@",_value,[_value class]); NSDebugMLLog(@"gswdync",@"_value=%@ class=%@",value,[value class]);
#ifndef NDEBUG #ifndef NDEBUG
if ([_value respondsToSelector:@selector(unsignedCharValue)]) if ([value respondsToSelector:@selector(unsignedCharValue)])
{ {
NSDebugMLLog(@"gswdync",@"unsignedCharValue=%d",(int)[_value unsignedCharValue]); NSDebugMLLog(@"gswdync",@"unsignedCharValue=%d",(int)[value unsignedCharValue]);
}; };
#endif #endif
_result=boolValueWithDefaultFor(_value,YES); result=boolValueWithDefaultFor(value,YES);
}; };
NSDebugMLLog(@"gswdync",@"result=%s", NSDebugMLLog(@"gswdync",@"result=%s",
(_result ? "YES" : "NO")); (result ? "YES" : "NO"));
LOGObjectFnStop(); LOGObjectFnStop();
return _result; return result;
}; };
@end @end

View file

@ -28,7 +28,7 @@
//==================================================================== //====================================================================
@interface GSWDynamicURLString : NSObject <NSCoding,NSCopying,NSMutableString> @interface GSWDynamicURLString : NSObject <NSCoding,NSCopying/*,NSMutableString*/>
{ {
NSMutableString* url; NSMutableString* url;
NSString* protocol;//NDFN NSString* protocol;//NDFN

View file

@ -1,11 +1,16 @@
/* GSWElement.h - GSWeb: Class GSWElement /** GSWElement.h - <title>GSWeb: Class GSWElement</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -41,12 +47,12 @@ extern BYTE ElementsMap_attributeElement;
#endif #endif
#ifndef NDEBBUG #ifndef NDEBBUG
-(void)saveAppendToResponseElementIDInContext:(id)context_; -(void)saveAppendToResponseElementIDInContext:(id)context;
-(void)assertCorrectElementIDInContext:(id)context_ -(void)assertCorrectElementIDInContext:(id)context
inCLass:(Class)class_ inCLass:(Class)class
method:(SEL)method_ method:(SEL)method
file:(const char*)file_ file:(const char*)file
line:(int)line_; line:(int)line;
#endif #endif
-(NSString*)definitionName; //return nil (for non dynamic element) -(NSString*)definitionName; //return nil (for non dynamic element)
@ -54,25 +60,26 @@ extern BYTE ElementsMap_attributeElement;
#ifdef NDEBBUG #ifdef NDEBBUG
#define GSWSaveAppendToResponseElementID(context_); {}; #define GSWSaveAppendToResponseElementID(context_); {};
#define GSWAssertCorrectElementID(context_); {}; #define GSWAssertCorrectElementID(context_); {};
#else #else
#define GSWSaveAppendToResponseElementID(context_); [self saveAppendToResponseElementIDInContext:context_]; #define GSWSaveAppendToResponseElementID(context_); [self saveAppendToResponseElementIDInContext:context_];
#define GSWAssertCorrectElementID(context_); ([self assertCorrectElementIDInContext:context_ inCLass:[self class] method:_cmd file:__FILE__ line:__LINE__]); #define GSWAssertCorrectElementID(context_); \
([self assertCorrectElementIDInContext:context_ inCLass:[self class] method:_cmd file:__FILE__ line:__LINE__]);
#endif #endif
//==================================================================== //====================================================================
@interface GSWElement (GSWRequestHandling) @interface GSWElement (GSWRequestHandling)
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(BOOL)prefixMatchSenderIDInContext:(GSWContext*)context_; -(BOOL)prefixMatchSenderIDInContext:(GSWContext*)context;
@end @end
#endif //_GSWElement_h__ #endif //_GSWElement_h__

View file

@ -1,11 +1,16 @@
/* GSWElement.m - GSWeb: Class GSWElement /** GSWElement.m - <title>GSWeb: Class GSWElement</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@sbuilders.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -34,42 +40,42 @@ BYTE ElementsMap_attributeElement = (BYTE)0x41;
@implementation GSWElement @implementation GSWElement
#ifndef NDEBBUG #ifndef NDEBBUG
-(void)saveAppendToResponseElementIDInContext:(id)context_ -(void)saveAppendToResponseElementIDInContext:(id)context
{ {
NSString* _elementID=[context_ elementID]; NSString* elementID=[context elementID];
ASSIGN(_appendToResponseElementID,_elementID); ASSIGN(_appendToResponseElementID,elementID);
}; };
-(void)assertCorrectElementIDInContext:(id)context_ -(void)assertCorrectElementIDInContext:(id)context
inCLass:(Class)class_ inCLass:(Class)class
method:(SEL)method_ method:(SEL)method
file:(const char*)file_ file:(const char*)file
line:(int)line_ line:(int)line
{ {
if ([_appendToResponseElementID length]>0) if ([_appendToResponseElementID length]>0)
{ {
NSString* _elementID=[context_ elementID]; NSString* elementID=[context elementID];
BOOL _appendToResponseElementIDIsFirst=NO; BOOL appendToResponseElementIDIsFirst=NO;
BOOL _elementIDIsFirst=NO; BOOL elementIDIsFirst=NO;
BOOL _OK=YES; BOOL OK=YES;
_appendToResponseElementIDIsFirst=[_appendToResponseElementID length]==0 || [_appendToResponseElementID isEqualToString:@"0"]; appendToResponseElementIDIsFirst=([_appendToResponseElementID length]==0 || [_appendToResponseElementID isEqualToString:@"0"]);
_elementIDIsFirst=[_elementID length]==0 || [_elementID isEqualToString:@"0"]; elementIDIsFirst=([elementID length]==0 || [elementID isEqualToString:@"0"]);
if (_appendToResponseElementIDIsFirst!=_elementIDIsFirst) if (appendToResponseElementIDIsFirst!=elementIDIsFirst)
{ {
_OK=[_appendToResponseElementID isEqualToString:_elementID]; OK=[_appendToResponseElementID isEqualToString:elementID];
}; };
if (!_OK) if (!OK)
{ {
NSString* _msg=[NSString stringWithFormat:@"In Class %@ (file %s line %d), id %@ in %@ is not the same than in appendToResponse %@", NSString* msg=[NSString stringWithFormat:@"In Class %@ (file %s line %d), id %@ in %@ is not the same than in appendToResponse %@",
NSStringFromClass(class_), NSStringFromClass(class),
file_, file,
line_, line,
[context_ elementID], [context elementID],
NSStringFromSelector(method_), NSStringFromSelector(method),
_appendToResponseElementID]; _appendToResponseElementID];
NSAssert1(_OK,@"%@",_msg); NSAssert1(OK,@"%@",msg);
}; };
}; };
}; };
#endif #endif
@ -85,21 +91,22 @@ BYTE ElementsMap_attributeElement = (BYTE)0x41;
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// takeValuesFromRequest:inContext: // takeValuesFromRequest:inContext:
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
GSWAssertCorrectElementID(context_);// Debug Only GSWAssertCorrectElementID(context);// Debug Only
//Does Nothing //Does Nothing
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// invokeActionForRequest:inContext: // invokeActionForRequest:inContext:
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@",[self class],[context_ elementID],[context_ senderID]); NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@",
GSWAssertCorrectElementID(context_);// Debug Only [self class],[context elementID],[context senderID]);
GSWAssertCorrectElementID(context);// Debug Only
//Does Nothing //Does Nothing
return nil; return nil;
}; };
@ -107,22 +114,22 @@ BYTE ElementsMap_attributeElement = (BYTE)0x41;
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// appendToResponse:inContext: // appendToResponse:inContext:
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
GSWSaveAppendToResponseElementID(context_);//Debug Only GSWSaveAppendToResponseElementID(context);//Debug Only
//Does Nothing //Does Nothing
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
//NDFN //NDFN
-(BOOL)prefixMatchSenderIDInContext:(GSWContext*)context_ -(BOOL)prefixMatchSenderIDInContext:(GSWContext*)context
{ {
NSString* _senderID=[context_ senderID]; NSString* senderID=[context senderID];
NSString* _elementID=[context_ elementID]; NSString* elementID=[context elementID];
NSDebugMLLog(@"gswdync",@"_senderID=%@",_senderID); NSDebugMLLog(@"gswdync",@"senderID=%@",senderID);
NSDebugMLLog(@"gswdync",@"_elementID=%@",_elementID); NSDebugMLLog(@"gswdync",@"elementID=%@",elementID);
return ([_elementID hasPrefix:_senderID] || [_senderID hasPrefix:_elementID]); return ([elementID hasPrefix:senderID] || [senderID hasPrefix:elementID]);
}; };
@end @end

View file

@ -1,11 +1,16 @@
/* GSWElementIDString.h - GSWeb: Class GSWElementIDString /** GSWElementIDString.h - <title>GSWeb: Class GSWElementIDString</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Feb 1999 Date: Feb 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -33,19 +39,19 @@
NSMutableString* _string; NSMutableString* _string;
}; };
- (id) init; -(id)init;
- (id) initWithCharactersNoCopy: (unichar*)chars -(id)initWithCharactersNoCopy:(unichar*)chars
length: (unsigned)length length:(unsigned)length
freeWhenDone: (BOOL)flag; freeWhenDone:(BOOL)flag;
- (id) initWithCStringNoCopy: (char*)byteString -(id)initWithCStringNoCopy:(char*)byteString
length: (unsigned)length length:(unsigned)length
freeWhenDone: (BOOL)flag; freeWhenDone:(BOOL)flag;
- (id) initWithCapacity: (unsigned)capacity; -(id)initWithCapacity:(unsigned)capacity;
- (unsigned) length; -(unsigned)length;
- (unichar) characterAtIndex: (unsigned)index; -(unichar)characterAtIndex:(unsigned)index;
- (void) replaceCharactersInRange: (NSRange)range -(void)replaceCharactersInRange:(NSRange)range
withString: (NSString*)aString; withString:(NSString*)aString;
-(BOOL)canBeConvertedToEncoding:(NSStringEncoding)encoding; -(BOOL)canBeConvertedToEncoding:(NSStringEncoding)encoding;
-(void)dealloc; -(void)dealloc;
-(void)getCString:(char*)buffer -(void)getCString:(char*)buffer

View file

@ -1,11 +1,16 @@
/* GSWElementIDString.m - GSWeb: Class GSWElementIDString /** GSWElementIDString.m - <title>GSWeb: Class GSWElementIDString</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -300,24 +306,22 @@ static char rcsId[] = "$Id$";
{ {
NSArray* ids=nil; NSArray* ids=nil;
LOGObjectFnStart(); LOGObjectFnStart();
// NSDebugMLLog(@"low",@"self:%@",self);
if ([self length]>0) if ([self length]>0)
{ {
ids=[self componentsSeparatedByString:@"."]; ids=[self componentsSeparatedByString:@"."];
NSAssert([ids count]>0,@"PROBLEM"); NSAssert([ids count]>0,@"PROBLEM");
if ([ids count]==1) if ([ids count]==1)
[self setString:@""]; [self setString:@""];
else else
{ {
[self setString:[[ids subarrayWithRange:NSMakeRange(0,[ids count]-1)] [self setString:[[ids subarrayWithRange:NSMakeRange(0,[ids count]-1)]
componentsJoinedByString:@"."]]; componentsJoinedByString:@"."]];
}; };
} }
else else
{ {
ExceptionRaise0(@"GSWElementIDString",@"Can't deleteLastElementIDComponent of an empty ElementID String"); ExceptionRaise0(@"GSWElementIDString",@"Can't deleteLastElementIDComponent of an empty ElementID String");
}; };
NSDebugMLLog(@"low",@"self:%@",self);
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -326,25 +330,20 @@ static char rcsId[] = "$Id$";
{ {
NSArray* ids=nil; NSArray* ids=nil;
LOGObjectFnStart(); LOGObjectFnStart();
// NSDebugMLLog(@"low",@"self:%@",self);
ids=[self componentsSeparatedByString:@"."]; ids=[self componentsSeparatedByString:@"."];
if (ids && [ids count]>0) if (ids && [ids count]>0)
{ {
NSString* _last=[ids lastObject]; NSString* _last=[ids lastObject];
NSString* _new=nil; NSString* _new=nil;
NSDebugMLLog(@"low",@"_last:%@",_last); _last=[NSString stringWithFormat:@"%d",([_last intValue]+1)];
_last=[NSString stringWithFormat:@"%d",([_last intValue]+1)]; if ([ids count]>1)
NSDebugMLLog(@"low",@"_last:%@",_last); _new=[[[ids subarrayWithRange:NSMakeRange(0,[ids count]-1)]
NSDebugMLLog(@"low",@"ids count:%d",[ids count]); componentsJoinedByString:@"."]
if ([ids count]>1) stringByAppendingFormat:@".%@",_last];
_new=[[[ids subarrayWithRange:NSMakeRange(0,[ids count]-1)] else
componentsJoinedByString:@"."] _new=_last;
stringByAppendingFormat:@".%@",_last]; [self setString:_new];
else };
_new=_last;
[self setString:_new];
};
NSDebugMLLog(@"low",@"self:%@",self);
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -352,12 +351,10 @@ static char rcsId[] = "$Id$";
-(void)appendZeroElementIDComponent -(void)appendZeroElementIDComponent
{ {
LOGObjectFnStart(); LOGObjectFnStart();
// NSDebugMLLog(@"low",@"self:%@",self);
if ([self length]>0) if ([self length]>0)
[self appendString:@".0"]; [self appendString:@".0"];
else else
[self setString:@"0"]; [self setString:@"0"];
NSDebugMLLog(@"low",@"self:%@",self);
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -365,13 +362,10 @@ static char rcsId[] = "$Id$";
-(void)appendElementIDComponent:(id)_element -(void)appendElementIDComponent:(id)_element
{ {
LOGObjectFnStart(); LOGObjectFnStart();
// NSDebugMLLog(@"low",@"self:%@",self);
// NSDebugMLLog(@"low",@"_element:%@",_element);
if (self && [self length]>0) if (self && [self length]>0)
[self appendFormat:@".%@",_element]; [self appendFormat:@".%@",_element];
else else
[self setString:_element]; [self setString:_element];
NSDebugMLLog(@"low",@"self:%@",self);
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -381,7 +375,7 @@ static char rcsId[] = "$Id$";
{ {
GSWElementIDString* _id=[[self copy] autorelease]; GSWElementIDString* _id=[[self copy] autorelease];
if ([self length]>0) if ([self length]>0)
[_id deleteLastElementIDComponent]; [_id deleteLastElementIDComponent];
return _id; return _id;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View file

@ -1,11 +1,16 @@
/* GSWFileUpload.h - GSWeb: Class GSWFileUpload /** GSWFileUpload.h - <title>GSWeb: Class GSWFileUpload</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Sept 1999 Date: Sept 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,13 +35,13 @@
//==================================================================== //====================================================================
@interface GSWFileUpload: GSWInput @interface GSWFileUpload: GSWInput
{ {
GSWAssociation* data; GSWAssociation* _data;
GSWAssociation* filepath; GSWAssociation* _filepath;
}; };
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(void)dealloc; -(void)dealloc;
@ -43,12 +49,12 @@
//==================================================================== //====================================================================
@interface GSWFileUpload (GSWFileUploadA) @interface GSWFileUpload (GSWFileUploadA)
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
@end @end
#endif // _GSWFileUpload_h__ #endif // _GSWFileUpload_h__

View file

@ -1,11 +1,16 @@
/* GSWFileUpload.h - GSWeb: Class GSWFileUpload /** GSWFileUpload.m - <title>GSWeb: Class GSWFileUpload</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Sep 1999 Date: Sep 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,39 +35,40 @@ static char rcsId[] = "$Id$";
@implementation GSWFileUpload @implementation GSWFileUpload
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
LOGObjectFnStartC("GSWFileUpload"); LOGObjectFnStartC("GSWFileUpload");
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_); NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements_=%@",
[_associations setObject:[GSWAssociation associationWithValue:@"file"] aName,associations,elements);
forKey:@"type"]; [tmpAssociations setObject:[GSWAssociation associationWithValue:@"file"]
[_associations removeObjectForKey:data__Key]; forKey:@"type"];
[_associations removeObjectForKey:filePath__Key]; [tmpAssociations removeObjectForKey:data__Key];
if ((self=[super initWithName:name_ [tmpAssociations removeObjectForKey:filePath__Key];
associations:_associations if ((self=[super initWithName:aName
contentElements:nil])) //No Childs! associations:tmpAssociations
{ contentElements:nil])) //No Childs!
data = [[associations_ objectForKey:data__Key {
withDefaultObject:[data autorelease]] retain]; _data = [[associations objectForKey:data__Key
NSDebugMLLog(@"gswdync",@"GSWFileUpload: data=%@",data); withDefaultObject:[_data autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWFileUpload: data=%@",_data);
if (!data || ![data isValueSettable]) if (!_data || ![_data isValueSettable])
{ {
//TODO //TODO
}; };
filepath = [[associations_ objectForKey:filePath__Key _filepath = [[associations objectForKey:filePath__Key
withDefaultObject:[filepath autorelease]] retain]; withDefaultObject:[_filepath autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWFileUpload: filepath=%@",filepath); NSDebugMLLog(@"gswdync",@"GSWFileUpload: filepath=%@",_filepath);
if (!filepath || ![filepath isValueSettable]) if (!_filepath || ![_filepath isValueSettable])
{ {
//TODO //TODO
}; };
}; };
LOGObjectFnStopC("GSWFileUpload"); LOGObjectFnStopC("GSWFileUpload");
return self; return self;
}; };
@ -70,8 +77,8 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(data); DESTROY(_data);
DESTROY(filepath); DESTROY(_filepath);
[super dealloc]; [super dealloc];
}; };
@ -80,126 +87,130 @@ static char rcsId[] = "$Id$";
@implementation GSWFileUpload (GSWFileUploadA) @implementation GSWFileUpload (GSWFileUploadA)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
[super appendToResponse:response_ [super appendToResponse:response
inContext:context_]; inContext:context];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
GSWAssertCorrectElementID(context_);// Debug Only GSWAssertCorrectElementID(context);// Debug Only
//Bypass GSWInput //Bypass GSWInput
return nil; return nil;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
BOOL _disabled=NO; BOOL disabledValue=NO;
LOGObjectFnStartC("GSWFileUpload"); LOGObjectFnStartC("GSWFileUpload");
GSWAssertCorrectElementID(context_);// Debug Only GSWAssertCorrectElementID(context);// Debug Only
_disabled=[self disabledInContext:context_]; disabledValue=[self disabledInContext:context];
if (!_disabled) if (!disabledValue)
{ {
BOOL _wasFormSubmitted=[context_ _wasFormSubmitted]; BOOL wasFormSubmitted=[context _wasFormSubmitted];
if (_wasFormSubmitted) if (wasFormSubmitted)
{ {
GSWComponent* _component=nil; GSWComponent* component=nil;
NSString* _nameInContext=nil; NSString* nameInContext=nil;
NSArray* _fileDatas=nil; NSArray* fileDatas=nil;
NSString* fileNameFormValueName=nil; NSString* fileNameFormValueName=nil;
NSString* _fileName=nil; NSString* fileNameValue=nil;
NSData* _data=nil; NSData* dataValue=nil;
int _fileDatasCount=0; int fileDatasCount=0;
NS_DURING NS_DURING
{ {
_component=[context_ component]; component=[context component];
_nameInContext=[self nameInContext:context_]; nameInContext=[self nameInContext:context];
NSDebugMLLog(@"gswdync",@"_nameInContext=%@",_nameInContext); NSDebugMLLog(@"gswdync",@"nameInContext=%@",nameInContext);
_fileDatas=[request_ formValuesForKey:_nameInContext]; fileDatas=[request formValuesForKey:nameInContext];
NSDebugMLLog(@"gswdync",@"_value=%@",_fileDatas); NSDebugMLLog(@"gswdync",@"value=%@",fileDatas);
_fileDatasCount=[_fileDatas count]; fileDatasCount=[fileDatas count];
/* /*
if (_fileDatasCount!=1) if (_fileDatasCount!=1)
{ {
ExceptionRaise(@"GSWFileUpload", ExceptionRaise(@"GSWFileUpload",
@"GSWFileUpload: File Data Nb != 1 :%d", @"GSWFileUpload: File Data Nb != 1 :%d",
_fileDatasCount); _fileDatasCount);
}; };
*/ */
if (_fileDatasCount==1) { if (fileDatasCount==1)
{
_data=[_fileDatas objectAtIndex:0]; dataValue=[fileDatas objectAtIndex:0];
NSDebugMLLog(@"gswdync",@"_data (class=%@)=%@",[_data class],_data); NSDebugMLLog(@"gswdync",@"dataValue (class=%@)=%@",
if (_data) [dataValue class],dataValue);
{ if (dataValue)
if ([_data isKindOfClass:[NSData class]]) {
{ if ([dataValue isKindOfClass:[NSData class]])
if ([_data length]==0) {
{ if ([dataValue length]==0)
LOGError(@"Empty Data: %@",_data); {
}; LOGError(@"Empty Data: %@",dataValue);
} };
else }
{ else
if ([_data isKindOfClass:[NSString class]] && [_data length]==0) {
{ if ([dataValue isKindOfClass:[NSString class]] && [dataValue length]==0)
LOGError(@"No Data: %@",_data); {
_data=nil; LOGError(@"No Data: %@",dataValue);
} dataValue=nil;
else }
{ else
NSLog(@"content type request : %@",[request_ _contentType]); {
NSLog(@"data class = %@",NSStringFromClass([_data class])); NSLog(@"content type request : %@",[request _contentType]);
/*if (![_data isMemberOfClass:[NSString class]]) { NSLog(@"data class = %@",NSStringFromClass([dataValue class]));
ExceptionRaise(@"GSWFileUpload", /*if (![dataValue isMemberOfClass:[NSString class]]) {
@"GSWFileUpload: bad data :%@", ExceptionRaise(@"GSWFileUpload",
_data); @"GSWFileUpload: bad data :%@",
_data=nil; dataValue);
}*/ dataValue=nil;
}; }*/
}; };
} };
else }
{ else
LOGError0(@"No Data:"); {
}; LOGError0(@"No Data:");
fileNameFormValueName=[NSString stringWithFormat:@"%@.filename",_nameInContext]; };
NSDebugMLLog(@"gswdync",@"fileNameFormValueName=%@",fileNameFormValueName); fileNameFormValueName=[NSString stringWithFormat:@"%@.filename",nameInContext];
_fileName=[request_ formValueForKey:fileNameFormValueName]; NSDebugMLLog(@"gswdync",@"fileNameFormValueName=%@",fileNameFormValueName);
NSDebugMLLog(@"gswdync",@"_fileName=%@",_fileName); fileNameValue=[request formValueForKey:fileNameFormValueName];
if (!_fileName || [_fileName length]==0) NSDebugMLLog(@"gswdync",@"fileNameValue=%@",fileNameValue);
{ if (!fileNameValue || [fileNameValue length]==0)
LOGError(@"No fileName: %@",_fileName); {
}; LOGError(@"No fileName: %@",fileNameValue);
[filepath setValue:_fileName };
inComponent:_component]; [_filepath setValue:fileNameValue
[data setValue:_data inComponent:component];
inComponent:_component]; [_data setValue:dataValue
} else { inComponent:component];
// bug in omniweb-browser if you click cancel in FileOpenPanel, it transmits incorrect datas }
else
[filepath setValue:nil {
inComponent:_component]; // bug in omniweb-browser if you click cancel in FileOpenPanel, it transmits incorrect datas
[data setValue:nil
inComponent:_component]; [_filepath setValue:nil
inComponent:component];
[_data setValue:nil
inComponent:component];
} }
} }
NS_HANDLER NS_HANDLER
{ {
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"GSWFileUpload in takeValuesFromRequest"); localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
LOGException(@"%@ (%@)",localException,[localException reason]); @"GSWFileUpload in takeValuesFromRequest");
[localException raise]; LOGException(@"%@ (%@)",localException,[localException reason]);
}; [localException raise];
NS_ENDHANDLER; };
}; NS_ENDHANDLER;
}; };
};
LOGObjectFnStopC("GSWFileUpload"); LOGObjectFnStopC("GSWFileUpload");
}; };
@end @end

View file

@ -1,11 +1,16 @@
/* GSWFrame.h - GSWeb: Class GSWFrame /** GSWFrame.h - <title>GSWeb: Class GSWFrame</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,9 +35,9 @@
//==================================================================== //====================================================================
@interface GSWFrame: GSWHTMLURLValuedElement @interface GSWFrame: GSWHTMLURLValuedElement
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(void)dealloc; -(void)dealloc;
-(NSString*)valueAttributeName; -(NSString*)valueAttributeName;
-(NSString*)urlAttributeName; -(NSString*)urlAttributeName;

View file

@ -1,11 +1,16 @@
/* GSWFrame.m - GSWeb: Class GSWFrame /** GSWFrame.m - <title>GSWeb: Class GSWFrame</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,16 +35,16 @@ static char rcsId[] = "$Id$";
@implementation GSWFrame @implementation GSWFrame
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
NSString* _elementName=[self elementName]; NSString* elementName=[self elementName];
if ((self=[super initWithName:_elementName if ((self=[super initWithName:elementName
associations:associations_ associations:associations
contentElements:nil])) contentElements:nil]))
{ {
}; };
return self; return self;
}; };
@ -70,8 +76,8 @@ static char rcsId[] = "$Id$";
-(NSString*)description -(NSString*)description
{ {
return [NSString stringWithFormat:@"<%s %p>", return [NSString stringWithFormat:@"<%s %p>",
object_get_class_name(self), object_get_class_name(self),
(void*)self]; (void*)self];
}; };

View file

@ -1,11 +1,15 @@
/* GSWGenericElement.h - GSWeb: Class GSWGenericElement /** GSWGenericElement.h - <title>GSWeb: Class GSWGenericElement</title>
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +23,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -30,41 +35,45 @@
//==================================================================== //====================================================================
@interface GSWGenericElement: GSWDynamicElement @interface GSWGenericElement: GSWDynamicElement
{ {
GSWAssociation* elementName; GSWAssociation* _elementName;
GSWAssociation* name; GSWAssociation* _name;
GSWAssociation* omitTags; GSWAssociation* _omitTags;
GSWAssociation* formValue; GSWAssociation* _formValue;
GSWAssociation* formValues; GSWAssociation* _formValues;
GSWAssociation* invokeAction; GSWAssociation* _invokeAction;
GSWAssociation* elementId; GSWAssociation* _elementId;
GSWAssociation* otherTagString; GSWAssociation* _otherTagString;
NSDictionary* otherAssociations; NSDictionary* _otherAssociations;
BOOL hasFormValues; BOOL _hasFormValues;
}; };
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
template:(GSWElement*)templateElement_; template:(GSWElement*)templateElement;
-(void)dealloc; -(void)dealloc;
-(NSString*)description; -(NSString*)description;
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(id)_elementNameAppenedToResponse:(GSWResponse*)response_ -(id)_elementNameAppenedToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)_appendTagWithName:(NSString*)name_
toResponse:(GSWResponse*)response_ -(void)_appendTagWithName:(NSString*)name
inContext:(GSWContext*)context_; toResponse:(GSWResponse*)response
-(void)_appendOtherAttributesToResponse:(GSWResponse*)response_ inContext:(GSWContext*)context;
inContext:(GSWContext*)context_;
-(NSString*)_elementNameInContext:(GSWContext*)context_; -(void)_appendOtherAttributesToResponse:(GSWResponse*)response
inContext:(GSWContext*)context;
-(NSString*)_elementNameInContext:(GSWContext*)context;
@end @end
#endif //_GSWGenericElement_h__ #endif //_GSWGenericElement_h__

View file

@ -1,11 +1,16 @@
/* GSWGenericElement.m - GSWeb: Class GSWGenericElement /** GSWGenericElement.m - <title>GSWeb: Class GSWGenericElement</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -28,9 +34,9 @@ static char rcsId[] = "$Id$";
//==================================================================== //====================================================================
@implementation GSWGenericElement @implementation GSWGenericElement
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
template:(GSWElement*)templateElement_ template:(GSWElement*)templateElement
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return nil; return nil;
@ -51,16 +57,16 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return nil; return nil;
@ -68,32 +74,32 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)_elementNameAppenedToResponse:(GSWResponse*)response_ -(id)_elementNameAppenedToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return nil; return nil;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)_appendTagWithName:(NSString*)name_ -(void)_appendTagWithName:(NSString*)name
toResponse:(GSWResponse*)response_ toResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)_appendOtherAttributesToResponse:(GSWResponse*)response_ -(void)_appendOtherAttributesToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
}; };

View file

@ -1,11 +1,16 @@
/* GSWHTMLStaticElement.h - GSWeb: Class GSWHTMLStaticElement /** GSWHTMLStaticElement.h - <title>GSWeb: Class GSWHTMLStaticElement</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Feb 1999 Date: Feb 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -30,10 +36,10 @@
//==================================================================== //====================================================================
@interface GSWHTMLStaticElement: GSWElement @interface GSWHTMLStaticElement: GSWElement
{ {
NSData* elementsMap; NSData* _elementsMap;
NSArray* htmlBareStrings; NSArray* _htmlBareStrings;
NSArray* dynamicChildren; NSArray* _dynamicChildren;
NSString* elementName; NSString* _elementName;
}; };
-(NSString*)elementName; -(NSString*)elementName;
@ -42,20 +48,20 @@
-(NSData*)elementsMap; -(NSData*)elementsMap;
-(id)_initWithElementsMap:(NSData*)_elementsMap -(id)_initWithElementsMap:(NSData*)_elementsMap
htmlBareStrings:(NSArray*)htmlBareStrings htmlBareStrings:(NSArray*)htmlBareStrings
dynamicChildren:(NSArray*)dynamicChildren; dynamicChildren:(NSArray*)dynamicChildren;
-(id) initWithName:(NSString*)elementName_ -(id) initWithName:(NSString*)elementName
attributeDictionary:(NSDictionary*)_attributeDictionary attributeDictionary:(NSDictionary*)attributeDictionary
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(id) initWithName:(NSString*)elementName_ -(id) initWithName:(NSString*)elementName
attributeString:(NSString*)_attributeString attributeString:(NSString*)attributeString
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(void)dealloc; -(void)dealloc;
-(void)_setEndOfHTMLTag:(unsigned int)_unknown; -(void)_setEndOfHTMLTag:(unsigned int)unknown;
-(NSString*)description; -(NSString*)description;
@ -63,28 +69,29 @@
//==================================================================== //====================================================================
@interface GSWHTMLStaticElement (GSWHTMLStaticElementA) @interface GSWHTMLStaticElement (GSWHTMLStaticElementA)
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)appendToResponse:(GSWResponse*)response_
inContext:(GSWContext*)context_
elementsFromIndex:(unsigned int)_fromIndex
toIndex:(unsigned int)_toIndex;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context
elementsFromIndex:(unsigned int)fromIndex
toIndex:(unsigned int)toIndex;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context;
@end @end
//==================================================================== //====================================================================
@interface GSWHTMLStaticElement (GSWHTMLStaticElementB) @interface GSWHTMLStaticElement (GSWHTMLStaticElementB)
-(BOOL)compactHTMLTags; -(BOOL)compactHTMLTags;
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping; withMapping:(char*)mapping;
-(BOOL)appendStringAtLeft:(id)_unkwnon -(BOOL)appendStringAtLeft:(id)unkwnon
withMapping:(char*)_mapping; withMapping:(char*)mapping;
-(BOOL)canBeFlattenedAtInitialization; -(BOOL)canBeFlattenedAtInitialization;
@end @end
@ -92,30 +99,30 @@
//==================================================================== //====================================================================
@interface GSWHTMLStaticElement (GSWHTMLStaticElementC) @interface GSWHTMLStaticElement (GSWHTMLStaticElementC)
+(BOOL)charactersNeedingQuotes; +(BOOL)charactersNeedingQuotes;
+(void)addURLAttribute:(id)_attribute +(void)addURLAttribute:(id)attribute
forElementNamed:(NSString*)_name; forElementNamed:(NSString*)name;
+(id)urlsForElementNamed:(NSString*)_name; +(id)urlsForElementNamed:(NSString*)name;
@end @end
//==================================================================== //====================================================================
@interface GSWHTMLStaticElement (GSWHTMLStaticElementD) @interface GSWHTMLStaticElement (GSWHTMLStaticElementD)
+(NSDictionary*)attributeDictionaryForString:(NSString*)_string; +(NSDictionary*)attributeDictionaryForString:(NSString*)string;
+(NSString*)stringForAttributeDictionary:(NSDictionary*)_attributeDictionary; +(NSString*)stringForAttributeDictionary:(NSDictionary*)attributeDictionary;
+(GSWElement*)elementWithName:(NSString*)_name +(GSWElement*)elementWithName:(NSString*)name
attributeString:(NSString*)_attributeString attributeString:(NSString*)attributeString
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
@end @end
//==================================================================== //====================================================================
@interface GSWHTMLStaticElement (GSWHTMLStaticElementE) @interface GSWHTMLStaticElement (GSWHTMLStaticElementE)
+(GSWElement*)elementWithName:(NSString*)_name +(GSWElement*)elementWithName:(NSString*)name
attributeDictionary:(NSDictionary*)_attributeDictionary attributeDictionary:(NSDictionary*)attributeDictionary
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
+(Class)_elementClassForName:(NSString*)_name; +(Class)_elementClassForName:(NSString*)name;
+(void)setElementClass:(Class)_class +(void)setElementClass:(Class)class
forName:(NSString*)_name; forName:(NSString*)name;
+(GSWElement*)_theEmptyElement; +(GSWElement*)_theEmptyElement;
@end @end

View file

@ -1,11 +1,16 @@
/* GSWHTMLStaticElement.m - GSWeb: Class GSWHTMLStaticElement /** GSWHTMLStaticElement.m - <title>GSWeb: Class GSWHTMLStaticElement</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Feb 1999 Date: Feb 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,197 +35,198 @@ static char rcsId[] = "$Id$";
@implementation GSWHTMLStaticElement @implementation GSWHTMLStaticElement
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id) initWithName:(NSString*)_elementName -(id) initWithName:(NSString*)anElementName
attributeDictionary:(NSDictionary*)attributeAssociations_ attributeDictionary:(NSDictionary*)aAttributeAssociationsList
contentElements:(NSArray*)_elements contentElements:(NSArray*)anElementsArray
{ {
//OK //OK
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"_elementName=%@ attributeAssociations_:%@ _elements=%@", NSDebugMLLog(@"gswdync",@"anElementName=%@ aAttributeAssociationsList:%@ anElementsArray=%@",
_elementName, anElementName,
attributeAssociations_, aAttributeAssociationsList,
_elements); anElementsArray);
if ((self=[super init])) if ((self=[super init]))
{ {
NSMutableArray* _attributeAssociationsValues=[NSMutableArray array]; NSMutableArray* attributeAssociationsValues=[NSMutableArray array];
NSMutableArray* _htmlBareStrings=[NSMutableArray array]; NSMutableArray* tmpHtmlBareStrings=[NSMutableArray array];
NSMutableData* _elementsMap=[[NSMutableData new]autorelease]; NSMutableData* tmpElementsMap=[[NSMutableData new]autorelease];
ASSIGN(elementName,_elementName);//?? ASSIGN(_elementName,anElementName);//??
if (anElementName)
{
NSEnumerator* attributesKeyEnum=nil;
id key=nil;
[tmpHtmlBareStrings addObject:[NSString stringWithFormat:@"<%@",
anElementName]];
[tmpElementsMap appendBytes:&ElementsMap_htmlBareString
length:1];
if (_elementName) attributesKeyEnum= [aAttributeAssociationsList keyEnumerator];
{ NSDebugMLLog(@"gswdync",@"attributesKeyEnum=%@ aAttributeAssociationsList=%@",
NSEnumerator* attributesKeyEnum=nil; attributesKeyEnum,aAttributeAssociationsList);
id _key=nil; while ((key = [attributesKeyEnum nextObject]))
[_htmlBareStrings addObject:[NSString stringWithFormat:@"<%@", {
_elementName]]; id association=[aAttributeAssociationsList objectForKey:key];
[_elementsMap appendBytes:&ElementsMap_htmlBareString id associationValue=[association valueInComponent:nil];
length:1]; NSDebugMLLog(@"gswdync",@"association=%@ associationValue=%@",
association,associationValue);
attributesKeyEnum= [attributeAssociations_ keyEnumerator]; [tmpHtmlBareStrings addObject:[NSString stringWithFormat:@" %@",key]];
NSDebugMLLog(@"gswdync",@"attributesKeyEnum=%@ attributeAssociations_=%@",attributesKeyEnum,attributeAssociations_); [tmpElementsMap appendBytes:&ElementsMap_htmlBareString
while ((_key = [attributesKeyEnum nextObject])) length:1];
{ if (associationValue)
id _association=[attributeAssociations_ objectForKey:_key]; {
id _associationValue=[_association valueInComponent:nil]; [tmpHtmlBareStrings addObject:[NSString stringWithString:@"="]];
NSDebugMLLog(@"gswdync",@"_association=%@ _associationValue=%@",_association,_associationValue); [tmpElementsMap appendBytes:&ElementsMap_htmlBareString
[_htmlBareStrings addObject:[NSString stringWithFormat:@" %@",_key]]; length:1];
[_elementsMap appendBytes:&ElementsMap_htmlBareString [tmpHtmlBareStrings addObject:[NSString stringWithFormat:@"\"%@\"",associationValue]];
length:1]; [tmpElementsMap appendBytes:&ElementsMap_htmlBareString
if (_associationValue) length:1];
{ }
[_htmlBareStrings addObject:[NSString stringWithString:@"="]]; else
[_elementsMap appendBytes:&ElementsMap_htmlBareString {
length:1]; //TODO So what next ?
[_htmlBareStrings addObject:[NSString stringWithFormat:@"\"%@\"",_associationValue]]; [attributeAssociationsValues addObject:association];
[_elementsMap appendBytes:&ElementsMap_htmlBareString [tmpElementsMap appendBytes:&ElementsMap_attributeElement
length:1]; length:1];
}
else
{
//TODO So what next ?
[_attributeAssociationsValues addObject:_association];
[_elementsMap appendBytes:&ElementsMap_attributeElement
length:1];
};
};
[_htmlBareStrings addObject:@">"];
[_elementsMap appendBytes:&ElementsMap_htmlBareString
length:1];
};
if (_elements)
{
int elementsN=[_elements count];
for(;elementsN>0;elementsN--)
[_elementsMap appendBytes:&ElementsMap_dynamicElement
length:1];
if (_elementName)
{
[_htmlBareStrings addObject:[NSString stringWithFormat:@"</%@>",
_elementName]];
[_elementsMap appendBytes:&ElementsMap_htmlBareString
length:1];
};
}; };
};
[self _initWithElementsMap:_elementsMap [tmpHtmlBareStrings addObject:@">"];
htmlBareStrings:_htmlBareStrings [tmpElementsMap appendBytes:&ElementsMap_htmlBareString
dynamicChildren:_elements]; length:1];
}; };
if (anElementsArray)
{
int elementsN=[anElementsArray count];
for(;elementsN>0;elementsN--)
[tmpElementsMap appendBytes:&ElementsMap_dynamicElement
length:1];
if (anElementName)
{
[tmpHtmlBareStrings addObject:[NSString stringWithFormat:@"</%@>",
anElementName]];
[tmpElementsMap appendBytes:&ElementsMap_htmlBareString
length:1];
};
};
[self _initWithElementsMap:tmpElementsMap
htmlBareStrings:tmpHtmlBareStrings
dynamicChildren:anElementsArray];
};
LOGObjectFnStop(); LOGObjectFnStop();
return self; return self;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id) initWithName:(NSString*)_elementName -(id) initWithName:(NSString*)anElementName
attributeString:(NSString*)_attributeString attributeString:(NSString*)attributeString
contentElements:(NSArray*)_elements contentElements:(NSArray*)anElementsArray
{ {
//OK //OK
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"_elementName=%@ _attributeString:%@ _elements=%@", NSDebugMLLog(@"gswdync",@"anElementName=%@ attributeString:%@ anElementsArray=%@",
_elementName, anElementName,
_attributeString, attributeString,
_elements); anElementsArray);
if ((self=[super init])) if ((self=[super init]))
{ {
NSMutableArray* _htmlBareStrings=[NSMutableArray array]; NSMutableArray* tmpHtmlBareStrings=[NSMutableArray array];
NSMutableData* _elementsMap=[[NSMutableData new]autorelease]; NSMutableData* tmpElementsMap=[[NSMutableData new]autorelease];
ASSIGN(elementName,_elementName);//?? ASSIGN(_elementName,anElementName);//??
if (_elementName) if (anElementName)
{ {
[_htmlBareStrings addObject:[NSString stringWithFormat:@"<%@", [tmpHtmlBareStrings addObject:[NSString stringWithFormat:@"<%@",
_elementName]]; anElementName]];
[_elementsMap appendBytes:&ElementsMap_htmlBareString [tmpElementsMap appendBytes:&ElementsMap_htmlBareString
length:1]; length:1];
[_htmlBareStrings addObject:_attributeString]; [tmpHtmlBareStrings addObject:attributeString];
[_elementsMap appendBytes:&ElementsMap_htmlBareString [tmpElementsMap appendBytes:&ElementsMap_htmlBareString
length:1]; length:1];
[_htmlBareStrings addObject:@">"]; [tmpHtmlBareStrings addObject:@">"];
[_elementsMap appendBytes:&ElementsMap_htmlBareString [tmpElementsMap appendBytes:&ElementsMap_htmlBareString
length:1]; length:1];
}; };
if (_elements) if (anElementsArray)
{ {
int elementsN=[_elements count]; int elementsN=[anElementsArray count];
for(;elementsN>0;elementsN--) for(;elementsN>0;elementsN--)
[_elementsMap appendBytes:&ElementsMap_dynamicElement [tmpElementsMap appendBytes:&ElementsMap_dynamicElement
length:1]; length:1];
if (_elementName) if (anElementName)
{ {
[_htmlBareStrings addObject:[NSString stringWithFormat:@"</%@>", [tmpHtmlBareStrings addObject:[NSString stringWithFormat:@"</%@>",
_elementName]]; anElementName]];
[_elementsMap appendBytes:&ElementsMap_htmlBareString [tmpElementsMap appendBytes:&ElementsMap_htmlBareString
length:1]; length:1];
}; };
}; };
[self _initWithElementsMap:_elementsMap [self _initWithElementsMap:tmpElementsMap
htmlBareStrings:_htmlBareStrings htmlBareStrings:tmpHtmlBareStrings
dynamicChildren:_elements]; dynamicChildren:anElementsArray];
}; };
LOGObjectFnStop(); LOGObjectFnStop();
return self; return self;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)_initWithElementsMap:(NSData*)_elementsMap -(id)_initWithElementsMap:(NSData*)tmpElementsMap
htmlBareStrings:(NSArray*)_htmlBareStrings htmlBareStrings:(NSArray*)tmpHtmlBareStrings
dynamicChildren:(NSArray*)_dynamicChildren dynamicChildren:(NSArray*)aDynamicChildrensArray
{ {
BOOL _compactHTMLTags=NO; BOOL compactHTMLTags=NO;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"_elementsMap=%@ _htmlBareStrings:%@ dynamicChildren=%@", NSDebugMLLog(@"gswdync",@"tmpElementsMap=%@ tmpHtmlBareStrings:%@ dynamicChildren=%@",
_elementsMap, tmpElementsMap,
_htmlBareStrings, tmpHtmlBareStrings,
_dynamicChildren); aDynamicChildrensArray);
_compactHTMLTags=[self compactHTMLTags]; compactHTMLTags=[self compactHTMLTags];
//OK //OK
if (_compactHTMLTags) if (compactHTMLTags)
{ {
int elementN=0; int elementN=0;
while(elementN<[_elementsMap length] && ((BYTE*)[_elementsMap bytes])[elementN]==ElementsMap_htmlBareString) while(elementN<[tmpElementsMap length] && ((BYTE*)[tmpElementsMap bytes])[elementN]==ElementsMap_htmlBareString)
elementN++; elementN++;
[self _setEndOfHTMLTag:elementN]; [self _setEndOfHTMLTag:elementN];
if (elementN>0) if (elementN>0)
{ {
int rmStringN=0; int rmStringN=0;
NSMutableArray* rmStrings=[NSMutableArray array]; NSMutableArray* rmStrings=[NSMutableArray array];
NSMutableString* rmString=[[NSMutableString new] autorelease]; NSMutableString* rmString=[[NSMutableString new] autorelease];
NSMutableData* tmpElementsMap=[[NSMutableData new] autorelease]; NSMutableData* tmpElementsMap=[[NSMutableData new] autorelease];
[tmpElementsMap appendBytes:&ElementsMap_htmlBareString [tmpElementsMap appendBytes:&ElementsMap_htmlBareString
length:1]; length:1];
if ([_elementsMap length]>elementN) if ([tmpElementsMap length]>elementN)
[tmpElementsMap appendData: [tmpElementsMap appendData:
[_elementsMap subdataWithRange: [tmpElementsMap subdataWithRange:
NSMakeRange(elementN, NSMakeRange(elementN,
[_elementsMap length]-elementN)]]; [tmpElementsMap length]-elementN)]];
_elementsMap=tmpElementsMap; tmpElementsMap=tmpElementsMap;
for(rmStringN=0;rmStringN<elementN;rmStringN++) for(rmStringN=0;rmStringN<elementN;rmStringN++)
{ {
NSDebugMLLog(@"gswdync",@"rmString=[%@]",rmString); NSDebugMLLog(@"gswdync",@"rmString=[%@]",rmString);
NSDebugMLLog(@"gswdync",@"[_htmlBareStrings objectAtIndex:rmStringN]=[%@]", NSDebugMLLog(@"gswdync",@"[tmpHtmlBareStrings objectAtIndex:rmStringN]=[%@]",
[_htmlBareStrings objectAtIndex:rmStringN]); [tmpHtmlBareStrings objectAtIndex:rmStringN]);
[rmString appendString:[_htmlBareStrings objectAtIndex:rmStringN]]; [rmString appendString:[tmpHtmlBareStrings objectAtIndex:rmStringN]];
}; };
NSDebugMLLog(@"gswdync",@"rmString=[%@]",rmString); NSDebugMLLog(@"gswdync",@"rmString=[%@]",rmString);
NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings); NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings);
[rmStrings addObject:rmString]; [rmStrings addObject:rmString];
NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings); NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings);
for(rmStringN=elementN;rmStringN<[_htmlBareStrings count];rmStringN++) for(rmStringN=elementN;rmStringN<[tmpHtmlBareStrings count];rmStringN++)
{ {
NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings); NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings);
NSDebugMLLog(@"gswdync",@"[_htmlBareStrings objectAtIndex:rmStringN]=[%@]", NSDebugMLLog(@"gswdync",@"[tmpHtmlBareStrings objectAtIndex:rmStringN]=[%@]",
[_htmlBareStrings objectAtIndex:rmStringN]); [tmpHtmlBareStrings objectAtIndex:rmStringN]);
[rmStrings addObject:[_htmlBareStrings objectAtIndex:rmStringN]]; [rmStrings addObject:[tmpHtmlBareStrings objectAtIndex:rmStringN]];
}; };
NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings); NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings);
_htmlBareStrings=rmStrings; tmpHtmlBareStrings=rmStrings;
}; };
}; };
ASSIGN(htmlBareStrings,_htmlBareStrings); ASSIGN(_htmlBareStrings,tmpHtmlBareStrings);
ASSIGN(elementsMap,_elementsMap); ASSIGN(_elementsMap,tmpElementsMap);
ASSIGN(dynamicChildren,_dynamicChildren); ASSIGN(_dynamicChildren,aDynamicChildrensArray);
LOGObjectFnStop(); LOGObjectFnStop();
return self; return self;
@ -228,39 +235,39 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)elementName -(NSString*)elementName
{ {
return elementName; return _elementName;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSArray*)dynamicChildren -(NSArray*)dynamicChildren
{ {
return dynamicChildren; return _dynamicChildren;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSArray*)htmlBareStrings -(NSArray*)htmlBareStrings
{ {
return htmlBareStrings; return _htmlBareStrings;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSData*)elementsMap -(NSData*)elementsMap
{ {
return elementsMap; return _elementsMap;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(elementsMap); DESTROY(_elementsMap);
DESTROY(htmlBareStrings); DESTROY(_htmlBareStrings);
DESTROY(dynamicChildren); DESTROY(_dynamicChildren);
DESTROY(elementName); DESTROY(_elementName);
[super dealloc]; [super dealloc];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)_setEndOfHTMLTag:(unsigned int)_unknown -(void)_setEndOfHTMLTag:(unsigned int)unknown
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
}; };
@ -272,10 +279,10 @@ static char rcsId[] = "$Id$";
/* htmlBareStrings:%@ dynamicChildren:%@ elementName:%@>",*/ /* htmlBareStrings:%@ dynamicChildren:%@ elementName:%@>",*/
[self class], [self class],
(void*)self, (void*)self,
elementsMap]; _elementsMap];
/* htmlBareStrings, /* _htmlBareStrings,
dynamicChildren, _dynamicChildren,
elementName];*/ _elementName];*/
}; };
@end @end
@ -284,155 +291,170 @@ static char rcsId[] = "$Id$";
@implementation GSWHTMLStaticElement (GSWHTMLStaticElementA) @implementation GSWHTMLStaticElement (GSWHTMLStaticElementA)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK (verifier avec GSWSession appendToR //OK (verifier avec GSWSession appendToR
GSWRequest* _request=[context_ request]; GSWRequest* request=[context request];
BOOL _isFromClientComponent=[_request isFromClientComponent]; //bis repetitam BOOL isFromClientComponent=[request isFromClientComponent]; //bis repetitam
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ self=%p",[self class],[context_ elementID],self); NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ self=%p",
GSWSaveAppendToResponseElementID(context_);//Debug Only [self class],[context elementID],self);
if ([elementsMap length]>0) GSWSaveAppendToResponseElementID(context);//Debug Only
{ if ([_elementsMap length]>0)
[self appendToResponse:response_ {
inContext:context_ [self appendToResponse:response
elementsFromIndex:0 inContext:context
toIndex:[elementsMap length]-1]; elementsFromIndex:0
}; toIndex:[_elementsMap length]-1];
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@ self=%p",[self class],[context_ elementID],self); };
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@ self=%p",
[self class],[context elementID],self);
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
elementsFromIndex:(unsigned int)_fromIndex elementsFromIndex:(unsigned int)fromIndex
toIndex:(unsigned int)_toIndex toIndex:(unsigned int)toIndex
{ {
//OK //OK
NSStringEncoding _encoding=[response_ contentEncoding]; NSStringEncoding encoding=[response contentEncoding];
NSArray* _dynamicChildren=[self dynamicChildren];//call dynamicChildren //GSWTextField: nil NSArray* aDynamicChildrensArray=[self dynamicChildren];//call dynamicChildren //GSWTextField: nil
int elementN=0; int elementN=0;
const BYTE* elements=[elementsMap bytes]; const BYTE* elements=[_elementsMap bytes];
BYTE element=0; BYTE element=0;
int elementsN[3]={0,0,0}; int elementsN[3]={0,0,0};
NSAssert2(_fromIndex<[elementsMap length],@"_fromIndex out of range:%u (length=%d)",_fromIndex,[elementsMap length]); NSAssert2(fromIndex<[_elementsMap length],@"fromIndex out of range:%u (length=%d)",
NSAssert2(_toIndex<[elementsMap length],@"_toIndex out of range:%u (length=%d)",_toIndex,[elementsMap length]); fromIndex,[_elementsMap length]);
NSAssert2(_fromIndex<=_toIndex,@"_fromIndex>_toIndex %u %u ",_fromIndex,_toIndex); NSAssert2(toIndex<[_elementsMap length],@"toIndex out of range:%u (length=%d)",
for(elementN=0;elementN<=_toIndex;elementN++) toIndex,[_elementsMap length]);
{ NSAssert2(fromIndex<=toIndex,@"fromIndex>toIndex %u %u ",
element=(BYTE)elements[elementN]; fromIndex,toIndex);
if (element==ElementsMap_htmlBareString) for(elementN=0;elementN<=toIndex;elementN++)
{
NSDebugMLLog(@"gswdync",@"%d:htmlBareString : %@",elementN,[htmlBareStrings objectAtIndex:elementsN[0]]);
if (elementN>=_fromIndex)
[response_ appendContentData:[[htmlBareStrings objectAtIndex:elementsN[0]]
dataUsingEncoding:_encoding]];
elementsN[0]++;
}
else if (element==ElementsMap_dynamicElement)
{
if (elementN>=_fromIndex)
{
NSDebugMLLog(@"gswdync",@"%d:dynamicElement : %@",elementN,[_dynamicChildren objectAtIndex:elementsN[1]]);
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",
[[_dynamicChildren objectAtIndex:elementsN[1]] class],
[context_ elementID]);
[[_dynamicChildren objectAtIndex:elementsN[1]] appendToResponse:response_
inContext:context_];
[context_ incrementLastElementIDComponent];
};
elementsN[1]++;
}
else if (element==ElementsMap_attributeElement)
{
//TODO
NSDebugMLLog(@"gswdync",@"%d:attributeElement",elementN);
elementsN[2]++;
};
};
};
//--------------------------------------------------------------------
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_
inContext:(GSWContext*)context_
{
//OK
GSWElement* _element=nil;
int elementN=0;
NSArray* _dynamicChildren=[self dynamicChildren];
const BYTE* elements=[elementsMap bytes];
BYTE element=0;
int elementsN[3]={0,0,0};
BOOL searchIsOver=NO;
NSString* _senderID=nil;
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@",[self class],[context_ elementID],[context_ senderID]);
GSWAssertCorrectElementID(context_);// Debug Only
_senderID=[context_ senderID];
for(elementN=0;!_element && !searchIsOver && elementN<[elementsMap length];elementN++)
{ {
element=(BYTE)elements[elementN]; element=(BYTE)elements[elementN];
if (element==ElementsMap_htmlBareString) if (element==ElementsMap_htmlBareString)
elementsN[0]++; {
NSDebugMLLog(@"gswdync",@"%d:htmlBareString : %@",
elementN,[_htmlBareStrings objectAtIndex:elementsN[0]]);
if (elementN>=fromIndex)
[response appendContentData:[[_htmlBareStrings objectAtIndex:elementsN[0]]
dataUsingEncoding:encoding]];
elementsN[0]++;
}
else if (element==ElementsMap_dynamicElement) else if (element==ElementsMap_dynamicElement)
{ {
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[[_dynamicChildren objectAtIndex:elementsN[1]] class],[context_ elementID]); if (elementN>=fromIndex)
_element=[[_dynamicChildren objectAtIndex:elementsN[1]] invokeActionForRequest:request_
inContext:context_];
// if (![context_ _wasFormSubmitted] && [[context_ elementID] compare:_senderID]==NSOrderedDescending)
if (![context_ _wasFormSubmitted] && [[context_ elementID] isSearchOverForSenderID:_senderID])
{ {
NSDebugMLLog(@"gswdync",@"id=%@ senderid=%@ => search is over", NSDebugMLLog(@"gswdync",@"%d:dynamicElement : %@",
[context_ elementID], elementN,[aDynamicChildrensArray objectAtIndex:elementsN[1]]);
_senderID); NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",
searchIsOver=YES; [[aDynamicChildrensArray objectAtIndex:elementsN[1]] class],
[context elementID]);
[[aDynamicChildrensArray objectAtIndex:elementsN[1]] appendToResponse:response
inContext:context];
[context incrementLastElementIDComponent];
}; };
[context_ incrementLastElementIDComponent];
elementsN[1]++; elementsN[1]++;
} }
else if (element==ElementsMap_attributeElement) else if (element==ElementsMap_attributeElement)
{ {
//TODO
NSDebugMLLog(@"gswdync",@"%d:attributeElement",elementN);
elementsN[2]++; elementsN[2]++;
}; };
}; };
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]);
return _element;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{
//OK
GSWElement* element=nil;
int elementN=0;
NSArray* aDynamicChildrensArray=[self dynamicChildren];
const BYTE* elements=[_elementsMap bytes];
BYTE elementIndic=0;
int elementsN[3]={0,0,0};
BOOL searchIsOver=NO;
NSString* senderID=nil;
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@",
[self class],[context elementID],[context senderID]);
GSWAssertCorrectElementID(context);// Debug Only
senderID=[context senderID];
for(elementN=0;!element && !searchIsOver && elementN<[_elementsMap length];elementN++)
{
elementIndic=(BYTE)elements[elementN];
if (elementIndic==ElementsMap_htmlBareString)
elementsN[0]++;
else if (elementIndic==ElementsMap_dynamicElement)
{
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",
[[aDynamicChildrensArray objectAtIndex:elementsN[1]] class],
[context elementID]);
element=[[aDynamicChildrensArray objectAtIndex:elementsN[1]] invokeActionForRequest:request
inContext:context];
//if (![context_ _wasFormSubmitted] && [[context_ elementID] compare:_senderID]==NSOrderedDescending)
if (![context _wasFormSubmitted] && [[context elementID] isSearchOverForSenderID:senderID])
{
NSDebugMLLog(@"gswdync",@"id=%@ senderid=%@ => search is over",
[context elementID],
senderID);
searchIsOver=YES;
};
[context incrementLastElementIDComponent];
elementsN[1]++;
}
else if (elementIndic==ElementsMap_attributeElement)
{
elementsN[2]++;
};
};
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context elementID]);
return element;
};
//--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context
{ {
//OK //OK
int elementN=0; int elementN=0;
NSArray* _dynamicChildren=[self dynamicChildren]; NSArray* aDynamicChildrensArray=[self dynamicChildren];
const BYTE* elements=[elementsMap bytes]; const BYTE* elements=[_elementsMap bytes];
BYTE element=0; BYTE elementIndic=0;
int elementsN[3]={0,0,0}; int elementsN[3]={0,0,0};
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context_ elementID]); NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",
GSWAssertCorrectElementID(context_);// Debug Only [self class],[context elementID]);
for(elementN=0;elementN<[elementsMap length];elementN++) GSWAssertCorrectElementID(context);// Debug Only
{ for(elementN=0;elementN<[_elementsMap length];elementN++)
NSDebugMLLog(@"gswdync",@"elementN=%d",elementN); {
element=(BYTE)elements[elementN]; NSDebugMLLog(@"gswdync",@"elementN=%d",elementN);
NSDebugMLLog(@"gswdync",@"element=%x",(unsigned int)element); elementIndic=(BYTE)elements[elementN];
if (element==ElementsMap_htmlBareString) NSDebugMLLog(@"gswdync",@"element=%x",(unsigned int)elementIndic);
elementsN[0]++; if (elementIndic==ElementsMap_htmlBareString)
else if (element==ElementsMap_dynamicElement) elementsN[0]++;
{ else if (elementIndic==ElementsMap_dynamicElement)
NSDebugMLLog(@"gswdync",@"\n[_dynamicChildren objectAtIndex:elementsN[1]=%@",[_dynamicChildren objectAtIndex:elementsN[1]]); {
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[[_dynamicChildren objectAtIndex:elementsN[1]] class],[context_ elementID]); NSDebugMLLog(@"gswdync",@"\n[aDynamicChildrensArray objectAtIndex:elementsN[1]=%@",
[[_dynamicChildren objectAtIndex:elementsN[1]] takeValuesFromRequest:request_ [aDynamicChildrensArray objectAtIndex:elementsN[1]]);
inContext:context_]; NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",
[context_ incrementLastElementIDComponent]; [[aDynamicChildrensArray objectAtIndex:elementsN[1]] class],
elementsN[1]++; [context elementID]);
} [[aDynamicChildrensArray objectAtIndex:elementsN[1]] takeValuesFromRequest:request
else if (element==ElementsMap_attributeElement) inContext:context];
{ [context incrementLastElementIDComponent];
elementsN[2]++; elementsN[1]++;
}; }
}; else if (elementIndic==ElementsMap_attributeElement)
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]); {
elementsN[2]++;
};
};
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",
[self class],[context elementID]);
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -449,16 +471,16 @@ static char rcsId[] = "$Id$";
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping withMapping:(char*)mapping
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return NO; return NO;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(BOOL)appendStringAtLeft:(id)_unkwnon -(BOOL)appendStringAtLeft:(id)unkwnon
withMapping:(char*)_mapping withMapping:(char*)mapping
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return NO; return NO;
@ -484,14 +506,14 @@ static char rcsId[] = "$Id$";
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
+(void)addURLAttribute:(id)_attribute +(void)addURLAttribute:(id)attribute
forElementNamed:(NSString*)_name forElementNamed:(NSString*)name
{ {
LOGClassFnNotImplemented(); //TODOFN LOGClassFnNotImplemented(); //TODOFN
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
+(id)urlsForElementNamed:(NSString*)_name +(id)urlsForElementNamed:(NSString*)name
{ {
LOGClassFnNotImplemented(); //TODOFN LOGClassFnNotImplemented(); //TODOFN
return nil; return nil;
@ -503,23 +525,23 @@ static char rcsId[] = "$Id$";
@implementation GSWHTMLStaticElement (GSWHTMLStaticElementD) @implementation GSWHTMLStaticElement (GSWHTMLStaticElementD)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
+(NSDictionary*)attributeDictionaryForString:(NSString*)string_ +(NSDictionary*)attributeDictionaryForString:(NSString*)string
{ {
LOGClassFnNotImplemented(); //TODOFN LOGClassFnNotImplemented(); //TODOFN
return nil; return nil;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
+(NSString*)stringForAttributeDictionary:(NSDictionary*)attributeDictionary_ +(NSString*)stringForAttributeDictionary:(NSDictionary*)attributeDictionary
{ {
LOGClassFnNotImplemented(); //TODOFN LOGClassFnNotImplemented(); //TODOFN
return nil; return nil;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
+(GSWElement*)elementWithName:(NSString*)name_ +(GSWElement*)elementWithName:(NSString*)name
attributeString:(NSString*)attributeString_ attributeString:(NSString*)attributeString
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
LOGClassFnNotImplemented(); //TODOFN LOGClassFnNotImplemented(); //TODOFN
return nil; return nil;
@ -531,22 +553,22 @@ static char rcsId[] = "$Id$";
@implementation GSWHTMLStaticElement (GSWHTMLStaticElementE) @implementation GSWHTMLStaticElement (GSWHTMLStaticElementE)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
+(GSWElement*)elementWithName:(NSString*)name_ +(GSWElement*)elementWithName:(NSString*)name
attributeDictionary:(NSDictionary*)attributeDictionary_ attributeDictionary:(NSDictionary*)attributeDictionary
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
LOGClassFnNotImplemented(); //TODOFN LOGClassFnNotImplemented(); //TODOFN
return nil; return nil;
}; };
+(Class)_elementClassForName:(NSString*)name_ +(Class)_elementClassForName:(NSString*)name
{ {
LOGClassFnNotImplemented(); //TODOFN LOGClassFnNotImplemented(); //TODOFN
return nil; return nil;
}; };
+(void)setElementClass:(Class)class_ +(void)setElementClass:(Class)class
forName:(NSString*)name_ forName:(NSString*)name
{ {
LOGClassFnNotImplemented(); //TODOFN LOGClassFnNotImplemented(); //TODOFN
}; };

View file

@ -1,11 +1,16 @@
/* GSWHTMLStaticGroup.h - GSWeb: Class GSWHTMLStaticGroup /** GSWHTMLStaticGroup.h - <title>GSWeb: Class GSWHTMLStaticGroup</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Feb 1999 Date: Feb 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -31,11 +37,11 @@
{ {
NSString* _documentTypeString; NSString* _documentTypeString;
} }
-(id)initWithContentElements:(NSArray*)elements_; -(id)initWithContentElements:(NSArray*)elements;
-(void)setDocumentTypeString:(NSString *)documentType_; -(void)setDocumentTypeString:(NSString *)documentType;
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)dealloc; -(void)dealloc;
@end @end

View file

@ -1,11 +1,16 @@
/* GSWHTMLStaticGroup.m - GSWeb: Class GSWHTMLStaticGroup /** GSWHTMLStaticGroup.m - <title>GSWeb: Class GSWHTMLStaticGroup</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Feb 1999 Date: Feb 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -27,54 +33,49 @@ static char rcsId[] = "$Id$";
//==================================================================== //====================================================================
@implementation GSWHTMLStaticGroup @implementation GSWHTMLStaticGroup
-(id)initWithContentElements:(NSArray*)elements_ -(id)initWithContentElements:(NSArray*)elements
{ {
//OK //OK
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"elements_:%@",elements_); NSDebugMLLog(@"gswdync",@"elements:%@",elements);
if ([elements_ count]==1 && [[elements_ objectAtIndex:0] class]==[GSWHTMLStaticGroup class]) if ([elements count]==1 && [[elements objectAtIndex:0] class]==[GSWHTMLStaticGroup class])
self=[super initWithName:nil self=[super initWithName:nil
attributeDictionary:nil attributeDictionary:nil
contentElements:[[elements_ objectAtIndex:0]dynamicChildren]]; contentElements:[[elements objectAtIndex:0]dynamicChildren]];
else else
self=[super initWithName:nil self=[super initWithName:nil
attributeDictionary:nil attributeDictionary:nil
contentElements:elements_]; contentElements:elements];
LOGObjectFnStop(); LOGObjectFnStop();
return self; return self;
}; };
//--------------------------------------------------------------------
-(void)setDocumentTypeString:(NSString *)documentType_
{
[_documentTypeString release];
_documentTypeString = [documentType_ retain];
}
//--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_
inContext:(GSWContext*)context_
{
if (_documentTypeString)
{
NSStringEncoding _encoding=[response_ contentEncoding];
NSDebugMLLog(@"gswdync",@"added _documentTypeString = %@", _documentTypeString);
[response_ appendContentData:[_documentTypeString
dataUsingEncoding:_encoding]];
};
[super appendToResponse:response_ inContext:context_];
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
[_documentTypeString release]; DESTROY(_documentTypeString);
[super dealloc];
[super dealloc];
} }
//--------------------------------------------------------------------
-(void)setDocumentTypeString:(NSString *)documentType
{
ASSIGN(_documentTypeString,documentType);
}
//--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context
{
if (_documentTypeString)
{
NSStringEncoding encoding=[response contentEncoding];
NSDebugMLLog(@"gswdync",@"added documentTypeString = %@",_documentTypeString);
[response appendContentData:[_documentTypeString dataUsingEncoding:encoding]];
};
[super appendToResponse:response
inContext:context];
};
@end @end

View file

@ -1,11 +1,16 @@
/* GSWHiddenField.h - GSWeb: Class GSWHiddenField /** GSWHiddenField.h - <title>GSWeb: Class GSWHiddenField</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,9 +35,9 @@
//OK //OK
//==================================================================== //====================================================================
@interface GSWHiddenField: GSWInput @interface GSWHiddenField: GSWInput
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
@end @end

View file

@ -1,11 +1,16 @@
/* GSWHiddenField.m - GSWeb: Class GSWHiddenField /** GSWHiddenField.m - <title>GSWeb: Class GSWHiddenField</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -27,20 +33,21 @@ static char rcsId[] = "$Id$";
//==================================================================== //====================================================================
@implementation GSWHiddenField @implementation GSWHiddenField
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
LOGObjectFnStartC("GSWHiddenField"); LOGObjectFnStartC("GSWHiddenField");
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,elements_); NSDebugMLLog(@"gswdync",@"name=%@ associations:%@ elements=%@",
[_associations setObject:[GSWAssociation associationWithValue:@"hidden"] aName,associations,elements);
forKey:@"type"]; [tmpAssociations setObject:[GSWAssociation associationWithValue:@"hidden"]
if ((self=[super initWithName:name_ forKey:@"type"];
associations:_associations if ((self=[super initWithName:aName
contentElements:nil])) //No Childs! associations:tmpAssociations
{ contentElements:nil])) //No Childs!
}; {
};
LOGObjectFnStopC("GSWHiddenField"); LOGObjectFnStopC("GSWHiddenField");
return self; return self;
}; };

View file

@ -1,11 +1,16 @@
/* GSWHyperlink.h - GSWeb: Class GSWHyperlink /** GSWHyperlink.h - <title>GSWeb: Class GSWHyperlink</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,55 +35,55 @@
@interface GSWHyperlink: GSWDynamicElement @interface GSWHyperlink: GSWDynamicElement
{ {
GSWAssociation* action; GSWAssociation* _action;
GSWAssociation* string; GSWAssociation* _string;
GSWAssociation* pageName; GSWAssociation* _pageName;
GSWAssociation* href; GSWAssociation* _href;
GSWAssociation* disabled; GSWAssociation* _disabled;
GSWAssociation* fragmentIdentifier; GSWAssociation* _fragmentIdentifier;
GSWAssociation* queryDictionary; GSWAssociation* _queryDictionary;
GSWAssociation* actionClass; GSWAssociation* _actionClass;
GSWAssociation* directActionName; GSWAssociation* _directActionName;
//GSWeb Additions { //GSWeb Additions {
GSWAssociation* enabled; GSWAssociation* _enabled;
GSWAssociation* displayDisabled; GSWAssociation* _displayDisabled;
GSWAssociation* redirectURL; GSWAssociation* _redirectURL;
NSDictionary* pageSetVarAssociations; NSDictionary* _pageSetVarAssociations;
GSWAssociation* pageSetVarAssociationsDynamic; GSWAssociation* _pageSetVarAssociationsDynamic;
// } // }
NSDictionary* otherQueryAssociations; NSDictionary* _otherQueryAssociations;
NSDictionary* otherAssociations; NSDictionary* _otherAssociations;
//GSWeb Additions { //GSWeb Additions {
GSWAssociation* filename; GSWAssociation* _filename;
GSWAssociation* framework; GSWAssociation* _framework;
GSWAssociation* data; GSWAssociation* _data;
GSWAssociation* mimeType; GSWAssociation* _mimeType;
GSWAssociation* key; GSWAssociation* _key;
// } // }
GSWElement* children; GSWElement* _children;
}; };
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
template:(GSWElement*)templateElement_; template:(GSWElement*)templateElement;
-(void)dealloc; -(void)dealloc;
-(NSString*)description; -(NSString*)description;
@end @end
@interface GSWHyperlink (GSWHyperlinkA) @interface GSWHyperlink (GSWHyperlinkA)
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
#if !GSWEB_STRICT #if !GSWEB_STRICT
-(NSString*)frameworkNameInContext:(GSWContext*)context_; -(NSString*)frameworkNameInContext:(GSWContext*)context;
#endif #endif
-(void)_appendCGIActionURLToResponse:(GSWResponse*)response_ -(void)_appendCGIActionURLToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(id)computeActionStringInContext:(GSWContext*)context_; -(id)computeActionStringInContext:(GSWContext*)context;
-(void)_appendQueryStringToResponse:(GSWResponse*)response_ -(void)_appendQueryStringToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(NSDictionary*)computeQueryDictionaryInContext:(GSWContext*)context_; -(NSDictionary*)computeQueryDictionaryInContext:(GSWContext*)context;
-(NSString*)hrefInContext:(GSWContext*)context_; //NDFN -(NSString*)hrefInContext:(GSWContext*)context; //NDFN
@end @end

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,16 @@
/* GSWImage.h - GSWeb: Class GSWImage /** GSWImage.h - <title>GSWeb: Class GSWImage</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,9 +35,9 @@
@interface GSWImage: GSWHTMLURLValuedElement @interface GSWImage: GSWHTMLURLValuedElement
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(void)dealloc; -(void)dealloc;
-(NSString*)valueAttributeName; -(NSString*)valueAttributeName;
-(NSString*)urlAttributeName; -(NSString*)urlAttributeName;

View file

@ -1,11 +1,16 @@
/* GSWImage.m - GSWeb: Class GSWImage /** GSWImage.m - <title>GSWeb: Class GSWImage</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,15 +35,15 @@ static char rcsId[] = "$Id$";
@implementation GSWImage @implementation GSWImage
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
if ((self=[super initWithName:name_ if ((self=[super initWithName:name
associations:associations_ associations:associations
contentElements:elements_])) contentElements:elements]))
{ {
}; };
return self; return self;
}; };
@ -69,8 +75,8 @@ static char rcsId[] = "$Id$";
-(NSString*)description -(NSString*)description
{ {
return [NSString stringWithFormat:@"<%s %p>", return [NSString stringWithFormat:@"<%s %p>",
object_get_class_name(self), object_get_class_name(self),
(void*)self]; (void*)self];
}; };

View file

@ -1,11 +1,16 @@
/* GSWImageButton.h - GSWeb: Class GSWImageButton /** GSWImageButton.h - <title>GSWeb: Class GSWImageButton</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -30,62 +36,68 @@
//==================================================================== //====================================================================
@interface GSWImageButton: GSWInput @interface GSWImageButton: GSWInput
{ {
GSWAssociation* imageMapFileName; GSWAssociation* _imageMapFileName;
//GSWeb Additions { //GSWeb Additions {
GSWAssociation* imageMapString; GSWAssociation* _imageMapString;
GSWAssociation* imageMapRegions; GSWAssociation* _imageMapRegions;
// } // }
GSWAssociation* action; GSWAssociation* _action;
GSWAssociation* actionClass; GSWAssociation* _actionClass;
GSWAssociation* directActionName; GSWAssociation* _directActionName;
GSWAssociation* xAssoc; GSWAssociation* _xAssoc;
GSWAssociation* yAssoc; GSWAssociation* _yAssoc;
GSWAssociation* filename; GSWAssociation* _filename;
GSWAssociation* framework; GSWAssociation* _framework;
GSWAssociation* src; GSWAssociation* _src;
GSWAssociation* data; GSWAssociation* _data;
GSWAssociation* mimeType; GSWAssociation* _mimeType;
GSWAssociation* key; GSWAssociation* _key;
}; };
-(void)dealloc; -(void)dealloc;
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(NSString*)description; -(NSString*)description;
-(NSString*)elementName; -(NSString*)elementName;
@end @end
//==================================================================== //====================================================================
@interface GSWImageButton (GSWImageButtonA) @interface GSWImageButton (GSWImageButtonA)
-(GSWAssociation*)hitTestX:(int)x_ -(GSWAssociation*)hitTestX:(int)x
y:(int)y_ y:(int)y
inRegions:(NSArray*)regions_; inRegions:(NSArray*)regions;
@end @end
//==================================================================== //====================================================================
@interface GSWImageButton (GSWImageButtonB) @interface GSWImageButton (GSWImageButtonB)
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(id)_imageURLInContext:(GSWContext*)context_;
-(void)appendToResponse:(GSWResponse*)response_ -(id)_imageURLInContext:(GSWContext*)context;
inContext:(GSWContext*)context_;
-(void)_appendDirectActionToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_
inContext:(GSWContext*)context_; -(void)_appendDirectActionToResponse:(GSWResponse*)response
-(void)takeValuesFromRequest:(GSWRequest*)request_ inContext:(GSWContext*)context;
inContext:(GSWContext*)context_;
-(NSString*)frameworkNameInContext:(GSWContext*)context_; -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context;
-(NSString*)frameworkNameInContext:(GSWContext*)context;
@end @end
//==================================================================== //====================================================================
@interface GSWImageButton (GSWImageButtonC) @interface GSWImageButton (GSWImageButtonC)
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping; withMapping:(char*)mapping;
-(BOOL)appendStringAtLeft:(id)_unkwnon -(BOOL)appendStringAtLeft:(id)unkwnon
withMapping:(char*)_mapping; withMapping:(char*)mapping;
@end @end
#endif //_GSWImageButton_h__ #endif //_GSWImageButton_h__

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,16 @@
/* GSWInput.h - GSWeb: Class GSWInput /** GSWInput.h - <title>GSWeb: Class GSWInput</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Feb 1999 Date: Feb 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -30,23 +36,23 @@
//==================================================================== //====================================================================
@interface GSWInput: GSWHTMLDynamicElement @interface GSWInput: GSWHTMLDynamicElement
{ {
GSWAssociation* disabled; GSWAssociation* _disabled;
//GSWeb Additions { //GSWeb Additions {
GSWAssociation* enabled; GSWAssociation* _enabled;
//} //}
GSWAssociation* name; GSWAssociation* _name;
GSWAssociation* value; GSWAssociation* _value;
//GSWeb Additions { //GSWeb Additions {
GSWAssociation* handleValidationException; GSWAssociation* _handleValidationException;
// } // }
//GSWeb Additions { //GSWeb Additions {
GSWAssociation* tcEscapeHTML; GSWAssociation* _tcEscapeHTML;
// } // }
}; };
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(void)dealloc; -(void)dealloc;
-(NSString*)elementName; -(NSString*)elementName;
@ -54,27 +60,27 @@
//==================================================================== //====================================================================
@interface GSWInput (GSWInputA) @interface GSWInput (GSWInputA)
-(NSString*)nameInContext:(GSWContext*)context_; -(NSString*)nameInContext:(GSWContext*)context;
-(NSString*)valueInContext:(GSWContext*)context_; -(NSString*)valueInContext:(GSWContext*)context;
-(void)resetAutoValue; -(void)resetAutoValue;
-(BOOL)disabledInContext:(GSWContext*)context_; -(BOOL)disabledInContext:(GSWContext*)context;
@end @end
//==================================================================== //====================================================================
@interface GSWInput (GSWInputB) @interface GSWInput (GSWInputB)
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
@end @end
//==================================================================== //====================================================================
@interface GSWInput (GSWInputC) @interface GSWInput (GSWInputC)
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)appendValueToResponse:(GSWResponse*)response_ -(void)appendValueToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)appendNameToResponse:(GSWResponse*)response_ -(void)appendNameToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
@end @end
@ -87,8 +93,8 @@
@interface GSWInput (GSWInputE) @interface GSWInput (GSWInputE)
#if !GSWEB_STRICT #if !GSWEB_STRICT
-(void)handleValidationException:(NSException*)exception_ -(void)handleValidationException:(NSException*)exception
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
#endif #endif
@end @end

View file

@ -1,11 +1,16 @@
/* GSWInput.m - GSWeb: Class GSWInput /** GSWInput.m - <title>GSWeb: Class GSWInput</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Feb 1999 Date: Feb 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,56 +35,57 @@ static char rcsId[] = "$Id$";
@implementation GSWInput @implementation GSWInput
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
NSMutableDictionary* _attributedAssociations=[[associations_ mutableCopy] autorelease]; NSMutableDictionary* attributedAssociations=[[associations mutableCopy] autorelease];
LOGObjectFnStartC("GSWInput"); LOGObjectFnStartC("GSWInput");
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_); NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",aName,associations,elements);
[_attributedAssociations removeObjectForKey:disabled__Key]; [attributedAssociations removeObjectForKey:disabled__Key];
[_attributedAssociations removeObjectForKey:enabled__Key];//?? [attributedAssociations removeObjectForKey:enabled__Key];//??
[_attributedAssociations removeObjectForKey:value__Key];//?? [attributedAssociations removeObjectForKey:value__Key];//??
if (!WOStrictFlag) if (!WOStrictFlag)
[_attributedAssociations removeObjectForKey:handleValidationException__Key]; [attributedAssociations removeObjectForKey:handleValidationException__Key];
value = [[associations_ objectForKey:value__Key _value = [[associations objectForKey:value__Key
withDefaultObject:[value autorelease]] retain]; withDefaultObject:[_value autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWInput: value=%@",value); NSDebugMLLog(@"gswdync",@"GSWInput: value=%@",_value);
if ((self=[super initWithName:name_ if ((self=[super initWithName:aName
attributeAssociations:_attributedAssociations attributeAssociations:attributedAssociations
contentElements:elements_])) contentElements:elements]))
{ {
disabled = [[associations_ objectForKey:disabled__Key _disabled = [[associations objectForKey:disabled__Key
withDefaultObject:[disabled autorelease]] retain]; withDefaultObject:[_disabled autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWInput: disabled=%@",disabled); NSDebugMLLog(@"gswdync",@"GSWInput: disabled=%@",_disabled);
if (!WOStrictFlag) if (!WOStrictFlag)
{
_enabled = [[associations objectForKey:enabled__Key
withDefaultObject:[_enabled autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWInput: enabled=%@",_enabled);
if (_disabled && _enabled)
{ {
enabled = [[associations_ objectForKey:enabled__Key ExceptionRaise0(@"GSWInput",@"You can't use 'diabled' and 'enabled' parameters at the same time.");
withDefaultObject:[enabled autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWInput: enabled=%@",enabled);
if (disabled && enabled)
{
ExceptionRaise0(@"GSWInput",@"You can't use 'diabled' and 'enabled' parameters at the same time.");
};
}; };
name = [[associations_ objectForKey:name__Key };
withDefaultObject:[name autorelease]] retain]; _name = [[associations objectForKey:name__Key
NSDebugMLLog(@"gswdync",@"GSWInput: name=%@",name); withDefaultObject:[_name autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWInput: name=%@",_name);
if (!WOStrictFlag)
if (!WOStrictFlag)
{
_handleValidationException = [[associations objectForKey:handleValidationException__Key
withDefaultObject:[_handleValidationException autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWInput: handleValidationException=%@",_handleValidationException);
// Turbocat Additions
// [attributedAssociations removeObjectForKey: escapeHTML__Key];
if ([associations objectForKey: escapeHTML__Key])
{ {
handleValidationException = [[associations_ objectForKey:handleValidationException__Key _tcEscapeHTML = [[associations objectForKey:escapeHTML__Key
withDefaultObject:[handleValidationException autorelease]] retain]; withDefaultObject:nil] retain];
NSDebugMLLog(@"gswdync",@"GSWInput: handleValidationException=%@",handleValidationException);
// Turbocat Additions
// [_attributedAssociations removeObjectForKey: escapeHTML__Key];
if ([associations_ objectForKey: escapeHTML__Key])
{
tcEscapeHTML = [[associations_ objectForKey:escapeHTML__Key withDefaultObject:nil] retain];
};
}; };
}; };
};
LOGObjectFnStopC("GSWInput"); LOGObjectFnStopC("GSWInput");
return self; return self;
}; };
@ -86,12 +93,12 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(disabled); DESTROY(_disabled);
DESTROY(enabled);//GSWeb Only DESTROY(_enabled);//GSWeb Only
DESTROY(name); DESTROY(_name);
DESTROY(value); DESTROY(_value);
DESTROY(handleValidationException);//GSWeb Only DESTROY(_handleValidationException);//GSWeb Only
DESTROY(tcEscapeHTML);//GSWeb Only DESTROY(_tcEscapeHTML);//GSWeb Only
[super dealloc]; [super dealloc];
}; };
@ -107,49 +114,49 @@ static char rcsId[] = "$Id$";
@implementation GSWInput (GSWInputA) @implementation GSWInput (GSWInputA)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)nameInContext:(GSWContext*)_context -(NSString*)nameInContext:(GSWContext*)context
{ {
//OK //OK
GSWComponent* _component=nil; GSWComponent* component=nil;
NSString* _name=nil; NSString* nameValue=nil;
LOGObjectFnStartC("GSWInput"); LOGObjectFnStartC("GSWInput");
if (name) if (_name)
{ {
_component=[_context component]; component=[context component];
_name=[name valueInComponent:_component]; nameValue=[_name valueInComponent:component];
} }
else else
{ {
_name=[_context elementID]; nameValue=[context elementID];
NSDebugMLLog(@"gswdync",@"_elementID=%@",[_context elementID]); NSDebugMLLog(@"gswdync",@"elementID=%@",[context elementID]);
}; };
LOGObjectFnStopC("GSWInput"); LOGObjectFnStopC("GSWInput");
return _name; return nameValue;
}; };
static int countAutoValue = 0; static int countAutoValue = 0;
//-------------------------------------------------------------------- //--------------------------------------------------------------------
- (NSString *)valueInContext:(GSWContext *)_context -(NSString*)valueInContext:(GSWContext*)context
{ {
//OK //OK
GSWComponent *_component=nil; GSWComponent *component=nil;
NSString *_value=nil; NSString *valueValue=nil;
LOGObjectFnStartC("GSWInput"); LOGObjectFnStartC("GSWInput");
countAutoValue++; countAutoValue++;
if(value) if(_value)
{ {
_component=[_context component]; component=[context component];
_value=[value valueInComponent:_component]; valueValue=[_value valueInComponent:component];
} }
else else
{ {
_value=[NSString stringWithFormat:@"%@.%d", [_context elementID], countAutoValue]; valueValue=[NSString stringWithFormat:@"%@.%d", [context elementID], countAutoValue];
NSDebugMLLog(@"gswdync",@"_elementID=%@ _countAutoValue",[_context elementID], countAutoValue); NSDebugMLLog(@"gswdync",@"elementID=%@ _countAutoValue",[context elementID], countAutoValue);
} }
LOGObjectFnStopC("GSWInput"); LOGObjectFnStopC("GSWInput");
return _value; return valueValue;
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -163,15 +170,15 @@ static int countAutoValue = 0;
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(BOOL)disabledInContext:(GSWContext*)_context -(BOOL)disabledInContext:(GSWContext*)context
{ {
//OK //OK
if (!WOStrictFlag && enabled) if (!WOStrictFlag && _enabled)
return ![self evaluateCondition:enabled return ![self evaluateCondition:_enabled
inContext:_context]; inContext:context];
else else
return [self evaluateCondition:disabled return [self evaluateCondition:_disabled
inContext:_context]; inContext:context];
}; };
@end @end
@ -180,44 +187,43 @@ static int countAutoValue = 0;
@implementation GSWInput (GSWInputB) @implementation GSWInput (GSWInputB)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
BOOL _disabledInContext=NO; BOOL disabledInContext=NO;
LOGObjectFnStartC("GSWInput"); LOGObjectFnStartC("GSWInput");
GSWAssertCorrectElementID(context_);// Debug Only GSWAssertCorrectElementID(context);// Debug Only
_disabledInContext=[self disabledInContext:context_]; //return 0 disabledInContext=[self disabledInContext:context]; //return 0
if (!_disabledInContext) if (!disabledInContext)
{ {
BOOL _wasFormSubmitted=[context_ _wasFormSubmitted]; BOOL wasFormSubmitted=[context _wasFormSubmitted];
if (_wasFormSubmitted) if (wasFormSubmitted)
{ {
GSWComponent* _component=[context_ component]; GSWComponent* component=[context component];
NSString* _nameInContext=[self nameInContext:context_]; NSString* nameInContext=[self nameInContext:context];
NSString* _value=[request_ formValueForKey:_nameInContext]; NSString* value=[request formValueForKey:nameInContext];
NSDebugMLLog(@"gswdync",@"_nameInContext=%@",_nameInContext); NSDebugMLLog(@"gswdync",@"nameInContext=%@",nameInContext);
NSDebugMLLog(@"gswdync",@"_value=%@",_value); NSDebugMLLog(@"gswdync",@"value=%@",value);
if (!WOStrictFlag) if (!WOStrictFlag)
{ {
NS_DURING NS_DURING
{ {
[value setValue:_value [value setValue:value
inComponent:_component]; inComponent:component];
}; };
NS_HANDLER NS_HANDLER
{ {
[self handleValidationException:localException [self handleValidationException:localException
inContext:context_]; inContext:context];
} }
NS_ENDHANDLER; NS_ENDHANDLER;
} }
else else
[value setValue:_value [value setValue:value
inComponent:_component]; inComponent:component];
}; };
};
};
LOGObjectFnStopC("GSWInput"); LOGObjectFnStopC("GSWInput");
}; };
@ -227,73 +233,74 @@ static int countAutoValue = 0;
@implementation GSWInput (GSWInputC) @implementation GSWInput (GSWInputC)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
BOOL _disabledInContext=NO; BOOL disabledInContext=NO;
LOGObjectFnStartC("GSWInput"); LOGObjectFnStartC("GSWInput");
_disabledInContext=[self disabledInContext:context_]; //return 0 disabledInContext=[self disabledInContext:context]; //return 0
if (_disabledInContext) if (disabledInContext)
[response_ _appendContentAsciiString:@" disabled"]; [response _appendContentAsciiString:@" disabled"];
[self appendValueToResponse:response_ [self appendValueToResponse:response
inContext:context_]; inContext:context];
[self appendNameToResponse:response_ [self appendNameToResponse:response
inContext:context_]; inContext:context];
LOGObjectFnStopC("GSWInput"); LOGObjectFnStopC("GSWInput");
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendValueToResponse:(GSWResponse*)response_ -(void)appendValueToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
GSWComponent* _component=nil; GSWComponent* component=nil;
LOGObjectFnStartC("GSWInput"); LOGObjectFnStartC("GSWInput");
GSWSaveAppendToResponseElementID(context_);//Debug Only GSWSaveAppendToResponseElementID(context);//Debug Only
_component=[context_ component]; component=[context component];
if (value) if (_value)
{ {
id _value=[value valueInComponent:_component]; id valueValue=[_value valueInComponent:component];
NSDebugMLLog(@"gswdync",@"_value=%@",_value); NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (_value) if (valueValue)
{ {
[response_ appendContentCharacter:' ']; [response appendContentCharacter:' '];
[response_ _appendContentAsciiString:@"value"]; [response _appendContentAsciiString:@"value"];
[response_ appendContentCharacter:'=']; [response appendContentCharacter:'='];
[response_ appendContentCharacter:'"']; [response appendContentCharacter:'"'];
if (tcEscapeHTML && [self evaluateCondition:tcEscapeHTML inContext:context_] == NO) if (_tcEscapeHTML && [self evaluateCondition:_tcEscapeHTML
{ inContext:context] == NO)
[response_ appendContentString:_value]; {
} [response appendContentString:valueValue];
else }
{ else
[response_ appendContentHTMLAttributeValue:_value]; {
}; [response appendContentHTMLAttributeValue:valueValue];
[response_ appendContentCharacter:'"']; };
}; [response appendContentCharacter:'"'];
}; };
};
LOGObjectFnStopC("GSWInput"); LOGObjectFnStopC("GSWInput");
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendNameToResponse:(GSWResponse*)response_ -(void)appendNameToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
NSString* _name=nil; NSString* name=nil;
LOGObjectFnStartC("GSWInput"); LOGObjectFnStartC("GSWInput");
_name=[self nameInContext:context_]; name=[self nameInContext:context];
NSDebugMLLog(@"gswdync",@"_name=%@",_name); NSDebugMLLog(@"gswdync",@"name=%@",name);
if (_name) if (name)
{ {
[response_ appendContentCharacter:' ']; [response appendContentCharacter:' '];
[response_ _appendContentAsciiString:@"name"]; [response _appendContentAsciiString:@"name"];
[response_ appendContentCharacter:'=']; [response appendContentCharacter:'='];
[response_ appendContentCharacter:'"']; [response appendContentCharacter:'"'];
[response_ appendContentHTMLAttributeValue:_name]; [response appendContentHTMLAttributeValue:name];
[response_ appendContentCharacter:'"']; [response appendContentCharacter:'"'];
}; };
LOGObjectFnStopC("GSWInput"); LOGObjectFnStopC("GSWInput");
}; };
@ -314,60 +321,60 @@ static int countAutoValue = 0;
@implementation GSWInput (GSWInputE) @implementation GSWInput (GSWInputE)
//GSWeb additions { //GSWeb additions {
-(void)handleValidationException:(NSException*)exception_ -(void)handleValidationException:(NSException*)exception
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
BOOL _isValidationException=[exception_ isValidationException]; BOOL isValidationException=[exception isValidationException];
BOOL _raise=YES; BOOL raise=YES;
LOGObjectFnStartC("GSWInput"); LOGObjectFnStartC("GSWInput");
if (_isValidationException) if (isValidationException)
{ {
GSWComponent* _component=[context_ component]; GSWComponent* component=[context component];
id _handleValidationException=[handleValidationException valueInComponent:_component]; id handleValidationException=[handleValidationException valueInComponent:component];
BOOL _handle=NO; BOOL handle=NO;
if (!_handleValidationException) if (!handleValidationException)
{ {
_handleValidationException = [_component handleValidationExceptionDefault]; handleValidationException = [component handleValidationExceptionDefault];
}; };
if (_handleValidationException) if (handleValidationException)
{ {
if ([_handleValidationException isEqualToString:@"handleAndRaise"]) if ([handleValidationException isEqualToString:@"handleAndRaise"])
{ {
_handle=YES; handle=YES;
_raise=YES; raise=YES;
} }
else if ([_handleValidationException isEqualToString:@"handle"]) else if ([handleValidationException isEqualToString:@"handle"])
{ {
_handle=YES; handle=YES;
_raise=NO; raise=NO;
} }
else if ([_handleValidationException isEqualToString:@"raise"]) else if ([handleValidationException isEqualToString:@"raise"])
{ {
_handle=NO; handle=NO;
_raise=YES; raise=YES;
} }
else else
{ {
NSDebugMLog(@"Unknown case for handleValidationException %@",_handleValidationException); NSDebugMLog(@"Unknown case for handleValidationException %@",handleValidationException);
}; };
}; };
if (_handle) if (handle)
{ {
NSDebugMLog(@"Handled validation exception %@",exception_); NSDebugMLog(@"Handled validation exception %@",exception);
[_component setValidationFailureMessage:[[exception_ userInfo]objectForKey:@"message"] [component setValidationFailureMessage:[[exception userInfo]objectForKey:@"message"]
forElement:self]; forElement:self];
} }
else else
{ {
NSDebugMLog(@"Unhandled validation exception %@",exception_); NSDebugMLog(@"Unhandled validation exception %@",exception);
}; };
}; };
if (_raise) if (raise)
{ {
NSDebugMLog(@"Raise exception %@",exception_); NSDebugMLog(@"Raise exception %@",exception);
exception_=ExceptionByAddingUserInfoObjectFrameInfo0(exception_,@"handleValidationException:inContext"); exception=ExceptionByAddingUserInfoObjectFrameInfo0(exception,@"handleValidationException:inContext");
[exception_ raise]; [exception raise];
}; };
LOGObjectFnStopC("GSWInput"); LOGObjectFnStopC("GSWInput");
}; };
// } // }

View file

@ -1,11 +1,16 @@
/* GSWPasswordField.h - GSWeb: Class GSWPasswordField /** GSWPasswordField.h - <title>GSWeb: Class GSWPasswordField</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,9 +35,9 @@
//OK //OK
//==================================================================== //====================================================================
@interface GSWPasswordField: GSWInput @interface GSWPasswordField: GSWInput
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
@end @end

View file

@ -1,11 +1,16 @@
/* GSWPasswordField.m - GSWeb: Class GSWPasswordField /** GSWPasswordField.m - <title>GSWeb: Class GSWPasswordField</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -27,20 +33,21 @@ static char rcsId[] = "$Id$";
//==================================================================== //====================================================================
@implementation GSWPasswordField @implementation GSWPasswordField
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
LOGObjectFnStartC("GSWPasswordField"); LOGObjectFnStartC("GSWPasswordField");
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,elements_); NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",
[_associations setObject:[GSWAssociation associationWithValue:@"password"] aName,associations,elements);
forKey:@"type"]; [tmpAssociations setObject:[GSWAssociation associationWithValue:@"password"]
if ((self=[super initWithName:name_ forKey:@"type"];
associations:_associations if ((self=[super initWithName:aName
contentElements:nil])) //No Childs! associations:tmpAssociations
{ contentElements:nil])) //No Childs!
}; {
};
LOGObjectFnStopC("GSWPasswordField"); LOGObjectFnStopC("GSWPasswordField");
return self; return self;
}; };

View file

@ -1,11 +1,16 @@
/* GSWPopUpButton.h - GSWeb: Class GSWPopUpButton /** GSWPopUpButton.h - <title>GSWeb: Class GSWPopUpButton</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,24 +35,24 @@
@interface GSWPopUpButton: GSWInput @interface GSWPopUpButton: GSWInput
{ {
GSWAssociation* list; GSWAssociation* _list;
GSWAssociation* item; GSWAssociation* _item;
GSWAssociation* displayString; GSWAssociation* _displayString;
GSWAssociation* selection; GSWAssociation* _selection;
//GSWeb Additions { //GSWeb Additions {
GSWAssociation* selectionValue; GSWAssociation* _selectionValue;
// } // }
GSWAssociation* selectedValue; GSWAssociation* _selectedValue;
GSWAssociation* noSelectionString; GSWAssociation* _noSelectionString;
GSWAssociation* escapeHTML; GSWAssociation* _escapeHTML;
BOOL autoValue; BOOL _autoValue;
}; };
-(void)dealloc; -(void)dealloc;
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(NSString*)description; -(NSString*)description;
-(NSString*)elementName; -(NSString*)elementName;
@ -54,23 +60,25 @@
@interface GSWPopUpButton (GSWPopUpButtonA) @interface GSWPopUpButton (GSWPopUpButtonA)
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)appendValueToResponse:(GSWResponse*)response_ -(void)appendValueToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_
inContext:(GSWContext*)context_; -(void)_fastTakeValuesFromRequest:(GSWRequest*)request
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_ inContext:(GSWContext*)context;
inContext:(GSWContext*)context_;
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context;
@end @end
@interface GSWPopUpButton (GSWPopUpButtonB) @interface GSWPopUpButton (GSWPopUpButtonB)
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping; withMapping:(char*)mapping;
@end @end
#endif //_GSWPopUpButton_h__ #endif //_GSWPopUpButton_h__

View file

@ -1,11 +1,16 @@
/* GSWPopUpButton.m - GSWeb: Class GSWPopUpButton /** GSWPopUpButton.m - <title>GSWeb: Class GSWPopUpButton</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,59 +35,60 @@ static char rcsId[] = "$Id$";
@implementation GSWPopUpButton @implementation GSWPopUpButton
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)_elements contentElements:(NSArray*)elements
{ {
//OK //OK
NSMutableDictionary* _associations=nil; NSMutableDictionary* tmpAssociations=nil;
LOGObjectFnStartC("GSWPopUpButton"); LOGObjectFnStartC("GSWPopUpButton");
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements); NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ _elements=%@",
_associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; aName,associations,elements);
[_associations removeObjectForKey:list__Key]; tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
[_associations removeObjectForKey:item__Key]; [tmpAssociations removeObjectForKey:list__Key];
[_associations removeObjectForKey:displayString__Key]; [tmpAssociations removeObjectForKey:item__Key];
[_associations removeObjectForKey:selection__Key]; [tmpAssociations removeObjectForKey:displayString__Key];
[tmpAssociations removeObjectForKey:selection__Key];
if (!WOStrictFlag) if (!WOStrictFlag)
[_associations removeObjectForKey:selectionValue__Key]; [tmpAssociations removeObjectForKey:selectionValue__Key];
[_associations removeObjectForKey:selectedValue__Key]; [tmpAssociations removeObjectForKey:selectedValue__Key];
[_associations removeObjectForKey:noSelectionString__Key]; [tmpAssociations removeObjectForKey:noSelectionString__Key];
[_associations removeObjectForKey:escapeHTML__Key]; [tmpAssociations removeObjectForKey:escapeHTML__Key];
if ((self=[super initWithName:name_ if ((self=[super initWithName:aName
associations:_associations associations:tmpAssociations
contentElements:nil])) contentElements:nil]))
{ {
list=[[associations_ objectForKey:list__Key _list=[[associations objectForKey:list__Key
withDefaultObject:[list autorelease]] retain]; withDefaultObject:[_list autorelease]] retain];
item=[[associations_ objectForKey:item__Key _item=[[associations objectForKey:item__Key
withDefaultObject:[item autorelease]] retain]; withDefaultObject:[_item autorelease]] retain];
displayString=[[associations_ objectForKey:displayString__Key _displayString=[[associations objectForKey:displayString__Key
withDefaultObject:[displayString autorelease]] retain]; withDefaultObject:[_displayString autorelease]] retain];
selection=[[associations_ objectForKey:selection__Key _selection=[[associations objectForKey:selection__Key
withDefaultObject:[selection autorelease]] retain]; withDefaultObject:[_selection autorelease]] retain];
if (selection && ![selection isValueSettable]) if (_selection && ![_selection isValueSettable])
{ {
//TODO //TODO
}; };
if (!WOStrictFlag) if (!WOStrictFlag)
{
_selectionValue=[[associations objectForKey:selectionValue__Key
withDefaultObject:[_selectionValue autorelease]] retain];
if (_selectionValue && ![_selectionValue isValueSettable])
{ {
selectionValue=[[associations_ objectForKey:selectionValue__Key //TODO
withDefaultObject:[selectionValue autorelease]] retain];
if (selectionValue && ![selectionValue isValueSettable])
{
//TODO
};
}; };
};
selectedValue=[[associations_ objectForKey:selectedValue__Key
withDefaultObject:[selectedValue autorelease]] retain]; _selectedValue=[[associations objectForKey:selectedValue__Key
noSelectionString=[[associations_ objectForKey:noSelectionString__Key withDefaultObject:[_selectedValue autorelease]] retain];
withDefaultObject:[noSelectionString autorelease]] retain]; _noSelectionString=[[associations objectForKey:noSelectionString__Key
escapeHTML=[[associations_ objectForKey:escapeHTML__Key withDefaultObject:[_noSelectionString autorelease]] retain];
withDefaultObject:[escapeHTML autorelease]] retain]; _escapeHTML=[[associations objectForKey:escapeHTML__Key
}; withDefaultObject:[_escapeHTML autorelease]] retain];
};
LOGObjectFnStopC("GSWPopUpButton"); LOGObjectFnStopC("GSWPopUpButton");
return self; return self;
}; };
@ -89,14 +96,14 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(list); DESTROY(_list);
DESTROY(item); DESTROY(_item);
DESTROY(displayString); DESTROY(_displayString);
DESTROY(selection); DESTROY(_selection);
DESTROY(selectionValue);//GSWeb Only DESTROY(_selectionValue);//GSWeb Only
DESTROY(selectedValue); DESTROY(_selectedValue);
DESTROY(noSelectionString); DESTROY(_noSelectionString);
DESTROY(escapeHTML); DESTROY(_escapeHTML);
[super dealloc]; [super dealloc];
}; };
@ -111,8 +118,8 @@ static char rcsId[] = "$Id$";
-(NSString*)description -(NSString*)description
{ {
return [NSString stringWithFormat:@"<%s %p>", return [NSString stringWithFormat:@"<%s %p>",
object_get_class_name(self), object_get_class_name(self),
(void*)self]; (void*)self];
}; };
//==================================================================== //====================================================================
@ -120,378 +127,378 @@ static char rcsId[] = "$Id$";
//#define ENABLE_OPTGROUP //#define ENABLE_OPTGROUP
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
GSWRequest* _request=nil; GSWRequest* request=nil;
BOOL _isFromClientComponent=NO; BOOL isFromClientComponent=NO;
GSWComponent* _component=nil; GSWComponent* component=nil;
NSArray* _listValue=nil; NSArray* listValue=nil;
id _selectionValue=nil; id selectionValue=nil;
id _selectedValueValue=nil; id selectedValueValue=nil;
id _valueValue=nil; id valueValue=nil;
id _itemValue=nil; id itemValue=nil;
id _displayStringValue=nil; id displayStringValue=nil;
BOOL _escapeHTML=YES; BOOL escapeHTMLBoolValue=YES;
id _escapeHTMLValue=nil; id escapeHTMLValue=nil;
int i=0; int i=0;
BOOL _inOptGroup=NO; BOOL inOptGroup=NO;
#ifndef ENABLE_OPTGROUP #ifndef ENABLE_OPTGROUP
BOOL _optGroupLabel=NO; BOOL optGroupLabel=NO;
#endif #endif
LOGObjectFnStartC("GSWPopUpButton"); LOGObjectFnStartC("GSWPopUpButton");
[self resetAutoValue]; [self resetAutoValue];
autoValue = NO; _autoValue = NO;
_request=[context_ request]; request=[context request];
_isFromClientComponent=[_request isFromClientComponent]; isFromClientComponent=[request isFromClientComponent];
_component=[context_ component]; component=[context component];
[super appendToResponse:response_ [super appendToResponse:response
inContext:context_]; inContext:context];
_listValue=[list valueInComponent:_component]; listValue=[_list valueInComponent:component];
NSDebugMLLog(@"gswdync",@"_listValue=%@",_listValue); NSDebugMLLog(@"gswdync",@"listValue=%@",listValue);
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'", @"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
list, _list,
_listValue, listValue,
[_listValue class]); [listValue class]);
_selectionValue=[selection valueInComponent:_component]; selectionValue=[_selection valueInComponent:component];
NSDebugMLLog(@"gswdync",@"selection=%@",selection); NSDebugMLLog(@"gswdync",@"selection=%@",_selection);
NSDebugMLLog(@"gswdync",@"_selectionValue=%@",_selectionValue); NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue);
_selectedValueValue=[selectedValue valueInComponent:_component]; selectedValueValue=[_selectedValue valueInComponent:component];
NSDebugMLLog(@"gswdync",@"selectedValue=%@",selectedValue); NSDebugMLLog(@"gswdync",@"selectedValue=%@",_selectedValue);
NSDebugMLLog(@"gswdync",@"_selectedValueValue=%@",_selectedValueValue); NSDebugMLLog(@"gswdync",@"selectedValueValue=%@",selectedValueValue);
if (escapeHTML) if (_escapeHTML)
{ {
_escapeHTMLValue=[escapeHTML valueInComponent:_component]; escapeHTMLValue=[_escapeHTML valueInComponent:component];
_escapeHTML=boolValueFor(_escapeHTMLValue); escapeHTMLBoolValue=boolValueFor(escapeHTMLValue);
}; };
if (noSelectionString) if (_noSelectionString)
{ {
id _noSelectionStringValue=nil; id noSelectionStringValue=nil;
[response_ _appendContentAsciiString:@"\n<OPTION"]; [response _appendContentAsciiString:@"\n<OPTION"];
if (selectedValue && !_selectedValueValue) if (_selectedValue && !selectedValueValue)
{ {
[response_ appendContentCharacter:' ']; [response appendContentCharacter:' '];
[response_ _appendContentAsciiString:@"selected"];//TODO [response _appendContentAsciiString:@"selected"];//TODO
}; };
[response_ appendContentCharacter:'>']; [response appendContentCharacter:'>'];
_noSelectionStringValue=[noSelectionString valueInComponent:_component]; noSelectionStringValue=[_noSelectionString valueInComponent:component];
if (_escapeHTML) if (escapeHTMLBoolValue)
_noSelectionStringValue=[GSWResponse stringByEscapingHTMLString:_noSelectionStringValue]; noSelectionStringValue=[GSWResponse stringByEscapingHTMLString:noSelectionStringValue];
[response_ appendContentString:_noSelectionStringValue]; [response appendContentString:noSelectionStringValue];
//[response_ appendContentHTMLString:_noSelectionStringValue]; //[response appendContentHTMLString:_noSelectionStringValue];
// There is no close tag on OPTION // There is no close tag on OPTION
//[response_ _appendContentAsciiString:@"</OPTION>"]; //[response _appendContentAsciiString:@"</OPTION>"];
}; };
for(i=0;i<[_listValue count];i++) for(i=0;i<[listValue count];i++)
{ {
NSDebugMLLog(@"gswdync",@"_inOptGroup=%s",(_inOptGroup ? "YES" : "NO")); NSDebugMLLog(@"gswdync",@"inOptGroup=%s",(inOptGroup ? "YES" : "NO"));
_itemValue=[_listValue objectAtIndex:i]; itemValue=[listValue objectAtIndex:i];
if (item) if (_item)
[item setValue:_itemValue [_item setValue:itemValue
inComponent:_component]; inComponent:component];
NSDebugMLLog(@"gswdync",@"_itemValue=%@",_itemValue); NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
if (_itemValue) if (itemValue)
{ {
NSDebugMLLog(@"gswdync",@"value=%@",value); NSDebugMLLog(@"gswdync",@"value=%@",_value);
_valueValue=[self valueInContext:context_]; valueValue=[self valueInContext:context];
NSDebugMLLog(@"gswdync",@"_valueValue=%@",_valueValue); NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (_valueValue) if (valueValue)
{ {
BOOL _isEqual; BOOL isEqual;
NSDebugMLLog0(@"gswdync",@"Adding OPTION"); NSDebugMLLog0(@"gswdync",@"Adding OPTION");
[response_ _appendContentAsciiString:@"\n<OPTION"]; [response _appendContentAsciiString:@"\n<OPTION"];
if (selection) if (_selection)
{ {
if(value) if (_value)
_isEqual=SBIsValueEqual(_valueValue,_selectionValue); isEqual=SBIsValueEqual(valueValue,selectionValue);
else else
_isEqual=SBIsValueEqual(_itemValue,_selectionValue); isEqual=SBIsValueEqual(itemValue,selectionValue);
if (_isEqual) if (isEqual)
{ {
[response_ appendContentCharacter:' ']; [response appendContentCharacter:' '];
[response_ _appendContentAsciiString:@"selected"]; [response _appendContentAsciiString:@"selected"];
}; };
}; };
if (_isEqual == NO && selectedValue) if (isEqual == NO && _selectedValue)
{ {
if(value) if(_value)
_isEqual=SBIsValueEqual(_valueValue,_selectedValueValue); isEqual=SBIsValueEqual(valueValue,selectedValueValue);
else else
_isEqual=SBIsValueEqual(_itemValue,_selectedValueValue); isEqual=SBIsValueEqual(itemValue,selectedValueValue);
if (_isEqual) if (isEqual)
{ {
[response_ appendContentCharacter:' ']; [response appendContentCharacter:' '];
[response_ _appendContentAsciiString:@"selected"]; [response _appendContentAsciiString:@"selected"];
}; };
}; };
if (value == nil) if (_value == nil)
autoValue = YES; _autoValue = YES;
if (_valueValue) if (valueValue)
{ {
[response_ _appendContentAsciiString:@" value=\""]; [response _appendContentAsciiString:@" value=\""];
[response_ _appendContentAsciiString:_valueValue]; [response _appendContentAsciiString:valueValue];
[response_ appendContentCharacter:'"']; [response appendContentCharacter:'"'];
}; };
[response_ appendContentCharacter:'>']; [response appendContentCharacter:'>'];
}; };
_displayStringValue=nil; displayStringValue=nil;
if (displayString) if (_displayString)
{ {
NSDebugMLLog(@"gswdync",@"displayString=%@",displayString); NSDebugMLLog(@"gswdync",@"displayString=%@",_displayString);
_displayStringValue=[displayString valueInComponent:_component]; displayStringValue=[_displayString valueInComponent:component];
NSDebugMLLog(@"gswdync",@"_displayStringValue=%@",_displayStringValue); NSDebugMLLog(@"gswdync",@"displayStringValue=%@",displayStringValue);
} }
else else
{ {
_displayStringValue = _itemValue; displayStringValue = itemValue;
} }
if (_displayStringValue) if (displayStringValue)
{ {
if (!_valueValue) if (!valueValue)
{ {
if (_inOptGroup) if (inOptGroup)
{ {
NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP"); NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP");
#ifdef ENABLE_OPTGROUP #ifdef ENABLE_OPTGROUP
[response_ _appendContentAsciiString:@"\n</OPTGROUP>"]; [response _appendContentAsciiString:@"\n</OPTGROUP>"];
#endif #endif
_inOptGroup=NO; inOptGroup=NO;
}; };
NSDebugMLLog0(@"gswdync",@"Adding OPTGROUP"); NSDebugMLLog0(@"gswdync",@"Adding OPTGROUP");
#ifdef ENABLE_OPTGROUP #ifdef ENABLE_OPTGROUP
[response_ _appendContentAsciiString:@"\n<OPTGROUP label=\""]; [response _appendContentAsciiString:@"\n<OPTGROUP label=\""];
#else #else
#if 0 #if 0
[response_ _appendContentAsciiString:@"\n<OPTION>-- "]; [response _appendContentAsciiString:@"\n<OPTION>-- "];
_optGroupLabel=YES; optGroupLabel=YES;
#else #else
[response_ _appendContentAsciiString:@"\n<OPTION>"]; [response _appendContentAsciiString:@"\n<OPTION>"];
#endif #endif
_optGroupLabel=YES; optGroupLabel=YES;
#endif #endif
_inOptGroup=YES; inOptGroup=YES;
}; };
//<OPTGROUP label="PortMaster 3"> //<OPTGROUP label="PortMaster 3">
if (_escapeHTML) if (escapeHTMLBoolValue)
_displayStringValue=[GSWResponse stringByEscapingHTMLString:_displayStringValue]; displayStringValue=[GSWResponse stringByEscapingHTMLString:displayStringValue];
NSDebugMLLog(@"gswdync",@"_displayStringValue=%@",_displayStringValue); NSDebugMLLog(@"gswdync",@"displayStringValue=%@",displayStringValue);
#ifndef ENABLE_OPTGROUP #ifndef ENABLE_OPTGROUP
if (_optGroupLabel) if (optGroupLabel)
{ {
_displayStringValue=[NSString stringWithFormat:@"%@ --",_displayStringValue]; displayStringValue=[NSString stringWithFormat:@"%@ --",displayStringValue];
}; };
#endif #endif
[response_ appendContentString:_displayStringValue]; [response appendContentString:displayStringValue];
//[response_ appendContentHTMLString:_displayStringValue]; //[response appendContentHTMLString:_displayStringValue];
}; };
if (_valueValue) if (valueValue)
{ {
//NSDebugMLLog0(@"gswdync",@"Adding /OPTION"); //NSDebugMLLog0(@"gswdync",@"Adding /OPTION");
// K2- No /OPTION TAG // K2- No /OPTION TAG
//[response_ _appendContentAsciiString:@"</OPTION>"]; //[response _appendContentAsciiString:@"</OPTION>"];
} }
else else
{ {
NSDebugMLLog0(@"gswdync",@"Adding > or </OPTION>"); NSDebugMLLog0(@"gswdync",@"Adding > or </OPTION>");
#ifdef ENABLE_OPTGROUP #ifdef ENABLE_OPTGROUP
[response_ _appendContentAsciiString:@"\">"]; [response _appendContentAsciiString:@"\">"];
#else #else
if (_optGroupLabel) if (optGroupLabel)
{ {
//[response_ _appendContentAsciiString:@"</OPTION>"]; //[response _appendContentAsciiString:@"</OPTION>"];
_optGroupLabel=NO; optGroupLabel=NO;
}; };
#endif #endif
}; };
}; };
}; };
if (_inOptGroup) if (inOptGroup)
{ {
#ifdef ENABLE_OPTGROUP #ifdef ENABLE_OPTGROUP
NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP"); NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP");
[response_ _appendContentAsciiString:@"\n</OPTGROUP>"]; [response _appendContentAsciiString:@"\n</OPTGROUP>"];
#endif #endif
_inOptGroup=NO; inOptGroup=NO;
}; };
[response_ _appendContentAsciiString:@"</SELECT>"]; [response _appendContentAsciiString:@"</SELECT>"];
LOGObjectFnStopC("GSWPopUpButton"); LOGObjectFnStopC("GSWPopUpButton");
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendValueToResponse:(GSWResponse*)response_ -(void)appendValueToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
//Does nothing ! //Does nothing !
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
LOGObjectFnStartC("GSWPopUpButton"); LOGObjectFnStartC("GSWPopUpButton");
[self _slowTakeValuesFromRequest:request_ [self _slowTakeValuesFromRequest:request
inContext:context_]; inContext:context];
LOGObjectFnStopC("GSWPopUpButton"); LOGObjectFnStopC("GSWPopUpButton");
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ -(void)_fastTakeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_ -(void)_slowTakeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
BOOL _disabled=NO; BOOL disabledValue=NO;
BOOL _wasFormSubmitted=NO; BOOL wasFormSubmitted=NO;
LOGObjectFnStartC("GSWPopUpButton"); LOGObjectFnStartC("GSWPopUpButton");
[self resetAutoValue]; [self resetAutoValue];
_disabled=[self disabledInContext:context_]; disabledValue=[self disabledInContext:context];
if (!_disabled) if (!disabledValue)
{ {
_wasFormSubmitted=[context_ _wasFormSubmitted]; wasFormSubmitted=[context _wasFormSubmitted];
if (_wasFormSubmitted) if (wasFormSubmitted)
{ {
GSWComponent* _component=nil; GSWComponent* component=nil;
NSArray* _listValue=nil; NSArray* listValue=nil;
id _valueValue=nil; id valueValue=nil;
id _itemValue=nil; id itemValue=nil;
NSString* _name=nil; NSString* name=nil;
NSArray* _formValues=nil; NSArray* formValues=nil;
id _formValue=nil; id formValue=nil;
BOOL _found=NO; BOOL found=NO;
int i=0; int i=0;
_component=[context_ component]; component=[context component];
_name=[self nameInContext:context_]; name=[self nameInContext:context];
NSDebugMLLog(@"gswdync",@"_name=%@",_name); NSDebugMLLog(@"gswdync",@"name=%@",name);
_formValues=[request_ formValuesForKey:_name]; formValues=[request formValuesForKey:name];
NSDebugMLLog(@"gswdync",@"_formValues=%@",_formValues); NSDebugMLLog(@"gswdync",@"formValues=%@",formValues);
if (_formValues && [_formValues count]) if (formValues && [formValues count])
{ {
BOOL _isEqual=NO; BOOL isEqual=NO;
_formValue=[_formValues objectAtIndex:0]; formValue=[formValues objectAtIndex:0];
NSDebugMLLog(@"gswdync",@"_formValue=%@",_formValue); NSDebugMLLog(@"gswdync",@"formValue=%@",formValue);
_listValue=[list valueInComponent:_component]; listValue=[_list valueInComponent:component];
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'", @"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
list, _list,
_listValue, listValue,
[_listValue class]); [listValue class]);
for(i=0;!_found && i<[_listValue count];i++) for(i=0;!found && i<[listValue count];i++)
{ {
_itemValue=[_listValue objectAtIndex:i]; itemValue=[listValue objectAtIndex:i];
NSDebugMLLog(@"gswdync",@"_itemValue=%@",_itemValue); NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
NSDebugMLLog(@"gswdync",@"item=%@",item); NSDebugMLLog(@"gswdync",@"item=%@",_item);
if (item) if (_item)
[item setValue:_itemValue [_item setValue:itemValue
inComponent:_component]; inComponent:component];
NSDebugMLLog(@"gswdync",@"value=%@",value); NSDebugMLLog(@"gswdync",@"value=%@",_value);
_valueValue=[self valueInContext:context_]; valueValue=[self valueInContext:context];
NSDebugMLLog(@"gswdync",@"_valueValue=%@ [class=%@] _formValue=%@ [class=%@]", NSDebugMLLog(@"gswdync",@"valueValue=%@ [class=%@] formValue=%@ [class=%@]",
_valueValue,[_valueValue class], valueValue,[valueValue class],
_formValue,[_formValue class]); formValue,[formValue class]);
_isEqual=SBIsValueEqual(_valueValue,_formValue); isEqual=SBIsValueEqual(valueValue,formValue);
if (_isEqual) if (isEqual)
{ {
if(autoValue == NO) if(_autoValue == NO)
_itemValue = _valueValue; itemValue = valueValue;
NSDebugMLLog(@"gswdync",@"selection=%@",selection); NSDebugMLLog(@"gswdync",@"selection=%@",_selection);
if (selection) if (_selection)
{ {
if (!WOStrictFlag) if (!WOStrictFlag)
{ {
NS_DURING NS_DURING
{ {
[selection setValue:_itemValue [_selection setValue:itemValue
inComponent:_component]; inComponent:component];
}; };
NS_HANDLER NS_HANDLER
{ {
[self handleValidationException:localException [self handleValidationException:localException
inContext:context_]; inContext:context];
} }
NS_ENDHANDLER; NS_ENDHANDLER;
} }
else else
[selection setValue:_itemValue [_selection setValue:itemValue
inComponent:_component]; inComponent:component];
}; };
if (!WOStrictFlag) if (!WOStrictFlag)
{ {
NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue); NSDebugMLLog(@"gswdync",@"selectionValue=%@",_selectionValue);
if (selectionValue) if (_selectionValue)
{ {
NS_DURING NS_DURING
{ {
[selectionValue setValue:_valueValue [_selectionValue setValue:valueValue
inComponent:_component]; inComponent:component];
}; };
NS_HANDLER NS_HANDLER
{ {
[self handleValidationException:localException [self handleValidationException:localException
inContext:context_]; inContext:context];
} }
NS_ENDHANDLER; NS_ENDHANDLER;
}; };
}; };
_found=YES; found=YES;
}; };
}; };
}; };
NSDebugMLLog(@"gswdync",@"_found=%s",(_found ? "YES" : "NO")); NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO"));
if (!_found) if (!found)
{ {
if (selection) if (_selection)
{ {
if (!WOStrictFlag) if (!WOStrictFlag)
{ {
NS_DURING NS_DURING
{ {
[selection setValue:nil [_selection setValue:nil
inComponent:_component]; inComponent:component];
}; };
NS_HANDLER NS_HANDLER
{ {
[self handleValidationException:localException [self handleValidationException:localException
inContext:context_]; inContext:context];
} }
NS_ENDHANDLER; NS_ENDHANDLER;
} }
else else
[selection setValue:nil [_selection setValue:nil
inComponent:_component]; inComponent:component];
}; };
if (!WOStrictFlag && selectionValue) if (!WOStrictFlag && _selectionValue)
{ {
NS_DURING NS_DURING
{ {
[selectionValue setValue:nil [_selectionValue setValue:nil
inComponent:_component]; inComponent:component];
}; };
NS_HANDLER NS_HANDLER
{ {
[self handleValidationException:localException [self handleValidationException:localException
inContext:context_]; inContext:context];
} }
NS_ENDHANDLER; NS_ENDHANDLER;
}; };
}; };
}; };
}; };
LOGObjectFnStopC("GSWPopUpButton"); LOGObjectFnStopC("GSWPopUpButton");
}; };
@ -500,8 +507,8 @@ static char rcsId[] = "$Id$";
//==================================================================== //====================================================================
@implementation GSWPopUpButton (GSWPopUpButtonB) @implementation GSWPopUpButton (GSWPopUpButtonB)
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping withMapping:(char*)mapping
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return NO; return NO;

View file

@ -1,11 +1,16 @@
/* GSWRadioButton.h - GSWeb: Class GSWRadioButton /** GSWRadioButton.h - <title>GSWeb: Class GSWRadioButton</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,13 +35,13 @@
//==================================================================== //====================================================================
@interface GSWRadioButton: GSWInput @interface GSWRadioButton: GSWInput
{ {
GSWAssociation* checked; GSWAssociation* _checked;
GSWAssociation* selection; GSWAssociation* _selection;
}; };
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(void)dealloc; -(void)dealloc;
-(NSString*)description; -(NSString*)description;
@ -43,14 +49,14 @@
//==================================================================== //====================================================================
@interface GSWRadioButton (GSWRadioButtonA) @interface GSWRadioButton (GSWRadioButtonA)
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
@end @end
//==================================================================== //====================================================================
@interface GSWRadioButton (GSWRadioButtonB) @interface GSWRadioButton (GSWRadioButtonB)
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
@end @end

View file

@ -1,11 +1,16 @@
/* GSWRadioButton.m - GSWeb: Class GSWRadioButton /** GSWRadioButton.m - <title>GSWeb: Class GSWRadioButton</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,49 +35,50 @@ static char rcsId[] = "$Id$";
@implementation GSWRadioButton @implementation GSWRadioButton
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)_elements contentElements:(NSArray*)elements
{ {
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements); NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ _elements=%@",
[_associations setObject:[GSWAssociation associationWithValue:@"radio"] aName,associations,elements);
[tmpAssociations setObject:[GSWAssociation associationWithValue:@"radio"]
forKey:@"type"]; forKey:@"type"];
[_associations removeObjectForKey:selection__Key]; [tmpAssociations removeObjectForKey:selection__Key];
[_associations removeObjectForKey:checked__Key]; [tmpAssociations removeObjectForKey:checked__Key];
if ((self=[super initWithName:name_ if ((self=[super initWithName:aName
associations:_associations associations:tmpAssociations
contentElements:nil])) contentElements:nil]))
{ {
selection=[[associations_ objectForKey:selection__Key _selection=[[associations objectForKey:selection__Key
withDefaultObject:[selection autorelease]] retain]; withDefaultObject:[_selection autorelease]] retain];
if (selection && ![selection isValueSettable]) if (_selection && ![_selection isValueSettable])
{ {
ExceptionRaise0(@"GSWRadioButton",@"'selection' parameter must be settable"); ExceptionRaise0(@"GSWRadioButton",@"'selection' parameter must be settable");
}; };
checked=[[associations_ objectForKey:checked__Key _checked=[[associations objectForKey:checked__Key
withDefaultObject:[checked autorelease]] retain]; withDefaultObject:[_checked autorelease]] retain];
if (checked && ![checked isValueSettable]) if (_checked && ![_checked isValueSettable])
{ {
ExceptionRaise0(@"GSWRadioButton",@"'checked' parameter must be settable"); ExceptionRaise0(@"GSWRadioButton",@"'checked' parameter must be settable");
}; };
if (!checked) if (!_checked)
{ {
if (!value || !selection) if (!_value || !_selection)
{ {
ExceptionRaise0(@"GSWRadioButton",@"if you don't specify 'checked' parameter, you have to specify 'value' and 'selection' parameter"); ExceptionRaise0(@"GSWRadioButton",@"if you don't specify 'checked' parameter, you have to specify 'value' and 'selection' parameter");
}; };
}; };
}; };
return self; return self;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(checked); DESTROY(_checked);
DESTROY(selection); DESTROY(_selection);
[super dealloc]; [super dealloc];
}; };
@ -79,8 +86,8 @@ static char rcsId[] = "$Id$";
-(NSString*)description -(NSString*)description
{ {
return [NSString stringWithFormat:@"<%s %p>", return [NSString stringWithFormat:@"<%s %p>",
object_get_class_name(self), object_get_class_name(self),
(void*)self]; (void*)self];
}; };
@end @end
@ -89,33 +96,33 @@ static char rcsId[] = "$Id$";
@implementation GSWRadioButton (GSWRadioButtonA) @implementation GSWRadioButton (GSWRadioButtonA)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
GSWComponent* _component=[context_ component]; GSWComponent* component=[context component];
BOOL _disabledInContext=[self disabledInContext:context_]; BOOL disabledInContext=[self disabledInContext:context];
if (!_disabledInContext) if (!disabledInContext)
{ {
BOOL _checked=NO; BOOL isChecked=NO;
[self appendValueToResponse:response_ [self appendValueToResponse:response
inContext:context_]; inContext:context];
[self appendNameToResponse:response_ [self appendNameToResponse:response
inContext:context_]; inContext:context];
if (checked) if (_checked)
{ {
_checked=[self evaluateCondition:checked isChecked=[self evaluateCondition:_checked
inContext:context_]; inContext:context];
} }
else if (value) else if (_value)
{ {
id _valueValue=[value valueInComponent:_component]; id valueValue=[_value valueInComponent:component];
id _selectionValue=[selection valueInComponent:_component]; id selectionValue=[_selection valueInComponent:component];
_checked=SBIsValueEqual(_selectionValue,_valueValue); isChecked=SBIsValueEqual(selectionValue,valueValue);
}; };
if (_checked) if (isChecked)
[response_ _appendContentAsciiString:@" checked"]; [response _appendContentAsciiString:@" checked"];
}; };
}; };
@end @end
@ -123,77 +130,77 @@ static char rcsId[] = "$Id$";
@implementation GSWRadioButton (GSWRadioButtonB) @implementation GSWRadioButton (GSWRadioButtonB)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
BOOL _disabledInContext=NO; BOOL disabledInContext=NO;
LOGObjectFnStart(); LOGObjectFnStart();
_disabledInContext=[self disabledInContext:context_]; disabledInContext=[self disabledInContext:context];
if (!_disabledInContext) if (!disabledInContext)
{ {
if ([context_ _wasFormSubmitted]) if ([context _wasFormSubmitted])
{ {
BOOL _isEqual=NO; BOOL isEqual=NO;
GSWComponent* _component=[context_ component]; GSWComponent* component=[context component];
NSString* _name=nil; NSString* name=nil;
id _formValue=nil; id formValue=nil;
id _valueValue=nil; id valueValue=nil;
BOOL _checkChecked=NO; BOOL checkChecked=NO;
_name=[self nameInContext:context_]; name=[self nameInContext:context];
NSDebugMLLog(@"gswdync",@"_name=%@",_name); NSDebugMLLog(@"gswdync",@"name=%@",name);
_formValue=[request_ formValueForKey:_name]; formValue=[request formValueForKey:name];
_valueValue=[value valueInComponent:_component]; valueValue=[_value valueInComponent:component];
//TODO if checked ! //TODO if checked !
_isEqual=SBIsValueEqual(_formValue,_valueValue); isEqual=SBIsValueEqual(formValue,valueValue);
if (_isEqual) if (isEqual)
{ {
_checkChecked=YES; checkChecked=YES;
if (selection) if (_selection)
{ {
if (!WOStrictFlag) if (!WOStrictFlag)
{ {
NS_DURING NS_DURING
{ {
[selection setValue:_valueValue [_selection setValue:valueValue
inComponent:_component]; inComponent:component];
}; };
NS_HANDLER NS_HANDLER
{ {
[self handleValidationException:localException [self handleValidationException:localException
inContext:context_]; inContext:context];
} }
NS_ENDHANDLER; NS_ENDHANDLER;
} }
else else
[selection setValue:_valueValue [_selection setValue:valueValue
inComponent:_component]; inComponent:component];
}; };
}; };
if (checked) if (_checked)
{ {
id _checkedValue=[NSNumber numberWithBool:_checkChecked]; id checkedValue=[NSNumber numberWithBool:checkChecked];
NSDebugMLLog(@"gswdync",@"_checkedValue=%@",_checkedValue); NSDebugMLLog(@"gswdync",@"checkedValue=%@",checkedValue);
if (!WOStrictFlag) if (!WOStrictFlag)
{ {
NS_DURING NS_DURING
{ {
[checked setValue:_checkedValue [_checked setValue:checkedValue
inComponent:_component]; inComponent:component];
}; };
NS_HANDLER NS_HANDLER
{ {
[self handleValidationException:localException [self handleValidationException:localException
inContext:context_]; inContext:context];
} }
NS_ENDHANDLER; NS_ENDHANDLER;
} }
else else
[checked setValue:_checkedValue [_checked setValue:checkedValue
inComponent:_component]; inComponent:component];
}; };
}; };
}; };
LOGObjectFnStop(); LOGObjectFnStop();
}; };

View file

@ -1,11 +1,16 @@
/* GSWRadioButtonList.h - GSWeb: Class GSWRadioButtonList /** GSWRadioButtonList.h - <title>GSWeb: Class GSWRadioButtonList</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,21 +35,21 @@
@interface GSWRadioButtonList: GSWInput @interface GSWRadioButtonList: GSWInput
{ {
GSWAssociation* list; GSWAssociation* _list;
GSWAssociation* item; GSWAssociation* _item;
GSWAssociation* index; GSWAssociation* _index;
GSWAssociation* selection; GSWAssociation* _selection;
GSWAssociation* prefix; GSWAssociation* _prefix;
GSWAssociation* suffix; GSWAssociation* _suffix;
GSWAssociation* displayString; GSWAssociation* _displayString;
GSWAssociation* escapeHTML; GSWAssociation* _escapeHTML;
BOOL defaultEscapeHTML; BOOL _defaultEscapeHTML;
BOOL autoValue; BOOL _autoValue;
}; };
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(void)dealloc; -(void)dealloc;
-(NSString*)description; -(NSString*)description;
@ -54,23 +60,25 @@
//==================================================================== //====================================================================
@interface GSWRadioButtonList (GSWRadioButtonListA) @interface GSWRadioButtonList (GSWRadioButtonListA)
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_
inContext:(GSWContext*)context_; -(void)_slowTakeValuesFromRequest:(GSWRequest*)request
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ inContext:(GSWContext*)context;
inContext:(GSWContext*)context_;
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context;
@end @end
//==================================================================== //====================================================================
@interface GSWRadioButtonList (GSWRadioButtonListB) @interface GSWRadioButtonList (GSWRadioButtonListB)
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping; withMapping:(char*)mapping;
-(BOOL)appendStringAtLeft:(id)_unkwnon -(BOOL)appendStringAtLeft:(id)unkwnon
withMapping:(char*)_mapping; withMapping:(char*)mapping;
-(BOOL)compactHTMLTags; -(BOOL)compactHTMLTags;
@end @end

View file

@ -1,11 +1,16 @@
/* GSWRadioButtonList.m - GSWeb: Class GSWRadioButtonList /** GSWRadioButtonList.m - <title>GSWeb: Class GSWRadioButtonList</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,71 +35,72 @@ static char rcsId[] = "$Id$";
@implementation GSWRadioButtonList @implementation GSWRadioButtonList
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
//OK //OK
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_); NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",
defaultEscapeHTML=1; aName,associations,elements);
[_associations removeObjectForKey:list__Key]; _defaultEscapeHTML=1;
[_associations removeObjectForKey:item__Key]; [tmpAssociations removeObjectForKey:list__Key];
[_associations removeObjectForKey:index__Key]; [tmpAssociations removeObjectForKey:item__Key];
[_associations removeObjectForKey:selection__Key]; [tmpAssociations removeObjectForKey:index__Key];
[_associations removeObjectForKey:prefix__Key]; [tmpAssociations removeObjectForKey:selection__Key];
[_associations removeObjectForKey:suffix__Key]; [tmpAssociations removeObjectForKey:prefix__Key];
[_associations removeObjectForKey:displayString__Key]; [tmpAssociations removeObjectForKey:suffix__Key];
[_associations removeObjectForKey:escapeHTML__Key]; [tmpAssociations removeObjectForKey:displayString__Key];
if ((self=[super initWithName:name_ [tmpAssociations removeObjectForKey:escapeHTML__Key];
associations:_associations if ((self=[super initWithName:aName
contentElements:nil])) associations:tmpAssociations
{ contentElements:nil]))
list=[[associations_ objectForKey:list__Key {
withDefaultObject:[list autorelease]] retain]; _list=[[associations objectForKey:list__Key
item=[[associations_ objectForKey:item__Key withDefaultObject:[_list autorelease]] retain];
withDefaultObject:[item autorelease]] retain]; _item=[[associations objectForKey:item__Key
if (item && ![item isValueSettable]) withDefaultObject:[_item autorelease]] retain];
{ if (_item && ![_item isValueSettable])
ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable"); {
}; ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable");
index=[[associations_ objectForKey:index__Key };
withDefaultObject:[index autorelease]] retain]; _index=[[associations objectForKey:index__Key
if (index && ![index isValueSettable]) withDefaultObject:[_index autorelease]] retain];
{ if (_index && ![_index isValueSettable])
ExceptionRaise0(@"GSWCheckBox",@"'index' parameter must be settable"); {
}; ExceptionRaise0(@"GSWCheckBox",@"'index' parameter must be settable");
};
selection=[[associations_ objectForKey:selection__Key
withDefaultObject:[selection autorelease]] retain]; _selection=[[associations objectForKey:selection__Key
if (![selection isValueSettable]) withDefaultObject:[_selection autorelease]] retain];
{ if (![_selection isValueSettable])
ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable"); {
}; ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable");
prefix=[[associations_ objectForKey:prefix__Key };
withDefaultObject:[prefix autorelease]] retain]; _prefix=[[associations objectForKey:prefix__Key
suffix=[[associations_ objectForKey:suffix__Key withDefaultObject:[_prefix autorelease]] retain];
withDefaultObject:[suffix autorelease]] retain]; _suffix=[[associations objectForKey:suffix__Key
displayString=[[associations_ objectForKey:displayString__Key withDefaultObject:[_suffix autorelease]] retain];
withDefaultObject:[displayString autorelease]] retain]; _displayString=[[associations objectForKey:displayString__Key
escapeHTML=[[associations_ objectForKey:escapeHTML__Key withDefaultObject:[_displayString autorelease]] retain];
withDefaultObject:[escapeHTML autorelease]] retain]; _escapeHTML=[[associations objectForKey:escapeHTML__Key
}; withDefaultObject:[_escapeHTML autorelease]] retain];
};
return self; return self;
}; };
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(list); DESTROY(_list);
DESTROY(item); DESTROY(_item);
DESTROY(index); DESTROY(_index);
DESTROY(selection); DESTROY(_selection);
DESTROY(prefix); DESTROY(_prefix);
DESTROY(suffix); DESTROY(_suffix);
DESTROY(displayString); DESTROY(_displayString);
DESTROY(escapeHTML); DESTROY(_escapeHTML);
[super dealloc]; [super dealloc];
} }
@ -101,8 +108,8 @@ static char rcsId[] = "$Id$";
-(NSString*)description -(NSString*)description
{ {
return [NSString stringWithFormat:@"<%s %p>", return [NSString stringWithFormat:@"<%s %p>",
object_get_class_name(self), object_get_class_name(self),
(void*)self]; (void*)self];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -117,117 +124,117 @@ static char rcsId[] = "$Id$";
@implementation GSWRadioButtonList (GSWRadioButtonListA) @implementation GSWRadioButtonList (GSWRadioButtonListA)
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
LOGObjectFnStart(); LOGObjectFnStart();
[self _slowTakeValuesFromRequest:request_ [self _slowTakeValuesFromRequest:request
inContext:context_]; inContext:context];
LOGObjectFnStop(); LOGObjectFnStop();
}; };
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_ -(void)_slowTakeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
BOOL _disabledInContext=NO; BOOL disabledInContext=NO;
LOGObjectFnStart(); LOGObjectFnStart();
[self resetAutoValue]; [self resetAutoValue];
_disabledInContext=[self disabledInContext:context_]; disabledInContext=[self disabledInContext:context];
if (!_disabledInContext) if (!disabledInContext)
{ {
if ([context_ _wasFormSubmitted]) if ([context _wasFormSubmitted])
{ {
GSWComponent* _component=[context_ component]; GSWComponent* component=[context component];
NSArray* _listValue=nil; NSArray* listValue=nil;
NSString* _name=nil; NSString* name=nil;
int _foundIndex=-1; int foundIndex=-1;
id _formValue=nil; id formValue=nil;
id _valueValue=nil; id valueValue=nil;
id _valueToSet=nil; id valueToSet=nil;
int i=0; int i=0;
_name=[self nameInContext:context_]; name=[self nameInContext:context];
NSDebugMLLog(@"gswdync",@"_name=%@",_name); NSDebugMLLog(@"gswdync",@"name=%@",name);
_formValue=[request_ formValueForKey:_name]; formValue=[request formValueForKey:name];
NSDebugMLLog(@"gswdync",@"_formValue=%@",_formValue); NSDebugMLLog(@"gswdync",@"formValue=%@",formValue);
_listValue=[list valueInComponent:_component]; listValue=[_list valueInComponent:component];
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'", @"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
list, _list,
_listValue, listValue,
[_listValue class]); [listValue class]);
NSDebugMLLog(@"gswdync",@"_listValue=%@",_listValue); NSDebugMLLog(@"gswdync",@"listValue=%@",listValue);
for(i=0;i<[_listValue count] && _foundIndex<0;i++) for(i=0;i<[listValue count] && foundIndex<0;i++)
{ {
NSDebugMLLog(@"gswdync",@"item=%@",item); NSDebugMLLog(@"gswdync",@"item=%@",_item);
NSDebugMLLog(@"gswdync",@"index=%@",index); NSDebugMLLog(@"gswdync",@"index=%@",_index);
if (item) if (_item)
[item setValue:[_listValue objectAtIndex:i] [_item setValue:[listValue objectAtIndex:i]
inComponent:_component]; inComponent:component];
else if (index) else if (_index)
[index setValue:[NSNumber numberWithShort:i] [_index setValue:[NSNumber numberWithShort:i]
inComponent:_component]; inComponent:component];
NSDebugMLLog(@"gswdync",@"value=%@",value); NSDebugMLLog(@"gswdync",@"value=%@",_value);
//TODOV //TODOV
_valueValue=[self valueInContext:context_]; valueValue=[self valueInContext:context];
NSDebugMLLog(@"gswdync",@"_valueValue=%@",_valueValue); NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (_valueValue) if (valueValue)
{ {
BOOL _isEqual=SBIsValueEqual(_valueValue,_formValue); BOOL isEqual=SBIsValueEqual(valueValue,formValue);
NSDebugMLLog(@"gswdync",@"_isEqual=%s",(_isEqual ? "YES" : "NO")); NSDebugMLLog(@"gswdync",@"isEqual=%s",(isEqual ? "YES" : "NO"));
if (_isEqual) if (isEqual)
{
if(autoValue == NO)
_valueToSet=_valueValue;
else
_valueToSet=[_listValue objectAtIndex:i];
_foundIndex=i;
};
};
};
NSDebugMLLog(@"gswdync",@"_component=%@",_component);
NSDebugMLLog(@"gswdync",@"_foundIndex=%d",_foundIndex);
NSDebugMLLog(@"gswdync",@"selection=%@",selection);
GSWLogAssertGood(_component);
if (!WOStrictFlag)
{ {
NS_DURING if(_autoValue == NO)
{ valueToSet=valueValue;
if (_foundIndex>=0)
[selection setValue:_valueToSet
inComponent:_component];
else
[selection setValue:nil
inComponent:_component];
};
NS_HANDLER
{
[self handleValidationException:localException
inContext:context_];
}
NS_ENDHANDLER;
}
else
{
if (_foundIndex>=0)
[selection setValue:_valueToSet
inComponent:_component];
else else
[selection setValue:nil valueToSet=[listValue objectAtIndex:i];
inComponent:_component]; foundIndex=i;
}; };
}; };
}; };
NSDebugMLLog(@"gswdync",@"component=%@",component);
NSDebugMLLog(@"gswdync",@"foundIndex=%d",foundIndex);
NSDebugMLLog(@"gswdync",@"selection=%@",_selection);
GSWLogAssertGood(component);
if (!WOStrictFlag)
{
NS_DURING
{
if (foundIndex>=0)
[_selection setValue:valueToSet
inComponent:component];
else
[_selection setValue:nil
inComponent:component];
};
NS_HANDLER
{
[self handleValidationException:localException
inContext:context];
}
NS_ENDHANDLER;
}
else
{
if (foundIndex>=0)
[_selection setValue:valueToSet
inComponent:component];
else
[_selection setValue:nil
inComponent:component];
};
};
};
LOGObjectFnStop(); LOGObjectFnStop();
}; };
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ -(void)_fastTakeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnStart(); LOGObjectFnStart();
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
@ -235,65 +242,65 @@ static char rcsId[] = "$Id$";
}; };
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
GSWRequest* _request=nil; GSWRequest* request=nil;
BOOL _isFromClientComponent=NO; BOOL isFromClientComponent=NO;
NSString* _name=nil; NSString* name=nil;
GSWComponent* _component=nil; GSWComponent* component=nil;
NSArray* _listValue=nil; NSArray* listValue=nil;
id _selectionValue=nil; id selectionValue=nil;
int i=0; int i=0;
id _displayStringValue=nil; id displayStringValue=nil;
id _prefixValue=nil; id prefixValue=nil;
id _suffixValue=nil; id suffixValue=nil;
id _valueValue=nil; id valueValue=nil;
BOOL _isEqual=NO; BOOL isEqual=NO;
LOGObjectFnStart(); LOGObjectFnStart();
[self resetAutoValue]; [self resetAutoValue];
autoValue = NO; _autoValue = NO;
_request=[context_ request]; request=[context request];
_isFromClientComponent=[_request isFromClientComponent]; isFromClientComponent=[request isFromClientComponent];
_name=[self nameInContext:context_]; name=[self nameInContext:context];
_component=[context_ component]; component=[context component];
_selectionValue=[selection valueInComponent:_component]; selectionValue=[_selection valueInComponent:component];
_listValue=[list valueInComponent:_component]; listValue=[_list valueInComponent:component];
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'", @"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
list, _list,
_listValue, listValue,
[_listValue class]); [listValue class]);
for(i=0;i<[_listValue count];i++) for(i=0;i<[listValue count];i++)
{ {
[item setValue:[_listValue objectAtIndex:i] [_item setValue:[listValue objectAtIndex:i]
inComponent:_component]; inComponent:component];
_prefixValue=[prefix valueInComponent:_component]; prefixValue=[_prefix valueInComponent:component];
_suffixValue=[suffix valueInComponent:_component]; suffixValue=[_suffix valueInComponent:component];
[index setValue:[NSNumber numberWithShort:i] [_index setValue:[NSNumber numberWithShort:i]
inComponent:_component]; inComponent:component];
_displayStringValue=[displayString valueInComponent:_component]; displayStringValue=[_displayString valueInComponent:component];
[response_ appendContentString:@"<INPUT NAME=\""]; [response appendContentString:@"<INPUT NAME=\""];
[response_ appendContentString:_name]; [response appendContentString:_name];
[response_ appendContentString:@"\" TYPE=radio VALUE=\""]; [response appendContentString:@"\" TYPE=radio VALUE=\""];
_valueValue=[self valueInContext:context_]; valueValue=[self valueInContext:context];
[response_ appendContentHTMLAttributeValue:_valueValue]; [response appendContentHTMLAttributeValue:valueValue];
[response_ appendContentCharacter:'"']; [response appendContentCharacter:'"'];
//TODOV //TODOV
if(value) if(_value)
_isEqual=SBIsValueEqual(_valueValue,_selectionValue); isEqual=SBIsValueEqual(valueValue,selectionValue);
else else
{ {
_isEqual=SBIsValueEqual([_listValue objectAtIndex:i],_selectionValue); isEqual=SBIsValueEqual([listValue objectAtIndex:i],selectionValue);
autoValue = YES; _autoValue = YES;
} }
if (_isEqual) if (isEqual)
[response_ appendContentString:@"\" CHECKED"]; [response appendContentString:@"\" CHECKED"];
[response_ appendContentCharacter:'>']; [response appendContentCharacter:'>'];
[response_ appendContentString:_prefixValue]; [response appendContentString:prefixValue];
[response_ appendContentHTMLString:_displayStringValue]; [response appendContentHTMLString:displayStringValue];
[response_ appendContentString:_suffixValue]; [response appendContentString:suffixValue];
}; };
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -302,15 +309,15 @@ static char rcsId[] = "$Id$";
//==================================================================== //====================================================================
@implementation GSWRadioButtonList (GSWRadioButtonListB) @implementation GSWRadioButtonList (GSWRadioButtonListB)
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping withMapping:(char*)mapping
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return NO; return NO;
}; };
-(BOOL)appendStringAtLeft:(id)_unkwnon -(BOOL)appendStringAtLeft:(id)unkwnon
withMapping:(char*)_mapping withMapping:(char*)mapping
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return NO; return NO;

View file

@ -1,7 +1,7 @@
/* GSWResourceManager.h - GSWeb: Class GSWResourceManager /* GSWResourceManager.h - GSWeb: Class GSWResourceManager
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
@ -32,21 +32,21 @@ extern NSDictionary* globalMime;
@interface GSWResourceManager : NSObject <NSLocking> @interface GSWResourceManager : NSObject <NSLocking>
{ {
@private @private
NSMutableDictionary* frameworkProjectBundlesCache; NSMutableDictionary* _frameworkProjectBundlesCache;
NSMutableDictionary* appURLs; NSMutableDictionary* _appURLs;
NSMutableDictionary* frameworkURLs; NSMutableDictionary* _frameworkURLs;
NSMutableDictionary* appPaths; NSMutableDictionary* _appPaths;
GSWMultiKeyDictionary* frameworkPaths; GSWMultiKeyDictionary* _frameworkPaths;
NSMutableDictionary* urlValuedElementsData; NSMutableDictionary* _urlValuedElementsData;
NSMutableDictionary* _stringsTablesByFrameworkByLanguageByName;//NDFN NSMutableDictionary* _stringsTablesByFrameworkByLanguageByName;//NDFN
NSMutableDictionary* _stringsTableArraysByFrameworkByLanguageByName;//NDFN NSMutableDictionary* _stringsTableArraysByFrameworkByLanguageByName;//NDFN
// NSMutableDictionary* frameworkPathsToFrameworksNames; // NSMutableDictionary* _frameworkPathsToFrameworksNames;
NSArray* frameworkClassPaths; NSArray* _frameworkClassPaths;
NSRecursiveLock* selfLock; NSRecursiveLock* _selfLock;
#ifndef NDEBUG #ifndef NDEBUG
int selfLockn; int _selfLockn;
#endif #endif
BOOL applicationRequiresJavaVirtualMachine; BOOL _applicationRequiresJavaVirtualMachine;
}; };
-(void)dealloc; -(void)dealloc;
@ -55,84 +55,84 @@ extern NSDictionary* globalMime;
-(void)_initFrameworkProjectBundles; -(void)_initFrameworkProjectBundles;
//-(NSString*)frameworkNameForPath:(NSString*)path_; //-(NSString*)frameworkNameForPath:(NSString*)path_;
-(NSString*)pathForResourceNamed:(NSString*)name_ -(NSString*)pathForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
languages:(NSArray*)languages_; languages:(NSArray*)languages;
-(NSString*)urlForResourceNamed:(NSString*)name_ -(NSString*)urlForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
languages:(NSArray*)languages_ languages:(NSArray*)languages
request:(GSWRequest*)request_; request:(GSWRequest*)request;
-(NSString*)stringForKey:(NSString*)key_ -(NSString*)stringForKey:(NSString*)key_
inTableNamed:(NSString*)tableName_ inTableNamed:(NSString*)tableName
withDefaultValue:(NSString*)defaultValue_ withDefaultValue:(NSString*)defaultValue_
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
languages:(NSArray*)languages_; languages:(NSArray*)languages;
//NDFN //NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)tableName_ -(NSDictionary*)stringsTableNamed:(NSString*)tableName
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
languages:(NSArray*)languages_; languages:(NSArray*)languages;
//NDFN //NDFN
-(NSArray*)stringsTableArrayNamed:(NSString*)tableName_ -(NSArray*)stringsTableArrayNamed:(NSString*)tableName
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
languages:(NSArray*)languages_; languages:(NSArray*)languages;
-(void)lock; -(void)lock;
-(void)unlock; -(void)unlock;
-(NSString*)lockedStringForKey:(NSString*)_key -(NSString*)lockedStringForKey:(NSString*)key
inTableNamed:(NSString*)_tableName inTableNamed:(NSString*)tableName
inFramework:(NSString*)_framework inFramework:(NSString*)framework
languages:(NSArray*)languages_; languages:(NSArray*)languages;
//NDFN //NDFN
-(NSDictionary*)lockedStringsTableNamed:(NSString*)_tableName -(NSDictionary*)lockedStringsTableNamed:(NSString*)tableName
inFramework:(NSString*)_framework inFramework:(NSString*)framework
languages:(NSArray*)languages_; languages:(NSArray*)languages;
//NDFN //NDFN
-(NSArray*)lockedStringsTableArrayNamed:(NSString*)_tableName -(NSArray*)lockedStringsTableArrayNamed:(NSString*)tableName
inFramework:(NSString*)_framework inFramework:(NSString*)framework
languages:(NSArray*)languages_; languages:(NSArray*)languages;
-(NSString*)lockedCachedStringForKey:(NSString*)key_ -(NSString*)lockedCachedStringForKey:(NSString*)key
inTableNamed:(NSString*)tableName_ inTableNamed:(NSString*)tableName
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
language:(NSString*)language_; language:(NSString*)language;
-(NSDictionary*)lockedCachedStringsTableWithName:(NSString*)tableName_ -(NSDictionary*)lockedCachedStringsTableWithName:(NSString*)tableName
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
language:(NSString*)language_; language:(NSString*)language;
//NDFN //NDFN
-(NSArray*)lockedCachedStringsTableArrayWithName:(NSString*)tableName_ -(NSArray*)lockedCachedStringsTableArrayWithName:(NSString*)tableName
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
language:(NSString*)language_; language:(NSString*)language;
-(NSDictionary*)lockedStringsTableWithName:(NSString*)tableName_ -(NSDictionary*)lockedStringsTableWithName:(NSString*)tableName
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
language:(NSString*)language_; language:(NSString*)language;
//NDFN //NDFN
-(NSArray*)lockedStringsTableArrayWithName:(NSString*)tableName_ -(NSArray*)lockedStringsTableArrayWithName:(NSString*)tableName
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
language:(NSString*)language_; language:(NSString*)language;
-(NSString*)lockedUrlForResourceNamed:(NSString*)name_ -(NSString*)lockedUrlForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
languages:(NSArray*)languages_ languages:(NSArray*)languages_
request:(GSWRequest*)_request; request:(GSWRequest*)request;
-(NSString*)lockedCachedURLForResourceNamed:(NSString*)name_ -(NSString*)lockedCachedURLForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
languages:(NSArray*)languages_; languages:(NSArray*)languages;
-(NSString*)lockedPathForResourceNamed:(NSString*)name_ -(NSString*)lockedPathForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
languages:(NSArray*)languages_; languages:(NSArray*)languages;
-(GSWDeployedBundle*)lockedCachedBundleForFrameworkNamed:(NSString*)name_; -(GSWDeployedBundle*)lockedCachedBundleForFrameworkNamed:(NSString*)name;
@end @end
//==================================================================== //====================================================================
@ -142,33 +142,33 @@ extern NSDictionary* globalMime;
-(void)setURLValuedElementData:(GSWURLValuedElementData*)data_; -(void)setURLValuedElementData:(GSWURLValuedElementData*)data_;
-(void)setData:(NSData*)data_ -(void)setData:(NSData*)data
forKey:(NSString*)key_ forKey:(NSString*)key
mimeType:(NSString*)type_ mimeType:(NSString*)type
session:(GSWSession*)session_; session:(GSWSession*)session;
-(void)removeDataForKey:(NSString*)key_ -(void)removeDataForKey:(NSString*)key
session:(GSWSession*)session_; session:(GSWSession*)session;
@end @end
//==================================================================== //====================================================================
@interface GSWResourceManager (GSWResourceManagerA) @interface GSWResourceManager (GSWResourceManagerA)
-(NSString*)pathForResourceNamed:(NSString*)name_ -(NSString*)pathForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
language:(NSString*)language_; language:(NSString*)language;
-(NSString*)lockedPathForResourceNamed:(NSString*)name_ -(NSString*)lockedPathForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName_ inFramework:(NSString*)frameworkName
language:(NSString*)language_; language:(NSString*)language;
-(GSWDeployedBundle*)_appProjectBundle; -(GSWDeployedBundle*)_appProjectBundle;
-(NSArray*)_allFrameworkProjectBundles; -(NSArray*)_allFrameworkProjectBundles;
-(void)lockedRemoveDataForKey:(NSString*)key_; -(void)lockedRemoveDataForKey:(NSString*)key;
-(BOOL)_doesRequireJavaVirualMachine; -(BOOL)_doesRequireJavaVirualMachine;
-(NSString*)_absolutePathForJavaClassPath:(NSString*)path_; -(NSString*)_absolutePathForJavaClassPath:(NSString*)path;
-(GSWURLValuedElementData*)_cachedDataForKey:(NSString*)key_; -(GSWURLValuedElementData*)_cachedDataForKey:(NSString*)key;
-(void)lockedCacheData:(GSWURLValuedElementData*)data_; -(void)lockedCacheData:(GSWURLValuedElementData*)data;
-(NSString*)contentTypeForResourcePath:(NSString*)path_; -(NSString*)contentTypeForResourcePath:(NSString*)path;
-(NSArray*)_frameworkClassPaths; -(NSArray*)_frameworkClassPaths;
@end @end
@ -176,10 +176,10 @@ extern NSDictionary* globalMime;
//==================================================================== //====================================================================
@interface GSWResourceManager (GSWResourceManagerOldFn) @interface GSWResourceManager (GSWResourceManagerOldFn)
-(NSString*)urlForResourceNamed:(NSString*)name_ -(NSString*)urlForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName_; inFramework:(NSString*)frameworkName;
-(NSString*)pathForResourceNamed:(NSString*)name_ -(NSString*)pathForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName_; inFramework:(NSString*)frameworkName;
@end @end
@ -190,10 +190,10 @@ extern NSDictionary* globalMime;
//==================================================================== //====================================================================
@interface GSWResourceManager (GSWResourceManagerClassA) @interface GSWResourceManager (GSWResourceManagerClassA)
+(NSString*)GSLanguageFromISOLanguage:(NSString*)ISOLanguage_; //NDFN +(NSString*)GSLanguageFromISOLanguage:(NSString*)ISOLanguage; //NDFN
+(NSArray*)GSLanguagesFromISOLanguages:(NSArray*)ISOLanguages_; //NDFN +(NSArray*)GSLanguagesFromISOLanguages:(NSArray*)ISOlanguages; //NDFN
+(NSString*)ISOLanguageFromGSLanguage:(NSString*)GSLanguage_; //NDFN +(NSString*)ISOLanguageFromGSLanguage:(NSString*)GSLanguage; //NDFN
+(NSArray*)ISOLanguagesFromGSLanguages:(NSArray*)GSLanguages_; //NDFN +(NSArray*)ISOLanguagesFromGSLanguages:(NSArray*)GSlanguages; //NDFN
+(GSWBundle*)_applicationGSWBundle; +(GSWBundle*)_applicationGSWBundle;
@end @end

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,16 @@
/* GSWResourceURL.h - GSWeb: Class GSWResourceURL /** GSWResourceURL.h - <title>GSWeb: Class GSWResourceURL</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Sept 1999 Date: Sept 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -31,8 +37,8 @@
@end @end
@interface GSWResourceURL (GSWResourceURLA) @interface GSWResourceURL (GSWResourceURLA)
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(NSString*)valueAttributeName; -(NSString*)valueAttributeName;
-(NSString*)urlAttributeName; -(NSString*)urlAttributeName;
+(BOOL)hasGSWebObjectsAssociations; +(BOOL)hasGSWebObjectsAssociations;

View file

@ -1,11 +1,15 @@
/* GSWResourceURL.m - GSWeb: Class GSWResourceURL /** GSWResourceURL.m - <title>GSWeb: Class GSWResourceURL</title>
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Sep 1999 Date: Sep 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +23,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -46,12 +51,12 @@ static char rcsId[] = "$Id$";
@implementation GSWResourceURL (GSWResourceURLA) @implementation GSWResourceURL (GSWResourceURLA)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
LOGObjectFnStartC("GSWResourceURL"); LOGObjectFnStartC("GSWResourceURL");
[self appendURLToResponse:response_ [self appendURLToResponse:response
inContext:context_]; inContext:context];
LOGObjectFnStopC("GSWResourceURL"); LOGObjectFnStopC("GSWResourceURL");
}; };

View file

@ -1,11 +1,16 @@
/* GSWString.h - GSWeb: Class GSWString /** GSWString.h - <title>GSWeb: Class GSWString</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,34 +35,36 @@
@interface GSWString: GSWHTMLDynamicElement @interface GSWString: GSWHTMLDynamicElement
{ {
GSWAssociation* value; GSWAssociation* _value;
GSWAssociation* dateFormat; GSWAssociation* _dateFormat;
GSWAssociation* numberFormat; GSWAssociation* _numberFormat;
GSWAssociation* escapeHTML; GSWAssociation* _escapeHTML;
//GSWeb Additions { //GSWeb Additions {
GSWAssociation* convertHTML; GSWAssociation* _convertHTML;
GSWAssociation* convertHTMLEntities; GSWAssociation* _convertHTMLEntities;
// } // }
GSWAssociation* formatter; GSWAssociation* _formatter;
}; };
-(void)dealloc; -(void)dealloc;
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(NSString*)description; -(NSString*)description;
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping; withMapping:(char*)mapping;
-(BOOL)appendStringAtLeft:(id)_unkwnon
withMapping:(char*)_mapping; -(BOOL)appendStringAtLeft:(id)unkwnon
-(NSFormatter*)formatterForComponent:(GSWComponent*)_component withMapping:(char*)mapping;
value:(id)value_;
-(NSFormatter*)formatterForComponent:(GSWComponent*)component
value:(id)value;
-(NSString*)elementName; -(NSString*)elementName;
@end @end

View file

@ -1,11 +1,16 @@
/* GSWString.m - GSWeb: Class GSWString /** GSWString.m - <title>GSWeb: Class GSWString</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -30,50 +36,50 @@ static char rcsId[] = "$Id$";
@implementation GSWString @implementation GSWString
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)_elements contentElements:(NSArray*)elements
{ {
//OK //OK
LOGObjectFnStartC("GSWString"); LOGObjectFnStartC("GSWString");
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements); NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",
aName,associations,elements);
if ((self=[super initWithName:nil if ((self=[super initWithName:nil
associations:nil associations:nil
contentElements:nil])) contentElements:nil]))
{ {
value = [[associations_ objectForKey:value__Key _value = [[associations objectForKey:value__Key
withDefaultObject:[value autorelease]] retain]; withDefaultObject:[_value autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWString: value=%@",value); NSDebugMLLog(@"gswdync",@"GSWString: value=%@",_value);
dateFormat = [[associations_ objectForKey:dateFormat__Key _dateFormat = [[associations objectForKey:dateFormat__Key
withDefaultObject:[dateFormat autorelease]] retain]; withDefaultObject:[_dateFormat autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWString: dateFormat=%@",dateFormat); NSDebugMLLog(@"gswdync",@"GSWString: dateFormat=%@",_dateFormat);
numberFormat = [[associations_ objectForKey:numberFormat__Key _numberFormat = [[associations objectForKey:numberFormat__Key
withDefaultObject:[numberFormat autorelease]] retain]; withDefaultObject:[_numberFormat autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWString: numberFormat=%@",numberFormat); NSDebugMLLog(@"gswdync",@"GSWString: numberFormat=%@",_numberFormat);
escapeHTML = [[associations_ objectForKey:escapeHTML__Key _escapeHTML = [[associations objectForKey:escapeHTML__Key
withDefaultObject:[escapeHTML autorelease]] retain]; withDefaultObject:[_escapeHTML autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWString: escapeHTML=%@",escapeHTML); NSDebugMLLog(@"gswdync",@"GSWString: escapeHTML=%@",_escapeHTML);
if (!WOStrictFlag) if (!WOStrictFlag)
{ {
convertHTML = [[associations_ objectForKey:convertHTML__Key _convertHTML = [[associations objectForKey:convertHTML__Key
withDefaultObject:[convertHTML autorelease]] retain]; withDefaultObject:[_convertHTML autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWString: convertHTML=%@",convertHTML); NSDebugMLLog(@"gswdync",@"GSWString: convertHTML=%@",_convertHTML);
convertHTMLEntities = [[associations_ objectForKey:convertHTMLEntities__Key _convertHTMLEntities = [[associations objectForKey:convertHTMLEntities__Key
withDefaultObject:[convertHTMLEntities autorelease]] retain]; withDefaultObject:[_convertHTMLEntities autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWString: convertHTMLEntities=%@",convertHTMLEntities); NSDebugMLLog(@"gswdync",@"GSWString: convertHTMLEntities=%@",_convertHTMLEntities);
}; };
formatter = [[associations_ objectForKey:formatter__Key _formatter = [[associations objectForKey:formatter__Key
withDefaultObject:[formatter autorelease]] retain]; withDefaultObject:[_formatter autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWString: formatter=%@",formatter); NSDebugMLLog(@"gswdync",@"GSWString: formatter=%@",_formatter);
};
};
LOGObjectFnStopC("GSWString"); LOGObjectFnStopC("GSWString");
return self; return self;
}; };
@ -81,13 +87,13 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(value); DESTROY(_value);
DESTROY(dateFormat); DESTROY(_dateFormat);
DESTROY(numberFormat); DESTROY(_numberFormat);
DESTROY(escapeHTML); DESTROY(_escapeHTML);
DESTROY(convertHTML); //GSWeb Only DESTROY(_convertHTML); //GSWeb Only
DESTROY(convertHTMLEntities); //GSWeb Only DESTROY(_convertHTMLEntities); //GSWeb Only
DESTROY(formatter); DESTROY(_formatter);
[super dealloc]; [super dealloc];
}; };
@ -95,138 +101,138 @@ static char rcsId[] = "$Id$";
-(NSString*)description -(NSString*)description
{ {
return [NSString stringWithFormat:@"<%s %p - value=%@ dateFormat=%@ numberFormat=%@ escapeHTML=%@ formatter=%@>", return [NSString stringWithFormat:@"<%s %p - value=%@ dateFormat=%@ numberFormat=%@ escapeHTML=%@ formatter=%@>",
object_get_class_name(self), object_get_class_name(self),
(void*)self, (void*)self,
value, _value,
dateFormat, _dateFormat,
numberFormat, _numberFormat,
escapeHTML, _escapeHTML,
formatter]; _formatter];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
NSString* _formattedValue=nil; NSString* formattedValue=nil;
GSWRequest* _request=nil; GSWRequest* request=nil;
BOOL _isFromClientComponent=NO; BOOL isFromClientComponent=NO;
GSWComponent* _component=nil; GSWComponent* component=nil;
id _valueValue = nil; id valueValue = nil;
LOGObjectFnStartC("GSWString"); LOGObjectFnStartC("GSWString");
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context_ elementID]); NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context elementID]);
_request=[context_ request]; request=[context request];
_isFromClientComponent=[_request isFromClientComponent]; isFromClientComponent=[request isFromClientComponent];
_component=[context_ component]; component=[context component];
NSDebugMLLog(@"gswdync",@"GSWString: _component=%@",_component); NSDebugMLLog(@"gswdync",@"GSWString: component=%@",component);
NSDebugMLLog(@"gswdync",@"GSWString: value=%@",value); NSDebugMLLog(@"gswdync",@"GSWString: value=%@",_value);
_valueValue = [value valueInComponent:_component]; valueValue = [_value valueInComponent:component];
NSDebugMLLog(@"gswdync",@"GSWString: _valueValue=%@",_valueValue); NSDebugMLLog(@"gswdync",@"GSWString: valueValue=%@",valueValue);
if (_valueValue) if (valueValue)
{ {
BOOL _escapeHTMLValue=YES; BOOL escapeHTMLValue=YES;
BOOL _convertHTMLValue=NO; BOOL convertHTMLValue=NO;
BOOL _convertHTMLEntitiesValue=NO; BOOL convertHTMLEntitiesValue=NO;
NSFormatter* _formatter=[self formatterForComponent:_component NSFormatter* formatter=[self formatterForComponent:component
value:_valueValue]; value:valueValue];
if (!_formatter) if (!formatter)
{ {
_formattedValue=_valueValue; formattedValue=valueValue;
} }
else else
{ {
_formattedValue=[_formatter stringForObjectValue:_valueValue]; formattedValue=[formatter stringForObjectValue:valueValue];
NSDebugMLog(@"_valueValue=%@ _formattedValue=%@",_valueValue,_formattedValue); NSDebugMLog(@"valueValue=%@ formattedValue=%@",valueValue,formattedValue);
}; };
if (!WOStrictFlag && convertHTML) if (!WOStrictFlag && _convertHTML)
_convertHTMLValue=[self evaluateCondition:convertHTML convertHTMLValue=[self evaluateCondition:_convertHTML
inContext:context_]; inContext:context];
if (!WOStrictFlag) if (!WOStrictFlag)
{
if (!convertHTMLValue)
{ {
if (!_convertHTMLValue) if (_convertHTMLEntities)
{ convertHTMLEntitiesValue=[self evaluateCondition:_convertHTMLEntities
if (convertHTMLEntities) inContext:context];
_convertHTMLEntitiesValue=[self evaluateCondition:convertHTMLEntities if (!convertHTMLEntitiesValue)
inContext:context_]; {
if (!_convertHTMLEntitiesValue) if (_escapeHTML)
{ escapeHTMLValue=[self evaluateCondition:_escapeHTML
if (escapeHTML) inContext:context];
_escapeHTMLValue=[self evaluateCondition:escapeHTML };
inContext:context_]; };
}; }
}; else if (_escapeHTML)
} escapeHTMLValue=[self evaluateCondition:_escapeHTML
else if (escapeHTML) inContext:context];
_escapeHTMLValue=[self evaluateCondition:escapeHTML
inContext:context_];
if (!WOStrictFlag && _convertHTMLValue) if (!WOStrictFlag && convertHTMLValue)
[response_ appendContentHTMLConvertString:_formattedValue]; [response appendContentHTMLConvertString:formattedValue];
else if (!WOStrictFlag && _convertHTMLEntitiesValue) else if (!WOStrictFlag && convertHTMLEntitiesValue)
[response_ appendContentHTMLEntitiesConvertString:_formattedValue]; [response appendContentHTMLEntitiesConvertString:formattedValue];
else if (_escapeHTMLValue) else if (escapeHTMLValue)
[response_ appendContentHTMLString:_formattedValue]; [response appendContentHTMLString:formattedValue];
else else
[response_ appendContentString:_formattedValue]; [response appendContentString:formattedValue];
}; };
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]); NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context elementID]);
LOGObjectFnStopC("GSWString"); LOGObjectFnStopC("GSWString");
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping withMapping:(char*)mapping
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return NO; return NO;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(BOOL)appendStringAtLeft:(id)_unkwnon -(BOOL)appendStringAtLeft:(id)unkwnon
withMapping:(char*)_mapping withMapping:(char*)mapping
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return NO; return NO;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSFormatter*)formatterForComponent:(GSWComponent*)_component -(NSFormatter*)formatterForComponent:(GSWComponent*)component
value:(id)value_ value:(id)value
{ {
//OK //OK
id _formatValue = nil; id formatValue = nil;
NSFormatter* _formatter = nil; NSFormatter* formatter = nil;
LOGObjectFnStartC("GSWString"); LOGObjectFnStartC("GSWString");
if (dateFormat) if (_dateFormat)
{ {
NSDebugMLog0(@"DateFormat"); NSDebugMLog0(@"DateFormat");
_formatValue=[dateFormat valueInComponent:_component]; formatValue=[_dateFormat valueInComponent:component];
if (_formatValue) if (formatValue)
_formatter=[[[NSDateFormatter alloc]initWithDateFormat:_formatValue formatter=[[[NSDateFormatter alloc]initWithDateFormat:formatValue
allowNaturalLanguage:YES]autorelease]; allowNaturalLanguage:YES]autorelease];
} }
else if (numberFormat) else if (_numberFormat)
{ {
NSDebugMLog0(@"NumberFormat"); NSDebugMLog0(@"NumberFormat");
_formatValue=[numberFormat valueInComponent:_component]; formatValue=[_numberFormat valueInComponent:component];
if (_formatValue) if (formatValue)
{ {
//TODO //TODO
/* _formatter=[[NSNumberFormatter new]autorelease]; /* _formatter=[[NSNumberFormatter new]autorelease];
[_formatter setFormat:_formatValue]; [_formatter setFormat:_formatValue];
*/ */
}; };
} }
else else
{ {
NSDebugMLog0(@"Formatter"); NSDebugMLog0(@"Formatter");
_formatter=[formatter valueInComponent:_component]; formatter=[_formatter valueInComponent:component];
}; };
NSDebugMLog(@"_formatter=%@",_formatter); NSDebugMLog(@"formatter=%@",formatter);
LOGObjectFnStopC("GSWString"); LOGObjectFnStopC("GSWString");
return _formatter; return formatter;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View file

@ -1,11 +1,16 @@
/* GSWSubmitButton.h - GSWeb: Class GSWSubmitButton /** GSWSubmitButton.h - <title>GSWeb: Class GSWSubmitButton</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,13 +35,13 @@
//OK //OK
@interface GSWSubmitButton: GSWInput @interface GSWSubmitButton: GSWInput
{ {
GSWAssociation* action; GSWAssociation* _action;
GSWAssociation* actionClass; GSWAssociation* _actionClass;
GSWAssociation* directActionName; GSWAssociation* _directActionName;
}; };
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements; contentElements:(NSArray*)elements;
-(void)dealloc; -(void)dealloc;
@ -43,20 +49,20 @@
@end @end
@interface GSWSubmitButton (GSWSubmitButtonA) @interface GSWSubmitButton (GSWSubmitButtonA)
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)appendNameToResponse:(GSWResponse*)response_ -(void)appendNameToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)_appendActionClassAndNameToResponse:(GSWResponse*)response_ -(void)_appendActionClassAndNameToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
@end @end
#endif //_GSWSubmitButton_h__ #endif //_GSWSubmitButton_h__

View file

@ -1,11 +1,16 @@
/* GSWSubmitButton.m - GSWeb: Class GSWSubmitButton /** GSWSubmitButton.m - <title>GSWeb: Class GSWSubmitButton</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@sbuilders.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,37 +35,39 @@ static char rcsId[] = "$Id$";
@implementation GSWSubmitButton @implementation GSWSubmitButton
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)_elements contentElements:(NSArray*)elements
{ {
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements); NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ _elements=%@",
[_associations setObject:[GSWAssociation associationWithValue:@"submit"] aName,associations,elements);
forKey:@"type"]; [tmpAssociations setObject:[GSWAssociation associationWithValue:@"submit"]
[_associations removeObjectForKey:action__Key]; forKey:@"type"];
[_associations removeObjectForKey:actionClass__Key]; [tmpAssociations removeObjectForKey:action__Key];
if (directActionName) [_associations removeObjectForKey:directActionName]; [tmpAssociations removeObjectForKey:actionClass__Key];
if (_directActionName)
[tmpAssociations removeObjectForKey:_directActionName];
if (![tmpAssociations objectForKey:value__Key])
[tmpAssociations setObject:[GSWAssociation associationWithValue:@"submit"]
forKey:value__Key];
if (![_associations objectForKey:value__Key]) if ((self=[super initWithName:aName
[_associations setObject:[GSWAssociation associationWithValue:@"submit"] associations:tmpAssociations
forKey:value__Key]; contentElements:nil]))
{
if ((self=[super initWithName:name_ _action = [[associations objectForKey:action__Key
associations:_associations withDefaultObject:[_action autorelease]] retain];
contentElements:nil])) NSDebugMLLog(@"gswdync",@"GSWSumbitButton: action=%@",_action);
{ _actionClass = [[associations objectForKey:actionClass__Key
action = [[associations_ objectForKey:action__Key withDefaultObject:[_actionClass autorelease]] retain];
withDefaultObject:[action autorelease]] retain]; NSDebugMLLog(@"gswdync",@"GSWSumbitButton: actionClass=%@",_actionClass);
NSDebugMLLog(@"gswdync",@"GSWSumbitButton: action=%@",action); _directActionName = [[associations objectForKey:directActionName__Key
actionClass = [[associations_ objectForKey:actionClass__Key withDefaultObject:[_directActionName autorelease]] retain];
withDefaultObject:[actionClass autorelease]] retain]; NSDebugMLLog(@"gswdync",@"GSWSumbitButton: directActionName=%@",_directActionName);
NSDebugMLLog(@"gswdync",@"GSWSumbitButton: actionClass=%@",actionClass); };
directActionName = [[associations_ objectForKey:directActionName__Key
withDefaultObject:[directActionName autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWSumbitButton: directActionName=%@",directActionName);
};
LOGObjectFnStop(); LOGObjectFnStop();
return self; return self;
}; };
@ -67,9 +75,9 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(action); DESTROY(_action);
DESTROY(actionClass); DESTROY(_actionClass);
DESTROY(directActionName); DESTROY(_directActionName);
[super dealloc]; [super dealloc];
}; };
@ -79,146 +87,148 @@ static char rcsId[] = "$Id$";
@implementation GSWSubmitButton (GSWSubmitButtonA) @implementation GSWSubmitButton (GSWSubmitButtonA)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
LOGObjectFnStart(); LOGObjectFnStart();
GSWSaveAppendToResponseElementID(context_);//Debug Only GSWSaveAppendToResponseElementID(context);//Debug Only
[super appendToResponse:response_ [super appendToResponse:response
inContext:context_]; inContext:context];
LOGObjectFnStop(); LOGObjectFnStop();
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
GSWElement* _element=nil; GSWElement* element=nil;
BOOL _disabled=NO; BOOL disabledValue=NO;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@",[self class],[context_ elementID],[context_ senderID]); NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@",
[self class],[context elementID],[context senderID]);
NS_DURING NS_DURING
{ {
GSWAssertCorrectElementID(context_);// Debug Only GSWAssertCorrectElementID(context);// Debug Only
_disabled=[self disabledInContext:context_]; disabledValue=[self disabledInContext:context];
NSDebugMLLog(@"gswdync",@"_disabled=%s",(_disabled ? "YES" : "NO")); NSDebugMLLog(@"gswdync",@"disabledValue=%s",(disabledValue ? "YES" : "NO"));
if (!_disabled) if (!disabledValue)
{ {
BOOL _wasFormSubmitted=[context_ _wasFormSubmitted]; BOOL wasFormSubmitted=[context _wasFormSubmitted];
if (_wasFormSubmitted) if (wasFormSubmitted)
{ {
BOOL _invoked=NO; BOOL invoked=NO;
GSWComponent* _component=[context_ component]; GSWComponent* component=[context component];
BOOL _isMultipleSubmitForm=[context_ _isMultipleSubmitForm]; BOOL isMultipleSubmitForm=[context _isMultipleSubmitForm];
if (_isMultipleSubmitForm) if (isMultipleSubmitForm)
{ {
NSString* _nameInContext=[self nameInContext:context_]; NSString* nameInContext=[self nameInContext:context];
NSString* _formValue=[request_ formValueForKey:_nameInContext]; NSString* formValue=[request formValueForKey:nameInContext];
NSDebugMLLog(@"gswdync",@"_formValue=%@",_formValue); NSDebugMLLog(@"gswdync",@"formValue=%@",formValue);
if (_formValue) if (formValue)
_invoked=YES; invoked=YES;
else else
{ {
NSDebugMLLog(@"gswdync",@"[request_ formValueKeys]=%@",[request_ formValueKeys]); NSDebugMLLog(@"gswdync",@"[request formValueKeys]=%@",[request formValueKeys]);
}; };
} }
else else
_invoked=YES; invoked=YES;
if (_invoked) if (invoked)
{ {
id _actionValue=nil; id actionValue=nil;
NSDebugMLLog0(@"gswdync",@"Invoked Object Found !!"); NSDebugMLLog0(@"gswdync",@"Invoked Object Found !!");
[context_ _setActionInvoked:1]; [context setActionInvoked:1];
NS_DURING NS_DURING
{ {
NSDebugMLLog(@"gswdync",@"Invoked Object Found: action=%@",action); NSDebugMLLog(@"gswdync",@"Invoked Object Found: action=%@",_action);
_actionValue=[action valueInComponent:_component]; actionValue=[_action valueInComponent:component];
} }
NS_HANDLER NS_HANDLER
{ {
LOGException0(@"exception in GSWSubmitButton invokeActionForRequest:inContext action"); LOGException0(@"exception in GSWSubmitButton invokeActionForRequest:inContext action");
LOGException(@"exception=%@",localException); LOGException(@"exception=%@",localException);
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException, localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
@"In GSWSubmitButton invokeActionForRequest:inContext action %@",action); @"In GSWSubmitButton invokeActionForRequest:inContext action %@",
LOGException(@"exception=%@",localException); _action);
[localException raise]; LOGException(@"exception=%@",localException);
} [localException raise];
NS_ENDHANDLER; }
if (_actionValue) NS_ENDHANDLER;
_element=_actionValue; if (actionValue)
if (_element) element=actionValue;
{ if (element)
if (![_element isKindOfClass:[GSWComponent class]]) //TODO GSWComponent or Element ? {
{ if (![element isKindOfClass:[GSWComponent class]]) //TODO GSWComponent or Element ?
ExceptionRaise0(@"GSWHyperlink",@"Invoked element return a not GSWComponent element"); {
} ExceptionRaise0(@"GSWHyperlink",@"Invoked element return a not GSWComponent element");
else }
{ else
// call awakeInContext when _element is sleeping deeply {
[_element ensureAwakeInContext:context_]; // call awakeInContext when _element is sleeping deeply
/* [element ensureAwakeInContext:context];
if (![_element context]) { /*
NSDebugMLLog(@"gswdync",@"_element sleeps, awake it = %@",_element); if (![_element context]) {
[_element awakeInContext:context_]; NSDebugMLLog(@"gswdync",@"_element sleeps, awake it = %@",_element);
} else { [_element awakeInContext:context];
[_element awakeInContext:context_]; } else {
} [_element awakeInContext:context];
*/ }
} */
} }
/* ??? }
if (!_element) /* ???
_element=[context_ page]; if (!_element)
*/ _element=[context page];
}; */
}; };
}; };
} };
}
NS_HANDLER NS_HANDLER
{ {
LOGException0(@"exception in GSWSubmitButton invokeActionForRequest:inContext"); LOGException0(@"exception in GSWSubmitButton invokeActionForRequest:inContext");
LOGException(@"exception=%@",localException); LOGException(@"exception=%@",localException);
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException, localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
@"In GSWSubmitButton invokeActionForRequest:inContext"); @"In GSWSubmitButton invokeActionForRequest:inContext");
LOGException(@"exception=%@",localException); LOGException(@"exception=%@",localException);
[localException raise]; [localException raise];
} }
NS_ENDHANDLER; NS_ENDHANDLER;
//if (![context_ _wasActionInvoked] && [[[context_ elementID] parentElementIDString] compare:[context_ senderID]]!=NSOrderedAscending) //if (![context _wasActionInvoked] && [[[context elementID] parentElementIDString] compare:[context senderID]]!=NSOrderedAscending)
if (![context_ _wasActionInvoked] && [[[context_ elementID] parentElementIDString] isSearchOverForSenderID:[context_ senderID]]) if (![context _wasActionInvoked] && [[[context elementID] parentElementIDString] isSearchOverForSenderID:[context senderID]])
{ {
LOGError(@"Action not invoked at the end of %@ (id=%@) senderId=%@", LOGError(@"Action not invoked at the end of %@ (id=%@) senderId=%@",
[self class], [self class],
[context_ elementID], [context elementID],
[context_ senderID]); [context senderID]);
}; };
LOGObjectFnStop(); LOGObjectFnStop();
return _element; return element;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//Does Nothing ? //Does Nothing ?
GSWAssertCorrectElementID(context_);// Debug Only GSWAssertCorrectElementID(context);// Debug Only
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendNameToResponse:(GSWResponse*)_response -(void)appendNameToResponse:(GSWResponse*)response
inContext:(GSWContext*)_context inContext:(GSWContext*)context
{ {
//OK //OK
//Here we call parent (GSWInput) method instead of doing it by ourself (as GSW) //Here we call parent (GSWInput) method instead of doing it by ourself (as GSW)
[super appendNameToResponse:_response [super appendNameToResponse:response
inContext:_context]; inContext:context];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)_appendActionClassAndNameToResponse:(GSWResponse*)_response -(void)_appendActionClassAndNameToResponse:(GSWResponse*)response
inContext:(GSWContext*)_context inContext:(GSWContext*)context
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
}; };

View file

@ -1,11 +1,16 @@
/* GSWText.h - GSWeb: Class GSWText /** GSWText.h - <title>GSWeb: Class GSWText</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -30,9 +36,9 @@
//==================================================================== //====================================================================
@interface GSWText: GSWInput @interface GSWText: GSWInput
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(void)dealloc; -(void)dealloc;
-(NSString*)description; -(NSString*)description;
@ -42,18 +48,18 @@
//==================================================================== //====================================================================
@interface GSWText (GSWTextA) @interface GSWText (GSWTextA)
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(NSString*)_filterSoftReturnsFromString:(NSString*)string_; -(NSString*)_filterSoftReturnsFromString:(NSString*)string;
@end @end
//==================================================================== //====================================================================
@interface GSWText (GSWTextB) @interface GSWText (GSWTextB)
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping; withMapping:(char*)mapping;
@end @end
#endif //_GSWText_h__ #endif //_GSWText_h__

View file

@ -1,11 +1,16 @@
/* GSWText.h - GSWeb: Class GSWText /** GSWText.m - <title>GSWeb: Class GSWText</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,15 +35,15 @@ static char rcsId[] = "$Id$";
@implementation GSWText @implementation GSWText
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
if ((self=[super initWithName:name_ if ((self=[super initWithName:name
associations:associations_ associations:associations
contentElements:nil])) contentElements:nil]))
{ {
}; };
return self; return self;
}; };
@ -51,8 +57,8 @@ static char rcsId[] = "$Id$";
-(NSString*)description -(NSString*)description
{ {
return [NSString stringWithFormat:@"<%s %p>", return [NSString stringWithFormat:@"<%s %p>",
object_get_class_name(self), object_get_class_name(self),
(void*)self]; (void*)self];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -67,67 +73,67 @@ static char rcsId[] = "$Id$";
@implementation GSWText (GSWTextA) @implementation GSWText (GSWTextA)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
if (value && [value isValueSettable]) if (_value && [_value isValueSettable])
{ {
GSWComponent* _component=[context_ component]; GSWComponent* component=[context component];
id _formValue=[request_ formValueForKey:[context_ elementID]]; id formValue=[request formValueForKey:[context elementID]];
if (!WOStrictFlag) if (!WOStrictFlag)
{
NS_DURING
{ {
NS_DURING [_value setValue:formValue
{ inComponent:component];
[value setValue:_formValue };
inComponent:_component]; NS_HANDLER
}; {
NS_HANDLER [self handleValidationException:localException
{ inContext:context];
[self handleValidationException:localException
inContext:context_];
}
NS_ENDHANDLER;
} }
else NS_ENDHANDLER;
[value setValue:_formValue }
inComponent:_component]; else
}; [_value setValue:formValue
[super takeValuesFromRequest:request_ inComponent:component];
inContext:context_]; };
[super takeValuesFromRequest:request
inContext:context];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
GSWRequest* _request=[context_ request]; GSWRequest* request=[context request];
NSString* _valueValue=nil; NSString* valueValue=nil;
NSString* _valueValueFiltered=nil; NSString* valueValueFiltered=nil;
BOOL _isFromClientComponent=[_request isFromClientComponent]; BOOL isFromClientComponent=[request isFromClientComponent];
GSWComponent* _component=[context_ component]; GSWComponent* component=[context component];
[super appendToResponse:response_ [super appendToResponse:response
inContext:context_]; inContext:context];
_valueValue=[value valueInComponent:_component]; valueValue=[_value valueInComponent:component];
_valueValueFiltered=[self _filterSoftReturnsFromString:_valueValue]; valueValueFiltered=[self _filterSoftReturnsFromString:valueValue];
[response_ appendContentHTMLString:_valueValueFiltered]; [response appendContentHTMLString:valueValueFiltered];
[response_ _appendContentAsciiString:@"</TEXTAREA>"]; [response _appendContentAsciiString:@"</TEXTAREA>"];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)_filterSoftReturnsFromString:(NSString*)string_ -(NSString*)_filterSoftReturnsFromString:(NSString*)string
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return string_; return string;
}; };
@end @end
//==================================================================== //====================================================================
@implementation GSWText (GSWTextB) @implementation GSWText (GSWTextB)
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping withMapping:(char*)mapping
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return NO; return NO;

View file

@ -1,11 +1,16 @@
/* GSWTextField.h - GSWeb: Class GSWTextField /** GSWTextField.h - <title>GSWeb: Class GSWTextField</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,20 +35,20 @@
//OK //OK
@interface GSWTextField: GSWInput @interface GSWTextField: GSWInput
{ {
GSWAssociation* dateFormat; GSWAssociation* _dateFormat;
GSWAssociation* numberFormat; GSWAssociation* _numberFormat;
GSWAssociation* useDecimalNumber; GSWAssociation* _useDecimalNumber;
GSWAssociation* formatter; GSWAssociation* _formatter;
}; };
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_; contentElements:(NSArray*)elements;
-(void)dealloc; -(void)dealloc;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)context;
-(NSFormatter*)formatterForComponent:(GSWComponent*)_component; -(NSFormatter*)formatterForComponent:(GSWComponent*)component;
@end @end

View file

@ -1,11 +1,16 @@
/* GSWTextField.h - GSWeb: Class GSWTextField /** GSWTextField.m - <title>GSWeb: Class GSWTextField</title>
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,36 +35,36 @@ static char rcsId[] = "$Id$";
@implementation GSWTextField @implementation GSWTextField
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
LOGObjectFnStartC("GSWTextField"); LOGObjectFnStartC("GSWTextField");
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_); NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",aName,associations,elements);
[_associations setObject:[GSWAssociation associationWithValue:@"text"] [tmpAssociations setObject:[GSWAssociation associationWithValue:@"text"]
forKey:@"type"]; forKey:@"type"];
[_associations removeObjectForKey:dateFormat__Key]; [tmpAssociations removeObjectForKey:dateFormat__Key];
[_associations removeObjectForKey:numberFormat__Key]; [tmpAssociations removeObjectForKey:numberFormat__Key];
[_associations removeObjectForKey:useDecimalNumber__Key]; [tmpAssociations removeObjectForKey:useDecimalNumber__Key];
[_associations removeObjectForKey:formatter__Key]; [tmpAssociations removeObjectForKey:formatter__Key];
if ((self=[super initWithName:name_ if ((self=[super initWithName:aName
associations:_associations associations:tmpAssociations
contentElements:nil])) //No Childs! contentElements:nil])) //No Childs!
{ {
dateFormat = [[associations_ objectForKey:dateFormat__Key _dateFormat = [[associations objectForKey:dateFormat__Key
withDefaultObject:[dateFormat autorelease]] retain]; withDefaultObject:[_dateFormat autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWTextField: dateFormat=%@",dateFormat); NSDebugMLLog(@"gswdync",@"GSWTextField: dateFormat=%@",_dateFormat);
numberFormat = [[associations_ objectForKey:numberFormat__Key _numberFormat = [[associations objectForKey:numberFormat__Key
withDefaultObject:[numberFormat autorelease]] retain]; withDefaultObject:[_numberFormat autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWTextField: numberFormat=%@",numberFormat); NSDebugMLLog(@"gswdync",@"GSWTextField: numberFormat=%@",_numberFormat);
useDecimalNumber = [[associations_ objectForKey:useDecimalNumber__Key _useDecimalNumber = [[associations objectForKey:useDecimalNumber__Key
withDefaultObject:[useDecimalNumber autorelease]] retain]; withDefaultObject:[_useDecimalNumber autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWTextField: useDecimalNumber=%@",useDecimalNumber); NSDebugMLLog(@"gswdync",@"GSWTextField: useDecimalNumber=%@",_useDecimalNumber);
formatter = [[associations_ objectForKey:formatter__Key _formatter = [[associations objectForKey:formatter__Key
withDefaultObject:[formatter autorelease]] retain]; withDefaultObject:[_formatter autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWTextField: formatter=%@",formatter); NSDebugMLLog(@"gswdync",@"GSWTextField: formatter=%@",_formatter);
}; };
LOGObjectFnStopC("GSWTextField"); LOGObjectFnStopC("GSWTextField");
return self; return self;
}; };
@ -66,167 +72,171 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(dateFormat); DESTROY(_dateFormat);
DESTROY(numberFormat); DESTROY(_numberFormat);
DESTROY(useDecimalNumber); DESTROY(_useDecimalNumber);
DESTROY(formatter); DESTROY(_formatter);
[super dealloc]; [super dealloc];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
BOOL _disabled=NO; BOOL disabledValue=NO;
LOGObjectFnStartC("GSWTextField"); LOGObjectFnStartC("GSWTextField");
GSWAssertCorrectElementID(context_);// Debug Only GSWAssertCorrectElementID(context);// Debug Only
_disabled=[self disabledInContext:context_]; disabledValue=[self disabledInContext:context];
if (!_disabled) if (!disabledValue)
{ {
BOOL _wasFormSubmitted=[context_ _wasFormSubmitted]; BOOL wasFormSubmitted=[context _wasFormSubmitted];
if (_wasFormSubmitted) if (wasFormSubmitted)
{ {
GSWComponent* _component=[context_ component]; GSWComponent* component=[context component];
NSString* _nameInContext=[self nameInContext:context_]; NSString* nameInContext=[self nameInContext:context];
NSString* _value=[request_ formValueForKey:_nameInContext]; NSString* value=[request formValueForKey:nameInContext];
id _resultValue=nil; id resultValue=nil;
NSDebugMLLog(@"gswdync",@"_nameInContext=%@",_nameInContext); NSDebugMLLog(@"gswdync",@"nameInContext=%@",nameInContext);
NSDebugMLLog(@"gswdync",@"_value=%@",_value); NSDebugMLLog(@"gswdync",@"value=%@",value);
if (_value) if (value)
{ {
NSFormatter* _formatter=[self formatterForComponent:_component]; NSFormatter* formatter=[self formatterForComponent:component];
NSDebugMLLog(@"gswdync",@"_formatter=%@",_formatter); NSDebugMLLog(@"gswdync",@"formatter=%@",formatter);
if (_formatter) if (formatter)
{ {
NSString* _errorDscr=nil; NSString* errorDscr=nil;
if (![_formatter getObjectValue:&_resultValue if (![formatter getObjectValue:&resultValue
forString:_value forString:value
errorDescription:&_errorDscr]) errorDescription:&errorDscr])
{
NSException* _exception=nil;
NSString* _valueKeyPath=[value keyPath];
LOGException(@"EOValidationException _resultValue=%@ _valueKeyPath=%@",_resultValue,_valueKeyPath);
_exception=[NSException exceptionWithName:@"EOValidationException"
reason:_errorDscr /*_exceptionDscr*/
userInfo:[NSDictionary
dictionaryWithObjectsAndKeys:
(_resultValue ? _resultValue : @"nil"),@"EOValidatedObjectUserInfoKey",
_valueKeyPath,@"EOValidatedPropertyUserInfoKey",
nil,nil]];
[_component validationFailedWithException:_exception
value:_resultValue
keyPath:_valueKeyPath];
};
}
else
_resultValue=_value;
};
NSDebugMLLog(@"gswdync",@"_resultValue=%@",_resultValue);
// Turbocat
if ([self _isFormattedValueInComponent:_component equalToFormattedValue:_value]) {
// does nothing, old formatted values are equal
} else {
if (!WOStrictFlag)
{ {
NS_DURING NSException* exception=nil;
{ NSString* valueKeyPath=[value keyPath];
[value setValue:_resultValue LOGException(@"EOValidationException resultValue=%@ valueKeyPath=%@",
inComponent:_component]; resultValue,valueKeyPath);
}; exception=[NSException exceptionWithName:@"EOValidationException"
NS_HANDLER reason:errorDscr /*_exceptionDscr*/
{ userInfo:[NSDictionary
[self handleValidationException:localException dictionaryWithObjectsAndKeys:
inContext:context_]; (resultValue ? resultValue : @"nil"),@"EOValidatedObjectUserInfoKey",
} valueKeyPath,@"EOValidatedPropertyUserInfoKey",
NS_ENDHANDLER; nil,nil]];
[component validationFailedWithException:exception
value:resultValue
keyPath:valueKeyPath];
};
}
else
resultValue=value;
};
NSDebugMLLog(@"gswdync",@"resultValue=%@",resultValue);
// Turbocat
if ([self _isFormattedValueInComponent:component
equalToFormattedValue:value])
{
// does nothing, old formatted values are equal
}
else
{
if (!WOStrictFlag)
{
NS_DURING
{
[_value setValue:resultValue
inComponent:component];
};
NS_HANDLER
{
[self handleValidationException:localException
inContext:context];
} }
else NS_ENDHANDLER;
[value setValue:_resultValue }
inComponent:_component]; else
} [_value setValue:resultValue
}; inComponent:component];
}; }
};
};
LOGObjectFnStopC("GSWTextField"); LOGObjectFnStopC("GSWTextField");
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)_response -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)context
{ {
//OK //OK
id _valueValue=nil; id valueValue=nil;
id _formattedValue=nil; id formattedValue=nil;
NSFormatter* _formatter=nil; NSFormatter* formatter=nil;
GSWComponent* _component=nil; GSWComponent* component=nil;
id _valueTmp=nil; id valueTmp=nil;
LOGObjectFnStartC("GSWTextField"); LOGObjectFnStartC("GSWTextField");
_component=[context_ component]; component=[context component];
//To avoid input value printing (stupid original hack !) //To avoid input value printing (stupid original hack !)
_valueTmp=value; valueTmp=_value;
value=nil; _value=nil;
[super appendGSWebObjectsAssociationsToResponse:_response [super appendGSWebObjectsAssociationsToResponse:response
inContext:context_]; inContext:context];
//To avoid input value printing (stupid original hack !) //To avoid input value printing (stupid original hack !)
value=_valueTmp; _value=valueTmp;
_valueTmp=nil; valueTmp=nil;
_valueValue=[value valueInComponent:_component]; valueValue=[_value valueInComponent:component];
_formatter=[self formatterForComponent:_component]; formatter=[self formatterForComponent:component];
if (!_formatter) if (!formatter)
{ {
NSDebugMLog0(@"No Formatter"); NSDebugMLog0(@"No Formatter");
_formattedValue=_valueValue; formattedValue=valueValue;
} }
else else
{ {
_formattedValue=[_formatter stringForObjectValue:_valueValue]; formattedValue=[formatter stringForObjectValue:valueValue];
}; };
[_response appendContentCharacter:' ']; [response appendContentCharacter:' '];
[_response _appendContentAsciiString:@"value"]; [response _appendContentAsciiString:@"value"];
[_response appendContentCharacter:'=']; [response appendContentCharacter:'='];
[_response appendContentCharacter:'"']; [response appendContentCharacter:'"'];
[_response appendContentHTMLAttributeValue:_formattedValue]; [response appendContentHTMLAttributeValue:formattedValue];
[_response appendContentCharacter:'"']; [response appendContentCharacter:'"'];
LOGObjectFnStopC("GSWTextField"); LOGObjectFnStopC("GSWTextField");
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSFormatter*)formatterForComponent:(GSWComponent*)_component -(NSFormatter*)formatterForComponent:(GSWComponent*)component
{ {
//OK //OK
id _formatValue = nil; id formatValue = nil;
id _formatter = nil; id formatter = nil;
LOGObjectFnStartC("GSWTextField"); LOGObjectFnStartC("GSWTextField");
if (dateFormat) if (_dateFormat)
{ {
NSDebugMLog0(@"DateFormat"); NSDebugMLog0(@"DateFormat");
_formatValue=[dateFormat valueInComponent:_component]; formatValue=[_dateFormat valueInComponent:component];
if (_formatValue) if (formatValue)
_formatter=[[[NSDateFormatter alloc]initWithDateFormat:_formatValue formatter=[[[NSDateFormatter alloc]initWithDateFormat:formatValue
allowNaturalLanguage:YES]autorelease]; allowNaturalLanguage:YES]autorelease];
} }
else if (numberFormat) else if (_numberFormat)
{ {
NSDebugMLog0(@"NumberFormat"); NSDebugMLog0(@"NumberFormat");
_formatValue=[numberFormat valueInComponent:_component]; formatValue=[_numberFormat valueInComponent:component];
if (_formatValue) if (formatValue)
{ {
//TODO //TODO
/* /*
_formatter=[[NSNumberFormatter new]autorelease]; formatter=[[NSNumberFormatter new]autorelease];
[_formatter setFormat:_formatValue]; [formatter setFormat:formatValue];
*/ */
}; };
} }
else else
{ {
NSDebugMLog0(@"Formatter"); NSDebugMLog0(@"Formatter");
_formatter=[formatter valueInComponent:_component]; formatter=[_formatter valueInComponent:component];
}; };
LOGObjectFnStopC("GSWTextField"); LOGObjectFnStopC("GSWTextField");
return _formatter; return formatter;
}; };
@end @end
@ -235,32 +245,36 @@ static char rcsId[] = "$Id$";
@implementation GSWTextField (TurbocatAdditions) @implementation GSWTextField (TurbocatAdditions)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
- (BOOL)_isFormattedValueInComponent:(GSWComponent *)_component equalToFormattedValue:(NSString *)newFormattedValue - (BOOL)_isFormattedValueInComponent:(GSWComponent *)component
equalToFormattedValue:(NSString *)newFormattedValue
{ {
id _valueValue=nil; id valueValue=nil;
id _formattedValue=nil; id formattedValue=nil;
NSFormatter* _formatter=nil; NSFormatter* formatter=nil;
if (!newFormattedValue) {
return NO;
}
if (!newFormattedValue)
{
return NO;
}
// get own value // get own value
_valueValue=[value valueInComponent:_component]; valueValue=[_value valueInComponent:component];
_formatter=[self formatterForComponent:_component]; formatter=[self formatterForComponent:component];
if (!_formatter) if (!formatter)
{ {
//NSLog(@"No Formatter in _isFormattedValueInComponent"); formattedValue=valueValue;
_formattedValue=_valueValue; }
}
else else
{ {
_formattedValue=[_formatter stringForObjectValue:_valueValue]; formattedValue=[formatter stringForObjectValue:valueValue];
}; };
if (_formattedValue && [newFormattedValue isEqualToString:_formattedValue]) { if (formattedValue && [newFormattedValue isEqualToString:formattedValue])
NSLog(@"### GSWTextField : are EQUAL ###"); {
return YES; NSLog(@"### GSWTextField : are EQUAL ###");
} return YES;
}
return NO; return NO;
} }
@end

View file

@ -52,7 +52,7 @@ BOOL boolValueFor(id id_)
return YES; return YES;
else if (/*id_==BNNO ||*/ id_==NSTNO) else if (/*id_==BNNO ||*/ id_==NSTNO)
return NO; return NO;
else if ([id_ conformsTo:@protocol(NSString)] && [id_ length]>0) else if (/*[id_ conformsTo:@protocol(NSString)]*/ [id_ isKindOfClass:[NSString class]] && [id_ length]>0)
return ([id_ caseInsensitiveCompare: @"NO"]!=NSOrderedSame); return ([id_ caseInsensitiveCompare: @"NO"]!=NSOrderedSame);
else if ([id_ respondsToSelector:@selector(boolValue)] && [id_ boolValue]) else if ([id_ respondsToSelector:@selector(boolValue)] && [id_ boolValue])
return YES; return YES;
@ -78,7 +78,7 @@ BOOL boolValueWithDefaultFor(id id_,BOOL default_)
else if (/*id_==BNNO ||*/ id_==NSTNO) else if (/*id_==BNNO ||*/ id_==NSTNO)
return NO; return NO;
//@protocol NSString //@protocol NSString
else if ([id_ conformsTo:@protocol(NSString)] && [id_ length]>0) else if (/*[id_ conformsTo:@protocol(NSString)]*/ [id_ isKindOfClass:[NSString class]] && [id_ length]>0)
return ([id_ caseInsensitiveCompare: @"NO"]!=NSOrderedSame); return ([id_ caseInsensitiveCompare: @"NO"]!=NSOrderedSame);
else if ([id_ respondsToSelector:@selector(boolValue)]) else if ([id_ respondsToSelector:@selector(boolValue)])
return ([id_ boolValue]!=NO); return ([id_ boolValue]!=NO);