mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-04-23 07:20:55 +00:00
2000-02-12 Manuel Guesdon <mguesdon@sbuilders.com>
* GSWForm.m: Added senderId test in -invokeActionForRequest:inContext: and -takeValuesFromRequest:inContext: * GSWComponentReference.m: Added senderId test in -invokeActionForRequest:inContext: and -takeValuesFromRequest:inContext: git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@5988 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
17a08632bb
commit
b54fa56d67
8 changed files with 202 additions and 108 deletions
|
@ -2314,9 +2314,22 @@ int GSWApplicationMain(NSString* _applicationClassName,
|
|||
GSWElement* element=nil;
|
||||
GSWSession* _session=nil;
|
||||
LOGObjectFnStart();
|
||||
_session=[context_ existingSession];
|
||||
element=[_session invokeActionForRequest:request_
|
||||
inContext:context_];
|
||||
NS_DURING
|
||||
{
|
||||
_session=[context_ existingSession];
|
||||
element=[_session invokeActionForRequest:request_
|
||||
inContext:context_];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
LOGException0(@"exception in GSWApplication invokeActionForRequest:inContext");
|
||||
LOGException(@"exception=%@",localException);
|
||||
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
|
||||
@"In GSWApplication invokeActionForRequest:inContext");
|
||||
LOGException(@"exception=%@",localException);
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
LOGObjectFnStop();
|
||||
return element;
|
||||
};
|
||||
|
|
|
@ -965,11 +965,24 @@ associationsKeys:(NSArray*)_associationsKeys
|
|||
#endif
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswcomponents",@"ET=%@ id=%@",[self class],[context_ elementID]);
|
||||
_template=[self _template];
|
||||
[context_ appendZeroElementIDComponent];
|
||||
element=[[self _template] invokeActionForRequest:request_
|
||||
inContext:context_];
|
||||
[context_ deleteLastElementIDComponent];
|
||||
NS_DURING
|
||||
{
|
||||
_template=[self _template];
|
||||
[context_ appendZeroElementIDComponent];
|
||||
element=[[self _template] invokeActionForRequest:request_
|
||||
inContext:context_];
|
||||
[context_ deleteLastElementIDComponent];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
LOGException0(@"exception in GSWComponent invokeActionForRequest:inContext");
|
||||
LOGException(@"exception=%@",localException);
|
||||
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
|
||||
@"In GSWComponent invokeActionForRequest:inContext");
|
||||
LOGException(@"exception=%@",localException);
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
NSDebugMLLog(@"gswcomponents",@"ET=%@ id=%@",[self class],[context_ elementID]);
|
||||
#ifndef NDEBUG
|
||||
if (![debugElementID isEqualToString:[context_ elementID]])
|
||||
|
|
|
@ -237,9 +237,18 @@ static char rcsId[] = "$Id$";
|
|||
[self pushRefComponentInContext:context_];
|
||||
if ([context_ component])
|
||||
{
|
||||
_component=[context_ component];
|
||||
_element=[_component invokeActionForRequest:request_
|
||||
inContext:context_];
|
||||
NSString* _senderID=nil;
|
||||
NSString* _elementID=nil;
|
||||
_senderID=[context_ senderID];
|
||||
_elementID=[context_ elementID];
|
||||
NSDebugMLLog(@"gswdync",@"_senderID=%@",_senderID);
|
||||
NSDebugMLLog(@"gswdync",@"_elementID=%@",_elementID);
|
||||
if ([_senderID hasPrefix:_elementID]) //Avoid trying to find action if we are not the good component
|
||||
{
|
||||
_component=[context_ component];
|
||||
_element=[_component invokeActionForRequest:request_
|
||||
inContext:context_];
|
||||
};
|
||||
[self popRefComponentInContext:context_];
|
||||
}
|
||||
else
|
||||
|
|
|
@ -357,6 +357,7 @@ static char rcsId[] = "$Id$";
|
|||
@"In invokeActionForRequest component=%@ of Class %@",
|
||||
[_component name],
|
||||
[_component class]);
|
||||
LOGException(@"exception=%@",localException);
|
||||
ASSIGN(_exception,localException);
|
||||
if (!_responsePage)
|
||||
{
|
||||
|
|
|
@ -243,43 +243,59 @@ static char rcsId[] = "$Id$";
|
|||
int i=0;
|
||||
LOGObjectFnStartC("GSWForm");
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context_ elementID]);
|
||||
_senderID=[context_ senderID];
|
||||
_elementID=[context_ elementID];
|
||||
_isFormSubmited=[_elementID isEqualToString:_senderID];
|
||||
#if !GSWEB_STRICT
|
||||
if (_isFormSubmited && [self disabledInContext:context_])
|
||||
_isFormSubmited=NO;
|
||||
#endif
|
||||
if (_isFormSubmited)
|
||||
NS_DURING
|
||||
{
|
||||
[context_ setInForm:YES];
|
||||
[context_ _setFormSubmitted:YES];
|
||||
_multipleSubmit=[self evaluateCondition:multipleSubmit
|
||||
inContext:context_];
|
||||
[context_ _setIsMultipleSubmitForm:_multipleSubmit];
|
||||
};
|
||||
[context_ appendZeroElementIDComponent];
|
||||
for(i=0;!_element && i<[dynamicChildren count];i++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[[dynamicChildren objectAtIndex:i] class],[context_ elementID]);
|
||||
_element=[[dynamicChildren objectAtIndex:i] invokeActionForRequest:request_
|
||||
inContext:context_];
|
||||
[context_ incrementLastElementIDComponent];
|
||||
};
|
||||
[context_ deleteLastElementIDComponent];
|
||||
if (_isFormSubmited)
|
||||
{
|
||||
if ([context_ _wasActionInvoked])
|
||||
_senderID=[context_ senderID];
|
||||
_elementID=[context_ elementID];
|
||||
if ([_senderID hasPrefix:_elementID]) //Avoid trying to find action if we are not the good form
|
||||
{
|
||||
[context_ _setIsMultipleSubmitForm:NO];
|
||||
};
|
||||
[context_ setInForm:NO];
|
||||
[context_ _setFormSubmitted:NO];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]);
|
||||
#ifndef NDEBBUG
|
||||
NSAssert(elementsNb==[(GSWElementIDString*)[context_ elementID]elementsNb],@"GSWForm invokeActionForRequest: bad elementID");
|
||||
_isFormSubmited=[_elementID isEqualToString:_senderID];
|
||||
#if !GSWEB_STRICT
|
||||
if (_isFormSubmited && [self disabledInContext:context_])
|
||||
_isFormSubmited=NO;
|
||||
#endif
|
||||
if (_isFormSubmited)
|
||||
{
|
||||
[context_ setInForm:YES];
|
||||
[context_ _setFormSubmitted:YES];
|
||||
_multipleSubmit=[self evaluateCondition:multipleSubmit
|
||||
inContext:context_];
|
||||
[context_ _setIsMultipleSubmitForm:_multipleSubmit];
|
||||
};
|
||||
[context_ appendZeroElementIDComponent];
|
||||
for(i=0;!_element && i<[dynamicChildren count];i++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[[dynamicChildren objectAtIndex:i] class],[context_ elementID]);
|
||||
_element=[[dynamicChildren objectAtIndex:i] invokeActionForRequest:request_
|
||||
inContext:context_];
|
||||
[context_ incrementLastElementIDComponent];
|
||||
};
|
||||
[context_ deleteLastElementIDComponent];
|
||||
if (_isFormSubmited)
|
||||
{
|
||||
if ([context_ _wasActionInvoked])
|
||||
{
|
||||
[context_ _setIsMultipleSubmitForm:NO];
|
||||
};
|
||||
[context_ setInForm:NO];
|
||||
[context_ _setFormSubmitted:NO];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]);
|
||||
#ifndef NDEBBUG
|
||||
NSAssert(elementsNb==[(GSWElementIDString*)[context_ elementID]elementsNb],@"GSWForm invokeActionForRequest: bad elementID");
|
||||
#endif
|
||||
};
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
LOGException0(@"exception in GSWForm invokeActionForRequest:inContext");
|
||||
LOGException(@"exception=%@",localException);
|
||||
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
|
||||
@"In GSWForm invokeActionForRequest:inContext");
|
||||
LOGException(@"exception=%@",localException);
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
LOGObjectFnStopC("GSWForm");
|
||||
return _element;
|
||||
};
|
||||
|
@ -302,35 +318,38 @@ static char rcsId[] = "$Id$";
|
|||
_elementID=[context_ elementID];
|
||||
NSDebugMLLog(@"gswdync",@"_senderID=%@",_senderID);
|
||||
NSDebugMLLog(@"gswdync",@"_elementID=%@",_elementID);
|
||||
_isFormSubmited=[_elementID isEqualToString:_senderID];
|
||||
NSDebugMLLog(@"gswdync",@"_isFormSubmited=%d",(int)_isFormSubmited);
|
||||
if ([_senderID hasPrefix:_elementID]) //Avoid taking values if we are not the good form
|
||||
{
|
||||
_isFormSubmited=[_elementID isEqualToString:_senderID];
|
||||
NSDebugMLLog(@"gswdync",@"_isFormSubmited=%d",(int)_isFormSubmited);
|
||||
#if !GSWEB_STRICT
|
||||
if (_isFormSubmited && [self disabledInContext:context_])
|
||||
_isFormSubmited=NO;
|
||||
if (_isFormSubmited && [self disabledInContext:context_])
|
||||
_isFormSubmited=NO;
|
||||
#endif
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"Starting GSWForm TV ET=%@ id=%@",[self class],[context_ elementID]);
|
||||
if (_isFormSubmited)
|
||||
{
|
||||
[context_ setInForm:YES];
|
||||
[context_ _setFormSubmitted:YES];
|
||||
};
|
||||
[context_ appendZeroElementIDComponent];
|
||||
NSDebugMLLog(@"gswdync",@"\n\ndynamicChildren=%@",dynamicChildren);
|
||||
NSDebugMLLog(@"gswdync",@"[dynamicChildren count]=%d",[dynamicChildren count]);
|
||||
for(i=0;i<[dynamicChildren count];i++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[[dynamicChildren objectAtIndex:i] class],[context_ elementID]);
|
||||
NSDebugMLLog(@"gswdync",@"\n[dynamicChildren objectAtIndex:i]=%@",[dynamicChildren objectAtIndex:i]);
|
||||
[[dynamicChildren objectAtIndex:i] takeValuesFromRequest:request_
|
||||
inContext:context_];
|
||||
[context_ incrementLastElementIDComponent];
|
||||
};
|
||||
[context_ deleteLastElementIDComponent];
|
||||
if (_isFormSubmited)
|
||||
{
|
||||
[context_ setInForm:NO];
|
||||
[context_ _setFormSubmitted:NO];
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"Starting GSWForm TV ET=%@ id=%@",[self class],[context_ elementID]);
|
||||
if (_isFormSubmited)
|
||||
{
|
||||
[context_ setInForm:YES];
|
||||
[context_ _setFormSubmitted:YES];
|
||||
};
|
||||
[context_ appendZeroElementIDComponent];
|
||||
NSDebugMLLog(@"gswdync",@"\n\ndynamicChildren=%@",dynamicChildren);
|
||||
NSDebugMLLog(@"gswdync",@"[dynamicChildren count]=%d",[dynamicChildren count]);
|
||||
for(i=0;i<[dynamicChildren count];i++)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[[dynamicChildren objectAtIndex:i] class],[context_ elementID]);
|
||||
NSDebugMLLog(@"gswdync",@"\n[dynamicChildren objectAtIndex:i]=%@",[dynamicChildren objectAtIndex:i]);
|
||||
[[dynamicChildren objectAtIndex:i] takeValuesFromRequest:request_
|
||||
inContext:context_];
|
||||
[context_ incrementLastElementIDComponent];
|
||||
};
|
||||
[context_ deleteLastElementIDComponent];
|
||||
if (_isFormSubmited)
|
||||
{
|
||||
[context_ setInForm:NO];
|
||||
[context_ _setFormSubmitted:NO];
|
||||
};
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]);
|
||||
#ifndef NDEBBUG
|
||||
|
|
|
@ -1500,7 +1500,7 @@ NSString* globalLanguagesPListPathName=nil;
|
|||
int i=0;
|
||||
for(i=0;i<[ISOLanguages_ count];i++)
|
||||
{
|
||||
_ISOLanguage=[[ISOLanguages_ objectAtIndex:i] lowercaseString];
|
||||
_ISOLanguage=[[[ISOLanguages_ objectAtIndex:i] stringByTrimmingSpaces] lowercaseString];
|
||||
_GSLanguage=[self GSLanguageFromISOLanguage:_ISOLanguage];
|
||||
if (_GSLanguage)
|
||||
[_array addObject:_GSLanguage];
|
||||
|
@ -1534,7 +1534,7 @@ NSString* globalLanguagesPListPathName=nil;
|
|||
int i=0;
|
||||
for(i=0;i<[GSLanguages_ count];i++)
|
||||
{
|
||||
_GSLanguage=[[GSLanguages_ objectAtIndex:i] lowercaseString];
|
||||
_GSLanguage=[[[GSLanguages_ objectAtIndex:i] stringByTrimmingSpaces] lowercaseString];
|
||||
_ISOLanguage=[self ISOLanguageFromGSLanguage:_GSLanguage];
|
||||
[_array addObject:_ISOLanguage];
|
||||
};
|
||||
|
|
|
@ -1093,14 +1093,27 @@ static char rcsId[] = "$Id$";
|
|||
GSWElement* _pageElement=nil;
|
||||
GSWComponent* _pageComponent=nil;
|
||||
LOGObjectFnStart();
|
||||
_pageElement=[context_ _pageElement];
|
||||
_pageComponent=[context_ _pageComponent];
|
||||
[context_ _setCurrentComponent:_pageComponent]; //_pageElement ??
|
||||
_element=[_pageComponent invokeActionForRequest:request_
|
||||
inContext:context_]; //_pageComponent
|
||||
[context_ _setCurrentComponent:nil];
|
||||
if (!_element)
|
||||
_element=[context_ page]; //??
|
||||
NS_DURING
|
||||
{
|
||||
_pageElement=[context_ _pageElement];
|
||||
_pageComponent=[context_ _pageComponent];
|
||||
[context_ _setCurrentComponent:_pageComponent]; //_pageElement ??
|
||||
_element=[_pageComponent invokeActionForRequest:request_
|
||||
inContext:context_]; //_pageComponent
|
||||
[context_ _setCurrentComponent:nil];
|
||||
if (!_element)
|
||||
_element=[context_ page]; //??
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
LOGException0(@"exception in GSWSession invokeActionForRequest:inContext");
|
||||
LOGException(@"exception=%@",localException);
|
||||
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
|
||||
@"In GSWSession invokeActionForRequest:inContext");
|
||||
LOGException(@"exception=%@",localException);
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
LOGObjectFnStop();
|
||||
return _element;
|
||||
};
|
||||
|
|
|
@ -97,38 +97,64 @@ static char rcsId[] = "$Id$";
|
|||
GSWElement* _element=nil;
|
||||
BOOL _disabled=NO;
|
||||
LOGObjectFnStart();
|
||||
_disabled=[self disabledInContext:context_];
|
||||
if (!_disabled)
|
||||
NS_DURING
|
||||
{
|
||||
BOOL _wasFormSubmitted=[context_ _wasFormSubmitted];
|
||||
if (_wasFormSubmitted)
|
||||
_disabled=[self disabledInContext:context_];
|
||||
if (!_disabled)
|
||||
{
|
||||
BOOL _invoked=NO;
|
||||
GSWComponent* _component=[context_ component];
|
||||
BOOL _isMultipleSubmitForm=[context_ _isMultipleSubmitForm];
|
||||
if (_isMultipleSubmitForm)
|
||||
BOOL _wasFormSubmitted=[context_ _wasFormSubmitted];
|
||||
if (_wasFormSubmitted)
|
||||
{
|
||||
NSString* _nameInContext=[self nameInContext:context_];
|
||||
NSString* _formValue=[request_ formValueForKey:_nameInContext];
|
||||
NSDebugMLLog(@"gswdync",@"_formValue=%@",_formValue);
|
||||
if (_formValue)
|
||||
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
|
||||
_invoked=YES;
|
||||
}
|
||||
else
|
||||
_invoked=YES;
|
||||
if (_invoked)
|
||||
{
|
||||
id _actionValue=nil;
|
||||
NSDebugMLLog0(@"gswdync",@"Invoked Object Found !!");
|
||||
[context_ _setActionInvoked:1];
|
||||
_actionValue=[action valueInComponent:_component];
|
||||
if (_actionValue)
|
||||
_element=_actionValue;
|
||||
if (!_element)
|
||||
_element=[context_ page];
|
||||
if (_invoked)
|
||||
{
|
||||
id _actionValue=nil;
|
||||
NSDebugMLLog0(@"gswdync",@"Invoked Object Found !!");
|
||||
[context_ _setActionInvoked:1];
|
||||
NS_DURING
|
||||
{
|
||||
_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)
|
||||
_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];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
LOGObjectFnStop();
|
||||
return _element;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue