mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-05-31 17:20:57 +00:00
o logs
o fixes in -invokeActionForRequest:inContext: git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@19315 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d698b389c3
commit
1ebefdc601
1 changed files with 89 additions and 62 deletions
|
@ -1,6 +1,6 @@
|
||||||
/** GSWGenericElement.m - <title>GSWeb: Class GSWGenericElement</title>
|
/** GSWGenericElement.m - <title>GSWeb: Class GSWGenericElement</title>
|
||||||
|
|
||||||
Copyright (C) 1999-2003 Free Software Foundation, Inc.
|
Copyright (C) 1999-2004 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
||||||
Date: Jan 1999
|
Date: Jan 1999
|
||||||
|
@ -36,16 +36,20 @@ RCS_ID("$Id$")
|
||||||
//====================================================================
|
//====================================================================
|
||||||
@implementation GSWGenericElement
|
@implementation GSWGenericElement
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
-(id)initWithName:(NSString*)name
|
-(id)initWithName:(NSString*)name
|
||||||
associations:(NSDictionary*)associations
|
associations:(NSDictionary*)associations
|
||||||
template:(GSWElement*)templateElement
|
template:(GSWElement*)templateElement
|
||||||
{
|
{
|
||||||
|
LOGObjectFnStart();
|
||||||
|
|
||||||
if ((self=[super initWithName: name
|
if ((self=[super initWithName: name
|
||||||
associations: associations
|
associations: associations
|
||||||
template: templateElement]))
|
template: templateElement]))
|
||||||
{
|
{
|
||||||
NSMutableDictionary *dict;
|
NSMutableDictionary *dict=nil;
|
||||||
|
|
||||||
|
ASSIGN(_elementName, [associations objectForKey: elementName__Key]);
|
||||||
ASSIGN(_name, [associations objectForKey: name__Key]);
|
ASSIGN(_name, [associations objectForKey: name__Key]);
|
||||||
ASSIGN(_omitTags, [associations objectForKey: omitTags__Key]);
|
ASSIGN(_omitTags, [associations objectForKey: omitTags__Key]);
|
||||||
ASSIGN(_formValue, [associations objectForKey: formValue__Key]);
|
ASSIGN(_formValue, [associations objectForKey: formValue__Key]);
|
||||||
|
@ -70,6 +74,7 @@ RCS_ID("$Id$")
|
||||||
|
|
||||||
dict = AUTORELEASE([associations mutableCopy]);
|
dict = AUTORELEASE([associations mutableCopy]);
|
||||||
|
|
||||||
|
[dict removeObjectForKey: elementName__Key];
|
||||||
[dict removeObjectForKey: name__Key];
|
[dict removeObjectForKey: name__Key];
|
||||||
[dict removeObjectForKey: omitTags__Key];
|
[dict removeObjectForKey: omitTags__Key];
|
||||||
[dict removeObjectForKey: formValue__Key];
|
[dict removeObjectForKey: formValue__Key];
|
||||||
|
@ -81,6 +86,8 @@ RCS_ID("$Id$")
|
||||||
ASSIGNCOPY(_otherAssociations, dict);
|
ASSIGNCOPY(_otherAssociations, dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOGObjectFnStop();
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -106,109 +113,109 @@ RCS_ID("$Id$")
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
-(void)appendToResponse:(GSWResponse*)response
|
-(void)appendToResponse:(GSWResponse*)response
|
||||||
inContext:(GSWContext*)context
|
inContext:(GSWContext*)context
|
||||||
{
|
{
|
||||||
[self _elementNameAppendToResponse: response inContext: context];
|
LOGObjectFnStart();
|
||||||
|
|
||||||
|
[self _elementNameAppendToResponse: response
|
||||||
|
inContext: context];
|
||||||
|
|
||||||
|
LOGObjectFnStop();
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||||
inContext:(GSWContext*)context
|
inContext:(GSWContext*)context
|
||||||
{
|
{
|
||||||
GSWElement *element;
|
GSWElement *element = nil;
|
||||||
GSWComponent *comp;
|
GSWComponent *component = nil;
|
||||||
|
|
||||||
|
LOGObjectFnStart();
|
||||||
|
|
||||||
|
component = [context component];
|
||||||
|
|
||||||
element = nil;
|
|
||||||
comp = [context component];
|
|
||||||
if (_invokeAction != nil
|
if (_invokeAction != nil
|
||||||
&& [_invokeAction isImplementedForComponent: comp])
|
&& [_invokeAction isImplementedForComponent:component])
|
||||||
{
|
{
|
||||||
NSString *elementID;
|
NSString *elementID = [context elementID];
|
||||||
NSString *senderID;
|
NSString *senderID = [context senderID];
|
||||||
|
|
||||||
elementID = [context elementID];
|
NSDebugMLog(@"elementID=%@ senderID=%@",
|
||||||
senderID = [context senderID];
|
elementID,senderID);
|
||||||
|
|
||||||
if ([elementID isEqualToString: senderID])
|
if ([elementID isEqualToString: senderID])
|
||||||
{
|
{
|
||||||
id nameValue;
|
if (_elementID != nil)
|
||||||
id formValue;
|
[_elementID setValue: [elementID description]
|
||||||
|
inComponent: component];
|
||||||
|
|
||||||
/* This implicitly also tests _hasFormValues
|
element = [_invokeAction valueInComponent:component];
|
||||||
as then we must have a _name,
|
if (!element)
|
||||||
but since we need the _name anyway,
|
element = [context page];
|
||||||
we can skip the extra test. */
|
}
|
||||||
if (_name == nil)
|
else if (_name)
|
||||||
{
|
{
|
||||||
return element;
|
id nameValue = [_name valueInComponent:component];
|
||||||
}
|
id formValue = [request stringFormValueForKey:nameValue];
|
||||||
|
|
||||||
nameValue = [_name valueInComponent: comp];
|
if (formValue)
|
||||||
formValue = [request formValueForKey: nameValue];
|
{
|
||||||
|
if(_elementID)
|
||||||
|
[_elementID setValue: [elementID description]
|
||||||
|
inComponent:component];
|
||||||
|
|
||||||
if (formValue == nil)
|
element = [_invokeAction valueInComponent: component];
|
||||||
{
|
if (!element)
|
||||||
return element;
|
element = [context page];
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
if (_elementID != nil)
|
|
||||||
{
|
|
||||||
[_elementID setValue: [elementID description]
|
|
||||||
inComponent: comp];
|
|
||||||
}
|
|
||||||
element = [_invokeAction valueInComponent: comp];
|
|
||||||
if (element != nil)
|
|
||||||
{
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
element = [context page];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOGObjectFnStop();
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||||
inContext:(GSWContext*)context
|
inContext:(GSWContext*)context
|
||||||
{
|
{
|
||||||
|
LOGObjectFnStart();
|
||||||
|
|
||||||
if (_hasFormValues)
|
if (_hasFormValues)
|
||||||
{
|
{
|
||||||
GSWComponent *comp;
|
GSWComponent *component = [context component];
|
||||||
NSString *elementID;
|
NSString *elementID = [context elementID];
|
||||||
id nameValue;
|
id nameValue = [_name valueInComponent: component];
|
||||||
|
|
||||||
comp = [context component];
|
|
||||||
elementID = [context elementID];
|
|
||||||
nameValue = [_name valueInComponent: comp];
|
|
||||||
if (_elementID != nil)
|
if (_elementID != nil)
|
||||||
{
|
{
|
||||||
[_elementID setValue: [elementID description]
|
[_elementID setValue: [elementID description]
|
||||||
inComponent: comp];
|
inComponent: component];
|
||||||
}
|
}
|
||||||
if (_formValue != nil)
|
if (_formValue != nil)
|
||||||
{
|
{
|
||||||
[_formValue setValue: [request formValueForKey: nameValue]
|
[_formValue setValue: [request stringFormValueForKey: nameValue]
|
||||||
inComponent: comp];
|
inComponent: component];
|
||||||
}
|
}
|
||||||
if (_formValues != nil)
|
if (_formValues != nil)
|
||||||
{
|
{
|
||||||
[_formValue setValue: [request formValuesForKey: nameValue]
|
[_formValue setValue: [request formValuesForKey: nameValue]
|
||||||
inComponent: comp];
|
inComponent: component];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOGObjectFnStop();
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
-(id)_elementNameAppendToResponse:(GSWResponse*)response
|
-(id)_elementNameAppendToResponse:(GSWResponse*)response
|
||||||
inContext:(GSWContext*)context
|
inContext:(GSWContext*)context
|
||||||
{
|
{
|
||||||
NSString *elementName;
|
NSString *elementName = nil;
|
||||||
|
|
||||||
|
LOGObjectFnStart();
|
||||||
|
|
||||||
if (_elementID != nil)
|
if (_elementID != nil)
|
||||||
{
|
{
|
||||||
|
@ -217,6 +224,7 @@ RCS_ID("$Id$")
|
||||||
}
|
}
|
||||||
|
|
||||||
elementName = [self _elementNameInContext: context];
|
elementName = [self _elementNameInContext: context];
|
||||||
|
NSDebugMLog(@"elementName=%@",elementName);
|
||||||
|
|
||||||
if (elementName != nil)
|
if (elementName != nil)
|
||||||
{
|
{
|
||||||
|
@ -225,6 +233,8 @@ RCS_ID("$Id$")
|
||||||
inContext: context];
|
inContext: context];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOGObjectFnStop();
|
||||||
|
|
||||||
return elementName;
|
return elementName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -233,7 +243,9 @@ RCS_ID("$Id$")
|
||||||
toResponse:(GSWResponse*)response
|
toResponse:(GSWResponse*)response
|
||||||
inContext:(GSWContext*)context
|
inContext:(GSWContext*)context
|
||||||
{
|
{
|
||||||
GSWComponent *comp;
|
GSWComponent *comp = nil;
|
||||||
|
|
||||||
|
LOGObjectFnStart();
|
||||||
|
|
||||||
comp = [context component];
|
comp = [context component];
|
||||||
[response appendContentCharacter:'<'];
|
[response appendContentCharacter:'<'];
|
||||||
|
@ -261,15 +273,18 @@ RCS_ID("$Id$")
|
||||||
}
|
}
|
||||||
[response appendContentCharacter: '>'];
|
[response appendContentCharacter: '>'];
|
||||||
|
|
||||||
|
LOGObjectFnStop();
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(void)_appendOtherAttributesToResponse:(GSWResponse*)response
|
-(void)_appendOtherAttributesToResponse:(GSWResponse*)response
|
||||||
inContext:(GSWContext*)context
|
inContext:(GSWContext*)context
|
||||||
{
|
{
|
||||||
GSWComponent *comp;
|
GSWComponent *comp = nil;
|
||||||
NSEnumerator *keyEnum;
|
NSEnumerator *keyEnum = nil;
|
||||||
NSString *key;
|
NSString *key = nil;
|
||||||
|
|
||||||
|
LOGObjectFnStart();
|
||||||
|
|
||||||
comp = [context component];
|
comp = [context component];
|
||||||
keyEnum = [_otherAssociations keyEnumerator];
|
keyEnum = [_otherAssociations keyEnumerator];
|
||||||
|
@ -291,11 +306,18 @@ RCS_ID("$Id$")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOGObjectFnStop();
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(NSString*)_elementNameInContext:(GSWContext*)context
|
-(NSString*)_elementNameInContext:(GSWContext*)context
|
||||||
{
|
{
|
||||||
|
NSString* elementName = nil;
|
||||||
|
|
||||||
|
LOGObjectFnStart();
|
||||||
|
|
||||||
|
NSDebugMLog(@"_elementName=%@",_elementName);
|
||||||
|
|
||||||
if (_elementName)
|
if (_elementName)
|
||||||
{
|
{
|
||||||
BOOL omit = NO;
|
BOOL omit = NO;
|
||||||
|
@ -307,10 +329,15 @@ RCS_ID("$Id$")
|
||||||
|
|
||||||
if (omit == NO)
|
if (omit == NO)
|
||||||
{
|
{
|
||||||
return [_elementName valueInComponent: [context component]];
|
elementName=[_elementName valueInComponent: [context component]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil;
|
|
||||||
|
NSDebugMLog(@"elementName=%@",elementName);
|
||||||
|
|
||||||
|
LOGObjectFnStop();
|
||||||
|
|
||||||
|
return elementName;
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue