2002-03-25 Manuel Guesdon <mguesdon@orange-concept.com>

* GSWAdaptors/common/GSWConfig.c: changed comments
	* GSWeb.framework/GSWSwitchComponent.h/.m:
		o ivar names changes to conform to coding standards
		o logs
	* GSWeb.framework/GSWComponentContent.h/.m:
		o ivar names changes to conform to coding standards
		o logs
	* GSWAdaptors/common/GSWTemplates.c:
		o change .gif to .png
	* GSWeb.framework/GSWAssociation.m:
		o Added Key/Value association conversion in associationsSetValuesFromObject:inObject:
	* GSWeb.framework/GSWKeyValueAssociation.m:
		o removed validateValue in -setValue:inObject:
		o logs
	* GSWeb.framework/GSWConstantValueAssociation.m
		o logs


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@13232 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mguesdon 2002-03-25 12:47:44 +00:00
parent c55ab0d675
commit a7860d4741
19 changed files with 815 additions and 701 deletions

View file

@ -1,3 +1,22 @@
2002-03-25 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWAdaptors/common/GSWConfig.c: changed comments
* GSWeb.framework/GSWSwitchComponent.h/.m:
o ivar names changes to conform to coding standards
o logs
* GSWeb.framework/GSWComponentContent.h/.m:
o ivar names changes to conform to coding standards
o logs
* GSWAdaptors/common/GSWTemplates.c:
o change .gif to .png
* GSWeb.framework/GSWAssociation.m:
o Added Key/Value association conversion in associationsSetValuesFromObject:inObject:
* GSWeb.framework/GSWKeyValueAssociation.m:
o removed validateValue in -setValue:inObject:
o logs
* GSWeb.framework/GSWConstantValueAssociation.m
o logs
2002-03-07 Manuel Guesdon <mguesdon@orange-concept.com> 2002-03-07 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWAdaptor.h/.m: * GSWeb.framework/GSWAdaptor.h/.m:

View file

