mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-21 02:41:04 +00:00
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:
parent
afcf1c4e8d
commit
7151edc54d
64 changed files with 5979 additions and 5449 deletions
100
ChangeLog
100
ChangeLog
|
@ -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>
|
||||
|
||||
* GSWAdaptors/common/GSWConfig.c: changed comments
|
||||
|
|
|
@ -7,6 +7,7 @@ Link: GSWHyperlink
|
|||
Image: GSWImage
|
||||
{
|
||||
filename = imageFileName;
|
||||
framework = "GSWExtensions";
|
||||
alt = helpString;
|
||||
name = helpString;
|
||||
border = "0";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
ExclamationImage: GSWImage
|
||||
{
|
||||
filename = "exclamation.png";
|
||||
filename = "exclamation.mng";
|
||||
framework = "GSWExtensions";
|
||||
border = 0;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWActionURL.h - GSWeb: Class GSWActionURL
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWActionURL.h - <title>GSWeb: Class GSWActionURL</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -27,15 +33,15 @@
|
|||
#define _GSWActionURL_h__
|
||||
|
||||
@interface GSWActionURL: GSWHyperlink
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
template:(GSWElement*)template_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
template:(GSWElement*)template;
|
||||
-(NSString*)elementName;
|
||||
@end
|
||||
|
||||
@interface GSWActionURL (GSWActionURLA)
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
+(BOOL)hasGSWebObjectsAssociations;
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWActionURL.h - GSWeb: Class GSWActionURL
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWActionURL.h - <title>GSWeb: Class GSWActionURL</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,17 +35,19 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWActionURL
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
template:(GSWElement*)template_
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
template:(GSWElement*)template
|
||||
{
|
||||
IM_StartC("ActionURL");
|
||||
MDumpInputObject(name_);
|
||||
MDumpInputObject(associations_);
|
||||
MDumpInputObject(template_);
|
||||
self=[super initWithName:name_
|
||||
associations:associations_
|
||||
template:template_];
|
||||
MDumpInputObject(name);
|
||||
MDumpInputObject(associations);
|
||||
MDumpInputObject(template);
|
||||
if ((self=[super initWithName:name
|
||||
associations:associations
|
||||
template:template]))
|
||||
{
|
||||
};
|
||||
IM_StopC("ActionURL");
|
||||
return self;
|
||||
};
|
||||
|
@ -67,14 +75,12 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWActionURL (GSWActionURLA)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
IM_StartC("ActionURL");
|
||||
MDumpInputObject(response_);
|
||||
MDumpInputObject(context_);
|
||||
[super appendToResponse:response_
|
||||
inContext:context_];
|
||||
[super appendToResponse:response
|
||||
inContext:context];
|
||||
IM_StopC("ActionURL");
|
||||
};
|
||||
|
||||
|
|
|
@ -605,7 +605,8 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
|
|||
id EONullNull=[NSNull null];
|
||||
#endif
|
||||
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 GDL2
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWBody.h - GSWeb: Class GSWBody
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWBody.h - <title>GSWeb: Class GSWBody</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,9 +35,9 @@
|
|||
|
||||
//====================================================================
|
||||
@interface GSWBody: GSWHTMLURLValuedElement
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
-(void)dealloc;
|
||||
-(NSString*)valueAttributeName;
|
||||
-(NSString*)urlAttributeName;
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWBody.m - GSWeb: Class GSWBody
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWBody.m - <title>GSWeb: Class GSWBody</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,15 +35,15 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWBody
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
if ((self=[super initWithName:name_
|
||||
associations:associations_
|
||||
contentElements:elements_]))
|
||||
{
|
||||
};
|
||||
if ((self=[super initWithName:name
|
||||
associations:associations
|
||||
contentElements:elements]))
|
||||
{
|
||||
};
|
||||
return self;
|
||||
};
|
||||
|
||||
|
@ -69,8 +75,8 @@ static char rcsId[] = "$Id$";
|
|||
-(NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%s %p>",
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWBrowser.h - GSWeb: Class GSWBrowser
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWBrowser.h - <title>GSWeb: Class GSWBrowser</title>
|
||||
|
||||
Copyright (C) 1999-2002 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jan 1999
|
||||
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
Date: Jan 1999
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,54 +35,56 @@
|
|||
//OK
|
||||
@interface GSWBrowser: GSWInput
|
||||
{
|
||||
GSWAssociation* list;
|
||||
GSWAssociation* item;
|
||||
GSWAssociation* displayString;
|
||||
GSWAssociation* selections;
|
||||
GSWAssociation* _list;
|
||||
GSWAssociation* _item;
|
||||
GSWAssociation* _displayString;
|
||||
GSWAssociation* _selections;
|
||||
//GSWeb Additions {
|
||||
GSWAssociation* selectionValues;
|
||||
GSWAssociation* _selectionValues;
|
||||
// }
|
||||
GSWAssociation* selectedValues;
|
||||
GSWAssociation* size;
|
||||
GSWAssociation* multiple;
|
||||
GSWAssociation* escapeHTML;
|
||||
BOOL autoValue;//??
|
||||
GSWAssociation* _selectedValues;
|
||||
GSWAssociation* _size;
|
||||
GSWAssociation* _multiple;
|
||||
GSWAssociation* _escapeHTML;
|
||||
BOOL _autoValue;//??
|
||||
};
|
||||
-(void)dealloc;
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
-(NSString*)description;
|
||||
-(NSString*)elementName;
|
||||
@end
|
||||
|
||||
@interface GSWBrowser (GSWBrowserA)
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
@interface GSWBrowser (GSWBrowserB)
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)appendValueToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendValueToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
@end
|
||||
|
||||
@interface GSWBrowser (GSWBrowserC)
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping;
|
||||
-(BOOL)appendStringAtRight:(id)unkwnon
|
||||
withMapping:(char*)mapping;
|
||||
@end
|
||||
#endif //_GSWBrowser_h__
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWBrowser.m - GSWeb: Class GSWBrowser
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWBrowser.m - <title>GSWeb: Class GSWBrowser</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,61 +35,62 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWBrowser
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_
|
||||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
//OK
|
||||
NSMutableDictionary* _associations=nil;
|
||||
NSMutableDictionary* tmpAssociations=nil;
|
||||
LOGObjectFnStartC("GSWBrowser");
|
||||
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements=%@",name_,associations_,elements_);
|
||||
_associations=[NSMutableDictionary dictionaryWithDictionary:associations_];
|
||||
[_associations removeObjectForKey:list__Key];
|
||||
[_associations removeObjectForKey:item__Key];
|
||||
[_associations removeObjectForKey:displayString__Key];
|
||||
[_associations removeObjectForKey:selections__Key];
|
||||
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",
|
||||
aName,associations,elements);
|
||||
tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
|
||||
[tmpAssociations removeObjectForKey:list__Key];
|
||||
[tmpAssociations removeObjectForKey:item__Key];
|
||||
[tmpAssociations removeObjectForKey:displayString__Key];
|
||||
[tmpAssociations removeObjectForKey:selections__Key];
|
||||
if (!WOStrictFlag)
|
||||
[_associations removeObjectForKey:selectionValues__Key];
|
||||
[_associations removeObjectForKey:selectedValues__Key];
|
||||
[_associations removeObjectForKey:size__Key];
|
||||
[_associations removeObjectForKey:multiple__Key];
|
||||
[_associations removeObjectForKey:escapeHTML__Key];
|
||||
[tmpAssociations removeObjectForKey:selectionValues__Key];
|
||||
[tmpAssociations removeObjectForKey:selectedValues__Key];
|
||||
[tmpAssociations removeObjectForKey:size__Key];
|
||||
[tmpAssociations removeObjectForKey:multiple__Key];
|
||||
[tmpAssociations removeObjectForKey:escapeHTML__Key];
|
||||
|
||||
if ((self=[super initWithName:name_
|
||||
associations:_associations
|
||||
if ((self=[super initWithName:aName
|
||||
associations:tmpAssociations
|
||||
contentElements:nil]))
|
||||
{
|
||||
list=[[associations_ objectForKey:list__Key
|
||||
withDefaultObject:[list autorelease]] retain];
|
||||
item=[[associations_ objectForKey:item__Key
|
||||
withDefaultObject:[item autorelease]] retain];
|
||||
displayString=[[associations_ objectForKey:displayString__Key
|
||||
withDefaultObject:[displayString autorelease]] retain];
|
||||
selections=[[associations_ objectForKey:selection__Key
|
||||
withDefaultObject:[selections autorelease]] retain];
|
||||
if (selections && ![selections isValueSettable])
|
||||
_list=[[associations objectForKey:list__Key
|
||||
withDefaultObject:[_list autorelease]] retain];
|
||||
_item=[[associations objectForKey:item__Key
|
||||
withDefaultObject:[_item autorelease]] retain];
|
||||
_displayString=[[associations objectForKey:displayString__Key
|
||||
withDefaultObject:[_displayString autorelease]] retain];
|
||||
_selections=[[associations objectForKey:selection__Key
|
||||
withDefaultObject:[_selections autorelease]] retain];
|
||||
if (_selections && ![_selections isValueSettable])
|
||||
{
|
||||
//TODO
|
||||
};
|
||||
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
selectionValues=[[associations_ objectForKey:selectionValue__Key
|
||||
withDefaultObject:[selectionValues autorelease]] retain];
|
||||
if (selectionValues && ![selectionValues isValueSettable])
|
||||
_selectionValues=[[associations objectForKey:selectionValue__Key
|
||||
withDefaultObject:[_selectionValues autorelease]] retain];
|
||||
if (_selectionValues && ![_selectionValues isValueSettable])
|
||||
{
|
||||
//TODO
|
||||
};
|
||||
};
|
||||
|
||||
selectedValues=[[associations_ objectForKey:selectedValues__Key
|
||||
withDefaultObject:[selectedValues autorelease]] retain];
|
||||
size=[[associations_ objectForKey:size__Key
|
||||
withDefaultObject:[size autorelease]] retain];
|
||||
multiple=[[associations_ objectForKey:multiple__Key
|
||||
withDefaultObject:[multiple autorelease]] retain];
|
||||
escapeHTML=[[associations_ objectForKey:escapeHTML__Key
|
||||
withDefaultObject:[escapeHTML autorelease]] retain];
|
||||
_selectedValues=[[associations objectForKey:selectedValues__Key
|
||||
withDefaultObject:[_selectedValues autorelease]] retain];
|
||||
_size=[[associations objectForKey:size__Key
|
||||
withDefaultObject:[_size autorelease]] retain];
|
||||
_multiple=[[associations objectForKey:multiple__Key
|
||||
withDefaultObject:[_multiple autorelease]] retain];
|
||||
_escapeHTML=[[associations objectForKey:escapeHTML__Key
|
||||
withDefaultObject:[_escapeHTML autorelease]] retain];
|
||||
};
|
||||
LOGObjectFnStopC("GSWBrowser");
|
||||
return self;
|
||||
|
@ -92,15 +99,15 @@ static char rcsId[] = "$Id$";
|
|||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(list);
|
||||
DESTROY(item);
|
||||
DESTROY(displayString);
|
||||
DESTROY(selections);
|
||||
DESTROY(selectionValues);
|
||||
DESTROY(selectedValues);
|
||||
DESTROY(size);
|
||||
DESTROY(multiple);
|
||||
DESTROY(escapeHTML);
|
||||
DESTROY(_list);
|
||||
DESTROY(_item);
|
||||
DESTROY(_displayString);
|
||||
DESTROY(_selections);
|
||||
DESTROY(_selectionValues);
|
||||
DESTROY(_selectedValues);
|
||||
DESTROY(_size);
|
||||
DESTROY(_multiple);
|
||||
DESTROY(_escapeHTML);
|
||||
[super dealloc];
|
||||
};
|
||||
|
||||
|
@ -123,315 +130,315 @@ static char rcsId[] = "$Id$";
|
|||
//====================================================================
|
||||
@implementation GSWBrowser (GSWBrowserA)
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
GSWRequest* _request=nil;
|
||||
BOOL _isFromClientComponent=NO;
|
||||
GSWComponent* _component=nil;
|
||||
NSArray* _listValue=nil;
|
||||
id _selectionsValue=nil;
|
||||
id _selectedValuesValue=nil;
|
||||
id _valueValue=nil;
|
||||
id _itemValue=nil;
|
||||
id _displayStringValue=nil;
|
||||
BOOL _escapeHTML=YES;
|
||||
id _escapeHTMLValue=nil;
|
||||
BOOL _isMultiple=NO;
|
||||
GSWRequest* request=nil;
|
||||
BOOL isFromClientComponent=NO;
|
||||
GSWComponent* component=nil;
|
||||
NSArray* listValue=nil;
|
||||
id selectionsValue=nil;
|
||||
id selectedValuesValue=nil;
|
||||
id valueValue=nil;
|
||||
id itemValue=nil;
|
||||
id displayStringValue=nil;
|
||||
BOOL escapeHTMLBoolValue=YES;
|
||||
id escapeHTMLValue=nil;
|
||||
BOOL isMultiple=NO;
|
||||
int i=0;
|
||||
BOOL _inOptGroup=NO;
|
||||
BOOL inOptGroup=NO;
|
||||
#ifndef ENABLE_OPTGROUP
|
||||
BOOL _optGroupLabel=NO;
|
||||
BOOL optGroupLabel=NO;
|
||||
#endif
|
||||
LOGObjectFnStartC("GSWBrowser");
|
||||
[self resetAutoValue];
|
||||
autoValue = NO;
|
||||
_request=[context_ request];
|
||||
_isFromClientComponent=[_request isFromClientComponent];
|
||||
_component=[context_ component];
|
||||
_autoValue = NO;
|
||||
request=[context request];
|
||||
isFromClientComponent=[request isFromClientComponent];
|
||||
component=[context component];
|
||||
//TODO: multiple
|
||||
[super appendToResponse:response_
|
||||
inContext:context_];
|
||||
_listValue=[list valueInComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"_listValue=%@",_listValue);
|
||||
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)],
|
||||
[super appendToResponse:response
|
||||
inContext:context];
|
||||
listValue=[_list valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"listValue=%@",listValue);
|
||||
NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
|
||||
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
|
||||
list,
|
||||
_listValue,
|
||||
[_listValue class]);
|
||||
_selectionsValue=[selections valueInComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"selections=%@",selections);
|
||||
NSDebugMLLog(@"gswdync",@"_selectionsValue=%@",_selectionsValue);
|
||||
_selectedValuesValue=[selectedValues valueInComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"selectedValues=%@",selectedValues);
|
||||
NSDebugMLLog(@"gswdync",@"_selectedValuesValue=%@",_selectedValuesValue);
|
||||
if (escapeHTML)
|
||||
_list,
|
||||
listValue,
|
||||
[listValue class]);
|
||||
selectionsValue=[_selections valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"selections=%@",_selections);
|
||||
NSDebugMLLog(@"gswdync",@"selectionsValue=%@",selectionsValue);
|
||||
selectedValuesValue=[_selectedValues valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"selectedValues=%@",_selectedValues);
|
||||
NSDebugMLLog(@"gswdync",@"selectedValuesValue=%@",selectedValuesValue);
|
||||
if (_escapeHTML)
|
||||
{
|
||||
_escapeHTMLValue=[escapeHTML valueInComponent:_component];
|
||||
_escapeHTML=boolValueFor(_escapeHTMLValue);
|
||||
escapeHTMLValue=[_escapeHTML valueInComponent:component];
|
||||
escapeHTMLBoolValue=boolValueFor(escapeHTMLValue);
|
||||
};
|
||||
if (multiple)
|
||||
if (_multiple)
|
||||
{
|
||||
id _multipleValue=nil;
|
||||
_multipleValue=[multiple valueInComponent:_component];
|
||||
_isMultiple=boolValueFor(_multipleValue);
|
||||
id multipleValue=nil;
|
||||
multipleValue=[_multiple valueInComponent:component];
|
||||
isMultiple=boolValueFor(multipleValue);
|
||||
};
|
||||
for(i=0;i<[_listValue count];i++)
|
||||
for(i=0;i<[listValue count];i++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"_inOptGroup=%s",(_inOptGroup ? "YES" : "NO"));
|
||||
_itemValue=[_listValue objectAtIndex:i];
|
||||
if (item)
|
||||
[item setValue:_itemValue
|
||||
inComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"_itemValue=%@",_itemValue);
|
||||
if (_itemValue)
|
||||
NSDebugMLLog(@"gswdync",@"inOptGroup=%s",(inOptGroup ? "YES" : "NO"));
|
||||
itemValue=[listValue objectAtIndex:i];
|
||||
if (_item)
|
||||
[_item setValue:itemValue
|
||||
inComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
|
||||
if (itemValue)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",value);
|
||||
_valueValue=[self valueInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_valueValue=%@",_valueValue);
|
||||
if (_valueValue)
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",_value);
|
||||
valueValue=[self valueInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
if (valueValue)
|
||||
{
|
||||
BOOL _isEqual;
|
||||
BOOL isEqual;
|
||||
|
||||
NSDebugMLLog0(@"gswdync",@"Adding OPTION");
|
||||
[response_ _appendContentAsciiString:@"\n<OPTION"];
|
||||
if (selections)
|
||||
[response _appendContentAsciiString:@"\n<OPTION"];
|
||||
if (_selections)
|
||||
{
|
||||
if(value)
|
||||
_isEqual=SBIsValueIsIn(_valueValue,_selectionsValue);
|
||||
if(_value)
|
||||
isEqual=SBIsValueIsIn(valueValue,selectionsValue);
|
||||
else
|
||||
_isEqual=SBIsValueIsIn(_itemValue,_selectionsValue);
|
||||
isEqual=SBIsValueIsIn(itemValue,selectionsValue);
|
||||
|
||||
if (_isEqual)
|
||||
if (isEqual)
|
||||
{
|
||||
[response_ appendContentCharacter:' '];
|
||||
[response_ _appendContentAsciiString:@"selected"];
|
||||
[response appendContentCharacter:' '];
|
||||
[response _appendContentAsciiString:@"selected"];
|
||||
};
|
||||
};
|
||||
if (_isEqual == NO && selectedValues)
|
||||
if (isEqual == NO && _selectedValues)
|
||||
{
|
||||
if(value)
|
||||
_isEqual=SBIsValueIsIn(_valueValue,_selectedValuesValue);
|
||||
if(_value)
|
||||
isEqual=SBIsValueIsIn(valueValue,selectedValuesValue);
|
||||
else
|
||||
_isEqual=SBIsValueIsIn(_itemValue,_selectedValuesValue);
|
||||
isEqual=SBIsValueIsIn(itemValue,selectedValuesValue);
|
||||
|
||||
if (_isEqual)
|
||||
if (isEqual)
|
||||
{
|
||||
[response_ appendContentCharacter:' '];
|
||||
[response_ _appendContentAsciiString:@"selected"];
|
||||
[response appendContentCharacter:' '];
|
||||
[response _appendContentAsciiString:@"selected"];
|
||||
};
|
||||
};
|
||||
if (value == nil)
|
||||
autoValue = YES;
|
||||
if (_valueValue)
|
||||
if (_value == nil)
|
||||
_autoValue = YES;
|
||||
if (valueValue)
|
||||
{
|
||||
[response_ _appendContentAsciiString:@" value=\""];
|
||||
[response_ _appendContentAsciiString:_valueValue];
|
||||
[response_ appendContentCharacter:'"'];
|
||||
[response _appendContentAsciiString:@" value=\""];
|
||||
[response _appendContentAsciiString:valueValue];
|
||||
[response appendContentCharacter:'"'];
|
||||
};
|
||||
[response_ appendContentCharacter:'>'];
|
||||
[response appendContentCharacter:'>'];
|
||||
};
|
||||
_displayStringValue=nil;
|
||||
if (displayString)
|
||||
displayStringValue=nil;
|
||||
if (_displayString)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"displayString=%@",displayString);
|
||||
_displayStringValue=[displayString valueInComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"_displayStringValue=%@",_displayStringValue);
|
||||
NSDebugMLLog(@"gswdync",@"displayString=%@",_displayString);
|
||||
displayStringValue=[_displayString valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"displayStringValue=%@",displayStringValue);
|
||||
};
|
||||
|
||||
if (_displayStringValue)
|
||||
if (displayStringValue)
|
||||
{
|
||||
if (!_valueValue)
|
||||
if (!valueValue)
|
||||
{
|
||||
if (_inOptGroup)
|
||||
if (inOptGroup)
|
||||
{
|
||||
NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP");
|
||||
#ifdef ENABLE_OPTGROUP
|
||||
[response_ _appendContentAsciiString:@"\n</OPTGROUP>"];
|
||||
[response _appendContentAsciiString:@"\n</OPTGROUP>"];
|
||||
#endif
|
||||
_inOptGroup=NO;
|
||||
inOptGroup=NO;
|
||||
};
|
||||
NSDebugMLLog0(@"gswdync",@"Adding OPTGROUP");
|
||||
#ifdef ENABLE_OPTGROUP
|
||||
[response_ _appendContentAsciiString:@"\n<OPTGROUP label=\""];
|
||||
[response _appendContentAsciiString:@"\n<OPTGROUP label=\""];
|
||||
#else
|
||||
#if 0
|
||||
[response_ _appendContentAsciiString:@"\n<OPTION>-- "];
|
||||
_optGroupLabel=YES;
|
||||
[response _appendContentAsciiString:@"\n<OPTION>-- "];
|
||||
optGroupLabel=YES;
|
||||
#else
|
||||
[response_ _appendContentAsciiString:@"\n<OPTION>"];
|
||||
[response _appendContentAsciiString:@"\n<OPTION>"];
|
||||
#endif
|
||||
_optGroupLabel=YES;
|
||||
optGroupLabel=YES;
|
||||
#endif
|
||||
_inOptGroup=YES;
|
||||
inOptGroup=YES;
|
||||
};
|
||||
//<OPTGROUP label="PortMaster 3">
|
||||
|
||||
if (_escapeHTML)
|
||||
_displayStringValue=[GSWResponse stringByEscapingHTMLString:_displayStringValue];
|
||||
NSDebugMLLog(@"gswdync",@"_displayStringValue=%@",_displayStringValue);
|
||||
if (escapeHTMLBoolValue)
|
||||
displayStringValue=[GSWResponse stringByEscapingHTMLString:displayStringValue];
|
||||
NSDebugMLLog(@"gswdync",@"displayStringValue=%@",displayStringValue);
|
||||
#ifndef ENABLE_OPTGROUP
|
||||
if (_optGroupLabel)
|
||||
if (optGroupLabel)
|
||||
{
|
||||
_displayStringValue=[NSString stringWithFormat:@"%@ --",_displayStringValue];
|
||||
displayStringValue=[NSString stringWithFormat:@"%@ --",displayStringValue];
|
||||
};
|
||||
#endif
|
||||
[response_ appendContentHTMLString:_displayStringValue];
|
||||
[response appendContentHTMLString:displayStringValue];
|
||||
};
|
||||
if (_valueValue)
|
||||
if (valueValue)
|
||||
{
|
||||
//NSDebugMLLog0(@"gswdync",@"Adding /OPTION");
|
||||
// K2- No /OPTION TAG
|
||||
//[response_ _appendContentAsciiString:@"</OPTION>"];
|
||||
//[response _appendContentAsciiString:@"</OPTION>"];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLLog0(@"gswdync",@"Adding > or </OPTION>");
|
||||
#ifdef ENABLE_OPTGROUP
|
||||
[response_ _appendContentAsciiString:@"\">"];
|
||||
[response _appendContentAsciiString:@"\">"];
|
||||
#else
|
||||
if (_optGroupLabel)
|
||||
if (optGroupLabel)
|
||||
{
|
||||
//[response_ _appendContentAsciiString:@"</OPTION>"];
|
||||
_optGroupLabel=NO;
|
||||
//[response _appendContentAsciiString:@"</OPTION>"];
|
||||
optGroupLabel=NO;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
};
|
||||
};
|
||||
if (_inOptGroup)
|
||||
if (inOptGroup)
|
||||
{
|
||||
#ifdef ENABLE_OPTGROUP
|
||||
NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP");
|
||||
[response_ _appendContentAsciiString:@"\n</OPTGROUP>"];
|
||||
[response _appendContentAsciiString:@"\n</OPTGROUP>"];
|
||||
#endif
|
||||
_inOptGroup=NO;
|
||||
inOptGroup=NO;
|
||||
};
|
||||
[response_ _appendContentAsciiString:@"</SELECT>"];
|
||||
[response _appendContentAsciiString:@"</SELECT>"];
|
||||
LOGObjectFnStopC("GSWBrowser");
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
LOGObjectFnStartC("GSWPopUpButton");
|
||||
[self _slowTakeValuesFromRequest:request_
|
||||
inContext:context_];
|
||||
[self _slowTakeValuesFromRequest:request
|
||||
inContext:context];
|
||||
LOGObjectFnStopC("GSWPopUpButton");
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
BOOL _disabled=NO;
|
||||
BOOL _wasFormSubmitted=NO;
|
||||
BOOL disabledValue=NO;
|
||||
BOOL wasFormSubmitted=NO;
|
||||
LOGObjectFnStartC("GSWPopUpButton");
|
||||
[self resetAutoValue];
|
||||
_disabled=[self disabledInContext:context_];
|
||||
if (!_disabled)
|
||||
disabledValue=[self disabledInContext:context];
|
||||
if (!disabledValue)
|
||||
{
|
||||
_wasFormSubmitted=[context_ _wasFormSubmitted];
|
||||
if (_wasFormSubmitted)
|
||||
wasFormSubmitted=[context _wasFormSubmitted];
|
||||
if (wasFormSubmitted)
|
||||
{
|
||||
BOOL _isMultiple=NO;
|
||||
NSArray* _foundValues=nil;
|
||||
NSMutableArray* _mutableFoundValues=[NSMutableArray array];
|
||||
GSWComponent* _component=nil;
|
||||
NSArray* _listValue=nil;
|
||||
id _valueValue=nil;
|
||||
id _itemValue=nil;
|
||||
NSString* _name=nil;
|
||||
NSArray* _formValues=nil;
|
||||
id _formValue=nil;
|
||||
BOOL _found=NO;
|
||||
BOOL isMultiple=NO;
|
||||
NSArray* foundValues=nil;
|
||||
NSMutableArray* mutableFoundValues=[NSMutableArray array];
|
||||
GSWComponent* component=nil;
|
||||
NSArray* listValue=nil;
|
||||
id valueValue=nil;
|
||||
id itemValue=nil;
|
||||
NSString* name=nil;
|
||||
NSArray* formValues=nil;
|
||||
id formValue=nil;
|
||||
BOOL found=NO;
|
||||
int i=0;
|
||||
_component=[context_ component];
|
||||
_name=[self nameInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_name=%@",_name);
|
||||
if (multiple)
|
||||
component=[context component];
|
||||
name=[self nameInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"name=%@",name);
|
||||
if (_multiple)
|
||||
{
|
||||
id _multipleValue=[multiple valueInComponent:_component];
|
||||
_isMultiple=boolValueFor(_multipleValue);
|
||||
id multipleValue=[_multiple valueInComponent:component];
|
||||
isMultiple=boolValueFor(multipleValue);
|
||||
};
|
||||
_formValues=[request_ formValuesForKey:_name];
|
||||
NSDebugMLLog(@"gswdync",@"_formValues=%@",_formValues);
|
||||
if (_formValues && [_formValues count])
|
||||
formValues=[request formValuesForKey:name];
|
||||
NSDebugMLLog(@"gswdync",@"formValues=%@",formValues);
|
||||
if (formValues && [formValues count])
|
||||
{
|
||||
BOOL _isEqual=NO;
|
||||
_formValue=[_formValues objectAtIndex:0];
|
||||
NSDebugMLLog(@"gswdync",@"_formValue=%@",_formValue);
|
||||
_listValue=[list valueInComponent:_component];
|
||||
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)],
|
||||
BOOL isEqual=NO;
|
||||
formValue=[formValues objectAtIndex:0];
|
||||
NSDebugMLLog(@"gswdync",@"formValue=%@",formValue);
|
||||
listValue=[_list valueInComponent:component];
|
||||
NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
|
||||
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
|
||||
list,
|
||||
_listValue,
|
||||
[_listValue class]);
|
||||
for(i=0;(!_found || _isMultiple) && i<[_listValue count];i++)
|
||||
_list,
|
||||
listValue,
|
||||
[listValue class]);
|
||||
for(i=0;(!found || isMultiple) && i<[listValue count];i++)
|
||||
{
|
||||
_itemValue=[_listValue objectAtIndex:i];
|
||||
NSDebugMLLog(@"gswdync",@"_itemValue=%@",_itemValue);
|
||||
NSDebugMLLog(@"gswdync",@"item=%@",item);
|
||||
if (item)
|
||||
[item setValue:_itemValue
|
||||
inComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",value);
|
||||
_valueValue=[self valueInContext:context_];
|
||||
itemValue=[listValue objectAtIndex:i];
|
||||
NSDebugMLLog(@"gswdync",@"_itemValue=%@",itemValue);
|
||||
NSDebugMLLog(@"gswdync",@"item=%@",_item);
|
||||
if (_item)
|
||||
[_item setValue:itemValue
|
||||
inComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",_value);
|
||||
valueValue=[self valueInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"_valueValue=%@ [class=%@] _formValue=%@ [class=%@]",
|
||||
_valueValue,[_valueValue class],
|
||||
_formValue,[_formValue class]);
|
||||
_isEqual=SBIsValueIsIn(_valueValue,_formValue);
|
||||
if (_isEqual)
|
||||
valueValue,[valueValue class],
|
||||
formValue,[formValue class]);
|
||||
isEqual=SBIsValueIsIn(valueValue,formValue);
|
||||
if (isEqual)
|
||||
{
|
||||
if(autoValue == NO)
|
||||
_itemValue = _valueValue;
|
||||
[_mutableFoundValues addObject:_itemValue];
|
||||
_found=YES;
|
||||
if(_autoValue == NO)
|
||||
itemValue = valueValue;
|
||||
[mutableFoundValues addObject:itemValue];
|
||||
found=YES;
|
||||
};
|
||||
};
|
||||
};
|
||||
_foundValues=[NSArray arrayWithArray:_mutableFoundValues];
|
||||
NSDebugMLLog(@"gswdync",@"_found=%s",(_found ? "YES" : "NO"));
|
||||
if (selections)
|
||||
foundValues=[NSArray arrayWithArray:mutableFoundValues];
|
||||
NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO"));
|
||||
if (_selections)
|
||||
{
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[selections setValue:_foundValues
|
||||
inComponent:_component];
|
||||
[_selections setValue:foundValues
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
inContext:context];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
{
|
||||
[selections setValue:_foundValues
|
||||
inComponent:_component];
|
||||
[_selections setValue:foundValues
|
||||
inComponent:component];
|
||||
};
|
||||
};
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
if (selectionValues)
|
||||
if (_selectionValues)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[selectionValues setValue:_foundValues
|
||||
inComponent:_component];
|
||||
[_selectionValues setValue:foundValues
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
inContext:context];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
};
|
||||
|
@ -442,8 +449,8 @@ static char rcsId[] = "$Id$";
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
@ -453,16 +460,16 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
//====================================================================
|
||||
@implementation GSWBrowser (GSWBrowserB)
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
-(void)appendValueToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendValueToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWCheckBox.h - GSWeb: Class GSWCheckBox
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWCheckBox.h - <title>GSWeb: Class GSWCheckBox</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,13 +35,13 @@
|
|||
//====================================================================
|
||||
@interface GSWCheckBox: GSWInput
|
||||
{
|
||||
GSWAssociation* checked;
|
||||
GSWAssociation* selection;
|
||||
GSWAssociation* _checked;
|
||||
GSWAssociation* _selection;
|
||||
};
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
-(void)dealloc;
|
||||
-(NSString*)description;
|
||||
|
||||
|
@ -44,14 +50,14 @@
|
|||
//====================================================================
|
||||
@interface GSWCheckBox (GSWCheckBoxA)
|
||||
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWCheckBox (GSWCheckBoxB)
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWCheckBox.m - GSWeb: Class GSWCheckBox
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWCheckBox.m - <title>GSWeb: Class GSWCheckBox</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,42 +35,42 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWCheckBox
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)_elements
|
||||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_];
|
||||
NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
|
||||
LOGObjectFnStartC("GSWCheckBox");
|
||||
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements);
|
||||
[_associations setObject:[GSWAssociation associationWithValue:@"checkbox"]
|
||||
forKey:@"type"];
|
||||
[_associations removeObjectForKey:selection__Key];
|
||||
[_associations removeObjectForKey:checked__Key];
|
||||
if ((self=[super initWithName:name_
|
||||
associations:_associations
|
||||
contentElements:nil]))
|
||||
{
|
||||
//TODOV
|
||||
selection=[[associations_ objectForKey:selection__Key
|
||||
withDefaultObject:[selection autorelease]] retain];
|
||||
if (selection && ![selection isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable");
|
||||
};
|
||||
checked=[[associations_ objectForKey:checked__Key
|
||||
withDefaultObject:[checked autorelease]] retain];
|
||||
if (checked && ![checked isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'checked' parameter must be settable");
|
||||
};
|
||||
if (!checked)
|
||||
{
|
||||
if (!value || !selection)
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"If you don't specify 'checked' parameter, you have to specify 'value' and 'selection' parameter");
|
||||
};
|
||||
};
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ _elements=%@",aName,associations,elements);
|
||||
[tmpAssociations setObject:[GSWAssociation associationWithValue:@"checkbox"]
|
||||
forKey:@"type"];
|
||||
[tmpAssociations removeObjectForKey:selection__Key];
|
||||
[tmpAssociations removeObjectForKey:checked__Key];
|
||||
if ((self=[super initWithName:aName
|
||||
associations:tmpAssociations
|
||||
contentElements:nil]))
|
||||
{
|
||||
//TODOV
|
||||
_selection=[[associations objectForKey:selection__Key
|
||||
withDefaultObject:[_selection autorelease]] retain];
|
||||
if (_selection && ![_selection isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable");
|
||||
};
|
||||
_checked=[[associations objectForKey:checked__Key
|
||||
withDefaultObject:[_checked autorelease]] retain];
|
||||
if (_checked && ![_checked isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'checked' parameter must be settable");
|
||||
};
|
||||
if (!_checked)
|
||||
{
|
||||
if (!_value || !_selection)
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"If you don't specify 'checked' parameter, you have to specify 'value' and 'selection' parameter");
|
||||
};
|
||||
};
|
||||
};
|
||||
LOGObjectFnStopC("GSWCheckBox");
|
||||
return self;
|
||||
};
|
||||
|
@ -72,8 +78,8 @@ static char rcsId[] = "$Id$";
|
|||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(checked);
|
||||
DESTROY(selection);
|
||||
DESTROY(_checked);
|
||||
DESTROY(_selection);
|
||||
[super dealloc];
|
||||
};
|
||||
|
||||
|
@ -81,8 +87,8 @@ static char rcsId[] = "$Id$";
|
|||
-(NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%s %p>",
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
};
|
||||
|
||||
|
||||
|
@ -92,37 +98,37 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWCheckBox (GSWCheckBoxA)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)_response
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
GSWComponent* _component=nil;
|
||||
BOOL _disabledInContext=NO;
|
||||
GSWComponent* component=nil;
|
||||
BOOL disabledInContext=NO;
|
||||
LOGObjectFnStartC("GSWCheckBox");
|
||||
_component=[context_ component];
|
||||
_disabledInContext=[self disabledInContext:context_];
|
||||
if (!_disabledInContext)
|
||||
{
|
||||
BOOL _checked=NO;
|
||||
[self appendValueToResponse:_response
|
||||
inContext:context_];
|
||||
[self appendNameToResponse:_response
|
||||
inContext:context_];
|
||||
component=[context component];
|
||||
disabledInContext=[self disabledInContext:context];
|
||||
if (!disabledInContext)
|
||||
{
|
||||
BOOL checkedValue=NO;
|
||||
[self appendValueToResponse:response
|
||||
inContext:context];
|
||||
[self appendNameToResponse:response
|
||||
inContext:context];
|
||||
|
||||
if (checked)
|
||||
{
|
||||
_checked=[self evaluateCondition:checked
|
||||
inContext:context_];
|
||||
}
|
||||
else if (value)
|
||||
{
|
||||
id _valueValue=[value valueInComponent:_component];
|
||||
id _selectionValue=[selection valueInComponent:_component];
|
||||
_checked=SBIsValueEqual(_selectionValue,_valueValue);
|
||||
};
|
||||
if (_checked)
|
||||
[_response _appendContentAsciiString:@" checked"];
|
||||
};
|
||||
if (_checked)
|
||||
{
|
||||
checkedValue=[self evaluateCondition:_checked
|
||||
inContext:context];
|
||||
}
|
||||
else if (_value)
|
||||
{
|
||||
id valueValue=[_value valueInComponent:component];
|
||||
id selectionValue=[_selection valueInComponent:component];
|
||||
checkedValue=SBIsValueEqual(selectionValue,valueValue);
|
||||
};
|
||||
if (checkedValue)
|
||||
[response _appendContentAsciiString:@" checked"];
|
||||
};
|
||||
LOGObjectFnStopC("GSWCheckBox");
|
||||
};
|
||||
|
||||
|
@ -132,83 +138,80 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWCheckBox (GSWCheckBoxB)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
BOOL _disabledInContext=NO;
|
||||
BOOL disabledInContext=NO;
|
||||
LOGObjectFnStartC("GSWCheckBox");
|
||||
_disabledInContext=[self disabledInContext:context_];
|
||||
if (!_disabledInContext)
|
||||
{
|
||||
if ([context_ _wasFormSubmitted])
|
||||
{
|
||||
GSWComponent* _component=[context_ component];
|
||||
NSString* _name=nil;
|
||||
NSArray* _formValues=nil;
|
||||
// GSWElementIDString* _elementID=nil;
|
||||
BOOL _checkChecked=NO;
|
||||
_name=[self nameInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_name=%@",_name);
|
||||
_formValues=[request_ formValuesForKey:_name];
|
||||
// _elementID=[[context_ elementID] copy]; //!! when release ?
|
||||
//???
|
||||
NSDebugMLLog(@"gswdync",@"_formValues=%@",_formValues);
|
||||
if (_formValues && [_formValues count])
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"[_formValues objectAtIndex:0]=%@",[_formValues objectAtIndex:0]);
|
||||
_checkChecked=YES;
|
||||
if (selection)
|
||||
{
|
||||
//TODOV
|
||||
id _valueValue=[value valueInComponent:_component];
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[selection setValue:_valueValue
|
||||
inComponent:_component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
{
|
||||
[selection setValue:_valueValue
|
||||
inComponent:_component];
|
||||
};
|
||||
};
|
||||
};
|
||||
if (checked)
|
||||
{
|
||||
id _checkedValue=[NSNumber numberWithBool:_checkChecked];
|
||||
NSDebugMLLog(@"gswdync",@"_checkedValue=%@",_checkedValue);
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[checked setValue:_checkedValue
|
||||
inComponent:_component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
{
|
||||
[checked setValue:_checkedValue
|
||||
inComponent:_component];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
disabledInContext=[self disabledInContext:context];
|
||||
if (!disabledInContext)
|
||||
{
|
||||
if ([context _wasFormSubmitted])
|
||||
{
|
||||
GSWComponent* component=[context component];
|
||||
NSString* name=nil;
|
||||
NSArray* formValues=nil;
|
||||
BOOL checkChecked=NO;
|
||||
name=[self nameInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"name=%@",name);
|
||||
formValues=[request formValuesForKey:name];
|
||||
NSDebugMLLog(@"gswdync",@"formValues=%@",formValues);
|
||||
if (formValues && [formValues count])
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"[formValues objectAtIndex:0]=%@",[formValues objectAtIndex:0]);
|
||||
checkChecked=YES;
|
||||
if (_selection)
|
||||
{
|
||||
//TODOV
|
||||
id valueValue=[_value valueInComponent:component];
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[_selection setValue:valueValue
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
{
|
||||
[_selection setValue:valueValue
|
||||
inComponent:component];
|
||||
};
|
||||
};
|
||||
};
|
||||
if (_checked)
|
||||
{
|
||||
id checkedValue=[NSNumber numberWithBool:checkChecked];
|
||||
NSDebugMLLog(@"gswdync",@"checkedValue=%@",checkedValue);
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[_checked setValue:checkedValue
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
{
|
||||
[_checked setValue:checkedValue
|
||||
inComponent:component];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
LOGObjectFnStopC("GSWCheckBox");
|
||||
};
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWCheckBoxList.h - GSWeb: Class GSWCheckBoxList
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWCheckBoxList.h - <title>GSWeb: Class GSWCheckBoxList</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,22 +35,22 @@
|
|||
//====================================================================
|
||||
@interface GSWCheckBoxList: GSWInput
|
||||
{
|
||||
GSWAssociation* list;
|
||||
GSWAssociation* item;
|
||||
GSWAssociation* index;
|
||||
GSWAssociation* selections;
|
||||
GSWAssociation* prefix;
|
||||
GSWAssociation* suffix;
|
||||
GSWAssociation* displayString;
|
||||
GSWAssociation* escapeHTML;
|
||||
GSWAssociation* itemDisabled;
|
||||
BOOL defaultEscapeHTML;
|
||||
BOOL autoValue;
|
||||
GSWAssociation* _list;
|
||||
GSWAssociation* _item;
|
||||
GSWAssociation* _index;
|
||||
GSWAssociation* _selections;
|
||||
GSWAssociation* _prefix;
|
||||
GSWAssociation* _suffix;
|
||||
GSWAssociation* _displayString;
|
||||
GSWAssociation* _escapeHTML;
|
||||
GSWAssociation* _itemDisabled;
|
||||
BOOL _defaultEscapeHTML;
|
||||
BOOL _autoValue;
|
||||
};
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
-(void)dealloc;
|
||||
|
||||
-(NSString*)description;
|
||||
|
@ -55,29 +61,31 @@
|
|||
|
||||
//====================================================================
|
||||
@interface GSWCheckBoxList (GSWCheckBoxListA)
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWCheckBoxList (GSWCheckBoxListB)
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWCheckBoxList (GSWCheckBoxListC)
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping;
|
||||
-(BOOL)appendStringAtLeft:(id)_unkwnon
|
||||
withMapping:(char*)_mapping;
|
||||
-(BOOL)appendStringAtRight:(id)unkwnon
|
||||
withMapping:(char*)mapping;
|
||||
-(BOOL)appendStringAtLeft:(id)unkwnon
|
||||
withMapping:(char*)mapping;
|
||||
-(BOOL)compactHTMLTags;
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWCheckBoxList.m - GSWeb: Class GSWCheckBoxList
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWCheckBoxList.m - <title>GSWeb: Class GSWCheckBoxList</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,79 +35,79 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWCheckBoxList
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements_
|
||||
{
|
||||
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_];
|
||||
NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_);
|
||||
defaultEscapeHTML=1;
|
||||
[_associations removeObjectForKey:list__Key];
|
||||
[_associations removeObjectForKey:item__Key];
|
||||
[_associations removeObjectForKey:index__Key];
|
||||
[_associations removeObjectForKey:prefix__Key];
|
||||
[_associations removeObjectForKey:suffix__Key];
|
||||
[_associations removeObjectForKey:selections__Key];
|
||||
[_associations removeObjectForKey:displayString__Key];
|
||||
[_associations removeObjectForKey:disabled__Key];
|
||||
[_associations removeObjectForKey:escapeHTML__Key];
|
||||
if ((self=[super initWithName:name_
|
||||
associations:_associations
|
||||
contentElements:nil]))
|
||||
{
|
||||
list = [[associations_ objectForKey:list__Key
|
||||
withDefaultObject:[list autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"list=%@",list);
|
||||
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements_=%@",aName,associations,elements_);
|
||||
_defaultEscapeHTML=1;
|
||||
[tmpAssociations removeObjectForKey:list__Key];
|
||||
[tmpAssociations removeObjectForKey:item__Key];
|
||||
[tmpAssociations removeObjectForKey:index__Key];
|
||||
[tmpAssociations removeObjectForKey:prefix__Key];
|
||||
[tmpAssociations removeObjectForKey:suffix__Key];
|
||||
[tmpAssociations removeObjectForKey:selections__Key];
|
||||
[tmpAssociations removeObjectForKey:displayString__Key];
|
||||
[tmpAssociations removeObjectForKey:disabled__Key];
|
||||
[tmpAssociations removeObjectForKey:escapeHTML__Key];
|
||||
if ((self=[super initWithName:aName
|
||||
associations:tmpAssociations
|
||||
contentElements:nil]))
|
||||
{
|
||||
_list = [[associations objectForKey:list__Key
|
||||
withDefaultObject:[_list autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"list=%@",_list);
|
||||
|
||||
item = [[associations_ objectForKey:item__Key
|
||||
withDefaultObject:[item autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"item=%@",item);
|
||||
if (item && ![item isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable");
|
||||
};
|
||||
_item = [[associations objectForKey:item__Key
|
||||
withDefaultObject:[_item autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"item=%@",_item);
|
||||
if (_item && ![_item isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable");
|
||||
};
|
||||
|
||||
value = [[associations_ objectForKey:value__Key
|
||||
withDefaultObject:[value autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",value);
|
||||
_value = [[associations objectForKey:value__Key
|
||||
withDefaultObject:[_value autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",_value);
|
||||
|
||||
index = [[associations_ objectForKey:index__Key
|
||||
withDefaultObject:[index autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"index=%@",index);
|
||||
if (index && ![index isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'index' parameter must be settable");
|
||||
};
|
||||
_index = [[associations objectForKey:index__Key
|
||||
withDefaultObject:[_index autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"index=%@",_index);
|
||||
if (_index && ![_index isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'index' parameter must be settable");
|
||||
};
|
||||
|
||||
prefix = [[associations_ objectForKey:prefix__Key
|
||||
withDefaultObject:[prefix autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"prefix=%@",prefix);
|
||||
_prefix = [[associations objectForKey:prefix__Key
|
||||
withDefaultObject:[_prefix autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"prefix=%@",_prefix);
|
||||
|
||||
suffix = [[associations_ objectForKey:suffix__Key
|
||||
withDefaultObject:[suffix autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"suffix=%@",suffix);
|
||||
_suffix = [[associations objectForKey:suffix__Key
|
||||
withDefaultObject:[_suffix autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"suffix=%@",_suffix);
|
||||
|
||||
selections = [[associations_ objectForKey:selections__Key
|
||||
withDefaultObject:[selections autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"selections=%@",selections);
|
||||
if (![selections isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable");
|
||||
};
|
||||
|
||||
displayString = [[associations_ objectForKey:displayString__Key
|
||||
withDefaultObject:[displayString autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"displayString=%@",displayString);
|
||||
_selections = [[associations objectForKey:selections__Key
|
||||
withDefaultObject:[_selections autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"selections=%@",_selections);
|
||||
if (![_selections isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable");
|
||||
};
|
||||
|
||||
_displayString = [[associations objectForKey:displayString__Key
|
||||
withDefaultObject:[_displayString autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"displayString=%@",_displayString);
|
||||
|
||||
itemDisabled = [[associations_ objectForKey:disabled__Key
|
||||
withDefaultObject:[itemDisabled autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"itemDisabled=%@",itemDisabled);
|
||||
_itemDisabled = [[associations objectForKey:disabled__Key
|
||||
withDefaultObject:[_itemDisabled autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"itemDisabled=%@",_itemDisabled);
|
||||
|
||||
escapeHTML = [[associations_ objectForKey:escapeHTML__Key
|
||||
withDefaultObject:[escapeHTML autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"escapeHTML=%@",escapeHTML);
|
||||
};
|
||||
_escapeHTML = [[associations objectForKey:escapeHTML__Key
|
||||
withDefaultObject:[_escapeHTML autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"escapeHTML=%@",_escapeHTML);
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
return self;
|
||||
};
|
||||
|
@ -109,15 +115,15 @@ static char rcsId[] = "$Id$";
|
|||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(list);
|
||||
DESTROY(item);
|
||||
DESTROY(index);
|
||||
DESTROY(selections);
|
||||
DESTROY(prefix);
|
||||
DESTROY(suffix);
|
||||
DESTROY(displayString);
|
||||
DESTROY(itemDisabled);
|
||||
DESTROY(escapeHTML);
|
||||
DESTROY(_list);
|
||||
DESTROY(_item);
|
||||
DESTROY(_index);
|
||||
DESTROY(_selections);
|
||||
DESTROY(_prefix);
|
||||
DESTROY(_suffix);
|
||||
DESTROY(_displayString);
|
||||
DESTROY(_itemDisabled);
|
||||
DESTROY(_escapeHTML);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -125,8 +131,8 @@ static char rcsId[] = "$Id$";
|
|||
-(NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%s %p>",
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -141,106 +147,105 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWCheckBoxList (GSWCheckBoxListA)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
LOGObjectFnStartC("GSWCheckBoxList");
|
||||
[self _slowTakeValuesFromRequest:request_
|
||||
inContext:context_];
|
||||
[self _slowTakeValuesFromRequest:request
|
||||
inContext:context];
|
||||
LOGObjectFnStopC("GSWCheckBoxList");
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
BOOL _disabledInContext=NO;
|
||||
BOOL disabledInContext=NO;
|
||||
LOGObjectFnStartC("GSWCheckBoxList");
|
||||
|
||||
[self resetAutoValue];
|
||||
_disabledInContext=[self disabledInContext:context_];
|
||||
if (!_disabledInContext)
|
||||
disabledInContext=[self disabledInContext:context];
|
||||
if (!disabledInContext)
|
||||
{
|
||||
if ([context_ _wasFormSubmitted])
|
||||
if ([context _wasFormSubmitted])
|
||||
{
|
||||
GSWComponent* _component=[context_ component];
|
||||
NSArray* _listValue=nil;
|
||||
NSMutableArray* _selections=nil;
|
||||
NSString* _name=nil;
|
||||
NSArray* _formValues=nil;
|
||||
id _valueValue=nil;
|
||||
GSWComponent* component=[context component];
|
||||
NSArray* listValue=nil;
|
||||
NSMutableArray* selectionsValues=nil;
|
||||
NSString* name=nil;
|
||||
NSArray* formValues=nil;
|
||||
id valueValue=nil;
|
||||
int i=0;
|
||||
|
||||
_name=[self nameInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_name=%@",_name);
|
||||
_formValues=[request_ formValuesForKey:_name];
|
||||
NSDebugMLLog(@"gswdync",@"_formValues=%@",_formValues);
|
||||
_listValue=[list valueInComponent:_component];
|
||||
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)],
|
||||
name=[self nameInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"name=%@",name);
|
||||
formValues=[request formValuesForKey:name];
|
||||
NSDebugMLLog(@"gswdync",@"formValues=%@",formValues);
|
||||
listValue=[_list valueInComponent:component];
|
||||
NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
|
||||
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
|
||||
list,
|
||||
_listValue,
|
||||
[_listValue class]);
|
||||
NSDebugMLLog(@"gswdync",@"_listValue=%@",_listValue);
|
||||
_list,
|
||||
listValue,
|
||||
[listValue class]);
|
||||
NSDebugMLLog(@"gswdync",@"listValue=%@",listValue);
|
||||
|
||||
for(i=0;i<[_listValue count];i++)
|
||||
for(i=0;i<[listValue count];i++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"item=%@",item);
|
||||
NSDebugMLLog(@"gswdync",@"index=%@",index);
|
||||
NSDebugMLLog(@"gswdync",@"item=%@",_item);
|
||||
NSDebugMLLog(@"gswdync",@"index=%@",_index);
|
||||
|
||||
if (item)
|
||||
[item setValue:[_listValue objectAtIndex:i]
|
||||
inComponent:_component];
|
||||
else if (index)
|
||||
[index setValue:[NSNumber numberWithShort:i]
|
||||
inComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",value);
|
||||
if (_item)
|
||||
[_item setValue:[listValue objectAtIndex:i]
|
||||
inComponent:component];
|
||||
else if (_index)
|
||||
[_index setValue:[NSNumber numberWithShort:i]
|
||||
inComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",_value);
|
||||
|
||||
_valueValue=[self valueInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_valueValue=%@",_valueValue);
|
||||
valueValue=[self valueInContext:context];
|
||||
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"));
|
||||
if (_found)
|
||||
NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO"));
|
||||
if (found)
|
||||
{
|
||||
if (!_selections)
|
||||
_selections=[NSMutableArray array];
|
||||
if (!selectionsValues)
|
||||
selectionsValues=[NSMutableArray array];
|
||||
|
||||
if(autoValue == NO)
|
||||
[_selections addObject:_valueValue];
|
||||
if(_autoValue == NO)
|
||||
[selectionsValues addObject:valueValue];
|
||||
else
|
||||
[_selections
|
||||
addObject:[_listValue objectAtIndex:i]];
|
||||
[selectionsValues addObject:[listValue objectAtIndex:i]];
|
||||
};
|
||||
};
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"_component=%@",_component);
|
||||
NSDebugMLLog(@"gswdync",@"_selections=%d",_selections);
|
||||
NSDebugMLLog(@"gswdync",@"selections=%@",selections);
|
||||
GSWLogAssertGood(_component);
|
||||
NSDebugMLLog(@"gswdync",@"component=%@",component);
|
||||
NSDebugMLLog(@"gswdync",@"selectionsValues=%d",selectionsValues);
|
||||
NSDebugMLLog(@"gswdync",@"selections=%@",_selections);
|
||||
GSWLogAssertGood(component);
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[selections setValue:_selections
|
||||
inComponent:_component];
|
||||
[_selections setValue:selectionsValues
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
inContext:context];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
{
|
||||
[selections setValue:_selections
|
||||
inComponent:_component];
|
||||
[_selections setValue:selectionsValues
|
||||
inComponent:component];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -248,96 +253,95 @@ static char rcsId[] = "$Id$";
|
|||
};
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnStartC("GSWCheckBoxList");
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
LOGObjectFnStopC("GSWCheckBoxList");
|
||||
};
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
GSWRequest* _request=nil;
|
||||
BOOL _isFromClientComponent=NO;
|
||||
NSString* _name=nil;
|
||||
GSWComponent* _component=nil;
|
||||
NSArray* _selectionsValue=nil;
|
||||
BOOL _isEqual=NO;
|
||||
GSWRequest* request=nil;
|
||||
BOOL isFromClientComponent=NO;
|
||||
NSString* name=nil;
|
||||
GSWComponent* component=nil;
|
||||
NSArray* selectionsValue=nil;
|
||||
BOOL isEqual=NO;
|
||||
|
||||
LOGObjectFnStartC("GSWCheckBoxList");
|
||||
|
||||
[self resetAutoValue];
|
||||
autoValue = NO;
|
||||
_autoValue = NO;
|
||||
|
||||
_request=[context_ request];
|
||||
_isFromClientComponent=[_request isFromClientComponent];
|
||||
_name=[self nameInContext:context_];
|
||||
_component=[context_ component];
|
||||
_selectionsValue=[selections valueInComponent:_component];
|
||||
if (_selectionsValue && ![_selectionsValue isKindOfClass:[NSArray class]])
|
||||
request=[context request];
|
||||
isFromClientComponent=[request isFromClientComponent];
|
||||
name=[self nameInContext:context];
|
||||
component=[context component];
|
||||
selectionsValue=[_selections valueInComponent:component];
|
||||
if (selectionsValue && ![selectionsValue isKindOfClass:[NSArray class]])
|
||||
{
|
||||
ExceptionRaise(@"GSWCheckBoxList",
|
||||
@"GSWCheckBoxList: selections is not a NSArray: %@ %@",
|
||||
_selectionsValue,
|
||||
[_selectionsValue class]);
|
||||
selectionsValue,
|
||||
[selectionsValue class]);
|
||||
}
|
||||
else
|
||||
{
|
||||
int i=0;
|
||||
id _displayStringValue=nil;
|
||||
id _prefixValue=nil;
|
||||
id _suffixValue=nil;
|
||||
id _valueValue=nil;
|
||||
BOOL _disableValue=NO;
|
||||
NSArray* _listValue=[list valueInComponent:_component];
|
||||
id displayStringValue=nil;
|
||||
id prefixValue=nil;
|
||||
id suffixValue=nil;
|
||||
id valueValue=nil;
|
||||
BOOL disableValue=NO;
|
||||
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'",
|
||||
list,
|
||||
_listValue,
|
||||
[_listValue class]);
|
||||
_list,
|
||||
listValue,
|
||||
[listValue class]);
|
||||
|
||||
for(i=0;i<[_listValue count];i++)
|
||||
for(i=0;i<[listValue count];i++)
|
||||
{
|
||||
[item setValue:[_listValue objectAtIndex:i]
|
||||
inComponent:_component];
|
||||
_prefixValue=[prefix valueInComponent:_component];
|
||||
_suffixValue=[suffix valueInComponent:_component];
|
||||
_disableValue=[itemDisabled valueInComponent:_component];
|
||||
[index setValue:[NSNumber numberWithShort:i]
|
||||
inComponent:_component];
|
||||
_displayStringValue=[displayString valueInComponent:_component];
|
||||
[response_ appendContentString:@"<INPUT NAME=\""];
|
||||
[response_ appendContentString:_name];
|
||||
[response_ appendContentString:@"\" TYPE=checkbox VALUE=\""];
|
||||
_valueValue = [self valueInContext:context_];
|
||||
[response_ appendContentHTMLAttributeValue:_valueValue];
|
||||
[response_ appendContentCharacter:'"'];
|
||||
[_item setValue:[listValue objectAtIndex:i]
|
||||
inComponent:component];
|
||||
prefixValue=[_prefix valueInComponent:component];
|
||||
suffixValue=[_suffix valueInComponent:component];
|
||||
disableValue=[_itemDisabled valueInComponent:component];
|
||||
[_index setValue:[NSNumber numberWithShort:i]
|
||||
inComponent:component];
|
||||
displayStringValue=[_displayString valueInComponent:component];
|
||||
[response appendContentString:@"<INPUT NAME=\""];
|
||||
[response appendContentString:name];
|
||||
[response appendContentString:@"\" TYPE=checkbox VALUE=\""];
|
||||
valueValue = [self valueInContext:context];
|
||||
[response appendContentHTMLAttributeValue:valueValue];
|
||||
[response appendContentCharacter:'"'];
|
||||
|
||||
//TODOV
|
||||
if(value)
|
||||
_isEqual = [_selectionsValue containsObject:_valueValue];
|
||||
if(_value)
|
||||
isEqual = [selectionsValue containsObject:valueValue];
|
||||
else
|
||||
{
|
||||
_isEqual = [_selectionsValue
|
||||
containsObject:[_listValue objectAtIndex:i]];
|
||||
isEqual = [selectionsValue containsObject:[listValue objectAtIndex:i]];
|
||||
|
||||
autoValue = YES;
|
||||
_autoValue = YES;
|
||||
}
|
||||
|
||||
if(_isEqual)
|
||||
[response_ appendContentString:@"\" CHECKED"];
|
||||
if(isEqual)
|
||||
[response appendContentString:@"\" CHECKED"];
|
||||
|
||||
if (_disableValue)
|
||||
[response_ appendContentString:@"\" DISABLED"];
|
||||
if (disableValue)
|
||||
[response appendContentString:@"\" DISABLED"];
|
||||
|
||||
[response_ appendContentCharacter:'>'];
|
||||
[response_ appendContentString:_prefixValue];
|
||||
[response_ appendContentHTMLString:_displayStringValue];
|
||||
[response_ appendContentString:_suffixValue];
|
||||
[response appendContentCharacter:'>'];
|
||||
[response appendContentString:prefixValue];
|
||||
[response appendContentHTMLString:displayStringValue];
|
||||
[response appendContentString:suffixValue];
|
||||
};
|
||||
};
|
||||
LOGObjectFnStopC("GSWCheckBoxList");
|
||||
|
@ -347,8 +351,8 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
//====================================================================
|
||||
@implementation GSWCheckBoxList (GSWCheckBoxListB)
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
@ -358,14 +362,14 @@ static char rcsId[] = "$Id$";
|
|||
//====================================================================
|
||||
@implementation GSWCheckBoxList (GSWCheckBoxListC)
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping
|
||||
withMapping:(char*)_mapping
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return NO;
|
||||
};
|
||||
|
||||
-(BOOL)appendStringAtLeft:(id)_unkwnon
|
||||
withMapping:(char*)_mapping
|
||||
withMapping:(char*)_mapping
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return NO;
|
||||
|
|
|
@ -143,6 +143,7 @@
|
|||
- (unsigned)indexOfFirstDisplayedObject;
|
||||
- (unsigned)indexOfLastDisplayedObject;
|
||||
- (id)init;
|
||||
- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver*)unarchiver;
|
||||
- (void)awakeFromKeyValueUnarchiver:(EOKeyValueUnarchiver*)object_;
|
||||
- (NSMutableDictionary *)inputObjectForQualifier;
|
||||
- (BOOL)inQueryMode;
|
||||
|
@ -191,6 +192,7 @@
|
|||
- (void)setFetchesOnLoad:(BOOL)flag;
|
||||
- (void)setInQueryMode:(BOOL)flag;
|
||||
- (void)setInsertedObjectDefaultValues:(NSDictionary *)defaultValues;
|
||||
-(void)setQueryOperator:(NSDictionary*)qo;
|
||||
- (void)setLocalKeys:(NSArray *)keys;
|
||||
- (void)setMasterObject:(id)masterObject;
|
||||
- (void)setNumberOfObjectsPerBatch:(unsigned)count;
|
||||
|
|
|
@ -46,7 +46,9 @@ static char rcsId[] = "$Id$";
|
|||
_queryMatch = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
_queryMin = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
_queryMax = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator);
|
||||
_queryOperator = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator);
|
||||
|
||||
_queryBindings = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
|
||||
|
@ -123,8 +125,9 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
[unarchiver decodeObjectForKey:@"formatForLikeQualifier"]];
|
||||
[self setInsertedObjectDefaultValues:
|
||||
[unarchiver decodeObjectForKey:@"insertedObjectDefaultValues"]];
|
||||
|
||||
[self setQueryOperator:[unarchiver decodeObjectForKey:@"queryOperator"]];
|
||||
[self finishInitialization];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"GSWDisplayGroup %p : %@",self,self);
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
return self;
|
||||
|
@ -159,6 +162,8 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
_defaultStringMatchFormat];
|
||||
_dscr=[_dscr stringByAppendingFormat:@"insertedObjectDefaultValues:[%@]\n",
|
||||
_insertedObjectDefaultValues];
|
||||
_dscr=[_dscr stringByAppendingFormat:@"queryOperator:[%@]\n",
|
||||
_queryOperator];
|
||||
|
||||
return _dscr;
|
||||
};
|
||||
|
@ -269,6 +274,7 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
NSString* fvalue=value;
|
||||
|
||||
//VERIFY!!
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator);
|
||||
op = [_queryOperator objectForKey:key];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"op=%@",op);
|
||||
if(op)
|
||||
|
@ -281,7 +287,7 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
|
||||
if (_defaultStringMatchFormat)
|
||||
fvalue=[NSString stringWithFormat:_defaultStringMatchFormat,
|
||||
value];//VERIFY !!!
|
||||
value];//VERIFY !!!
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"fvalue=%@",fvalue);
|
||||
qualifier=[[[EOKeyValueQualifier alloc]
|
||||
initWithKey:key
|
||||
|
@ -955,11 +961,12 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// hasMultipleBatches
|
||||
/** returns YES if the displayGroup paginates display (batchCount>1), false otherwise **/
|
||||
|
||||
- (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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
/** 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:
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWDynamicElement.h - GSWeb: Class GSWDynamicElement
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWDynamicElement.h - <title>GSWeb: Class GSWDynamicElement</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -33,16 +39,16 @@
|
|||
NSString* _definitionName; // Name of element in def file (.gswd) - Mainly for debugging purpose
|
||||
};
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
template:(GSWElement*)template_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
template:(GSWElement*)template;
|
||||
-(NSString*)definitionName;
|
||||
-(void)setDefinitionName:(NSString*)definitionName;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWDynamicElement (GSWDynamicElement)
|
||||
-(BOOL)evaluateCondition:(id)condition_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(BOOL)evaluateCondition:(id)condition
|
||||
inContext:(GSWContext*)context;
|
||||
@end
|
||||
#endif //_GSWDynamicElement_h__
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWDynamicElement.m - GSWeb: Class GSWDynamicElement
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWDynamicElement.m - <title>GSWeb: Class GSWDynamicElement</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -32,14 +38,14 @@ static char rcsId[] = "$Id$";
|
|||
//--------------------------------------------------------------------
|
||||
// initWithName:associations:template:
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
template:(GSWElement*)template_
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
template:(GSWElement*)template
|
||||
{
|
||||
//OK
|
||||
if ((self=[super init]))
|
||||
{
|
||||
};
|
||||
{
|
||||
};
|
||||
return self;
|
||||
};
|
||||
|
||||
|
@ -62,9 +68,11 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
-(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);
|
||||
NSDebugMLLog(@"gswdync",@"setDefinitionName2 in %p: %p %@",self,_definitionName,_definitionName);
|
||||
NSDebugMLLog(@"gswdync",@"setDefinitionName2 in %p: %p %@",
|
||||
self,_definitionName,_definitionName);
|
||||
};
|
||||
|
||||
@end
|
||||
|
@ -72,30 +80,30 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWDynamicElement (GSWDynamicElement)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(BOOL)evaluateCondition:(id)condition_
|
||||
inContext:(GSWContext*)_context
|
||||
-(BOOL)evaluateCondition:(id)condition
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
BOOL _result=NO;
|
||||
BOOL result=NO;
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdync",@"condition_=%@",
|
||||
condition_);
|
||||
if (condition_)
|
||||
{
|
||||
GSWComponent* _component=[_context component];
|
||||
id _value=[condition_ valueInComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"_value=%@ class=%@",_value,[_value class]);
|
||||
condition);
|
||||
if (condition)
|
||||
{
|
||||
GSWComponent* component=[context component];
|
||||
id value=[condition valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"_value=%@ class=%@",value,[value class]);
|
||||
#ifndef NDEBUG
|
||||
if ([_value respondsToSelector:@selector(unsignedCharValue)])
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"unsignedCharValue=%d",(int)[_value unsignedCharValue]);
|
||||
};
|
||||
if ([value respondsToSelector:@selector(unsignedCharValue)])
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"unsignedCharValue=%d",(int)[value unsignedCharValue]);
|
||||
};
|
||||
#endif
|
||||
_result=boolValueWithDefaultFor(_value,YES);
|
||||
};
|
||||
result=boolValueWithDefaultFor(value,YES);
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"result=%s",
|
||||
(_result ? "YES" : "NO"));
|
||||
(result ? "YES" : "NO"));
|
||||
LOGObjectFnStop();
|
||||
return _result;
|
||||
return result;
|
||||
};
|
||||
@end
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
|
||||
//====================================================================
|
||||
@interface GSWDynamicURLString : NSObject <NSCoding,NSCopying,NSMutableString>
|
||||
@interface GSWDynamicURLString : NSObject <NSCoding,NSCopying/*,NSMutableString*/>
|
||||
{
|
||||
NSMutableString* url;
|
||||
NSString* protocol;//NDFN
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWElement.h - GSWeb: Class GSWElement
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWElement.h - <title>GSWeb: Class GSWElement</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -41,12 +47,12 @@ extern BYTE ElementsMap_attributeElement;
|
|||
#endif
|
||||
|
||||
#ifndef NDEBBUG
|
||||
-(void)saveAppendToResponseElementIDInContext:(id)context_;
|
||||
-(void)assertCorrectElementIDInContext:(id)context_
|
||||
inCLass:(Class)class_
|
||||
method:(SEL)method_
|
||||
file:(const char*)file_
|
||||
line:(int)line_;
|
||||
-(void)saveAppendToResponseElementIDInContext:(id)context;
|
||||
-(void)assertCorrectElementIDInContext:(id)context
|
||||
inCLass:(Class)class
|
||||
method:(SEL)method
|
||||
file:(const char*)file
|
||||
line:(int)line;
|
||||
#endif
|
||||
|
||||
-(NSString*)definitionName; //return nil (for non dynamic element)
|
||||
|
@ -54,25 +60,26 @@ extern BYTE ElementsMap_attributeElement;
|
|||
|
||||
#ifdef NDEBBUG
|
||||
#define GSWSaveAppendToResponseElementID(context_); {};
|
||||
#define GSWAssertCorrectElementID(context_); {};
|
||||
#define GSWAssertCorrectElementID(context_); {};
|
||||
#else
|
||||
#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
|
||||
|
||||
|
||||
//====================================================================
|
||||
@interface GSWElement (GSWRequestHandling)
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(BOOL)prefixMatchSenderIDInContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
-(BOOL)prefixMatchSenderIDInContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
#endif //_GSWElement_h__
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWElement.m - GSWeb: Class GSWElement
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWElement.m - <title>GSWeb: Class GSWElement</title>
|
||||
|
||||
Copyright (C) 1999-2002 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jan 1999
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -34,42 +40,42 @@ BYTE ElementsMap_attributeElement = (BYTE)0x41;
|
|||
@implementation GSWElement
|
||||
|
||||
#ifndef NDEBBUG
|
||||
-(void)saveAppendToResponseElementIDInContext:(id)context_
|
||||
-(void)saveAppendToResponseElementIDInContext:(id)context
|
||||
{
|
||||
NSString* _elementID=[context_ elementID];
|
||||
ASSIGN(_appendToResponseElementID,_elementID);
|
||||
NSString* elementID=[context elementID];
|
||||
ASSIGN(_appendToResponseElementID,elementID);
|
||||
};
|
||||
|
||||
-(void)assertCorrectElementIDInContext:(id)context_
|
||||
inCLass:(Class)class_
|
||||
method:(SEL)method_
|
||||
file:(const char*)file_
|
||||
line:(int)line_
|
||||
-(void)assertCorrectElementIDInContext:(id)context
|
||||
inCLass:(Class)class
|
||||
method:(SEL)method
|
||||
file:(const char*)file
|
||||
line:(int)line
|
||||
{
|
||||
if ([_appendToResponseElementID length]>0)
|
||||
{
|
||||
NSString* _elementID=[context_ elementID];
|
||||
BOOL _appendToResponseElementIDIsFirst=NO;
|
||||
BOOL _elementIDIsFirst=NO;
|
||||
BOOL _OK=YES;
|
||||
_appendToResponseElementIDIsFirst=[_appendToResponseElementID length]==0 || [_appendToResponseElementID isEqualToString:@"0"];
|
||||
_elementIDIsFirst=[_elementID length]==0 || [_elementID isEqualToString:@"0"];
|
||||
if (_appendToResponseElementIDIsFirst!=_elementIDIsFirst)
|
||||
{
|
||||
_OK=[_appendToResponseElementID isEqualToString:_elementID];
|
||||
};
|
||||
if (!_OK)
|
||||
{
|
||||
NSString* _msg=[NSString stringWithFormat:@"In Class %@ (file %s line %d), id %@ in %@ is not the same than in appendToResponse %@",
|
||||
NSStringFromClass(class_),
|
||||
file_,
|
||||
line_,
|
||||
[context_ elementID],
|
||||
NSStringFromSelector(method_),
|
||||
_appendToResponseElementID];
|
||||
NSAssert1(_OK,@"%@",_msg);
|
||||
};
|
||||
};
|
||||
{
|
||||
NSString* elementID=[context elementID];
|
||||
BOOL appendToResponseElementIDIsFirst=NO;
|
||||
BOOL elementIDIsFirst=NO;
|
||||
BOOL OK=YES;
|
||||
appendToResponseElementIDIsFirst=([_appendToResponseElementID length]==0 || [_appendToResponseElementID isEqualToString:@"0"]);
|
||||
elementIDIsFirst=([elementID length]==0 || [elementID isEqualToString:@"0"]);
|
||||
if (appendToResponseElementIDIsFirst!=elementIDIsFirst)
|
||||
{
|
||||
OK=[_appendToResponseElementID isEqualToString:elementID];
|
||||
};
|
||||
if (!OK)
|
||||
{
|
||||
NSString* msg=[NSString stringWithFormat:@"In Class %@ (file %s line %d), id %@ in %@ is not the same than in appendToResponse %@",
|
||||
NSStringFromClass(class),
|
||||
file,
|
||||
line,
|
||||
[context elementID],
|
||||
NSStringFromSelector(method),
|
||||
_appendToResponseElementID];
|
||||
NSAssert1(OK,@"%@",msg);
|
||||
};
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -85,21 +91,22 @@ BYTE ElementsMap_attributeElement = (BYTE)0x41;
|
|||
//--------------------------------------------------------------------
|
||||
// takeValuesFromRequest:inContext:
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
GSWAssertCorrectElementID(context_);// Debug Only
|
||||
GSWAssertCorrectElementID(context);// Debug Only
|
||||
//Does Nothing
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// invokeActionForRequest:inContext:
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@",[self class],[context_ elementID],[context_ senderID]);
|
||||
GSWAssertCorrectElementID(context_);// Debug Only
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@",
|
||||
[self class],[context elementID],[context senderID]);
|
||||
GSWAssertCorrectElementID(context);// Debug Only
|
||||
//Does Nothing
|
||||
return nil;
|
||||
};
|
||||
|
@ -107,22 +114,22 @@ BYTE ElementsMap_attributeElement = (BYTE)0x41;
|
|||
//--------------------------------------------------------------------
|
||||
// appendToResponse:inContext:
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
GSWSaveAppendToResponseElementID(context_);//Debug Only
|
||||
GSWSaveAppendToResponseElementID(context);//Debug Only
|
||||
//Does Nothing
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//NDFN
|
||||
-(BOOL)prefixMatchSenderIDInContext:(GSWContext*)context_
|
||||
-(BOOL)prefixMatchSenderIDInContext:(GSWContext*)context
|
||||
{
|
||||
NSString* _senderID=[context_ senderID];
|
||||
NSString* _elementID=[context_ elementID];
|
||||
NSDebugMLLog(@"gswdync",@"_senderID=%@",_senderID);
|
||||
NSDebugMLLog(@"gswdync",@"_elementID=%@",_elementID);
|
||||
return ([_elementID hasPrefix:_senderID] || [_senderID hasPrefix:_elementID]);
|
||||
NSString* senderID=[context senderID];
|
||||
NSString* elementID=[context elementID];
|
||||
NSDebugMLLog(@"gswdync",@"senderID=%@",senderID);
|
||||
NSDebugMLLog(@"gswdync",@"elementID=%@",elementID);
|
||||
return ([elementID hasPrefix:senderID] || [senderID hasPrefix:elementID]);
|
||||
};
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWElementIDString.h - GSWeb: Class GSWElementIDString
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWElementIDString.h - <title>GSWeb: Class GSWElementIDString</title>
|
||||
|
||||
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
|
||||
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -33,19 +39,19 @@
|
|||
NSMutableString* _string;
|
||||
};
|
||||
|
||||
- (id) init;
|
||||
- (id) initWithCharactersNoCopy: (unichar*)chars
|
||||
length: (unsigned)length
|
||||
freeWhenDone: (BOOL)flag;
|
||||
-(id)init;
|
||||
-(id)initWithCharactersNoCopy:(unichar*)chars
|
||||
length:(unsigned)length
|
||||
freeWhenDone:(BOOL)flag;
|
||||
|
||||
- (id) initWithCStringNoCopy: (char*)byteString
|
||||
length: (unsigned)length
|
||||
freeWhenDone: (BOOL)flag;
|
||||
- (id) initWithCapacity: (unsigned)capacity;
|
||||
- (unsigned) length;
|
||||
- (unichar) characterAtIndex: (unsigned)index;
|
||||
- (void) replaceCharactersInRange: (NSRange)range
|
||||
withString: (NSString*)aString;
|
||||
-(id)initWithCStringNoCopy:(char*)byteString
|
||||
length:(unsigned)length
|
||||
freeWhenDone:(BOOL)flag;
|
||||
-(id)initWithCapacity:(unsigned)capacity;
|
||||
-(unsigned)length;
|
||||
-(unichar)characterAtIndex:(unsigned)index;
|
||||
-(void)replaceCharactersInRange:(NSRange)range
|
||||
withString:(NSString*)aString;
|
||||
-(BOOL)canBeConvertedToEncoding:(NSStringEncoding)encoding;
|
||||
-(void)dealloc;
|
||||
-(void)getCString:(char*)buffer
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWElementIDString.m - GSWeb: Class GSWElementIDString
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWElementIDString.m - <title>GSWeb: Class GSWElementIDString</title>
|
||||
|
||||
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
|
||||
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -300,24 +306,22 @@ static char rcsId[] = "$Id$";
|
|||
{
|
||||
NSArray* ids=nil;
|
||||
LOGObjectFnStart();
|
||||
// NSDebugMLLog(@"low",@"self:%@",self);
|
||||
if ([self length]>0)
|
||||
{
|
||||
ids=[self componentsSeparatedByString:@"."];
|
||||
NSAssert([ids count]>0,@"PROBLEM");
|
||||
if ([ids count]==1)
|
||||
[self setString:@""];
|
||||
else
|
||||
{
|
||||
[self setString:[[ids subarrayWithRange:NSMakeRange(0,[ids count]-1)]
|
||||
componentsJoinedByString:@"."]];
|
||||
};
|
||||
}
|
||||
{
|
||||
ids=[self componentsSeparatedByString:@"."];
|
||||
NSAssert([ids count]>0,@"PROBLEM");
|
||||
if ([ids count]==1)
|
||||
[self setString:@""];
|
||||
else
|
||||
{
|
||||
[self setString:[[ids subarrayWithRange:NSMakeRange(0,[ids count]-1)]
|
||||
componentsJoinedByString:@"."]];
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
ExceptionRaise0(@"GSWElementIDString",@"Can't deleteLastElementIDComponent of an empty ElementID String");
|
||||
};
|
||||
NSDebugMLLog(@"low",@"self:%@",self);
|
||||
{
|
||||
ExceptionRaise0(@"GSWElementIDString",@"Can't deleteLastElementIDComponent of an empty ElementID String");
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
|
@ -326,25 +330,20 @@ static char rcsId[] = "$Id$";
|
|||
{
|
||||
NSArray* ids=nil;
|
||||
LOGObjectFnStart();
|
||||
// NSDebugMLLog(@"low",@"self:%@",self);
|
||||
ids=[self componentsSeparatedByString:@"."];
|
||||
if (ids && [ids count]>0)
|
||||
{
|
||||
NSString* _last=[ids lastObject];
|
||||
NSString* _new=nil;
|
||||
NSDebugMLLog(@"low",@"_last:%@",_last);
|
||||
_last=[NSString stringWithFormat:@"%d",([_last intValue]+1)];
|
||||
NSDebugMLLog(@"low",@"_last:%@",_last);
|
||||
NSDebugMLLog(@"low",@"ids count:%d",[ids count]);
|
||||
if ([ids count]>1)
|
||||
_new=[[[ids subarrayWithRange:NSMakeRange(0,[ids count]-1)]
|
||||
componentsJoinedByString:@"."]
|
||||
stringByAppendingFormat:@".%@",_last];
|
||||
else
|
||||
_new=_last;
|
||||
[self setString:_new];
|
||||
};
|
||||
NSDebugMLLog(@"low",@"self:%@",self);
|
||||
{
|
||||
NSString* _last=[ids lastObject];
|
||||
NSString* _new=nil;
|
||||
_last=[NSString stringWithFormat:@"%d",([_last intValue]+1)];
|
||||
if ([ids count]>1)
|
||||
_new=[[[ids subarrayWithRange:NSMakeRange(0,[ids count]-1)]
|
||||
componentsJoinedByString:@"."]
|
||||
stringByAppendingFormat:@".%@",_last];
|
||||
else
|
||||
_new=_last;
|
||||
[self setString:_new];
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
|
@ -352,12 +351,10 @@ static char rcsId[] = "$Id$";
|
|||
-(void)appendZeroElementIDComponent
|
||||
{
|
||||
LOGObjectFnStart();
|
||||
// NSDebugMLLog(@"low",@"self:%@",self);
|
||||
if ([self length]>0)
|
||||
[self appendString:@".0"];
|
||||
[self appendString:@".0"];
|
||||
else
|
||||
[self setString:@"0"];
|
||||
NSDebugMLLog(@"low",@"self:%@",self);
|
||||
[self setString:@"0"];
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
|
@ -365,13 +362,10 @@ static char rcsId[] = "$Id$";
|
|||
-(void)appendElementIDComponent:(id)_element
|
||||
{
|
||||
LOGObjectFnStart();
|
||||
// NSDebugMLLog(@"low",@"self:%@",self);
|
||||
// NSDebugMLLog(@"low",@"_element:%@",_element);
|
||||
if (self && [self length]>0)
|
||||
[self appendFormat:@".%@",_element];
|
||||
[self appendFormat:@".%@",_element];
|
||||
else
|
||||
[self setString:_element];
|
||||
NSDebugMLLog(@"low",@"self:%@",self);
|
||||
[self setString:_element];
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
|
@ -381,7 +375,7 @@ static char rcsId[] = "$Id$";
|
|||
{
|
||||
GSWElementIDString* _id=[[self copy] autorelease];
|
||||
if ([self length]>0)
|
||||
[_id deleteLastElementIDComponent];
|
||||
[_id deleteLastElementIDComponent];
|
||||
return _id;
|
||||
};
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWFileUpload.h - GSWeb: Class GSWFileUpload
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWFileUpload.h - <title>GSWeb: Class GSWFileUpload</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,13 +35,13 @@
|
|||
//====================================================================
|
||||
@interface GSWFileUpload: GSWInput
|
||||
{
|
||||
GSWAssociation* data;
|
||||
GSWAssociation* filepath;
|
||||
GSWAssociation* _data;
|
||||
GSWAssociation* _filepath;
|
||||
};
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
|
||||
-(void)dealloc;
|
||||
|
||||
|
@ -43,12 +49,12 @@
|
|||
|
||||
//====================================================================
|
||||
@interface GSWFileUpload (GSWFileUploadA)
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
#endif // _GSWFileUpload_h__
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWFileUpload.h - GSWeb: Class GSWFileUpload
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWFileUpload.m - <title>GSWeb: Class GSWFileUpload</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,39 +35,40 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWFileUpload
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_
|
||||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_];
|
||||
NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
|
||||
LOGObjectFnStartC("GSWFileUpload");
|
||||
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_);
|
||||
[_associations setObject:[GSWAssociation associationWithValue:@"file"]
|
||||
forKey:@"type"];
|
||||
[_associations removeObjectForKey:data__Key];
|
||||
[_associations removeObjectForKey:filePath__Key];
|
||||
if ((self=[super initWithName:name_
|
||||
associations:_associations
|
||||
contentElements:nil])) //No Childs!
|
||||
{
|
||||
data = [[associations_ objectForKey:data__Key
|
||||
withDefaultObject:[data autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWFileUpload: data=%@",data);
|
||||
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements_=%@",
|
||||
aName,associations,elements);
|
||||
[tmpAssociations setObject:[GSWAssociation associationWithValue:@"file"]
|
||||
forKey:@"type"];
|
||||
[tmpAssociations removeObjectForKey:data__Key];
|
||||
[tmpAssociations removeObjectForKey:filePath__Key];
|
||||
if ((self=[super initWithName:aName
|
||||
associations:tmpAssociations
|
||||
contentElements:nil])) //No Childs!
|
||||
{
|
||||
_data = [[associations objectForKey:data__Key
|
||||
withDefaultObject:[_data autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWFileUpload: data=%@",_data);
|
||||
|
||||
if (!data || ![data isValueSettable])
|
||||
{
|
||||
//TODO
|
||||
};
|
||||
|
||||
filepath = [[associations_ objectForKey:filePath__Key
|
||||
withDefaultObject:[filepath autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWFileUpload: filepath=%@",filepath);
|
||||
|
||||
if (!filepath || ![filepath isValueSettable])
|
||||
{
|
||||
//TODO
|
||||
};
|
||||
};
|
||||
if (!_data || ![_data isValueSettable])
|
||||
{
|
||||
//TODO
|
||||
};
|
||||
|
||||
_filepath = [[associations objectForKey:filePath__Key
|
||||
withDefaultObject:[_filepath autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWFileUpload: filepath=%@",_filepath);
|
||||
|
||||
if (!_filepath || ![_filepath isValueSettable])
|
||||
{
|
||||
//TODO
|
||||
};
|
||||
};
|
||||
LOGObjectFnStopC("GSWFileUpload");
|
||||
return self;
|
||||
};
|
||||
|
@ -70,8 +77,8 @@ static char rcsId[] = "$Id$";
|
|||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(data);
|
||||
DESTROY(filepath);
|
||||
DESTROY(_data);
|
||||
DESTROY(_filepath);
|
||||
[super dealloc];
|
||||
};
|
||||
|
||||
|
@ -80,126 +87,130 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWFileUpload (GSWFileUploadA)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
[super appendToResponse:response_
|
||||
inContext:context_];
|
||||
[super appendToResponse:response
|
||||
inContext:context];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
GSWAssertCorrectElementID(context_);// Debug Only
|
||||
GSWAssertCorrectElementID(context);// Debug Only
|
||||
//Bypass GSWInput
|
||||
return nil;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
BOOL _disabled=NO;
|
||||
BOOL disabledValue=NO;
|
||||
LOGObjectFnStartC("GSWFileUpload");
|
||||
GSWAssertCorrectElementID(context_);// Debug Only
|
||||
_disabled=[self disabledInContext:context_];
|
||||
if (!_disabled)
|
||||
{
|
||||
BOOL _wasFormSubmitted=[context_ _wasFormSubmitted];
|
||||
if (_wasFormSubmitted)
|
||||
{
|
||||
GSWComponent* _component=nil;
|
||||
NSString* _nameInContext=nil;
|
||||
NSArray* _fileDatas=nil;
|
||||
NSString* fileNameFormValueName=nil;
|
||||
NSString* _fileName=nil;
|
||||
NSData* _data=nil;
|
||||
int _fileDatasCount=0;
|
||||
NS_DURING
|
||||
{
|
||||
_component=[context_ component];
|
||||
_nameInContext=[self nameInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_nameInContext=%@",_nameInContext);
|
||||
_fileDatas=[request_ formValuesForKey:_nameInContext];
|
||||
NSDebugMLLog(@"gswdync",@"_value=%@",_fileDatas);
|
||||
_fileDatasCount=[_fileDatas count];
|
||||
/*
|
||||
if (_fileDatasCount!=1)
|
||||
{
|
||||
ExceptionRaise(@"GSWFileUpload",
|
||||
@"GSWFileUpload: File Data Nb != 1 :%d",
|
||||
_fileDatasCount);
|
||||
};
|
||||
*/
|
||||
if (_fileDatasCount==1) {
|
||||
|
||||
_data=[_fileDatas objectAtIndex:0];
|
||||
NSDebugMLLog(@"gswdync",@"_data (class=%@)=%@",[_data class],_data);
|
||||
if (_data)
|
||||
{
|
||||
if ([_data isKindOfClass:[NSData class]])
|
||||
{
|
||||
if ([_data length]==0)
|
||||
{
|
||||
LOGError(@"Empty Data: %@",_data);
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([_data isKindOfClass:[NSString class]] && [_data length]==0)
|
||||
{
|
||||
LOGError(@"No Data: %@",_data);
|
||||
_data=nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"content type request : %@",[request_ _contentType]);
|
||||
NSLog(@"data class = %@",NSStringFromClass([_data class]));
|
||||
/*if (![_data isMemberOfClass:[NSString class]]) {
|
||||
ExceptionRaise(@"GSWFileUpload",
|
||||
@"GSWFileUpload: bad data :%@",
|
||||
_data);
|
||||
_data=nil;
|
||||
}*/
|
||||
};
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGError0(@"No Data:");
|
||||
};
|
||||
fileNameFormValueName=[NSString stringWithFormat:@"%@.filename",_nameInContext];
|
||||
NSDebugMLLog(@"gswdync",@"fileNameFormValueName=%@",fileNameFormValueName);
|
||||
_fileName=[request_ formValueForKey:fileNameFormValueName];
|
||||
NSDebugMLLog(@"gswdync",@"_fileName=%@",_fileName);
|
||||
if (!_fileName || [_fileName length]==0)
|
||||
{
|
||||
LOGError(@"No fileName: %@",_fileName);
|
||||
};
|
||||
[filepath setValue:_fileName
|
||||
inComponent:_component];
|
||||
[data setValue:_data
|
||||
inComponent:_component];
|
||||
} else {
|
||||
// bug in omniweb-browser if you click cancel in FileOpenPanel, it transmits incorrect datas
|
||||
|
||||
[filepath setValue:nil
|
||||
inComponent:_component];
|
||||
[data setValue:nil
|
||||
inComponent:_component];
|
||||
GSWAssertCorrectElementID(context);// Debug Only
|
||||
disabledValue=[self disabledInContext:context];
|
||||
if (!disabledValue)
|
||||
{
|
||||
BOOL wasFormSubmitted=[context _wasFormSubmitted];
|
||||
if (wasFormSubmitted)
|
||||
{
|
||||
GSWComponent* component=nil;
|
||||
NSString* nameInContext=nil;
|
||||
NSArray* fileDatas=nil;
|
||||
NSString* fileNameFormValueName=nil;
|
||||
NSString* fileNameValue=nil;
|
||||
NSData* dataValue=nil;
|
||||
int fileDatasCount=0;
|
||||
NS_DURING
|
||||
{
|
||||
component=[context component];
|
||||
nameInContext=[self nameInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"nameInContext=%@",nameInContext);
|
||||
fileDatas=[request formValuesForKey:nameInContext];
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",fileDatas);
|
||||
fileDatasCount=[fileDatas count];
|
||||
/*
|
||||
if (_fileDatasCount!=1)
|
||||
{
|
||||
ExceptionRaise(@"GSWFileUpload",
|
||||
@"GSWFileUpload: File Data Nb != 1 :%d",
|
||||
_fileDatasCount);
|
||||
};
|
||||
*/
|
||||
if (fileDatasCount==1)
|
||||
{
|
||||
dataValue=[fileDatas objectAtIndex:0];
|
||||
NSDebugMLLog(@"gswdync",@"dataValue (class=%@)=%@",
|
||||
[dataValue class],dataValue);
|
||||
if (dataValue)
|
||||
{
|
||||
if ([dataValue isKindOfClass:[NSData class]])
|
||||
{
|
||||
if ([dataValue length]==0)
|
||||
{
|
||||
LOGError(@"Empty Data: %@",dataValue);
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([dataValue isKindOfClass:[NSString class]] && [dataValue length]==0)
|
||||
{
|
||||
LOGError(@"No Data: %@",dataValue);
|
||||
dataValue=nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"content type request : %@",[request _contentType]);
|
||||
NSLog(@"data class = %@",NSStringFromClass([dataValue class]));
|
||||
/*if (![dataValue isMemberOfClass:[NSString class]]) {
|
||||
ExceptionRaise(@"GSWFileUpload",
|
||||
@"GSWFileUpload: bad data :%@",
|
||||
dataValue);
|
||||
dataValue=nil;
|
||||
}*/
|
||||
};
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGError0(@"No Data:");
|
||||
};
|
||||
fileNameFormValueName=[NSString stringWithFormat:@"%@.filename",nameInContext];
|
||||
NSDebugMLLog(@"gswdync",@"fileNameFormValueName=%@",fileNameFormValueName);
|
||||
fileNameValue=[request formValueForKey:fileNameFormValueName];
|
||||
NSDebugMLLog(@"gswdync",@"fileNameValue=%@",fileNameValue);
|
||||
if (!fileNameValue || [fileNameValue length]==0)
|
||||
{
|
||||
LOGError(@"No fileName: %@",fileNameValue);
|
||||
};
|
||||
[_filepath setValue:fileNameValue
|
||||
inComponent:component];
|
||||
[_data setValue:dataValue
|
||||
inComponent:component];
|
||||
}
|
||||
else
|
||||
{
|
||||
// bug in omniweb-browser if you click cancel in FileOpenPanel, it transmits incorrect datas
|
||||
|
||||
[_filepath setValue:nil
|
||||
inComponent:component];
|
||||
[_data setValue:nil
|
||||
inComponent:component];
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"GSWFileUpload in takeValuesFromRequest");
|
||||
LOGException(@"%@ (%@)",localException,[localException reason]);
|
||||
[localException raise];
|
||||
};
|
||||
NS_ENDHANDLER;
|
||||
};
|
||||
};
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
|
||||
@"GSWFileUpload in takeValuesFromRequest");
|
||||
LOGException(@"%@ (%@)",localException,[localException reason]);
|
||||
[localException raise];
|
||||
};
|
||||
NS_ENDHANDLER;
|
||||
};
|
||||
};
|
||||
LOGObjectFnStopC("GSWFileUpload");
|
||||
};
|
||||
@end
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWFrame.h - GSWeb: Class GSWFrame
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWFrame.h - <title>GSWeb: Class GSWFrame</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,9 +35,9 @@
|
|||
//====================================================================
|
||||
@interface GSWFrame: GSWHTMLURLValuedElement
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
-(void)dealloc;
|
||||
-(NSString*)valueAttributeName;
|
||||
-(NSString*)urlAttributeName;
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWFrame.m - GSWeb: Class GSWFrame
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWFrame.m - <title>GSWeb: Class GSWFrame</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,16 +35,16 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWFrame
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
NSString* _elementName=[self elementName];
|
||||
if ((self=[super initWithName:_elementName
|
||||
associations:associations_
|
||||
contentElements:nil]))
|
||||
{
|
||||
};
|
||||
NSString* elementName=[self elementName];
|
||||
if ((self=[super initWithName:elementName
|
||||
associations:associations
|
||||
contentElements:nil]))
|
||||
{
|
||||
};
|
||||
return self;
|
||||
};
|
||||
|
||||
|
@ -70,8 +76,8 @@ static char rcsId[] = "$Id$";
|
|||
-(NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%s %p>",
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
/* GSWGenericElement.h - GSWeb: Class GSWGenericElement
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWGenericElement.h - <title>GSWeb: Class GSWGenericElement</title>
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +23,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -30,41 +35,45 @@
|
|||
//====================================================================
|
||||
@interface GSWGenericElement: GSWDynamicElement
|
||||
{
|
||||
GSWAssociation* elementName;
|
||||
GSWAssociation* name;
|
||||
GSWAssociation* omitTags;
|
||||
GSWAssociation* formValue;
|
||||
GSWAssociation* formValues;
|
||||
GSWAssociation* invokeAction;
|
||||
GSWAssociation* elementId;
|
||||
GSWAssociation* otherTagString;
|
||||
NSDictionary* otherAssociations;
|
||||
BOOL hasFormValues;
|
||||
GSWAssociation* _elementName;
|
||||
GSWAssociation* _name;
|
||||
GSWAssociation* _omitTags;
|
||||
GSWAssociation* _formValue;
|
||||
GSWAssociation* _formValues;
|
||||
GSWAssociation* _invokeAction;
|
||||
GSWAssociation* _elementId;
|
||||
GSWAssociation* _otherTagString;
|
||||
NSDictionary* _otherAssociations;
|
||||
BOOL _hasFormValues;
|
||||
};
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
template:(GSWElement*)templateElement_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
template:(GSWElement*)templateElement;
|
||||
|
||||
-(void)dealloc;
|
||||
-(NSString*)description;
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(id)_elementNameAppenedToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)_appendTagWithName:(NSString*)name_
|
||||
toResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)_appendOtherAttributesToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(NSString*)_elementNameInContext:(GSWContext*)context_;
|
||||
-(id)_elementNameAppenedToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)_appendTagWithName:(NSString*)name
|
||||
toResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)_appendOtherAttributesToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(NSString*)_elementNameInContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
#endif //_GSWGenericElement_h__
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWGenericElement.m - GSWeb: Class GSWGenericElement
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWGenericElement.m - <title>GSWeb: Class GSWGenericElement</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -28,9 +34,9 @@ static char rcsId[] = "$Id$";
|
|||
//====================================================================
|
||||
@implementation GSWGenericElement
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
template:(GSWElement*)templateElement_
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
template:(GSWElement*)templateElement
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return nil;
|
||||
|
@ -51,16 +57,16 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return nil;
|
||||
|
@ -68,32 +74,32 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
-(id)_elementNameAppenedToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(id)_elementNameAppenedToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return nil;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)_appendTagWithName:(NSString*)name_
|
||||
toResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)_appendTagWithName:(NSString*)name
|
||||
toResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)_appendOtherAttributesToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)_appendOtherAttributesToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWHTMLStaticElement.h - GSWeb: Class GSWHTMLStaticElement
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWHTMLStaticElement.h - <title>GSWeb: Class GSWHTMLStaticElement</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -30,10 +36,10 @@
|
|||
//====================================================================
|
||||
@interface GSWHTMLStaticElement: GSWElement
|
||||
{
|
||||
NSData* elementsMap;
|
||||
NSArray* htmlBareStrings;
|
||||
NSArray* dynamicChildren;
|
||||
NSString* elementName;
|
||||
NSData* _elementsMap;
|
||||
NSArray* _htmlBareStrings;
|
||||
NSArray* _dynamicChildren;
|
||||
NSString* _elementName;
|
||||
};
|
||||
|
||||
-(NSString*)elementName;
|
||||
|
@ -42,20 +48,20 @@
|
|||
-(NSData*)elementsMap;
|
||||
|
||||
-(id)_initWithElementsMap:(NSData*)_elementsMap
|
||||
htmlBareStrings:(NSArray*)htmlBareStrings
|
||||
dynamicChildren:(NSArray*)dynamicChildren;
|
||||
htmlBareStrings:(NSArray*)htmlBareStrings
|
||||
dynamicChildren:(NSArray*)dynamicChildren;
|
||||
|
||||
-(id) initWithName:(NSString*)elementName_
|
||||
attributeDictionary:(NSDictionary*)_attributeDictionary
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id) initWithName:(NSString*)elementName
|
||||
attributeDictionary:(NSDictionary*)attributeDictionary
|
||||
contentElements:(NSArray*)elements;
|
||||
|
||||
-(id) initWithName:(NSString*)elementName_
|
||||
attributeString:(NSString*)_attributeString
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id) initWithName:(NSString*)elementName
|
||||
attributeString:(NSString*)attributeString
|
||||
contentElements:(NSArray*)elements;
|
||||
|
||||
-(void)dealloc;
|
||||
|
||||
-(void)_setEndOfHTMLTag:(unsigned int)_unknown;
|
||||
-(void)_setEndOfHTMLTag:(unsigned int)unknown;
|
||||
|
||||
-(NSString*)description;
|
||||
|
||||
|
@ -63,28 +69,29 @@
|
|||
|
||||
//====================================================================
|
||||
@interface GSWHTMLStaticElement (GSWHTMLStaticElementA)
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
elementsFromIndex:(unsigned int)_fromIndex
|
||||
toIndex:(unsigned int)_toIndex;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
elementsFromIndex:(unsigned int)fromIndex
|
||||
toIndex:(unsigned int)toIndex;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWHTMLStaticElement (GSWHTMLStaticElementB)
|
||||
-(BOOL)compactHTMLTags;
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping;
|
||||
-(BOOL)appendStringAtLeft:(id)_unkwnon
|
||||
withMapping:(char*)_mapping;
|
||||
-(BOOL)appendStringAtRight:(id)unkwnon
|
||||
withMapping:(char*)mapping;
|
||||
-(BOOL)appendStringAtLeft:(id)unkwnon
|
||||
withMapping:(char*)mapping;
|
||||
-(BOOL)canBeFlattenedAtInitialization;
|
||||
|
||||
@end
|
||||
|
@ -92,30 +99,30 @@
|
|||
//====================================================================
|
||||
@interface GSWHTMLStaticElement (GSWHTMLStaticElementC)
|
||||
+(BOOL)charactersNeedingQuotes;
|
||||
+(void)addURLAttribute:(id)_attribute
|
||||
forElementNamed:(NSString*)_name;
|
||||
+(id)urlsForElementNamed:(NSString*)_name;
|
||||
+(void)addURLAttribute:(id)attribute
|
||||
forElementNamed:(NSString*)name;
|
||||
+(id)urlsForElementNamed:(NSString*)name;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWHTMLStaticElement (GSWHTMLStaticElementD)
|
||||
+(NSDictionary*)attributeDictionaryForString:(NSString*)_string;
|
||||
+(NSString*)stringForAttributeDictionary:(NSDictionary*)_attributeDictionary;
|
||||
+(GSWElement*)elementWithName:(NSString*)_name
|
||||
attributeString:(NSString*)_attributeString
|
||||
contentElements:(NSArray*)elements_;
|
||||
+(NSDictionary*)attributeDictionaryForString:(NSString*)string;
|
||||
+(NSString*)stringForAttributeDictionary:(NSDictionary*)attributeDictionary;
|
||||
+(GSWElement*)elementWithName:(NSString*)name
|
||||
attributeString:(NSString*)attributeString
|
||||
contentElements:(NSArray*)elements;
|
||||
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWHTMLStaticElement (GSWHTMLStaticElementE)
|
||||
+(GSWElement*)elementWithName:(NSString*)_name
|
||||
attributeDictionary:(NSDictionary*)_attributeDictionary
|
||||
contentElements:(NSArray*)elements_;
|
||||
+(GSWElement*)elementWithName:(NSString*)name
|
||||
attributeDictionary:(NSDictionary*)attributeDictionary
|
||||
contentElements:(NSArray*)elements;
|
||||
|
||||
+(Class)_elementClassForName:(NSString*)_name;
|
||||
+(void)setElementClass:(Class)_class
|
||||
forName:(NSString*)_name;
|
||||
+(Class)_elementClassForName:(NSString*)name;
|
||||
+(void)setElementClass:(Class)class
|
||||
forName:(NSString*)name;
|
||||
+(GSWElement*)_theEmptyElement;
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWHTMLStaticElement.m - GSWeb: Class GSWHTMLStaticElement
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWHTMLStaticElement.m - <title>GSWeb: Class GSWHTMLStaticElement</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,197 +35,198 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWHTMLStaticElement
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id) initWithName:(NSString*)_elementName
|
||||
attributeDictionary:(NSDictionary*)attributeAssociations_
|
||||
contentElements:(NSArray*)_elements
|
||||
-(id) initWithName:(NSString*)anElementName
|
||||
attributeDictionary:(NSDictionary*)aAttributeAssociationsList
|
||||
contentElements:(NSArray*)anElementsArray
|
||||
{
|
||||
//OK
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdync",@"_elementName=%@ attributeAssociations_:%@ _elements=%@",
|
||||
_elementName,
|
||||
attributeAssociations_,
|
||||
_elements);
|
||||
NSDebugMLLog(@"gswdync",@"anElementName=%@ aAttributeAssociationsList:%@ anElementsArray=%@",
|
||||
anElementName,
|
||||
aAttributeAssociationsList,
|
||||
anElementsArray);
|
||||
if ((self=[super init]))
|
||||
{
|
||||
NSMutableArray* _attributeAssociationsValues=[NSMutableArray array];
|
||||
NSMutableArray* _htmlBareStrings=[NSMutableArray array];
|
||||
NSMutableData* _elementsMap=[[NSMutableData new]autorelease];
|
||||
ASSIGN(elementName,_elementName);//??
|
||||
{
|
||||
NSMutableArray* attributeAssociationsValues=[NSMutableArray array];
|
||||
NSMutableArray* tmpHtmlBareStrings=[NSMutableArray array];
|
||||
NSMutableData* tmpElementsMap=[[NSMutableData new]autorelease];
|
||||
ASSIGN(_elementName,anElementName);//??
|
||||
if (anElementName)
|
||||
{
|
||||
NSEnumerator* attributesKeyEnum=nil;
|
||||
id key=nil;
|
||||
[tmpHtmlBareStrings addObject:[NSString stringWithFormat:@"<%@",
|
||||
anElementName]];
|
||||
[tmpElementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
length:1];
|
||||
|
||||
if (_elementName)
|
||||
{
|
||||
NSEnumerator* attributesKeyEnum=nil;
|
||||
id _key=nil;
|
||||
[_htmlBareStrings addObject:[NSString stringWithFormat:@"<%@",
|
||||
_elementName]];
|
||||
[_elementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
length:1];
|
||||
|
||||
attributesKeyEnum= [attributeAssociations_ keyEnumerator];
|
||||
NSDebugMLLog(@"gswdync",@"attributesKeyEnum=%@ attributeAssociations_=%@",attributesKeyEnum,attributeAssociations_);
|
||||
while ((_key = [attributesKeyEnum nextObject]))
|
||||
{
|
||||
id _association=[attributeAssociations_ objectForKey:_key];
|
||||
id _associationValue=[_association valueInComponent:nil];
|
||||
NSDebugMLLog(@"gswdync",@"_association=%@ _associationValue=%@",_association,_associationValue);
|
||||
[_htmlBareStrings addObject:[NSString stringWithFormat:@" %@",_key]];
|
||||
[_elementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
length:1];
|
||||
if (_associationValue)
|
||||
{
|
||||
[_htmlBareStrings addObject:[NSString stringWithString:@"="]];
|
||||
[_elementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
length:1];
|
||||
[_htmlBareStrings addObject:[NSString stringWithFormat:@"\"%@\"",_associationValue]];
|
||||
[_elementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
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];
|
||||
};
|
||||
attributesKeyEnum= [aAttributeAssociationsList keyEnumerator];
|
||||
NSDebugMLLog(@"gswdync",@"attributesKeyEnum=%@ aAttributeAssociationsList=%@",
|
||||
attributesKeyEnum,aAttributeAssociationsList);
|
||||
while ((key = [attributesKeyEnum nextObject]))
|
||||
{
|
||||
id association=[aAttributeAssociationsList objectForKey:key];
|
||||
id associationValue=[association valueInComponent:nil];
|
||||
NSDebugMLLog(@"gswdync",@"association=%@ associationValue=%@",
|
||||
association,associationValue);
|
||||
[tmpHtmlBareStrings addObject:[NSString stringWithFormat:@" %@",key]];
|
||||
[tmpElementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
length:1];
|
||||
if (associationValue)
|
||||
{
|
||||
[tmpHtmlBareStrings addObject:[NSString stringWithString:@"="]];
|
||||
[tmpElementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
length:1];
|
||||
[tmpHtmlBareStrings addObject:[NSString stringWithFormat:@"\"%@\"",associationValue]];
|
||||
[tmpElementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
length:1];
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO So what next ?
|
||||
[attributeAssociationsValues addObject:association];
|
||||
[tmpElementsMap appendBytes:&ElementsMap_attributeElement
|
||||
length:1];
|
||||
|
||||
};
|
||||
|
||||
[self _initWithElementsMap:_elementsMap
|
||||
htmlBareStrings:_htmlBareStrings
|
||||
dynamicChildren:_elements];
|
||||
};
|
||||
};
|
||||
[tmpHtmlBareStrings addObject:@">"];
|
||||
[tmpElementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
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();
|
||||
return self;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id) initWithName:(NSString*)_elementName
|
||||
attributeString:(NSString*)_attributeString
|
||||
contentElements:(NSArray*)_elements
|
||||
-(id) initWithName:(NSString*)anElementName
|
||||
attributeString:(NSString*)attributeString
|
||||
contentElements:(NSArray*)anElementsArray
|
||||
{
|
||||
//OK
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdync",@"_elementName=%@ _attributeString:%@ _elements=%@",
|
||||
_elementName,
|
||||
_attributeString,
|
||||
_elements);
|
||||
NSDebugMLLog(@"gswdync",@"anElementName=%@ attributeString:%@ anElementsArray=%@",
|
||||
anElementName,
|
||||
attributeString,
|
||||
anElementsArray);
|
||||
if ((self=[super init]))
|
||||
{
|
||||
NSMutableArray* _htmlBareStrings=[NSMutableArray array];
|
||||
NSMutableData* _elementsMap=[[NSMutableData new]autorelease];
|
||||
ASSIGN(elementName,_elementName);//??
|
||||
{
|
||||
NSMutableArray* tmpHtmlBareStrings=[NSMutableArray array];
|
||||
NSMutableData* tmpElementsMap=[[NSMutableData new]autorelease];
|
||||
ASSIGN(_elementName,anElementName);//??
|
||||
|
||||
if (_elementName)
|
||||
{
|
||||
[_htmlBareStrings addObject:[NSString stringWithFormat:@"<%@",
|
||||
_elementName]];
|
||||
[_elementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
length:1];
|
||||
[_htmlBareStrings addObject:_attributeString];
|
||||
[_elementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
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
|
||||
htmlBareStrings:_htmlBareStrings
|
||||
dynamicChildren:_elements];
|
||||
};
|
||||
if (anElementName)
|
||||
{
|
||||
[tmpHtmlBareStrings addObject:[NSString stringWithFormat:@"<%@",
|
||||
anElementName]];
|
||||
[tmpElementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
length:1];
|
||||
[tmpHtmlBareStrings addObject:attributeString];
|
||||
[tmpElementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
length:1];
|
||||
[tmpHtmlBareStrings addObject:@">"];
|
||||
[tmpElementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
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();
|
||||
return self;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)_initWithElementsMap:(NSData*)_elementsMap
|
||||
htmlBareStrings:(NSArray*)_htmlBareStrings
|
||||
dynamicChildren:(NSArray*)_dynamicChildren
|
||||
-(id)_initWithElementsMap:(NSData*)tmpElementsMap
|
||||
htmlBareStrings:(NSArray*)tmpHtmlBareStrings
|
||||
dynamicChildren:(NSArray*)aDynamicChildrensArray
|
||||
{
|
||||
BOOL _compactHTMLTags=NO;
|
||||
BOOL compactHTMLTags=NO;
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdync",@"_elementsMap=%@ _htmlBareStrings:%@ dynamicChildren=%@",
|
||||
_elementsMap,
|
||||
_htmlBareStrings,
|
||||
_dynamicChildren);
|
||||
_compactHTMLTags=[self compactHTMLTags];
|
||||
NSDebugMLLog(@"gswdync",@"tmpElementsMap=%@ tmpHtmlBareStrings:%@ dynamicChildren=%@",
|
||||
tmpElementsMap,
|
||||
tmpHtmlBareStrings,
|
||||
aDynamicChildrensArray);
|
||||
compactHTMLTags=[self compactHTMLTags];
|
||||
//OK
|
||||
if (_compactHTMLTags)
|
||||
{
|
||||
int elementN=0;
|
||||
while(elementN<[_elementsMap length] && ((BYTE*)[_elementsMap bytes])[elementN]==ElementsMap_htmlBareString)
|
||||
elementN++;
|
||||
[self _setEndOfHTMLTag:elementN];
|
||||
if (elementN>0)
|
||||
{
|
||||
int rmStringN=0;
|
||||
NSMutableArray* rmStrings=[NSMutableArray array];
|
||||
NSMutableString* rmString=[[NSMutableString new] autorelease];
|
||||
NSMutableData* tmpElementsMap=[[NSMutableData new] autorelease];
|
||||
[tmpElementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
length:1];
|
||||
if ([_elementsMap length]>elementN)
|
||||
[tmpElementsMap appendData:
|
||||
[_elementsMap subdataWithRange:
|
||||
NSMakeRange(elementN,
|
||||
[_elementsMap length]-elementN)]];
|
||||
_elementsMap=tmpElementsMap;
|
||||
for(rmStringN=0;rmStringN<elementN;rmStringN++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"rmString=[%@]",rmString);
|
||||
NSDebugMLLog(@"gswdync",@"[_htmlBareStrings objectAtIndex:rmStringN]=[%@]",
|
||||
[_htmlBareStrings objectAtIndex:rmStringN]);
|
||||
[rmString appendString:[_htmlBareStrings objectAtIndex:rmStringN]];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"rmString=[%@]",rmString);
|
||||
NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings);
|
||||
[rmStrings addObject:rmString];
|
||||
NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings);
|
||||
for(rmStringN=elementN;rmStringN<[_htmlBareStrings count];rmStringN++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings);
|
||||
NSDebugMLLog(@"gswdync",@"[_htmlBareStrings objectAtIndex:rmStringN]=[%@]",
|
||||
[_htmlBareStrings objectAtIndex:rmStringN]);
|
||||
[rmStrings addObject:[_htmlBareStrings objectAtIndex:rmStringN]];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings);
|
||||
_htmlBareStrings=rmStrings;
|
||||
};
|
||||
};
|
||||
ASSIGN(htmlBareStrings,_htmlBareStrings);
|
||||
ASSIGN(elementsMap,_elementsMap);
|
||||
ASSIGN(dynamicChildren,_dynamicChildren);
|
||||
if (compactHTMLTags)
|
||||
{
|
||||
int elementN=0;
|
||||
while(elementN<[tmpElementsMap length] && ((BYTE*)[tmpElementsMap bytes])[elementN]==ElementsMap_htmlBareString)
|
||||
elementN++;
|
||||
[self _setEndOfHTMLTag:elementN];
|
||||
if (elementN>0)
|
||||
{
|
||||
int rmStringN=0;
|
||||
NSMutableArray* rmStrings=[NSMutableArray array];
|
||||
NSMutableString* rmString=[[NSMutableString new] autorelease];
|
||||
NSMutableData* tmpElementsMap=[[NSMutableData new] autorelease];
|
||||
[tmpElementsMap appendBytes:&ElementsMap_htmlBareString
|
||||
length:1];
|
||||
if ([tmpElementsMap length]>elementN)
|
||||
[tmpElementsMap appendData:
|
||||
[tmpElementsMap subdataWithRange:
|
||||
NSMakeRange(elementN,
|
||||
[tmpElementsMap length]-elementN)]];
|
||||
tmpElementsMap=tmpElementsMap;
|
||||
for(rmStringN=0;rmStringN<elementN;rmStringN++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"rmString=[%@]",rmString);
|
||||
NSDebugMLLog(@"gswdync",@"[tmpHtmlBareStrings objectAtIndex:rmStringN]=[%@]",
|
||||
[tmpHtmlBareStrings objectAtIndex:rmStringN]);
|
||||
[rmString appendString:[tmpHtmlBareStrings objectAtIndex:rmStringN]];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"rmString=[%@]",rmString);
|
||||
NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings);
|
||||
[rmStrings addObject:rmString];
|
||||
NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings);
|
||||
for(rmStringN=elementN;rmStringN<[tmpHtmlBareStrings count];rmStringN++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings);
|
||||
NSDebugMLLog(@"gswdync",@"[tmpHtmlBareStrings objectAtIndex:rmStringN]=[%@]",
|
||||
[tmpHtmlBareStrings objectAtIndex:rmStringN]);
|
||||
[rmStrings addObject:[tmpHtmlBareStrings objectAtIndex:rmStringN]];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"rmStrings=[%@]",rmStrings);
|
||||
tmpHtmlBareStrings=rmStrings;
|
||||
};
|
||||
};
|
||||
ASSIGN(_htmlBareStrings,tmpHtmlBareStrings);
|
||||
ASSIGN(_elementsMap,tmpElementsMap);
|
||||
ASSIGN(_dynamicChildren,aDynamicChildrensArray);
|
||||
|
||||
LOGObjectFnStop();
|
||||
return self;
|
||||
|
@ -228,39 +235,39 @@ static char rcsId[] = "$Id$";
|
|||
//--------------------------------------------------------------------
|
||||
-(NSString*)elementName
|
||||
{
|
||||
return elementName;
|
||||
return _elementName;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(NSArray*)dynamicChildren
|
||||
{
|
||||
return dynamicChildren;
|
||||
return _dynamicChildren;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(NSArray*)htmlBareStrings
|
||||
{
|
||||
return htmlBareStrings;
|
||||
return _htmlBareStrings;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(NSData*)elementsMap
|
||||
{
|
||||
return elementsMap;
|
||||
return _elementsMap;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(elementsMap);
|
||||
DESTROY(htmlBareStrings);
|
||||
DESTROY(dynamicChildren);
|
||||
DESTROY(elementName);
|
||||
DESTROY(_elementsMap);
|
||||
DESTROY(_htmlBareStrings);
|
||||
DESTROY(_dynamicChildren);
|
||||
DESTROY(_elementName);
|
||||
[super dealloc];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)_setEndOfHTMLTag:(unsigned int)_unknown
|
||||
-(void)_setEndOfHTMLTag:(unsigned int)unknown
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
@ -272,10 +279,10 @@ static char rcsId[] = "$Id$";
|
|||
/* htmlBareStrings:%@ dynamicChildren:%@ elementName:%@>",*/
|
||||
[self class],
|
||||
(void*)self,
|
||||
elementsMap];
|
||||
/* htmlBareStrings,
|
||||
dynamicChildren,
|
||||
elementName];*/
|
||||
_elementsMap];
|
||||
/* _htmlBareStrings,
|
||||
_dynamicChildren,
|
||||
_elementName];*/
|
||||
};
|
||||
|
||||
@end
|
||||
|
@ -284,155 +291,170 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWHTMLStaticElement (GSWHTMLStaticElementA)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK (verifier avec GSWSession appendToR
|
||||
GSWRequest* _request=[context_ request];
|
||||
BOOL _isFromClientComponent=[_request isFromClientComponent]; //bis repetitam
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ self=%p",[self class],[context_ elementID],self);
|
||||
GSWSaveAppendToResponseElementID(context_);//Debug Only
|
||||
if ([elementsMap length]>0)
|
||||
{
|
||||
[self appendToResponse:response_
|
||||
inContext:context_
|
||||
elementsFromIndex:0
|
||||
toIndex:[elementsMap length]-1];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@ self=%p",[self class],[context_ elementID],self);
|
||||
GSWRequest* request=[context request];
|
||||
BOOL isFromClientComponent=[request isFromClientComponent]; //bis repetitam
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ self=%p",
|
||||
[self class],[context elementID],self);
|
||||
GSWSaveAppendToResponseElementID(context);//Debug Only
|
||||
if ([_elementsMap length]>0)
|
||||
{
|
||||
[self appendToResponse:response
|
||||
inContext:context
|
||||
elementsFromIndex:0
|
||||
toIndex:[_elementsMap length]-1];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@ self=%p",
|
||||
[self class],[context elementID],self);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
elementsFromIndex:(unsigned int)_fromIndex
|
||||
toIndex:(unsigned int)_toIndex
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
elementsFromIndex:(unsigned int)fromIndex
|
||||
toIndex:(unsigned int)toIndex
|
||||
{
|
||||
//OK
|
||||
NSStringEncoding _encoding=[response_ contentEncoding];
|
||||
NSArray* _dynamicChildren=[self dynamicChildren];//call dynamicChildren //GSWTextField: nil
|
||||
NSStringEncoding encoding=[response contentEncoding];
|
||||
NSArray* aDynamicChildrensArray=[self dynamicChildren];//call dynamicChildren //GSWTextField: nil
|
||||
int elementN=0;
|
||||
const BYTE* elements=[elementsMap bytes];
|
||||
const BYTE* elements=[_elementsMap bytes];
|
||||
BYTE element=0;
|
||||
int elementsN[3]={0,0,0};
|
||||
NSAssert2(_fromIndex<[elementsMap length],@"_fromIndex out of range:%u (length=%d)",_fromIndex,[elementsMap length]);
|
||||
NSAssert2(_toIndex<[elementsMap length],@"_toIndex out of range:%u (length=%d)",_toIndex,[elementsMap length]);
|
||||
NSAssert2(_fromIndex<=_toIndex,@"_fromIndex>_toIndex %u %u ",_fromIndex,_toIndex);
|
||||
for(elementN=0;elementN<=_toIndex;elementN++)
|
||||
{
|
||||
element=(BYTE)elements[elementN];
|
||||
if (element==ElementsMap_htmlBareString)
|
||||
{
|
||||
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++)
|
||||
NSAssert2(fromIndex<[_elementsMap length],@"fromIndex out of range:%u (length=%d)",
|
||||
fromIndex,[_elementsMap length]);
|
||||
NSAssert2(toIndex<[_elementsMap length],@"toIndex out of range:%u (length=%d)",
|
||||
toIndex,[_elementsMap length]);
|
||||
NSAssert2(fromIndex<=toIndex,@"fromIndex>toIndex %u %u ",
|
||||
fromIndex,toIndex);
|
||||
for(elementN=0;elementN<=toIndex;elementN++)
|
||||
{
|
||||
element=(BYTE)elements[elementN];
|
||||
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)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[[_dynamicChildren objectAtIndex:elementsN[1]] class],[context_ elementID]);
|
||||
_element=[[_dynamicChildren objectAtIndex:elementsN[1]] invokeActionForRequest:request_
|
||||
inContext:context_];
|
||||
// if (![context_ _wasFormSubmitted] && [[context_ elementID] compare:_senderID]==NSOrderedDescending)
|
||||
if (![context_ _wasFormSubmitted] && [[context_ elementID] isSearchOverForSenderID:_senderID])
|
||||
if (elementN>=fromIndex)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"id=%@ senderid=%@ => search is over",
|
||||
[context_ elementID],
|
||||
_senderID);
|
||||
searchIsOver=YES;
|
||||
NSDebugMLLog(@"gswdync",@"%d:dynamicElement : %@",
|
||||
elementN,[aDynamicChildrensArray objectAtIndex:elementsN[1]]);
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",
|
||||
[[aDynamicChildrensArray objectAtIndex:elementsN[1]] class],
|
||||
[context elementID]);
|
||||
[[aDynamicChildrensArray objectAtIndex:elementsN[1]] appendToResponse:response
|
||||
inContext:context];
|
||||
[context incrementLastElementIDComponent];
|
||||
};
|
||||
[context_ incrementLastElementIDComponent];
|
||||
elementsN[1]++;
|
||||
}
|
||||
else if (element==ElementsMap_attributeElement)
|
||||
{
|
||||
//TODO
|
||||
NSDebugMLLog(@"gswdync",@"%d:attributeElement",elementN);
|
||||
elementsN[2]++;
|
||||
};
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]);
|
||||
return _element;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
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
|
||||
int elementN=0;
|
||||
NSArray* _dynamicChildren=[self dynamicChildren];
|
||||
const BYTE* elements=[elementsMap bytes];
|
||||
BYTE element=0;
|
||||
NSArray* aDynamicChildrensArray=[self dynamicChildren];
|
||||
const BYTE* elements=[_elementsMap bytes];
|
||||
BYTE elementIndic=0;
|
||||
int elementsN[3]={0,0,0};
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context_ elementID]);
|
||||
GSWAssertCorrectElementID(context_);// Debug Only
|
||||
for(elementN=0;elementN<[elementsMap length];elementN++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"elementN=%d",elementN);
|
||||
element=(BYTE)elements[elementN];
|
||||
NSDebugMLLog(@"gswdync",@"element=%x",(unsigned int)element);
|
||||
if (element==ElementsMap_htmlBareString)
|
||||
elementsN[0]++;
|
||||
else if (element==ElementsMap_dynamicElement)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"\n[_dynamicChildren objectAtIndex:elementsN[1]=%@",[_dynamicChildren objectAtIndex:elementsN[1]]);
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[[_dynamicChildren objectAtIndex:elementsN[1]] class],[context_ elementID]);
|
||||
[[_dynamicChildren objectAtIndex:elementsN[1]] takeValuesFromRequest:request_
|
||||
inContext:context_];
|
||||
[context_ incrementLastElementIDComponent];
|
||||
elementsN[1]++;
|
||||
}
|
||||
else if (element==ElementsMap_attributeElement)
|
||||
{
|
||||
elementsN[2]++;
|
||||
};
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]);
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",
|
||||
[self class],[context elementID]);
|
||||
GSWAssertCorrectElementID(context);// Debug Only
|
||||
for(elementN=0;elementN<[_elementsMap length];elementN++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"elementN=%d",elementN);
|
||||
elementIndic=(BYTE)elements[elementN];
|
||||
NSDebugMLLog(@"gswdync",@"element=%x",(unsigned int)elementIndic);
|
||||
if (elementIndic==ElementsMap_htmlBareString)
|
||||
elementsN[0]++;
|
||||
else if (elementIndic==ElementsMap_dynamicElement)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"\n[aDynamicChildrensArray objectAtIndex:elementsN[1]=%@",
|
||||
[aDynamicChildrensArray objectAtIndex:elementsN[1]]);
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",
|
||||
[[aDynamicChildrensArray objectAtIndex:elementsN[1]] class],
|
||||
[context elementID]);
|
||||
[[aDynamicChildrensArray objectAtIndex:elementsN[1]] takeValuesFromRequest:request
|
||||
inContext:context];
|
||||
[context incrementLastElementIDComponent];
|
||||
elementsN[1]++;
|
||||
}
|
||||
else if (elementIndic==ElementsMap_attributeElement)
|
||||
{
|
||||
elementsN[2]++;
|
||||
};
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",
|
||||
[self class],[context elementID]);
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
|
@ -449,16 +471,16 @@ static char rcsId[] = "$Id$";
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping
|
||||
-(BOOL)appendStringAtRight:(id)unkwnon
|
||||
withMapping:(char*)mapping
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return NO;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(BOOL)appendStringAtLeft:(id)_unkwnon
|
||||
withMapping:(char*)_mapping
|
||||
-(BOOL)appendStringAtLeft:(id)unkwnon
|
||||
withMapping:(char*)mapping
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return NO;
|
||||
|
@ -484,14 +506,14 @@ static char rcsId[] = "$Id$";
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(void)addURLAttribute:(id)_attribute
|
||||
forElementNamed:(NSString*)_name
|
||||
+(void)addURLAttribute:(id)attribute
|
||||
forElementNamed:(NSString*)name
|
||||
{
|
||||
LOGClassFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(id)urlsForElementNamed:(NSString*)_name
|
||||
+(id)urlsForElementNamed:(NSString*)name
|
||||
{
|
||||
LOGClassFnNotImplemented(); //TODOFN
|
||||
return nil;
|
||||
|
@ -503,23 +525,23 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWHTMLStaticElement (GSWHTMLStaticElementD)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(NSDictionary*)attributeDictionaryForString:(NSString*)string_
|
||||
+(NSDictionary*)attributeDictionaryForString:(NSString*)string
|
||||
{
|
||||
LOGClassFnNotImplemented(); //TODOFN
|
||||
return nil;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(NSString*)stringForAttributeDictionary:(NSDictionary*)attributeDictionary_
|
||||
+(NSString*)stringForAttributeDictionary:(NSDictionary*)attributeDictionary
|
||||
{
|
||||
LOGClassFnNotImplemented(); //TODOFN
|
||||
return nil;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(GSWElement*)elementWithName:(NSString*)name_
|
||||
attributeString:(NSString*)attributeString_
|
||||
contentElements:(NSArray*)elements_
|
||||
+(GSWElement*)elementWithName:(NSString*)name
|
||||
attributeString:(NSString*)attributeString
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
LOGClassFnNotImplemented(); //TODOFN
|
||||
return nil;
|
||||
|
@ -531,22 +553,22 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWHTMLStaticElement (GSWHTMLStaticElementE)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(GSWElement*)elementWithName:(NSString*)name_
|
||||
attributeDictionary:(NSDictionary*)attributeDictionary_
|
||||
contentElements:(NSArray*)elements_
|
||||
+(GSWElement*)elementWithName:(NSString*)name
|
||||
attributeDictionary:(NSDictionary*)attributeDictionary
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
LOGClassFnNotImplemented(); //TODOFN
|
||||
return nil;
|
||||
};
|
||||
|
||||
+(Class)_elementClassForName:(NSString*)name_
|
||||
+(Class)_elementClassForName:(NSString*)name
|
||||
{
|
||||
LOGClassFnNotImplemented(); //TODOFN
|
||||
return nil;
|
||||
};
|
||||
|
||||
+(void)setElementClass:(Class)class_
|
||||
forName:(NSString*)name_
|
||||
+(void)setElementClass:(Class)class
|
||||
forName:(NSString*)name
|
||||
{
|
||||
LOGClassFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWHTMLStaticGroup.h - GSWeb: Class GSWHTMLStaticGroup
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWHTMLStaticGroup.h - <title>GSWeb: Class GSWHTMLStaticGroup</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -31,11 +37,11 @@
|
|||
{
|
||||
NSString* _documentTypeString;
|
||||
}
|
||||
-(id)initWithContentElements:(NSArray*)elements_;
|
||||
-(void)setDocumentTypeString:(NSString *)documentType_;
|
||||
-(id)initWithContentElements:(NSArray*)elements;
|
||||
-(void)setDocumentTypeString:(NSString *)documentType;
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)dealloc;
|
||||
@end
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWHTMLStaticGroup.m - GSWeb: Class GSWHTMLStaticGroup
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWHTMLStaticGroup.m - <title>GSWeb: Class GSWHTMLStaticGroup</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -27,54 +33,49 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
//====================================================================
|
||||
@implementation GSWHTMLStaticGroup
|
||||
-(id)initWithContentElements:(NSArray*)elements_
|
||||
-(id)initWithContentElements:(NSArray*)elements
|
||||
{
|
||||
//OK
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdync",@"elements_:%@",elements_);
|
||||
if ([elements_ count]==1 && [[elements_ objectAtIndex:0] class]==[GSWHTMLStaticGroup class])
|
||||
self=[super initWithName:nil
|
||||
attributeDictionary:nil
|
||||
contentElements:[[elements_ objectAtIndex:0]dynamicChildren]];
|
||||
NSDebugMLLog(@"gswdync",@"elements:%@",elements);
|
||||
if ([elements count]==1 && [[elements objectAtIndex:0] class]==[GSWHTMLStaticGroup class])
|
||||
self=[super initWithName:nil
|
||||
attributeDictionary:nil
|
||||
contentElements:[[elements objectAtIndex:0]dynamicChildren]];
|
||||
else
|
||||
self=[super initWithName:nil
|
||||
attributeDictionary:nil
|
||||
contentElements:elements_];
|
||||
self=[super initWithName:nil
|
||||
attributeDictionary:nil
|
||||
contentElements:elements];
|
||||
LOGObjectFnStop();
|
||||
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
|
||||
{
|
||||
[_documentTypeString release];
|
||||
|
||||
[super dealloc];
|
||||
DESTROY(_documentTypeString);
|
||||
[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
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWHiddenField.h - GSWeb: Class GSWHiddenField
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWHiddenField.h - <title>GSWeb: Class GSWHiddenField</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,9 +35,9 @@
|
|||
//OK
|
||||
//====================================================================
|
||||
@interface GSWHiddenField: GSWInput
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWHiddenField.m - GSWeb: Class GSWHiddenField
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWHiddenField.m - <title>GSWeb: Class GSWHiddenField</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -27,20 +33,21 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
//====================================================================
|
||||
@implementation GSWHiddenField
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_
|
||||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_];
|
||||
NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
|
||||
LOGObjectFnStartC("GSWHiddenField");
|
||||
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,elements_);
|
||||
[_associations setObject:[GSWAssociation associationWithValue:@"hidden"]
|
||||
forKey:@"type"];
|
||||
if ((self=[super initWithName:name_
|
||||
associations:_associations
|
||||
contentElements:nil])) //No Childs!
|
||||
{
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"name=%@ associations:%@ elements=%@",
|
||||
aName,associations,elements);
|
||||
[tmpAssociations setObject:[GSWAssociation associationWithValue:@"hidden"]
|
||||
forKey:@"type"];
|
||||
if ((self=[super initWithName:aName
|
||||
associations:tmpAssociations
|
||||
contentElements:nil])) //No Childs!
|
||||
{
|
||||
};
|
||||
LOGObjectFnStopC("GSWHiddenField");
|
||||
return self;
|
||||
};
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWHyperlink.h - GSWeb: Class GSWHyperlink
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWHyperlink.h - <title>GSWeb: Class GSWHyperlink</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,55 +35,55 @@
|
|||
|
||||
@interface GSWHyperlink: GSWDynamicElement
|
||||
{
|
||||
GSWAssociation* action;
|
||||
GSWAssociation* string;
|
||||
GSWAssociation* pageName;
|
||||
GSWAssociation* href;
|
||||
GSWAssociation* disabled;
|
||||
GSWAssociation* fragmentIdentifier;
|
||||
GSWAssociation* queryDictionary;
|
||||
GSWAssociation* actionClass;
|
||||
GSWAssociation* directActionName;
|
||||
GSWAssociation* _action;
|
||||
GSWAssociation* _string;
|
||||
GSWAssociation* _pageName;
|
||||
GSWAssociation* _href;
|
||||
GSWAssociation* _disabled;
|
||||
GSWAssociation* _fragmentIdentifier;
|
||||
GSWAssociation* _queryDictionary;
|
||||
GSWAssociation* _actionClass;
|
||||
GSWAssociation* _directActionName;
|
||||
//GSWeb Additions {
|
||||
GSWAssociation* enabled;
|
||||
GSWAssociation* displayDisabled;
|
||||
GSWAssociation* redirectURL;
|
||||
NSDictionary* pageSetVarAssociations;
|
||||
GSWAssociation* pageSetVarAssociationsDynamic;
|
||||
GSWAssociation* _enabled;
|
||||
GSWAssociation* _displayDisabled;
|
||||
GSWAssociation* _redirectURL;
|
||||
NSDictionary* _pageSetVarAssociations;
|
||||
GSWAssociation* _pageSetVarAssociationsDynamic;
|
||||
// }
|
||||
NSDictionary* otherQueryAssociations;
|
||||
NSDictionary* otherAssociations;
|
||||
NSDictionary* _otherQueryAssociations;
|
||||
NSDictionary* _otherAssociations;
|
||||
|
||||
//GSWeb Additions {
|
||||
GSWAssociation* filename;
|
||||
GSWAssociation* framework;
|
||||
GSWAssociation* data;
|
||||
GSWAssociation* mimeType;
|
||||
GSWAssociation* key;
|
||||
GSWAssociation* _filename;
|
||||
GSWAssociation* _framework;
|
||||
GSWAssociation* _data;
|
||||
GSWAssociation* _mimeType;
|
||||
GSWAssociation* _key;
|
||||
// }
|
||||
GSWElement* children;
|
||||
GSWElement* _children;
|
||||
};
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
template:(GSWElement*)templateElement_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
template:(GSWElement*)templateElement;
|
||||
-(void)dealloc;
|
||||
-(NSString*)description;
|
||||
@end
|
||||
|
||||
@interface GSWHyperlink (GSWHyperlinkA)
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
#if !GSWEB_STRICT
|
||||
-(NSString*)frameworkNameInContext:(GSWContext*)context_;
|
||||
-(NSString*)frameworkNameInContext:(GSWContext*)context;
|
||||
#endif
|
||||
-(void)_appendCGIActionURLToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(id)computeActionStringInContext:(GSWContext*)context_;
|
||||
-(void)_appendQueryStringToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(NSDictionary*)computeQueryDictionaryInContext:(GSWContext*)context_;
|
||||
-(NSString*)hrefInContext:(GSWContext*)context_; //NDFN
|
||||
-(void)_appendCGIActionURLToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
-(id)computeActionStringInContext:(GSWContext*)context;
|
||||
-(void)_appendQueryStringToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
-(NSDictionary*)computeQueryDictionaryInContext:(GSWContext*)context;
|
||||
-(NSString*)hrefInContext:(GSWContext*)context; //NDFN
|
||||
|
||||
@end
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,11 +1,16 @@
|
|||
/* GSWImage.h - GSWeb: Class GSWImage
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWImage.h - <title>GSWeb: Class GSWImage</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,9 +35,9 @@
|
|||
|
||||
@interface GSWImage: GSWHTMLURLValuedElement
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
-(void)dealloc;
|
||||
-(NSString*)valueAttributeName;
|
||||
-(NSString*)urlAttributeName;
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWImage.m - GSWeb: Class GSWImage
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWImage.m - <title>GSWeb: Class GSWImage</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,15 +35,15 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWImage
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
if ((self=[super initWithName:name_
|
||||
associations:associations_
|
||||
contentElements:elements_]))
|
||||
{
|
||||
};
|
||||
if ((self=[super initWithName:name
|
||||
associations:associations
|
||||
contentElements:elements]))
|
||||
{
|
||||
};
|
||||
return self;
|
||||
};
|
||||
|
||||
|
@ -69,8 +75,8 @@ static char rcsId[] = "$Id$";
|
|||
-(NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%s %p>",
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWImageButton.h - GSWeb: Class GSWImageButton
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWImageButton.h - <title>GSWeb: Class GSWImageButton</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -30,62 +36,68 @@
|
|||
//====================================================================
|
||||
@interface GSWImageButton: GSWInput
|
||||
{
|
||||
GSWAssociation* imageMapFileName;
|
||||
GSWAssociation* _imageMapFileName;
|
||||
//GSWeb Additions {
|
||||
GSWAssociation* imageMapString;
|
||||
GSWAssociation* imageMapRegions;
|
||||
GSWAssociation* _imageMapString;
|
||||
GSWAssociation* _imageMapRegions;
|
||||
// }
|
||||
GSWAssociation* action;
|
||||
GSWAssociation* actionClass;
|
||||
GSWAssociation* directActionName;
|
||||
GSWAssociation* xAssoc;
|
||||
GSWAssociation* yAssoc;
|
||||
GSWAssociation* filename;
|
||||
GSWAssociation* framework;
|
||||
GSWAssociation* src;
|
||||
GSWAssociation* data;
|
||||
GSWAssociation* mimeType;
|
||||
GSWAssociation* key;
|
||||
GSWAssociation* _action;
|
||||
GSWAssociation* _actionClass;
|
||||
GSWAssociation* _directActionName;
|
||||
GSWAssociation* _xAssoc;
|
||||
GSWAssociation* _yAssoc;
|
||||
GSWAssociation* _filename;
|
||||
GSWAssociation* _framework;
|
||||
GSWAssociation* _src;
|
||||
GSWAssociation* _data;
|
||||
GSWAssociation* _mimeType;
|
||||
GSWAssociation* _key;
|
||||
};
|
||||
|
||||
-(void)dealloc;
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
-(NSString*)description;
|
||||
-(NSString*)elementName;
|
||||
|
||||
@end
|
||||
//====================================================================
|
||||
@interface GSWImageButton (GSWImageButtonA)
|
||||
-(GSWAssociation*)hitTestX:(int)x_
|
||||
y:(int)y_
|
||||
inRegions:(NSArray*)regions_;
|
||||
-(GSWAssociation*)hitTestX:(int)x
|
||||
y:(int)y
|
||||
inRegions:(NSArray*)regions;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWImageButton (GSWImageButtonB)
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(id)_imageURLInContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)_appendDirectActionToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(NSString*)frameworkNameInContext:(GSWContext*)context_;
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(id)_imageURLInContext:(GSWContext*)context;
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)_appendDirectActionToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(NSString*)frameworkNameInContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWImageButton (GSWImageButtonC)
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping;
|
||||
-(BOOL)appendStringAtLeft:(id)_unkwnon
|
||||
withMapping:(char*)_mapping;
|
||||
-(BOOL)appendStringAtRight:(id)unkwnon
|
||||
withMapping:(char*)mapping;
|
||||
-(BOOL)appendStringAtLeft:(id)unkwnon
|
||||
withMapping:(char*)mapping;
|
||||
@end
|
||||
|
||||
#endif //_GSWImageButton_h__
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,11 +1,16 @@
|
|||
/* GSWInput.h - GSWeb: Class GSWInput
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWInput.h - <title>GSWeb: Class GSWInput</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -30,23 +36,23 @@
|
|||
//====================================================================
|
||||
@interface GSWInput: GSWHTMLDynamicElement
|
||||
{
|
||||
GSWAssociation* disabled;
|
||||
GSWAssociation* _disabled;
|
||||
//GSWeb Additions {
|
||||
GSWAssociation* enabled;
|
||||
GSWAssociation* _enabled;
|
||||
//}
|
||||
GSWAssociation* name;
|
||||
GSWAssociation* value;
|
||||
GSWAssociation* _name;
|
||||
GSWAssociation* _value;
|
||||
//GSWeb Additions {
|
||||
GSWAssociation* handleValidationException;
|
||||
GSWAssociation* _handleValidationException;
|
||||
// }
|
||||
//GSWeb Additions {
|
||||
GSWAssociation* tcEscapeHTML;
|
||||
GSWAssociation* _tcEscapeHTML;
|
||||
// }
|
||||
};
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
-(void)dealloc;
|
||||
-(NSString*)elementName;
|
||||
|
||||
|
@ -54,27 +60,27 @@
|
|||
|
||||
//====================================================================
|
||||
@interface GSWInput (GSWInputA)
|
||||
-(NSString*)nameInContext:(GSWContext*)context_;
|
||||
-(NSString*)valueInContext:(GSWContext*)context_;
|
||||
-(NSString*)nameInContext:(GSWContext*)context;
|
||||
-(NSString*)valueInContext:(GSWContext*)context;
|
||||
-(void)resetAutoValue;
|
||||
-(BOOL)disabledInContext:(GSWContext*)context_;
|
||||
-(BOOL)disabledInContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWInput (GSWInputB)
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWInput (GSWInputC)
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendValueToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendNameToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
-(void)appendValueToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
-(void)appendNameToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -87,8 +93,8 @@
|
|||
@interface GSWInput (GSWInputE)
|
||||
|
||||
#if !GSWEB_STRICT
|
||||
-(void)handleValidationException:(NSException*)exception_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)handleValidationException:(NSException*)exception
|
||||
inContext:(GSWContext*)context;
|
||||
#endif
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWInput.m - GSWeb: Class GSWInput
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWInput.m - <title>GSWeb: Class GSWInput</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,56 +35,57 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWInput
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_
|
||||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
NSMutableDictionary* _attributedAssociations=[[associations_ mutableCopy] autorelease];
|
||||
NSMutableDictionary* attributedAssociations=[[associations mutableCopy] autorelease];
|
||||
LOGObjectFnStartC("GSWInput");
|
||||
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_);
|
||||
[_attributedAssociations removeObjectForKey:disabled__Key];
|
||||
[_attributedAssociations removeObjectForKey:enabled__Key];//??
|
||||
[_attributedAssociations removeObjectForKey:value__Key];//??
|
||||
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",aName,associations,elements);
|
||||
[attributedAssociations removeObjectForKey:disabled__Key];
|
||||
[attributedAssociations removeObjectForKey:enabled__Key];//??
|
||||
[attributedAssociations removeObjectForKey:value__Key];//??
|
||||
if (!WOStrictFlag)
|
||||
[_attributedAssociations removeObjectForKey:handleValidationException__Key];
|
||||
value = [[associations_ objectForKey:value__Key
|
||||
withDefaultObject:[value autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWInput: value=%@",value);
|
||||
if ((self=[super initWithName:name_
|
||||
attributeAssociations:_attributedAssociations
|
||||
contentElements:elements_]))
|
||||
{
|
||||
disabled = [[associations_ objectForKey:disabled__Key
|
||||
withDefaultObject:[disabled autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWInput: disabled=%@",disabled);
|
||||
if (!WOStrictFlag)
|
||||
[attributedAssociations removeObjectForKey:handleValidationException__Key];
|
||||
_value = [[associations objectForKey:value__Key
|
||||
withDefaultObject:[_value autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWInput: value=%@",_value);
|
||||
if ((self=[super initWithName:aName
|
||||
attributeAssociations:attributedAssociations
|
||||
contentElements:elements]))
|
||||
{
|
||||
_disabled = [[associations objectForKey:disabled__Key
|
||||
withDefaultObject:[_disabled autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWInput: disabled=%@",_disabled);
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
_enabled = [[associations objectForKey:enabled__Key
|
||||
withDefaultObject:[_enabled autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWInput: enabled=%@",_enabled);
|
||||
if (_disabled && _enabled)
|
||||
{
|
||||
enabled = [[associations_ objectForKey:enabled__Key
|
||||
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.");
|
||||
};
|
||||
ExceptionRaise0(@"GSWInput",@"You can't use 'diabled' and 'enabled' parameters at the same time.");
|
||||
};
|
||||
name = [[associations_ objectForKey:name__Key
|
||||
withDefaultObject:[name autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWInput: name=%@",name);
|
||||
|
||||
if (!WOStrictFlag)
|
||||
};
|
||||
_name = [[associations objectForKey:name__Key
|
||||
withDefaultObject:[_name autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWInput: name=%@",_name);
|
||||
|
||||
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
|
||||
withDefaultObject:[handleValidationException autorelease]] 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];
|
||||
};
|
||||
_tcEscapeHTML = [[associations objectForKey:escapeHTML__Key
|
||||
withDefaultObject:nil] retain];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
LOGObjectFnStopC("GSWInput");
|
||||
return self;
|
||||
};
|
||||
|
@ -86,12 +93,12 @@ static char rcsId[] = "$Id$";
|
|||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(disabled);
|
||||
DESTROY(enabled);//GSWeb Only
|
||||
DESTROY(name);
|
||||
DESTROY(value);
|
||||
DESTROY(handleValidationException);//GSWeb Only
|
||||
DESTROY(tcEscapeHTML);//GSWeb Only
|
||||
DESTROY(_disabled);
|
||||
DESTROY(_enabled);//GSWeb Only
|
||||
DESTROY(_name);
|
||||
DESTROY(_value);
|
||||
DESTROY(_handleValidationException);//GSWeb Only
|
||||
DESTROY(_tcEscapeHTML);//GSWeb Only
|
||||
[super dealloc];
|
||||
};
|
||||
|
||||
|
@ -107,49 +114,49 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWInput (GSWInputA)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(NSString*)nameInContext:(GSWContext*)_context
|
||||
-(NSString*)nameInContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
GSWComponent* _component=nil;
|
||||
NSString* _name=nil;
|
||||
GSWComponent* component=nil;
|
||||
NSString* nameValue=nil;
|
||||
LOGObjectFnStartC("GSWInput");
|
||||
if (name)
|
||||
{
|
||||
_component=[_context component];
|
||||
_name=[name valueInComponent:_component];
|
||||
}
|
||||
if (_name)
|
||||
{
|
||||
component=[context component];
|
||||
nameValue=[_name valueInComponent:component];
|
||||
}
|
||||
else
|
||||
{
|
||||
_name=[_context elementID];
|
||||
NSDebugMLLog(@"gswdync",@"_elementID=%@",[_context elementID]);
|
||||
};
|
||||
{
|
||||
nameValue=[context elementID];
|
||||
NSDebugMLLog(@"gswdync",@"elementID=%@",[context elementID]);
|
||||
};
|
||||
LOGObjectFnStopC("GSWInput");
|
||||
return _name;
|
||||
return nameValue;
|
||||
};
|
||||
|
||||
static int countAutoValue = 0;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
- (NSString *)valueInContext:(GSWContext *)_context
|
||||
-(NSString*)valueInContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
GSWComponent *_component=nil;
|
||||
NSString *_value=nil;
|
||||
GSWComponent *component=nil;
|
||||
NSString *valueValue=nil;
|
||||
|
||||
LOGObjectFnStartC("GSWInput");
|
||||
countAutoValue++;
|
||||
if(value)
|
||||
if(_value)
|
||||
{
|
||||
_component=[_context component];
|
||||
_value=[value valueInComponent:_component];
|
||||
component=[context component];
|
||||
valueValue=[_value valueInComponent:component];
|
||||
}
|
||||
else
|
||||
{
|
||||
_value=[NSString stringWithFormat:@"%@.%d", [_context elementID], countAutoValue];
|
||||
NSDebugMLLog(@"gswdync",@"_elementID=%@ _countAutoValue",[_context elementID], countAutoValue);
|
||||
valueValue=[NSString stringWithFormat:@"%@.%d", [context elementID], countAutoValue];
|
||||
NSDebugMLLog(@"gswdync",@"elementID=%@ _countAutoValue",[context elementID], countAutoValue);
|
||||
}
|
||||
LOGObjectFnStopC("GSWInput");
|
||||
return _value;
|
||||
return valueValue;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -163,15 +170,15 @@ static int countAutoValue = 0;
|
|||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(BOOL)disabledInContext:(GSWContext*)_context
|
||||
-(BOOL)disabledInContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
if (!WOStrictFlag && enabled)
|
||||
return ![self evaluateCondition:enabled
|
||||
inContext:_context];
|
||||
if (!WOStrictFlag && _enabled)
|
||||
return ![self evaluateCondition:_enabled
|
||||
inContext:context];
|
||||
else
|
||||
return [self evaluateCondition:disabled
|
||||
inContext:_context];
|
||||
return [self evaluateCondition:_disabled
|
||||
inContext:context];
|
||||
};
|
||||
|
||||
@end
|
||||
|
@ -180,44 +187,43 @@ static int countAutoValue = 0;
|
|||
@implementation GSWInput (GSWInputB)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
BOOL _disabledInContext=NO;
|
||||
BOOL disabledInContext=NO;
|
||||
LOGObjectFnStartC("GSWInput");
|
||||
GSWAssertCorrectElementID(context_);// Debug Only
|
||||
_disabledInContext=[self disabledInContext:context_]; //return 0
|
||||
if (!_disabledInContext)
|
||||
{
|
||||
BOOL _wasFormSubmitted=[context_ _wasFormSubmitted];
|
||||
if (_wasFormSubmitted)
|
||||
{
|
||||
GSWComponent* _component=[context_ component];
|
||||
NSString* _nameInContext=[self nameInContext:context_];
|
||||
NSString* _value=[request_ formValueForKey:_nameInContext];
|
||||
NSDebugMLLog(@"gswdync",@"_nameInContext=%@",_nameInContext);
|
||||
NSDebugMLLog(@"gswdync",@"_value=%@",_value);
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[value setValue:_value
|
||||
inComponent:_component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
[value setValue:_value
|
||||
inComponent:_component];
|
||||
};
|
||||
|
||||
};
|
||||
GSWAssertCorrectElementID(context);// Debug Only
|
||||
disabledInContext=[self disabledInContext:context]; //return 0
|
||||
if (!disabledInContext)
|
||||
{
|
||||
BOOL wasFormSubmitted=[context _wasFormSubmitted];
|
||||
if (wasFormSubmitted)
|
||||
{
|
||||
GSWComponent* component=[context component];
|
||||
NSString* nameInContext=[self nameInContext:context];
|
||||
NSString* value=[request formValueForKey:nameInContext];
|
||||
NSDebugMLLog(@"gswdync",@"nameInContext=%@",nameInContext);
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",value);
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[value setValue:value
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
[value setValue:value
|
||||
inComponent:component];
|
||||
};
|
||||
};
|
||||
LOGObjectFnStopC("GSWInput");
|
||||
};
|
||||
|
||||
|
@ -227,73 +233,74 @@ static int countAutoValue = 0;
|
|||
@implementation GSWInput (GSWInputC)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
BOOL _disabledInContext=NO;
|
||||
BOOL disabledInContext=NO;
|
||||
LOGObjectFnStartC("GSWInput");
|
||||
_disabledInContext=[self disabledInContext:context_]; //return 0
|
||||
if (_disabledInContext)
|
||||
[response_ _appendContentAsciiString:@" disabled"];
|
||||
[self appendValueToResponse:response_
|
||||
inContext:context_];
|
||||
[self appendNameToResponse:response_
|
||||
inContext:context_];
|
||||
disabledInContext=[self disabledInContext:context]; //return 0
|
||||
if (disabledInContext)
|
||||
[response _appendContentAsciiString:@" disabled"];
|
||||
[self appendValueToResponse:response
|
||||
inContext:context];
|
||||
[self appendNameToResponse:response
|
||||
inContext:context];
|
||||
LOGObjectFnStopC("GSWInput");
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendValueToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendValueToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
GSWComponent* _component=nil;
|
||||
GSWComponent* component=nil;
|
||||
LOGObjectFnStartC("GSWInput");
|
||||
GSWSaveAppendToResponseElementID(context_);//Debug Only
|
||||
_component=[context_ component];
|
||||
if (value)
|
||||
{
|
||||
id _value=[value valueInComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"_value=%@",_value);
|
||||
if (_value)
|
||||
{
|
||||
[response_ appendContentCharacter:' '];
|
||||
[response_ _appendContentAsciiString:@"value"];
|
||||
[response_ appendContentCharacter:'='];
|
||||
[response_ appendContentCharacter:'"'];
|
||||
if (tcEscapeHTML && [self evaluateCondition:tcEscapeHTML inContext:context_] == NO)
|
||||
{
|
||||
[response_ appendContentString:_value];
|
||||
}
|
||||
else
|
||||
{
|
||||
[response_ appendContentHTMLAttributeValue:_value];
|
||||
};
|
||||
[response_ appendContentCharacter:'"'];
|
||||
};
|
||||
};
|
||||
GSWSaveAppendToResponseElementID(context);//Debug Only
|
||||
component=[context component];
|
||||
if (_value)
|
||||
{
|
||||
id valueValue=[_value valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
if (valueValue)
|
||||
{
|
||||
[response appendContentCharacter:' '];
|
||||
[response _appendContentAsciiString:@"value"];
|
||||
[response appendContentCharacter:'='];
|
||||
[response appendContentCharacter:'"'];
|
||||
if (_tcEscapeHTML && [self evaluateCondition:_tcEscapeHTML
|
||||
inContext:context] == NO)
|
||||
{
|
||||
[response appendContentString:valueValue];
|
||||
}
|
||||
else
|
||||
{
|
||||
[response appendContentHTMLAttributeValue:valueValue];
|
||||
};
|
||||
[response appendContentCharacter:'"'];
|
||||
};
|
||||
};
|
||||
LOGObjectFnStopC("GSWInput");
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendNameToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendNameToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
NSString* _name=nil;
|
||||
NSString* name=nil;
|
||||
LOGObjectFnStartC("GSWInput");
|
||||
_name=[self nameInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_name=%@",_name);
|
||||
if (_name)
|
||||
{
|
||||
[response_ appendContentCharacter:' '];
|
||||
[response_ _appendContentAsciiString:@"name"];
|
||||
[response_ appendContentCharacter:'='];
|
||||
[response_ appendContentCharacter:'"'];
|
||||
[response_ appendContentHTMLAttributeValue:_name];
|
||||
[response_ appendContentCharacter:'"'];
|
||||
};
|
||||
name=[self nameInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"name=%@",name);
|
||||
if (name)
|
||||
{
|
||||
[response appendContentCharacter:' '];
|
||||
[response _appendContentAsciiString:@"name"];
|
||||
[response appendContentCharacter:'='];
|
||||
[response appendContentCharacter:'"'];
|
||||
[response appendContentHTMLAttributeValue:name];
|
||||
[response appendContentCharacter:'"'];
|
||||
};
|
||||
LOGObjectFnStopC("GSWInput");
|
||||
};
|
||||
|
||||
|
@ -314,60 +321,60 @@ static int countAutoValue = 0;
|
|||
@implementation GSWInput (GSWInputE)
|
||||
|
||||
//GSWeb additions {
|
||||
-(void)handleValidationException:(NSException*)exception_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)handleValidationException:(NSException*)exception
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
BOOL _isValidationException=[exception_ isValidationException];
|
||||
BOOL _raise=YES;
|
||||
BOOL isValidationException=[exception isValidationException];
|
||||
BOOL raise=YES;
|
||||
LOGObjectFnStartC("GSWInput");
|
||||
if (_isValidationException)
|
||||
{
|
||||
GSWComponent* _component=[context_ component];
|
||||
id _handleValidationException=[handleValidationException valueInComponent:_component];
|
||||
BOOL _handle=NO;
|
||||
if (!_handleValidationException)
|
||||
{
|
||||
_handleValidationException = [_component handleValidationExceptionDefault];
|
||||
};
|
||||
if (_handleValidationException)
|
||||
{
|
||||
if ([_handleValidationException isEqualToString:@"handleAndRaise"])
|
||||
{
|
||||
_handle=YES;
|
||||
_raise=YES;
|
||||
}
|
||||
else if ([_handleValidationException isEqualToString:@"handle"])
|
||||
{
|
||||
_handle=YES;
|
||||
_raise=NO;
|
||||
}
|
||||
else if ([_handleValidationException isEqualToString:@"raise"])
|
||||
{
|
||||
_handle=NO;
|
||||
_raise=YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLog(@"Unknown case for handleValidationException %@",_handleValidationException);
|
||||
};
|
||||
};
|
||||
if (_handle)
|
||||
{
|
||||
NSDebugMLog(@"Handled validation exception %@",exception_);
|
||||
[_component setValidationFailureMessage:[[exception_ userInfo]objectForKey:@"message"]
|
||||
forElement:self];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLog(@"Unhandled validation exception %@",exception_);
|
||||
};
|
||||
};
|
||||
if (_raise)
|
||||
{
|
||||
NSDebugMLog(@"Raise exception %@",exception_);
|
||||
exception_=ExceptionByAddingUserInfoObjectFrameInfo0(exception_,@"handleValidationException:inContext");
|
||||
[exception_ raise];
|
||||
};
|
||||
if (isValidationException)
|
||||
{
|
||||
GSWComponent* component=[context component];
|
||||
id handleValidationException=[handleValidationException valueInComponent:component];
|
||||
BOOL handle=NO;
|
||||
if (!handleValidationException)
|
||||
{
|
||||
handleValidationException = [component handleValidationExceptionDefault];
|
||||
};
|
||||
if (handleValidationException)
|
||||
{
|
||||
if ([handleValidationException isEqualToString:@"handleAndRaise"])
|
||||
{
|
||||
handle=YES;
|
||||
raise=YES;
|
||||
}
|
||||
else if ([handleValidationException isEqualToString:@"handle"])
|
||||
{
|
||||
handle=YES;
|
||||
raise=NO;
|
||||
}
|
||||
else if ([handleValidationException isEqualToString:@"raise"])
|
||||
{
|
||||
handle=NO;
|
||||
raise=YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLog(@"Unknown case for handleValidationException %@",handleValidationException);
|
||||
};
|
||||
};
|
||||
if (handle)
|
||||
{
|
||||
NSDebugMLog(@"Handled validation exception %@",exception);
|
||||
[component setValidationFailureMessage:[[exception userInfo]objectForKey:@"message"]
|
||||
forElement:self];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLog(@"Unhandled validation exception %@",exception);
|
||||
};
|
||||
};
|
||||
if (raise)
|
||||
{
|
||||
NSDebugMLog(@"Raise exception %@",exception);
|
||||
exception=ExceptionByAddingUserInfoObjectFrameInfo0(exception,@"handleValidationException:inContext");
|
||||
[exception raise];
|
||||
};
|
||||
LOGObjectFnStopC("GSWInput");
|
||||
};
|
||||
// }
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWPasswordField.h - GSWeb: Class GSWPasswordField
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWPasswordField.h - <title>GSWeb: Class GSWPasswordField</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,9 +35,9 @@
|
|||
//OK
|
||||
//====================================================================
|
||||
@interface GSWPasswordField: GSWInput
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWPasswordField.m - GSWeb: Class GSWPasswordField
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWPasswordField.m - <title>GSWeb: Class GSWPasswordField</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -27,20 +33,21 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
//====================================================================
|
||||
@implementation GSWPasswordField
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_
|
||||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_];
|
||||
NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
|
||||
LOGObjectFnStartC("GSWPasswordField");
|
||||
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,elements_);
|
||||
[_associations setObject:[GSWAssociation associationWithValue:@"password"]
|
||||
forKey:@"type"];
|
||||
if ((self=[super initWithName:name_
|
||||
associations:_associations
|
||||
contentElements:nil])) //No Childs!
|
||||
{
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",
|
||||
aName,associations,elements);
|
||||
[tmpAssociations setObject:[GSWAssociation associationWithValue:@"password"]
|
||||
forKey:@"type"];
|
||||
if ((self=[super initWithName:aName
|
||||
associations:tmpAssociations
|
||||
contentElements:nil])) //No Childs!
|
||||
{
|
||||
};
|
||||
LOGObjectFnStopC("GSWPasswordField");
|
||||
return self;
|
||||
};
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWPopUpButton.h - GSWeb: Class GSWPopUpButton
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWPopUpButton.h - <title>GSWeb: Class GSWPopUpButton</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,24 +35,24 @@
|
|||
|
||||
@interface GSWPopUpButton: GSWInput
|
||||
{
|
||||
GSWAssociation* list;
|
||||
GSWAssociation* item;
|
||||
GSWAssociation* displayString;
|
||||
GSWAssociation* selection;
|
||||
GSWAssociation* _list;
|
||||
GSWAssociation* _item;
|
||||
GSWAssociation* _displayString;
|
||||
GSWAssociation* _selection;
|
||||
//GSWeb Additions {
|
||||
GSWAssociation* selectionValue;
|
||||
GSWAssociation* _selectionValue;
|
||||
// }
|
||||
GSWAssociation* selectedValue;
|
||||
GSWAssociation* noSelectionString;
|
||||
GSWAssociation* escapeHTML;
|
||||
BOOL autoValue;
|
||||
GSWAssociation* _selectedValue;
|
||||
GSWAssociation* _noSelectionString;
|
||||
GSWAssociation* _escapeHTML;
|
||||
BOOL _autoValue;
|
||||
};
|
||||
|
||||
-(void)dealloc;
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
-(NSString*)description;
|
||||
-(NSString*)elementName;
|
||||
|
||||
|
@ -54,23 +60,25 @@
|
|||
|
||||
@interface GSWPopUpButton (GSWPopUpButtonA)
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)appendValueToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendValueToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
@interface GSWPopUpButton (GSWPopUpButtonB)
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping;
|
||||
-(BOOL)appendStringAtRight:(id)unkwnon
|
||||
withMapping:(char*)mapping;
|
||||
@end
|
||||
|
||||
#endif //_GSWPopUpButton_h__
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWPopUpButton.m - GSWeb: Class GSWPopUpButton
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWPopUpButton.m - <title>GSWeb: Class GSWPopUpButton</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,59 +35,60 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWPopUpButton
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)_elements
|
||||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
//OK
|
||||
NSMutableDictionary* _associations=nil;
|
||||
NSMutableDictionary* tmpAssociations=nil;
|
||||
LOGObjectFnStartC("GSWPopUpButton");
|
||||
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements);
|
||||
_associations=[NSMutableDictionary dictionaryWithDictionary:associations_];
|
||||
[_associations removeObjectForKey:list__Key];
|
||||
[_associations removeObjectForKey:item__Key];
|
||||
[_associations removeObjectForKey:displayString__Key];
|
||||
[_associations removeObjectForKey:selection__Key];
|
||||
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ _elements=%@",
|
||||
aName,associations,elements);
|
||||
tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
|
||||
[tmpAssociations removeObjectForKey:list__Key];
|
||||
[tmpAssociations removeObjectForKey:item__Key];
|
||||
[tmpAssociations removeObjectForKey:displayString__Key];
|
||||
[tmpAssociations removeObjectForKey:selection__Key];
|
||||
if (!WOStrictFlag)
|
||||
[_associations removeObjectForKey:selectionValue__Key];
|
||||
[_associations removeObjectForKey:selectedValue__Key];
|
||||
[_associations removeObjectForKey:noSelectionString__Key];
|
||||
[_associations removeObjectForKey:escapeHTML__Key];
|
||||
[tmpAssociations removeObjectForKey:selectionValue__Key];
|
||||
[tmpAssociations removeObjectForKey:selectedValue__Key];
|
||||
[tmpAssociations removeObjectForKey:noSelectionString__Key];
|
||||
[tmpAssociations removeObjectForKey:escapeHTML__Key];
|
||||
|
||||
if ((self=[super initWithName:name_
|
||||
associations:_associations
|
||||
contentElements:nil]))
|
||||
{
|
||||
list=[[associations_ objectForKey:list__Key
|
||||
withDefaultObject:[list autorelease]] retain];
|
||||
item=[[associations_ objectForKey:item__Key
|
||||
withDefaultObject:[item autorelease]] retain];
|
||||
displayString=[[associations_ objectForKey:displayString__Key
|
||||
withDefaultObject:[displayString autorelease]] retain];
|
||||
selection=[[associations_ objectForKey:selection__Key
|
||||
withDefaultObject:[selection autorelease]] retain];
|
||||
if (selection && ![selection isValueSettable])
|
||||
{
|
||||
//TODO
|
||||
};
|
||||
|
||||
if (!WOStrictFlag)
|
||||
if ((self=[super initWithName:aName
|
||||
associations:tmpAssociations
|
||||
contentElements:nil]))
|
||||
{
|
||||
_list=[[associations objectForKey:list__Key
|
||||
withDefaultObject:[_list autorelease]] retain];
|
||||
_item=[[associations objectForKey:item__Key
|
||||
withDefaultObject:[_item autorelease]] retain];
|
||||
_displayString=[[associations objectForKey:displayString__Key
|
||||
withDefaultObject:[_displayString autorelease]] retain];
|
||||
_selection=[[associations objectForKey:selection__Key
|
||||
withDefaultObject:[_selection autorelease]] retain];
|
||||
if (_selection && ![_selection isValueSettable])
|
||||
{
|
||||
//TODO
|
||||
};
|
||||
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
_selectionValue=[[associations objectForKey:selectionValue__Key
|
||||
withDefaultObject:[_selectionValue autorelease]] retain];
|
||||
if (_selectionValue && ![_selectionValue isValueSettable])
|
||||
{
|
||||
selectionValue=[[associations_ objectForKey:selectionValue__Key
|
||||
withDefaultObject:[selectionValue autorelease]] retain];
|
||||
if (selectionValue && ![selectionValue isValueSettable])
|
||||
{
|
||||
//TODO
|
||||
};
|
||||
//TODO
|
||||
};
|
||||
|
||||
selectedValue=[[associations_ objectForKey:selectedValue__Key
|
||||
withDefaultObject:[selectedValue autorelease]] retain];
|
||||
noSelectionString=[[associations_ objectForKey:noSelectionString__Key
|
||||
withDefaultObject:[noSelectionString autorelease]] retain];
|
||||
escapeHTML=[[associations_ objectForKey:escapeHTML__Key
|
||||
withDefaultObject:[escapeHTML autorelease]] retain];
|
||||
};
|
||||
};
|
||||
|
||||
_selectedValue=[[associations objectForKey:selectedValue__Key
|
||||
withDefaultObject:[_selectedValue autorelease]] retain];
|
||||
_noSelectionString=[[associations objectForKey:noSelectionString__Key
|
||||
withDefaultObject:[_noSelectionString autorelease]] retain];
|
||||
_escapeHTML=[[associations objectForKey:escapeHTML__Key
|
||||
withDefaultObject:[_escapeHTML autorelease]] retain];
|
||||
};
|
||||
LOGObjectFnStopC("GSWPopUpButton");
|
||||
return self;
|
||||
};
|
||||
|
@ -89,14 +96,14 @@ static char rcsId[] = "$Id$";
|
|||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(list);
|
||||
DESTROY(item);
|
||||
DESTROY(displayString);
|
||||
DESTROY(selection);
|
||||
DESTROY(selectionValue);//GSWeb Only
|
||||
DESTROY(selectedValue);
|
||||
DESTROY(noSelectionString);
|
||||
DESTROY(escapeHTML);
|
||||
DESTROY(_list);
|
||||
DESTROY(_item);
|
||||
DESTROY(_displayString);
|
||||
DESTROY(_selection);
|
||||
DESTROY(_selectionValue);//GSWeb Only
|
||||
DESTROY(_selectedValue);
|
||||
DESTROY(_noSelectionString);
|
||||
DESTROY(_escapeHTML);
|
||||
[super dealloc];
|
||||
};
|
||||
|
||||
|
@ -111,8 +118,8 @@ static char rcsId[] = "$Id$";
|
|||
-(NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%s %p>",
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
};
|
||||
|
||||
//====================================================================
|
||||
|
@ -120,378 +127,378 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
//#define ENABLE_OPTGROUP
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
GSWRequest* _request=nil;
|
||||
BOOL _isFromClientComponent=NO;
|
||||
GSWComponent* _component=nil;
|
||||
NSArray* _listValue=nil;
|
||||
id _selectionValue=nil;
|
||||
id _selectedValueValue=nil;
|
||||
id _valueValue=nil;
|
||||
id _itemValue=nil;
|
||||
id _displayStringValue=nil;
|
||||
BOOL _escapeHTML=YES;
|
||||
id _escapeHTMLValue=nil;
|
||||
GSWRequest* request=nil;
|
||||
BOOL isFromClientComponent=NO;
|
||||
GSWComponent* component=nil;
|
||||
NSArray* listValue=nil;
|
||||
id selectionValue=nil;
|
||||
id selectedValueValue=nil;
|
||||
id valueValue=nil;
|
||||
id itemValue=nil;
|
||||
id displayStringValue=nil;
|
||||
BOOL escapeHTMLBoolValue=YES;
|
||||
id escapeHTMLValue=nil;
|
||||
int i=0;
|
||||
BOOL _inOptGroup=NO;
|
||||
BOOL inOptGroup=NO;
|
||||
#ifndef ENABLE_OPTGROUP
|
||||
BOOL _optGroupLabel=NO;
|
||||
BOOL optGroupLabel=NO;
|
||||
#endif
|
||||
LOGObjectFnStartC("GSWPopUpButton");
|
||||
[self resetAutoValue];
|
||||
autoValue = NO;
|
||||
_request=[context_ request];
|
||||
_isFromClientComponent=[_request isFromClientComponent];
|
||||
_component=[context_ component];
|
||||
[super appendToResponse:response_
|
||||
inContext:context_];
|
||||
_listValue=[list valueInComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"_listValue=%@",_listValue);
|
||||
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)],
|
||||
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
|
||||
list,
|
||||
_listValue,
|
||||
[_listValue class]);
|
||||
_selectionValue=[selection valueInComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"selection=%@",selection);
|
||||
NSDebugMLLog(@"gswdync",@"_selectionValue=%@",_selectionValue);
|
||||
_selectedValueValue=[selectedValue valueInComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"selectedValue=%@",selectedValue);
|
||||
NSDebugMLLog(@"gswdync",@"_selectedValueValue=%@",_selectedValueValue);
|
||||
if (escapeHTML)
|
||||
{
|
||||
_escapeHTMLValue=[escapeHTML valueInComponent:_component];
|
||||
_escapeHTML=boolValueFor(_escapeHTMLValue);
|
||||
};
|
||||
if (noSelectionString)
|
||||
{
|
||||
id _noSelectionStringValue=nil;
|
||||
[response_ _appendContentAsciiString:@"\n<OPTION"];
|
||||
if (selectedValue && !_selectedValueValue)
|
||||
{
|
||||
[response_ appendContentCharacter:' '];
|
||||
[response_ _appendContentAsciiString:@"selected"];//TODO
|
||||
};
|
||||
[response_ appendContentCharacter:'>'];
|
||||
_noSelectionStringValue=[noSelectionString valueInComponent:_component];
|
||||
if (_escapeHTML)
|
||||
_noSelectionStringValue=[GSWResponse stringByEscapingHTMLString:_noSelectionStringValue];
|
||||
[response_ appendContentString:_noSelectionStringValue];
|
||||
//[response_ appendContentHTMLString:_noSelectionStringValue];
|
||||
// There is no close tag on OPTION
|
||||
//[response_ _appendContentAsciiString:@"</OPTION>"];
|
||||
};
|
||||
for(i=0;i<[_listValue count];i++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"_inOptGroup=%s",(_inOptGroup ? "YES" : "NO"));
|
||||
_itemValue=[_listValue objectAtIndex:i];
|
||||
if (item)
|
||||
[item setValue:_itemValue
|
||||
inComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"_itemValue=%@",_itemValue);
|
||||
if (_itemValue)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",value);
|
||||
_valueValue=[self valueInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_valueValue=%@",_valueValue);
|
||||
if (_valueValue)
|
||||
{
|
||||
BOOL _isEqual;
|
||||
_autoValue = NO;
|
||||
request=[context request];
|
||||
isFromClientComponent=[request isFromClientComponent];
|
||||
component=[context component];
|
||||
[super appendToResponse:response
|
||||
inContext:context];
|
||||
listValue=[_list valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"listValue=%@",listValue);
|
||||
NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
|
||||
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
|
||||
_list,
|
||||
listValue,
|
||||
[listValue class]);
|
||||
selectionValue=[_selection valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"selection=%@",_selection);
|
||||
NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue);
|
||||
selectedValueValue=[_selectedValue valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"selectedValue=%@",_selectedValue);
|
||||
NSDebugMLLog(@"gswdync",@"selectedValueValue=%@",selectedValueValue);
|
||||
if (_escapeHTML)
|
||||
{
|
||||
escapeHTMLValue=[_escapeHTML valueInComponent:component];
|
||||
escapeHTMLBoolValue=boolValueFor(escapeHTMLValue);
|
||||
};
|
||||
if (_noSelectionString)
|
||||
{
|
||||
id noSelectionStringValue=nil;
|
||||
[response _appendContentAsciiString:@"\n<OPTION"];
|
||||
if (_selectedValue && !selectedValueValue)
|
||||
{
|
||||
[response appendContentCharacter:' '];
|
||||
[response _appendContentAsciiString:@"selected"];//TODO
|
||||
};
|
||||
[response appendContentCharacter:'>'];
|
||||
noSelectionStringValue=[_noSelectionString valueInComponent:component];
|
||||
if (escapeHTMLBoolValue)
|
||||
noSelectionStringValue=[GSWResponse stringByEscapingHTMLString:noSelectionStringValue];
|
||||
[response appendContentString:noSelectionStringValue];
|
||||
//[response appendContentHTMLString:_noSelectionStringValue];
|
||||
// There is no close tag on OPTION
|
||||
//[response _appendContentAsciiString:@"</OPTION>"];
|
||||
};
|
||||
for(i=0;i<[listValue count];i++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"inOptGroup=%s",(inOptGroup ? "YES" : "NO"));
|
||||
itemValue=[listValue objectAtIndex:i];
|
||||
if (_item)
|
||||
[_item setValue:itemValue
|
||||
inComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
|
||||
if (itemValue)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",_value);
|
||||
valueValue=[self valueInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
if (valueValue)
|
||||
{
|
||||
BOOL isEqual;
|
||||
|
||||
NSDebugMLLog0(@"gswdync",@"Adding OPTION");
|
||||
[response_ _appendContentAsciiString:@"\n<OPTION"];
|
||||
if (selection)
|
||||
{
|
||||
if(value)
|
||||
_isEqual=SBIsValueEqual(_valueValue,_selectionValue);
|
||||
else
|
||||
_isEqual=SBIsValueEqual(_itemValue,_selectionValue);
|
||||
NSDebugMLLog0(@"gswdync",@"Adding OPTION");
|
||||
[response _appendContentAsciiString:@"\n<OPTION"];
|
||||
if (_selection)
|
||||
{
|
||||
if (_value)
|
||||
isEqual=SBIsValueEqual(valueValue,selectionValue);
|
||||
else
|
||||
isEqual=SBIsValueEqual(itemValue,selectionValue);
|
||||
|
||||
if (_isEqual)
|
||||
{
|
||||
[response_ appendContentCharacter:' '];
|
||||
[response_ _appendContentAsciiString:@"selected"];
|
||||
};
|
||||
};
|
||||
if (_isEqual == NO && selectedValue)
|
||||
{
|
||||
if(value)
|
||||
_isEqual=SBIsValueEqual(_valueValue,_selectedValueValue);
|
||||
else
|
||||
_isEqual=SBIsValueEqual(_itemValue,_selectedValueValue);
|
||||
if (isEqual)
|
||||
{
|
||||
[response appendContentCharacter:' '];
|
||||
[response _appendContentAsciiString:@"selected"];
|
||||
};
|
||||
};
|
||||
if (isEqual == NO && _selectedValue)
|
||||
{
|
||||
if(_value)
|
||||
isEqual=SBIsValueEqual(valueValue,selectedValueValue);
|
||||
else
|
||||
isEqual=SBIsValueEqual(itemValue,selectedValueValue);
|
||||
|
||||
if (_isEqual)
|
||||
{
|
||||
[response_ appendContentCharacter:' '];
|
||||
[response_ _appendContentAsciiString:@"selected"];
|
||||
};
|
||||
};
|
||||
if (value == nil)
|
||||
autoValue = YES;
|
||||
if (_valueValue)
|
||||
{
|
||||
[response_ _appendContentAsciiString:@" value=\""];
|
||||
[response_ _appendContentAsciiString:_valueValue];
|
||||
[response_ appendContentCharacter:'"'];
|
||||
};
|
||||
[response_ appendContentCharacter:'>'];
|
||||
};
|
||||
_displayStringValue=nil;
|
||||
if (displayString)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"displayString=%@",displayString);
|
||||
_displayStringValue=[displayString valueInComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"_displayStringValue=%@",_displayStringValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
_displayStringValue = _itemValue;
|
||||
}
|
||||
if (isEqual)
|
||||
{
|
||||
[response appendContentCharacter:' '];
|
||||
[response _appendContentAsciiString:@"selected"];
|
||||
};
|
||||
};
|
||||
if (_value == nil)
|
||||
_autoValue = YES;
|
||||
if (valueValue)
|
||||
{
|
||||
[response _appendContentAsciiString:@" value=\""];
|
||||
[response _appendContentAsciiString:valueValue];
|
||||
[response appendContentCharacter:'"'];
|
||||
};
|
||||
[response appendContentCharacter:'>'];
|
||||
};
|
||||
displayStringValue=nil;
|
||||
if (_displayString)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"displayString=%@",_displayString);
|
||||
displayStringValue=[_displayString valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"displayStringValue=%@",displayStringValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
displayStringValue = itemValue;
|
||||
}
|
||||
|
||||
if (_displayStringValue)
|
||||
{
|
||||
if (!_valueValue)
|
||||
{
|
||||
if (_inOptGroup)
|
||||
{
|
||||
NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP");
|
||||
if (displayStringValue)
|
||||
{
|
||||
if (!valueValue)
|
||||
{
|
||||
if (inOptGroup)
|
||||
{
|
||||
NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP");
|
||||
#ifdef ENABLE_OPTGROUP
|
||||
[response_ _appendContentAsciiString:@"\n</OPTGROUP>"];
|
||||
[response _appendContentAsciiString:@"\n</OPTGROUP>"];
|
||||
#endif
|
||||
_inOptGroup=NO;
|
||||
};
|
||||
NSDebugMLLog0(@"gswdync",@"Adding OPTGROUP");
|
||||
inOptGroup=NO;
|
||||
};
|
||||
NSDebugMLLog0(@"gswdync",@"Adding OPTGROUP");
|
||||
#ifdef ENABLE_OPTGROUP
|
||||
[response_ _appendContentAsciiString:@"\n<OPTGROUP label=\""];
|
||||
[response _appendContentAsciiString:@"\n<OPTGROUP label=\""];
|
||||
#else
|
||||
#if 0
|
||||
[response_ _appendContentAsciiString:@"\n<OPTION>-- "];
|
||||
_optGroupLabel=YES;
|
||||
[response _appendContentAsciiString:@"\n<OPTION>-- "];
|
||||
optGroupLabel=YES;
|
||||
#else
|
||||
[response_ _appendContentAsciiString:@"\n<OPTION>"];
|
||||
[response _appendContentAsciiString:@"\n<OPTION>"];
|
||||
#endif
|
||||
_optGroupLabel=YES;
|
||||
optGroupLabel=YES;
|
||||
#endif
|
||||
_inOptGroup=YES;
|
||||
};
|
||||
//<OPTGROUP label="PortMaster 3">
|
||||
|
||||
if (_escapeHTML)
|
||||
_displayStringValue=[GSWResponse stringByEscapingHTMLString:_displayStringValue];
|
||||
NSDebugMLLog(@"gswdync",@"_displayStringValue=%@",_displayStringValue);
|
||||
inOptGroup=YES;
|
||||
};
|
||||
//<OPTGROUP label="PortMaster 3">
|
||||
|
||||
if (escapeHTMLBoolValue)
|
||||
displayStringValue=[GSWResponse stringByEscapingHTMLString:displayStringValue];
|
||||
NSDebugMLLog(@"gswdync",@"displayStringValue=%@",displayStringValue);
|
||||
#ifndef ENABLE_OPTGROUP
|
||||
if (_optGroupLabel)
|
||||
{
|
||||
_displayStringValue=[NSString stringWithFormat:@"%@ --",_displayStringValue];
|
||||
};
|
||||
if (optGroupLabel)
|
||||
{
|
||||
displayStringValue=[NSString stringWithFormat:@"%@ --",displayStringValue];
|
||||
};
|
||||
#endif
|
||||
[response_ appendContentString:_displayStringValue];
|
||||
//[response_ appendContentHTMLString:_displayStringValue];
|
||||
};
|
||||
if (_valueValue)
|
||||
{
|
||||
//NSDebugMLLog0(@"gswdync",@"Adding /OPTION");
|
||||
// K2- No /OPTION TAG
|
||||
//[response_ _appendContentAsciiString:@"</OPTION>"];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLLog0(@"gswdync",@"Adding > or </OPTION>");
|
||||
[response appendContentString:displayStringValue];
|
||||
//[response appendContentHTMLString:_displayStringValue];
|
||||
};
|
||||
if (valueValue)
|
||||
{
|
||||
//NSDebugMLLog0(@"gswdync",@"Adding /OPTION");
|
||||
// K2- No /OPTION TAG
|
||||
//[response _appendContentAsciiString:@"</OPTION>"];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLLog0(@"gswdync",@"Adding > or </OPTION>");
|
||||
#ifdef ENABLE_OPTGROUP
|
||||
[response_ _appendContentAsciiString:@"\">"];
|
||||
[response _appendContentAsciiString:@"\">"];
|
||||
#else
|
||||
if (_optGroupLabel)
|
||||
{
|
||||
//[response_ _appendContentAsciiString:@"</OPTION>"];
|
||||
_optGroupLabel=NO;
|
||||
};
|
||||
if (optGroupLabel)
|
||||
{
|
||||
//[response _appendContentAsciiString:@"</OPTION>"];
|
||||
optGroupLabel=NO;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
};
|
||||
};
|
||||
if (_inOptGroup)
|
||||
{
|
||||
};
|
||||
};
|
||||
};
|
||||
if (inOptGroup)
|
||||
{
|
||||
#ifdef ENABLE_OPTGROUP
|
||||
NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP");
|
||||
[response_ _appendContentAsciiString:@"\n</OPTGROUP>"];
|
||||
NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP");
|
||||
[response _appendContentAsciiString:@"\n</OPTGROUP>"];
|
||||
#endif
|
||||
_inOptGroup=NO;
|
||||
};
|
||||
[response_ _appendContentAsciiString:@"</SELECT>"];
|
||||
inOptGroup=NO;
|
||||
};
|
||||
[response _appendContentAsciiString:@"</SELECT>"];
|
||||
LOGObjectFnStopC("GSWPopUpButton");
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendValueToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendValueToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
//Does nothing !
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
LOGObjectFnStartC("GSWPopUpButton");
|
||||
[self _slowTakeValuesFromRequest:request_
|
||||
inContext:context_];
|
||||
[self _slowTakeValuesFromRequest:request
|
||||
inContext:context];
|
||||
LOGObjectFnStopC("GSWPopUpButton");
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
BOOL _disabled=NO;
|
||||
BOOL _wasFormSubmitted=NO;
|
||||
BOOL disabledValue=NO;
|
||||
BOOL wasFormSubmitted=NO;
|
||||
LOGObjectFnStartC("GSWPopUpButton");
|
||||
[self resetAutoValue];
|
||||
_disabled=[self disabledInContext:context_];
|
||||
if (!_disabled)
|
||||
{
|
||||
_wasFormSubmitted=[context_ _wasFormSubmitted];
|
||||
if (_wasFormSubmitted)
|
||||
{
|
||||
GSWComponent* _component=nil;
|
||||
NSArray* _listValue=nil;
|
||||
id _valueValue=nil;
|
||||
id _itemValue=nil;
|
||||
NSString* _name=nil;
|
||||
NSArray* _formValues=nil;
|
||||
id _formValue=nil;
|
||||
BOOL _found=NO;
|
||||
int i=0;
|
||||
_component=[context_ component];
|
||||
_name=[self nameInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_name=%@",_name);
|
||||
_formValues=[request_ formValuesForKey:_name];
|
||||
NSDebugMLLog(@"gswdync",@"_formValues=%@",_formValues);
|
||||
if (_formValues && [_formValues count])
|
||||
{
|
||||
BOOL _isEqual=NO;
|
||||
_formValue=[_formValues objectAtIndex:0];
|
||||
NSDebugMLLog(@"gswdync",@"_formValue=%@",_formValue);
|
||||
_listValue=[list valueInComponent:_component];
|
||||
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)],
|
||||
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
|
||||
list,
|
||||
_listValue,
|
||||
[_listValue class]);
|
||||
for(i=0;!_found && i<[_listValue count];i++)
|
||||
{
|
||||
_itemValue=[_listValue objectAtIndex:i];
|
||||
NSDebugMLLog(@"gswdync",@"_itemValue=%@",_itemValue);
|
||||
NSDebugMLLog(@"gswdync",@"item=%@",item);
|
||||
if (item)
|
||||
[item setValue:_itemValue
|
||||
inComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",value);
|
||||
_valueValue=[self valueInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_valueValue=%@ [class=%@] _formValue=%@ [class=%@]",
|
||||
_valueValue,[_valueValue class],
|
||||
_formValue,[_formValue class]);
|
||||
_isEqual=SBIsValueEqual(_valueValue,_formValue);
|
||||
if (_isEqual)
|
||||
{
|
||||
if(autoValue == NO)
|
||||
_itemValue = _valueValue;
|
||||
disabledValue=[self disabledInContext:context];
|
||||
if (!disabledValue)
|
||||
{
|
||||
wasFormSubmitted=[context _wasFormSubmitted];
|
||||
if (wasFormSubmitted)
|
||||
{
|
||||
GSWComponent* component=nil;
|
||||
NSArray* listValue=nil;
|
||||
id valueValue=nil;
|
||||
id itemValue=nil;
|
||||
NSString* name=nil;
|
||||
NSArray* formValues=nil;
|
||||
id formValue=nil;
|
||||
BOOL found=NO;
|
||||
int i=0;
|
||||
component=[context component];
|
||||
name=[self nameInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"name=%@",name);
|
||||
formValues=[request formValuesForKey:name];
|
||||
NSDebugMLLog(@"gswdync",@"formValues=%@",formValues);
|
||||
if (formValues && [formValues count])
|
||||
{
|
||||
BOOL isEqual=NO;
|
||||
formValue=[formValues objectAtIndex:0];
|
||||
NSDebugMLLog(@"gswdync",@"formValue=%@",formValue);
|
||||
listValue=[_list valueInComponent:component];
|
||||
NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
|
||||
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
|
||||
_list,
|
||||
listValue,
|
||||
[listValue class]);
|
||||
for(i=0;!found && i<[listValue count];i++)
|
||||
{
|
||||
itemValue=[listValue objectAtIndex:i];
|
||||
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
|
||||
NSDebugMLLog(@"gswdync",@"item=%@",_item);
|
||||
if (_item)
|
||||
[_item setValue:itemValue
|
||||
inComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",_value);
|
||||
valueValue=[self valueInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@ [class=%@] formValue=%@ [class=%@]",
|
||||
valueValue,[valueValue class],
|
||||
formValue,[formValue class]);
|
||||
isEqual=SBIsValueEqual(valueValue,formValue);
|
||||
if (isEqual)
|
||||
{
|
||||
if(_autoValue == NO)
|
||||
itemValue = valueValue;
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"selection=%@",selection);
|
||||
if (selection)
|
||||
{
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[selection setValue:_itemValue
|
||||
inComponent:_component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
[selection setValue:_itemValue
|
||||
inComponent:_component];
|
||||
};
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue);
|
||||
if (selectionValue)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[selectionValue setValue:_valueValue
|
||||
inComponent:_component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
};
|
||||
};
|
||||
_found=YES;
|
||||
};
|
||||
};
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"_found=%s",(_found ? "YES" : "NO"));
|
||||
if (!_found)
|
||||
{
|
||||
if (selection)
|
||||
{
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[selection setValue:nil
|
||||
inComponent:_component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
[selection setValue:nil
|
||||
inComponent:_component];
|
||||
};
|
||||
if (!WOStrictFlag && selectionValue)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[selectionValue setValue:nil
|
||||
inComponent:_component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"selection=%@",_selection);
|
||||
if (_selection)
|
||||
{
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[_selection setValue:itemValue
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
[_selection setValue:itemValue
|
||||
inComponent:component];
|
||||
};
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"selectionValue=%@",_selectionValue);
|
||||
if (_selectionValue)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[_selectionValue setValue:valueValue
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
};
|
||||
};
|
||||
found=YES;
|
||||
};
|
||||
};
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO"));
|
||||
if (!found)
|
||||
{
|
||||
if (_selection)
|
||||
{
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[_selection setValue:nil
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
[_selection setValue:nil
|
||||
inComponent:component];
|
||||
};
|
||||
if (!WOStrictFlag && _selectionValue)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[_selectionValue setValue:nil
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
LOGObjectFnStopC("GSWPopUpButton");
|
||||
};
|
||||
|
||||
|
@ -500,8 +507,8 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
//====================================================================
|
||||
@implementation GSWPopUpButton (GSWPopUpButtonB)
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping
|
||||
-(BOOL)appendStringAtRight:(id)unkwnon
|
||||
withMapping:(char*)mapping
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return NO;
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWRadioButton.h - GSWeb: Class GSWRadioButton
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWRadioButton.h - <title>GSWeb: Class GSWRadioButton</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,13 +35,13 @@
|
|||
//====================================================================
|
||||
@interface GSWRadioButton: GSWInput
|
||||
{
|
||||
GSWAssociation* checked;
|
||||
GSWAssociation* selection;
|
||||
GSWAssociation* _checked;
|
||||
GSWAssociation* _selection;
|
||||
};
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
-(void)dealloc;
|
||||
-(NSString*)description;
|
||||
|
||||
|
@ -43,14 +49,14 @@
|
|||
|
||||
//====================================================================
|
||||
@interface GSWRadioButton (GSWRadioButtonA)
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWRadioButton (GSWRadioButtonB)
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWRadioButton.m - GSWeb: Class GSWRadioButton
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWRadioButton.m - <title>GSWeb: Class GSWRadioButton</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,49 +35,50 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWRadioButton
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)_elements
|
||||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_];
|
||||
NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements);
|
||||
[_associations setObject:[GSWAssociation associationWithValue:@"radio"]
|
||||
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ _elements=%@",
|
||||
aName,associations,elements);
|
||||
[tmpAssociations setObject:[GSWAssociation associationWithValue:@"radio"]
|
||||
forKey:@"type"];
|
||||
[_associations removeObjectForKey:selection__Key];
|
||||
[_associations removeObjectForKey:checked__Key];
|
||||
if ((self=[super initWithName:name_
|
||||
associations:_associations
|
||||
contentElements:nil]))
|
||||
{
|
||||
selection=[[associations_ objectForKey:selection__Key
|
||||
withDefaultObject:[selection autorelease]] retain];
|
||||
if (selection && ![selection isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWRadioButton",@"'selection' parameter must be settable");
|
||||
};
|
||||
checked=[[associations_ objectForKey:checked__Key
|
||||
withDefaultObject:[checked autorelease]] retain];
|
||||
if (checked && ![checked isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWRadioButton",@"'checked' parameter must be settable");
|
||||
};
|
||||
if (!checked)
|
||||
{
|
||||
if (!value || !selection)
|
||||
{
|
||||
ExceptionRaise0(@"GSWRadioButton",@"if you don't specify 'checked' parameter, you have to specify 'value' and 'selection' parameter");
|
||||
};
|
||||
};
|
||||
};
|
||||
[tmpAssociations removeObjectForKey:selection__Key];
|
||||
[tmpAssociations removeObjectForKey:checked__Key];
|
||||
if ((self=[super initWithName:aName
|
||||
associations:tmpAssociations
|
||||
contentElements:nil]))
|
||||
{
|
||||
_selection=[[associations objectForKey:selection__Key
|
||||
withDefaultObject:[_selection autorelease]] retain];
|
||||
if (_selection && ![_selection isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWRadioButton",@"'selection' parameter must be settable");
|
||||
};
|
||||
_checked=[[associations objectForKey:checked__Key
|
||||
withDefaultObject:[_checked autorelease]] retain];
|
||||
if (_checked && ![_checked isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWRadioButton",@"'checked' parameter must be settable");
|
||||
};
|
||||
if (!_checked)
|
||||
{
|
||||
if (!_value || !_selection)
|
||||
{
|
||||
ExceptionRaise0(@"GSWRadioButton",@"if you don't specify 'checked' parameter, you have to specify 'value' and 'selection' parameter");
|
||||
};
|
||||
};
|
||||
};
|
||||
return self;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(checked);
|
||||
DESTROY(selection);
|
||||
DESTROY(_checked);
|
||||
DESTROY(_selection);
|
||||
[super dealloc];
|
||||
};
|
||||
|
||||
|
@ -79,8 +86,8 @@ static char rcsId[] = "$Id$";
|
|||
-(NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%s %p>",
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
};
|
||||
|
||||
@end
|
||||
|
@ -89,33 +96,33 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWRadioButton (GSWRadioButtonA)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
GSWComponent* _component=[context_ component];
|
||||
BOOL _disabledInContext=[self disabledInContext:context_];
|
||||
if (!_disabledInContext)
|
||||
{
|
||||
BOOL _checked=NO;
|
||||
[self appendValueToResponse:response_
|
||||
inContext:context_];
|
||||
[self appendNameToResponse:response_
|
||||
inContext:context_];
|
||||
if (checked)
|
||||
{
|
||||
_checked=[self evaluateCondition:checked
|
||||
inContext:context_];
|
||||
}
|
||||
else if (value)
|
||||
{
|
||||
id _valueValue=[value valueInComponent:_component];
|
||||
id _selectionValue=[selection valueInComponent:_component];
|
||||
_checked=SBIsValueEqual(_selectionValue,_valueValue);
|
||||
};
|
||||
if (_checked)
|
||||
[response_ _appendContentAsciiString:@" checked"];
|
||||
};
|
||||
GSWComponent* component=[context component];
|
||||
BOOL disabledInContext=[self disabledInContext:context];
|
||||
if (!disabledInContext)
|
||||
{
|
||||
BOOL isChecked=NO;
|
||||
[self appendValueToResponse:response
|
||||
inContext:context];
|
||||
[self appendNameToResponse:response
|
||||
inContext:context];
|
||||
if (_checked)
|
||||
{
|
||||
isChecked=[self evaluateCondition:_checked
|
||||
inContext:context];
|
||||
}
|
||||
else if (_value)
|
||||
{
|
||||
id valueValue=[_value valueInComponent:component];
|
||||
id selectionValue=[_selection valueInComponent:component];
|
||||
isChecked=SBIsValueEqual(selectionValue,valueValue);
|
||||
};
|
||||
if (isChecked)
|
||||
[response _appendContentAsciiString:@" checked"];
|
||||
};
|
||||
};
|
||||
@end
|
||||
|
||||
|
@ -123,77 +130,77 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWRadioButton (GSWRadioButtonB)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
BOOL _disabledInContext=NO;
|
||||
BOOL disabledInContext=NO;
|
||||
LOGObjectFnStart();
|
||||
_disabledInContext=[self disabledInContext:context_];
|
||||
if (!_disabledInContext)
|
||||
{
|
||||
if ([context_ _wasFormSubmitted])
|
||||
{
|
||||
BOOL _isEqual=NO;
|
||||
GSWComponent* _component=[context_ component];
|
||||
NSString* _name=nil;
|
||||
id _formValue=nil;
|
||||
id _valueValue=nil;
|
||||
BOOL _checkChecked=NO;
|
||||
_name=[self nameInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_name=%@",_name);
|
||||
_formValue=[request_ formValueForKey:_name];
|
||||
_valueValue=[value valueInComponent:_component];
|
||||
//TODO if checked !
|
||||
_isEqual=SBIsValueEqual(_formValue,_valueValue);
|
||||
if (_isEqual)
|
||||
{
|
||||
_checkChecked=YES;
|
||||
if (selection)
|
||||
{
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[selection setValue:_valueValue
|
||||
inComponent:_component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
[selection setValue:_valueValue
|
||||
inComponent:_component];
|
||||
};
|
||||
};
|
||||
if (checked)
|
||||
{
|
||||
id _checkedValue=[NSNumber numberWithBool:_checkChecked];
|
||||
NSDebugMLLog(@"gswdync",@"_checkedValue=%@",_checkedValue);
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[checked setValue:_checkedValue
|
||||
inComponent:_component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
[checked setValue:_checkedValue
|
||||
inComponent:_component];
|
||||
};
|
||||
};
|
||||
};
|
||||
disabledInContext=[self disabledInContext:context];
|
||||
if (!disabledInContext)
|
||||
{
|
||||
if ([context _wasFormSubmitted])
|
||||
{
|
||||
BOOL isEqual=NO;
|
||||
GSWComponent* component=[context component];
|
||||
NSString* name=nil;
|
||||
id formValue=nil;
|
||||
id valueValue=nil;
|
||||
BOOL checkChecked=NO;
|
||||
name=[self nameInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"name=%@",name);
|
||||
formValue=[request formValueForKey:name];
|
||||
valueValue=[_value valueInComponent:component];
|
||||
//TODO if checked !
|
||||
isEqual=SBIsValueEqual(formValue,valueValue);
|
||||
if (isEqual)
|
||||
{
|
||||
checkChecked=YES;
|
||||
if (_selection)
|
||||
{
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[_selection setValue:valueValue
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
[_selection setValue:valueValue
|
||||
inComponent:component];
|
||||
};
|
||||
};
|
||||
if (_checked)
|
||||
{
|
||||
id checkedValue=[NSNumber numberWithBool:checkChecked];
|
||||
NSDebugMLLog(@"gswdync",@"checkedValue=%@",checkedValue);
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[_checked setValue:checkedValue
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
[_checked setValue:checkedValue
|
||||
inComponent:component];
|
||||
};
|
||||
};
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWRadioButtonList.h - GSWeb: Class GSWRadioButtonList
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWRadioButtonList.h - <title>GSWeb: Class GSWRadioButtonList</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,21 +35,21 @@
|
|||
|
||||
@interface GSWRadioButtonList: GSWInput
|
||||
{
|
||||
GSWAssociation* list;
|
||||
GSWAssociation* item;
|
||||
GSWAssociation* index;
|
||||
GSWAssociation* selection;
|
||||
GSWAssociation* prefix;
|
||||
GSWAssociation* suffix;
|
||||
GSWAssociation* displayString;
|
||||
GSWAssociation* escapeHTML;
|
||||
BOOL defaultEscapeHTML;
|
||||
BOOL autoValue;
|
||||
GSWAssociation* _list;
|
||||
GSWAssociation* _item;
|
||||
GSWAssociation* _index;
|
||||
GSWAssociation* _selection;
|
||||
GSWAssociation* _prefix;
|
||||
GSWAssociation* _suffix;
|
||||
GSWAssociation* _displayString;
|
||||
GSWAssociation* _escapeHTML;
|
||||
BOOL _defaultEscapeHTML;
|
||||
BOOL _autoValue;
|
||||
};
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
-(void)dealloc;
|
||||
|
||||
-(NSString*)description;
|
||||
|
@ -54,23 +60,25 @@
|
|||
|
||||
//====================================================================
|
||||
@interface GSWRadioButtonList (GSWRadioButtonListA)
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWRadioButtonList (GSWRadioButtonListB)
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping;
|
||||
-(BOOL)appendStringAtLeft:(id)_unkwnon
|
||||
withMapping:(char*)_mapping;
|
||||
-(BOOL)appendStringAtRight:(id)unkwnon
|
||||
withMapping:(char*)mapping;
|
||||
-(BOOL)appendStringAtLeft:(id)unkwnon
|
||||
withMapping:(char*)mapping;
|
||||
-(BOOL)compactHTMLTags;
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWRadioButtonList.m - GSWeb: Class GSWRadioButtonList
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWRadioButtonList.m - <title>GSWeb: Class GSWRadioButtonList</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,71 +35,72 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWRadioButtonList
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_
|
||||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
//OK
|
||||
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_];
|
||||
NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_);
|
||||
defaultEscapeHTML=1;
|
||||
[_associations removeObjectForKey:list__Key];
|
||||
[_associations removeObjectForKey:item__Key];
|
||||
[_associations removeObjectForKey:index__Key];
|
||||
[_associations removeObjectForKey:selection__Key];
|
||||
[_associations removeObjectForKey:prefix__Key];
|
||||
[_associations removeObjectForKey:suffix__Key];
|
||||
[_associations removeObjectForKey:displayString__Key];
|
||||
[_associations removeObjectForKey:escapeHTML__Key];
|
||||
if ((self=[super initWithName:name_
|
||||
associations:_associations
|
||||
contentElements:nil]))
|
||||
{
|
||||
list=[[associations_ objectForKey:list__Key
|
||||
withDefaultObject:[list autorelease]] retain];
|
||||
item=[[associations_ objectForKey:item__Key
|
||||
withDefaultObject:[item autorelease]] retain];
|
||||
if (item && ![item isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable");
|
||||
};
|
||||
index=[[associations_ objectForKey:index__Key
|
||||
withDefaultObject:[index autorelease]] retain];
|
||||
if (index && ![index isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'index' parameter must be settable");
|
||||
};
|
||||
|
||||
selection=[[associations_ objectForKey:selection__Key
|
||||
withDefaultObject:[selection autorelease]] retain];
|
||||
if (![selection isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable");
|
||||
};
|
||||
prefix=[[associations_ objectForKey:prefix__Key
|
||||
withDefaultObject:[prefix autorelease]] retain];
|
||||
suffix=[[associations_ objectForKey:suffix__Key
|
||||
withDefaultObject:[suffix autorelease]] retain];
|
||||
displayString=[[associations_ objectForKey:displayString__Key
|
||||
withDefaultObject:[displayString autorelease]] retain];
|
||||
escapeHTML=[[associations_ objectForKey:escapeHTML__Key
|
||||
withDefaultObject:[escapeHTML autorelease]] retain];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",
|
||||
aName,associations,elements);
|
||||
_defaultEscapeHTML=1;
|
||||
[tmpAssociations removeObjectForKey:list__Key];
|
||||
[tmpAssociations removeObjectForKey:item__Key];
|
||||
[tmpAssociations removeObjectForKey:index__Key];
|
||||
[tmpAssociations removeObjectForKey:selection__Key];
|
||||
[tmpAssociations removeObjectForKey:prefix__Key];
|
||||
[tmpAssociations removeObjectForKey:suffix__Key];
|
||||
[tmpAssociations removeObjectForKey:displayString__Key];
|
||||
[tmpAssociations removeObjectForKey:escapeHTML__Key];
|
||||
if ((self=[super initWithName:aName
|
||||
associations:tmpAssociations
|
||||
contentElements:nil]))
|
||||
{
|
||||
_list=[[associations objectForKey:list__Key
|
||||
withDefaultObject:[_list autorelease]] retain];
|
||||
_item=[[associations objectForKey:item__Key
|
||||
withDefaultObject:[_item autorelease]] retain];
|
||||
if (_item && ![_item isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable");
|
||||
};
|
||||
_index=[[associations objectForKey:index__Key
|
||||
withDefaultObject:[_index autorelease]] retain];
|
||||
if (_index && ![_index isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'index' parameter must be settable");
|
||||
};
|
||||
|
||||
_selection=[[associations objectForKey:selection__Key
|
||||
withDefaultObject:[_selection autorelease]] retain];
|
||||
if (![_selection isValueSettable])
|
||||
{
|
||||
ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable");
|
||||
};
|
||||
_prefix=[[associations objectForKey:prefix__Key
|
||||
withDefaultObject:[_prefix autorelease]] retain];
|
||||
_suffix=[[associations objectForKey:suffix__Key
|
||||
withDefaultObject:[_suffix autorelease]] retain];
|
||||
_displayString=[[associations objectForKey:displayString__Key
|
||||
withDefaultObject:[_displayString autorelease]] retain];
|
||||
_escapeHTML=[[associations objectForKey:escapeHTML__Key
|
||||
withDefaultObject:[_escapeHTML autorelease]] retain];
|
||||
};
|
||||
return self;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(list);
|
||||
DESTROY(item);
|
||||
DESTROY(index);
|
||||
DESTROY(selection);
|
||||
DESTROY(prefix);
|
||||
DESTROY(suffix);
|
||||
DESTROY(displayString);
|
||||
DESTROY(escapeHTML);
|
||||
DESTROY(_list);
|
||||
DESTROY(_item);
|
||||
DESTROY(_index);
|
||||
DESTROY(_selection);
|
||||
DESTROY(_prefix);
|
||||
DESTROY(_suffix);
|
||||
DESTROY(_displayString);
|
||||
DESTROY(_escapeHTML);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -101,8 +108,8 @@ static char rcsId[] = "$Id$";
|
|||
-(NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%s %p>",
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -117,117 +124,117 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWRadioButtonList (GSWRadioButtonListA)
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
LOGObjectFnStart();
|
||||
[self _slowTakeValuesFromRequest:request_
|
||||
inContext:context_];
|
||||
[self _slowTakeValuesFromRequest:request
|
||||
inContext:context];
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)_slowTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
BOOL _disabledInContext=NO;
|
||||
BOOL disabledInContext=NO;
|
||||
LOGObjectFnStart();
|
||||
|
||||
[self resetAutoValue];
|
||||
_disabledInContext=[self disabledInContext:context_];
|
||||
if (!_disabledInContext)
|
||||
{
|
||||
if ([context_ _wasFormSubmitted])
|
||||
{
|
||||
GSWComponent* _component=[context_ component];
|
||||
NSArray* _listValue=nil;
|
||||
NSString* _name=nil;
|
||||
int _foundIndex=-1;
|
||||
id _formValue=nil;
|
||||
id _valueValue=nil;
|
||||
id _valueToSet=nil;
|
||||
int i=0;
|
||||
_name=[self nameInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_name=%@",_name);
|
||||
_formValue=[request_ formValueForKey:_name];
|
||||
NSDebugMLLog(@"gswdync",@"_formValue=%@",_formValue);
|
||||
_listValue=[list valueInComponent:_component];
|
||||
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)],
|
||||
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
|
||||
list,
|
||||
_listValue,
|
||||
[_listValue class]);
|
||||
NSDebugMLLog(@"gswdync",@"_listValue=%@",_listValue);
|
||||
for(i=0;i<[_listValue count] && _foundIndex<0;i++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"item=%@",item);
|
||||
NSDebugMLLog(@"gswdync",@"index=%@",index);
|
||||
if (item)
|
||||
[item setValue:[_listValue objectAtIndex:i]
|
||||
inComponent:_component];
|
||||
else if (index)
|
||||
[index setValue:[NSNumber numberWithShort:i]
|
||||
inComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",value);
|
||||
disabledInContext=[self disabledInContext:context];
|
||||
if (!disabledInContext)
|
||||
{
|
||||
if ([context _wasFormSubmitted])
|
||||
{
|
||||
GSWComponent* component=[context component];
|
||||
NSArray* listValue=nil;
|
||||
NSString* name=nil;
|
||||
int foundIndex=-1;
|
||||
id formValue=nil;
|
||||
id valueValue=nil;
|
||||
id valueToSet=nil;
|
||||
int i=0;
|
||||
name=[self nameInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"name=%@",name);
|
||||
formValue=[request formValueForKey:name];
|
||||
NSDebugMLLog(@"gswdync",@"formValue=%@",formValue);
|
||||
listValue=[_list valueInComponent:component];
|
||||
NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
|
||||
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
|
||||
_list,
|
||||
listValue,
|
||||
[listValue class]);
|
||||
NSDebugMLLog(@"gswdync",@"listValue=%@",listValue);
|
||||
for(i=0;i<[listValue count] && foundIndex<0;i++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"item=%@",_item);
|
||||
NSDebugMLLog(@"gswdync",@"index=%@",_index);
|
||||
if (_item)
|
||||
[_item setValue:[listValue objectAtIndex:i]
|
||||
inComponent:component];
|
||||
else if (_index)
|
||||
[_index setValue:[NSNumber numberWithShort:i]
|
||||
inComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",_value);
|
||||
|
||||
//TODOV
|
||||
_valueValue=[self valueInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_valueValue=%@",_valueValue);
|
||||
if (_valueValue)
|
||||
{
|
||||
BOOL _isEqual=SBIsValueEqual(_valueValue,_formValue);
|
||||
NSDebugMLLog(@"gswdync",@"_isEqual=%s",(_isEqual ? "YES" : "NO"));
|
||||
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)
|
||||
//TODOV
|
||||
valueValue=[self valueInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
if (valueValue)
|
||||
{
|
||||
BOOL isEqual=SBIsValueEqual(valueValue,formValue);
|
||||
NSDebugMLLog(@"gswdync",@"isEqual=%s",(isEqual ? "YES" : "NO"));
|
||||
if (isEqual)
|
||||
{
|
||||
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];
|
||||
if(_autoValue == NO)
|
||||
valueToSet=valueValue;
|
||||
else
|
||||
[selection setValue:nil
|
||||
inComponent:_component];
|
||||
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 (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();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnStart();
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
|
@ -235,65 +242,65 @@ static char rcsId[] = "$Id$";
|
|||
};
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
GSWRequest* _request=nil;
|
||||
BOOL _isFromClientComponent=NO;
|
||||
NSString* _name=nil;
|
||||
GSWComponent* _component=nil;
|
||||
NSArray* _listValue=nil;
|
||||
id _selectionValue=nil;
|
||||
GSWRequest* request=nil;
|
||||
BOOL isFromClientComponent=NO;
|
||||
NSString* name=nil;
|
||||
GSWComponent* component=nil;
|
||||
NSArray* listValue=nil;
|
||||
id selectionValue=nil;
|
||||
int i=0;
|
||||
id _displayStringValue=nil;
|
||||
id _prefixValue=nil;
|
||||
id _suffixValue=nil;
|
||||
id _valueValue=nil;
|
||||
BOOL _isEqual=NO;
|
||||
id displayStringValue=nil;
|
||||
id prefixValue=nil;
|
||||
id suffixValue=nil;
|
||||
id valueValue=nil;
|
||||
BOOL isEqual=NO;
|
||||
LOGObjectFnStart();
|
||||
[self resetAutoValue];
|
||||
autoValue = NO;
|
||||
_request=[context_ request];
|
||||
_isFromClientComponent=[_request isFromClientComponent];
|
||||
_name=[self nameInContext:context_];
|
||||
_component=[context_ component];
|
||||
_selectionValue=[selection valueInComponent:_component];
|
||||
_listValue=[list valueInComponent:_component];
|
||||
NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)],
|
||||
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
|
||||
list,
|
||||
_listValue,
|
||||
[_listValue class]);
|
||||
for(i=0;i<[_listValue count];i++)
|
||||
{
|
||||
[item setValue:[_listValue objectAtIndex:i]
|
||||
inComponent:_component];
|
||||
_prefixValue=[prefix valueInComponent:_component];
|
||||
_suffixValue=[suffix valueInComponent:_component];
|
||||
[index setValue:[NSNumber numberWithShort:i]
|
||||
inComponent:_component];
|
||||
_displayStringValue=[displayString valueInComponent:_component];
|
||||
[response_ appendContentString:@"<INPUT NAME=\""];
|
||||
[response_ appendContentString:_name];
|
||||
[response_ appendContentString:@"\" TYPE=radio VALUE=\""];
|
||||
_valueValue=[self valueInContext:context_];
|
||||
[response_ appendContentHTMLAttributeValue:_valueValue];
|
||||
[response_ appendContentCharacter:'"'];
|
||||
//TODOV
|
||||
if(value)
|
||||
_isEqual=SBIsValueEqual(_valueValue,_selectionValue);
|
||||
else
|
||||
{
|
||||
_isEqual=SBIsValueEqual([_listValue objectAtIndex:i],_selectionValue);
|
||||
autoValue = YES;
|
||||
}
|
||||
if (_isEqual)
|
||||
[response_ appendContentString:@"\" CHECKED"];
|
||||
[response_ appendContentCharacter:'>'];
|
||||
[response_ appendContentString:_prefixValue];
|
||||
[response_ appendContentHTMLString:_displayStringValue];
|
||||
[response_ appendContentString:_suffixValue];
|
||||
_autoValue = NO;
|
||||
request=[context request];
|
||||
isFromClientComponent=[request isFromClientComponent];
|
||||
name=[self nameInContext:context];
|
||||
component=[context component];
|
||||
selectionValue=[_selection valueInComponent:component];
|
||||
listValue=[_list valueInComponent:component];
|
||||
NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
|
||||
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
|
||||
_list,
|
||||
listValue,
|
||||
[listValue class]);
|
||||
for(i=0;i<[listValue count];i++)
|
||||
{
|
||||
[_item setValue:[listValue objectAtIndex:i]
|
||||
inComponent:component];
|
||||
prefixValue=[_prefix valueInComponent:component];
|
||||
suffixValue=[_suffix valueInComponent:component];
|
||||
[_index setValue:[NSNumber numberWithShort:i]
|
||||
inComponent:component];
|
||||
displayStringValue=[_displayString valueInComponent:component];
|
||||
[response appendContentString:@"<INPUT NAME=\""];
|
||||
[response appendContentString:_name];
|
||||
[response appendContentString:@"\" TYPE=radio VALUE=\""];
|
||||
valueValue=[self valueInContext:context];
|
||||
[response appendContentHTMLAttributeValue:valueValue];
|
||||
[response appendContentCharacter:'"'];
|
||||
//TODOV
|
||||
if(_value)
|
||||
isEqual=SBIsValueEqual(valueValue,selectionValue);
|
||||
else
|
||||
{
|
||||
isEqual=SBIsValueEqual([listValue objectAtIndex:i],selectionValue);
|
||||
_autoValue = YES;
|
||||
}
|
||||
if (isEqual)
|
||||
[response appendContentString:@"\" CHECKED"];
|
||||
[response appendContentCharacter:'>'];
|
||||
[response appendContentString:prefixValue];
|
||||
[response appendContentHTMLString:displayStringValue];
|
||||
[response appendContentString:suffixValue];
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
@ -302,15 +309,15 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
//====================================================================
|
||||
@implementation GSWRadioButtonList (GSWRadioButtonListB)
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping
|
||||
-(BOOL)appendStringAtRight:(id)unkwnon
|
||||
withMapping:(char*)mapping
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return NO;
|
||||
};
|
||||
|
||||
-(BOOL)appendStringAtLeft:(id)_unkwnon
|
||||
withMapping:(char*)_mapping
|
||||
-(BOOL)appendStringAtLeft:(id)unkwnon
|
||||
withMapping:(char*)mapping
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return NO;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* 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
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
@ -32,21 +32,21 @@ extern NSDictionary* globalMime;
|
|||
@interface GSWResourceManager : NSObject <NSLocking>
|
||||
{
|
||||
@private
|
||||
NSMutableDictionary* frameworkProjectBundlesCache;
|
||||
NSMutableDictionary* appURLs;
|
||||
NSMutableDictionary* frameworkURLs;
|
||||
NSMutableDictionary* appPaths;
|
||||
GSWMultiKeyDictionary* frameworkPaths;
|
||||
NSMutableDictionary* urlValuedElementsData;
|
||||
NSMutableDictionary* _frameworkProjectBundlesCache;
|
||||
NSMutableDictionary* _appURLs;
|
||||
NSMutableDictionary* _frameworkURLs;
|
||||
NSMutableDictionary* _appPaths;
|
||||
GSWMultiKeyDictionary* _frameworkPaths;
|
||||
NSMutableDictionary* _urlValuedElementsData;
|
||||
NSMutableDictionary* _stringsTablesByFrameworkByLanguageByName;//NDFN
|
||||
NSMutableDictionary* _stringsTableArraysByFrameworkByLanguageByName;//NDFN
|
||||
// NSMutableDictionary* frameworkPathsToFrameworksNames;
|
||||
NSArray* frameworkClassPaths;
|
||||
NSRecursiveLock* selfLock;
|
||||
// NSMutableDictionary* _frameworkPathsToFrameworksNames;
|
||||
NSArray* _frameworkClassPaths;
|
||||
NSRecursiveLock* _selfLock;
|
||||
#ifndef NDEBUG
|
||||
int selfLockn;
|
||||
int _selfLockn;
|
||||
#endif
|
||||
BOOL applicationRequiresJavaVirtualMachine;
|
||||
BOOL _applicationRequiresJavaVirtualMachine;
|
||||
};
|
||||
|
||||
-(void)dealloc;
|
||||
|
@ -55,84 +55,84 @@ extern NSDictionary* globalMime;
|
|||
-(void)_initFrameworkProjectBundles;
|
||||
|
||||
//-(NSString*)frameworkNameForPath:(NSString*)path_;
|
||||
-(NSString*)pathForResourceNamed:(NSString*)name_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
languages:(NSArray*)languages_;
|
||||
-(NSString*)urlForResourceNamed:(NSString*)name_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
languages:(NSArray*)languages_
|
||||
request:(GSWRequest*)request_;
|
||||
-(NSString*)pathForResourceNamed:(NSString*)name
|
||||
inFramework:(NSString*)frameworkName
|
||||
languages:(NSArray*)languages;
|
||||
-(NSString*)urlForResourceNamed:(NSString*)name
|
||||
inFramework:(NSString*)frameworkName
|
||||
languages:(NSArray*)languages
|
||||
request:(GSWRequest*)request;
|
||||
-(NSString*)stringForKey:(NSString*)key_
|
||||
inTableNamed:(NSString*)tableName_
|
||||
withDefaultValue:(NSString*)defaultValue_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
languages:(NSArray*)languages_;
|
||||
inTableNamed:(NSString*)tableName
|
||||
withDefaultValue:(NSString*)defaultValue_
|
||||
inFramework:(NSString*)frameworkName
|
||||
languages:(NSArray*)languages;
|
||||
|
||||
//NDFN
|
||||
-(NSDictionary*)stringsTableNamed:(NSString*)tableName_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
languages:(NSArray*)languages_;
|
||||
-(NSDictionary*)stringsTableNamed:(NSString*)tableName
|
||||
inFramework:(NSString*)frameworkName
|
||||
languages:(NSArray*)languages;
|
||||
|
||||
//NDFN
|
||||
-(NSArray*)stringsTableArrayNamed:(NSString*)tableName_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
languages:(NSArray*)languages_;
|
||||
|
||||
-(NSArray*)stringsTableArrayNamed:(NSString*)tableName
|
||||
inFramework:(NSString*)frameworkName
|
||||
languages:(NSArray*)languages;
|
||||
|
||||
-(void)lock;
|
||||
|
||||
-(void)unlock;
|
||||
|
||||
-(NSString*)lockedStringForKey:(NSString*)_key
|
||||
inTableNamed:(NSString*)_tableName
|
||||
inFramework:(NSString*)_framework
|
||||
languages:(NSArray*)languages_;
|
||||
-(NSString*)lockedStringForKey:(NSString*)key
|
||||
inTableNamed:(NSString*)tableName
|
||||
inFramework:(NSString*)framework
|
||||
languages:(NSArray*)languages;
|
||||
//NDFN
|
||||
-(NSDictionary*)lockedStringsTableNamed:(NSString*)_tableName
|
||||
inFramework:(NSString*)_framework
|
||||
languages:(NSArray*)languages_;
|
||||
-(NSDictionary*)lockedStringsTableNamed:(NSString*)tableName
|
||||
inFramework:(NSString*)framework
|
||||
languages:(NSArray*)languages;
|
||||
|
||||
//NDFN
|
||||
-(NSArray*)lockedStringsTableArrayNamed:(NSString*)_tableName
|
||||
inFramework:(NSString*)_framework
|
||||
languages:(NSArray*)languages_;
|
||||
-(NSArray*)lockedStringsTableArrayNamed:(NSString*)tableName
|
||||
inFramework:(NSString*)framework
|
||||
languages:(NSArray*)languages;
|
||||
|
||||
-(NSString*)lockedCachedStringForKey:(NSString*)key_
|
||||
inTableNamed:(NSString*)tableName_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
language:(NSString*)language_;
|
||||
-(NSString*)lockedCachedStringForKey:(NSString*)key
|
||||
inTableNamed:(NSString*)tableName
|
||||
inFramework:(NSString*)frameworkName
|
||||
language:(NSString*)language;
|
||||
|
||||
-(NSDictionary*)lockedCachedStringsTableWithName:(NSString*)tableName_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
language:(NSString*)language_;
|
||||
-(NSDictionary*)lockedCachedStringsTableWithName:(NSString*)tableName
|
||||
inFramework:(NSString*)frameworkName
|
||||
language:(NSString*)language;
|
||||
|
||||
//NDFN
|
||||
-(NSArray*)lockedCachedStringsTableArrayWithName:(NSString*)tableName_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
language:(NSString*)language_;
|
||||
-(NSArray*)lockedCachedStringsTableArrayWithName:(NSString*)tableName
|
||||
inFramework:(NSString*)frameworkName
|
||||
language:(NSString*)language;
|
||||
|
||||
-(NSDictionary*)lockedStringsTableWithName:(NSString*)tableName_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
language:(NSString*)language_;
|
||||
-(NSDictionary*)lockedStringsTableWithName:(NSString*)tableName
|
||||
inFramework:(NSString*)frameworkName
|
||||
language:(NSString*)language;
|
||||
|
||||
//NDFN
|
||||
-(NSArray*)lockedStringsTableArrayWithName:(NSString*)tableName_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
language:(NSString*)language_;
|
||||
-(NSArray*)lockedStringsTableArrayWithName:(NSString*)tableName
|
||||
inFramework:(NSString*)frameworkName
|
||||
language:(NSString*)language;
|
||||
|
||||
-(NSString*)lockedUrlForResourceNamed:(NSString*)name_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
languages:(NSArray*)languages_
|
||||
request:(GSWRequest*)_request;
|
||||
-(NSString*)lockedUrlForResourceNamed:(NSString*)name
|
||||
inFramework:(NSString*)frameworkName
|
||||
languages:(NSArray*)languages_
|
||||
request:(GSWRequest*)request;
|
||||
|
||||
-(NSString*)lockedCachedURLForResourceNamed:(NSString*)name_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
languages:(NSArray*)languages_;
|
||||
-(NSString*)lockedCachedURLForResourceNamed:(NSString*)name
|
||||
inFramework:(NSString*)frameworkName
|
||||
languages:(NSArray*)languages;
|
||||
|
||||
-(NSString*)lockedPathForResourceNamed:(NSString*)name_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
languages:(NSArray*)languages_;
|
||||
-(NSString*)lockedPathForResourceNamed:(NSString*)name
|
||||
inFramework:(NSString*)frameworkName
|
||||
languages:(NSArray*)languages;
|
||||
|
||||
-(GSWDeployedBundle*)lockedCachedBundleForFrameworkNamed:(NSString*)name_;
|
||||
-(GSWDeployedBundle*)lockedCachedBundleForFrameworkNamed:(NSString*)name;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
|
@ -142,33 +142,33 @@ extern NSDictionary* globalMime;
|
|||
|
||||
-(void)setURLValuedElementData:(GSWURLValuedElementData*)data_;
|
||||
|
||||
-(void)setData:(NSData*)data_
|
||||
forKey:(NSString*)key_
|
||||
mimeType:(NSString*)type_
|
||||
session:(GSWSession*)session_;
|
||||
-(void)setData:(NSData*)data
|
||||
forKey:(NSString*)key
|
||||
mimeType:(NSString*)type
|
||||
session:(GSWSession*)session;
|
||||
|
||||
-(void)removeDataForKey:(NSString*)key_
|
||||
session:(GSWSession*)session_;
|
||||
-(void)removeDataForKey:(NSString*)key
|
||||
session:(GSWSession*)session;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
//====================================================================
|
||||
@interface GSWResourceManager (GSWResourceManagerA)
|
||||
-(NSString*)pathForResourceNamed:(NSString*)name_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
language:(NSString*)language_;
|
||||
-(NSString*)lockedPathForResourceNamed:(NSString*)name_
|
||||
inFramework:(NSString*)frameworkName_
|
||||
language:(NSString*)language_;
|
||||
-(NSString*)pathForResourceNamed:(NSString*)name
|
||||
inFramework:(NSString*)frameworkName
|
||||
language:(NSString*)language;
|
||||
-(NSString*)lockedPathForResourceNamed:(NSString*)name
|
||||
inFramework:(NSString*)frameworkName
|
||||
language:(NSString*)language;
|
||||
-(GSWDeployedBundle*)_appProjectBundle;
|
||||
-(NSArray*)_allFrameworkProjectBundles;
|
||||
-(void)lockedRemoveDataForKey:(NSString*)key_;
|
||||
-(void)lockedRemoveDataForKey:(NSString*)key;
|
||||
-(BOOL)_doesRequireJavaVirualMachine;
|
||||
-(NSString*)_absolutePathForJavaClassPath:(NSString*)path_;
|
||||
-(GSWURLValuedElementData*)_cachedDataForKey:(NSString*)key_;
|
||||
-(void)lockedCacheData:(GSWURLValuedElementData*)data_;
|
||||
-(NSString*)contentTypeForResourcePath:(NSString*)path_;
|
||||
-(NSString*)_absolutePathForJavaClassPath:(NSString*)path;
|
||||
-(GSWURLValuedElementData*)_cachedDataForKey:(NSString*)key;
|
||||
-(void)lockedCacheData:(GSWURLValuedElementData*)data;
|
||||
-(NSString*)contentTypeForResourcePath:(NSString*)path;
|
||||
-(NSArray*)_frameworkClassPaths;
|
||||
|
||||
@end
|
||||
|
@ -176,10 +176,10 @@ extern NSDictionary* globalMime;
|
|||
|
||||
//====================================================================
|
||||
@interface GSWResourceManager (GSWResourceManagerOldFn)
|
||||
-(NSString*)urlForResourceNamed:(NSString*)name_
|
||||
inFramework:(NSString*)frameworkName_;
|
||||
-(NSString*)pathForResourceNamed:(NSString*)name_
|
||||
inFramework:(NSString*)frameworkName_;
|
||||
-(NSString*)urlForResourceNamed:(NSString*)name
|
||||
inFramework:(NSString*)frameworkName;
|
||||
-(NSString*)pathForResourceNamed:(NSString*)name
|
||||
inFramework:(NSString*)frameworkName;
|
||||
@end
|
||||
|
||||
|
||||
|
@ -190,10 +190,10 @@ extern NSDictionary* globalMime;
|
|||
|
||||
//====================================================================
|
||||
@interface GSWResourceManager (GSWResourceManagerClassA)
|
||||
+(NSString*)GSLanguageFromISOLanguage:(NSString*)ISOLanguage_; //NDFN
|
||||
+(NSArray*)GSLanguagesFromISOLanguages:(NSArray*)ISOLanguages_; //NDFN
|
||||
+(NSString*)ISOLanguageFromGSLanguage:(NSString*)GSLanguage_; //NDFN
|
||||
+(NSArray*)ISOLanguagesFromGSLanguages:(NSArray*)GSLanguages_; //NDFN
|
||||
+(NSString*)GSLanguageFromISOLanguage:(NSString*)ISOLanguage; //NDFN
|
||||
+(NSArray*)GSLanguagesFromISOLanguages:(NSArray*)ISOlanguages; //NDFN
|
||||
+(NSString*)ISOLanguageFromGSLanguage:(NSString*)GSLanguage; //NDFN
|
||||
+(NSArray*)ISOLanguagesFromGSLanguages:(NSArray*)GSlanguages; //NDFN
|
||||
+(GSWBundle*)_applicationGSWBundle;
|
||||
@end
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,11 +1,16 @@
|
|||
/* GSWResourceURL.h - GSWeb: Class GSWResourceURL
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWResourceURL.h - <title>GSWeb: Class GSWResourceURL</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -31,8 +37,8 @@
|
|||
@end
|
||||
|
||||
@interface GSWResourceURL (GSWResourceURLA)
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
-(NSString*)valueAttributeName;
|
||||
-(NSString*)urlAttributeName;
|
||||
+(BOOL)hasGSWebObjectsAssociations;
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
/* GSWResourceURL.m - GSWeb: Class GSWResourceURL
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWResourceURL.m - <title>GSWeb: Class GSWResourceURL</title>
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +23,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -46,12 +51,12 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWResourceURL (GSWResourceURLA)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnStartC("GSWResourceURL");
|
||||
[self appendURLToResponse:response_
|
||||
inContext:context_];
|
||||
[self appendURLToResponse:response
|
||||
inContext:context];
|
||||
LOGObjectFnStopC("GSWResourceURL");
|
||||
};
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWString.h - GSWeb: Class GSWString
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWString.h - <title>GSWeb: Class GSWString</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,34 +35,36 @@
|
|||
|
||||
@interface GSWString: GSWHTMLDynamicElement
|
||||
{
|
||||
GSWAssociation* value;
|
||||
GSWAssociation* dateFormat;
|
||||
GSWAssociation* numberFormat;
|
||||
GSWAssociation* escapeHTML;
|
||||
GSWAssociation* _value;
|
||||
GSWAssociation* _dateFormat;
|
||||
GSWAssociation* _numberFormat;
|
||||
GSWAssociation* _escapeHTML;
|
||||
//GSWeb Additions {
|
||||
GSWAssociation* convertHTML;
|
||||
GSWAssociation* convertHTMLEntities;
|
||||
GSWAssociation* _convertHTML;
|
||||
GSWAssociation* _convertHTMLEntities;
|
||||
// }
|
||||
GSWAssociation* formatter;
|
||||
GSWAssociation* _formatter;
|
||||
};
|
||||
|
||||
-(void)dealloc;
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
|
||||
-(NSString*)description;
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping;
|
||||
-(BOOL)appendStringAtLeft:(id)_unkwnon
|
||||
withMapping:(char*)_mapping;
|
||||
-(NSFormatter*)formatterForComponent:(GSWComponent*)_component
|
||||
value:(id)value_;
|
||||
-(BOOL)appendStringAtRight:(id)unkwnon
|
||||
withMapping:(char*)mapping;
|
||||
|
||||
-(BOOL)appendStringAtLeft:(id)unkwnon
|
||||
withMapping:(char*)mapping;
|
||||
|
||||
-(NSFormatter*)formatterForComponent:(GSWComponent*)component
|
||||
value:(id)value;
|
||||
-(NSString*)elementName;
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWString.m - GSWeb: Class GSWString
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWString.m - <title>GSWeb: Class GSWString</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -30,50 +36,50 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWString
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)_elements
|
||||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
//OK
|
||||
LOGObjectFnStartC("GSWString");
|
||||
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements);
|
||||
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",
|
||||
aName,associations,elements);
|
||||
if ((self=[super initWithName:nil
|
||||
associations:nil
|
||||
contentElements:nil]))
|
||||
{
|
||||
value = [[associations_ objectForKey:value__Key
|
||||
withDefaultObject:[value autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: value=%@",value);
|
||||
associations:nil
|
||||
contentElements:nil]))
|
||||
{
|
||||
_value = [[associations objectForKey:value__Key
|
||||
withDefaultObject:[_value autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: value=%@",_value);
|
||||
|
||||
dateFormat = [[associations_ objectForKey:dateFormat__Key
|
||||
withDefaultObject:[dateFormat autorelease]] retain];
|
||||
_dateFormat = [[associations objectForKey:dateFormat__Key
|
||||
withDefaultObject:[_dateFormat autorelease]] retain];
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: dateFormat=%@",dateFormat);
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: dateFormat=%@",_dateFormat);
|
||||
|
||||
numberFormat = [[associations_ objectForKey:numberFormat__Key
|
||||
withDefaultObject:[numberFormat autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: numberFormat=%@",numberFormat);
|
||||
_numberFormat = [[associations objectForKey:numberFormat__Key
|
||||
withDefaultObject:[_numberFormat autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: numberFormat=%@",_numberFormat);
|
||||
|
||||
escapeHTML = [[associations_ objectForKey:escapeHTML__Key
|
||||
withDefaultObject:[escapeHTML autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: escapeHTML=%@",escapeHTML);
|
||||
_escapeHTML = [[associations objectForKey:escapeHTML__Key
|
||||
withDefaultObject:[_escapeHTML autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: escapeHTML=%@",_escapeHTML);
|
||||
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
convertHTML = [[associations_ objectForKey:convertHTML__Key
|
||||
withDefaultObject:[convertHTML autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: convertHTML=%@",convertHTML);
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
_convertHTML = [[associations objectForKey:convertHTML__Key
|
||||
withDefaultObject:[_convertHTML autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: convertHTML=%@",_convertHTML);
|
||||
|
||||
convertHTMLEntities = [[associations_ objectForKey:convertHTMLEntities__Key
|
||||
withDefaultObject:[convertHTMLEntities autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: convertHTMLEntities=%@",convertHTMLEntities);
|
||||
};
|
||||
|
||||
formatter = [[associations_ objectForKey:formatter__Key
|
||||
withDefaultObject:[formatter autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: formatter=%@",formatter);
|
||||
|
||||
};
|
||||
_convertHTMLEntities = [[associations objectForKey:convertHTMLEntities__Key
|
||||
withDefaultObject:[_convertHTMLEntities autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: convertHTMLEntities=%@",_convertHTMLEntities);
|
||||
};
|
||||
|
||||
_formatter = [[associations objectForKey:formatter__Key
|
||||
withDefaultObject:[_formatter autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: formatter=%@",_formatter);
|
||||
};
|
||||
LOGObjectFnStopC("GSWString");
|
||||
return self;
|
||||
};
|
||||
|
@ -81,13 +87,13 @@ static char rcsId[] = "$Id$";
|
|||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(value);
|
||||
DESTROY(dateFormat);
|
||||
DESTROY(numberFormat);
|
||||
DESTROY(escapeHTML);
|
||||
DESTROY(convertHTML); //GSWeb Only
|
||||
DESTROY(convertHTMLEntities); //GSWeb Only
|
||||
DESTROY(formatter);
|
||||
DESTROY(_value);
|
||||
DESTROY(_dateFormat);
|
||||
DESTROY(_numberFormat);
|
||||
DESTROY(_escapeHTML);
|
||||
DESTROY(_convertHTML); //GSWeb Only
|
||||
DESTROY(_convertHTMLEntities); //GSWeb Only
|
||||
DESTROY(_formatter);
|
||||
[super dealloc];
|
||||
};
|
||||
|
||||
|
@ -95,138 +101,138 @@ static char rcsId[] = "$Id$";
|
|||
-(NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%s %p - value=%@ dateFormat=%@ numberFormat=%@ escapeHTML=%@ formatter=%@>",
|
||||
object_get_class_name(self),
|
||||
(void*)self,
|
||||
value,
|
||||
dateFormat,
|
||||
numberFormat,
|
||||
escapeHTML,
|
||||
formatter];
|
||||
object_get_class_name(self),
|
||||
(void*)self,
|
||||
_value,
|
||||
_dateFormat,
|
||||
_numberFormat,
|
||||
_escapeHTML,
|
||||
_formatter];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
NSString* _formattedValue=nil;
|
||||
GSWRequest* _request=nil;
|
||||
BOOL _isFromClientComponent=NO;
|
||||
GSWComponent* _component=nil;
|
||||
id _valueValue = nil;
|
||||
NSString* formattedValue=nil;
|
||||
GSWRequest* request=nil;
|
||||
BOOL isFromClientComponent=NO;
|
||||
GSWComponent* component=nil;
|
||||
id valueValue = nil;
|
||||
LOGObjectFnStartC("GSWString");
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context_ elementID]);
|
||||
_request=[context_ request];
|
||||
_isFromClientComponent=[_request isFromClientComponent];
|
||||
_component=[context_ component];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: _component=%@",_component);
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: value=%@",value);
|
||||
_valueValue = [value valueInComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: _valueValue=%@",_valueValue);
|
||||
if (_valueValue)
|
||||
{
|
||||
BOOL _escapeHTMLValue=YES;
|
||||
BOOL _convertHTMLValue=NO;
|
||||
BOOL _convertHTMLEntitiesValue=NO;
|
||||
NSFormatter* _formatter=[self formatterForComponent:_component
|
||||
value:_valueValue];
|
||||
if (!_formatter)
|
||||
{
|
||||
_formattedValue=_valueValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
_formattedValue=[_formatter stringForObjectValue:_valueValue];
|
||||
NSDebugMLog(@"_valueValue=%@ _formattedValue=%@",_valueValue,_formattedValue);
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context elementID]);
|
||||
request=[context request];
|
||||
isFromClientComponent=[request isFromClientComponent];
|
||||
component=[context component];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: component=%@",component);
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: value=%@",_value);
|
||||
valueValue = [_value valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: valueValue=%@",valueValue);
|
||||
if (valueValue)
|
||||
{
|
||||
BOOL escapeHTMLValue=YES;
|
||||
BOOL convertHTMLValue=NO;
|
||||
BOOL convertHTMLEntitiesValue=NO;
|
||||
NSFormatter* formatter=[self formatterForComponent:component
|
||||
value:valueValue];
|
||||
if (!formatter)
|
||||
{
|
||||
formattedValue=valueValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
formattedValue=[formatter stringForObjectValue:valueValue];
|
||||
NSDebugMLog(@"valueValue=%@ formattedValue=%@",valueValue,formattedValue);
|
||||
};
|
||||
|
||||
if (!WOStrictFlag && convertHTML)
|
||||
_convertHTMLValue=[self evaluateCondition:convertHTML
|
||||
inContext:context_];
|
||||
if (!WOStrictFlag)
|
||||
if (!WOStrictFlag && _convertHTML)
|
||||
convertHTMLValue=[self evaluateCondition:_convertHTML
|
||||
inContext:context];
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
if (!convertHTMLValue)
|
||||
{
|
||||
if (!_convertHTMLValue)
|
||||
{
|
||||
if (convertHTMLEntities)
|
||||
_convertHTMLEntitiesValue=[self evaluateCondition:convertHTMLEntities
|
||||
inContext:context_];
|
||||
if (!_convertHTMLEntitiesValue)
|
||||
{
|
||||
if (escapeHTML)
|
||||
_escapeHTMLValue=[self evaluateCondition:escapeHTML
|
||||
inContext:context_];
|
||||
};
|
||||
};
|
||||
}
|
||||
else if (escapeHTML)
|
||||
_escapeHTMLValue=[self evaluateCondition:escapeHTML
|
||||
inContext:context_];
|
||||
if (_convertHTMLEntities)
|
||||
convertHTMLEntitiesValue=[self evaluateCondition:_convertHTMLEntities
|
||||
inContext:context];
|
||||
if (!convertHTMLEntitiesValue)
|
||||
{
|
||||
if (_escapeHTML)
|
||||
escapeHTMLValue=[self evaluateCondition:_escapeHTML
|
||||
inContext:context];
|
||||
};
|
||||
};
|
||||
}
|
||||
else if (_escapeHTML)
|
||||
escapeHTMLValue=[self evaluateCondition:_escapeHTML
|
||||
inContext:context];
|
||||
|
||||
if (!WOStrictFlag && _convertHTMLValue)
|
||||
[response_ appendContentHTMLConvertString:_formattedValue];
|
||||
else if (!WOStrictFlag && _convertHTMLEntitiesValue)
|
||||
[response_ appendContentHTMLEntitiesConvertString:_formattedValue];
|
||||
else if (_escapeHTMLValue)
|
||||
[response_ appendContentHTMLString:_formattedValue];
|
||||
else
|
||||
[response_ appendContentString:_formattedValue];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]);
|
||||
if (!WOStrictFlag && convertHTMLValue)
|
||||
[response appendContentHTMLConvertString:formattedValue];
|
||||
else if (!WOStrictFlag && convertHTMLEntitiesValue)
|
||||
[response appendContentHTMLEntitiesConvertString:formattedValue];
|
||||
else if (escapeHTMLValue)
|
||||
[response appendContentHTMLString:formattedValue];
|
||||
else
|
||||
[response appendContentString:formattedValue];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context elementID]);
|
||||
LOGObjectFnStopC("GSWString");
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping
|
||||
-(BOOL)appendStringAtRight:(id)unkwnon
|
||||
withMapping:(char*)mapping
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return NO;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(BOOL)appendStringAtLeft:(id)_unkwnon
|
||||
withMapping:(char*)_mapping
|
||||
-(BOOL)appendStringAtLeft:(id)unkwnon
|
||||
withMapping:(char*)mapping
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return NO;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(NSFormatter*)formatterForComponent:(GSWComponent*)_component
|
||||
value:(id)value_
|
||||
-(NSFormatter*)formatterForComponent:(GSWComponent*)component
|
||||
value:(id)value
|
||||
{
|
||||
//OK
|
||||
id _formatValue = nil;
|
||||
NSFormatter* _formatter = nil;
|
||||
id formatValue = nil;
|
||||
NSFormatter* formatter = nil;
|
||||
LOGObjectFnStartC("GSWString");
|
||||
if (dateFormat)
|
||||
{
|
||||
NSDebugMLog0(@"DateFormat");
|
||||
_formatValue=[dateFormat valueInComponent:_component];
|
||||
if (_formatValue)
|
||||
_formatter=[[[NSDateFormatter alloc]initWithDateFormat:_formatValue
|
||||
allowNaturalLanguage:YES]autorelease];
|
||||
}
|
||||
else if (numberFormat)
|
||||
{
|
||||
NSDebugMLog0(@"NumberFormat");
|
||||
_formatValue=[numberFormat valueInComponent:_component];
|
||||
if (_formatValue)
|
||||
{
|
||||
//TODO
|
||||
/* _formatter=[[NSNumberFormatter new]autorelease];
|
||||
[_formatter setFormat:_formatValue];
|
||||
*/
|
||||
};
|
||||
}
|
||||
if (_dateFormat)
|
||||
{
|
||||
NSDebugMLog0(@"DateFormat");
|
||||
formatValue=[_dateFormat valueInComponent:component];
|
||||
if (formatValue)
|
||||
formatter=[[[NSDateFormatter alloc]initWithDateFormat:formatValue
|
||||
allowNaturalLanguage:YES]autorelease];
|
||||
}
|
||||
else if (_numberFormat)
|
||||
{
|
||||
NSDebugMLog0(@"NumberFormat");
|
||||
formatValue=[_numberFormat valueInComponent:component];
|
||||
if (formatValue)
|
||||
{
|
||||
//TODO
|
||||
/* _formatter=[[NSNumberFormatter new]autorelease];
|
||||
[_formatter setFormat:_formatValue];
|
||||
*/
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLog0(@"Formatter");
|
||||
_formatter=[formatter valueInComponent:_component];
|
||||
};
|
||||
NSDebugMLog(@"_formatter=%@",_formatter);
|
||||
{
|
||||
NSDebugMLog0(@"Formatter");
|
||||
formatter=[_formatter valueInComponent:component];
|
||||
};
|
||||
NSDebugMLog(@"formatter=%@",formatter);
|
||||
LOGObjectFnStopC("GSWString");
|
||||
return _formatter;
|
||||
return formatter;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWSubmitButton.h - GSWeb: Class GSWSubmitButton
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWSubmitButton.h - <title>GSWeb: Class GSWSubmitButton</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,13 +35,13 @@
|
|||
//OK
|
||||
@interface GSWSubmitButton: GSWInput
|
||||
{
|
||||
GSWAssociation* action;
|
||||
GSWAssociation* actionClass;
|
||||
GSWAssociation* directActionName;
|
||||
GSWAssociation* _action;
|
||||
GSWAssociation* _actionClass;
|
||||
GSWAssociation* _directActionName;
|
||||
};
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
|
||||
-(void)dealloc;
|
||||
|
@ -43,20 +49,20 @@
|
|||
@end
|
||||
|
||||
@interface GSWSubmitButton (GSWSubmitButtonA)
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)appendNameToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendNameToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)_appendActionClassAndNameToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)_appendActionClassAndNameToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
#endif //_GSWSubmitButton_h__
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWSubmitButton.m - GSWeb: Class GSWSubmitButton
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWSubmitButton.m - <title>GSWeb: Class GSWSubmitButton</title>
|
||||
|
||||
Copyright (C) 1999-2002 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jan 1999
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,37 +35,39 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWSubmitButton
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)_elements
|
||||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_];
|
||||
NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements);
|
||||
[_associations setObject:[GSWAssociation associationWithValue:@"submit"]
|
||||
forKey:@"type"];
|
||||
[_associations removeObjectForKey:action__Key];
|
||||
[_associations removeObjectForKey:actionClass__Key];
|
||||
if (directActionName) [_associations removeObjectForKey:directActionName];
|
||||
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ _elements=%@",
|
||||
aName,associations,elements);
|
||||
[tmpAssociations setObject:[GSWAssociation associationWithValue:@"submit"]
|
||||
forKey:@"type"];
|
||||
[tmpAssociations removeObjectForKey:action__Key];
|
||||
[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])
|
||||
[_associations setObject:[GSWAssociation associationWithValue:@"submit"]
|
||||
forKey:value__Key];
|
||||
|
||||
if ((self=[super initWithName:name_
|
||||
associations:_associations
|
||||
contentElements:nil]))
|
||||
{
|
||||
action = [[associations_ objectForKey:action__Key
|
||||
withDefaultObject:[action autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWSumbitButton: action=%@",action);
|
||||
actionClass = [[associations_ objectForKey:actionClass__Key
|
||||
withDefaultObject:[actionClass autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWSumbitButton: actionClass=%@",actionClass);
|
||||
directActionName = [[associations_ objectForKey:directActionName__Key
|
||||
withDefaultObject:[directActionName autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWSumbitButton: directActionName=%@",directActionName);
|
||||
};
|
||||
if ((self=[super initWithName:aName
|
||||
associations:tmpAssociations
|
||||
contentElements:nil]))
|
||||
{
|
||||
_action = [[associations objectForKey:action__Key
|
||||
withDefaultObject:[_action autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWSumbitButton: action=%@",_action);
|
||||
_actionClass = [[associations objectForKey:actionClass__Key
|
||||
withDefaultObject:[_actionClass autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWSumbitButton: actionClass=%@",_actionClass);
|
||||
_directActionName = [[associations objectForKey:directActionName__Key
|
||||
withDefaultObject:[_directActionName autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWSumbitButton: directActionName=%@",_directActionName);
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
return self;
|
||||
};
|
||||
|
@ -67,9 +75,9 @@ static char rcsId[] = "$Id$";
|
|||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(action);
|
||||
DESTROY(actionClass);
|
||||
DESTROY(directActionName);
|
||||
DESTROY(_action);
|
||||
DESTROY(_actionClass);
|
||||
DESTROY(_directActionName);
|
||||
[super dealloc];
|
||||
};
|
||||
|
||||
|
@ -79,146 +87,148 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWSubmitButton (GSWSubmitButtonA)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
LOGObjectFnStart();
|
||||
GSWSaveAppendToResponseElementID(context_);//Debug Only
|
||||
[super appendToResponse:response_
|
||||
inContext:context_];
|
||||
GSWSaveAppendToResponseElementID(context);//Debug Only
|
||||
[super appendToResponse:response
|
||||
inContext:context];
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
GSWElement* _element=nil;
|
||||
BOOL _disabled=NO;
|
||||
GSWElement* element=nil;
|
||||
BOOL disabledValue=NO;
|
||||
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
|
||||
{
|
||||
GSWAssertCorrectElementID(context_);// Debug Only
|
||||
_disabled=[self disabledInContext:context_];
|
||||
NSDebugMLLog(@"gswdync",@"_disabled=%s",(_disabled ? "YES" : "NO"));
|
||||
if (!_disabled)
|
||||
{
|
||||
BOOL _wasFormSubmitted=[context_ _wasFormSubmitted];
|
||||
if (_wasFormSubmitted)
|
||||
{
|
||||
BOOL _invoked=NO;
|
||||
GSWComponent* _component=[context_ component];
|
||||
BOOL _isMultipleSubmitForm=[context_ _isMultipleSubmitForm];
|
||||
if (_isMultipleSubmitForm)
|
||||
{
|
||||
NSString* _nameInContext=[self nameInContext:context_];
|
||||
NSString* _formValue=[request_ formValueForKey:_nameInContext];
|
||||
NSDebugMLLog(@"gswdync",@"_formValue=%@",_formValue);
|
||||
if (_formValue)
|
||||
_invoked=YES;
|
||||
else
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"[request_ formValueKeys]=%@",[request_ formValueKeys]);
|
||||
};
|
||||
}
|
||||
else
|
||||
_invoked=YES;
|
||||
if (_invoked)
|
||||
{
|
||||
id _actionValue=nil;
|
||||
NSDebugMLLog0(@"gswdync",@"Invoked Object Found !!");
|
||||
[context_ _setActionInvoked:1];
|
||||
NS_DURING
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"Invoked Object Found: action=%@",action);
|
||||
_actionValue=[action valueInComponent:_component];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
LOGException0(@"exception in GSWSubmitButton invokeActionForRequest:inContext action");
|
||||
LOGException(@"exception=%@",localException);
|
||||
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
|
||||
@"In GSWSubmitButton invokeActionForRequest:inContext action %@",action);
|
||||
LOGException(@"exception=%@",localException);
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
if (_actionValue)
|
||||
_element=_actionValue;
|
||||
if (_element)
|
||||
{
|
||||
if (![_element isKindOfClass:[GSWComponent class]]) //TODO GSWComponent or Element ?
|
||||
{
|
||||
ExceptionRaise0(@"GSWHyperlink",@"Invoked element return a not GSWComponent element");
|
||||
}
|
||||
else
|
||||
{
|
||||
// call awakeInContext when _element is sleeping deeply
|
||||
[_element ensureAwakeInContext:context_];
|
||||
/*
|
||||
if (![_element context]) {
|
||||
NSDebugMLLog(@"gswdync",@"_element sleeps, awake it = %@",_element);
|
||||
[_element awakeInContext:context_];
|
||||
} else {
|
||||
[_element awakeInContext:context_];
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
/* ???
|
||||
if (!_element)
|
||||
_element=[context_ page];
|
||||
*/
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
{
|
||||
GSWAssertCorrectElementID(context);// Debug Only
|
||||
disabledValue=[self disabledInContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"disabledValue=%s",(disabledValue ? "YES" : "NO"));
|
||||
if (!disabledValue)
|
||||
{
|
||||
BOOL wasFormSubmitted=[context _wasFormSubmitted];
|
||||
if (wasFormSubmitted)
|
||||
{
|
||||
BOOL invoked=NO;
|
||||
GSWComponent* component=[context component];
|
||||
BOOL isMultipleSubmitForm=[context _isMultipleSubmitForm];
|
||||
if (isMultipleSubmitForm)
|
||||
{
|
||||
NSString* nameInContext=[self nameInContext:context];
|
||||
NSString* formValue=[request formValueForKey:nameInContext];
|
||||
NSDebugMLLog(@"gswdync",@"formValue=%@",formValue);
|
||||
if (formValue)
|
||||
invoked=YES;
|
||||
else
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"[request formValueKeys]=%@",[request formValueKeys]);
|
||||
};
|
||||
}
|
||||
else
|
||||
invoked=YES;
|
||||
if (invoked)
|
||||
{
|
||||
id actionValue=nil;
|
||||
NSDebugMLLog0(@"gswdync",@"Invoked Object Found !!");
|
||||
[context setActionInvoked:1];
|
||||
NS_DURING
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"Invoked Object Found: action=%@",_action);
|
||||
actionValue=[_action valueInComponent:component];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
LOGException0(@"exception in GSWSubmitButton invokeActionForRequest:inContext action");
|
||||
LOGException(@"exception=%@",localException);
|
||||
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
|
||||
@"In GSWSubmitButton invokeActionForRequest:inContext action %@",
|
||||
_action);
|
||||
LOGException(@"exception=%@",localException);
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
if (actionValue)
|
||||
element=actionValue;
|
||||
if (element)
|
||||
{
|
||||
if (![element isKindOfClass:[GSWComponent class]]) //TODO GSWComponent or Element ?
|
||||
{
|
||||
ExceptionRaise0(@"GSWHyperlink",@"Invoked element return a not GSWComponent element");
|
||||
}
|
||||
else
|
||||
{
|
||||
// call awakeInContext when _element is sleeping deeply
|
||||
[element ensureAwakeInContext:context];
|
||||
/*
|
||||
if (![_element context]) {
|
||||
NSDebugMLLog(@"gswdync",@"_element sleeps, awake it = %@",_element);
|
||||
[_element awakeInContext:context];
|
||||
} else {
|
||||
[_element awakeInContext:context];
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
/* ???
|
||||
if (!_element)
|
||||
_element=[context page];
|
||||
*/
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
LOGException0(@"exception in GSWSubmitButton invokeActionForRequest:inContext");
|
||||
LOGException(@"exception=%@",localException);
|
||||
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
|
||||
@"In GSWSubmitButton invokeActionForRequest:inContext");
|
||||
LOGException(@"exception=%@",localException);
|
||||
[localException raise];
|
||||
}
|
||||
{
|
||||
LOGException0(@"exception in GSWSubmitButton invokeActionForRequest:inContext");
|
||||
LOGException(@"exception=%@",localException);
|
||||
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
|
||||
@"In GSWSubmitButton invokeActionForRequest:inContext");
|
||||
LOGException(@"exception=%@",localException);
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
//if (![context_ _wasActionInvoked] && [[[context_ elementID] parentElementIDString] compare:[context_ senderID]]!=NSOrderedAscending)
|
||||
if (![context_ _wasActionInvoked] && [[[context_ elementID] parentElementIDString] isSearchOverForSenderID:[context_ senderID]])
|
||||
{
|
||||
LOGError(@"Action not invoked at the end of %@ (id=%@) senderId=%@",
|
||||
[self class],
|
||||
[context_ elementID],
|
||||
[context_ senderID]);
|
||||
};
|
||||
//if (![context _wasActionInvoked] && [[[context elementID] parentElementIDString] compare:[context senderID]]!=NSOrderedAscending)
|
||||
if (![context _wasActionInvoked] && [[[context elementID] parentElementIDString] isSearchOverForSenderID:[context senderID]])
|
||||
{
|
||||
LOGError(@"Action not invoked at the end of %@ (id=%@) senderId=%@",
|
||||
[self class],
|
||||
[context elementID],
|
||||
[context senderID]);
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
return _element;
|
||||
return element;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//Does Nothing ?
|
||||
GSWAssertCorrectElementID(context_);// Debug Only
|
||||
GSWAssertCorrectElementID(context);// Debug Only
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendNameToResponse:(GSWResponse*)_response
|
||||
inContext:(GSWContext*)_context
|
||||
-(void)appendNameToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
//Here we call parent (GSWInput) method instead of doing it by ourself (as GSW)
|
||||
[super appendNameToResponse:_response
|
||||
inContext:_context];
|
||||
[super appendNameToResponse:response
|
||||
inContext:context];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)_appendActionClassAndNameToResponse:(GSWResponse*)_response
|
||||
inContext:(GSWContext*)_context
|
||||
-(void)_appendActionClassAndNameToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWText.h - GSWeb: Class GSWText
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWText.h - <title>GSWeb: Class GSWText</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -30,9 +36,9 @@
|
|||
//====================================================================
|
||||
@interface GSWText: GSWInput
|
||||
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
-(void)dealloc;
|
||||
|
||||
-(NSString*)description;
|
||||
|
@ -42,18 +48,18 @@
|
|||
|
||||
//====================================================================
|
||||
@interface GSWText (GSWTextA)
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(NSString*)_filterSoftReturnsFromString:(NSString*)string_;
|
||||
-(NSString*)_filterSoftReturnsFromString:(NSString*)string;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWText (GSWTextB)
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping;
|
||||
-(BOOL)appendStringAtRight:(id)unkwnon
|
||||
withMapping:(char*)mapping;
|
||||
@end
|
||||
#endif //_GSWText_h__
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWText.h - GSWeb: Class GSWText
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWText.m - <title>GSWeb: Class GSWText</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,15 +35,15 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWText
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
if ((self=[super initWithName:name_
|
||||
associations:associations_
|
||||
contentElements:nil]))
|
||||
{
|
||||
};
|
||||
if ((self=[super initWithName:name
|
||||
associations:associations
|
||||
contentElements:nil]))
|
||||
{
|
||||
};
|
||||
return self;
|
||||
};
|
||||
|
||||
|
@ -51,8 +57,8 @@ static char rcsId[] = "$Id$";
|
|||
-(NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%s %p>",
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -67,67 +73,67 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWText (GSWTextA)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
if (value && [value isValueSettable])
|
||||
{
|
||||
GSWComponent* _component=[context_ component];
|
||||
id _formValue=[request_ formValueForKey:[context_ elementID]];
|
||||
if (!WOStrictFlag)
|
||||
if (_value && [_value isValueSettable])
|
||||
{
|
||||
GSWComponent* component=[context component];
|
||||
id formValue=[request formValueForKey:[context elementID]];
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[value setValue:_formValue
|
||||
inComponent:_component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
[_value setValue:formValue
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context];
|
||||
}
|
||||
else
|
||||
[value setValue:_formValue
|
||||
inComponent:_component];
|
||||
};
|
||||
[super takeValuesFromRequest:request_
|
||||
inContext:context_];
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
[_value setValue:formValue
|
||||
inComponent:component];
|
||||
};
|
||||
[super takeValuesFromRequest:request
|
||||
inContext:context];
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
GSWRequest* _request=[context_ request];
|
||||
NSString* _valueValue=nil;
|
||||
NSString* _valueValueFiltered=nil;
|
||||
BOOL _isFromClientComponent=[_request isFromClientComponent];
|
||||
GSWComponent* _component=[context_ component];
|
||||
[super appendToResponse:response_
|
||||
inContext:context_];
|
||||
_valueValue=[value valueInComponent:_component];
|
||||
_valueValueFiltered=[self _filterSoftReturnsFromString:_valueValue];
|
||||
[response_ appendContentHTMLString:_valueValueFiltered];
|
||||
[response_ _appendContentAsciiString:@"</TEXTAREA>"];
|
||||
GSWRequest* request=[context request];
|
||||
NSString* valueValue=nil;
|
||||
NSString* valueValueFiltered=nil;
|
||||
BOOL isFromClientComponent=[request isFromClientComponent];
|
||||
GSWComponent* component=[context component];
|
||||
[super appendToResponse:response
|
||||
inContext:context];
|
||||
valueValue=[_value valueInComponent:component];
|
||||
valueValueFiltered=[self _filterSoftReturnsFromString:valueValue];
|
||||
[response appendContentHTMLString:valueValueFiltered];
|
||||
[response _appendContentAsciiString:@"</TEXTAREA>"];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(NSString*)_filterSoftReturnsFromString:(NSString*)string_
|
||||
-(NSString*)_filterSoftReturnsFromString:(NSString*)string
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return string_;
|
||||
return string;
|
||||
};
|
||||
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@implementation GSWText (GSWTextB)
|
||||
-(BOOL)appendStringAtRight:(id)_unkwnon
|
||||
withMapping:(char*)_mapping
|
||||
-(BOOL)appendStringAtRight:(id)unkwnon
|
||||
withMapping:(char*)mapping
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return NO;
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWTextField.h - GSWeb: Class GSWTextField
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWTextField.h - <title>GSWeb: Class GSWTextField</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
@ -29,20 +35,20 @@
|
|||
//OK
|
||||
@interface GSWTextField: GSWInput
|
||||
{
|
||||
GSWAssociation* dateFormat;
|
||||
GSWAssociation* numberFormat;
|
||||
GSWAssociation* useDecimalNumber;
|
||||
GSWAssociation* formatter;
|
||||
GSWAssociation* _dateFormat;
|
||||
GSWAssociation* _numberFormat;
|
||||
GSWAssociation* _useDecimalNumber;
|
||||
GSWAssociation* _formatter;
|
||||
};
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_;
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
-(void)dealloc;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
-(NSFormatter*)formatterForComponent:(GSWComponent*)_component;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
-(NSFormatter*)formatterForComponent:(GSWComponent*)component;
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
/* GSWTextField.h - GSWeb: Class GSWTextField
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/** GSWTextField.m - <title>GSWeb: Class GSWTextField</title>
|
||||
|
||||
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
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
@ -19,7 +24,8 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
</license>
|
||||
**/
|
||||
|
||||
static char rcsId[] = "$Id$";
|
||||
|
||||
|
@ -29,36 +35,36 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWTextField
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithName:(NSString*)name_
|
||||
associations:(NSDictionary*)associations_
|
||||
contentElements:(NSArray*)elements_
|
||||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements
|
||||
{
|
||||
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_];
|
||||
NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
|
||||
LOGObjectFnStartC("GSWTextField");
|
||||
NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_);
|
||||
[_associations setObject:[GSWAssociation associationWithValue:@"text"]
|
||||
forKey:@"type"];
|
||||
[_associations removeObjectForKey:dateFormat__Key];
|
||||
[_associations removeObjectForKey:numberFormat__Key];
|
||||
[_associations removeObjectForKey:useDecimalNumber__Key];
|
||||
[_associations removeObjectForKey:formatter__Key];
|
||||
if ((self=[super initWithName:name_
|
||||
associations:_associations
|
||||
contentElements:nil])) //No Childs!
|
||||
{
|
||||
dateFormat = [[associations_ objectForKey:dateFormat__Key
|
||||
withDefaultObject:[dateFormat autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWTextField: dateFormat=%@",dateFormat);
|
||||
numberFormat = [[associations_ objectForKey:numberFormat__Key
|
||||
withDefaultObject:[numberFormat autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWTextField: numberFormat=%@",numberFormat);
|
||||
useDecimalNumber = [[associations_ objectForKey:useDecimalNumber__Key
|
||||
withDefaultObject:[useDecimalNumber autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWTextField: useDecimalNumber=%@",useDecimalNumber);
|
||||
formatter = [[associations_ objectForKey:formatter__Key
|
||||
withDefaultObject:[formatter autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWTextField: formatter=%@",formatter);
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",aName,associations,elements);
|
||||
[tmpAssociations setObject:[GSWAssociation associationWithValue:@"text"]
|
||||
forKey:@"type"];
|
||||
[tmpAssociations removeObjectForKey:dateFormat__Key];
|
||||
[tmpAssociations removeObjectForKey:numberFormat__Key];
|
||||
[tmpAssociations removeObjectForKey:useDecimalNumber__Key];
|
||||
[tmpAssociations removeObjectForKey:formatter__Key];
|
||||
if ((self=[super initWithName:aName
|
||||
associations:tmpAssociations
|
||||
contentElements:nil])) //No Childs!
|
||||
{
|
||||
_dateFormat = [[associations objectForKey:dateFormat__Key
|
||||
withDefaultObject:[_dateFormat autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWTextField: dateFormat=%@",_dateFormat);
|
||||
_numberFormat = [[associations objectForKey:numberFormat__Key
|
||||
withDefaultObject:[_numberFormat autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWTextField: numberFormat=%@",_numberFormat);
|
||||
_useDecimalNumber = [[associations objectForKey:useDecimalNumber__Key
|
||||
withDefaultObject:[_useDecimalNumber autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWTextField: useDecimalNumber=%@",_useDecimalNumber);
|
||||
_formatter = [[associations objectForKey:formatter__Key
|
||||
withDefaultObject:[_formatter autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"GSWTextField: formatter=%@",_formatter);
|
||||
};
|
||||
LOGObjectFnStopC("GSWTextField");
|
||||
return self;
|
||||
};
|
||||
|
@ -66,167 +72,171 @@ static char rcsId[] = "$Id$";
|
|||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(dateFormat);
|
||||
DESTROY(numberFormat);
|
||||
DESTROY(useDecimalNumber);
|
||||
DESTROY(formatter);
|
||||
DESTROY(_dateFormat);
|
||||
DESTROY(_numberFormat);
|
||||
DESTROY(_useDecimalNumber);
|
||||
DESTROY(_formatter);
|
||||
[super dealloc];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request_
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
BOOL _disabled=NO;
|
||||
BOOL disabledValue=NO;
|
||||
LOGObjectFnStartC("GSWTextField");
|
||||
GSWAssertCorrectElementID(context_);// Debug Only
|
||||
_disabled=[self disabledInContext:context_];
|
||||
if (!_disabled)
|
||||
{
|
||||
BOOL _wasFormSubmitted=[context_ _wasFormSubmitted];
|
||||
if (_wasFormSubmitted)
|
||||
{
|
||||
GSWComponent* _component=[context_ component];
|
||||
NSString* _nameInContext=[self nameInContext:context_];
|
||||
NSString* _value=[request_ formValueForKey:_nameInContext];
|
||||
id _resultValue=nil;
|
||||
NSDebugMLLog(@"gswdync",@"_nameInContext=%@",_nameInContext);
|
||||
NSDebugMLLog(@"gswdync",@"_value=%@",_value);
|
||||
if (_value)
|
||||
{
|
||||
NSFormatter* _formatter=[self formatterForComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"_formatter=%@",_formatter);
|
||||
if (_formatter)
|
||||
{
|
||||
NSString* _errorDscr=nil;
|
||||
if (![_formatter getObjectValue:&_resultValue
|
||||
forString:_value
|
||||
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)
|
||||
GSWAssertCorrectElementID(context);// Debug Only
|
||||
disabledValue=[self disabledInContext:context];
|
||||
if (!disabledValue)
|
||||
{
|
||||
BOOL wasFormSubmitted=[context _wasFormSubmitted];
|
||||
if (wasFormSubmitted)
|
||||
{
|
||||
GSWComponent* component=[context component];
|
||||
NSString* nameInContext=[self nameInContext:context];
|
||||
NSString* value=[request formValueForKey:nameInContext];
|
||||
id resultValue=nil;
|
||||
NSDebugMLLog(@"gswdync",@"nameInContext=%@",nameInContext);
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",value);
|
||||
if (value)
|
||||
{
|
||||
NSFormatter* formatter=[self formatterForComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"formatter=%@",formatter);
|
||||
if (formatter)
|
||||
{
|
||||
NSString* errorDscr=nil;
|
||||
if (![formatter getObjectValue:&resultValue
|
||||
forString:value
|
||||
errorDescription:&errorDscr])
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[value setValue:_resultValue
|
||||
inComponent:_component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context_];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
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
|
||||
{
|
||||
[_value setValue:resultValue
|
||||
inComponent:component];
|
||||
};
|
||||
NS_HANDLER
|
||||
{
|
||||
[self handleValidationException:localException
|
||||
inContext:context];
|
||||
}
|
||||
else
|
||||
[value setValue:_resultValue
|
||||
inComponent:_component];
|
||||
}
|
||||
};
|
||||
};
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
else
|
||||
[_value setValue:resultValue
|
||||
inComponent:component];
|
||||
}
|
||||
};
|
||||
};
|
||||
LOGObjectFnStopC("GSWTextField");
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)_response
|
||||
inContext:(GSWContext*)context_
|
||||
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
id _valueValue=nil;
|
||||
id _formattedValue=nil;
|
||||
NSFormatter* _formatter=nil;
|
||||
GSWComponent* _component=nil;
|
||||
id _valueTmp=nil;
|
||||
id valueValue=nil;
|
||||
id formattedValue=nil;
|
||||
NSFormatter* formatter=nil;
|
||||
GSWComponent* component=nil;
|
||||
id valueTmp=nil;
|
||||
LOGObjectFnStartC("GSWTextField");
|
||||
_component=[context_ component];
|
||||
component=[context component];
|
||||
//To avoid input value printing (stupid original hack !)
|
||||
_valueTmp=value;
|
||||
value=nil;
|
||||
[super appendGSWebObjectsAssociationsToResponse:_response
|
||||
inContext:context_];
|
||||
valueTmp=_value;
|
||||
_value=nil;
|
||||
[super appendGSWebObjectsAssociationsToResponse:response
|
||||
inContext:context];
|
||||
//To avoid input value printing (stupid original hack !)
|
||||
value=_valueTmp;
|
||||
_valueTmp=nil;
|
||||
_valueValue=[value valueInComponent:_component];
|
||||
_formatter=[self formatterForComponent:_component];
|
||||
if (!_formatter)
|
||||
{
|
||||
NSDebugMLog0(@"No Formatter");
|
||||
_formattedValue=_valueValue;
|
||||
}
|
||||
_value=valueTmp;
|
||||
valueTmp=nil;
|
||||
valueValue=[_value valueInComponent:component];
|
||||
formatter=[self formatterForComponent:component];
|
||||
if (!formatter)
|
||||
{
|
||||
NSDebugMLog0(@"No Formatter");
|
||||
formattedValue=valueValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
_formattedValue=[_formatter stringForObjectValue:_valueValue];
|
||||
};
|
||||
[_response appendContentCharacter:' '];
|
||||
[_response _appendContentAsciiString:@"value"];
|
||||
[_response appendContentCharacter:'='];
|
||||
[_response appendContentCharacter:'"'];
|
||||
[_response appendContentHTMLAttributeValue:_formattedValue];
|
||||
[_response appendContentCharacter:'"'];
|
||||
{
|
||||
formattedValue=[formatter stringForObjectValue:valueValue];
|
||||
};
|
||||
[response appendContentCharacter:' '];
|
||||
[response _appendContentAsciiString:@"value"];
|
||||
[response appendContentCharacter:'='];
|
||||
[response appendContentCharacter:'"'];
|
||||
[response appendContentHTMLAttributeValue:formattedValue];
|
||||
[response appendContentCharacter:'"'];
|
||||
LOGObjectFnStopC("GSWTextField");
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(NSFormatter*)formatterForComponent:(GSWComponent*)_component
|
||||
-(NSFormatter*)formatterForComponent:(GSWComponent*)component
|
||||
{
|
||||
//OK
|
||||
id _formatValue = nil;
|
||||
id _formatter = nil;
|
||||
id formatValue = nil;
|
||||
id formatter = nil;
|
||||
LOGObjectFnStartC("GSWTextField");
|
||||
if (dateFormat)
|
||||
{
|
||||
NSDebugMLog0(@"DateFormat");
|
||||
_formatValue=[dateFormat valueInComponent:_component];
|
||||
if (_formatValue)
|
||||
_formatter=[[[NSDateFormatter alloc]initWithDateFormat:_formatValue
|
||||
allowNaturalLanguage:YES]autorelease];
|
||||
}
|
||||
else if (numberFormat)
|
||||
{
|
||||
NSDebugMLog0(@"NumberFormat");
|
||||
_formatValue=[numberFormat valueInComponent:_component];
|
||||
if (_formatValue)
|
||||
{
|
||||
//TODO
|
||||
/*
|
||||
_formatter=[[NSNumberFormatter new]autorelease];
|
||||
[_formatter setFormat:_formatValue];
|
||||
*/
|
||||
};
|
||||
}
|
||||
if (_dateFormat)
|
||||
{
|
||||
NSDebugMLog0(@"DateFormat");
|
||||
formatValue=[_dateFormat valueInComponent:component];
|
||||
if (formatValue)
|
||||
formatter=[[[NSDateFormatter alloc]initWithDateFormat:formatValue
|
||||
allowNaturalLanguage:YES]autorelease];
|
||||
}
|
||||
else if (_numberFormat)
|
||||
{
|
||||
NSDebugMLog0(@"NumberFormat");
|
||||
formatValue=[_numberFormat valueInComponent:component];
|
||||
if (formatValue)
|
||||
{
|
||||
//TODO
|
||||
/*
|
||||
formatter=[[NSNumberFormatter new]autorelease];
|
||||
[formatter setFormat:formatValue];
|
||||
*/
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLog0(@"Formatter");
|
||||
_formatter=[formatter valueInComponent:_component];
|
||||
};
|
||||
{
|
||||
NSDebugMLog0(@"Formatter");
|
||||
formatter=[_formatter valueInComponent:component];
|
||||
};
|
||||
LOGObjectFnStopC("GSWTextField");
|
||||
return _formatter;
|
||||
return formatter;
|
||||
};
|
||||
|
||||
@end
|
||||
|
@ -235,32 +245,36 @@ static char rcsId[] = "$Id$";
|
|||
@implementation GSWTextField (TurbocatAdditions)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
- (BOOL)_isFormattedValueInComponent:(GSWComponent *)_component equalToFormattedValue:(NSString *)newFormattedValue
|
||||
- (BOOL)_isFormattedValueInComponent:(GSWComponent *)component
|
||||
equalToFormattedValue:(NSString *)newFormattedValue
|
||||
{
|
||||
id _valueValue=nil;
|
||||
id _formattedValue=nil;
|
||||
NSFormatter* _formatter=nil;
|
||||
|
||||
if (!newFormattedValue) {
|
||||
return NO;
|
||||
}
|
||||
id valueValue=nil;
|
||||
id formattedValue=nil;
|
||||
NSFormatter* formatter=nil;
|
||||
|
||||
if (!newFormattedValue)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
// get own value
|
||||
_valueValue=[value valueInComponent:_component];
|
||||
_formatter=[self formatterForComponent:_component];
|
||||
if (!_formatter)
|
||||
{
|
||||
//NSLog(@"No Formatter in _isFormattedValueInComponent");
|
||||
_formattedValue=_valueValue;
|
||||
}
|
||||
valueValue=[_value valueInComponent:component];
|
||||
formatter=[self formatterForComponent:component];
|
||||
if (!formatter)
|
||||
{
|
||||
formattedValue=valueValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
_formattedValue=[_formatter stringForObjectValue:_valueValue];
|
||||
};
|
||||
{
|
||||
formattedValue=[formatter stringForObjectValue:valueValue];
|
||||
};
|
||||
|
||||
if (_formattedValue && [newFormattedValue isEqualToString:_formattedValue]) {
|
||||
NSLog(@"### GSWTextField : are EQUAL ###");
|
||||
return YES;
|
||||
}
|
||||
if (formattedValue && [newFormattedValue isEqualToString:formattedValue])
|
||||
{
|
||||
NSLog(@"### GSWTextField : are EQUAL ###");
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -52,7 +52,7 @@ BOOL boolValueFor(id id_)
|
|||
return YES;
|
||||
else if (/*id_==BNNO ||*/ id_==NSTNO)
|
||||
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);
|
||||
else if ([id_ respondsToSelector:@selector(boolValue)] && [id_ boolValue])
|
||||
return YES;
|
||||
|
@ -78,7 +78,7 @@ BOOL boolValueWithDefaultFor(id id_,BOOL default_)
|
|||
else if (/*id_==BNNO ||*/ id_==NSTNO)
|
||||
return NO;
|
||||
//@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);
|
||||
else if ([id_ respondsToSelector:@selector(boolValue)])
|
||||
return ([id_ boolValue]!=NO);
|
||||
|
|
Loading…
Reference in a new issue