mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-04-24 07:49:06 +00:00
* GSWeb/GSWPopUpButton.m
fix _slowTakeValuesFromRequest:inContext: (convert valueValue before isEqual:) replace while loop by a simplier for loop respect GNUstep coding standard (curly brackets placement) rename variable to make code more understandable * GSWeb/GSWComponent.m respect GNUstep coding standard (curly brackets placement) fix validateTakeValue:forKeyPath: (set value if only if different) remove non standard and unused methods validation stuff: -setValidationFailureMessage:forElement: -validationFailureMessageForElement: -handleValidationExceptionDefault -isValidationFailure -validationFailureMessages -allValidationFailureMessages fix -path remove context -setIsValidate: calls remove _uniqueID clean code * GSWeb/GSWComponent.h remove _validationFailureMessages remove non standard and unused methods validation stuff remove _uniqueID * GSWeb/GSWUtils.[hm] remove non standard -isValidationException remove -ValidationExceptionRaise* * GSWeb/GSWContext.[hm] remove -setValidate remove -isValidate * GSWeb/GSWApplication.m remove context -setIsValidate: calls git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@37800 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4f18e087c5
commit
8f1f977388
9 changed files with 601 additions and 752 deletions
33
ChangeLog
33
ChangeLog
|
@ -1,3 +1,36 @@
|
|||
2014-04-17 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
* GSWeb/GSWPopUpButton.m
|
||||
fix _slowTakeValuesFromRequest:inContext:
|
||||
(convert valueValue before isEqual:)
|
||||
replace while loop by a simplier for loop
|
||||
respect GNUstep coding standard (curly brackets placement)
|
||||
rename variable to make code more understandable
|
||||
* GSWeb/GSWComponent.m
|
||||
respect GNUstep coding standard (curly brackets placement)
|
||||
fix validateTakeValue:forKeyPath: (set value if only if different)
|
||||
remove non standard and unused methods validation stuff:
|
||||
-setValidationFailureMessage:forElement:
|
||||
-validationFailureMessageForElement:
|
||||
-handleValidationExceptionDefault
|
||||
-isValidationFailure
|
||||
-validationFailureMessages
|
||||
-allValidationFailureMessages
|
||||
fix -path
|
||||
remove context -setIsValidate: calls
|
||||
remove _uniqueID
|
||||
clean code
|
||||
* GSWeb/GSWComponent.h
|
||||
remove _validationFailureMessages
|
||||
remove non standard and unused methods validation stuff
|
||||
remove _uniqueID
|
||||
* GSWeb/GSWUtils.[hm]
|
||||
remove non standard -isValidationException
|
||||
remove -ValidationExceptionRaise*
|
||||
* GSWeb/GSWContext.[hm]
|
||||
remove -setValidate
|
||||
remove -isValidate
|
||||
* GSWeb/GSWApplication.m
|
||||
remove context -setIsValidate: calls
|
||||
2014-04-11 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
* GSWeb/GSWHyperlink.m
|
||||
fix generateRelativeURLs/generateRelativeURLs
|
||||
|
|
|
@ -1946,17 +1946,14 @@ to another instance **/
|
|||
//NDFN
|
||||
-(void)lockedAddTimer:(NSTimer*)aTimer
|
||||
{
|
||||
|
||||
[[self runLoop]addTimer:aTimer
|
||||
forMode:NSDefaultRunLoopMode];
|
||||
|
||||
forMode:NSDefaultRunLoopMode];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//NDFN
|
||||
-(void)addTimer:(NSTimer*)aTimer
|
||||
{
|
||||
|
||||
{
|
||||
[self lock];
|
||||
NS_DURING
|
||||
{
|
||||
|
@ -1970,8 +1967,7 @@ to another instance **/
|
|||
[localException raise];
|
||||
};
|
||||
NS_ENDHANDLER;
|
||||
[self unlock];
|
||||
|
||||
[self unlock];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -2045,32 +2041,30 @@ to another instance **/
|
|||
{
|
||||
GSWResponse * response=nil;
|
||||
GSWRequestHandler * requestHandler=nil;
|
||||
NSNotificationCenter * noteCenter = [NSNotificationCenter defaultCenter];
|
||||
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
ASSIGN(_lastAccessDate,[NSDate date]);
|
||||
{
|
||||
NSNotificationCenter * noteCenter = [NSNotificationCenter defaultCenter];
|
||||
ASSIGN(_lastAccessDate,[NSDate date]);
|
||||
|
||||
[noteCenter postNotificationName:@"ApplicationWillDispatchRequestNotification"
|
||||
object:aRequest];
|
||||
|
||||
requestHandler = [self handlerForRequest:aRequest];
|
||||
|
||||
[noteCenter postNotificationName:@"ApplicationWillDispatchRequestNotification"
|
||||
object:aRequest];
|
||||
if (!requestHandler)
|
||||
requestHandler = [self defaultRequestHandler];
|
||||
|
||||
requestHandler = [self handlerForRequest:aRequest];
|
||||
response = [requestHandler handleRequest:aRequest];
|
||||
if (!response)
|
||||
response = [self createResponseInContext:nil];
|
||||
|
||||
if (!requestHandler)
|
||||
requestHandler = [self defaultRequestHandler];
|
||||
|
||||
response = [requestHandler handleRequest:aRequest];
|
||||
if (!response) {
|
||||
response = [self createResponseInContext:nil];
|
||||
[self _resetCache];
|
||||
|
||||
[noteCenter postNotificationName:@"ApplicationDidDispatchRequestNotification"
|
||||
object:response];
|
||||
[aRequest _setContext:nil];
|
||||
}
|
||||
|
||||
[self _resetCache];
|
||||
|
||||
[noteCenter postNotificationName:@"ApplicationDidDispatchRequestNotification"
|
||||
object:response];
|
||||
[aRequest _setContext:nil];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"EXCEPTION: %@",localException);
|
||||
|
@ -2094,15 +2088,9 @@ to another instance **/
|
|||
-(void)takeValuesFromRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
//OK
|
||||
GSWSession* session=nil;
|
||||
|
||||
[aContext setValidate:YES];
|
||||
session=[aContext existingSession];
|
||||
GSWSession* session=[aContext existingSession];
|
||||
[session takeValuesFromRequest:aRequest
|
||||
inContext:aContext];
|
||||
[aContext setValidate:NO];
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -2112,24 +2100,23 @@ to another instance **/
|
|||
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
GSWSession* session=nil;
|
||||
id <GSWActionResults> results = nil;
|
||||
|
||||
NS_DURING
|
||||
id <GSWActionResults> results = nil;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
session = [aContext existingSession];
|
||||
results = [session invokeActionForRequest:aRequest
|
||||
inContext:aContext];
|
||||
GSWSession* session = [aContext existingSession];
|
||||
results = [session invokeActionForRequest:aRequest
|
||||
inContext:aContext];
|
||||
}
|
||||
NS_HANDLER
|
||||
NS_HANDLER
|
||||
{
|
||||
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
|
||||
@"In GSWApplication invokeActionForRequest:inContext");
|
||||
[localException raise];
|
||||
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
|
||||
@"In GSWApplication invokeActionForRequest:inContext");
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
|
||||
return results;
|
||||
NS_ENDHANDLER;
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -2138,12 +2125,8 @@ to another instance **/
|
|||
-(void)appendToResponse:(GSWResponse*)aResponse
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
GSWRequest* request=nil;
|
||||
GSWSession* session=nil;
|
||||
|
||||
|
||||
request=[aContext request];
|
||||
session=[aContext existingSession];
|
||||
GSWRequest* request=[aContext request];
|
||||
GSWSession* session=[aContext existingSession];
|
||||
|
||||
if ([aContext _isRefusingThisRequest])
|
||||
{
|
||||
|
@ -2189,8 +2172,7 @@ to another instance **/
|
|||
-(void)_setRecordingHeadersToResponse:(GSWResponse*)aResponse
|
||||
forRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
|
||||
{
|
||||
if (_recorder
|
||||
&& ([aRequest headerForKey:GSWHTTPHeader_Recording[GSWebNamingConv]]
|
||||
|| [[self class] recordingPath]))
|
||||
|
|
|
@ -63,7 +63,6 @@
|
|||
NSDictionary* _userDictionary;
|
||||
NSDictionary* _userAssociations;
|
||||
NSDictionary* _defaultAssociations;
|
||||
NSMutableDictionary* _validationFailureMessages;
|
||||
// }
|
||||
BOOL _isPage;
|
||||
BOOL _isCachingEnabled;
|
||||
|
@ -161,15 +160,6 @@
|
|||
inContext:(GSWContext*)aContext;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)aContext;
|
||||
#if !GSWEB_STRICT
|
||||
-(void)setValidationFailureMessage:(NSString*)message
|
||||
forElement:(GSWDynamicElement*)element;
|
||||
-(NSString*)validationFailureMessageForElement:(GSWDynamicElement*)element;
|
||||
-(NSString*)handleValidationExceptionDefault;
|
||||
-(BOOL)isValidationFailure;
|
||||
-(NSDictionary*)validationFailureMessages;
|
||||
-(NSArray*)allValidationFailureMessages;
|
||||
#endif
|
||||
|
||||
/*
|
||||
Makes sure that the receiver is awake in aContext.
|
||||
|
@ -207,8 +197,6 @@ Call this method before using a component which was cached in a variable.
|
|||
arguments:(va_list)argList;
|
||||
+(void)logWithFormat:(NSString*)format,...;
|
||||
|
||||
-(NSString*)_uniqueID;
|
||||
|
||||
-(GSWResponse*)_generateResponseInContext:(GSWContext*)aContext;
|
||||
-(NSException*)validateValue:(id*)valuePtr
|
||||
forKey:(NSString*)key;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -113,7 +113,6 @@ GSWEB_EXPORT BOOL GSWContext_isSenderIDSearchOver(GSWContext* aContext);
|
|||
BOOL _actionInvoked;
|
||||
BOOL _formSubmitted;
|
||||
BOOL _isMultipleSubmitForm;
|
||||
BOOL _isValidate;
|
||||
#ifndef NDEBUG
|
||||
int _loopLevel; //ForDebugging purpose: each repetition increment and next decrement it
|
||||
NSMutableString* _docStructure; //ForDebugging purpose: array of all objects if the document during appendResponse, takeValues, invokeAction
|
||||
|
@ -393,9 +392,6 @@ If none, try request languages
|
|||
- (NSString*) _urlForResourceNamed: (NSString*)aName
|
||||
inFramework: (NSString*)frameworkName;
|
||||
|
||||
-(BOOL)isValidate;
|
||||
-(void)setValidate:(BOOL)isValidate;
|
||||
|
||||
-(BOOL)secureMode;
|
||||
-(void)setSecureMode:(BOOL) value;
|
||||
|
||||
|
|
|
@ -2106,17 +2106,6 @@ If none, try request languages
|
|||
request: _request];
|
||||
}
|
||||
|
||||
-(BOOL)isValidate
|
||||
{
|
||||
return _isValidate;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)setValidate:(BOOL)isValidate
|
||||
{
|
||||
_isValidate = isValidate;
|
||||
}
|
||||
|
||||
- (BOOL) secureRequest
|
||||
{
|
||||
BOOL isSecure = NO;
|
||||
|
|
|
@ -162,96 +162,125 @@ static SEL valueInComponentSEL = NULL;
|
|||
inContext:(GSWContext*) context
|
||||
{
|
||||
GSWComponent * component = GSWContext_component(context);
|
||||
if ((_selection != nil) && (![self disabledInComponent:component]) && ([context _wasFormSubmitted])) {
|
||||
id obj = nil;
|
||||
id itemValue = nil;
|
||||
id valueValue = nil;
|
||||
|
||||
NSString * ctxName = [self nameInContext:context];
|
||||
NSString * formValue = [request stringFormValueForKey: ctxName];
|
||||
if (formValue != nil && (![formValue isEqual:@"WONoSelectionString"])) {
|
||||
id compoValue = [_list valueInComponent:component];
|
||||
if (compoValue != nil) {
|
||||
if ([compoValue isKindOfClass:[NSArray class]]) {
|
||||
NSArray * valueArray = (NSArray*)compoValue;
|
||||
int i = [valueArray count];
|
||||
int k = 0;
|
||||
while (YES) {
|
||||
if (k >= i) {
|
||||
break;
|
||||
}
|
||||
itemValue = [valueArray objectAtIndex:k];
|
||||
[_item setValue: itemValue inComponent:component]; // ???
|
||||
valueValue = [_value valueInComponent:component];
|
||||
if (valueValue != nil) {
|
||||
if ([formValue isEqual:valueValue]) { // stringValue?
|
||||
obj = itemValue;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
NSLog(@"%s:'value' evaluated to nil in component '%@'.\nUnable to select item '%@'",
|
||||
__PRETTY_FUNCTION__,
|
||||
component,
|
||||
itemValue);
|
||||
}
|
||||
k++;
|
||||
}
|
||||
} else {
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"%s: Evaluating 'list' binding returned a '%@' class and not a NSArray.",
|
||||
__PRETTY_FUNCTION__, [compoValue class]];
|
||||
}
|
||||
}
|
||||
if (_selection != nil
|
||||
&& ![self disabledInComponent:component]
|
||||
&& [context _wasFormSubmitted])
|
||||
{
|
||||
id selection = nil;
|
||||
|
||||
NSString * ctxName = [self nameInContext:context];
|
||||
NSString * formValue = [request stringFormValueForKey: ctxName];
|
||||
|
||||
if (formValue != nil
|
||||
&& ![formValue isEqual:@"WONoSelectionString"])
|
||||
{
|
||||
NSArray* list = [_list valueInComponent:component];
|
||||
if (list != nil)
|
||||
{
|
||||
if ([list isKindOfClass:[NSArray class]])
|
||||
{
|
||||
id item = nil;
|
||||
id value = nil;
|
||||
NSUInteger listCount = [list count];
|
||||
NSUInteger i = 0;
|
||||
for(i=0;i<listCount;i++)
|
||||
{
|
||||
item = [list objectAtIndex:i];
|
||||
[_item setValue: item
|
||||
inComponent:component];
|
||||
value = [_value valueInComponent:component];
|
||||
if (value != nil)
|
||||
{
|
||||
if ([formValue isEqual:NSStringWithObject(value)])
|
||||
{
|
||||
selection = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"%s:'value' evaluated to nil in component '%@'.\nUnable to select item '%@'",
|
||||
__PRETTY_FUNCTION__,component,item);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"%s: Evaluating 'list' binding returned a '%@' class and not a NSArray.",
|
||||
__PRETTY_FUNCTION__, [list class]];
|
||||
}
|
||||
}
|
||||
}
|
||||
[_selection setValue:selection
|
||||
inComponent: component];
|
||||
}
|
||||
[_selection setValue:obj inComponent: component];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) _fastTakeValuesFromRequest:(GSWRequest*) request
|
||||
inContext:(GSWContext*) context
|
||||
{
|
||||
GSWComponent * component = GSWContext_component(context);
|
||||
if (_selection != nil)
|
||||
{
|
||||
GSWComponent * component = GSWContext_component(context);
|
||||
|
||||
if ((_selection != nil) && (![self disabledInComponent:component]) && ([context _wasFormSubmitted])) {
|
||||
id obj = nil;
|
||||
NSString * ctxName = [self nameInContext:context];
|
||||
NSString * formValue = [request stringFormValueForKey: ctxName];
|
||||
if (formValue != nil) {
|
||||
formValue = [formValue stringByTrimmingSpaces];
|
||||
if (![formValue isEqual:@"WONoSelectionString"]) {
|
||||
int i = [formValue intValue];
|
||||
id compoValue = [_list valueInComponent:component];
|
||||
if (compoValue != nil) {
|
||||
if ([compoValue isKindOfClass:[NSArray class]]) {
|
||||
NSArray * valueArray = compoValue;
|
||||
if ((i < [valueArray count]) && (i >= 0)) {
|
||||
obj = [valueArray objectAtIndex:i];
|
||||
}
|
||||
} else {
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"%s: Evaluating 'list' binding returned a '%@' class and not a NSArray.",
|
||||
__PRETTY_FUNCTION__, [compoValue class]];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (![self disabledInComponent:component]
|
||||
&& [context _wasFormSubmitted])
|
||||
{
|
||||
id selection = nil;
|
||||
NSString * ctxName = [self nameInContext:context];
|
||||
NSString * formValue = [request stringFormValueForKey: ctxName];
|
||||
if (formValue != nil)
|
||||
{
|
||||
formValue = [formValue stringByTrimmingSpaces];
|
||||
if (![formValue isEqual:@"WONoSelectionString"])
|
||||
{
|
||||
int i = [formValue intValue];
|
||||
NSArray* list = [_list valueInComponent:component];
|
||||
if (list != nil)
|
||||
{
|
||||
if ([list isKindOfClass:[NSArray class]])
|
||||
{
|
||||
if (i < [list count]
|
||||
&& i >= 0)
|
||||
{
|
||||
selection = [list objectAtIndex:i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"%s: Evaluating 'list' binding returned a '%@' class and not a NSArray.",
|
||||
__PRETTY_FUNCTION__, [list class]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
[_selection setValue: selection
|
||||
inComponent: component];
|
||||
}
|
||||
}
|
||||
[_selection setValue:obj inComponent: component];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
if (_value != nil) {
|
||||
if (!_loggedSlow) {
|
||||
NSLog(@"%s Warning: Avoid using the 'value' binding as it is much slower than omitting it, and it is just cosmetic.",
|
||||
__PRETTY_FUNCTION__);
|
||||
_loggedSlow = YES;
|
||||
if (_value != nil)
|
||||
{
|
||||
if (!_loggedSlow)
|
||||
{
|
||||
NSLog(@"%s Warning: Avoid using the 'value' binding as it is much slower than omitting it, and it is just cosmetic.",
|
||||
__PRETTY_FUNCTION__);
|
||||
_loggedSlow = YES;
|
||||
}
|
||||
[self _slowTakeValuesFromRequest:request
|
||||
inContext:context];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self _fastTakeValuesFromRequest:request
|
||||
inContext:context];
|
||||
}
|
||||
[self _slowTakeValuesFromRequest:request inContext:context];
|
||||
} else {
|
||||
[self _fastTakeValuesFromRequest:request inContext:context];
|
||||
}
|
||||
}
|
||||
|
||||
-(void) _appendValueAttributeToResponse:(GSWResponse *) response
|
||||
|
@ -262,123 +291,145 @@ static SEL valueInComponentSEL = NULL;
|
|||
-(void) appendChildrenToResponse:(GSWResponse *) response
|
||||
inContext:(GSWContext*) context
|
||||
{
|
||||
NSArray * valueArray = nil;
|
||||
int j = 0;
|
||||
id obj = nil;
|
||||
BOOL isSelected = NO;
|
||||
id compoValue = nil;
|
||||
int i = 0;
|
||||
NSString * valueValue = nil;
|
||||
NSString * s1 = nil;
|
||||
id arrayObj = nil;
|
||||
NSArray * list = nil;
|
||||
NSUInteger listCount = 0;
|
||||
|
||||
GSWComponent * component = GSWContext_component(context);
|
||||
BOOL doEscape = YES;
|
||||
|
||||
if (_escapeHTML != nil) {
|
||||
if (_escapeHTML != nil)
|
||||
doEscape = [_escapeHTML boolValueInComponent:component];
|
||||
}
|
||||
compoValue = [_list valueInComponent:component];
|
||||
if (compoValue != nil) {
|
||||
if ([compoValue isKindOfClass:[NSArray class]]) {
|
||||
valueArray = compoValue;
|
||||
j = [valueArray count];
|
||||
} else {
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"%s: Evaluating 'list' binding returned a '%@' class and not a NSArray.",
|
||||
__PRETTY_FUNCTION__, [compoValue class]];
|
||||
|
||||
list = [_list valueInComponent:component];
|
||||
if (list != nil)
|
||||
{
|
||||
if ([list isKindOfClass:[NSArray class]])
|
||||
{
|
||||
listCount = [list count];
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"%s: Evaluating 'list' binding returned a '%@' class and not a NSArray.",
|
||||
__PRETTY_FUNCTION__, [list class]];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_noSelectionString != nil) {
|
||||
id noSelectionValue = [_noSelectionString valueInComponent:component];
|
||||
if (noSelectionValue != nil) {
|
||||
GSWResponse_appendContentAsciiString(response,@"\n<option value=\"WONoSelectionString\">");
|
||||
// wo seems to NOT do it right here. They escape always.
|
||||
if (doEscape) {
|
||||
GSWResponse_appendContentHTMLConvertString(response, [noSelectionValue description]);
|
||||
} else {
|
||||
GSWResponse_appendContentString(response, [noSelectionValue description]);
|
||||
}
|
||||
GSWResponse_appendContentAsciiString(response, @"</option>");
|
||||
} else {
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"%s: 'noSelectionString' evaluated to nil in component '%@'. Did not insert a WONoSelectionString.",
|
||||
__PRETTY_FUNCTION__, component];
|
||||
}
|
||||
}
|
||||
if (_selection != nil) {
|
||||
// it seems like we have to do that below. dw.
|
||||
// obj = [_selection valueInComponent:component];
|
||||
} else {
|
||||
if (_selectedValue != nil) {
|
||||
compoValue = [_selectedValue valueInComponent:component];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < j; i++) {
|
||||
valueValue = nil;
|
||||
s1 = nil;
|
||||
arrayObj = nil;
|
||||
if (valueArray != nil) {
|
||||
arrayObj = [valueArray objectAtIndex:i];
|
||||
}
|
||||
if ((_string != nil) || (_value != nil)) {
|
||||
[_item setValue:arrayObj inComponent:component];
|
||||
if (_string != nil) {
|
||||
id obj5 = [_string valueInComponent:component];
|
||||
if (obj5 != nil) {
|
||||
s1 = obj5; // stringValue??
|
||||
if (_value != nil) {
|
||||
id obj7 = [_value valueInComponent:component];
|
||||
if (obj7 != nil) {
|
||||
valueValue = obj7; // stringValue?
|
||||
}
|
||||
} else {
|
||||
valueValue = s1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
id obj6 = [_value valueInComponent:component];
|
||||
if (obj6 != nil) {
|
||||
valueValue = obj6; // stringValue?
|
||||
s1 = valueValue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s1 = arrayObj; // stringValue?
|
||||
valueValue = s1;
|
||||
}
|
||||
GSWResponse_appendContentAsciiString(response,@"\n<option");
|
||||
if (_selection != nil) {
|
||||
obj = [_selection valueInComponent:component];
|
||||
isSelected = (obj == nil) ? NO : [obj isEqual:arrayObj];
|
||||
} else {
|
||||
if (_selectedValue != nil) {
|
||||
if (_value != nil) {
|
||||
isSelected = compoValue == nil ? NO : [compoValue isEqual: valueValue];
|
||||
} else {
|
||||
isSelected = [GSWIntToNSString(i) isEqual:compoValue];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isSelected) {
|
||||
GSWResponse_appendContentCharacter(response,' ');
|
||||
GSWResponse_appendContentAsciiString(response,@"selected");
|
||||
}
|
||||
if (_value != nil) {
|
||||
GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(response, value__Key, valueValue, YES);
|
||||
|
||||
} else {
|
||||
GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(response, value__Key, GSWIntToNSString(i), NO);
|
||||
}
|
||||
GSWResponse_appendContentCharacter(response,'>');
|
||||
if (doEscape) {
|
||||
GSWResponse_appendContentHTMLConvertString(response, s1);
|
||||
} else {
|
||||
GSWResponse_appendContentString(response, s1);
|
||||
}
|
||||
GSWResponse_appendContentAsciiString(response,@"</option>");
|
||||
}
|
||||
|
||||
if (_noSelectionString != nil)
|
||||
{
|
||||
id noSelectionValue = [_noSelectionString valueInComponent:component];
|
||||
if (noSelectionValue != nil)
|
||||
{
|
||||
GSWResponse_appendContentAsciiString(response,@"\n<option value=\"WONoSelectionString\">");
|
||||
// wo seems to NOT do it right here. They escape always.
|
||||
if (doEscape)
|
||||
GSWResponse_appendContentHTMLConvertString(response,NSStringWithObject(noSelectionValue));
|
||||
else
|
||||
GSWResponse_appendContentString(response, NSStringWithObject(noSelectionValue));
|
||||
GSWResponse_appendContentAsciiString(response, @"</option>");
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"%s: 'noSelectionString' evaluated to nil in component '%@'. Did not insert a WONoSelectionString.",
|
||||
__PRETTY_FUNCTION__, component];
|
||||
}
|
||||
}
|
||||
if (listCount>0)
|
||||
{
|
||||
NSString* selectedValueString = nil;
|
||||
id selection = nil;
|
||||
int i=0;
|
||||
|
||||
if (_selection != nil)
|
||||
selection = [_selection valueInComponent:component];
|
||||
else if (_selectedValue != nil)
|
||||
selectedValueString = NSStringWithObject([_selectedValue valueInComponent:component]);
|
||||
|
||||
for (i = 0; i < listCount; i++)
|
||||
{
|
||||
NSString* valueString = nil;
|
||||
NSString* displayString = nil;
|
||||
id item = nil;
|
||||
BOOL isSelected = NO;
|
||||
|
||||
if (list != nil)
|
||||
item = [list objectAtIndex:i];
|
||||
|
||||
if (_string != nil
|
||||
|| _value != nil)
|
||||
{
|
||||
[_item setValue:item
|
||||
inComponent:component];
|
||||
|
||||
if (_string != nil)
|
||||
{
|
||||
displayString = NSStringWithObject([_string valueInComponent:component]);
|
||||
if (displayString != nil)
|
||||
{
|
||||
if (_value != nil)
|
||||
valueString = NSStringWithObject([_value valueInComponent:component]);
|
||||
else
|
||||
valueString = displayString;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
valueString = NSStringWithObject([_value valueInComponent:component]);
|
||||
displayString = valueString;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
displayString = NSStringWithObject(item);
|
||||
valueString = displayString;
|
||||
}
|
||||
GSWResponse_appendContentAsciiString(response,@"\n<option");
|
||||
|
||||
if (_selection != nil)
|
||||
{
|
||||
isSelected = (selection == nil) ? NO : [selection isEqual:item];
|
||||
}
|
||||
else if (_selectedValue != nil)
|
||||
{
|
||||
if (_value != nil)
|
||||
{
|
||||
isSelected = (selectedValueString == nil) ? NO : [selectedValueString isEqual: valueString];
|
||||
}
|
||||
else
|
||||
{
|
||||
isSelected = [GSWIntToNSString(i) isEqual:selectedValueString];
|
||||
}
|
||||
}
|
||||
|
||||
if (isSelected)
|
||||
{
|
||||
GSWResponse_appendContentCharacter(response,' ');
|
||||
GSWResponse_appendContentAsciiString(response,@"selected");
|
||||
}
|
||||
|
||||
if (_value != nil)
|
||||
{
|
||||
GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(response,
|
||||
value__Key,
|
||||
valueString,
|
||||
YES);
|
||||
}
|
||||
else
|
||||
{
|
||||
GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(response,
|
||||
value__Key,
|
||||
GSWIntToNSString(i),
|
||||
NO);
|
||||
}
|
||||
GSWResponse_appendContentCharacter(response,'>');
|
||||
if (doEscape)
|
||||
GSWResponse_appendContentHTMLConvertString(response, displayString);
|
||||
else
|
||||
GSWResponse_appendContentString(response, displayString);
|
||||
GSWResponse_appendContentAsciiString(response,@"</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -118,21 +118,6 @@ ExceptionRaiseFn0(const char *func,
|
|||
NSString* name_,
|
||||
NSString* format_);
|
||||
|
||||
GSWEB_EXPORT void
|
||||
ValidationExceptionRaiseFn(const char *func,
|
||||
const char *file,
|
||||
int line,
|
||||
NSString* name_,
|
||||
NSString* message_,
|
||||
NSString* format_,
|
||||
...);
|
||||
GSWEB_EXPORT void
|
||||
ValidationExceptionRaiseFn0(const char *func,
|
||||
const char *file,
|
||||
int line,
|
||||
NSString* name_,
|
||||
NSString* message_,
|
||||
NSString* format_);
|
||||
|
||||
#define ExceptionRaise(name_, format_, args...) \
|
||||
{ ExceptionRaiseFn(__PRETTY_FUNCTION__, __FILE__, __LINE__, \
|
||||
|
@ -142,14 +127,6 @@ ValidationExceptionRaiseFn0(const char *func,
|
|||
{ ExceptionRaiseFn0(__PRETTY_FUNCTION__, __FILE__, __LINE__, \
|
||||
name_,format_); }
|
||||
|
||||
#define ValidationExceptionRaise(name_,message_, format_, args...) \
|
||||
{ ValidationExceptionRaiseFn(__PRETTY_FUNCTION__, __FILE__, __LINE__,\
|
||||
name_,message_,format_, ## args); }
|
||||
|
||||
#define ValidationExceptionRaise0(name_,message_, format_) \
|
||||
{ ValidationExceptionRaiseFn0(__PRETTY_FUNCTION__, __FILE__, __LINE__,\
|
||||
name_,message_,format_); }
|
||||
|
||||
GSWEB_EXPORT BOOL boolValueFor(id id_);
|
||||
GSWEB_EXPORT BOOL boolValueWithDefaultFor(id id_,BOOL defaultValue);
|
||||
//GSWEB_EXPORT BOOLNB boolNbFor(BOOL value_);
|
||||
|
@ -205,7 +182,6 @@ GSWEB_EXPORT NSString* GSWGetDefaultDocRoot();
|
|||
file:(const char*)file
|
||||
line:(int)line
|
||||
format:(NSString*)format,...;
|
||||
-(BOOL)isValidationException;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
|
|
|
@ -498,61 +498,6 @@ void ExceptionRaiseFn0(const char *func,
|
|||
format:@"%@",string];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void ValidationExceptionRaiseFn(const char *func,
|
||||
const char *file,
|
||||
int line,
|
||||
NSString* name,
|
||||
NSString* message,
|
||||
NSString* format,
|
||||
...)
|
||||
{
|
||||
NSException* exception=nil;
|
||||
NSString* fmt=(*nsString_stringWithFormatIMP)
|
||||
(nsStringClass,stringWithFormatSEL,@"File %s: %d. In %s EXCEPTION %@: %@",
|
||||
func,line,file,name,format);
|
||||
NSString* string=nil;
|
||||
va_list args;
|
||||
va_start(args,format);
|
||||
string=[nsStringClass stringWithFormat:fmt
|
||||
arguments:args];
|
||||
va_end(args);
|
||||
NSLog(@"%@",string);
|
||||
exception=[NSException exceptionWithName:name
|
||||
reason:string
|
||||
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
GSWNumberYes,@"isValidationException",
|
||||
message,@"message",
|
||||
nil,nil]];
|
||||
StackTraceIFND();
|
||||
DebugBreakpointIFND();
|
||||
[exception raise];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void ValidationExceptionRaiseFn0(const char *func,
|
||||
const char *file,
|
||||
int line,
|
||||
NSString* name,
|
||||
NSString* message,
|
||||
NSString* format)
|
||||
{
|
||||
NSException* exception=nil;
|
||||
NSString* string=(*nsString_stringWithFormatIMP)
|
||||
(nsStringClass,stringWithFormatSEL,@"File %s: %d. In %s EXCEPTION %@: %@",
|
||||
func,line,file,name,format);
|
||||
NSLog(@"%@",string);
|
||||
exception=[NSException exceptionWithName:name
|
||||
reason:format
|
||||
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
GSWNumberYes,@"isValidationException",
|
||||
message,@"message",
|
||||
nil,nil]];
|
||||
StackTraceIFND();
|
||||
DebugBreakpointIFND();
|
||||
[exception raise];
|
||||
};
|
||||
|
||||
//====================================================================
|
||||
@implementation NSException (NSBuild)
|
||||
|
||||
|
|
Loading…
Reference in a new issue