@ -165,10 +165,10 @@ CONST char* GSWConfig_GetConfigFilePath()
/*{ /*{
canDumpStatus=NO; canDumpStatus=NO;
GSWExtensionsFrameworkWebServerResources="/GSW/GSWExtensions/WebServerResources" GSWExtensionsFrameworkWebServerResources="/GSW/GSWExtensions/Resources/WebServer"
applications= { applications= {
MyApp1 = { MyApp1 = {
GSWExtensionsFrameworkWebServerResources="/GSW/GSWExtensions/WebServerResources" GSWExtensionsFrameworkWebServerResources="/GSW/GSWExtensions/Resources/WebServer"
instances = { instances = {
1 = { 1 = {
host=12.13.14.15; host=12.13.14.15;

View file

@ -39,7 +39,7 @@ const char* g_szErrorResponseTextTemplate[2]={
"<HTML><BODY BGCOLOR=\"#FFFFFF\">\n" "<HTML><BODY BGCOLOR=\"#FFFFFF\">\n"
"<CENTER><H1>##TEXT##</H1></CENTER>\n" "<CENTER><H1>##TEXT##</H1></CENTER>\n"
"<BR>\n" "<BR>\n"
"<CENTER><A HREF=\"http://www.gnustepweb.org\"><IMG SRC=\"##GSWEXTFWKWSR##/PoweredByGNUstepWeb.gif\" ALT=\"Powered By GNUstepWeb\" BORDER=0></A></CENTER>\n" "<CENTER><A HREF=\"http://www.gnustepweb.org\"><IMG SRC=\"##GSWEXTFWKWSR##/PoweredByGNUstepWeb.png\" ALT=\"Powered By GNUstepWeb\" BORDER=0></A></CENTER>\n"
"</BODY></HTML>\n"}; "</BODY></HTML>\n"};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -62,7 +62,7 @@ const char* g_szStatusResponseAllowedTemplate[2]={
"<p><strong>Headers:</strong><br>\n" "<p><strong>Headers:</strong><br>\n"
"##HEADERS##\n" "##HEADERS##\n"
"<BR>\n" "<BR>\n"
"<CENTER><A HREF=\"http://www.gnustepweb.org\"><IMG SRC=\"##GSWEXTFWKWSR##/PoweredByGNUstepWeb.gif\" ALT=\"Powered By GNUstepWeb\" BORDER=0></A></CENTER>\n" "<CENTER><A HREF=\"http://www.gnustepweb.org\"><IMG SRC=\"##GSWEXTFWKWSR##/PoweredByGNUstepWeb.png\" ALT=\"Powered By GNUstepWeb\" BORDER=0></A></CENTER>\n"
"</BODY></HTML>\n"}; "</BODY></HTML>\n"};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -73,7 +73,7 @@ const char* g_szStatusResponseDeniedTemplate[2]={
"<BODY BGCOLOR=\"#FFFFFF\">\n" "<BODY BGCOLOR=\"#FFFFFF\">\n"
"<CENTER><H1>Don't play with me ##REMOTE_ADDR## ##REMOTE_HOST##, I'll win!</H1></CENTER>" "<CENTER><H1>Don't play with me ##REMOTE_ADDR## ##REMOTE_HOST##, I'll win!</H1></CENTER>"
"<BR>\n" "<BR>\n"
"<CENTER><A HREF=\"http://www.gnustepweb.org\"><IMG SRC=\"##GSWEXTFWKWSR##/PoweredByGNUstepWeb.gif\" ALT=\"Powered By GNUstepWeb\" BORDER=0></A></CENTER>\n" "<CENTER><A HREF=\"http://www.gnustepweb.org\"><IMG SRC=\"##GSWEXTFWKWSR##/PoweredByGNUstepWeb.png\" ALT=\"Powered By GNUstepWeb\" BORDER=0></A></CENTER>\n"
"</BODY></HTML>\n"}; "</BODY></HTML>\n"};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -100,7 +100,7 @@ const char* g_szDump_FootTemplate[2]={
"", "",
"</table></CENTER>\n" "</table></CENTER>\n"
"<BR>\n" "<BR>\n"
"<CENTER><A HREF=\"http://www.gnustepweb.org\"><IMG SRC=\"##GSWEXTFWKWSR##/PoweredByGNUstepWeb.gif\" ALT=\"Powered By GNUstepWeb\" BORDER=0></A></CENTER>\n" "<CENTER><A HREF=\"http://www.gnustepweb.org\"><IMG SRC=\"##GSWEXTFWKWSR##/PoweredByGNUstepWeb.png\" ALT=\"Powered By GNUstepWeb\" BORDER=0></A></CENTER>\n"
"</BODY></HTML>"}; "</BODY></HTML>"};
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View file

@ -151,7 +151,6 @@ GSWExtensions_AGSDOC_FILES = gswextensions.gsdoc $(GSWExtensions_AUTOGSDOC_HEADE
GSWExtensions_AGSDOC_FLAGS = \ GSWExtensions_AGSDOC_FLAGS = \
-Declared Foundation \ -Declared Foundation \
-Standards YES \ -Standards YES \
-SystemProjects System \
-Project gswextensions \ -Project gswextensions \
-WordMap '{\ -WordMap '{\
FOUNDATION_EXPORT=extern;FOUNDATION_STATIC_INLINE="";\ FOUNDATION_EXPORT=extern;FOUNDATION_STATIC_INLINE="";\
@ -161,6 +160,7 @@ GSWExtensions_AGSDOC_FLAGS = \
GS_ZONE_SCOPE=extern;GS_ZONE_ATTR="";\ GS_ZONE_SCOPE=extern;GS_ZONE_ATTR="";\
}' -Up gswextensions }' -Up gswextensions
# -SystemProjects System \
#DIST_FILES = $(SRCS) $(HDRS) GNUmakefile Makefile.postamble Makefile.preamble #DIST_FILES = $(SRCS) $(HDRS) GNUmakefile Makefile.postamble Makefile.preamble

View file

@ -90,7 +90,6 @@ GSWExtensionsGSW_AGSDOC_FILES = gswextensionsgsw.gsdoc $(GSWExtensionsGSW_AUTOGS
GSWExtensionsGSW_AGSDOC_FLAGS = \ GSWExtensionsGSW_AGSDOC_FLAGS = \
-Declared Foundation \ -Declared Foundation \
-Standards YES \ -Standards YES \
-SystemProjects System \
-Project gswextensionsgsw \ -Project gswextensionsgsw \
-WordMap '{\ -WordMap '{\
FOUNDATION_EXPORT=extern;FOUNDATION_STATIC_INLINE="";\ FOUNDATION_EXPORT=extern;FOUNDATION_STATIC_INLINE="";\
@ -100,6 +99,8 @@ GSWExtensionsGSW_AGSDOC_FLAGS = \
GS_ZONE_SCOPE=extern;GS_ZONE_ATTR="";\ GS_ZONE_SCOPE=extern;GS_ZONE_ATTR="";\
}' -Up gswextensionsgsw }' -Up gswextensionsgsw
# -SystemProjects System \
#DIST_FILES = $(SRCS) $(HDRS) GNUmakefile Makefile.postamble Makefile.preamble #DIST_FILES = $(SRCS) $(HDRS) GNUmakefile Makefile.postamble Makefile.preamble
-include Makefile.preamble -include Makefile.preamble

View file

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

View file

@ -1,11 +1,17 @@
/* GSWActiveImage.m - GSWeb: Class GSWActiveImage /** GSWActiveImage.m - <title>GSWeb: Class GSWActiveImage</title>
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
<abstract></abstract>
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +25,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,127 +36,128 @@ static char rcsId[] = "$Id$";
@implementation GSWActiveImage @implementation GSWActiveImage
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)Xassociations
contentElements:(NSArray*)elements_ contentElements:(NSArray*)elements
{ {
//OK //OK
NSMutableDictionary* _associations=nil; NSMutableDictionary* tmpAssociations=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLog(@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_); NSDebugMLog(@"name=%@ Xassociations:%@ elements_=%@",
_associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; aName,Xassociations,elements);
[_associations removeObjectForKey:imageMapFileName__Key]; tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:Xassociations];
[tmpAssociations removeObjectForKey:imageMapFileName__Key];
if (!WOStrictFlag) if (!WOStrictFlag)
{ {
[_associations removeObjectForKey:imageMapString__Key]; [tmpAssociations removeObjectForKey:imageMapString__Key];
[_associations removeObjectForKey:imageMapRegions__Key]; [tmpAssociations removeObjectForKey:imageMapRegions__Key];
}; };
[_associations removeObjectForKey:action__Key]; [tmpAssociations removeObjectForKey:action__Key];
[_associations removeObjectForKey:href__Key]; [tmpAssociations removeObjectForKey:href__Key];
[_associations removeObjectForKey:src__Key]; [tmpAssociations removeObjectForKey:src__Key];
[_associations removeObjectForKey:x__Key]; [tmpAssociations removeObjectForKey:x__Key];
[_associations removeObjectForKey:y__Key]; [tmpAssociations removeObjectForKey:y__Key];
[_associations removeObjectForKey:target__Key]; [tmpAssociations removeObjectForKey:target__Key];
[_associations removeObjectForKey:filename__Key]; [tmpAssociations removeObjectForKey:filename__Key];
[_associations removeObjectForKey:framework__Key]; [tmpAssociations removeObjectForKey:framework__Key];
[_associations removeObjectForKey:data__Key]; [tmpAssociations removeObjectForKey:data__Key];
[_associations removeObjectForKey:mimeType__Key]; [tmpAssociations removeObjectForKey:mimeType__Key];
[_associations removeObjectForKey:key__Key]; [tmpAssociations removeObjectForKey:key__Key];
if ((self=[super initWithName:name_ if ((self=[super initWithName:aName
associations:_associations associations:tmpAssociations
contentElements:elements_])) contentElements:elements]))
{ {
int _imageMapDefNb=0; int imageMapDefNb=0;
imageMapFileName = [[associations_ objectForKey:imageMapFileName__Key _imageMapFileName = [[Xassociations objectForKey:imageMapFileName__Key
withDefaultObject:[imageMapFileName autorelease]] retain]; withDefaultObject:[_imageMapFileName autorelease]] retain];
if (imageMapFileName) if (_imageMapFileName)
_imageMapDefNb++; imageMapDefNb++;
if (!WOStrictFlag) if (!WOStrictFlag)
{
_imageMapString = [[Xassociations objectForKey:imageMapString__Key
withDefaultObject:[_imageMapString autorelease]] retain];
if (_imageMapString)
imageMapDefNb++;
_imageMapRegions = [[Xassociations objectForKey:imageMapRegions__Key
withDefaultObject:[_imageMapRegions autorelease]] retain];
if (_imageMapRegions)
imageMapDefNb++;
if (imageMapDefNb>0)
{ {
imageMapString = [[associations_ objectForKey:imageMapString__Key ExceptionRaise(@"GSWActiveImage",@"you can't specify %@, %@ and %@",
withDefaultObject:[imageMapString autorelease]] retain]; imageMapFileName__Key,
if (imageMapString) imageMapString__Key,
_imageMapDefNb++; imageMapRegions__Key);
};
imageMapRegions = [[associations_ objectForKey:imageMapRegions__Key };
withDefaultObject:[imageMapRegions autorelease]] retain]; _action = [[Xassociations objectForKey:action__Key
if (imageMapRegions) withDefaultObject:[_action autorelease]] retain];
_imageMapDefNb++;
if (_imageMapDefNb>0) _href = [[Xassociations objectForKey:href__Key
{ withDefaultObject:[_href autorelease]] retain];
ExceptionRaise(@"GSWActiveImage",@"you can't specify %@, %@ and %@",
imageMapFileName__Key, _src = [[Xassociations objectForKey:src__Key
imageMapString__Key, withDefaultObject:[_src autorelease]] retain];
imageMapRegions__Key);
}; _xAssoc = [[Xassociations objectForKey:x__Key
}; withDefaultObject:[_xAssoc autorelease]] retain];
action = [[associations_ objectForKey:action__Key if (_xAssoc && ![_xAssoc isValueSettable])
withDefaultObject:[action autorelease]] retain]; {
ExceptionRaise0(@"GSWActiveImage",@"'x' parameter must be settable");
href = [[associations_ objectForKey:href__Key };
withDefaultObject:[href autorelease]] retain];
_yAssoc = [[Xassociations objectForKey:y__Key
src = [[associations_ objectForKey:src__Key withDefaultObject:[_yAssoc autorelease]] retain];
withDefaultObject:[src autorelease]] retain]; if (_yAssoc && ![_yAssoc isValueSettable])
{
xAssoc = [[associations_ objectForKey:x__Key ExceptionRaise0(@"GSWActiveImage",@"'y' parameter must be settable");
withDefaultObject:[xAssoc autorelease]] retain]; };
if (xAssoc && ![xAssoc isValueSettable])
{ _target = [[Xassociations objectForKey:target__Key
ExceptionRaise0(@"GSWActiveImage",@"'x' parameter must be settable"); withDefaultObject:[_target autorelease]] retain];
};
_filename = [[Xassociations objectForKey:filename__Key
yAssoc = [[associations_ objectForKey:y__Key withDefaultObject:[_filename autorelease]] retain];
withDefaultObject:[yAssoc autorelease]] retain];
if (yAssoc && ![yAssoc isValueSettable]) _framework = [[Xassociations objectForKey:framework__Key
{ withDefaultObject:[_framework autorelease]] retain];
ExceptionRaise0(@"GSWActiveImage",@"'y' parameter must be settable");
}; _data = [[Xassociations objectForKey:data__Key
withDefaultObject:[_data autorelease]] retain];
target = [[associations_ objectForKey:target__Key NSDebugMLLog(@"gswdync",@"_data=%@",_data);
withDefaultObject:[target autorelease]] retain]; _action = [[Xassociations objectForKey:action__Key
withDefaultObject:[_action autorelease]] retain];
filename = [[associations_ objectForKey:filename__Key
withDefaultObject:[filename autorelease]] retain]; _mimeType = [[Xassociations objectForKey:mimeType__Key
withDefaultObject:[_mimeType autorelease]] retain];
framework = [[associations_ objectForKey:framework__Key
withDefaultObject:[framework autorelease]] retain]; _key = [[Xassociations objectForKey:key__Key
withDefaultObject:[_key autorelease]] retain];
data = [[associations_ objectForKey:data__Key
withDefaultObject:[data autorelease]] retain]; };
NSDebugMLLog(@"gswdync",@"data=%@",data);
action = [[associations_ objectForKey:action__Key
withDefaultObject:[action autorelease]] retain];
mimeType = [[associations_ objectForKey:mimeType__Key
withDefaultObject:[mimeType autorelease]] retain];
key = [[associations_ objectForKey:key__Key
withDefaultObject:[key autorelease]] retain];
};
return self; return self;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(imageMapFileName); DESTROY(_imageMapFileName);
DESTROY(imageMapString); DESTROY(_imageMapString);
DESTROY(imageMapRegions); DESTROY(_imageMapRegions);
DESTROY(action); DESTROY(_action);
DESTROY(href); DESTROY(_href);
DESTROY(src); DESTROY(_src);
DESTROY(xAssoc); DESTROY(_xAssoc);
DESTROY(yAssoc); DESTROY(_yAssoc);
DESTROY(target); DESTROY(_target);
DESTROY(filename); DESTROY(_filename);
DESTROY(framework); DESTROY(_framework);
DESTROY(data); DESTROY(_data);
DESTROY(mimeType); DESTROY(_mimeType);
DESTROY(key); DESTROY(_key);
[super dealloc]; [super dealloc];
} }
@ -163,25 +171,25 @@ static char rcsId[] = "$Id$";
-(NSString*)description -(NSString*)description
{ {
return [NSString stringWithFormat:@"<%s %p>", return [NSString stringWithFormat:@"<%s %p>",
object_get_class_name(self), object_get_class_name(self),
(void*)self]; (void*)self];
}; };
//==================================================================== //====================================================================
@implementation GSWActiveImage (GSWActiveImageA) @implementation GSWActiveImage (GSWActiveImageA)
-(GSWAssociation*)hitTestX:(int)x_ -(GSWAssociation*)hitTestX:(int)x
y:(int)y_ y:(int)y
inRegions:(NSArray*)regions_ inRegions:(NSArray*)regions
{ {
GSWAssociation* _assoc=nil; GSWAssociation* assoc=nil;
GSWGeometricRegion* _region=[GSWGeometricRegion hitTestX:x_ GSWGeometricRegion* region=[GSWGeometricRegion hitTestX:x
y:y_ y:y
inRegions:regions_]; inRegions:regions];
if (_region) if (region)
_assoc=[GSWAssociation associationWithKeyPath:[_region userDefinedString]]; assoc=[GSWAssociation associationWithKeyPath:[region userDefinedString]];
else else
_assoc=action; assoc=_action;
return _assoc; return assoc;
}; };
@end @end
@ -190,8 +198,8 @@ static char rcsId[] = "$Id$";
@implementation GSWActiveImage (GSWActiveImageB) @implementation GSWActiveImage (GSWActiveImageB)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)aContext
{ {
LOGObjectFnStart(); LOGObjectFnStart();
//Does nothing //Does nothing
@ -199,350 +207,350 @@ static char rcsId[] = "$Id$";
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)aContext
{ {
GSWElement* _element=nil; GSWElement* element=nil;
NSString* _senderID=nil; NSString* senderID=nil;
NSString* _elementID=nil; NSString* elementID=nil;
BOOL _disabledInContext=NO; BOOL disabledInContext=NO;
BOOL _isInForm=NO; BOOL isInForm=NO;
BOOL _XYValues=NO; BOOL XYValues=NO;
BOOL _thisOne=NO; BOOL thisOne=NO;
GSWComponent* _component=nil; GSWComponent* component=nil;
int _x=0; int x=0;
int _y=0; int y=0;
LOGObjectFnStart(); LOGObjectFnStart();
_component=[context_ component]; component=[aContext component];
[context_ appendZeroElementIDComponent]; [aContext appendZeroElementIDComponent];
_senderID=[context_ senderID]; senderID=[aContext senderID];
NSDebugMLog(@"_senderID=%@",_senderID); NSDebugMLog(@"senderID=%@",senderID);
_elementID=[context_ elementID]; elementID=[aContext elementID];
NSDebugMLog(@"_elementID=%@",_elementID); NSDebugMLog(@"elementID=%@",elementID);
if ([_elementID isEqualToString:_senderID]) if ([elementID isEqualToString:senderID])
{ {
//TODO //TODO
}; };
[context_ deleteLastElementIDComponent]; [aContext deleteLastElementIDComponent];
_disabledInContext=[self disabledInContext:context_]; disabledInContext=[self disabledInContext:aContext];
if (!_disabledInContext) if (!disabledInContext)
{ {
_isInForm=[context_ isInForm]; isInForm=[aContext isInForm];
if (_isInForm) if (isInForm)
{ {
BOOL _wasFormSubmitted=[context_ _wasFormSubmitted]; BOOL wasFormSubmitted=[aContext _wasFormSubmitted];
if (_wasFormSubmitted) if (wasFormSubmitted)
{ {
NSString* _nameInContext=[self nameInContext:context_]; NSString* nameInContext=[self nameInContext:aContext];
NSString* _formValueX=[request_ formValueForKey:[NSString stringWithFormat:@"%@.x", NSString* formValueX=[request formValueForKey:[NSString stringWithFormat:@"%@.x",
_nameInContext]]; nameInContext]];
NSString* _formValueY=[request_ formValueForKey:[NSString stringWithFormat:@"%@.y", NSString* formValueY=[request formValueForKey:[NSString stringWithFormat:@"%@.y",
_nameInContext]]; nameInContext]];
NSDebugMLLog(@"gswdync",@"_formValueX=%@",_formValueX); NSDebugMLLog(@"gswdync",@"formValueX=%@",formValueX);
NSDebugMLLog(@"gswdync",@"_formValueY=%@",_formValueY); NSDebugMLLog(@"gswdync",@"formValueY=%@",formValueY);
if (_formValueX && _formValueY) if (formValueX && formValueY)
{ {
_x=[_formValueX intValue]; x=[formValueX intValue];
_y=[_formValueY intValue]; y=[formValueY intValue];
_XYValues=YES; XYValues=YES;
_thisOne=YES; thisOne=YES;
} }
else else
{ {
//TODO //TODO
}; };
}; };
} }
else else
{ {
_elementID=[context_ elementID]; elementID=[aContext elementID];
NSDebugMLog(@"_elementID=%@",_elementID); NSDebugMLog(@"elementID=%@",elementID);
if ([_elementID isEqualToString:_senderID]) if ([elementID isEqualToString:senderID])
{ {
id _param=[request_ formValueForKey:GSWKey_IsmapCoords[GSWebNamingConv]]; id param=[request formValueForKey:GSWKey_IsmapCoords[GSWebNamingConv]];
NSDebugMLLog(@"gswdync",@"_param=%@",_param); NSDebugMLLog(@"gswdync",@"param=%@",param);
if (_param) if (param)
{ {
if ([_param ismapCoordx:&_x if ([param ismapCoordx:&x
y:&_y]) y:&y])
_XYValues=YES; XYValues=YES;
else else
{ {
//TODO //TODO
}; };
}; };
_thisOne=YES; thisOne=YES;
}; };
}; };
if (_thisOne) if (thisOne)
{ {
GSWAssociation* _actionAssociation=nil; GSWAssociation* actionAssociation=nil;
NSArray* _regions=nil; NSArray* regions=nil;
if (imageMapFileName) if (_imageMapFileName)
{ {
id _imageMapFileNameValue=[imageMapFileName valueInComponent:_component]; id imageMapFileNameValue=[_imageMapFileName valueInComponent:component];
NSString* _imageMapFilePath=[[context_ component] NSString* imageMapFilePath=[[aContext component]
pathForResourceNamed:_imageMapFileNameValue pathForResourceNamed:imageMapFileNameValue
ofType:nil]; ofType:nil];
if (!_imageMapFilePath) if (!imageMapFilePath)
{ {
GSWResourceManager* _resourceManager=[[GSWApplication application]resourceManager]; GSWResourceManager* resourceManager=[[GSWApplication application]resourceManager];
NSArray* _languages=[context_ languages]; NSArray* languages=[aContext languages];
_imageMapFilePath=[_resourceManager pathForResourceNamed:_imageMapFileNameValue imageMapFilePath=[resourceManager pathForResourceNamed:imageMapFileNameValue
inFramework:nil inFramework:nil
languages:_languages]; languages:languages];
}; };
if (_imageMapFilePath) if (imageMapFilePath)
_regions=[GSWGeometricRegion geometricRegionsWithFile:_imageMapFilePath]; regions=[GSWGeometricRegion geometricRegionsWithFile:imageMapFilePath];
else else
{ {
NSDebugMLLog0(@"gswdync",@"GSWActiveImage No image Map."); NSDebugMLLog0(@"gswdync",@"GSWActiveImage No image Map.");
}; };
} }
else if (!WOStrictFlag && imageMapString) else if (!WOStrictFlag && _imageMapString)
{ {
id _imageMapValue=[imageMapString valueInComponent:_component]; id imageMapValue=[_imageMapString valueInComponent:component];
_regions=[GSWGeometricRegion geometricRegionsWithString:_imageMapValue]; regions=[GSWGeometricRegion geometricRegionsWithString:imageMapValue];
} }
else if (!WOStrictFlag && imageMapRegions) else if (!WOStrictFlag && _imageMapRegions)
{ {
_regions=[imageMapRegions valueInComponent:_component]; regions=[_imageMapRegions valueInComponent:component];
}; };
if (xAssoc) if (_xAssoc)
[xAssoc setValue:[NSNumber numberWithInt:_x] [_xAssoc setValue:[NSNumber numberWithInt:x]
inComponent:_component]; inComponent:component];
if (yAssoc) if (_yAssoc)
[yAssoc setValue:[NSNumber numberWithInt:_y] [_yAssoc setValue:[NSNumber numberWithInt:y]
inComponent:_component]; inComponent:component];
_actionAssociation=[self hitTestX:_x actionAssociation=[self hitTestX:x
y:_y y:y
inRegions:_regions]; inRegions:regions];
if (_actionAssociation) if (actionAssociation)
{ {
[context_ _setActionInvoked:YES]; [aContext _setActionInvoked:YES];
_element=[_actionAssociation valueInComponent:_component]; element=[actionAssociation valueInComponent:component];
} }
else else
{ {
if (href) if (_href)
{ {
[context_ _setActionInvoked:YES]; [aContext _setActionInvoked:YES];
//TODO redirect to href //TODO redirect to href
} }
else if (action) else if (_action)
{ {
[context_ _setActionInvoked:YES]; [aContext _setActionInvoked:YES];
_element=[action valueInComponent:_component]; element=[_action valueInComponent:component];
} }
else else
{ {
NSDebugMLLog0(@"gswdync",@"GSWActiveImage Couldn't trigger action."); NSDebugMLLog0(@"gswdync",@"GSWActiveImage Couldn't trigger action.");
}; };
}; };
if (!_element) if (!element)
_element=[context_ page]; element=[aContext page];
} }
else else
_element=[super invokeActionForRequest:request_ element=[super invokeActionForRequest:request
inContext:context_]; inContext:aContext];
} }
else else
_element=[super invokeActionForRequest:request_ element=[super invokeActionForRequest:request
inContext:context_]; inContext:aContext];
LOGObjectFnStop(); LOGObjectFnStop();
return _element; return element;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)aContext
{ {
//OK //OK
GSWRequest* _request=[context_ request]; GSWRequest* _request=[aContext request];
BOOL _isFromClientComponent=[_request isFromClientComponent]; BOOL isFromClientComponent=[_request isFromClientComponent];
BOOL _disabledInContext=[self disabledInContext:context_]; BOOL disabledInContext=[self disabledInContext:aContext];
BOOL _isInForm=NO; BOOL isInForm=NO;
_isInForm=[context_ isInForm]; //TODO isInForm=[aContext isInForm]; //TODO
if (_isInForm) if (isInForm)
{ {
if (!_disabledInContext) if (!disabledInContext)
[response_ _appendContentAsciiString:@"<INPUT "]; [response _appendContentAsciiString:@"<INPUT "];
else else
[response_ _appendContentAsciiString:@"<IMG "]; [response _appendContentAsciiString:@"<IMG "];
} }
else else
{ {
if (!_disabledInContext) if (!disabledInContext)
{ {
NSString* _href=nil; NSString* hrefValue=nil;
[response_ _appendContentAsciiString:@"<A HREF=\""]; [response _appendContentAsciiString:@"<A HREF=\""];
if (href) if (_href)
_href=[self hrefInContext:context_]; hrefValue=[self hrefInContext:aContext];
else else
_href=(NSString*)[context_ componentActionURL]; hrefValue=(NSString*)[aContext componentActionURL];
[response_ appendContentString:_href]; [response appendContentString:hrefValue];
[response_ _appendContentAsciiString:@"\">"]; [response _appendContentAsciiString:@"\">"];
}; };
[response_ _appendContentAsciiString:@"<IMG"]; [response _appendContentAsciiString:@"<IMG"];
}; };
[super appendToResponse:response_ [super appendToResponse:response
inContext:context_]; inContext:aContext];
if (!_isInForm) if (!isInForm)
{ {
if (!_disabledInContext) if (!disabledInContext)
{ {
[response_ _appendContentAsciiString:@"</A>"]; [response _appendContentAsciiString:@"</A>"];
}; };
}; };
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)frameworkNameInContext:(GSWContext*)context_ -(NSString*)frameworkNameInContext:(GSWContext*)aContext
{ {
//OK //OK
NSString* _frameworkName=nil; NSString* frameworkName=nil;
GSWComponent* _component=[context_ component]; GSWComponent* component=[aContext component];
NSDebugMLog(@"framework=%@",framework); NSDebugMLog(@"_framework=%@",_framework);
if (framework) if (_framework)
_frameworkName=[framework valueInComponent:_component]; frameworkName=[_framework valueInComponent:component];
else else
_frameworkName=[_component frameworkName]; frameworkName=[component frameworkName];
return _frameworkName; return frameworkName;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
//NDFN //NDFN
-(NSString*)imageSourceInContext:(GSWContext*)context_ -(NSString*)imageSourceInContext:(GSWContext*)aContext
{ {
GSWComponent* _component=nil; GSWComponent* component=nil;
NSString* _imageSource=nil; NSString* imageSource=nil;
_component=[context_ component]; component=[aContext component];
_imageSource=[src valueInComponent:_component]; imageSource=[_src valueInComponent:component];
return _imageSource; return imageSource;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
//NDFN //NDFN
-(NSString*)hrefInContext:(GSWContext*)context_ -(NSString*)hrefInContext:(GSWContext*)aContext
{ {
GSWComponent* _component=nil; GSWComponent* component=nil;
NSString* _href=nil; NSString* hrefValue=nil;
_component=[context_ component]; component=[aContext component];
_href=[href valueInComponent:_component]; hrefValue=[_href valueInComponent:component];
return _href; return hrefValue;
}; };
@end @end
//==================================================================== //====================================================================
@implementation GSWActiveImage (GSWActiveImageC) @implementation GSWActiveImage (GSWActiveImageC)
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ -(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)aContext
{ {
//OK //OK
NSString* _url=nil; NSString* url=nil;
GSWComponent* _component=nil; GSWComponent* component=nil;
id _data=nil; id data=nil;
id _mimeTypeValue=nil; id mimeTypeValue=nil;
GSWURLValuedElementData* _dataValue=nil; GSWURLValuedElementData* dataValue=nil;
GSWResourceManager* _resourceManager=nil; GSWResourceManager* resourceManager=nil;
BOOL _disabledInContext=NO; BOOL disabledInContext=NO;
BOOL _isInForm=NO; BOOL isInForm=NO;
LOGObjectFnStartC("GSWActiveImage"); LOGObjectFnStartC("GSWActiveImage");
NSDebugMLLog(@"gswdync",@"_elementID=%@",[context_ elementID]); NSDebugMLLog(@"gswdync",@"elementID=%@",[aContext elementID]);
_component=[context_ component]; component=[aContext component];
_disabledInContext=[self disabledInContext:context_]; disabledInContext=[self disabledInContext:aContext];
_isInForm=[context_ isInForm]; isInForm=[aContext isInForm];
if (!_disabledInContext) if (!disabledInContext)
{ {
if (_isInForm) if (isInForm)
{ {
NSString* _nameInContext=[self nameInContext:context_]; NSString* nameInContext=[self nameInContext:aContext];
[response_ _appendContentAsciiString:@" type=image"]; [response _appendContentAsciiString:@" type=image"];
[response_ _appendContentAsciiString:@" name=\""]; [response _appendContentAsciiString:@" name=\""];
[response_ appendContentHTMLAttributeValue:_nameInContext]; [response appendContentHTMLAttributeValue:nameInContext];
[response_ appendContentCharacter:'"']; [response appendContentCharacter:'"'];
} }
else else
{ {
[response_ _appendContentAsciiString:@" ismap"]; [response _appendContentAsciiString:@" ismap"];
}; };
} }
NSDebugMLLog(@"gswdync",@"data=%@",data); NSDebugMLLog(@"gswdync",@"_data=%@",_data);
NSDebugMLLog(@"gswdync",@"filename=%@",filename); NSDebugMLLog(@"gswdync",@"_filename=%@",_filename);
if (key) if (_key)
{ {
NSString* _keyValue=[key valueInComponent:_component]; NSString* keyValue=[_key valueInComponent:component];
_dataValue=[_resourceManager _cachedDataForKey:_keyValue]; dataValue=[resourceManager _cachedDataForKey:keyValue];
}; };
if (!_dataValue && data) if (!dataValue && _data)
{ {
_data=[data valueInComponent:_component]; data=[_data valueInComponent:component];
NSDebugMLLog(@"gswdync",@"_data=%@",_data); NSDebugMLLog(@"gswdync",@"data=%@",data);
_mimeTypeValue=[mimeType valueInComponent:_component]; mimeTypeValue=[_mimeType valueInComponent:component];
NSDebugMLLog(@"gswdync",@"mimeType=%@",mimeType); NSDebugMLLog(@"gswdync",@"_mimeType=%@",_mimeType);
NSDebugMLLog(@"gswdync",@"_mimeTypeValue=%@",_mimeTypeValue); NSDebugMLLog(@"gswdync",@"mimeTypeValue=%@",mimeTypeValue);
_dataValue=[[[GSWURLValuedElementData alloc] initWithData:_data dataValue=[[[GSWURLValuedElementData alloc] initWithData:data
mimeType:_mimeTypeValue mimeType:mimeTypeValue
key:nil] autorelease]; key:nil] autorelease];
NSDebugMLLog(@"gswdync",@"_dataValue=%@",_dataValue); NSDebugMLLog(@"gswdync",@"dataValue=%@",dataValue);
}; };
_resourceManager=[[GSWApplication application]resourceManager]; resourceManager=[[GSWApplication application]resourceManager];
if (key || data) if (_key || _data)
{ {
[_resourceManager setURLValuedElementData:_dataValue]; [resourceManager setURLValuedElementData:dataValue];
} }
else if (filename) else if (_filename)
{ {
id _filenameValue=nil; id filenameValue=nil;
id _frameworkValue=nil; id frameworkValue=nil;
GSWRequest* _request=nil; GSWRequest* aRequest=nil;
NSArray* _languages=nil; NSArray* languages=nil;
NSDebugMLLog(@"gswdync",@"filename=%@",filename); NSDebugMLLog(@"gswdync",@"_filename=%@",_filename);
_filenameValue=[filename valueInComponent:_component]; filenameValue=[_filename valueInComponent:component];
NSDebugMLLog(@"gswdync",@"_filenameValue=%@",_filenameValue); NSDebugMLLog(@"gswdync",@"filenameValue=%@",filenameValue);
_frameworkValue=[self frameworkNameInContext:context_]; frameworkValue=[self frameworkNameInContext:aContext];
NSDebugMLLog(@"gswdync",@"_frameworkValue=%@",_frameworkValue); NSDebugMLLog(@"gswdync",@"frameworkValue=%@",frameworkValue);
_request=[context_ request]; aRequest=[aContext request];
_languages=[context_ languages]; languages=[aContext languages];
_url=[_resourceManager urlForResourceNamed:_filenameValue url=[resourceManager urlForResourceNamed:filenameValue
inFramework:_frameworkValue inFramework:frameworkValue
languages:_languages languages:languages
request:_request]; request:aRequest];
if (!_url) if (!url)
{ {
LOGSeriousError(@"No URL for resource named: %@ in framework named: %@ for languages: %@", LOGSeriousError(@"No URL for resource named: %@ in framework named: %@ for languages: %@",
_filenameValue, filenameValue,
_frameworkValue, frameworkValue,
_languages); languages);
}; };
}; };
[response_ _appendContentAsciiString:@" src=\""]; [response _appendContentAsciiString:@" src=\""];
if (key || data) if (_key || _data)
{ {
[_dataValue appendDataURLToResponse:response_ [dataValue appendDataURLToResponse:response
inContext:context_]; inContext:aContext];
} }
else if (filename) else if (_filename)
{ {
[response_ appendContentString:_url]; [response appendContentString:url];
} }
else if (src) else if (_src)
{ {
NSString* _src=[self imageSourceInContext:context_]; NSString* srcValue=[self imageSourceInContext:aContext];
[response_ appendContentString:_src]; [response appendContentString:srcValue];
} }
else else
{ {
GSWDynamicURLString* _componentActionURL=[context_ componentActionURL]; GSWDynamicURLString* componentActionURL=[aContext componentActionURL];
NSDebugMLLog(@"gswdync",@"_componentActionURL=%@",_componentActionURL); NSDebugMLLog(@"gswdync",@"componentActionURL=%@",componentActionURL);
[response_ appendContentString:(NSString*)_componentActionURL]; [response appendContentString:(NSString*)componentActionURL];
}; };
[response_ appendContentCharacter:'"']; [response appendContentCharacter:'"'];
NSDebugMLLog(@"gswdync",@"_elementID=%@",[context_ elementID]); NSDebugMLLog(@"gswdync",@"elementID=%@",[aContext elementID]);
LOGObjectFnStopC("GSWActiveImage"); LOGObjectFnStopC("GSWActiveImage");
}; };
@ -554,16 +562,16 @@ static char rcsId[] = "$Id$";
@implementation GSWActiveImage (GSWActiveImageD) @implementation GSWActiveImage (GSWActiveImageD)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(BOOL)appendStringAtRight:(id)_unkwnon -(BOOL)appendStringAtRight:(id)unkwnon
withMapping:(char*)_mapping withMapping:(char*)mapping
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return NO; return NO;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(BOOL)appendStringAtLeft:(id)_unkwnon -(BOOL)appendStringAtLeft:(id)unkwnon
withMapping:(char*)_mapping withMapping:(char*)mapping
{ {
LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnNotImplemented(); //TODOFN
return NO; return NO;

View file

@ -902,25 +902,40 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
LOGObjectFnStop(); LOGObjectFnStop();
}; };
-(void)associationsSetValuesFromObject:(id)from_ -(void)associationsSetValuesFromObject:(id)from
inObject:(id)to_ inObject:(id)to
{ {
NSEnumerator *enumerator = nil; NSEnumerator *enumerator = nil;
id _key=nil; id key=nil;
id _varValue=nil; id varValue=nil;
id _var=nil; id var=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"associations",@"from=%@",from);
NSDebugMLLog(@"associations",@"to=%@",to);
enumerator = [self keyEnumerator]; enumerator = [self keyEnumerator];
while ((_key = [enumerator nextObject])) while ((key = [enumerator nextObject]))
{ {
NSDebugMLLog(@"associations",@"_key=%@",_key); NSDebugMLLog(@"associations",@"key=%@",key);
_var=[self objectForKey:_key]; /* NSAssert2([key isKindOfClass:[GSWAssociation class]],
NSDebugMLLog(@"associations",@"_var=%@",_var); @"key is not an GSWAssociation but a %@: %@",
_varValue=[_var valueInComponent:from_]; [key class],
NSDebugMLLog(@"associations",@"_varValue=%@",_varValue); key);*/
[_key setValue:_varValue var=[self objectForKey:key];
inComponent:to_]; NSDebugMLLog(@"associations",@"var=%@",var);
}; /* NSAssert2([var isKindOfClass:[GSWAssociation class]],
@"Variable is not an GSWAssociation but a %@: %@",
[var class],
var);*/
if ([var isKindOfClass:[GSWAssociation class]])
varValue=[var valueInComponent:from];
else
varValue=var;
NSDebugMLLog(@"associations",@"varValue=%@",varValue);
if (![key isKindOfClass:[GSWAssociation class]])
key=[GSWAssociation associationWithKeyPath:key];
[key setValue:varValue
inComponent:to];
};
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -935,7 +950,7 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
id _varKeyAssociation=nil; id _varKeyAssociation=nil;
id _value=nil; id _value=nil;
LOGObjectFnStart(); LOGObjectFnStart();
_newAssociation=[NSMutableDictionary dictionary]; _newAssociation=(NSMutableDictionary*)[NSMutableDictionary dictionary];
enumerator = [self keyEnumerator]; enumerator = [self keyEnumerator];
while ((_key = [enumerator nextObject])) while ((_key = [enumerator nextObject]))
{ {

View file

@ -348,8 +348,8 @@ associationsKeys:(NSArray*)_associationsKeys
NSDebugMLLog(@"gswcomponents",@"name=%@ parent=%p (%@)", NSDebugMLLog(@"gswcomponents",@"name=%@ parent=%p (%@)",
[self definitionName], [self definitionName],
(void*)parent,[parent class]); (void*)parent,[parent class]);
ASSIGN(associations,_associations);
NSDebugMLLog(@"gswcomponents",@"associations=%@",associations); NSDebugMLLog(@"gswcomponents",@"associations=%@",associations);
ASSIGN(associations,_associations);
ASSIGN(associationsKeys,_associationsKeys); ASSIGN(associationsKeys,_associationsKeys);
NSDebugMLLog(@"gswcomponents",@"associationsKeys=%@",associationsKeys); NSDebugMLLog(@"gswcomponents",@"associationsKeys=%@",associationsKeys);
ASSIGN(childTemplate,_template); ASSIGN(childTemplate,_template);

View file

@ -1,11 +1,17 @@
/* GSWComponentContent.h - GSWeb: Class GSWComponentContent /** GSWComponentContent.h - <title>GSWeb: Class GSWComponentContent</title>
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
<abstract></abstract>
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,21 +25,21 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
#ifndef _GSWComponentContent_h__ #ifndef _GSWComponentContent_h__
#define _GSWComponentContent_h__ #define _GSWComponentContent_h__
@interface GSWComponentContent : GSWDynamicElement @interface GSWComponentContent : GSWDynamicElement
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)aContext;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request_
inContext:(GSWContext*)context_; inContext:(GSWContext*)aContext;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request_
inContext:(GSWContext*)context_; inContext:(GSWContext*)aContext;
@end @end

View file

@ -1,11 +1,17 @@
/* GSWComponentContent.m - GSWeb: Class GSWComponentContent /** GSWComponentContent.m - <title>GSWeb: Class GSWComponentContent</title>
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
<abstract></abstract>
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +25,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,87 +36,96 @@ static char rcsId[] = "$Id$";
@implementation GSWComponentContent @implementation GSWComponentContent
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)aContext
{ {
//OK //OK
GSWComponent* _component=nil; GSWComponent* component=nil;
GSWComponent* _parent=nil; GSWComponent* parent=nil;
GSWElement* _childTemplate=nil; GSWElement* childTemplate=nil;
#ifndef NDEBBUG #ifndef NDEBBUG
int elementsNb=[(GSWElementIDString*)[context_ elementID]elementsNb]; int elementsNb=[(GSWElementIDString*)[aContext elementID]elementsNb];
#endif #endif
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context_ elementID]); NSDebugMLLog(@"gswdync",@"ET=%@ defName=%@ id=%@",
_component=[context_ component]; [self class],[self definitionName],[aContext elementID]);
_childTemplate=[_component _childTemplate]; component=[aContext component];
_parent=[_component parent]; childTemplate=[component _childTemplate];
[context_ _setCurrentComponent:_parent]; parent=[component parent];
[_childTemplate appendToResponse:response_ [aContext _setCurrentComponent:parent];
inContext:context_]; [childTemplate appendToResponse:response
[context_ _setCurrentComponent:_component]; inContext:aContext];
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]); [aContext _setCurrentComponent:component];
NSDebugMLLog(@"gswdync",@"END ET=%@ defName=%@ id=%@",
[self class],[self definitionName],[aContext elementID]);
#ifndef NDEBBUG #ifndef NDEBBUG
NSAssert(elementsNb==[(GSWElementIDString*)[context_ elementID]elementsNb],@"GSWComponentContent appendToResponse: bad elementID"); NSAssert(elementsNb==[(GSWElementIDString*)[aContext elementID]elementsNb],
@"GSWComponentContent appendToResponse: bad elementID");
#endif #endif
LOGObjectFnStop(); LOGObjectFnStop();
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)aContext
{ {
//OK //OK
GSWElement* _element=nil; GSWElement* element=nil;
GSWComponent* _component=nil; GSWComponent* component=nil;
GSWComponent* _parent=nil; GSWComponent* parent=nil;
GSWElement* _childTemplate=nil; GSWElement* childTemplate=nil;
#ifndef NDEBBUG #ifndef NDEBBUG
int elementsNb=[(GSWElementIDString*)[context_ elementID]elementsNb]; int elementsNb=[(GSWElementIDString*)[aContext elementID]elementsNb];
#endif #endif
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context_ elementID]); NSDebugMLLog(@"gswdync",@"ET=%@ defName=%@ id=%@",
_component=[context_ component]; [self class],[self definitionName],[aContext elementID]);
NSDebugMLLog(@"gswdync",@"_component=%@",_component); component=[aContext component];
_childTemplate=[_component _childTemplate]; NSDebugMLLog(@"gswdync",@"component=%@",component);
NSDebugMLLog(@"gswdync",@"_childTemplate=%@",_childTemplate); childTemplate=[component _childTemplate];
_parent=[_component parent]; NSDebugMLLog(@"gswdync",@"childTemplate=%@",childTemplate);
NSDebugMLLog(@"gswdync",@"_parent=%@",_parent); parent=[component parent];
[context_ _setCurrentComponent:_parent]; NSDebugMLLog(@"gswdync",@"parent=%@",parent);
_element=[_childTemplate invokeActionForRequest:request_ [aContext _setCurrentComponent:parent];
inContext:context_]; element=[childTemplate invokeActionForRequest:request
[context_ _setCurrentComponent:_component]; inContext:aContext];
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]); [aContext _setCurrentComponent:component];
NSDebugMLLog(@"gswdync",@"END ET=%@ defName=%@ id=%@",
[self class],[self definitionName],[aContext elementID]);
#ifndef NDEBBUG #ifndef NDEBBUG
NSAssert(elementsNb==[(GSWElementIDString*)[context_ elementID]elementsNb],@"GSWComponentContent invokeActionForRequest: bad elementID"); NSAssert(elementsNb==[(GSWElementIDString*)[aContext elementID]elementsNb],
@"GSWComponentContent invokeActionForRequest: bad elementID");
#endif #endif
LOGObjectFnStop(); LOGObjectFnStop();
return _element; return element;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)aContext
{ {
//OK //OK
GSWComponent* _component=nil; GSWComponent* component=nil;
GSWComponent* _parent=nil; GSWComponent* parent=nil;
GSWElement* _childTemplate=nil; GSWElement* childTemplate=nil;
#ifndef NDEBBUG #ifndef NDEBBUG
int elementsNb=[(GSWElementIDString*)[context_ elementID]elementsNb]; int elementsNb=[(GSWElementIDString*)[aContext elementID]elementsNb];
#endif #endif
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context_ elementID]); NSDebugMLLog(@"gswdync",@"ET=%@ defName=%@ id=%@",
_component=[context_ component]; [self class],[self definitionName],[aContext elementID]);
_childTemplate=[_component _childTemplate]; component=[aContext component];
_parent=[_component parent]; childTemplate=[component _childTemplate];
[context_ _setCurrentComponent:_parent]; parent=[component parent];
[_childTemplate takeValuesFromRequest:request_ [aContext _setCurrentComponent:parent];
inContext:context_]; [childTemplate takeValuesFromRequest:request
[context_ _setCurrentComponent:_component]; inContext:aContext];
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]); [aContext _setCurrentComponent:component];
NSDebugMLLog(@"gswdync",@"END ET=%@ defName=%@ id=%@",
[self class],[self definitionName],[aContext elementID]);
#ifndef NDEBBUG #ifndef NDEBBUG
NSAssert(elementsNb==[(GSWElementIDString*)[context_ elementID]elementsNb],@"GSWComponentContent takeValuesFromRequest: bad elementID"); NSAssert(elementsNb==[(GSWElementIDString*)[aContext elementID]elementsNb],
@"GSWComponentContent takeValuesFromRequest: bad elementID");
#endif #endif
LOGObjectFnStop(); LOGObjectFnStop();
}; };

View file

@ -30,29 +30,29 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name_
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations_
{ {
LOGObjectFnStart(); LOGObjectFnStart();
//OK //OK
NSDebugMLLog(@"gswdync",@"name:%@",name); NSDebugMLLog(@"gswdync",@"name:%@",name);
NSDebugMLLog(@"gswdync",@"associations_:%@",associations_); NSDebugMLLog(@"gswdync",@"associations_:%@",associations_);
if ((self==[super initWithName:name_ if ((self==[super initWithName:name_
associations:associations_ associations:associations_
template:nil])) template:nil]))
{ {
ASSIGN(name,name_); ASSIGN(name,name_);
if (associations_ && [associations_ count]) if (associations_ && [associations_ count])
{ {
NSMutableArray* tmpArray=[NSMutableArray array]; NSMutableArray* tmpArray=[NSMutableArray array];
int i=0; int i=0;
ASSIGN(associationsKeys,[associations_ allKeys]); ASSIGN(associationsKeys,[associations_ allKeys]);
for(i=0;i<[associationsKeys count];i++) for(i=0;i<[associationsKeys count];i++)
{ {
[tmpArray addObject:[associations_ objectForKey:[associationsKeys objectAtIndex:i]]]; [tmpArray addObject:[associations_ objectForKey:[associationsKeys objectAtIndex:i]]];
}; };
ASSIGN(associations,[NSArray arrayWithArray:tmpArray]); ASSIGN(associations,[NSArray arrayWithArray:tmpArray]);
}; };
}; };
LOGObjectFnStop(); LOGObjectFnStop();
return self; return self;
}; };

View file

@ -42,8 +42,12 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
GSWLogMemC("GSWConstantValueAssociation start of dealloc");
GSWLogAssertGood(self);
DESTROY(value); DESTROY(value);
GSWLogMemC("value deallocated");
[super dealloc]; [super dealloc];
GSWLogMemC("GSWConstantValueAssociation end of dealloc");
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View file

@ -268,6 +268,7 @@ extern id identifier__Key;
extern id count__Key; extern id count__Key;
extern id escapeHTML__Key; extern id escapeHTML__Key;
extern id GSWComponentName__Key[2]; extern id GSWComponentName__Key[2];
extern id componentName__Key;
extern id prefix__Key; extern id prefix__Key;
extern id suffix__Key; extern id suffix__Key;
extern id level__Key; extern id level__Key;

View file

@ -273,6 +273,7 @@ id identifier__Key = @"identifier";
id count__Key = @"count"; id count__Key = @"count";
id escapeHTML__Key = @"escapeHTML"; id escapeHTML__Key = @"escapeHTML";
id GSWComponentName__Key[2] = { @"GSWComponentName", @"WOComponentName"}; id GSWComponentName__Key[2] = { @"GSWComponentName", @"WOComponentName"};
id componentName__Key = @"componentName";
id prefix__Key = @"prefix"; id prefix__Key = @"prefix";
id suffix__Key = @"suffix"; id suffix__Key = @"suffix";
id level__Key = @"level"; id level__Key = @"level";

View file

@ -42,8 +42,12 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
GSWLogMemC("GSWKeyValueAssociation start of dealloc");
GSWLogAssertGood(self);
DESTROY(keyPath); DESTROY(keyPath);
GSWLogMemC("keyPath deallocated");
[super dealloc]; [super dealloc];
GSWLogMemC("GSWKeyValueAssociation end of dealloc");
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -82,9 +86,11 @@ static char rcsId[] = "$Id$";
if (value_) { if (value_) {
NSDebugMLLog(@"associations",@"value_ class:%@",NSStringFromClass([value_ class])); NSDebugMLLog(@"associations",@"value_ class:%@",NSStringFromClass([value_ class]));
} }
/*Not Here because self is not a string key !
//TODO (return something!) //TODO (return something!)
[object_ validateValue:&value_ [object_ validateValue:&value_
forKey:self]; forKey:self];
*/
[GSWAssociation setValue:value_ [GSWAssociation setValue:value_
inObject:object_ inObject:object_
forKeyPath:keyPath]; forKeyPath:keyPath];

View file

@ -1,11 +1,17 @@
/* GSWSwitchComponent.h - GSWeb: Class GSWSwitchComponent /** GSWSwitchComponent.h - <title>GSWeb: Class GSWSwitchComponent</title>
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
<abstract></abstract>
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +25,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
// $Id$ // $Id$
@ -29,32 +36,32 @@
//==================================================================== //====================================================================
@interface GSWSwitchComponent: GSWDynamicElement @interface GSWSwitchComponent: GSWDynamicElement
{ {
GSWAssociation* componentName; GSWAssociation* _componentName;
NSDictionary* componentAttributes; NSDictionary* _componentAttributes;
GSWElement* template; GSWElement* _template;
NSMutableDictionary* componentCache; NSMutableDictionary* _componentCache;
}; };
-(void)dealloc; -(void)dealloc;
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
template:(GSWElement*)templateElement_; template:(GSWElement*)templateElement;
-(NSString*)description; -(NSString*)description;
@end @end
@interface GSWSwitchComponent (GSWSwitchComponentA) @interface GSWSwitchComponent (GSWSwitchComponentA)
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_; inContext:(GSWContext*)aContext;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_; inContext:(GSWContext*)aContext;
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request_
inContext:(GSWContext*)context_; inContext:(GSWContext*)aContext;
-(GSWElement*)_realComponentWithName:(NSString*)name_ -(GSWElement*)_realComponentWithName:(NSString*)name
inContext:(GSWContext*)context_; inContext:(GSWContext*)aContext;
-(NSString*)_elementNameInContext:(GSWContext*)context_; -(NSString*)_elementNameInContext:(GSWContext*)aContext;
@end @end

View file

@ -1,11 +1,17 @@
/* GSWSwitchComponent.m - GSWeb: Class GSWSwitchComponent /** GSWSwitchComponent.m - <title>GSWeb: Class GSWSwitchComponent</title>
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999-2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$
$Date$
<abstract></abstract>
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +25,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ </license>
**/
static char rcsId[] = "$Id$"; static char rcsId[] = "$Id$";
@ -29,31 +36,46 @@ static char rcsId[] = "$Id$";
@implementation GSWSwitchComponent @implementation GSWSwitchComponent
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name_ -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations_ associations:(NSDictionary*)associations
template:(GSWElement*)templateElement_ template:(GSWElement*)templateElement
{ {
LOGObjectFnStartC("GSWSwitchComponent"); LOGObjectFnStartC("GSWSwitchComponent");
if ((self=[super initWithName:name_ if ((self=[super initWithName:aName
associations:associations_ associations:associations
template:nil])) template:nil]))
{ {
NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
NSDebugMLLog(@"gswdync",@"GSWSwitchComponent: _associations=%@",_associations); NSDebugMLLog(@"gswdync",@"GSWSwitchComponent %p (defName=%@): tmpAssociations=%@",
NSDebugMLLog(@"gswdync",@"GSWSwitchComponent: GSWComponentName__Key=%@",GSWComponentName__Key[GSWebNamingConv]); self,[self definitionName],tmpAssociations);
[_associations removeObjectForKey:GSWComponentName__Key[GSWebNamingConv]]; NSDebugMLLog(@"gswdync",@"GSWSwitchComponent %p (defName=%@): GSWComponentName__Key=%@",
self,[self definitionName],GSWComponentName__Key[GSWebNamingConv]);
[tmpAssociations removeObjectForKey:GSWComponentName__Key[GSWebNamingConv]];
NSDebugMLLog(@"gswdync",@"GSWSwitchComponent %p (defName=%@): componentName__Key=%@",
self,[self definitionName],componentName__Key);
[tmpAssociations removeObjectForKey:componentName__Key];
componentName = [[associations_ objectForKey:GSWComponentName__Key[GSWebNamingConv] _componentName = [[associations objectForKey:GSWComponentName__Key[GSWebNamingConv]
withDefaultObject:[componentName autorelease]] retain]; withDefaultObject:[_componentName autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWSwitchComponent: componentName=%@",componentName); NSDebugMLLog(@"gswdync",@"GSWSwitchComponent %p (defName=%@): componentName=%@",
self,[self definitionName],_componentName);
if (!_componentName)
{
_componentName = [[associations objectForKey:componentName__Key
withDefaultObject:[_componentName autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWSwitchComponent %p (defName=%@): componentName=%@",
self,[self definitionName],_componentName);
}
ASSIGN(componentAttributes,[NSDictionary dictionaryWithDictionary:_associations]); ASSIGN(_componentAttributes,[NSDictionary dictionaryWithDictionary:tmpAssociations]);
NSDebugMLLog(@"gswdync",@"GSWSwitchComponent: componentAttributes=%@",componentAttributes); NSDebugMLLog(@"gswdync",@"GSWSwitchComponent %p (defName=%@): componentAttributes=%@",
self,[self definitionName],_componentAttributes);
ASSIGN(template,templateElement_); ASSIGN(_template,templateElement);
NSDebugMLLog(@"gswdync",@"GSWSwitchComponent: template=%@",template); NSDebugMLLog(@"gswdync",@"GSWSwitchComponent %p (defName=%@): template=%@",
self,[self definitionName],_template);
componentCache=[NSMutableDictionary new]; _componentCache=[NSMutableDictionary new];
}; };
LOGObjectFnStopC("GSWSwitchComponent"); LOGObjectFnStopC("GSWSwitchComponent");
return self; return self;
@ -62,10 +84,10 @@ static char rcsId[] = "$Id$";
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(componentName); DESTROY(_componentName);
DESTROY(componentAttributes); DESTROY(_componentAttributes);
DESTROY(template); DESTROY(_template);
DESTROY(componentCache); DESTROY(_componentCache);
[super dealloc]; [super dealloc];
}; };
@ -83,103 +105,117 @@ static char rcsId[] = "$Id$";
@implementation GSWSwitchComponent (GSWSwitchComponentA) @implementation GSWSwitchComponent (GSWSwitchComponentA)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response_ -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context_ inContext:(GSWContext*)aContext
{ {
GSWElement* _element=nil; GSWElement* element=nil;
NSString* _elementNameInContext=nil; NSString* elementNameInContext=nil;
LOGObjectFnStartC("GSWSwitchComponent"); LOGObjectFnStartC("GSWSwitchComponent");
_elementNameInContext=[self _elementNameInContext:context_]; elementNameInContext=[self _elementNameInContext:aContext];
[context_ appendElementIDComponent:_elementNameInContext]; [aContext appendElementIDComponent:elementNameInContext];
_element=[self _realComponentWithName:_elementNameInContext element=[self _realComponentWithName:elementNameInContext
inContext:context_]; inContext:aContext];
[_element appendToResponse:response_ [element appendToResponse:response
inContext:context_]; inContext:aContext];
[context_ deleteLastElementIDComponent]; [aContext deleteLastElementIDComponent];
LOGObjectFnStopC("GSWSwitchComponent"); LOGObjectFnStopC("GSWSwitchComponent");
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ -(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)aContext
{ {
GSWElement* _resultElement=nil; GSWElement* resultElement=nil;
GSWElement* _element=nil; GSWElement* element=nil;
NSString* _elementNameInContext=nil; NSString* elementNameInContext=nil;
LOGObjectFnStartC("GSWSwitchComponent"); LOGObjectFnStartC("GSWSwitchComponent");
_elementNameInContext=[self _elementNameInContext:context_]; elementNameInContext=[self _elementNameInContext:aContext];
[context_ appendElementIDComponent:_elementNameInContext]; [aContext appendElementIDComponent:elementNameInContext];
_element=[self _realComponentWithName:_elementNameInContext element=[self _realComponentWithName:elementNameInContext
inContext:context_]; inContext:aContext];
_resultElement=[_element invokeActionForRequest:request_ resultElement=[element invokeActionForRequest:request
inContext:context_]; inContext:aContext];
[context_ deleteLastElementIDComponent]; [aContext deleteLastElementIDComponent];
LOGObjectFnStopC("GSWSwitchComponent"); LOGObjectFnStopC("GSWSwitchComponent");
return _resultElement; return resultElement;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request_ -(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context_ inContext:(GSWContext*)aContext
{ {
GSWElement* _element=nil; GSWElement* element=nil;
NSString* _elementNameInContext=nil; NSString* elementNameInContext=nil;
LOGObjectFnStartC("GSWSwitchComponent"); LOGObjectFnStartC("GSWSwitchComponent");
_elementNameInContext=[self _elementNameInContext:context_]; elementNameInContext=[self _elementNameInContext:aContext];
[context_ appendElementIDComponent:_elementNameInContext]; [aContext appendElementIDComponent:elementNameInContext];
_element=[self _realComponentWithName:_elementNameInContext element=[self _realComponentWithName:elementNameInContext
inContext:context_]; inContext:aContext];
[_element takeValuesFromRequest:request_ [element takeValuesFromRequest:request
inContext:context_]; inContext:aContext];
[context_ deleteLastElementIDComponent]; [aContext deleteLastElementIDComponent];
LOGObjectFnStopC("GSWSwitchComponent"); LOGObjectFnStopC("GSWSwitchComponent");
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(GSWElement*)_realComponentWithName:(NSString*)name_ /** returns a GSWComponentReference representing component named aName
inContext:(GSWContext*)context_ if the component has already been created, it get it from the cache; otherwise, it is created.
**/
-(GSWElement*)_realComponentWithName:(NSString*)aName
inContext:(GSWContext*)aContext
{ {
GSWElement* _element=nil; GSWElement* element=nil;
NSArray* _languages=nil; NSArray* languages=nil;
GSWComponent* component=nil;
LOGObjectFnStartC("GSWSwitchComponent"); LOGObjectFnStartC("GSWSwitchComponent");
if (!name_) component=[aContext component];
{ NSDebugMLLog(@"gswdync",@"GSWSwitchComponent %p (defName=%@): componentName=%@ parent=%@",
ExceptionRaise0(@"GSWSwitchComponent",@"ComponentName is null !"); self,[self definitionName],_componentName,[component parent]);
} if (!aName)
{
ExceptionRaise0(@"GSWSwitchComponent",@"ComponentName is null !");
}
else else
{ {
_element=[componentCache objectForKey:name_]; element=[_componentCache objectForKey:aName];
if (!_element) if (!element)
{ {
_languages=[context_ languages]; languages=[aContext languages];
_element=[GSWApp dynamicElementWithName:name_ element=[GSWApp dynamicElementWithName:aName
associations:componentAttributes associations:_componentAttributes
template:template template:_template
languages:_languages]; languages:languages];
if (_element) if (element)
[componentCache setObject:_element {
forKey:name_]; [_componentCache setObject:element
else forKey:aName];
{ }
ExceptionRaise(@"GSWSwitchComponent: Creation failed for element named:%@", else
name_); {
}; ExceptionRaise(@"GSWSwitchComponent %p (defName=%@): Creation failed for element named:%@",
}; self,[self definitionName],aName);
}; };
};
};
LOGObjectFnStopC("GSWSwitchComponent"); LOGObjectFnStopC("GSWSwitchComponent");
return _element; return element;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)_elementNameInContext:(GSWContext*)context_ /** returns the element name by resolving _componentName association **/
-(NSString*)_elementNameInContext:(GSWContext*)aContext
{ {
GSWComponent* _component=nil; GSWComponent* component=nil;
NSString* _componentNameValue=nil; NSString* componentNameValue=nil;
LOGObjectFnStartC("GSWSwitchComponent"); LOGObjectFnStartC("GSWSwitchComponent");
_component=[context_ component]; component=[aContext component];
_componentNameValue=[componentName valueInComponent:_component]; NSDebugMLLog(@"gswdync",@"GSWSwitchComponent %p (defName=%@): componentName=%@",
self,[self definitionName],_componentName);
componentNameValue=[_componentName valueInComponent:component];
NSDebugMLLog(@"gswdync",@"GSWSwitchComponent %p (defName=%@): componentNameValue=%@",
self,[self definitionName],componentNameValue);
LOGObjectFnStopC("GSWSwitchComponent"); LOGObjectFnStopC("GSWSwitchComponent");
return _componentNameValue; return componentNameValue;
}; };
@end @end

View file

@ -42,20 +42,7 @@
# after-all:: # after-all::
# Things to do before installing # Things to do before installing
# before-install:: autodoc gsdoc # before-install::
autodocs:
echo $($(LIBRARY_NAME)_HEADER_FILES)
mkdir -p Doc/tmp
rm -f Doc/tmp/*
autodoc -allclasses -format html -template /usr/GNUstep/System/Libraries/Resources/DocTemplates/AutoDocTemplate.gsdoc -destination Doc/tmp/ -copyright "Copyright (C) 1999-200 Free Software Foundation, Inc." -define-author-name "Manuel Guesdon" -define-author-email "mguesdon@orange-concept.com" -define-author-desc "Developer" -define-author-url "http://www.gnustep.org/developers/whoiswho.html" -define-dtd-ref "/usr/GNUstep/System/Libraries/Resources/DTDs/gsdoc-0_6_6.dtd" -define-stylesheeturl "http://www.orange-concept.com/styles/default.css" -define-basetitle "GNUstepWeb - GSWeb" -define-dtd-url "http://www.gnustep.org/gsdoc-0_6_6.xml" -define-next "[[next]]" -define-prev "[[prev]]" -define-up "[[up]]" $($(LIBRARY_NAME)_HEADER_FILES)
mmv "Doc/tmp/*.html" "Doc/tmp/#1.gsdoc"
mv -f Doc/tmp/*.gsdoc Doc/
gsdocs:
@(cd Doc; \
gsdoc --verbose=1 --makeRefs --makeIndex --makeIndexTemplate=/usr/GNUstep/System/Libraries/Resources/DocTemplates/indextemplate.gsdoc --projectName="GSWeb" --refs=../../../ --define-version=1.0 --location="/usr/local/doc/dev/test/gsweb/GSWeb" --define-stylesheeturl="http://www.orange-concept.com/styles/default.css" --define-basetitle="GNUstepWeb - GSWeb" --define-dtd-url="http://www.gnustep.org/gsdoc-0_6_6.xml" --define-authorName="Manuel Guesdon" --define-author-email="mguesdon@orange-concept.com" --define-authorDesc="Developer" --define-authorURL="http://www.gnustep.org/developers/whoiswho.html" --define-copyright="Copyright (C) 1999-2000 Free Software Foundation, Inc." --define-date="" --define-up="../index" "*.gsdoc" ; \
cd ..; )
# Things to do after installing # Things to do after installing
after-install:: after-install::