Bug fixes, minor improvments and optimizations

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@20452 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mguesdon 2004-12-14 12:54:40 +00:00
parent 8895e6d456
commit cd39e1f8e1
55 changed files with 2341 additions and 902 deletions

126
ChangeLog
View file

@ -1,3 +1,129 @@
2004-12-14 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWAction.m:
o added NSAssert in pageWithName:
o added -context
o implemented -_session
o added -session
* GSWeb.framework/GSWAction.h:
o added -context
o added -session
* GSWeb.framework/GSWActionRequestHandler.m:
o comments/documentation
* GSWeb.framework/GSWBrowser.m:
o replace back GSWIntToNSString() by [NSNumber numberWithXXX]
for setting values in associations. Anyway, short int
objects are cached
o optimization by using NSString -stringWithObject:
* GSWeb.framework/GSWCheckBox.m:
o optimization by using NSString -stringWithObject:
* GSWeb.framework/GSWCheckBoxList.m:
o optimization by using NSString -stringWithObject:
and GSWIntToNSString()
* GSWeb.framework/GSWComponent.h:
o added -userAssociationForKey:
o added -defaultAssociationForKey:
o logs
* GSWeb.framework/GSWConstants.[hm]:
o added omitElement__Key
* GSWeb.framework/GSWContext.[hm]:
o added ivar -isInEnabledForm to detect forms in form
o added -setInEnabledForm:
o added -isInEnabledForm
o added -urlWithURLPrefix:RequestHandlerKey:path:queryString:isSecure:
o added -urlWithRequestHandlerKey:path:queryString:isSecure:
* GSWeb.framework/GSWContext.m:
o fix in directActionURLForActionNamed:urlPrefix:queryDictionary:pathQueryDictionary:
o fix in directActionURLForActionNamed:urlPrefix:queryDictionary:isSecure:
o fix in -componentActionURLIsSecure:
o logs
* GSWeb.framework/GSWDefaultAdaptor.m:
o removed librwap paranoid mode
* GSWeb.framework/GSWDefaultAdaptorThread.m
o rewritten -createRequestFromRequestLine:headers:data:
* GSWeb.framework/GSWDisplayGroup.[hm]:
o added -displayFirstBatch
o added -displayLastBatch
o added -canDisplayFirstBatch
o added -canDisplayNextBatch
o added -canDisplayPreviousBatch
o added -canDisplayLastBatch
* GSWeb.framework/GSWDisplayGroup.m:
o fix in insertAfterLastObject
o change MLLog key
* GSWeb.framework/GSWDynamicElement.[hm]
o -evaluateCondition:inContext:noConditionAssociationDefault:noConditionDefault:
* GSWeb.framework/GSWForm.h:
o added _displayDisabled
* GSWeb.framework/GSWForm.[hm]:
o handle _displayDisabled
o handle form in forms
* GSWeb.framework/GSWGenericContainer.[hm]:
o added _elementName
o added _otherTagString
o added _omitElement
* GSWeb.framework/GSWHTMLRawParser.m:
o logs
o fixes in -tagPropertiesForType:betweenIndex:andIndex: to avoid infinite loops
o fixes in -parseHTML to avoid infinite loops
* GSWeb.framework/GSWHyperlink.[hm]:
o added _escapeHTML
* GSWeb.framework/GSWHTMLURLValuedElement.m:
o Warnings
* GSWeb.framework/GSWMessage.[hm]:
o added -removeHeader:forKey:
o added -removeHeaderForKey:
o added -removeHeadersForKey:
* GSWeb.framework/GSWMessage.m:
o cleaned code
o re-added disappeared caching mechanism
o use DESTROY macro in -setContent:
o replace NSString +stringWithObject by NSStringWithObject()
* GSWeb.framework/GSWPopUpButton.m:
o don't append noSelection string if there's none
o replace back GSWIntToNSString() by [NSNumber numberWithXXX]
for setting values in associations. Anyway, short int
objects are cached
* GSWeb.framework/GSWRadioButton.m:
o doc
o optimization by using NSString -stringWithObject:
* GSWeb.framework/GSWRadioButtonList.m:
o optimization by using NSString -stringWithObject:
and GSWIntToNSString()
* GSWeb.framework/GSWRecording.m:
o corrected assert message
o changes according to GSWMessage string-To-Data changes
* GSWeb.framework/GSWRepetition.m:
o use IMP for performances
* GSWeb.framework/GSWResourcesManager.[hm]:
o added -stringsTableNamed:inFramework:languages:foundLanguage:
o added -lockedStringsTableNamed:inFramework:languages:foundLanguage:
o added -lockedStringForKey:inTableNamed:inFramework:languages:foundLanguage:
* GSWeb.framework/GSWResponse.[hm]:
o added -canDisableClientCaching and hadle it
* GSWeb.framework/GSWSession.[hm]:
o added _domainForIDCookies and fixes -domainForIDCookies
* GSWeb.framework/GSWString.[hm]:
o cleaned
o added -formattedValueInContext:
* GSWeb.framework/GSWUtils.h:
o added NSString +stringWithContentsOfFile:encoding:
o added NSString +encodingNamed:
* GSWeb.framework/GSWUtils.m:
o dix in SBIsEqual()
o put values in array for cachedStringForInt()
o moved NSString +stringWithContentsOfFile:encoding: from GSWBundle
o moved NSString +encodingNamed: from GSWBundle
TODO: MultiThread protection
* GSWeb.framework/NSString+HTML.m:
o optimization in -stringByConvertingFromHTML
o optimization in -stringByConvertingToHTML
* GSWeb.framework/NSString+Trimming.m:
o added NSStringWithObject()
o optimized NSStringWithObject()
TODO: MultiThread protection ?
* GSWExtensionsGSW.framework/GSWCacheElement.m:
o changes to follow GSWMessage content changes
2004-12-01 David Wetzel <dave@turbocat.de> 2004-12-01 David Wetzel <dave@turbocat.de>
* GSWeb.framework/GSWMessage.m * GSWeb.framework/GSWMessage.m

View file

@ -1,8 +1,9 @@
/* GSWCollapsibleComponentContent.h - GSWeb: Class GSWCollapsibleComponentContent /* GSWCollapsibleComponentContent.h - GSWeb: Class GSWCollapsibleComponentContent
Copyright (C) 1999-2002 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: Apr 1999 Date: Apr 1999
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
@ -42,6 +43,8 @@
-(NSString*)imageFileName; -(NSString*)imageFileName;
-(id)label; -(id)label;
-(NSString*)helpString; -(NSString*)helpString;
-(BOOL)isDisabled;
-(BOOL)shouldDisplay;
@end @end

View file

@ -75,7 +75,12 @@ RCS_ID("$Id$")
NSDebugMLog(@"_isVisibleConditionPassed=%s",(_isVisibleConditionPassed ? "YES" : "NO")); NSDebugMLog(@"_isVisibleConditionPassed=%s",(_isVisibleConditionPassed ? "YES" : "NO"));
if (!_isVisibleConditionPassed) if (!_isVisibleConditionPassed)
{ {
_isVisible=boolValueFor([self valueForBinding:@"condition"]); if ([self hasBinding:@"condition"])
_isVisible=boolValueFor([self valueForBinding:@"condition"]);
else if ([self hasBinding:@"visibility"])
_isVisible=boolValueFor([self valueForBinding:@"visibility"]);
else
_isVisible=boolValueFor([self valueForBinding:@"condition"]);
_isVisibleConditionPassed=YES; _isVisibleConditionPassed=YES;
}; };
NSDebugMLog(@"_isVisible=%s",(_isVisible ? "YES" : "NO")); NSDebugMLog(@"_isVisible=%s",(_isVisible ? "YES" : "NO"));
@ -203,20 +208,22 @@ RCS_ID("$Id$")
}; };
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
-(id)isDisabled -(BOOL)isDisabled
{ {
id isDisabled=NO; BOOL isDisabled=NO;
LOGObjectFnStart(); LOGObjectFnStart();
if ([self hasBinding:@"disabled"]) if ([self hasBinding:@"disabled"])
isDisabled=[self valueForBinding:@"disabled"]; isDisabled=boolValueFor([self valueForBinding:@"disabled"]);
else if ([self hasBinding:@"enabled"]) else if ([self hasBinding:@"enabled"])
{ {
BOOL isEnabled=boolValueFor([self valueForBinding:@"enabled"]); BOOL isEnabled=boolValueFor([self valueForBinding:@"enabled"]);
isDisabled=[NSNumber numberWithBool:(isEnabled ? NO : YES)]; isDisabled=(isEnabled ? NO : YES);
}; };
NSDebugMLog(@"isDisabled=%s",(isDisabled ? "YES" : "NO"));
LOGObjectFnStop(); LOGObjectFnStop();
return isDisabled; return isDisabled;
@ -229,11 +236,13 @@ RCS_ID("$Id$")
LOGObjectFnStart(); LOGObjectFnStart();
if (boolValueFor([self isDisabled]) if ([self isDisabled]
&& [self hasBinding:@"displayDisabled"] && [self hasBinding:@"displayDisabled"]
&& !boolValueFor([self valueForBinding:@"displayDisabled"])) && !boolValueFor([self valueForBinding:@"displayDisabled"]))
shouldDisplay=NO; shouldDisplay=NO;
NSDebugMLog(@"shouldDisplay=%s",(shouldDisplay ? "YES" : "NO"));
LOGObjectFnStop(); LOGObjectFnStop();
return shouldDisplay; return shouldDisplay;

View file

@ -72,27 +72,27 @@ Bindings
_cachedObject = [[associations objectForKey:@"cachedObject" _cachedObject = [[associations objectForKey:@"cachedObject"
withDefaultObject:[_cachedObject autorelease]] retain]; withDefaultObject:[_cachedObject autorelease]] retain];
NSDebugMLLog(@"gswdync",@"cachedObject=%@",_cachedObject); NSDebugMLLog(@"GSWCacheElement",@"cachedObject=%@",_cachedObject);
_cache = [[associations objectForKey:@"cache" _cache = [[associations objectForKey:@"cache"
withDefaultObject:[_cache autorelease]] retain]; withDefaultObject:[_cache autorelease]] retain];
NSDebugMLLog(@"gswdync",@"cache=%@",_cache); NSDebugMLLog(@"GSWCacheElement",@"cache=%@",_cache);
_duration = [[associations objectForKey:@"duration" _duration = [[associations objectForKey:@"duration"
withDefaultObject:[_duration autorelease]] retain]; withDefaultObject:[_duration autorelease]] retain];
NSDebugMLLog(@"gswdync",@"duration=%@",_duration); NSDebugMLLog(@"GSWCacheElement",@"duration=%@",_duration);
_uniqID = [[associations objectForKey:@"uniqID" _uniqID = [[associations objectForKey:@"uniqID"
withDefaultObject:[_uniqID autorelease]] retain]; withDefaultObject:[_uniqID autorelease]] retain];
NSDebugMLLog(@"gswdync",@"uniqID=%@",_uniqID); NSDebugMLLog(@"GSWCacheElement",@"uniqID=%@",_uniqID);
_disabled = [[associations objectForKey:disabled__Key _disabled = [[associations objectForKey:disabled__Key
withDefaultObject:[_disabled autorelease]] retain]; withDefaultObject:[_disabled autorelease]] retain];
NSDebugMLLog(@"gswdync",@"disabled=%@",_disabled); NSDebugMLLog(@"GSWCacheElement",@"disabled=%@",_disabled);
_enabled = [[associations objectForKey:enabled__Key _enabled = [[associations objectForKey:enabled__Key
withDefaultObject:[_enabled autorelease]] retain]; withDefaultObject:[_enabled autorelease]] retain];
NSDebugMLLog(@"gswdync",@"enabled=%@",_enabled); NSDebugMLLog(@"GSWCacheElement",@"enabled=%@",_enabled);
if (_disabled && _enabled) if (_disabled && _enabled)
{ {
@ -189,11 +189,11 @@ Bindings
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)setDefinitionName:(NSString*)definitionName -(void)setDeclarationName:(NSString*)declarationName
{ {
[super setDefinitionName:definitionName]; [super setDeclarationName:declarationName];
if (definitionName && _childrenGroup) if (declarationName && _childrenGroup)
[_childrenGroup setDefinitionName:[NSString stringWithFormat:@"%@-StaticGroup",definitionName]]; [_childrenGroup setDeclarationName:[NSString stringWithFormat:@"%@-StaticGroup",declarationName]];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -254,19 +254,19 @@ Bindings
[aContext appendElementIDComponent:[NSString stringWithFormat:@"CacheElement-%@",uniqID]]; [aContext appendElementIDComponent:[NSString stringWithFormat:@"CacheElement-%@",uniqID]];
contextAndElementID=[aContext contextAndElementID]; contextAndElementID=[aContext contextAndElementID];
NSDebugMLog(@"contextAndElementID=%@",contextAndElementID); NSDebugMLLog(@"GSWCacheElement",@"contextAndElementID=%@",contextAndElementID);
elementID=[[[aContext elementID] copy]autorelease]; // because elementID is mutable (and varying) elementID=[[[aContext elementID] copy]autorelease]; // because elementID is mutable (and varying)
NSDebugMLog(@"elementID=%@",elementID); NSDebugMLLog(@"GSWCacheElement",@"elementID=%@",elementID);
sessionID=[[aContext session] sessionID]; sessionID=[[aContext session] sessionID];
NSDebugMLog(@"sessionID=%@",sessionID); NSDebugMLLog(@"GSWCacheElement",@"sessionID=%@",sessionID);
NSDebugMLLog(@"gswdync",@"isDisabled=%d",isDisabled); NSDebugMLLog(@"GSWCacheElement",@"isDisabled=%d",isDisabled);
if (!isDisabled) if (!isDisabled)
{ {
id cachedObject=nil; NSMutableData* cachedObject=nil;
if (_cachedObject) if (_cachedObject)
cachedObject=[_cachedObject valueInComponent:component]; cachedObject=[_cachedObject valueInComponent:component];
else else
@ -276,17 +276,17 @@ Bindings
{ {
GSWAssociation* assoc=[_keys objectAtIndex:i]; GSWAssociation* assoc=[_keys objectAtIndex:i];
keys[i]=[assoc valueInComponent:component]; keys[i]=[assoc valueInComponent:component];
NSDebugMLLog(@"gswdync",@"keys[%d]=%@",i,keys[i]); NSDebugMLLog(@"GSWCacheElement",@"keys[%d]=%@",i,keys[i]);
if (!keys[i]) if (!keys[i])
{ {
keys[i]=[NSNull null]; keys[i]=[NSNull null];
NSDebugMLLog(@"gswdync",@"keys[%d]=%@",i,keys[i]); NSDebugMLLog(@"GSWCacheElement",@"keys[%d]=%@",i,keys[i]);
}; };
}; };
cachedObject=[cache objectForKeys:keys cachedObject=[cache objectForKeys:keys
count:keysCount]; count:keysCount];
}; };
NSDebugMLLog(@"gswdync",@"cachedObject=%p",cachedObject); NSDebugMLLog(@"GSWCacheElement",@"cachedObject=%p",cachedObject);
contextAndElementIDCacheKey=[NSString stringWithFormat:@"##CONTEXT_ELEMENT_ID-%@##", contextAndElementIDCacheKey=[NSString stringWithFormat:@"##CONTEXT_ELEMENT_ID-%@##",
uniqID]; uniqID];
@ -295,55 +295,33 @@ Bindings
if (cachedObject) if (cachedObject)
{ {
NSLog(@"GSWCacheElement5: sessionID=%@",sessionID);
NSLog(@"GSWCacheElement5: elementID=%@",elementID);
NSLog(@"GSWCacheElement5: contextAndElementID=%@",contextAndElementID);
cacheUsed=YES; cacheUsed=YES;
cachedObject=[[cachedObject mutableCopy] autorelease]; cachedObject=AUTORELEASE([cachedObject mutableCopy]);
//NSLog(@"GSWCacheElement: cachedObject found=%@",cachedObject); //NSLog(@"GSWCacheElement: cachedObject found=%@",cachedObject);
if ([cachedObject isKindOfClass:[NSString class]]) [cachedObject replaceOccurrencesOfData:[contextAndElementIDCacheKey dataUsingEncoding:[aResponse contentEncoding]]
{ withData:[contextAndElementID dataUsingEncoding:[aResponse contentEncoding]]
NSDebugMLog(@"cachedObject=%@",cachedObject); range:NSMakeRange(0,[cachedObject length])];
[(NSMutableString*)cachedObject replaceOccurrencesOfString:contextAndElementIDCacheKey [cachedObject replaceOccurrencesOfData:[elementIDCacheKey dataUsingEncoding:[aResponse contentEncoding]]
withString:contextAndElementID withData:[elementID dataUsingEncoding:[aResponse contentEncoding]]
options:0
range:NSMakeRange(0,[cachedObject length])];
[(NSMutableString*)cachedObject replaceOccurrencesOfString:elementIDCacheKey
withString:elementID
options:0
range:NSMakeRange(0,[cachedObject length])];
[(NSMutableString*)cachedObject replaceOccurrencesOfString:@"##SESSION_ID##"
withString:sessionID
options:0
range:NSMakeRange(0,[cachedObject length])];
NSDebugMLog(@"cachedObject result=%@",cachedObject);
[aResponse appendContentString:(NSString*)cachedObject];
}
else
{
[(NSMutableData*)cachedObject replaceOccurrencesOfData:[contextAndElementIDCacheKey dataUsingEncoding:[aResponse contentEncoding]]
withData:[contextAndElementID dataUsingEncoding:[aResponse contentEncoding]]
range:NSMakeRange(0,[cachedObject length])]; range:NSMakeRange(0,[cachedObject length])];
[(NSMutableData*)cachedObject replaceOccurrencesOfData:[elementIDCacheKey dataUsingEncoding:[aResponse contentEncoding]] [cachedObject replaceOccurrencesOfData:[@"##SESSION_ID##" dataUsingEncoding:[aResponse contentEncoding]]
withData:[elementID dataUsingEncoding:[aResponse contentEncoding]] withData:[sessionID dataUsingEncoding:[aResponse contentEncoding]]
range:NSMakeRange(0,[cachedObject length])]; range:NSMakeRange(0,[cachedObject length])];
[aResponse appendContentData:cachedObject];
[(NSMutableData*)cachedObject replaceOccurrencesOfData:[@"##SESSION_ID##" dataUsingEncoding:[aResponse contentEncoding]]
withData:[sessionID dataUsingEncoding:[aResponse contentEncoding]]
range:NSMakeRange(0,[cachedObject length])];
[aResponse appendContentData:(NSData*)cachedObject];
}
} }
else else
{ {
_cacheIndex=[aResponse startCache]; _cacheIndex=[aResponse startCache];
NSDebugMLLog(@"gswdync",@"cacheIndex=%d",_cacheIndex); NSDebugMLLog(@"GSWCacheElement",@"cacheIndex=%d",_cacheIndex);
}; };
}; };
NSDebugMLLog(@"gswdync",@"cacheUsed=%d",cacheUsed); NSDebugMLLog(@"GSWCacheElement",@"cacheUsed=%d",cacheUsed);
if (!cacheUsed) if (!cacheUsed)
{ {
NSLog(@"GSWCacheElement Children Start Date=%@",[NSDate date]); NSLog(@"GSWCacheElement Children Start Date=%@",[NSDate date]);
@ -354,48 +332,29 @@ Bindings
if (!cacheUsed && !isDisabled) if (!cacheUsed && !isDisabled)
{ {
id cachedObject=[aResponse stopCacheOfIndex:_cacheIndex]; NSMutableData* cachedObject=[aResponse stopCacheOfIndex:_cacheIndex];
NSDebugMLLog(@"gswdync",@"cachedObject=%p",cachedObject); NSDebugMLLog(@"GSWCacheElement",@"cachedObject=%p",cachedObject);
if ([cachedObject isKindOfClass:[NSMutableString class]]) NSLog(@"GSWCacheElement6: sessionID=%@",sessionID);
{ NSLog(@"GSWCacheElement6: elementID=%@",elementID);
NSDebugMLog(@"cachedObject=%@",cachedObject); NSLog(@"GSWCacheElement6: contextAndElementID=%@",contextAndElementID);
[(NSMutableString*)cachedObject replaceOccurrencesOfString:contextAndElementID [cachedObject replaceOccurrencesOfData:[contextAndElementID dataUsingEncoding:[aResponse contentEncoding]]
withString:contextAndElementIDCacheKey withData:[contextAndElementIDCacheKey dataUsingEncoding:[aResponse contentEncoding]]
options:0 range:NSMakeRange(0,[cachedObject length])];
range:NSMakeRange(0,[cachedObject length])];
[cachedObject replaceOccurrencesOfData:[elementID dataUsingEncoding:[aResponse contentEncoding]]
[(NSMutableString*)cachedObject replaceOccurrencesOfString:elementID withData:[elementIDCacheKey dataUsingEncoding:[aResponse contentEncoding]]
withString:elementIDCacheKey range:NSMakeRange(0,[cachedObject length])];
options:0
range:NSMakeRange(0,[cachedObject length])]; [cachedObject replaceOccurrencesOfData:[sessionID dataUsingEncoding:[aResponse contentEncoding]]
withData:[@"##SESSION_ID##" dataUsingEncoding:[aResponse contentEncoding]]
[(NSMutableString*)cachedObject replaceOccurrencesOfString:sessionID range:NSMakeRange(0,[cachedObject length])];
withString:@"##SESSION_ID##"
options:0
range:NSMakeRange(0,[cachedObject length])];
NSDebugMLLog(@"gswdync",@"cachedObject=%@",cachedObject);
}
else
{
[(NSMutableData*)cachedObject replaceOccurrencesOfData:[contextAndElementID dataUsingEncoding:[aResponse contentEncoding]]
withData:[contextAndElementIDCacheKey dataUsingEncoding:[aResponse contentEncoding]]
range:NSMakeRange(0,[cachedObject length])];
[(NSMutableData*)cachedObject replaceOccurrencesOfData:[elementID dataUsingEncoding:[aResponse contentEncoding]]
withData:[elementIDCacheKey dataUsingEncoding:[aResponse contentEncoding]]
range:NSMakeRange(0,[cachedObject length])];
[(NSMutableData*)cachedObject replaceOccurrencesOfData:[sessionID dataUsingEncoding:[aResponse contentEncoding]]
withData:[@"##SESSION_ID##" dataUsingEncoding:[aResponse contentEncoding]]
range:NSMakeRange(0,[cachedObject length])];
};
if (_cachedObject) if (_cachedObject)
[_cachedObject setValue:cachedObject [_cachedObject setValue:cachedObject
inComponent:component]; inComponent:component];
else else
{ {
id duration=[_duration valueInComponent:component]; id duration=[_duration valueInComponent:component];
NSDebugMLLog(@"gswdync",@"duration=%@",duration); NSDebugMLLog(@"GSWCacheElement",@"duration=%@",duration);
if (duration) if (duration)
{ {
NSTimeInterval ts=0; NSTimeInterval ts=0;
@ -422,7 +381,7 @@ Bindings
[aContext deleteLastElementIDComponent]; [aContext deleteLastElementIDComponent];
NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[aContext elementID]); NSDebugMLLog(@"GSWCacheElement",@"END ET=%@ id=%@",[self class],[aContext elementID]);
NSLog(@"GSWCacheElement Stop Date=%@",[NSDate date]); NSLog(@"GSWCacheElement Stop Date=%@",[NSDate date]);
@ -490,7 +449,7 @@ Bindings
element=[_childrenGroup invokeActionForRequest:aRequest element=[_childrenGroup invokeActionForRequest:aRequest
inContext:aContext]; inContext:aContext];
NSDebugMLLog(@"gswdync",@"element=%@",element); NSDebugMLLog(@"GSWCacheElement",@"element=%@",element);
NSAssert2(!element || [element isKindOfClass:[GSWElement class]], NSAssert2(!element || [element isKindOfClass:[GSWElement class]],
@"Element is a %@ not a GSWElement: %@", @"Element is a %@ not a GSWElement: %@",
[element class], [element class],

View file

@ -41,6 +41,92 @@ ImageWithURL: GSWImage
height = ^imageHeight; height = ^imageHeight;
}; };
IsFileNameDisplay: GSWConditional
{
condition = isFileNameDisplay;
};
FileName: GSWString
{
value = fileName;
};
HasWidthAndHeight: GSWConditional
{
condition = ^hasWidthAndHeight;
};
HasWidthAndHeightList: GSWConditional
{
condition = hasWidthAndHeightList;
};
HasNotWidthAndHeightList: GSWConditional
{
condition = hasWidthAndHeightList;
negate = YES;
};
IsCustomWidthAndHeightEnabled: GSWConditional
{
condition = ^isCustomWidthAndHeightEnabled;
};
WidthAndHeightList: GSWPopUpButton
{
value= tmpWithAndHeight.code;
list = ^widthAndHeightList;
item = tmpWithAndHeight;
selectionValue = fileInfo.widthAndHeightCode;
selectedValue = fileInfo.widthAndHeightCode;
displayString = tmpWithAndHeight.label;
noSelectionString= ^customizedWidthAndHeightListLabel;
enabled=^isUploadEnabled;
}
WidthAndHeightListTitle: GSWString
{
value = ^widthAndHeightListTitle;
};
WidthField: GSWTextField
{
value = fileInfo.width;
enabled=^isUploadEnabled;
}
WidthTitle: GSWString
{
value = ^widthTitle;
};
HeightField: GSWTextField
{
value = fileInfo.height;
enabled=^isUploadEnabled;
}
HeightTitle: GSWString
{
value = ^heightTitle;
};
HasUploadFileTitle: GSWConditional
{
condition = hasUploadFileTitle;
}
HasNotUploadFileTitle: GSWConditional
{
condition = hasUploadFileTitle;
negate = YES;
}
UploadFileTitle: GSWString
{
value = ^uploadFileTitle;
};
UploadFile: GSWFileUpload UploadFile: GSWFileUpload
{ {
data = fileInfo.data; data = fileInfo.data;

View file

@ -1,23 +1,40 @@
<table border="0">
<gsweb name="ViewCondition"> <gsweb name="ViewCondition">
<gsweb name="ViewPathCondition"> <gsweb name="ViewPathCondition">
<gsweb name="LinkViewCondition"> <gsweb name="LinkViewCondition">
<gsweb name="FileLinkWithPath"></gsweb> <tr><td colspan="2" align="center"><gsweb name="FileLinkWithPath"></gsweb></td></tr>
</gsweb> </gsweb>
<gsweb name="ImageViewCondition"> <gsweb name="ImageViewCondition">
<gsweb name="ImageWithPath"></gsweb> <tr><td colspan="2" align="center"><gsweb name="ImageWithPath"></gsweb></td></tr>
</gsweb> </gsweb>
</gsweb> </gsweb>
<gsweb name="ViewURLCondition"> <gsweb name="ViewURLCondition">
<gsweb name="LinkViewCondition"> <gsweb name="LinkViewCondition">
<gsweb name="FileLinkWithURL"></gsweb> <tr><td colspan="2" align="center"><gsweb name="FileLinkWithURL"></gsweb></td></tr>
</gsweb> </gsweb>
<gsweb name="ImageViewCondition"> <gsweb name="ImageViewCondition">
<gsweb name="ImageWithURL"></gsweb> <tr><td colspan="2" align="center"><gsweb name="ImageWithURL"></gsweb></td></tr>
</gsweb> </gsweb>
</gsweb> </gsweb>
</gsweb> </gsweb>
<br> <gsweb name="IsFileNameDisplay">
<gsweb name="UploadFile"></gsweb><br> <tr><td colspan="2"><gsweb name="FileName"></gsweb></td></tr>
<gsweb name="DeleteCondition">
<gsweb name="DeleteCheckBoxTitle"></gsweb><gsweb name="DeleteCheckBox"></gsweb>
</gsweb> </gsweb>
<gsweb name="DeleteCondition">
<tr><th align="right"><gsweb name="DeleteCheckBoxTitle"></gsweb>&nbsp;:&nbsp;</td><td><gsweb name="DeleteCheckBox"></gsweb></td></tr>
</gsweb>
<gsweb name="HasWidthAndHeight">
<gsweb name="HasWidthAndHeightList">
<tr><th align="right"><gsweb name="WidthAndHeightListTitle"></gsweb>&nbsp;:&nbsp;</td><td><gsweb name="WidthAndHeightList"></gsweb></td></tr>
</gsweb>
<gsweb name="IsCustomWidthAndHeightEnabled">
<tr><th align="right"><gsweb name="WidthTitle"></gsweb>&nbsp;x&nbsp;<gsweb name="HeightTitle"></gsweb>&nbsp;:&nbsp;</td><td><gsweb name="WidthField" size="6"></gsweb>&nbsp;x&nbsp;<gsweb name="HeightField" size="6"></gsweb></td></tr>
</gsweb>
</gsweb>
<gsweb name="HasUploadFileTitle">
<tr><th align="right"><gsweb name="UploadFileTitle"></gsweb>&nbsp;:&nbsp;</td><td><gsweb name="UploadFile"></gsweb></td></tr>
</gsweb>
<gsweb name="HasNotUploadFileTitle">
<tr><td align="left" colspan="2"><gsweb name="UploadFile"></gsweb></td></tr>
</gsweb>
</table>

View file

@ -28,6 +28,7 @@
@interface GSWFileUploadComponent : GSWComponent @interface GSWFileUploadComponent : GSWComponent
{ {
NSMutableDictionary* _tmpFileInfo; NSMutableDictionary* _tmpFileInfo;
id _tmpWithAndHeight;
}; };
-(NSMutableDictionary*)fileInfo; -(NSMutableDictionary*)fileInfo;

View file

@ -70,6 +70,7 @@ RCS_ID("$Id$")
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(_tmpWithAndHeight);
[super dealloc]; [super dealloc];
}; };
@ -109,7 +110,9 @@ RCS_ID("$Id$")
NSDebugMLog(@"fileInfo.data %p",[_tmpFileInfo valueForKey:@"data"]); NSDebugMLog(@"fileInfo.data %p",[_tmpFileInfo valueForKey:@"data"]);
NSDebugMLog(@"fileInfo.data length %d",(int)[[_tmpFileInfo valueForKey:@"data"] length]); NSDebugMLog(@"fileInfo.data length %d",(int)[[_tmpFileInfo valueForKey:@"data"] length]);
NSDebugMLog(@"fileInfo.mimeType %@",[_tmpFileInfo valueForKey:@"mimeType"]); NSDebugMLog(@"fileInfo.mimeType %@",[_tmpFileInfo valueForKey:@"mimeType"]);
NSDebugMLog(@"fileInfo.isDeleted %@",[_tmpFileInfo valueForKey:@"isDeleted"]); NSDebugMLog(@"fileInfo.widthAndHeightCode %@",[_tmpFileInfo valueForKey:@"widthAndHeightCode"]);
NSDebugMLog(@"fileInfo.width %@",[_tmpFileInfo valueForKey:@"width"]);
NSDebugMLog(@"fileInfo.height %@",[_tmpFileInfo valueForKey:@"height"]);
if ([[_tmpFileInfo valueForKey:@"data"]length]>0 || boolValueWithDefaultFor([_tmpFileInfo valueForKey:@"isDeleted"],NO)) if ([[_tmpFileInfo valueForKey:@"data"]length]>0 || boolValueWithDefaultFor([_tmpFileInfo valueForKey:@"isDeleted"],NO))
[self setValue:_tmpFileInfo [self setValue:_tmpFileInfo
forBinding:@"fileInfo"]; forBinding:@"fileInfo"];
@ -172,6 +175,50 @@ RCS_ID("$Id$")
return isDeleteEnabled; return isDeleteEnabled;
}; };
//--------------------------------------------------------------------
-(BOOL)hasWidthAndHeightList
{
return ([self valueForBinding:@"isDeleteEnabled"]!=nil);
};
//--------------------------------------------------------------------
-(NSString*)fileName
{
NSMutableDictionary* fileInfo=[self fileInfo];
NSString* fileName = [fileInfo objectForKey:@"fileName"];
if (!fileName || fileName==(NSString*)[NSNull null])
{
fileName=[fileInfo objectForKey:@"filePath"];
if (!fileName || fileName==(NSString*)[NSNull null])
{
fileName = [fileInfo objectForKey:@"fileURL"];
if (fileName==(NSString*)[NSNull null])
fileName=nil;
};
};
if (fileName)
fileName=[fileName lastPathComponent];
else
fileName=@"";
return fileName;
};
//--------------------------------------------------------------------
-(BOOL)isFileNameDisplay
{
BOOL isFileNameDisplay=boolValueFor([self valueForBinding:@"isFileNameDisplay"]);
if (isFileNameDisplay
&& [[self fileName]length]==0)
isFileNameDisplay=NO;
return isFileNameDisplay;
};
//--------------------------------------------------------------------
-(BOOL)hasUploadFileTitle
{
return (([self hasBinding:@"uploadFileTitle"]
&& [[self valueForBinding:@"uploadFileTitle"] length]>0));
};
@end @end

View file

@ -1,9 +1,9 @@
/** GSWAction.h - <title>GSWeb: Class GSWAction</title> /** GSWAction.h - <title>GSWeb: Class GSWAction</title>
Copyright (C) 1999-2002 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: Feb 1999 Date: Feb 1999
$Revision$ $Revision$
$Date$ $Date$
@ -64,7 +64,9 @@
//==================================================================== //====================================================================
@interface GSWAction (GSWActionA) @interface GSWAction (GSWActionA)
-(GSWContext*)context;
-(GSWContext*)_context; -(GSWContext*)_context;
-(GSWSession*)session;
-(GSWSession*)_session; -(GSWSession*)_session;
@end @end

View file

@ -1,9 +1,9 @@
/** GSWAction.m - <title>GSWeb: Class GSWAction</title> /** GSWAction.m - <title>GSWeb: Class GSWAction</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: Feb 1999 Date: Feb 1999
$Revision$ $Revision$
$Date$ $Date$
@ -196,6 +196,7 @@ RCS_ID("$Id$")
LOGObjectFnStart(); LOGObjectFnStart();
NS_DURING NS_DURING
{ {
NSAssert(_context,@"No Context");
component=[[GSWApplication application]pageWithName:pageName component=[[GSWApplication application]pageWithName:pageName
inContext:_context]; inContext:_context];
} }
@ -282,12 +283,13 @@ RCS_ID("$Id$")
LOGObjectFnStop(); LOGObjectFnStop();
}; };
//--------------------------------------------------------------------
-(void)setLanguages:(NSArray*)languages -(void)setLanguages:(NSArray*)languages
{ {
[_context _setLanguages:languages]; [_context _setLanguages:languages];
} }
//--------------------------------------------------------------------
-(NSArray*)languages -(NSArray*)languages
{ {
return [_context languages]; return [_context languages];
@ -297,16 +299,29 @@ RCS_ID("$Id$")
//==================================================================== //====================================================================
@implementation GSWAction (GSWActionA) @implementation GSWAction (GSWActionA)
//--------------------------------------------------------------------
-(GSWContext*)context
{
return [self _context];
};
-(GSWContext*)_context -(GSWContext*)_context
{ {
//OK //OK
return _context; return _context;
}; };
//--------------------------------------------------------------------
-(GSWSession*)session
{
return [self _session];
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(GSWSession*)_session -(GSWSession*)_session
{ {
return nil;//TODO? return [_context session];
}; };
@end @end

View file

@ -343,18 +343,22 @@ RCS_ID("$Id$")
requestHandlerPathArray); requestHandlerPathArray);
// Parse path into actionClassName,actionClass and actionName // Parse path into actionClassName,actionClass and actionName
// Be carefull: there's no context created for the moment
NS_DURING NS_DURING
{ [self getRequestActionClassNameInto:&actionClassName {
classInto:&actionClass [self getRequestActionClassNameInto:&actionClassName
nameInto:&actionName classInto:&actionClass
forPath:requestHandlerPathArray]; nameInto:&actionName
NSDebugMLLog(@"requests",@"className=%@",actionClassName); forPath:requestHandlerPathArray];
NSDebugMLLog(@"requests",@"actionClass=%@",actionClass); NSDebugMLLog(@"requests",@"className=%@",actionClassName);
NSDebugMLLog(@"requests",@"actionName=%@",actionName); NSDebugMLLog(@"requests",@"actionClass=%@",actionClass);
NSDebugMLLog(@"requests",@"actionName=%@",actionName);
} }
NS_HANDLER NS_HANDLER
{ {
LOGException(@"%@ (%@)",localException,[localException reason]); LOGException(@"%@ (%@)",localException,[localException reason]);
// Be carefull: there's no context created for the moment
response=[application handleActionRequestErrorWithRequest:aRequest response=[application handleActionRequestErrorWithRequest:aRequest
exception:localException exception:localException
reason:@"InvalidPathError" reason:@"InvalidPathError"
@ -363,7 +367,7 @@ RCS_ID("$Id$")
actionName:actionName actionName:actionName
actionClass:actionClass actionClass:actionClass
actionObject:action]; actionObject:action];
[localException raise]; [localException raise]; // Will be caught be up level Exception
}; };
NS_ENDHANDLER; NS_ENDHANDLER;
@ -379,6 +383,7 @@ RCS_ID("$Id$")
NS_DURING NS_DURING
{ {
// Will also create context
action=[self getActionInstanceOfClass:actionClass action=[self getActionInstanceOfClass:actionClass
withRequest:aRequest]; withRequest:aRequest];
} }
@ -393,7 +398,7 @@ RCS_ID("$Id$")
actionName:actionName actionName:actionName
actionClass:actionClass actionClass:actionClass
actionObject:action]; actionObject:action];
[localException raise]; [localException raise];// Will be caught be up level Exception
}; };
NS_ENDHANDLER; NS_ENDHANDLER;
@ -415,7 +420,7 @@ RCS_ID("$Id$")
actionName:actionName actionName:actionName
actionClass:actionClass actionClass:actionClass
actionObject:action]; actionObject:action];
[localException raise]; [localException raise]; // Will be caught be up level Exception
}; };
NS_ENDHANDLER; NS_ENDHANDLER;
@ -464,7 +469,7 @@ RCS_ID("$Id$")
}; };
NSDebugMLog(@"Exception=%@",exception); NSDebugMLog(@"Exception=%@",exception);
NSDebugMLog(@"Response=%@",response); NSDebugMLog(@"Response=%@",response);
[exception raise]; [exception raise]; // Will be caught be up level Exception
NSDebugMLog(@"Not raised ? Exception=%@",exception); NSDebugMLog(@"Not raised ? Exception=%@",exception);
}; };
if ([application isCachingEnabled]) if ([application isCachingEnabled])

View file

@ -258,7 +258,7 @@ Bindings
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue); NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
if (_index) if (_index)
[_index setValue:GSWIntToNSString(i) [_index setValue:[NSNumber numberWithShort:i]
inComponent:component]; inComponent:component];
if (itemValue) if (itemValue)
@ -268,7 +268,7 @@ Bindings
if (_value) // Binded Value if (_value) // Binded Value
valueValue = [_value valueInComponent:component]; valueValue = [_value valueInComponent:component];
else // Auto Value else // Auto Value
valueValue = GSWIntToNSString(i); valueValue = [NSNumber numberWithShort:i];
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue); NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (valueValue) if (valueValue)
@ -299,7 +299,7 @@ Bindings
}; };
[response _appendContentAsciiString:@" value=\""]; [response _appendContentAsciiString:@" value=\""];
[response _appendContentAsciiString:valueValue]; [response appendContentHTMLAttributeValue:valueValue];
[response appendContentCharacter:'"']; [response appendContentCharacter:'"'];
[response appendContentCharacter:'>']; [response appendContentCharacter:'>'];
@ -457,16 +457,20 @@ Bindings
inComponent:component]; inComponent:component];
if (_index) if (_index)
[_index setValue:GSWIntToNSString(i) [_index setValue:[NSNumber numberWithShort:i]
inComponent:component]; inComponent:component];
NSDebugMLLog(@"gswdync",@"value=%@",_value); NSDebugMLLog(@"gswdync",@"value=%@",_value);
if (_value) // Binded Value if (_value) // Binded Value
valueValue = [_value valueInComponent:component]; {
valueValue = [_value valueInComponent:component];
valueValueString=NSStringWithObject(valueValue);
}
else // Auto Value else // Auto Value
valueValue = GSWIntToNSString(i); {
#warning XXX SPEED UP THIS valueValue = GSWIntToNSString(i);
valueValueString=[NSString stringWithFormat:@"%@",valueValue]; valueValueString=valueValue;
};
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue); NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (valueValue) if (valueValue)

View file

@ -77,96 +77,7 @@ objectForReference:(NSString*)keyPath
@end @end
#endif // HAVE_GDL2 #endif // HAVE_GDL2
//====================================================================
// this should be in Gnustep base / extensions
@implementation NSString (EncodingDataExt)
+ (id)stringWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)encoding
{
NSData * tmpData = nil;
NSString * tmpString = nil;
if (tmpData = [NSData dataWithContentsOfFile: path])
{
tmpString = [NSString alloc];
tmpString = [tmpString initWithData:tmpData
encoding:encoding];
if (!tmpString) {
NSLog(@"%s NO STRING for path '%@' encoding:%d", __PRETTY_FUNCTION__, path, encoding);
[NSException raise:NSInvalidArgumentException
format:@"%s: could not open convert file contents '%s' non-lossy to encoding %i",
__PRETTY_FUNCTION__, path, encoding];
}
[tmpString autorelease];
}
return tmpString;
}
#warning XXX TODO Optimize for speed
+ (NSStringEncoding) encodingNamed:(NSString*) encodingName
{
if ([encodingName isEqualToString:@"NSISOLatin1StringEncoding"])
{
return NSISOLatin1StringEncoding;
}
if ([encodingName isEqualToString:@"NSASCIIStringEncoding"])
{
return NSASCIIStringEncoding;
}
if ([encodingName isEqualToString:@"NSISOLatin2StringEncoding"])
{
return NSISOLatin2StringEncoding;
}
if ([encodingName isEqualToString:@"NSJapaneseEUCStringEncoding"])
{
return NSJapaneseEUCStringEncoding;
}
if ([encodingName isEqualToString:@"NSMacOSRomanStringEncoding"])
{
return NSMacOSRomanStringEncoding;
}
if ([encodingName isEqualToString:@"NSNEXTSTEPStringEncoding"])
{
return NSNEXTSTEPStringEncoding;
}
if ([encodingName isEqualToString:@"NSNonLossyASCIIStringEncoding"])
{
return NSNonLossyASCIIStringEncoding;
}
if ([encodingName isEqualToString:@"NSUTF8StringEncoding"])
{
return NSUTF8StringEncoding;
}
if ([encodingName isEqualToString:@"NSUnicodeStringEncoding"])
{
return NSUnicodeStringEncoding;
}
if ([encodingName isEqualToString:@"NSWindowsCP1253StringEncoding"])
{
return NSWindowsCP1253StringEncoding;
}
if ([encodingName isEqualToString:@"NSWindowsCP1252StringEncoding"])
{
return NSWindowsCP1252StringEncoding;
}
if ([encodingName isEqualToString:@"NSWindowsCP1254StringEncoding"])
{
return NSWindowsCP1254StringEncoding;
}
[NSException raise:NSInvalidArgumentException
format:@"%s: does not know about '%s'",
__PRETTY_FUNCTION__, encodingName];
return 0; // to make gcc happy
}
@end
@implementation GSWBundle @implementation GSWBundle
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View file

@ -160,8 +160,8 @@ Bindings
NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue); NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue);
if (selectionValue) if (selectionValue)
{ {
NSString* valueValueString=[NSString stringWithFormat:@"%@",valueValue]; NSString* valueValueString=NSStringWithObject(valueValue);
NSString* selectionValueString=[NSString stringWithFormat:@"%@",selectionValue]; NSString* selectionValueString=NSStringWithObject(selectionValue);
isChecked=SBIsValueEqual(selectionValueString,valueValueString); isChecked=SBIsValueEqual(selectionValueString,valueValueString);
}; };
}; };
@ -217,7 +217,7 @@ Bindings
if (formValues && [formValues count]>0 && valueValue) if (formValues && [formValues count]>0 && valueValue)
{ {
NSString* valueValueString=[NSString stringWithFormat:@"%@",valueValue]; NSString* valueValueString=NSStringWithObject(valueValue);
isChecked=[formValues containsObject:valueValueString]; isChecked=[formValues containsObject:valueValueString];
}; };
NSDebugMLLog(@"gswdync",@"isChecked=%s",(isChecked ? "YES" : "NO")); NSDebugMLLog(@"gswdync",@"isChecked=%s",(isChecked ? "YES" : "NO"));

View file

@ -259,10 +259,15 @@ Bindings
NSDebugMLLog(@"gswdync",@"value=%@",_value); NSDebugMLLog(@"gswdync",@"value=%@",_value);
if (_value) // Binded Value if (_value) // Binded Value
valueValue = [_value valueInComponent:component]; {
valueValue = [_value valueInComponent:component];
valueValueString=NSStringWithObject(valueValue);
}
else // Auto Value else // Auto Value
valueValue = [NSNumber numberWithInt:i]; {
valueValueString=[NSString stringWithFormat:@"%@",valueValue]; valueValue = GSWIntToNSString(i);
valueValueString=valueValue;
};
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue); NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (valueValue) if (valueValue)
@ -441,12 +446,17 @@ Bindings
NSDebugMLLog(@"gswdync",@"_value (class: %@): %@",[_value class],_value); NSDebugMLLog(@"gswdync",@"_value (class: %@): %@",[_value class],_value);
// Value property of the INPUT tag // Value property of the INPUT tag
if (_value) // Binded Value if (_value) // Binded Value
valueValue = [_value valueInComponent:component]; {
valueValue = [_value valueInComponent:component];
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
[response appendContentHTMLAttributeValue:valueValue];
}
else // Auto Value else // Auto Value
valueValue = [NSNumber numberWithInt:i]; {
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue); valueValue = GSWIntToNSString(i);
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
[response appendContentHTMLAttributeValue:valueValue]; [response _appendContentAsciiString:valueValue];
}
[response appendContentCharacter:'"']; [response appendContentCharacter:'"'];
NSDebugMLLog(@"gswdync",@"selectionsValue=%@",selectionsValue); NSDebugMLLog(@"gswdync",@"selectionsValue=%@",selectionsValue);

View file

@ -68,8 +68,10 @@
-(void)setUserDictionary:(NSDictionary*)userDictionary; -(void)setUserDictionary:(NSDictionary*)userDictionary;
-(NSDictionary*)userAssociations; -(NSDictionary*)userAssociations;
-(void)setUserAssociations:(NSDictionary*)userAssociations; -(void)setUserAssociations:(NSDictionary*)userAssociations;
-(GSWAssociation*)userAssociationForKey:(NSString*)key;
-(NSDictionary*)defaultAssociations; -(NSDictionary*)defaultAssociations;
-(void)setDefaultAssociations:(NSDictionary*)defaultAssociations; -(void)setDefaultAssociations:(NSDictionary*)defaultAssociations;
-(GSWAssociation*)defaultAssociationForKey:(NSString*)key;
#endif #endif
-(NSString*)frameworkName; -(NSString*)frameworkName;
-(NSString*)baseURL; -(NSString*)baseURL;

View file

@ -289,38 +289,57 @@ RCS_ID("$Id$")
}; };
// GSWeb Additions { // GSWeb Additions {
//--------------------------------------------------------------------
-(NSDictionary*)userDictionary -(NSDictionary*)userDictionary
{ {
return _userDictionary; return _userDictionary;
}; };
//--------------------------------------------------------------------
-(void)setUserDictionary:(NSDictionary*)aUserDictionary -(void)setUserDictionary:(NSDictionary*)aUserDictionary
{ {
ASSIGN(_userDictionary,aUserDictionary); ASSIGN(_userDictionary,aUserDictionary);
NSDebugMLLog(@"GSWComponent",@"userDictionary:%@",_userDictionary); NSDebugMLLog(@"GSWComponent",@"userDictionary:%@",_userDictionary);
}; };
//--------------------------------------------------------------------
-(NSDictionary*)userAssociations -(NSDictionary*)userAssociations
{ {
return _userAssociations; return _userAssociations;
}; };
//--------------------------------------------------------------------
-(void)setUserAssociations:(NSDictionary*)userAssociations -(void)setUserAssociations:(NSDictionary*)userAssociations
{ {
ASSIGN(_userAssociations,userAssociations); ASSIGN(_userAssociations,userAssociations);
NSDebugMLLog(@"GSWComponent",@"userAssociations:%@",_userAssociations); NSDebugMLLog(@"GSWComponent",@"userAssociations:%@",_userAssociations);
}; };
//--------------------------------------------------------------------
-(GSWAssociation*)userAssociationForKey:(NSString*)key
{
return [[self userAssociations]objectForKey:key];
};
//--------------------------------------------------------------------
-(NSDictionary*)defaultAssociations -(NSDictionary*)defaultAssociations
{ {
return _defaultAssociations; return _defaultAssociations;
}; };
//--------------------------------------------------------------------
-(void)setDefaultAssociations:(NSDictionary*)defaultAssociations -(void)setDefaultAssociations:(NSDictionary*)defaultAssociations
{ {
ASSIGN(_defaultAssociations,defaultAssociations); ASSIGN(_defaultAssociations,defaultAssociations);
NSDebugMLLog(@"GSWComponent",@"defaultAssociations:%@",_defaultAssociations); NSDebugMLLog(@"GSWComponent",@"defaultAssociations:%@",_defaultAssociations);
}; };
//--------------------------------------------------------------------
-(GSWAssociation*)defaultAssociationForKey:(NSString*)key
{
return [[self defaultAssociations]objectForKey:key];
};
// } // }
@end @end
@ -399,7 +418,8 @@ associationsKeys:(NSArray*)associationsKeys
&& ![anAssociation isKindOfClass:[GSWBindingNameAssociation class]]) //TODOV && ![anAssociation isKindOfClass:[GSWBindingNameAssociation class]]) //TODOV
{ {
aValue=[self valueForKey:aKey]; aValue=[self valueForKey:aKey];
NSDebugMLLog(@"GSWComponent",@"aKey=%@ aValue=%@",aKey,aValue); NSDebugMLLog(@"GSWComponent",@"aKey=%@ aValue=%@ (%@)",
aKey,aValue,NSStringFromClass([aValue class]));
if (doLog) if (doLog)
[anAssociation logSynchronizeComponentToParentForValue:aValue [anAssociation logSynchronizeComponentToParentForValue:aValue
inComponent:_parent]; inComponent:_parent];
@ -437,7 +457,8 @@ associationsKeys:(NSArray*)associationsKeys
if (![anAssociation isKindOfClass:[GSWBindingNameAssociation class]]) //TODOV if (![anAssociation isKindOfClass:[GSWBindingNameAssociation class]]) //TODOV
{ {
aValue=[anAssociation valueInComponent:_parent]; aValue=[anAssociation valueInComponent:_parent];
NSDebugMLLog(@"GSWComponent",@"aKey=%@ aValue=%@",aKey,aValue); NSDebugMLLog(@"GSWComponent",@"aKey=%@ aValue=%@ (%@)",
aKey,aValue,NSStringFromClass([aValue class]));
if (doLog) if (doLog)
[anAssociation logSynchronizeParentToComponentForValue:aValue [anAssociation logSynchronizeParentToComponentForValue:aValue
inComponent:self]; inComponent:self];
@ -787,7 +808,9 @@ associationsKeys:(NSArray*)associationsKeys
GSWAssociation* assoc=nil; GSWAssociation* assoc=nil;
unsigned int index=NSNotFound; unsigned int index=NSNotFound;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"GSWComponent",@"_associationsKeys=%@",_associationsKeys); NSDebugMLLog(@"GSWComponent",@"In %@ Search %@ _associationsKeys=%@",
NSStringFromClass([self class]),
aName,_associationsKeys);
//NSDebugMLLog(@"GSWComponent",@"_associations=%@",[_associations description]); //NSDebugMLLog(@"GSWComponent",@"_associations=%@",[_associations description]);
if (_associationsKeys) if (_associationsKeys)
{ {
@ -800,7 +823,9 @@ associationsKeys:(NSArray*)associationsKeys
{ {
assoc=[_defaultAssociations objectForKey:aName]; assoc=[_defaultAssociations objectForKey:aName];
}; };
NSDebugMLLog(@"GSWComponent",@"assoc=%@",assoc); NSDebugMLLog(@"GSWComponent",@"In %@ Association for %@=%@",
NSStringFromClass([self class]),
aName,assoc);
LOGObjectFnStop(); LOGObjectFnStop();
return assoc; return assoc;
}; };
@ -843,15 +868,18 @@ associationsKeys:(NSArray*)associationsKeys
//OK //OK
GSWAssociation* assoc=nil; GSWAssociation* assoc=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"GSWComponent",@"declarationName=%@ - parentBindingName_=%@", NSDebugMLLog(@"GSWComponent",@"self=%@ declarationName=%@ - parentBindingName_=%@",
NSStringFromClass([self class]),
[self declarationName], [self declarationName],
parentBindingName); parentBindingName);
NSDebugMLLog(@"GSWComponent",@"value_=%@",value); NSDebugMLLog(@"GSWComponent",@"value_=%@",value);
NSDebugMLLog(@"GSWComponent",@"_parent=%p",(void*)_parent); NSDebugMLLog(@"GSWComponent",@"_parent=%p of class %@",
(void*)_parent,
NSStringFromClass([_parent class]));
if (_parent) if (_parent)
{ {
assoc=[self _associationWithName:parentBindingName]; assoc=[self _associationWithName:parentBindingName];
NSDebugMLLog(@"GSWComponent",@"assoc=%@",assoc); NSDebugMLLog(@"GSWComponent",@"assoc for %@=%@",parentBindingName,assoc);
if(assoc) if(assoc)
[assoc setValue:value [assoc setValue:value
inComponent:_parent]; inComponent:_parent];
@ -910,7 +938,8 @@ associationsKeys:(NSArray*)associationsKeys
} }
#endif #endif
*/ */
NSDebugMLLog(@"GSWComponent",@"aValue=%@",aValue); NSDebugMLLog(@"GSWComponent",@"parentBindingName=%@ aValue=%@ (%@)",
parentBindingName,aValue,NSStringFromClass([aValue class]));
}; };
LOGObjectFnStop(); LOGObjectFnStop();
return aValue; return aValue;

View file

@ -396,6 +396,7 @@ GSWEB_EXPORT id cidKey__Key;
GSWEB_EXPORT id isDisplayStringBefore__Key; GSWEB_EXPORT id isDisplayStringBefore__Key;
GSWEB_EXPORT id urlPrefix__Key; GSWEB_EXPORT id urlPrefix__Key;
GSWEB_EXPORT id pathQueryDictionary__Key; GSWEB_EXPORT id pathQueryDictionary__Key;
GSWEB_EXPORT id omitElement__Key;
#endif // _GSWebConstants_h__ #endif // _GSWebConstants_h__

View file

@ -393,3 +393,4 @@ id cidKey__Key = @"cidKey";
id isDisplayStringBefore__Key = @"isDisplayStringBefore"; id isDisplayStringBefore__Key = @"isDisplayStringBefore";
id urlPrefix__Key = @"urlPrefix"; id urlPrefix__Key = @"urlPrefix";
id pathQueryDictionary__Key = @"pathQueryDictionary"; id pathQueryDictionary__Key = @"pathQueryDictionary";
id omitElement__Key = @"omitElement";

View file

@ -1,9 +1,9 @@
/** GSWContext.h - <title>GSWeb: Class GSWContext</title> /** GSWContext.h - <title>GSWeb: Class GSWContext</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
$Revision$ $Revision$
$Date$ $Date$
@ -57,6 +57,7 @@
BOOL _pageReplaced; BOOL _pageReplaced;
BOOL _generateCompleteURLs; BOOL _generateCompleteURLs;
BOOL _isInForm; BOOL _isInForm;
BOOL _isInEnabledForm;
BOOL _actionInvoked; BOOL _actionInvoked;
BOOL _formSubmitted; BOOL _formSubmitted;
BOOL _isMultipleSubmitForm; BOOL _isMultipleSubmitForm;
@ -75,6 +76,8 @@
-(void)setInForm:(BOOL)flag; -(void)setInForm:(BOOL)flag;
-(BOOL)isInForm; -(BOOL)isInForm;
-(void)setInEnabledForm:(BOOL)flag;
-(BOOL)isInEnabledForm;
-(GSWElementIDString*)elementID; -(GSWElementIDString*)elementID;
-(NSString*)contextAndElementID; -(NSString*)contextAndElementID;
-(GSWComponent*)component; -(GSWComponent*)component;
@ -145,6 +148,7 @@
queryString:(NSString*)queryString queryString:(NSString*)queryString
isSecure:(BOOL)isSecure isSecure:(BOOL)isSecure
port:(int)port; port:(int)port;
-(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey -(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey
path:(NSString*)requestHandlerPath path:(NSString*)requestHandlerPath
queryString:(NSString*)queryString queryString:(NSString*)queryString
@ -156,6 +160,12 @@
path:(NSString*)requestHandlerPath path:(NSString*)requestHandlerPath
queryString:(NSString*)queryString; queryString:(NSString*)queryString;
-(GSWDynamicURLString*)urlWithURLPrefix:(NSString*)urlPrefix
RequestHandlerKey:(NSString*)requestHandlerKey
path:(NSString*)requestHandlerPath
queryString:(NSString*)queryString
isSecure:(BOOL)isSecure;
-(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey -(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey
path:(NSString*)requestHandlerPath path:(NSString*)requestHandlerPath
queryString:(NSString*)queryString; queryString:(NSString*)queryString;
@ -166,6 +176,12 @@
path:(NSString*)requestHandlerPath path:(NSString*)requestHandlerPath
queryString:(NSString*)queryString; queryString:(NSString*)queryString;
//NDFN
-(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey
path:(NSString*)requestHandlerPath
queryString:(NSString*)queryString
isSecure:(BOOL)isSecure;
//NDFN //NDFN
-(GSWDynamicURLString*)completeURLWithRequestHandlerKey:(NSString*)requestHandlerKey -(GSWDynamicURLString*)completeURLWithRequestHandlerKey:(NSString*)requestHandlerKey
path:(NSString*)requestHandlerPath path:(NSString*)requestHandlerPath

View file

@ -214,6 +214,18 @@ static int dontTraceComponentActionURL=0;
return _isInForm; return _isInForm;
}; };
//--------------------------------------------------------------------
-(void)setInEnabledForm:(BOOL)flag
{
_isInEnabledForm=flag;
};
//--------------------------------------------------------------------
-(BOOL)isInEnabledForm
{
return _isInEnabledForm;
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// elementID // elementID
-(GSWElementIDString*)elementID -(GSWElementIDString*)elementID
@ -286,7 +298,7 @@ static int dontTraceComponentActionURL=0;
if (!_session) if (!_session)
{ {
NSDebugMLog(@"_requestSessionID=%@",_requestSessionID); NSDebugMLLog(@"sessions",@"_requestSessionID=%@",_requestSessionID);
if (_requestSessionID) if (_requestSessionID)
[GSWApp restoreSessionWithID:_requestSessionID [GSWApp restoreSessionWithID:_requestSessionID
inContext:self];//Application call context _setSession inContext:self];//Application call context _setSession
@ -380,12 +392,16 @@ static int dontTraceComponentActionURL=0;
queryDictionary:(NSDictionary*)queryDictionary queryDictionary:(NSDictionary*)queryDictionary
{ {
GSWDynamicURLString* url=nil; GSWDynamicURLString* url=nil;
LOGObjectFnStart(); LOGObjectFnStart();
url=[self directActionURLForActionNamed:actionName url=[self directActionURLForActionNamed:actionName
urlPrefix:urlPrefix urlPrefix:urlPrefix
queryDictionary:queryDictionary queryDictionary:queryDictionary
isSecure:NO]; isSecure:NO];
LOGObjectFnStop(); LOGObjectFnStop();
return url; return url;
}; };
@ -393,9 +409,17 @@ static int dontTraceComponentActionURL=0;
-(GSWDynamicURLString*)directActionURLForActionNamed:(NSString*)actionName -(GSWDynamicURLString*)directActionURLForActionNamed:(NSString*)actionName
queryDictionary:(NSDictionary*)queryDictionary queryDictionary:(NSDictionary*)queryDictionary
{ {
return [self directActionURLForActionNamed:actionName GSWDynamicURLString* url=nil;
urlPrefix:nil
queryDictionary:queryDictionary]; LOGObjectFnStart();
url=[self directActionURLForActionNamed:actionName
urlPrefix:nil
queryDictionary:queryDictionary];
LOGObjectFnStop();
return url;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -405,12 +429,17 @@ static int dontTraceComponentActionURL=0;
pathQueryDictionary:(NSDictionary*)pathQueryDictionary pathQueryDictionary:(NSDictionary*)pathQueryDictionary
{ {
GSWDynamicURLString* url=nil; GSWDynamicURLString* url=nil;
LOGObjectFnStart(); LOGObjectFnStart();
url=[self directActionURLForActionNamed:actionName url=[self directActionURLForActionNamed:actionName
urlPrefix:urlPrefix urlPrefix:urlPrefix
queryDictionary:queryDictionary queryDictionary:queryDictionary
pathQueryDictionary:pathQueryDictionary]; pathQueryDictionary:pathQueryDictionary
isSecure:NO];
LOGObjectFnStop(); LOGObjectFnStop();
return url; return url;
}; };
@ -419,10 +448,18 @@ static int dontTraceComponentActionURL=0;
queryDictionary:(NSDictionary*)queryDictionary queryDictionary:(NSDictionary*)queryDictionary
pathQueryDictionary:(NSDictionary*)pathQueryDictionary pathQueryDictionary:(NSDictionary*)pathQueryDictionary
{ {
return [self directActionURLForActionNamed:actionName GSWDynamicURLString* url=nil;
LOGObjectFnStart();
url=[self directActionURLForActionNamed:actionName
urlPrefix:nil urlPrefix:nil
queryDictionary:queryDictionary queryDictionary:queryDictionary
pathQueryDictionary:pathQueryDictionary]; pathQueryDictionary:pathQueryDictionary];
LOGObjectFnStop();
return url;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -432,13 +469,17 @@ static int dontTraceComponentActionURL=0;
isSecure:(BOOL)isSecure isSecure:(BOOL)isSecure
{ {
GSWDynamicURLString* url=nil; GSWDynamicURLString* url=nil;
LOGObjectFnStart(); LOGObjectFnStart();
url=[self directActionURLForActionNamed:actionName url=[self directActionURLForActionNamed:actionName
urlPrefix:urlPrefix urlPrefix:urlPrefix
queryDictionary:queryDictionary queryDictionary:queryDictionary
pathQueryDictionary:nil pathQueryDictionary:nil
isSecure:NO]; isSecure:isSecure];
LOGObjectFnStop(); LOGObjectFnStop();
return url; return url;
}; };
@ -447,10 +488,18 @@ static int dontTraceComponentActionURL=0;
queryDictionary:(NSDictionary*)queryDictionary queryDictionary:(NSDictionary*)queryDictionary
isSecure:(BOOL)isSecure isSecure:(BOOL)isSecure
{ {
return [self directActionURLForActionNamed:actionName GSWDynamicURLString* url=nil;
urlPrefix:nil
queryDictionary:queryDictionary LOGObjectFnStart();
isSecure:isSecure];
url=[self directActionURLForActionNamed:actionName
urlPrefix:nil
queryDictionary:queryDictionary
isSecure:isSecure];
LOGObjectFnStop();
return url;
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -471,7 +520,7 @@ static int dontTraceComponentActionURL=0;
isSecure:isSecure isSecure:isSecure
url:url]; url:url];
NSDebugMLog(@"url=%@",url); NSDebugMLLog(@"GSWContext",@"url=%@",url);
LOGObjectFnStop(); LOGObjectFnStop();
@ -495,16 +544,19 @@ static int dontTraceComponentActionURL=0;
-(GSWDynamicURLString*)componentActionURL -(GSWDynamicURLString*)componentActionURL
{ {
GSWDynamicURLString* url=nil; GSWDynamicURLString* url=nil;
LOGObjectFnStartCond(dontTraceComponentActionURL==0); LOGObjectFnStartCond(dontTraceComponentActionURL==0);
url=[self componentActionURLIsSecure:NO]; url=[self componentActionURLIsSecure:NO];
LOGObjectFnStopCond(dontTraceComponentActionURL==0); LOGObjectFnStopCond(dontTraceComponentActionURL==0);
return url; return url;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(GSWDynamicURLString*)componentActionURLIsSecure:(BOOL)isSecure -(GSWDynamicURLString*)componentActionURLIsSecure:(BOOL)isSecure
{ {
//TODO: use isSecure
BOOL storesIDsInURLs=NO; BOOL storesIDsInURLs=NO;
GSWDynamicURLString* url=nil; GSWDynamicURLString* url=nil;
GSWSession* session=nil; GSWSession* session=nil;
@ -578,7 +630,8 @@ static int dontTraceComponentActionURL=0;
NSDebugMLogCond(dontTraceComponentActionURL==0,@"requestHandlerPath=%@",requestHandlerPath); NSDebugMLogCond(dontTraceComponentActionURL==0,@"requestHandlerPath=%@",requestHandlerPath);
url=[self urlWithRequestHandlerKey:requestHandlerKey url=[self urlWithRequestHandlerKey:requestHandlerKey
path:requestHandlerPath path:requestHandlerPath
queryString:nil]; queryString:nil
isSecure:isSecure];
NSDebugMLogCond(dontTraceComponentActionURL==0,@"url=%@",url); NSDebugMLogCond(dontTraceComponentActionURL==0,@"url=%@",url);
LOGObjectFnStopCond(dontTraceComponentActionURL==0); LOGObjectFnStopCond(dontTraceComponentActionURL==0);
return url; return url;
@ -597,11 +650,11 @@ static int dontTraceComponentActionURL=0;
LOGObjectFnStartCond(dontTraceComponentActionURL==0); LOGObjectFnStartCond(dontTraceComponentActionURL==0);
NSDebugMLog(@"urlPrefix=%@",urlPrefix); NSDebugMLLog(@"GSWContext",@"urlPrefix=%@",urlPrefix);
NSDebugMLog(@"requestHandlerKey=%@",requestHandlerKey); NSDebugMLLog(@"GSWContext",@"requestHandlerKey=%@",requestHandlerKey);
NSDebugMLog(@"requestHandlerPath=%@",requestHandlerPath); NSDebugMLLog(@"GSWContext",@"requestHandlerPath=%@",requestHandlerPath);
NSDebugMLog(@"queryString=%@",queryString); NSDebugMLLog(@"GSWContext",@"queryString=%@",queryString);
NSDebugMLog(@"isSecure=%d",isSecure); NSDebugMLLog(@"GSWContext",@"isSecure=%d",isSecure);
NSDebugMLogCond(dontTraceComponentActionURL==0, NSDebugMLogCond(dontTraceComponentActionURL==0,
@"generateCompleteURLs=%s", @"generateCompleteURLs=%s",
(_generateCompleteURLs ? "YES" : "NO")); (_generateCompleteURLs ? "YES" : "NO"));
@ -645,12 +698,33 @@ static int dontTraceComponentActionURL=0;
port:port]; port:port];
} }
//--------------------------------------------------------------------
-(GSWDynamicURLString*)urlWithURLPrefix:(NSString*)urlPrefix
RequestHandlerKey:(NSString*)requestHandlerKey
path:(NSString*)requestHandlerPath
queryString:(NSString*)queryString
{
GSWDynamicURLString* url=nil;
LOGObjectFnStartCond(dontTraceComponentActionURL==0);
url=[self urlWithURLPrefix:urlPrefix
RequestHandlerKey:requestHandlerKey
path:requestHandlerPath
queryString:queryString
isSecure:NO];
LOGObjectFnStopCond(dontTraceComponentActionURL==0);
return url;
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
//TODO rewrite to avoid request call //TODO rewrite to avoid request call
-(GSWDynamicURLString*)urlWithURLPrefix:(NSString*)urlPrefix -(GSWDynamicURLString*)urlWithURLPrefix:(NSString*)urlPrefix
RequestHandlerKey:(NSString*)requestHandlerKey RequestHandlerKey:(NSString*)requestHandlerKey
path:(NSString*)requestHandlerPath path:(NSString*)requestHandlerPath
queryString:(NSString*)queryString queryString:(NSString*)queryString
isSecure:(BOOL)isSecure
{ {
GSWDynamicURLString* url=nil; GSWDynamicURLString* url=nil;
GSWRequest* request=[self request]; GSWRequest* request=[self request];
@ -661,7 +735,9 @@ static int dontTraceComponentActionURL=0;
if (_generateCompleteURLs) if (_generateCompleteURLs)
url=[self completeURLWithRequestHandlerKey:requestHandlerKey url=[self completeURLWithRequestHandlerKey:requestHandlerKey
path:requestHandlerPath path:requestHandlerPath
queryString:queryString]; queryString:queryString
isSecure:isSecure
port:0];
else else
{ {
url=[request _urlWithRequestHandlerKey:requestHandlerKey url=[request _urlWithRequestHandlerKey:requestHandlerKey
@ -683,10 +759,22 @@ static int dontTraceComponentActionURL=0;
return [self urlWithURLPrefix:nil return [self urlWithURLPrefix:nil
RequestHandlerKey:requestHandlerKey RequestHandlerKey:requestHandlerKey
path:requestHandlerPath path:requestHandlerPath
queryString:queryString]; queryString:queryString
isSecure:NO];
}; };
//--------------------------------------------------------------------
-(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey
path:(NSString*)requestHandlerPath
queryString:(NSString*)queryString
isSecure:(BOOL)isSecure
{
return [self urlWithURLPrefix:nil
RequestHandlerKey:requestHandlerKey
path:requestHandlerPath
queryString:queryString
isSecure:isSecure];
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
//NDFN //NDFN
@ -1059,11 +1147,11 @@ static int dontTraceComponentActionURL=0;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLog(@"actionName=%@",actionName); NSDebugMLLog(@"GSWContext",@"actionName=%@",actionName);
NSDebugMLog(@"urlPrefix=%@",urlPrefix); NSDebugMLLog(@"GSWContext",@"urlPrefix=%@",urlPrefix);
NSDebugMLog(@"dict=%@",dict); NSDebugMLLog(@"GSWContext",@"dict=%@",dict);
NSDebugMLog(@"pathQueryDictionary=%@",pathQueryDictionary); NSDebugMLLog(@"GSWContext",@"pathQueryDictionary=%@",pathQueryDictionary);
NSDebugMLog(@"isSecure=%d",isSecure); NSDebugMLLog(@"GSWContext",@"isSecure=%d",isSecure);
NSDebugMLogCond(dontTraceComponentActionURL==0, NSDebugMLogCond(dontTraceComponentActionURL==0,
@"anURL=%@",anURL); @"anURL=%@",anURL);
@ -1166,25 +1254,25 @@ If none, try request languages
LOGObjectFnStart(); LOGObjectFnStart();
languages=[_session languages]; languages=[_session languages];
NSDebugMLog(@"_session %p languages=%@",_session,languages); NSDebugMLLog(@"GSWContext",@"_session %p languages=%@",_session,languages);
if ([languages count]==0) if ([languages count]==0)
{ {
languages=_languages; languages=_languages;
NSDebugMLog(@"context %p languages=%@",self,languages); NSDebugMLLog(@"GSWContext",@"context %p languages=%@",self,languages);
if ([languages count]==0) if ([languages count]==0)
{ {
languages=[[self request]browserLanguages]; languages=[[self request]browserLanguages];
NSDebugMLog(@"resquest %p browserLanguages=%@",[self request],languages); NSDebugMLLog(@"GSWContext",@"resquest %p browserLanguages=%@",[self request],languages);
} }
}; };
NSDebugMLog(@"context %p ==> languages=%@",self,languages); NSDebugMLLog(@"GSWContext",@"context %p ==> languages=%@",self,languages);
//GSWeb specific: It enable application languages filtering //GSWeb specific: It enable application languages filtering
languages=[GSWApp filterLanguages:languages]; languages=[GSWApp filterLanguages:languages];
NSDebugMLog(@"context %p ==> filtered languages=%@",self,languages); NSDebugMLLog(@"GSWContext",@"context %p ==> filtered languages=%@",self,languages);
LOGObjectFnStop(); LOGObjectFnStop();
@ -1196,7 +1284,7 @@ If none, try request languages
{ {
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLog(@"languages=%@",languages); NSDebugMLLog(@"GSWContext",@"languages=%@",languages);
ASSIGNCOPY(_languages,languages); ASSIGNCOPY(_languages,languages);
@ -1329,17 +1417,17 @@ If none, try request languages
storesIDsInURLs=[_session storesIDsInURLs]; storesIDsInURLs=[_session storesIDsInURLs];
isDistributionEnabled=[_session isDistributionEnabled]; isDistributionEnabled=[_session isDistributionEnabled];
NSDebugMLog(@"storesIDsInURLs=%d",storesIDsInURLs); NSDebugMLLog(@"GSWContext",@"storesIDsInURLs=%d",storesIDsInURLs);
NSDebugMLog(@"isDistributionEnabled=%d",isDistributionEnabled); NSDebugMLLog(@"GSWContext",@"isDistributionEnabled=%d",isDistributionEnabled);
NSDebugMLog(@"_session=%p",_session); NSDebugMLLog(@"GSWContext",@"_session=%p",_session);
NSDebugMLog(@"_request=%p",_request); NSDebugMLLog(@"GSWContext",@"_request=%p",_request);
instance=[_request applicationNumber]; instance=[_request applicationNumber];
sessionID=[_request sessionID]; sessionID=[_request sessionID];
NSDebugMLog(@"instance=%d",instance); NSDebugMLLog(@"GSWContext",@"instance=%d",instance);
NSDebugMLog(@"sessionID=%@",sessionID); NSDebugMLLog(@"GSWContext",@"sessionID=%@",sessionID);
// Set instance to -1 // Set instance to -1
// if we don't store IDs in URLs and distribution is enabled // if we don't store IDs in URLs and distribution is enabled
@ -1349,7 +1437,7 @@ If none, try request languages
instance=-1; instance=-1;
}; };
NSDebugMLog(@"instance=%d",instance); NSDebugMLLog(@"GSWContext",@"instance=%d",instance);
_urlApplicationNumber = instance; _urlApplicationNumber = instance;
[_url setURLApplicationNumber:instance]; [_url setURLApplicationNumber:instance];

View file

@ -801,7 +801,7 @@ int allow_severity = LOG_INFO;
[appName cString], RQ_FILE, [handle fileDescriptor], 0); [appName cString], RQ_FILE, [handle fileDescriptor], 0);
fromhost(&libwrapRequestInfo); fromhost(&libwrapRequestInfo);
if (STR_EQ(eval_hostname(libwrapRequestInfo.client), paranoid) if (STR_EQ(eval_hostname(libwrapRequestInfo.client), "") //!paranoid
|| !hosts_access(&libwrapRequestInfo)) || !hosts_access(&libwrapRequestInfo))
{ {
allowed = NO; allowed = NO;

View file

@ -574,49 +574,84 @@ RCS_ID("$Id$")
data:(NSData*)data data:(NSData*)data
{ {
GSWRequest* request=nil; GSWRequest* request=nil;
NSArray* requestLineArray=nil; int requestLineLength=0;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugDeepMLog0(@"GSWDefaultAdaptorThread: createRequestFromData"); NSDebugDeepMLog0(@"GSWDefaultAdaptorThread: createRequestFromData");
requestLineArray=[requestLine componentsSeparatedByString:@" "];
NSDebugDeepMLLog(@"low",@"requestLine:%@",requestLine); NSDebugDeepMLLog(@"low",@"requestLine:%@",requestLine);
NSDebugDeepMLLog(@"info",@"requestLineArray:%@",requestLineArray);
if ([requestLineArray count]!=3) requestLineLength=[requestLine length];
if (requestLineLength==0)
{ {
ExceptionRaise(@"GSWDefaultAdaptorThread", ExceptionRaise(@"GSWDefaultAdaptorThread",
@"bad request first line (elements count %d != 3). requestLine: '%@'.RequestLineArray: %@", @"bad request first line: '%@'",
[requestLineArray count], requestLine);
requestLine,
requestLineArray);
} }
else else
{ {
NSString* method=[requestLineArray objectAtIndex:0]; NSRange spaceRange;
NSString* url=[requestLineArray objectAtIndex:1]; NSRange urlRange;
NSArray* http=[[requestLineArray objectAtIndex:2] componentsSeparatedByString:@"/"]; NSString* method=nil;
[GSWApplication statusLogWithFormat:@"RemoteAddress=%@ Request uri=%@",_remoteAddress,url]; NSString* url=nil;
NSString* protocolString=nil;
NSArray* protocol=nil;
NSDebugDeepMLLog(@"info",@"method=%@",method); spaceRange=[requestLine rangeOfString:@" "];
NSDebugDeepMLLog(@"info",@"url=%@",url); if (spaceRange.length==0 || spaceRange.location+spaceRange.length>=requestLineLength)
NSDebugDeepMLLog(@"info",@"http=%@",http);
if ([http count]!=2)
{ {
ExceptionRaise0(@"GSWDefaultAdaptorThread",@"bad request first line (HTTP)"); ExceptionRaise(@"GSWDefaultAdaptorThread",
@"bad request first line: No method or no protocol '%@'",
requestLine);
} }
else else
{ {
NSString* httpVersion=[http objectAtIndex:1]; method=[requestLine substringToIndex:spaceRange.location];
/* if (isHeaderKeysEqual(method,GSWHTTPHeader_MethodPost)) urlRange.location=spaceRange.location+spaceRange.length;//+1 to skip space
{ spaceRange=[requestLine rangeOfString:@" "
*/ options:NSBackwardsSearch
request=[_application createRequestWithMethod:method range:NSMakeRange(urlRange.location,requestLineLength-urlRange.location)];
uri:url if (spaceRange.length==0 || spaceRange.location<=urlRange.location)
httpVersion:httpVersion {
headers:headers ExceptionRaise(@"GSWDefaultAdaptorThread",
content:data @"bad request first line: No protocol or no url '%@'",
userInfo:nil]; requestLine);
/* };*/ }
else
{
protocolString=[requestLine substringFromIndex:spaceRange.location+spaceRange.length];
protocol=[protocolString componentsSeparatedByString:@"/"];
urlRange.length=spaceRange.location-urlRange.location;
url=[requestLine substringFromRange:urlRange];
NSDebugDeepMLLog(@"info",@"method=%@",method);
NSDebugDeepMLLog(@"info",@"url=%@",url);
NSDebugDeepMLLog(@"info",@"protocolString=%@",protocolString);
if ([protocol count]!=2)
{
ExceptionRaise0(@"GSWDefaultAdaptorThread",@"bad request first line (HTTP)");
}
else
{
NSString* httpVersion=[protocol objectAtIndex:1];
[GSWApplication statusLogWithFormat:@"RemoteAddress=%@ Method=%@ Protocol=%@ httpVersion=%@ uri=%@",
_remoteAddress,method,protocolString,httpVersion,url];
/* if (isHeaderKeysEqual(method,GSWHTTPHeader_MethodPost))
{
*/
request=[_application createRequestWithMethod:method
uri:url
httpVersion:httpVersion
headers:headers
content:data
userInfo:nil];
/* };*/
};
};
}; };
}; };
LOGObjectFnStop(); LOGObjectFnStop();
return request; return request;
}; };
@ -688,7 +723,6 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
{ {
int headerN=0; int headerN=0;
int headerNForKey=0; int headerNForKey=0;
NSMutableData* allResponseData=nil;//to store response
NSMutableData* responseData=(NSMutableData*)[NSMutableData data]; NSMutableData* responseData=(NSMutableData*)[NSMutableData data];
NSArray* headerKeys=[response headerKeys]; NSArray* headerKeys=[response headerKeys];
NSArray* headersForKey=nil; NSArray* headersForKey=nil;

View file

@ -1,6 +1,6 @@
/** GSWDisplayGroup.h - <title>GSWeb: Class GSWDisplayGroup</title> /** GSWDisplayGroup.h - <title>GSWeb: Class GSWDisplayGroup</title>
Copyright (C) 1999-2002 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
@ -169,8 +169,14 @@
- (id)displayBatchContainingSelectedObject; - (id)displayBatchContainingSelectedObject;
- (NSArray *)displayedObjects; - (NSArray *)displayedObjects;
- (NSArray *)allDisplayedObjects; - (NSArray *)allDisplayedObjects;
- (id)displayFirstBatch;
- (id)displayNextBatch; - (id)displayNextBatch;
- (id)displayPreviousBatch; - (id)displayPreviousBatch;
- (id)displayLastBatch;
- (BOOL)canDisplayFirstBatch;
- (BOOL)canDisplayNextBatch;
- (BOOL)canDisplayPreviousBatch;
- (BOOL)canDisplayLastBatch;
- (BOOL)endEditing; - (BOOL)endEditing;
- (id)executeQuery; - (id)executeQuery;
- (id)fetch; - (id)fetch;

View file

@ -1,6 +1,6 @@
/** GSWDisplayGroup.m - <title>GSWeb: Class GSWDisplayGroup</title> /** GSWDisplayGroup.m - <title>GSWeb: Class GSWDisplayGroup</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>
Mirko Viviani <mirko.viviani@rccr.cremona.it> Mirko Viviani <mirko.viviani@rccr.cremona.it>
@ -124,9 +124,9 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
_queryMinMatch = [[NSMutableDictionary alloc] initWithCapacity:8]; _queryMinMatch = [[NSMutableDictionary alloc] initWithCapacity:8];
_queryMax = [[NSMutableDictionary alloc] initWithCapacity:8]; _queryMax = [[NSMutableDictionary alloc] initWithCapacity:8];
_queryMaxMatch = [[NSMutableDictionary alloc] initWithCapacity:8]; _queryMaxMatch = [[NSMutableDictionary alloc] initWithCapacity:8];
NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator); NSDebugMLLog(@"GSWDisplayGroup",@"_queryOperator=%@",_queryOperator);
_queryOperator = [[NSMutableDictionary alloc] initWithCapacity:8]; _queryOperator = [[NSMutableDictionary alloc] initWithCapacity:8];
NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator); NSDebugMLLog(@"GSWDisplayGroup",@"_queryOperator=%@",_queryOperator);
_queryKeyValueQualifierClassName _queryKeyValueQualifierClassName
= [[NSMutableDictionary alloc] initWithCapacity:8]; = [[NSMutableDictionary alloc] initWithCapacity:8];
@ -138,9 +138,9 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
[[self class]globalDefaultStringMatchOperator]); [[self class]globalDefaultStringMatchOperator]);
ASSIGN(_defaultStringMatchFormat, ASSIGN(_defaultStringMatchFormat,
[[self class]globalDefaultStringMatchFormat]); [[self class]globalDefaultStringMatchFormat]);
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchOperator=%@", NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchOperator=%@",
_defaultStringMatchOperator); _defaultStringMatchOperator);
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchFormat=%@", NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchFormat=%@",
_defaultStringMatchFormat); _defaultStringMatchFormat);
[self setFetchesOnLoad:YES]; [self setFetchesOnLoad:YES];
@ -154,7 +154,7 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
if ((self=[self init])) if ((self=[self init]))
{ {
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdisplaygroup",@"GSWDisplayGroup %p",self); NSDebugMLLog(@"GSWDisplayGroup",@"GSWDisplayGroup %p",self);
[self setNumberOfObjectsPerBatch: [self setNumberOfObjectsPerBatch:
[unarchiver decodeIntForKey:@"numberOfObjectsPerBatch"]]; [unarchiver decodeIntForKey:@"numberOfObjectsPerBatch"]];
[self setFetchesOnLoad: [self setFetchesOnLoad:
@ -180,7 +180,7 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
[self setQueryOperator:[unarchiver decodeObjectForKey:@"queryOperator"]]; [self setQueryOperator:[unarchiver decodeObjectForKey:@"queryOperator"]];
[self setQueryKeyValueQualifierClassName:[unarchiver decodeObjectForKey:@"queryKeyValueQualifierClassName"]]; [self setQueryKeyValueQualifierClassName:[unarchiver decodeObjectForKey:@"queryKeyValueQualifierClassName"]];
[self finishInitialization]; [self finishInitialization];
NSDebugMLLog(@"gswdisplaygroup",@"GSWDisplayGroup %p : %@",self,self); NSDebugMLLog(@"GSWDisplayGroup",@"GSWDisplayGroup %p : %@",self,self);
LOGObjectFnStop(); LOGObjectFnStop();
}; };
return self; return self;
@ -198,7 +198,7 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
{ {
NSString* dscr=nil; NSString* dscr=nil;
GSWLogAssertGood(self); GSWLogAssertGood(self);
NSDebugMLLog(@"gswdisplaygroup",@"GSWDisplayGroup description Self=%p",self); NSDebugMLLog(@"GSWDisplayGroup",@"GSWDisplayGroup description Self=%p",self);
dscr=[NSString stringWithFormat:@"<%s %p - \n", dscr=[NSString stringWithFormat:@"<%s %p - \n",
object_get_class_name(self), object_get_class_name(self),
(void*)self]; (void*)self];
@ -705,26 +705,26 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
+(NSString*)globalDefaultStringMatchOperator +(NSString*)globalDefaultStringMatchOperator
{ {
NSDebugMLLog(@"gswdisplaygroup",@"globalDefaultStringMatchOperator=%@",globalDefaultStringMatchOperator); NSDebugMLLog(@"GSWDisplayGroup",@"globalDefaultStringMatchOperator=%@",globalDefaultStringMatchOperator);
return globalDefaultStringMatchOperator; return globalDefaultStringMatchOperator;
} }
+(void)setGlobalDefaultStringMatchOperator:(NSString*)operatorString +(void)setGlobalDefaultStringMatchOperator:(NSString*)operatorString
{ {
ASSIGN(globalDefaultStringMatchOperator,operatorString); ASSIGN(globalDefaultStringMatchOperator,operatorString);
NSDebugMLLog(@"gswdisplaygroup",@"globalDefaultStringMatchOperator=%@",globalDefaultStringMatchOperator); NSDebugMLLog(@"GSWDisplayGroup",@"globalDefaultStringMatchOperator=%@",globalDefaultStringMatchOperator);
} }
+(NSString*)globalDefaultStringMatchFormat +(NSString*)globalDefaultStringMatchFormat
{ {
NSDebugMLLog(@"gswdisplaygroup",@"globalDefaultStringMatchFormat=%@",globalDefaultStringMatchFormat); NSDebugMLLog(@"GSWDisplayGroup",@"globalDefaultStringMatchFormat=%@",globalDefaultStringMatchFormat);
return globalDefaultStringMatchFormat; return globalDefaultStringMatchFormat;
} }
+(void)setGlobalDefaultStringMatchFormat:(NSString*)format +(void)setGlobalDefaultStringMatchFormat:(NSString*)format
{ {
ASSIGN(globalDefaultStringMatchFormat,format); ASSIGN(globalDefaultStringMatchFormat,format);
NSDebugMLLog(@"gswdisplaygroup",@"globalDefaultStringMatchFormat=%@",globalDefaultStringMatchFormat); NSDebugMLLog(@"GSWDisplayGroup",@"globalDefaultStringMatchFormat=%@",globalDefaultStringMatchFormat);
} }
+(BOOL)globalDefaultForValidatesChangesImmediately +(BOOL)globalDefaultForValidatesChangesImmediately
@ -841,7 +841,7 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
- (NSString *)defaultStringMatchFormat - (NSString *)defaultStringMatchFormat
{ {
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat); NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat);
return _defaultStringMatchFormat; return _defaultStringMatchFormat;
} }
@ -850,7 +850,7 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
- (NSString *)defaultStringMatchOperator - (NSString *)defaultStringMatchOperator
{ {
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchOperator=%@",_defaultStringMatchOperator); NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchOperator=%@",_defaultStringMatchOperator);
return _defaultStringMatchOperator; return _defaultStringMatchOperator;
} }
@ -995,8 +995,8 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
GSWLogAssertGood(_displayedObjects); GSWLogAssertGood(_displayedObjects);
displayedObjectsCount = [_displayedObjects count]; displayedObjectsCount = [_displayedObjects count];
NSDebugMLLog(@"gswdisplaygroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch); NSDebugMLLog(@"GSWDisplayGroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch);
NSDebugMLLog(@"gswdisplaygroup",@"displayedObjectsCount=%d",displayedObjectsCount); NSDebugMLLog(@"GSWDisplayGroup",@"displayedObjectsCount=%d",displayedObjectsCount);
if (_numberOfObjectsPerBatch == 0 || _numberOfObjectsPerBatch>=displayedObjectsCount) if (_numberOfObjectsPerBatch == 0 || _numberOfObjectsPerBatch>=displayedObjectsCount)
displayedObjects=_displayedObjects; displayedObjects=_displayedObjects;
@ -1004,12 +1004,12 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
{ {
int currentBatchIndex = [self currentBatchIndex]; int currentBatchIndex = [self currentBatchIndex];
int startIndex=(currentBatchIndex - 1) * _numberOfObjectsPerBatch; int startIndex=(currentBatchIndex - 1) * _numberOfObjectsPerBatch;
NSDebugMLLog(@"gswdisplaygroup",@"currentBatchIndex=%d",currentBatchIndex); NSDebugMLLog(@"GSWDisplayGroup",@"currentBatchIndex=%d",currentBatchIndex);
NSDebugMLLog(@"gswdisplaygroup",@"startIndex=%d",startIndex); NSDebugMLLog(@"GSWDisplayGroup",@"startIndex=%d",startIndex);
if( displayedObjectsCount > (currentBatchIndex * _numberOfObjectsPerBatch)) if( displayedObjectsCount > (currentBatchIndex * _numberOfObjectsPerBatch))
displayedObjectsCount = currentBatchIndex * _numberOfObjectsPerBatch; displayedObjectsCount = currentBatchIndex * _numberOfObjectsPerBatch;
NSDebugMLLog(@"gswdisplaygroup",@"displayedObjectsCount=%d",displayedObjectsCount); NSDebugMLLog(@"GSWDisplayGroup",@"displayedObjectsCount=%d",displayedObjectsCount);
displayedObjects=[_displayedObjects subarrayWithRange:NSMakeRange(startIndex,displayedObjectsCount-startIndex)]; displayedObjects=[_displayedObjects subarrayWithRange:NSMakeRange(startIndex,displayedObjectsCount-startIndex)];
}; };
@ -1032,6 +1032,24 @@ of all Batches, not only the current one.
return _displayedObjects; return _displayedObjects;
}; };
//--------------------------------------------------------------------
// displayFirstBatch
- (id)displayFirstBatch
{
LOGObjectFnStart();
NSDebugMLLog(@"GSWDisplayGroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch);
if (_numberOfObjectsPerBatch>0)
{
[self setCurrentBatchIndex:1];
[self clearSelection];
};
LOGObjectFnStop();
return nil;//return nil for direct .gswd actions ==> same page
}
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// displayNextBatch // displayNextBatch
@ -1039,7 +1057,7 @@ of all Batches, not only the current one.
{ {
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdisplaygroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch); NSDebugMLLog(@"GSWDisplayGroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch);
if (_numberOfObjectsPerBatch>0) if (_numberOfObjectsPerBatch>0)
{ {
[self setCurrentBatchIndex:_batchIndex+1]; [self setCurrentBatchIndex:_batchIndex+1];
@ -1067,6 +1085,104 @@ of all Batches, not only the current one.
return nil;//return nil for direct .gswd actions ==> same page return nil;//return nil for direct .gswd actions ==> same page
} }
//--------------------------------------------------------------------
// displayLastBatch
- (id)displayLastBatch
{
LOGObjectFnStart();
NSDebugMLLog(@"GSWDisplayGroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch);
if (_numberOfObjectsPerBatch>0)
{
int batchCount=0;
batchCount=[self batchCount];
[self setCurrentBatchIndex:batchCount];
[self clearSelection];
};
LOGObjectFnStop();
return nil;//return nil for direct .gswd actions ==> same page
}
//--------------------------------------------------------------------
/** Returns YES if batchCount>0 and current batch index>1 **/
- (BOOL)canDisplayFirstBatch
{
BOOL canDisplayFirstBatch=NO;
LOGObjectFnStart();
if(_numberOfObjectsPerBatch>0)
{
NSDebugMLLog(@"GSWDisplayGroup",@"batchIndex=%d",_batchIndex);
canDisplayFirstBatch=(_batchIndex>1);
};
LOGObjectFnStop();
return canDisplayFirstBatch;
};
//--------------------------------------------------------------------
/** Returns YES if batchCount>0 and current batch index < batch count **/
- (BOOL)canDisplayNextBatch
{
BOOL canDisplayNextBatch=NO;
LOGObjectFnStart();
if(_numberOfObjectsPerBatch>0)
{
int batchCount=[self batchCount];
NSDebugMLLog(@"GSWDisplayGroup",@"batchIndex=%d batchCount=%d",_batchIndex,batchCount);
canDisplayNextBatch=(_batchIndex<batchCount);
};
LOGObjectFnStop();
return canDisplayNextBatch;
};
//--------------------------------------------------------------------
/** Returns YES if batchCount>0 and current batch index > 1 **/
- (BOOL)canDisplayPreviousBatch
{
BOOL canDisplayPreviousBatch=NO;
LOGObjectFnStart();
if(_numberOfObjectsPerBatch>0)
{
NSDebugMLLog(@"GSWDisplayGroup",@"batchIndex=%d",_batchIndex);
canDisplayPreviousBatch=(_batchIndex>1);
};
LOGObjectFnStop();
return canDisplayPreviousBatch;
};
//--------------------------------------------------------------------
/** Returns YES if batchCount>0 and current batch index < batch count **/
- (BOOL)canDisplayLastBatch
{
BOOL canDisplayLastBatch=NO;
LOGObjectFnStart();
if(_numberOfObjectsPerBatch>0)
{
int batchCount=[self batchCount];
NSDebugMLLog(@"GSWDisplayGroup",@"batchIndex=%d batchCount=%d",_batchIndex,batchCount);
canDisplayLastBatch=(_batchIndex<batchCount);
};
LOGObjectFnStop();
return canDisplayLastBatch;
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// endEditing // endEditing
// deprecatd // deprecatd
@ -1266,7 +1382,7 @@ of all Batches, not only the current one.
- (id)insertAfterLastObject - (id)insertAfterLastObject
{ {
int index= [_allObjects count]; int index= [_displayedObjects count];
return [self insertObjectAtIndex:index]; return [self insertObjectAtIndex:index];
} }
@ -1368,9 +1484,9 @@ of all Batches, not only the current one.
if ([self endEditing]) if ([self endEditing])
{ {
NSDebugMLLog(@"gswdisplaygroup",@"Will [_dataSource createObject]"); NSDebugMLLog(@"GSWDisplayGroup",@"Will [_dataSource createObject]");
object = [_dataSource createObject]; object = [_dataSource createObject];
NSDebugMLLog(@"gswdisplaygroup",@"End [_dataSource createObject]. Object %p=%@", NSDebugMLLog(@"GSWDisplayGroup",@"End [_dataSource createObject]. Object %p=%@",
object,object); object,object);
if (!object) if (!object)
{ {
@ -1384,10 +1500,10 @@ of all Batches, not only the current one.
else else
{ {
[object takeValuesFromDictionary:[self insertedObjectDefaultValues]]; [object takeValuesFromDictionary:[self insertedObjectDefaultValues]];
NSDebugMLLog(@"gswdisplaygroup",@"Will insertObject:AtIndex:"); NSDebugMLLog(@"GSWDisplayGroup",@"Will insertObject:AtIndex:");
[self insertObject:object [self insertObject:object
atIndex:index]; atIndex:index];
NSDebugMLLog(@"gswdisplaygroup",@"End insertObject:AtIndex:"); NSDebugMLLog(@"GSWDisplayGroup",@"End insertObject:AtIndex:");
}; };
}; };
LOGObjectFnStop(); LOGObjectFnStop();
@ -1494,19 +1610,19 @@ of all Batches, not only the current one.
EOQualifier* resultQualifier=nil; EOQualifier* resultQualifier=nil;
NSMutableArray *array=nil; NSMutableArray *array=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdisplaygroup",@"_queryMatch=%@", NSDebugMLLog(@"GSWDisplayGroup",@"_queryMatch=%@",
_queryMatch); _queryMatch);
NSDebugMLLog(@"gswdisplaygroup",@"_queryNotMatch=%@", NSDebugMLLog(@"GSWDisplayGroup",@"_queryNotMatch=%@",
_queryNotMatch); _queryNotMatch);
NSDebugMLLog(@"gswdisplaygroup",@"_queryMin=%@", NSDebugMLLog(@"GSWDisplayGroup",@"_queryMin=%@",
_queryMin); _queryMin);
NSDebugMLLog(@"gswdisplaygroup",@"_queryMax=%@", NSDebugMLLog(@"GSWDisplayGroup",@"_queryMax=%@",
_queryMax); _queryMax);
NSDebugMLLog(@"gswdisplaygroup",@"_queryMinMatch=%@", NSDebugMLLog(@"GSWDisplayGroup",@"_queryMinMatch=%@",
_queryMinMatch); _queryMinMatch);
NSDebugMLLog(@"gswdisplaygroup",@"_queryMaxMatch=%@", NSDebugMLLog(@"GSWDisplayGroup",@"_queryMaxMatch=%@",
_queryMaxMatch); _queryMaxMatch);
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchOperator=%@ EOQualifier sel:%p", NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchOperator=%@ EOQualifier sel:%p",
_defaultStringMatchOperator, _defaultStringMatchOperator,
(void*)[EOQualifier operatorSelectorForString:_defaultStringMatchOperator]); (void*)[EOQualifier operatorSelectorForString:_defaultStringMatchOperator]);
@ -1533,12 +1649,12 @@ of all Batches, not only the current one.
if (_auxiliaryQueryQualifier) if (_auxiliaryQueryQualifier)
[array addObject:_auxiliaryQueryQualifier]; [array addObject:_auxiliaryQueryQualifier];
NSDebugMLLog(@"gswdisplaygroup",@"array=%@",array); NSDebugMLLog(@"GSWDisplayGroup",@"array=%@",array);
if ([array count]==1) if ([array count]==1)
resultQualifier=[array objectAtIndex:0]; resultQualifier=[array objectAtIndex:0];
else if ([array count]>1) else if ([array count]>1)
resultQualifier=[[[EOAndQualifier alloc] initWithQualifierArray:array] autorelease]; resultQualifier=[[[EOAndQualifier alloc] initWithQualifierArray:array] autorelease];
NSDebugMLLog(@"gswdisplaygroup",@"resultQualifier=%@",resultQualifier); NSDebugMLLog(@"GSWDisplayGroup",@"resultQualifier=%@",resultQualifier);
LOGObjectFnStop(); LOGObjectFnStop();
return resultQualifier; return resultQualifier;
} }
@ -1561,9 +1677,9 @@ of all Batches, not only the current one.
[self setInQueryMode:NO]; [self setInQueryMode:NO];
qualifier=[self qualifierFromQueryValues]; qualifier=[self qualifierFromQueryValues];
NSDebugMLLog(@"gswdisplaygroup",@"qualifier=%@",qualifier); NSDebugMLLog(@"GSWDisplayGroup",@"qualifier=%@",qualifier);
NSDebugMLLog(@"gswdisplaygroup",@"_dataSource=%@",_dataSource); NSDebugMLLog(@"GSWDisplayGroup",@"_dataSource=%@",_dataSource);
if (_flags.isCustomDataSourceClass) if (_flags.isCustomDataSourceClass)
{ {
if ([_dataSource respondsToSelector:@selector(setAuxiliaryQualifier:)]) if ([_dataSource respondsToSelector:@selector(setAuxiliaryQualifier:)])
@ -1601,7 +1717,7 @@ of all Batches, not only the current one.
LOGObjectFnStart(); LOGObjectFnStart();
[self setInQueryMode:NO]; [self setInQueryMode:NO];
qualifier=[self qualifierFromQueryValues]; qualifier=[self qualifierFromQueryValues];
NSDebugMLLog(@"gswdisplaygroup",@"qualifier=%@",qualifier); NSDebugMLLog(@"GSWDisplayGroup",@"qualifier=%@",qualifier);
[self setQualifier:qualifier]; [self setQualifier:qualifier];
NSDebugMLLog0(@"gswdisplaygroup",@"updateDisplayedObjects"); NSDebugMLLog0(@"gswdisplaygroup",@"updateDisplayedObjects");
@ -1717,10 +1833,10 @@ of all Batches, not only the current one.
{ {
id obj=nil; id obj=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdisplaygroup",@"_selectedObjects count=%d",[_selectedObjects count]); NSDebugMLLog(@"GSWDisplayGroup",@"_selectedObjects count=%d",[_selectedObjects count]);
if([_selectedObjects count]>0) if([_selectedObjects count]>0)
obj=[_selectedObjects objectAtIndex:0]; obj=[_selectedObjects objectAtIndex:0];
NSDebugMLLog(@"gswdisplaygroup",@"selectedObject=%@",obj); NSDebugMLLog(@"GSWDisplayGroup",@"selectedObject=%@",obj);
LOGObjectFnStop(); LOGObjectFnStop();
return obj; return obj;
@ -1836,19 +1952,19 @@ of all Batches, not only the current one.
GSWLogAssertGood(_displayedObjects); GSWLogAssertGood(_displayedObjects);
GSWLogAssertGood(objects); GSWLogAssertGood(objects);
NSDebugMLLog(@"gswdisplaygroup",@"_displayedObjects count]=%d",[_displayedObjects count]); NSDebugMLLog(@"GSWDisplayGroup",@"_displayedObjects count]=%d",[_displayedObjects count]);
NSDebugMLLog(@"gswdisplaygroup",@"objects count]=%d",[objects count]); NSDebugMLLog(@"GSWDisplayGroup",@"objects count]=%d",[objects count]);
selectionIndexes = [_displayedObjects indexesOfObjectsIdenticalTo:objects]; selectionIndexes = [_displayedObjects indexesOfObjectsIdenticalTo:objects];
NSDebugMLLog(@"gswdisplaygroup",@"selectionIndexes count]=%d",[selectionIndexes count]); NSDebugMLLog(@"GSWDisplayGroup",@"selectionIndexes count]=%d",[selectionIndexes count]);
if ([selectionIndexes count]==0) if ([selectionIndexes count]==0)
{ {
if (selectFirstOnNoMatch && [_displayedObjects count]>0) if (selectFirstOnNoMatch && [_displayedObjects count]>0)
selectionIndexes=[NSArray arrayWithObject:[NSNumber numberWithInt:0]]; selectionIndexes=[NSArray arrayWithObject:[NSNumber numberWithInt:0]];
}; };
NSDebugMLLog(@"gswdisplaygroup",@"selectionIndexes count]=%d",[selectionIndexes count]); NSDebugMLLog(@"GSWDisplayGroup",@"selectionIndexes count]=%d",[selectionIndexes count]);
result = [self setSelectionIndexes:selectionIndexes]; result = [self setSelectionIndexes:selectionIndexes];
NSDebugMLLog(@"gswdisplaygroup",@"selectionIndexes count]=%d",[selectionIndexes count]); NSDebugMLLog(@"GSWDisplayGroup",@"selectionIndexes count]=%d",[selectionIndexes count]);
LOGObjectFnStop(); LOGObjectFnStop();
return result; return result;
@ -1907,19 +2023,19 @@ of all Batches, not only the current one.
{ {
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdisplaygroup",@"index=%d",index); NSDebugMLLog(@"GSWDisplayGroup",@"index=%d",index);
NSDebugMLLog(@"gswdisplaygroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch); NSDebugMLLog(@"GSWDisplayGroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch);
if(_numberOfObjectsPerBatch>0) if(_numberOfObjectsPerBatch>0)
{ {
int batchCount=[self batchCount]; int batchCount=[self batchCount];
NSDebugMLLog(@"gswdisplaygroup",@"batchCount=%d",batchCount); NSDebugMLLog(@"GSWDisplayGroup",@"batchCount=%d",batchCount);
if (index<1) if (index<1)
_batchIndex=(batchCount>0 ? batchCount : 1); _batchIndex=(batchCount>0 ? batchCount : 1);
else if (index>batchCount) else if (index>batchCount)
_batchIndex=1; _batchIndex=1;
else else
_batchIndex=index; _batchIndex=index;
NSDebugMLLog(@"gswdisplaygroup",@"_batchIndex=%d",_batchIndex); NSDebugMLLog(@"GSWDisplayGroup",@"_batchIndex=%d",_batchIndex);
}; };
LOGObjectFnStop(); LOGObjectFnStop();
} }
@ -1961,7 +2077,7 @@ of all Batches, not only the current one.
{ {
ASSIGN(_defaultStringMatchFormat, format); ASSIGN(_defaultStringMatchFormat, format);
}; };
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat); NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat);
LOGObjectFnStop(); LOGObjectFnStop();
} }
@ -1972,7 +2088,7 @@ of all Batches, not only the current one.
{ {
LOGObjectFnStart(); LOGObjectFnStart();
ASSIGN(_defaultStringMatchOperator, operator); ASSIGN(_defaultStringMatchOperator, operator);
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchOperator=%@",_defaultStringMatchOperator); NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchOperator=%@",_defaultStringMatchOperator);
LOGObjectFnStop(); LOGObjectFnStop();
} }
@ -2095,17 +2211,17 @@ of all Batches, not only the current one.
{ {
EODetailDataSource *source=nil; EODetailDataSource *source=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdisplaygroup",@"masterObject=%@",masterObject); NSDebugMLLog(@"GSWDisplayGroup",@"masterObject=%@",masterObject);
if([self hasDetailDataSource] == YES) if([self hasDetailDataSource] == YES)
{ {
source = (EODetailDataSource *)_dataSource; source = (EODetailDataSource *)_dataSource;
NSDebugMLLog(@"gswdisplaygroup",@"source=%@",source); NSDebugMLLog(@"GSWDisplayGroup",@"source=%@",source);
NSDebugMLLog(@"gswdisplaygroup",@"[source detailKey]=%@",[source detailKey]); NSDebugMLLog(@"GSWDisplayGroup",@"[source detailKey]=%@",[source detailKey]);
[_dataSource qualifyWithRelationshipKey:[source detailKey] [_dataSource qualifyWithRelationshipKey:[source detailKey]
ofObject:masterObject]; ofObject:masterObject];
if ([self fetchesOnLoad]) if ([self fetchesOnLoad])
{ {
NSDebugMLLog(@"gswdisplaygroup",@"will fetch"); NSDebugMLLog(@"GSWDisplayGroup",@"will fetch");
[self fetch]; [self fetch];
}; };
}; };
@ -2142,9 +2258,9 @@ of all Batches, not only the current one.
RETAIN(selectedObjects); RETAIN(selectedObjects);
AUTORELEASE(selectedObjects); AUTORELEASE(selectedObjects);
GSWLogAssertGood(selectedObjects); GSWLogAssertGood(selectedObjects);
NSDebugMLLog(@"gswdisplaygroup",@"selectedObjects count]=%d",[selectedObjects count]); NSDebugMLLog(@"GSWDisplayGroup",@"selectedObjects count]=%d",[selectedObjects count]);
NSDebugMLLog(@"gswdisplaygroup",@"_allObjects count]=%d",[_allObjects count]); NSDebugMLLog(@"GSWDisplayGroup",@"_allObjects count]=%d",[_allObjects count]);
NSDebugMLLog(@"gswdisplaygroup",@"objects count]=%d",[objects count]); NSDebugMLLog(@"GSWDisplayGroup",@"objects count]=%d",[objects count]);
if (objects) if (objects)
ASSIGN(_allObjects,[NSMutableArray arrayWithArray:objects]); ASSIGN(_allObjects,[NSMutableArray arrayWithArray:objects]);
@ -2152,14 +2268,14 @@ of all Batches, not only the current one.
ASSIGN(_allObjects,[NSMutableArray array]); ASSIGN(_allObjects,[NSMutableArray array]);
GSWLogAssertGood(selectedObjects); GSWLogAssertGood(selectedObjects);
GSWLogAssertGood(_allObjects); GSWLogAssertGood(_allObjects);
NSDebugMLLog(@"gswdisplaygroup",@"selectedObjects count]=%d",[selectedObjects count]); NSDebugMLLog(@"GSWDisplayGroup",@"selectedObjects count]=%d",[selectedObjects count]);
NSDebugMLLog(@"gswdisplaygroup",@"_allObjects count]=%d",[_allObjects count]); NSDebugMLLog(@"GSWDisplayGroup",@"_allObjects count]=%d",[_allObjects count]);
[self updateDisplayedObjects]; [self updateDisplayedObjects];
GSWLogAssertGood(selectedObjects); GSWLogAssertGood(selectedObjects);
GSWLogAssertGood(_allObjects); GSWLogAssertGood(_allObjects);
NSDebugMLLog(@"gswdisplaygroup",@"selectedObjects count]=%d",[selectedObjects count]); NSDebugMLLog(@"GSWDisplayGroup",@"selectedObjects count]=%d",[selectedObjects count]);
NSDebugMLLog(@"gswdisplaygroup",@"_allObjects count]=%d",[_allObjects count]); NSDebugMLLog(@"GSWDisplayGroup",@"_allObjects count]=%d",[_allObjects count]);
[self selectObjectsIdenticalTo:selectedObjects [self selectObjectsIdenticalTo:selectedObjects
selectFirstOnNoMatch:[self selectsFirstObjectAfterFetch]]; selectFirstOnNoMatch:[self selectsFirstObjectAfterFetch]];
@ -2232,9 +2348,9 @@ of all Batches, not only the current one.
LOGObjectFnStart(); LOGObjectFnStart();
GSWLogAssertGood(selection); GSWLogAssertGood(selection);
NSDebugMLLog(@"gswdisplaygroup",@"selection count]=%d",[selection count]); NSDebugMLLog(@"GSWDisplayGroup",@"selection count]=%d",[selection count]);
GSWLogAssertGood(_displayedObjects); GSWLogAssertGood(_displayedObjects);
NSDebugMLLog(@"gswdisplaygroup",@"_displayedObjects count]=%d",[_displayedObjects count]); NSDebugMLLog(@"GSWDisplayGroup",@"_displayedObjects count]=%d",[_displayedObjects count]);
if([selection count]>1) if([selection count]>1)
{ {
sortedSelection = [selection sortedArrayUsingSelector:@selector(compare:)]; sortedSelection = [selection sortedArrayUsingSelector:@selector(compare:)];
@ -2243,10 +2359,10 @@ of all Batches, not only the current one.
sortedSelection = [NSArray arrayWithArray:selection]; sortedSelection = [NSArray arrayWithArray:selection];
else else
sortedSelection = [NSArray array]; sortedSelection = [NSArray array];
NSDebugMLLog(@"gswdisplaygroup",@"sortedSelection count]=%d",[sortedSelection count]); NSDebugMLLog(@"GSWDisplayGroup",@"sortedSelection count]=%d",[sortedSelection count]);
selectedObjects = [[[_displayedObjects objectsAtIndexes:sortedSelection] mutableCopy]autorelease]; selectedObjects = [[[_displayedObjects objectsAtIndexes:sortedSelection] mutableCopy]autorelease];
NSDebugMLLog(@"gswdisplaygroup",@"selectedObjects count]=%d",[selectedObjects count]); NSDebugMLLog(@"GSWDisplayGroup",@"selectedObjects count]=%d",[selectedObjects count]);
isSelectedObjectsChanged = ![selectedObjects isEqual:_selectedObjects]; isSelectedObjectsChanged = ![selectedObjects isEqual:_selectedObjects];
isSelectionChanged = ![sortedSelection isEqual:_selection]; isSelectionChanged = ![sortedSelection isEqual:_selection];
if (!isSelectionChanged && !isSelectedObjectsChanged) if (!isSelectionChanged && !isSelectedObjectsChanged)
@ -2276,7 +2392,7 @@ of all Batches, not only the current one.
}; };
}; };
}; };
NSDebugMLLog(@"gswdisplaygroup",@"_selection count]=%d",[_selection count]); NSDebugMLLog(@"GSWDisplayGroup",@"_selection count]=%d",[_selection count]);
LOGObjectFnStop(); LOGObjectFnStop();
@ -2333,13 +2449,13 @@ of all Batches, not only the current one.
NSArray* newDisplayedObjects = nil; NSArray* newDisplayedObjects = nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdisplaygroup",@"START updateDisplayedObjects"); NSDebugMLLog(@"GSWDisplayGroup",@"START updateDisplayedObjects");
selectedObjects = (NSMutableArray*)[self selectedObjects]; selectedObjects = (NSMutableArray*)[self selectedObjects];
GSWLogAssertGood(selectedObjects); GSWLogAssertGood(selectedObjects);
newDisplayedObjects = _allObjects; newDisplayedObjects = _allObjects;
GSWLogAssertGood(newDisplayedObjects); GSWLogAssertGood(newDisplayedObjects);
NSDebugMLLog(@"gswdisplaygroup",@"[newDisplayedObjects count]=%d", NSDebugMLLog(@"GSWDisplayGroup",@"[newDisplayedObjects count]=%d",
[newDisplayedObjects count]); [newDisplayedObjects count]);
// Let's delegate doing the job ? // Let's delegate doing the job ?
@ -2350,35 +2466,35 @@ of all Batches, not only the current one.
} }
else else
{ {
NSDebugMLLog(@"gswdisplaygroup",@"_qualifier=%d", NSDebugMLLog(@"GSWDisplayGroup",@"_qualifier=%d",
_qualifier); _qualifier);
// Filter ? // Filter ?
if (_qualifier) if (_qualifier)
{ {
newDisplayedObjects=[newDisplayedObjects newDisplayedObjects=[newDisplayedObjects
filteredArrayUsingQualifier:_qualifier]; filteredArrayUsingQualifier:_qualifier];
NSDebugMLLog(@"gswdisplaygroup",@"[newDisplayedObjects count]=%d", NSDebugMLLog(@"GSWDisplayGroup",@"[newDisplayedObjects count]=%d",
[newDisplayedObjects count]); [newDisplayedObjects count]);
}; };
NSDebugMLLog(@"gswdisplaygroup",@"_sortOrdering=%d", NSDebugMLLog(@"GSWDisplayGroup",@"_sortOrdering=%d",
_sortOrdering); _sortOrdering);
// Sort ? // Sort ?
if (_sortOrdering) if (_sortOrdering)
{ {
newDisplayedObjects=[newDisplayedObjects newDisplayedObjects=[newDisplayedObjects
sortedArrayUsingKeyOrderArray:_sortOrdering]; sortedArrayUsingKeyOrderArray:_sortOrdering];
NSDebugMLLog(@"gswdisplaygroup",@"[newDisplayedObjects count]=%d", NSDebugMLLog(@"GSWDisplayGroup",@"[newDisplayedObjects count]=%d",
[newDisplayedObjects count]); [newDisplayedObjects count]);
}; };
}; };
ASSIGN(_displayedObjects,([NSMutableArray arrayWithArray:newDisplayedObjects])); ASSIGN(_displayedObjects,([NSMutableArray arrayWithArray:newDisplayedObjects]));
NSDebugMLLog(@"gswdisplaygroup",@"[_displayedObjects count]=%d", NSDebugMLLog(@"GSWDisplayGroup",@"[_displayedObjects count]=%d",
[_displayedObjects count]); [_displayedObjects count]);
[self selectObjectsIdenticalTo:selectedObjects [self selectObjectsIdenticalTo:selectedObjects
selectFirstOnNoMatch:NO]; selectFirstOnNoMatch:NO];
[self redisplay]; [self redisplay];
NSDebugMLLog(@"gswdisplaygroup",@"STOP updateDisplayedObjects"); NSDebugMLLog(@"GSWDisplayGroup",@"STOP updateDisplayedObjects");
/* /*
NSEnumerator *objsEnum=nil; NSEnumerator *objsEnum=nil;
id object=nil; id object=nil;
@ -2414,7 +2530,7 @@ of all Batches, not only the current one.
[self displayNextBatch]; [self displayNextBatch];
} }
NSDebugMLLog(@"gswdisplaygroup",@"_sortOrdering=%@",_sortOrdering); NSDebugMLLog(@"GSWDisplayGroup",@"_sortOrdering=%@",_sortOrdering);
if(_sortOrdering) if(_sortOrdering)
[_displayedObjects sortUsingKeyOrderArray:_sortOrdering]; [_displayedObjects sortUsingKeyOrderArray:_sortOrdering];
}; };
@ -2525,9 +2641,9 @@ of all Batches, not only the current one.
NSEnumerator *enumerator=nil; NSEnumerator *enumerator=nil;
NSString *key=nil; NSString *key=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdisplaygroup",@"array=%@",array); NSDebugMLLog(@"GSWDisplayGroup",@"array=%@",array);
NSDebugMLLog(@"gswdisplaygroup",@"values=%@",values); NSDebugMLLog(@"GSWDisplayGroup",@"values=%@",values);
NSDebugMLLog(@"gswdisplaygroup",@"operatorSelector=%p: %@", NSDebugMLLog(@"GSWDisplayGroup",@"operatorSelector=%p: %@",
(void*)sel, (void*)sel,
NSStringFromSelector(sel)); NSStringFromSelector(sel));
enumerator = [values keyEnumerator]; enumerator = [values keyEnumerator];
@ -2535,15 +2651,15 @@ of all Batches, not only the current one.
{ {
EOQualifier* qualifier=nil; EOQualifier* qualifier=nil;
id value=[values objectForKey:key]; id value=[values objectForKey:key];
NSDebugMLLog(@"gswdisplaygroup",@"key=%@ value=%@",key,value); NSDebugMLLog(@"GSWDisplayGroup",@"key=%@ value=%@",key,value);
qualifier=[self _qualifierForKey:key qualifier=[self _qualifierForKey:key
value:value value:value
operatorSelector:sel]; operatorSelector:sel];
NSDebugMLLog(@"gswdisplaygroup",@"qualifier=%@",qualifier); NSDebugMLLog(@"GSWDisplayGroup",@"qualifier=%@",qualifier);
if (qualifier) if (qualifier)
[array addObject:qualifier]; [array addObject:qualifier];
}; };
NSDebugMLLog(@"gswdisplaygroup",@"array=%@",array); NSDebugMLLog(@"GSWDisplayGroup",@"array=%@",array);
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -2557,8 +2673,8 @@ of all Batches, not only the current one.
NSException* validateException=nil; NSException* validateException=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdisplaygroup",@"value=%@",value); NSDebugMLLog(@"GSWDisplayGroup",@"value=%@",value);
NSDebugMLLog(@"gswdisplaygroup",@"operatorSelector=%p: %@", NSDebugMLLog(@"GSWDisplayGroup",@"operatorSelector=%p: %@",
(void*)operatorSelector, (void*)operatorSelector,
NSStringFromSelector(operatorSelector)); NSStringFromSelector(operatorSelector));
@ -2568,7 +2684,7 @@ of all Batches, not only the current one.
// Validate the value against object class description // Validate the value against object class description
validateException=[cd validateValue:&value validateException=[cd validateValue:&value
forKey:key]; forKey:key];
NSDebugMLLog(@"gswdisplaygroup",@"validateException=%@",validateException); NSDebugMLLog(@"GSWDisplayGroup",@"validateException=%@",validateException);
if (validateException) if (validateException)
{ {
@ -2578,9 +2694,9 @@ of all Batches, not only the current one.
{ {
NSString* qualifierClassName=[_queryKeyValueQualifierClassName objectForKey:key]; NSString* qualifierClassName=[_queryKeyValueQualifierClassName objectForKey:key];
Class qualifierClass=Nil; Class qualifierClass=Nil;
NSDebugMLLog(@"gswdisplaygroup",@"key=%@",key); NSDebugMLLog(@"GSWDisplayGroup",@"key=%@",key);
NSDebugMLLog(@"gswdisplaygroup",@"_queryKeyValueQualifierClassName=%@",_queryKeyValueQualifierClassName); NSDebugMLLog(@"GSWDisplayGroup",@"_queryKeyValueQualifierClassName=%@",_queryKeyValueQualifierClassName);
NSDebugMLLog(@"gswdisplaygroup",@"qualifierClassName=%@",qualifierClassName); NSDebugMLLog(@"GSWDisplayGroup",@"qualifierClassName=%@",qualifierClassName);
if ([qualifierClassName length]>0) if ([qualifierClassName length]>0)
{ {
qualifierClass=NSClassFromString(qualifierClassName); qualifierClass=NSClassFromString(qualifierClassName);
@ -2591,10 +2707,10 @@ of all Batches, not only the current one.
} }
else else
qualifierClass=[EOKeyValueQualifier class]; qualifierClass=[EOKeyValueQualifier class];
NSDebugMLLog(@"gswdisplaygroup",@"operatorSelector=%p: %@", NSDebugMLLog(@"GSWDisplayGroup",@"operatorSelector=%p: %@",
(void*)operatorSelector, (void*)operatorSelector,
NSStringFromSelector(operatorSelector)); NSStringFromSelector(operatorSelector));
NSDebugMLLog(@"gswdisplaygroup",@"EOQualifierOperatorEqual=%p: %@", NSDebugMLLog(@"GSWDisplayGroup",@"EOQualifierOperatorEqual=%p: %@",
(void*)EOQualifierOperatorEqual, (void*)EOQualifierOperatorEqual,
NSStringFromSelector(EOQualifierOperatorEqual)); NSStringFromSelector(EOQualifierOperatorEqual));
@ -2603,10 +2719,10 @@ of all Batches, not only the current one.
{ {
// Search if there's a specific defined operator for it // Search if there's a specific defined operator for it
NSString* operatorString=[_queryOperator objectForKey:key]; NSString* operatorString=[_queryOperator objectForKey:key];
NSDebugMLLog(@"gswdisplaygroup",@"key=%@",key); NSDebugMLLog(@"GSWDisplayGroup",@"key=%@",key);
NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator); NSDebugMLLog(@"GSWDisplayGroup",@"_queryOperator=%@",_queryOperator);
NSDebugMLLog(@"gswdisplaygroup",@"operatorString=%@",operatorString); NSDebugMLLog(@"GSWDisplayGroup",@"operatorString=%@",operatorString);
NSDebugMLLog(@"gswdisplaygroup",@"[value isKindOfClass:[NSString class]]=%d", NSDebugMLLog(@"GSWDisplayGroup",@"[value isKindOfClass:[NSString class]]=%d",
[value isKindOfClass:[NSString class]]); [value isKindOfClass:[NSString class]]);
// If value is a string, try to do handle string specific operators // If value is a string, try to do handle string specific operators
@ -2621,7 +2737,7 @@ of all Batches, not only the current one.
{ {
NSString* stringValue = (NSString*)value; NSString* stringValue = (NSString*)value;
// Other string operators don't care about empry string // Other string operators don't care about empry string
NSDebugMLLog(@"gswdisplaygroup",@"stringValue=%@",stringValue); NSDebugMLLog(@"GSWDisplayGroup",@"stringValue=%@",stringValue);
if ([stringValue length]==0) if ([stringValue length]==0)
{ {
// So ends here and we'll return a nil qualifier // So ends here and we'll return a nil qualifier
@ -2631,7 +2747,7 @@ of all Batches, not only the current one.
} }
else if ([operatorString length]==0) // ==> defaultStringMatchOperator with defaultStringMatchFormat else if ([operatorString length]==0) // ==> defaultStringMatchOperator with defaultStringMatchFormat
{ {
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat); NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat);
value=[NSString stringWithFormat:_defaultStringMatchFormat, value=[NSString stringWithFormat:_defaultStringMatchFormat,
value]; value];
operatorString = _defaultStringMatchOperator; operatorString = _defaultStringMatchOperator;
@ -2658,17 +2774,17 @@ of all Batches, not only the current one.
} }
else else
{ {
NSDebugMLLog(@"gswdisplaygroup",@"! string value"); NSDebugMLLog(@"GSWDisplayGroup",@"! string value");
if ([operatorString length]==0) if ([operatorString length]==0)
operatorString = @"="; operatorString = @"=";
}; };
NSDebugMLLog(@"gswdisplaygroup",@"operatorString=%@",operatorString); NSDebugMLLog(@"GSWDisplayGroup",@"operatorString=%@",operatorString);
operatorSelector = [qualifierClass operatorSelectorForString:operatorString]; operatorSelector = [qualifierClass operatorSelectorForString:operatorString];
NSDebugMLLog(@"gswdisplaygroup",@"operatorSelector=%p: %@", NSDebugMLLog(@"GSWDisplayGroup",@"operatorSelector=%p: %@",
(void*)operatorSelector, (void*)operatorSelector,
NSStringFromSelector(operatorSelector)); NSStringFromSelector(operatorSelector));
}; };
NSDebugMLLog(@"gswdisplaygroup",@"%@ %@ %@", NSDebugMLLog(@"GSWDisplayGroup",@"%@ %@ %@",
key, key,
NSStringFromSelector(operatorSelector), NSStringFromSelector(operatorSelector),
value); value);
@ -2680,7 +2796,7 @@ of all Batches, not only the current one.
initWithKey:key initWithKey:key
operatorSelector:operatorSelector operatorSelector:operatorSelector
value:value] autorelease]; value:value] autorelease];
NSDebugMLLog(@"gswdisplaygroup",@"qualifier=%@",qualifier); NSDebugMLLog(@"GSWDisplayGroup",@"qualifier=%@",qualifier);
} }
else else
{ {
@ -2689,7 +2805,7 @@ of all Batches, not only the current one.
}; };
}; };
}; };
NSDebugMLLog(@"gswdisplaygroup",@"qualifier=%@",qualifier); NSDebugMLLog(@"GSWDisplayGroup",@"qualifier=%@",qualifier);
return qualifier; return qualifier;
}; };
@ -2704,8 +2820,8 @@ of all Batches, not only the current one.
int selfCount=0; int selfCount=0;
GSWLogAssertGood(objects); GSWLogAssertGood(objects);
GSWLogAssertGood(self); GSWLogAssertGood(self);
NSDebugMLLog(@"gswdisplaygroup",@"objects count]=%d",[objects count]); NSDebugMLLog(@"GSWDisplayGroup",@"objects count]=%d",[objects count]);
NSDebugMLLog(@"gswdisplaygroup",@"self count]=%d",[self count]); NSDebugMLLog(@"GSWDisplayGroup",@"self count]=%d",[self count]);
selfCount=[self count]; selfCount=[self count];
if (selfCount>0) if (selfCount>0)
{ {
@ -2733,7 +2849,7 @@ of all Batches, not only the current one.
}; };
if (!indexes) if (!indexes)
indexes=[NSArray array]; indexes=[NSArray array];
NSDebugMLLog(@"gswdisplaygroup",@"indexes count]=%d",[indexes count]); NSDebugMLLog(@"GSWDisplayGroup",@"indexes count]=%d",[indexes count]);
return indexes; return indexes;
}; };
@ -2743,8 +2859,8 @@ of all Batches, not only the current one.
int selfCount=0; int selfCount=0;
GSWLogAssertGood(self); GSWLogAssertGood(self);
GSWLogAssertGood(indexes); GSWLogAssertGood(indexes);
NSDebugMLLog(@"gswdisplaygroup",@"indexes count]=%d",[indexes count]); NSDebugMLLog(@"GSWDisplayGroup",@"indexes count]=%d",[indexes count]);
NSDebugMLLog(@"gswdisplaygroup",@"self count]=%d",[self count]); NSDebugMLLog(@"GSWDisplayGroup",@"self count]=%d",[self count]);
selfCount=[self count]; selfCount=[self count];
if ([self count]>0) if ([self count]>0)
{ {
@ -2772,7 +2888,7 @@ of all Batches, not only the current one.
}; };
if (!objects) if (!objects)
objects=[NSArray array]; objects=[NSArray array];
NSDebugMLLog(@"gswdisplaygroup",@"objects count]=%d",[objects count]); NSDebugMLLog(@"GSWDisplayGroup",@"objects count]=%d",[objects count]);
return objects; return objects;
}; };
@end @end

View file

@ -1,9 +1,9 @@
/** GSWDynamicElement.h - <title>GSWeb: Class GSWDynamicElement</title> /** GSWDynamicElement.h - <title>GSWeb: Class GSWDynamicElement</title>
Copyright (C) 1999-2002 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
$Revision$ $Revision$
$Date$ $Date$
@ -45,6 +45,11 @@
//==================================================================== //====================================================================
@interface GSWDynamicElement (GSWDynamicElement) @interface GSWDynamicElement (GSWDynamicElement)
-(BOOL) evaluateCondition:(id)condition
inContext:(GSWContext*)context
noConditionAssociationDefault:(BOOL)noConditionAssociationDefault
noConditionDefault:(BOOL)noConditionDefault;
-(BOOL)evaluateCondition:(id)condition -(BOOL)evaluateCondition:(id)condition
inContext:(GSWContext*)context; inContext:(GSWContext*)context;
@end @end

View file

@ -1,6 +1,6 @@
/** GSWDynamicElement.m - <title>GSWeb: Class GSWDynamicElement</title> /** GSWDynamicElement.m - <title>GSWeb: Class GSWDynamicElement</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
@ -63,18 +63,22 @@ RCS_ID("$Id$")
} }
@end @end
//==================================================================== //====================================================================
@implementation GSWDynamicElement (GSWDynamicElement) @implementation GSWDynamicElement (GSWDynamicElement)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(BOOL)evaluateCondition:(id)condition -(BOOL) evaluateCondition:(id)condition
inContext:(GSWContext*)context inContext:(GSWContext*)context
noConditionAssociationDefault:(BOOL)noConditionAssociationDefault
noConditionDefault:(BOOL)noConditionDefault
{ {
//OK //OK
BOOL result=NO; BOOL result=noConditionAssociationDefault;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"gswdync",@"condition_=%@", NSDebugMLLog(@"gswdync",@"condition_=%@ noConditionAssociationDefault=%s noConditionDefault=%s",
condition); condition,(noConditionAssociationDefault ? "YES" : "NO"),
(noConditionDefault ? "YES" : "NO"));
if (condition) if (condition)
{ {
GSWComponent* component=[context component]; GSWComponent* component=[context component];
@ -86,10 +90,27 @@ RCS_ID("$Id$")
NSDebugMLLog(@"gswdync",@"unsignedCharValue=%d",(int)[value unsignedCharValue]); NSDebugMLLog(@"gswdync",@"unsignedCharValue=%d",(int)[value unsignedCharValue]);
}; };
#endif #endif
result=boolValueWithDefaultFor(value,YES); result=boolValueWithDefaultFor(value,noConditionDefault);
}; };
NSDebugMLLog(@"gswdync",@"result=%s", NSDebugMLLog(@"gswdync",@"condition_=%@ noConditionAssociationDefault=%s noConditionDefault=%s ==> result=%s",
(result ? "YES" : "NO")); condition,(noConditionAssociationDefault ? "YES" : "NO"),
(noConditionDefault ? "YES" : "NO"),(result ? "YES" : "NO"));
LOGObjectFnStop();
return result;
};
//--------------------------------------------------------------------
-(BOOL)evaluateCondition:(id)condition
inContext:(GSWContext*)context
{
BOOL result=NO;
LOGObjectFnStart();
result=[self evaluateCondition:condition
inContext:context
noConditionAssociationDefault:NO
noConditionDefault:YES];
LOGObjectFnStop(); LOGObjectFnStop();
return result; return result;
}; };

View file

@ -45,6 +45,7 @@
GSWAssociation* _disabled; GSWAssociation* _disabled;
GSWAssociation* _enabled; GSWAssociation* _enabled;
GSWAssociation* _fragmentIdentifier; GSWAssociation* _fragmentIdentifier;
GSWAssociation* _displayDisabled;
NSDictionary* _otherPathQueryAssociations; NSDictionary* _otherPathQueryAssociations;
// } // }
NSDictionary* _otherQueryAssociations; NSDictionary* _otherQueryAssociations;

View file

@ -107,6 +107,12 @@ RCS_ID("$Id$")
NSDebugMLLog(@"gswdync",@"fragmentIdentifier=%@",_fragmentIdentifier); NSDebugMLLog(@"gswdync",@"fragmentIdentifier=%@",_fragmentIdentifier);
[tmpAssociations removeObjectForKey:fragmentIdentifier__Key]; [tmpAssociations removeObjectForKey:fragmentIdentifier__Key];
_displayDisabled = [[associations objectForKey:displayDisabled__Key
withDefaultObject:[_displayDisabled autorelease]] retain];
NSDebugMLLog(@"gswdync",@"displayDisabled=%@",_displayDisabled);
[tmpAssociations removeObjectForKey:displayDisabled__Key];
}; };
_queryDictionary = [[associations objectForKey:queryDictionary__Key _queryDictionary = [[associations objectForKey:queryDictionary__Key
@ -152,6 +158,7 @@ RCS_ID("$Id$")
DESTROY(_disabled); DESTROY(_disabled);
DESTROY(_enabled); DESTROY(_enabled);
DESTROY(_fragmentIdentifier); DESTROY(_fragmentIdentifier);
DESTROY(_displayDisabled);
DESTROY(_otherQueryAssociations); DESTROY(_otherQueryAssociations);
DESTROY(_otherPathQueryAssociations); DESTROY(_otherPathQueryAssociations);
[super dealloc]; [super dealloc];
@ -256,10 +263,14 @@ RCS_ID("$Id$")
inContext:(GSWContext*)context inContext:(GSWContext*)context
{ {
//OK //OK
BOOL disabledInContext=NO;
BOOL displayDisabledValue=YES;
#ifndef NDEBBUG #ifndef NDEBBUG
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb]; int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
#endif #endif
LOGObjectFnStartC("GSWForm"); LOGObjectFnStartC("GSWForm");
GSWStartElement(context); GSWStartElement(context);
GSWSaveAppendToResponseElementID(context); GSWSaveAppendToResponseElementID(context);
[response appendDebugCommentContentString:[NSString stringWithFormat:@"declarationName=%@ ID=%@", [response appendDebugCommentContentString:[NSString stringWithFormat:@"declarationName=%@ ID=%@",
@ -268,25 +279,61 @@ RCS_ID("$Id$")
if (!WOStrictFlag) if (!WOStrictFlag)
{ {
BOOL disabledInContext=NO;
disabledInContext=[self disabledInContext:context]; disabledInContext=[self disabledInContext:context];
[context setInForm:!disabledInContext]; [context setInForm:!disabledInContext];
if (!disabledInContext)
{
if ([context isInEnabledForm])
{
NSWarnLog(@"Enabled Form %@ ID=%@ in an enbled form. This usually doesn't works well",
[self declarationName],
[context elementID]);
//[response appendContentString:@"FORM in a FORM"];//TEMP
[context setInEnabledForm:YES];
};
};
if (disabledInContext && _displayDisabled)
{
displayDisabledValue=[self evaluateCondition:_displayDisabled
inContext:context];
};
} }
else else
[context setInForm:YES]; [context setInForm:YES];
[self appendToResponse:response if (!disabledInContext || displayDisabledValue)
inContext:context {
elementsFromIndex:0 [self appendToResponse:response
toIndex:[_elementsMap length]-2]; inContext:context
[self _appendHiddenFieldsToResponse:response elementsFromIndex:0
inContext:context]; toIndex:[_elementsMap length]-2];
[self appendToResponse:response
inContext:context [self _appendHiddenFieldsToResponse:response
elementsFromIndex:[_elementsMap length]-1 inContext:context];
toIndex:[_elementsMap length]-1]; [self appendToResponse:response
[context setInForm:NO]; inContext:context
elementsFromIndex:[_elementsMap length]-1
toIndex:[_elementsMap length]-1];
[context setInForm:NO];
}
else
{
if ([_elementsMap length]>2)
{
[self appendToResponse:response
inContext:context
elementsFromIndex:1 // omit <form>
toIndex:[_elementsMap length]-2]; // omit </form>
};
};
if (!disabledInContext)
{
[context setInForm:NO];
[context setInEnabledForm:NO];
};
GSWStopElement(context); GSWStopElement(context);
#ifndef NDEBBUG #ifndef NDEBBUG
NSAssert3(elementsNb==[(GSWElementIDString*)[context elementID]elementsNb], NSAssert3(elementsNb==[(GSWElementIDString*)[context elementID]elementsNb],
@"GSWForm appendToResponse: bad elementID: elementsNb=%d [context elementID]=%@ [(GSWElementIDString*)[context elementID]elementsNb]=%d", @"GSWForm appendToResponse: bad elementID: elementsNb=%d [context elementID]=%@ [(GSWElementIDString*)[context elementID]elementsNb]=%d",
@ -334,6 +381,7 @@ RCS_ID("$Id$")
if (isFormSubmited) if (isFormSubmited)
{ {
[context setInForm:YES]; [context setInForm:YES];
[context setInEnabledForm:YES];
[context _setFormSubmitted:YES]; [context _setFormSubmitted:YES];
multipleSubmitValue=[self evaluateCondition:_multipleSubmit multipleSubmitValue=[self evaluateCondition:_multipleSubmit
inContext:context]; inContext:context];
@ -374,6 +422,7 @@ RCS_ID("$Id$")
[context _setActionInvoked:YES]; [context _setActionInvoked:YES];
}; };
[context setInForm:NO]; [context setInForm:NO];
[context setInEnabledForm:NO];
[context _setFormSubmitted:NO]; [context _setFormSubmitted:NO];
[context _setIsMultipleSubmitForm:NO]; [context _setIsMultipleSubmitForm:NO];
}; };
@ -443,6 +492,7 @@ RCS_ID("$Id$")
if (isFormSubmited) if (isFormSubmited)
{ {
[context setInForm:YES]; [context setInForm:YES];
[context setInEnabledForm:YES];
[context _setFormSubmitted:YES]; [context _setFormSubmitted:YES];
}; };
NSDebugMLLog(@"gswdync",@"\n\ndynamicChildren=%@",_dynamicChildren); NSDebugMLLog(@"gswdync",@"\n\ndynamicChildren=%@",_dynamicChildren);
@ -454,6 +504,7 @@ RCS_ID("$Id$")
if (isFormSubmited) if (isFormSubmited)
{ {
[context setInForm:NO]; [context setInForm:NO];
[context setInEnabledForm:NO];
[context _setFormSubmitted:NO]; [context _setFormSubmitted:NO];
}; };
}; };
@ -481,7 +532,13 @@ RCS_ID("$Id$")
disabledInContext=[self disabledInContext:context]; disabledInContext=[self disabledInContext:context];
NSDebugMLLog(@"gswdync",@"disabledInContext=%s",(disabledInContext ? "YES" : "NO")); NSDebugMLLog(@"gswdync",@"disabledInContext=%s",(disabledInContext ? "YES" : "NO"));
}; };
if (!disabledInContext) if (disabledInContext)
{
// Mainly for debugginf purpose as it is not
// handled by browsers
[response appendContentString:@" disabled"];
}
else
{ {
GSWComponent* component=[context component]; GSWComponent* component=[context component];
if (_href) if (_href)

View file

@ -1,9 +1,9 @@
/** GSWGenericContainer.h - <title>GSWeb: Class GSWGenericContainer</title> /** GSWGenericContainer.h - <title>GSWeb: Class GSWGenericContainer</title>
Copyright (C) 1999-2002 Free Software Foundation, Inc. Copyright (C) 1999-2002,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
$Revision$ $Revision$
$Date$ $Date$
@ -36,6 +36,9 @@
//==================================================================== //====================================================================
@interface GSWGenericContainer: GSWDynamicElement @interface GSWGenericContainer: GSWDynamicElement
{ {
GSWAssociation* _elementName;
GSWAssociation* _otherTagString;
GSWAssociation* _omitElement;
GSWAssociation* _children; GSWAssociation* _children;
NSDictionary* _associations; NSDictionary* _associations;
GSWElement* _element; GSWElement* _element;
@ -44,8 +47,6 @@
-(id)initWithName:(NSString*)aName -(id)initWithName:(NSString*)aName
associations:(NSDictionary*)associations associations:(NSDictionary*)associations
template:(GSWElement*)templateElement; template:(GSWElement*)templateElement;
-(void)dealloc;
-(NSString*)description;
-(void)appendToResponse:(GSWResponse*)aResponse -(void)appendToResponse:(GSWResponse*)aResponse
inContext:(GSWContext*)aContext; inContext:(GSWContext*)aContext;

View file

@ -1,6 +1,6 @@
/** GSWGenericContainer.m - <title>GSWeb: Class GSWGenericContainer</title> /** GSWGenericContainer.m - <title>GSWeb: Class GSWGenericContainer</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
@ -40,9 +40,37 @@ RCS_ID("$Id$")
associations:(NSDictionary*)associations associations:(NSDictionary*)associations
template:(GSWElement*)templateElement template:(GSWElement*)templateElement
{ {
if ((self = [super init])) NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
LOGObjectFnStartC("GSWForm");
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ templateElement=%@",aName,associations,templateElement);
_elementName = [[associations objectForKey:elementName__Key
withDefaultObject:[_elementName autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWGenericContainer: elementName=%@",_elementName);
_otherTagString = [[associations objectForKey:otherTagString__Key
withDefaultObject:[_otherTagString autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWGenericContainer: otherTagString=%@",_otherTagString);
[tmpAssociations removeObjectForKey:elementName__Key];
[tmpAssociations removeObjectForKey:otherTagString__Key];
if (!WOStrictFlag)
{ {
ASSIGN(_associations,associations); _omitElement = [[associations objectForKey:omitElement__Key
withDefaultObject:[_omitElement autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWGenericContainer: omitElement=%@",_omitElement);
[tmpAssociations removeObjectForKey:omitElement__Key];
};
if ((self=[super initWithName:aName
associations:tmpAssociations
template:templateElement]))
{
if ([tmpAssociations count]>0)
ASSIGN(_associations,tmpAssociations);
ASSIGN(_element,templateElement); ASSIGN(_element,templateElement);
}; };
return self; return self;
@ -51,6 +79,9 @@ RCS_ID("$Id$")
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)dealloc -(void)dealloc
{ {
DESTROY(_elementName);
DESTROY(_otherTagString);
DESTROY(_omitElement);
DESTROY(_associations); DESTROY(_associations);
DESTROY(_element); DESTROY(_element);
[super dealloc]; [super dealloc];
@ -73,29 +104,47 @@ RCS_ID("$Id$")
id component = [aContext component]; id component = [aContext component];
id theValue=nil; id theValue=nil;
id otherTag = nil; id otherTag = nil;
id tag = [[_associations objectForKey:@"elementName"] valueInComponent:component]; id tag = nil;
BOOL omitElement = NO;
[aResponse appendContentString:[NSString stringWithFormat:@"<%@",tag]];
if ((otherTag = [[_associations objectForKey:@"otherTagString"] valueInComponent:component])) if (!WOStrictFlag && _omitElement)
{ {
[aResponse appendContentString:[NSString stringWithFormat:@" %@",otherTag]]; omitElement=[self evaluateCondition:_omitElement
} inContext:aContext
noConditionAssociationDefault:NO
assocEnumer = [_associations keyEnumerator]; noConditionDefault:NO];
while ((currentAssocKey = [assocEnumer nextObject])) };
if (!omitElement)
{ {
theValue = [[_associations objectForKey:currentAssocKey] valueInComponent:component]; tag = [_elementName valueInComponent:component];
if (([currentAssocKey isEqualToString:@"elementName"] == NO)
&& ([currentAssocKey isEqualToString:@"otherTagString"] == NO)) [aResponse appendContentString:[NSString stringWithFormat:@"<%@",tag]];
if ((otherTag = [_otherTagString valueInComponent:component]))
{ {
[aResponse appendContentString:[NSString stringWithFormat:@" %@=\"%@\"",currentAssocKey,theValue]]; [aResponse appendContentString:
[NSString stringWithFormat:@" %@",otherTag]];
} }
}
assocEnumer = [_associations keyEnumerator];
while ((currentAssocKey = [assocEnumer nextObject]))
{
theValue = [[_associations objectForKey:currentAssocKey]
valueInComponent:component];
[aResponse appendContentString:
[NSString stringWithFormat:@" %@=\"%@\"",
currentAssocKey,theValue]];
}
[aResponse appendContentString:@">"];
};
[aResponse appendContentString:@">"];
[_element appendToResponse:aResponse inContext:aContext]; [_element appendToResponse:aResponse inContext:aContext];
[aResponse appendContentString:[NSString stringWithFormat:@"</%@>",tag]];
if (!omitElement)
[aResponse appendContentString:[NSString stringWithFormat:@"</%@>",tag]];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View file

@ -279,7 +279,7 @@ An exception is raised if the end quote is not found,...
else else
(*indexPtr)++; (*indexPtr)++;
} }
NSDebugMLog(@"startIndex=%d *indexPtr=%d _uniBuf[*indexPtr]='%c'", NSDebugMLLog(@"GSWHTMLRawParser",@"startIndex=%d *indexPtr=%d _uniBuf[*indexPtr]='%c'",
startIndex,*indexPtr,(char)_uniBuf[*indexPtr]); startIndex,*indexPtr,(char)_uniBuf[*indexPtr]);
if (_uniBuf[*indexPtr]!=quote) if (_uniBuf[*indexPtr]!=quote)
{ {
@ -300,7 +300,7 @@ An exception is raised if the end quote is not found,...
(char)quote,(char)_uniBuf[*indexPtr]); (char)quote,(char)_uniBuf[*indexPtr]);
//ParserDebugLogBuffer(_uniBuf,stopIndex+1,*indexPtr,stopIndex+1); //ParserDebugLogBuffer(_uniBuf,stopIndex+1,*indexPtr,stopIndex+1);
NSDebugMLog(@"startIndex=%d *indexPtr=%d _uniBuf[*indexPtr]='%c'", NSDebugMLLog(@"GSWHTMLRawParser",@"startIndex=%d *indexPtr=%d _uniBuf[*indexPtr]='%c'",
startIndex,*indexPtr,(char)_uniBuf[*indexPtr]); startIndex,*indexPtr,(char)_uniBuf[*indexPtr]);
LOGObjectFnStop(); LOGObjectFnStop();
@ -338,12 +338,12 @@ An exception is raised if the end quote is not found,...
(char)quote,(char)_uniBuf[*indexPtr]); (char)quote,(char)_uniBuf[*indexPtr]);
//ParserDebugLogBuffer(_uniBuf,stopIndex+1,*indexPtr,stopIndex+1); //ParserDebugLogBuffer(_uniBuf,stopIndex+1,*indexPtr,stopIndex+1);
NSDebugMLog(@"startIndex=%d *indexPtr=%d _uniBuf[*indexPtr]='%c'", NSDebugMLLog(@"GSWHTMLRawParser",@"startIndex=%d *indexPtr=%d _uniBuf[*indexPtr]='%c'",
startIndex,*indexPtr,(char)_uniBuf[*indexPtr]); startIndex,*indexPtr,(char)_uniBuf[*indexPtr]);
string=[NSString stringWithCharacters:_uniBuf+startIndex+1 // +1: skip begining quote string=[NSString stringWithCharacters:_uniBuf+startIndex+1 // +1: skip begining quote
length:*indexPtr-startIndex-1]; // -1 because -1 for begining quote, -1 for ending quote +1 for length length:*indexPtr-startIndex-1]; // -1 because -1 for begining quote, -1 for ending quote +1 for length
NSDebugMLog(@"'string'='%@'",string); NSDebugMLLog(@"GSWHTMLRawParser",@"'string'='%@'",string);
LOGObjectFnStop(); LOGObjectFnStop();
@ -389,7 +389,7 @@ It skip starting blank spaces
string=[self _parseQuotedStringWithQuote:_uniBuf[*indexPtr] string=[self _parseQuotedStringWithQuote:_uniBuf[*indexPtr]
index:indexPtr index:indexPtr
stopIndex:stopIndex]; stopIndex:stopIndex];
NSDebugMLog(@"indexPtr=%d 'string'='%@'",*indexPtr,string); NSDebugMLLog(@"GSWHTMLRawParser",@"indexPtr=%d 'string'='%@'",*indexPtr,string);
(*indexPtr)++; // skip last quote (*indexPtr)++; // skip last quote
} }
else else
@ -408,16 +408,16 @@ It skip starting blank spaces
else else
(*indexPtr)++; (*indexPtr)++;
}; };
NSDebugMLog(@"startIndex=%d stopIndex=%d *indexPtr=%d _uniBuf[*indexPtr]='%c'", NSDebugMLLog(@"GSWHTMLRawParser",@"startIndex=%d stopIndex=%d *indexPtr=%d _uniBuf[*indexPtr]='%c'",
startIndex,stopIndex,*indexPtr,(char)_uniBuf[*indexPtr]); startIndex,stopIndex,*indexPtr,(char)_uniBuf[*indexPtr]);
if (*indexPtr>startIndex) if (*indexPtr>startIndex)
string=[NSString stringWithCharacters:_uniBuf+startIndex string=[NSString stringWithCharacters:_uniBuf+startIndex
length:*indexPtr-startIndex]; length:*indexPtr-startIndex];
NSDebugMLog(@"'string'='%@'",string); NSDebugMLLog(@"GSWHTMLRawParser",@"'string'='%@'",string);
}; };
}; };
NSDebugMLog(@"'string'='%@'",string); NSDebugMLLog(@"GSWHTMLRawParser",@"'string'='%@'",string);
LOGObjectFnStop(); LOGObjectFnStop();
return string; return string;
@ -444,6 +444,7 @@ if it is not the case but you'll have problems later...)
andIndex:(int)stopIndex andIndex:(int)stopIndex
{ {
NSMutableDictionary* properties=nil; NSMutableDictionary* properties=nil;
LOGObjectFnStart(); LOGObjectFnStart();
//ParserDebugLogBuffer(_uniBuf,stopIndex+1,startIndex,stopIndex+1); //ParserDebugLogBuffer(_uniBuf,stopIndex+1,startIndex,stopIndex+1);
if (stopIndex>=startIndex) if (stopIndex>=startIndex)
@ -460,16 +461,18 @@ if it is not the case but you'll have problems later...)
{ {
tagName=[NSString stringWithCharacters:_uniBuf+startIndex tagName=[NSString stringWithCharacters:_uniBuf+startIndex
length:index-startIndex+1]; length:index-startIndex+1];
NSDebugMLog(@"tagName=%@",tagName); NSDebugMLLog(@"GSWHTMLRawParser",@"tagName=%@",tagName);
}; };
break; break;
} }
else
index++;
}; };
if (!tagName && index>stopIndex) if (!tagName && index>stopIndex)
{ {
tagName=[NSString stringWithCharacters:_uniBuf+startIndex tagName=[NSString stringWithCharacters:_uniBuf+startIndex
length:index-startIndex]; length:index-startIndex];
NSDebugMLog(@"tagName=%@",tagName); NSDebugMLLog(@"GSWHTMLRawParser",@"tagName=%@",tagName);
}; };
if (tagName) if (tagName)
{ {
@ -486,44 +489,60 @@ if it is not the case but you'll have problems later...)
while(index<=stopIndex) while(index<=stopIndex)
{ {
NSString* key=[self _parsePropertiesStringEndingWith:'=' NSString* key=nil;
or:' ' int previousIndex=index;
index:&index
stopIndex:stopIndex];
NSDebugMLog(@"'key'='%@'",key);
// Skip blank
while(index<=stopIndex
&& _uniBuf[index]==' ')
index++;
if ([key length]>0) if (_uniBuf[index]=='=')
[NSException raise:NSInvalidArgumentException
format:@"Found '=' in tag without key at %@.",
[self lineAndColumnIndexesStringFromIndex:index]];
else
{ {
key=[key lowercaseString]; key=[self _parsePropertiesStringEndingWith:'='
if (!properties) or:' '
properties=(NSMutableDictionary*)[NSMutableDictionary dictionary]; index:&index
if (index>stopIndex) // key without value stopIndex:stopIndex];
[properties setObject:@"" NSDebugMLLog(@"GSWHTMLRawParser",@"'key'='%@'",key);
forKey:key]; // Skip blank
else if (_uniBuf[index]=='=') // key=value while(index<=stopIndex
&& _uniBuf[index]==' ')
index++;
if ([key length]>0)
{ {
NSString *value; key=[key lowercaseString];
index++; if (!properties)
value=[self _parsePropertiesStringEndingWith:'=' properties=(NSMutableDictionary*)[NSMutableDictionary dictionary];
or:' ' if (index>stopIndex) // key without value
index:&index [properties setObject:@""
stopIndex:stopIndex]; forKey:key];
NSDebugMLog(@"'value'='%@'",value); else if (_uniBuf[index]=='=') // key=value
NSAssert(value,@"No value"); {
[properties setObject:value NSString *value;
forKey:key]; index++;
} value=[self _parsePropertiesStringEndingWith:'='
else // key without value or:' '
[properties setObject:@"" index:&index
forKey:key]; stopIndex:stopIndex];
NSDebugMLLog(@"GSWHTMLRawParser",@"'value'='%@'",value);
NSAssert(value,@"No value");
[properties setObject:value
forKey:key];
}
else // key without value
[properties setObject:@""
forKey:key];
};
};
if (index==previousIndex)
{
[NSException raise:NSInvalidArgumentException
format:@"Parser blocked at %@.",
[self lineAndColumnIndexesStringFromIndex:index]];
}; };
}; };
}; };
NSDebugMLog(@"properties=%@",properties); NSDebugMLLog(@"GSWHTMLRawParser",@"properties=%@",properties);
LOGObjectFnStop(); LOGObjectFnStop();
return properties; return properties;
}; };
@ -536,7 +555,7 @@ May raise exception.
{ {
// Object obj = null; // Object obj = null;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLog(@"_string=%@",_string); NSDebugMLLog(@"GSWHTMLRawParser",@"_string=%@",_string);
_length=[_string length]; _length=[_string length];
_uniBuf = (unichar*)objc_malloc(sizeof(unichar)*(_length+1)); _uniBuf = (unichar*)objc_malloc(sizeof(unichar)*(_length+1));
@ -546,12 +565,13 @@ May raise exception.
_index=0; _index=0;
NSDebugMLog(@"index=%d length=%d",_index,_length); NSDebugMLLog(@"GSWHTMLRawParser",@"index=%d length=%d",_index,_length);
//ParserDebugLogBuffer(_uniBuf,_length,_index,_length); //ParserDebugLogBuffer(_uniBuf,_length,_index,_length);
_textStartIndex=_index; _textStartIndex=_index;
while(_index<_length) while(_index<_length)
{ {
int previousIndex=_index;
//ParserDebugLogBuffer(_uniBuf,_length,_index,20); //ParserDebugLogBuffer(_uniBuf,_length,_index,20);
switch(_uniBuf[_index]) switch(_uniBuf[_index])
{ {
@ -568,7 +588,7 @@ May raise exception.
if (_index>=_length) if (_index>=_length)
{ {
[NSException raise:NSInvalidArgumentException [NSException raise:NSInvalidArgumentException
format:@"Reached end of string when parsing tag opening at %@.", format:@"Reached end of string when parsing tag opening at %@.",
[self lineAndColumnIndexesStringFromIndex:tagStartIndex]]; [self lineAndColumnIndexesStringFromIndex:tagStartIndex]];
} }
else else
@ -577,7 +597,7 @@ May raise exception.
GSWHTMLRawParserTagType tagType=GetTagType(_uniBuf,_length,&_index,&isClosingTag); GSWHTMLRawParserTagType tagType=GetTagType(_uniBuf,_length,&_index,&isClosingTag);
int tagPropertiesStartIndex=_index; int tagPropertiesStartIndex=_index;
_textStopIndex=tagStartIndex-1; _textStopIndex=tagStartIndex-1;
NSDebugMLog(@"tagType=%d isClosingTag=%s _textStartIndex=%d",tagType,(isClosingTag ? "YES" : "NO"),_textStartIndex); NSDebugMLLog(@"GSWHTMLRawParser",@"tagType=%d isClosingTag=%s _textStartIndex=%d",tagType,(isClosingTag ? "YES" : "NO"),_textStartIndex);
if (_parserIsDynamicTagType(tagType)) if (_parserIsDynamicTagType(tagType))
{ {
//ParserDebugLogBuffer(_uniBuf,_length,_index,20); //ParserDebugLogBuffer(_uniBuf,_length,_index,20);
@ -600,7 +620,7 @@ May raise exception.
BOOL stopTag=NO; BOOL stopTag=NO;
int tagStopIndex=_index; int tagStopIndex=_index;
int tagPropertiesStopIndex=_index; int tagPropertiesStopIndex=_index;
NSDebugMLog(@"tagStartIndex=%d tagStopIndex=%d _textStartIndex=%d _textStopIndex=%d _length=%d _index=%d", NSDebugMLLog(@"GSWHTMLRawParser",@"tagStartIndex=%d tagStopIndex=%d _textStartIndex=%d _textStopIndex=%d _length=%d _index=%d",
tagStartIndex,tagStopIndex,_textStartIndex,_textStopIndex,_length,_index); tagStartIndex,tagStopIndex,_textStartIndex,_textStopIndex,_length,_index);
if (isClosingTag) if (isClosingTag)
{ {
@ -617,14 +637,14 @@ May raise exception.
stopTag=YES; stopTag=YES;
tagPropertiesStopIndex--; tagPropertiesStopIndex--;
}; };
NSDebugMLog(@"stopTag=%d",stopTag); NSDebugMLLog(@"GSWHTMLRawParser",@"stopTag=%d",stopTag);
tagPropertiesString=[NSString stringWithCharacters:_uniBuf+tagPropertiesStartIndex tagPropertiesString=[NSString stringWithCharacters:_uniBuf+tagPropertiesStartIndex
length:tagPropertiesStopIndex-tagPropertiesStartIndex]; length:tagPropertiesStopIndex-tagPropertiesStartIndex];
NSDebugMLog(@"tagPropertiesString='%@'",tagPropertiesString); NSDebugMLLog(@"GSWHTMLRawParser",@"tagPropertiesString='%@'",tagPropertiesString);
tagProperties=[self tagPropertiesForType:tagType tagProperties=[self tagPropertiesForType:tagType
betweenIndex:tagPropertiesStartIndex betweenIndex:tagPropertiesStartIndex
andIndex:tagPropertiesStopIndex-1]; andIndex:tagPropertiesStopIndex-1];
NSDebugMLog(@"tagProperties='%@'",tagProperties); NSDebugMLLog(@"GSWHTMLRawParser",@"tagProperties='%@'",tagProperties);
[self startDynamicTagOfType:tagType [self startDynamicTagOfType:tagType
withProperties:tagProperties withProperties:tagProperties
templateInfo:[self lineAndColumnIndexesStringFromIndex:tagStartIndex]]; templateInfo:[self lineAndColumnIndexesStringFromIndex:tagStartIndex]];
@ -636,7 +656,7 @@ May raise exception.
_index++; _index++;
//ParserDebugLogBuffer(_uniBuf,_length,_index,20); //ParserDebugLogBuffer(_uniBuf,_length,_index,20);
_textStartIndex=_index; _textStartIndex=_index;
NSDebugMLog(@"_textStartIndex=%d _textStopIndex=%d _length=%d _index=%d", NSDebugMLLog(@"GSWHTMLRawParser",@"_textStartIndex=%d _textStopIndex=%d _length=%d _index=%d",
_textStartIndex,_textStopIndex,_length,_index); _textStartIndex,_textStopIndex,_length,_index);
}; };
} }
@ -668,7 +688,7 @@ May raise exception.
[self didParseCommentWithContentString:commentString]; [self didParseCommentWithContentString:commentString];
_index++; _index++;
_textStartIndex=_index; _textStartIndex=_index;
NSDebugMLog(@"_textStartIndex=%d _textStopIndex=%d _length=%d _index=%d", NSDebugMLLog(@"GSWHTMLRawParser",@"_textStartIndex=%d _textStopIndex=%d _length=%d _index=%d",
_textStartIndex,_textStopIndex,_length,_index); _textStartIndex,_textStopIndex,_length,_index);
}; };
}; };
@ -682,6 +702,12 @@ May raise exception.
_index++; _index++;
break; break;
}; };
if (_index==previousIndex)
{
[NSException raise:NSInvalidArgumentException
format:@"Parser blocked at %@.",
[self lineAndColumnIndexesStringFromIndex:_index]];
};
}; };
_textStopIndex=_length-1; _textStopIndex=_length-1;
[self didParseText]; [self didParseText];

View file

@ -1,6 +1,6 @@
/** GSWHTMLURLValuedElement.m - <title>GSWeb: Class GSWHTMLURLValuedElement</title> /** GSWHTMLURLValuedElement.m - <title>GSWeb: Class GSWHTMLURLValuedElement</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: Apr 1999 Date: Apr 1999
@ -416,11 +416,20 @@ NS_DURING
NSString* path=[resourceManager pathForResourceNamed:filenameValue NSString* path=[resourceManager pathForResourceNamed:filenameValue
inFramework:frameworkValue inFramework:frameworkValue
languages:languages]; languages:languages];
if ([path length]==0)
NSWarnLog(@"No path (or empty one) for filenameValue: '%@' (association=%@) in %@ named %@",
filenameValue,_filename,[self className],[self declarationName]);
url=[self addPath:path url=[self addPath:path
forCIDKeyAssociation:_cidKey forCIDKeyAssociation:_cidKey
CIDStoreAssociation:_cidStore CIDStoreAssociation:_cidStore
inContext:aContext]; inContext:aContext];
NSDebugMLLog(@"gswdync",@"url=%@",url);
NSDebugMLLog(@"gswdync",@"filenameValue=%@ url=%@",filenameValue,url);
if ([url length]==0)
NSWarnLog(@"No URL (or empty one) for filenameValue: '%@' (association=%@) in %@ named %@",
filenameValue,_filename,[self className],[self declarationName]);
} }
else else
{ {
@ -428,7 +437,12 @@ NS_DURING
inFramework:frameworkValue inFramework:frameworkValue
languages:languages languages:languages
request:request]; request:request];
NSDebugMLLog(@"gswdync",@"url=%@",url);
NSDebugMLLog(@"gswdync",@"filenameValue=%@ url=%@",filenameValue,url);
if ([url length]==0)
NSWarnLog(@"No URL (or empty one) for filenameValue: '%@' (association=%@) in %@ named %@",
filenameValue,_filename,[self className],[self declarationName]);
}; };
}; };
}; };

View file

@ -1,9 +1,9 @@
/** GSWHyperlink.h - <title>GSWeb: Class GSWHyperlink</title> /** GSWHyperlink.h - <title>GSWeb: Class GSWHyperlink</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
$Revision$ $Revision$
$Date$ $Date$
@ -64,6 +64,7 @@
NSDictionary* _otherPathQueryAssociations; NSDictionary* _otherPathQueryAssociations;
GSWAssociation* _urlPrefix; GSWAssociation* _urlPrefix;
GSWAssociation* _pathQueryDictionary; GSWAssociation* _pathQueryDictionary;
GSWAssociation* _escapeHTML;
// } // }
GSWElement* _children; GSWElement* _children;
}; };

View file

@ -132,6 +132,10 @@ RCS_ID("$Id$")
_urlPrefix = [[anAssociationsDict objectForKey:urlPrefix__Key _urlPrefix = [[anAssociationsDict objectForKey:urlPrefix__Key
withDefaultObject:[_urlPrefix autorelease]] retain]; withDefaultObject:[_urlPrefix autorelease]] retain];
NSDebugMLLog(@"gswdync",@"urlPrefix=%@",_urlPrefix); NSDebugMLLog(@"gswdync",@"urlPrefix=%@",_urlPrefix);
_escapeHTML = [[anAssociationsDict objectForKey:escapeHTML__Key
withDefaultObject:[_escapeHTML autorelease]] retain];
NSDebugMLLog(@"gswdync",@"escapeHTML=%@",_escapeHTML);
}; };
@ -158,6 +162,7 @@ RCS_ID("$Id$")
[tmpOtherAssociations removeObjectForKey:key__Key]; [tmpOtherAssociations removeObjectForKey:key__Key];
[tmpOtherAssociations removeObjectForKey:urlPrefix__Key]; [tmpOtherAssociations removeObjectForKey:urlPrefix__Key];
[tmpOtherAssociations removeObjectForKey:pathQueryDictionary__Key]; [tmpOtherAssociations removeObjectForKey:pathQueryDictionary__Key];
[tmpOtherAssociations removeObjectForKey:escapeHTML__Key];
}; };
if (!WOStrictFlag) if (!WOStrictFlag)
@ -255,6 +260,7 @@ RCS_ID("$Id$")
DESTROY(_mimeType); DESTROY(_mimeType);
DESTROY(_key); DESTROY(_key);
DESTROY(_urlPrefix); DESTROY(_urlPrefix);
DESTROY(_escapeHTML);
DESTROY(_pathQueryDictionary); DESTROY(_pathQueryDictionary);
DESTROY(_children); DESTROY(_children);
[super dealloc]; [super dealloc];
@ -296,7 +302,7 @@ RCS_ID("$Id$")
disabledValue=![self evaluateCondition:_enabled disabledValue=![self evaluateCondition:_enabled
inContext:context]; inContext:context];
if (!WOStrictFlag && _displayDisabled) if (!WOStrictFlag && disabledValue && _displayDisabled)
{ {
displayDisabledValue=[self evaluateCondition:_displayDisabled displayDisabledValue=[self evaluateCondition:_displayDisabled
inContext:context]; inContext:context];
@ -642,11 +648,23 @@ RCS_ID("$Id$")
if (_string) if (_string)
{ {
id stringValue=nil; id stringValue=nil;
NSDebugMLLog(@"gswdync",@"string=%@",_string); NSDebugMLLog(@"gswdync",@"string=%@",_string);
stringValue=[_string valueInComponent:[aContext component]]; stringValue=[_string valueInComponent:[aContext component]];
NSDebugMLLog(@"gswdync",@"stringValue=%@",stringValue); NSDebugMLLog(@"gswdync",@"stringValue=%@",stringValue);
if (stringValue) if (stringValue)
[aResponse appendContentHTMLString:stringValue]; {
BOOL escapeHTMLValue=YES;
if (!WOStrictFlag && _escapeHTML)
escapeHTMLValue=[self evaluateCondition:_escapeHTML
inContext:aContext];
if (escapeHTMLValue)
[aResponse appendContentHTMLString:stringValue];
else
[aResponse appendContentString:stringValue];
};
}; };
LOGObjectFnStop(); LOGObjectFnStop();
} }

View file

@ -41,11 +41,20 @@
NSStringEncoding _contentEncoding; NSStringEncoding _contentEncoding;
NSDictionary* _userInfo; NSDictionary* _userInfo;
// NSMutableString* _contentString; // NSMutableString* _contentString;
IMP _contentStringASImp; // IMP _contentStringASImp;
NSMutableData* _contentData; NSMutableData* _contentData;
IMP _contentDataADImp; IMP _contentDataADImp;
IMP _appendContentStringIMP;
Class _selfClass;
IMP _stringByEscapingHTMLStringIMP;
IMP _stringByEscapingHTMLAttributeValueIMP;
IMP _stringByConvertingToHTMLEntitiesIMP;
IMP _stringByConvertingToHTMLIMP;
#ifndef NO_GNUSTEP #ifndef NO_GNUSTEP
NSMutableArray* _cachesStack; // Cache Stacks NSMutableArray* _cachesStack; // Cache Stacks
NSMutableData* _currentCacheData; // Current Cache Data (last object of _cachesStack). Do not retain/release
IMP _currentCacheDataADImp;
#endif #endif
}; };
@ -61,6 +70,12 @@
forKey:(NSString*)key; forKey:(NSString*)key;
-(void)setHeaders:(NSDictionary*)headerList; -(void)setHeaders:(NSDictionary*)headerList;
-(void)removeHeader:(NSString*)header
forKey:(NSString*)key;
-(void)removeHeaderForKey:(NSString*)key;
-(void)removeHeadersForKey:(NSString*)key;
-(void)appendHeader:(NSString*)header -(void)appendHeader:(NSString*)header
forKey:(NSString*)key; forKey:(NSString*)key;
-(void)appendHeaders:(NSArray*)headers -(void)appendHeaders:(NSArray*)headers
@ -77,15 +92,12 @@
-(void)setContentEncoding:(NSStringEncoding)encoding; -(void)setContentEncoding:(NSStringEncoding)encoding;
-(NSStringEncoding)contentEncoding; -(NSStringEncoding)contentEncoding;
-(void)_initContentData;
-(NSData*)content; -(NSData*)content;
-(NSString*)contentString; -(NSString*)contentString;
-(void)setContent:(NSData*)contentData; -(void)setContent:(NSData*)contentData;
-(void)setContentString:(NSString*)contentString;
-(void)_appendContentAsciiString:(NSString*)aString; -(void)_appendContentAsciiString:(NSString*)aString;
-(void)_appendContentCharacter:(char)aChar; -(void)appendContentCharacter:(char)aChar;
-(void)appendContentString:(NSString*)string; -(void)appendContentString:(NSString*)string;
-(void)appendContentData:(NSData*)contentData; -(void)appendContentData:(NSData*)contentData;
@ -96,10 +108,7 @@
@interface GSWMessage (GSWContentConveniences) @interface GSWMessage (GSWContentConveniences)
-(void)appendContentBytes:(const void*)contentsBytes -(void)appendContentBytes:(const void*)contentsBytes
length:(unsigned)length; length:(unsigned)length;
-(void)appendContentCharacter:(char)aChar;
-(void)appendDebugCommentContentString:(NSString*)string; -(void)appendDebugCommentContentString:(NSString*)string;
-(void)replaceContentString:(NSString*)replaceString
byString:(NSString*)byString;
-(void)replaceContentData:(NSData*)replaceData -(void)replaceContentData:(NSData*)replaceData
byData:(NSData*)byData; byData:(NSData*)byData;

View file

@ -40,24 +40,46 @@ RCS_ID("$Id$")
static NSStringEncoding globalDefaultEncoding=GSUndefinedEncoding; static NSStringEncoding globalDefaultEncoding=GSUndefinedEncoding;
static NSString* globalDefaultURLEncoding=nil; static NSString* globalDefaultURLEncoding=nil;
static SEL appendStringSel = NULL;
static SEL appendDataSel = NULL; static SEL appendDataSel = NULL;
static SEL appendContentStringSEL = NULL;
static SEL stringByEscapingHTMLStringSEL = NULL;
static SEL stringByEscapingHTMLAttributeValueSEL = NULL;
static SEL stringByConvertingToHTMLEntitiesSEL = NULL;
static SEL stringByConvertingToHTMLSEL = NULL;
// Site size of Ascii characters to data cache
#define GSWMESSGAEDATACHESIZE 128 #define GSWMESSGAEDATACHESIZE 128
static id GSWMessageDataCache[GSWMESSGAEDATACHESIZE]; static id GSWMessageDataCache[GSWMESSGAEDATACHESIZE];
// Default data content size
#define DEF_CONTENT_SIZE 81920 #define DEF_CONTENT_SIZE 81920
//==================================================================== //====================================================================
#ifndef NO_GNUSTEP
@interface GSWMessage (GSWMessageCachePrivate)
-(void)_cacheAppendData:(NSData*)data;
-(void)_cacheAppendBytes:(const void*)aBuffer
length:(unsigned int)bufferSize;
@end
#endif
//====================================================================
#define assertContentDataADImp(); \ #define assertContentDataADImp(); \
{ if (!_contentDataADImp) { \ { if (!_contentDataADImp) { \
_contentDataADImp=[_contentData \ _contentDataADImp=[_contentData \
methodForSelector:appendDataSel]; }; }; methodForSelector:appendDataSel]; }; };
#define assertCurrentCacheDataADImp(); \
{ if (!_currentCacheDataADImp) { \
_currentCacheDataADImp=[_currentCacheData \
methodForSelector:appendDataSel]; }; };
//==================================================================== //====================================================================
// Initialize Ascii string to data cache
void initGSWMessageDataCache(void) void initGSWMessageDataCache(void)
{ {
int i=0; int i=0;
@ -67,17 +89,19 @@ void initGSWMessageDataCache(void)
cstring[1] = 0; cstring[1] = 0;
for (i=0;i<GSWMESSGAEDATACHESIZE;i++) { for (i=0;i<GSWMESSGAEDATACHESIZE;i++)
cstring[0] = i; {
myNSString = [NSString stringWithCString:&cstring cstring[0] = (char)i;
length:1]; myNSString = [NSString stringWithCString:cstring
length:1];
myData = [myNSString dataUsingEncoding:NSASCIIStringEncoding myData = [myNSString dataUsingEncoding:NSASCIIStringEncoding
allowLossyConversion:YES]; allowLossyConversion:YES];
[myData retain]; [myData retain];
GSWMessageDataCache[i] = myData; GSWMessageDataCache[i] = myData;
} };
} }
//====================================================================
@implementation GSWMessage @implementation GSWMessage
static __inline__ NSMutableData *_checkBody(GSWMessage *self) { static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
@ -90,14 +114,21 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
return self->_contentData; return self->_contentData;
} }
//--------------------------------------------------------------------
+ (void) initialize + (void) initialize
{ {
if (self == [GSWMessage class]) if (self == [GSWMessage class])
{ {
appendStringSel = @selector(appendString:);
appendDataSel = @selector(appendData:); appendDataSel = @selector(appendData:);
globalDefaultEncoding = WOStrictFlag ? NSISOLatin1StringEncoding : GetDefEncoding() ; appendContentStringSEL = @selector(appendContentString:);
initGSWMessageDataCache();
stringByEscapingHTMLStringSEL = @selector(stringByEscapingHTMLString:);
stringByEscapingHTMLAttributeValueSEL = @selector(stringByEscapingHTMLAttributeValue:);
stringByConvertingToHTMLEntitiesSEL = @selector(stringByConvertingToHTMLEntities:);
stringByConvertingToHTMLSEL = @selector(stringByConvertingToHTML:);
globalDefaultEncoding = WOStrictFlag ? NSISOLatin1StringEncoding : GetDefEncoding();
initGSWMessageDataCache();
}; };
}; };
@ -109,9 +140,24 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
LOGObjectFnStart(); LOGObjectFnStart();
if ((self=[super init])) if ((self=[super init]))
{ {
_selfClass=[self class];
_appendContentStringIMP=[self methodForSelector:@selector(appendContentString:)];
_stringByEscapingHTMLStringIMP = [_selfClass methodForSelector:stringByEscapingHTMLStringSEL];
NSAssert(_stringByEscapingHTMLStringIMP,@"No IMP for stringByEscapingHTMLString:");
_stringByEscapingHTMLAttributeValueIMP = [_selfClass methodForSelector:stringByEscapingHTMLAttributeValueSEL];
NSAssert(_stringByEscapingHTMLAttributeValueIMP,@"No IMP for stringByEscapingHTMLAttributeValue:");
_stringByConvertingToHTMLEntitiesIMP = [_selfClass methodForSelector:stringByConvertingToHTMLEntitiesSEL];
NSAssert(_stringByConvertingToHTMLEntitiesIMP,@"No IMP for stringByConvertingToHTMLEntities:");
_stringByConvertingToHTMLIMP = [_selfClass methodForSelector:stringByConvertingToHTMLSEL];
NSAssert(_stringByConvertingToHTMLIMP,@"No IMP for stringByConvertingToHTML:");
ASSIGN(_httpVersion,@"HTTP/1.0"); ASSIGN(_httpVersion,@"HTTP/1.0");
_headers=[NSMutableDictionary new]; _headers=[NSMutableDictionary new];
_contentEncoding=[[self class] defaultEncoding]; _contentEncoding=[_selfClass defaultEncoding];
_checkBody(self); _checkBody(self);
}; };
LOGObjectFnStop(); LOGObjectFnStop();
@ -168,6 +214,11 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
#ifndef NO_GNUSTEP #ifndef NO_GNUSTEP
DESTROY(clone->_cachesStack); DESTROY(clone->_cachesStack);
clone->_cachesStack=[_cachesStack mutableCopyWithZone:zone]; clone->_cachesStack=[_cachesStack mutableCopyWithZone:zone];
if ([clone->_cachesStack count]>0)
{
clone->_currentCacheData=[clone->_cachesStack lastObject];
clone->_currentCacheDataADImp=NULL;
};
#endif #endif
}; };
return clone; return clone;
@ -376,93 +427,230 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
return [NSArray arrayWithObject:object]; return [NSArray arrayWithObject:object];
}; };
//--------------------------------------------------------------------
-(void)removeHeader:(NSString*)header
forKey:(NSString*)key
{
id object=[_headers objectForKey:key];
if (object)
{
if ([object isKindOfClass:[NSArray class]])
{
int index=[object indexOfObject:header];
if (index!=NSNotFound)
{
if ([object count]==1)
[_headers removeObjectForKey:key];
else
{
object=[[object mutableCopy]autorelease];
[object removeObjectAtIndex:index];
[self setHeaders:object
forKey:key];
};
}
}
else if ([object isEqual:header])
{
[_headers removeObjectForKey:key];
};
};
};
//--------------------------------------------------------------------
-(void)removeHeaderForKey:(NSString*)key
{
[self removeHeadersForKey:key];
}
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)removeHeadersForKey:(NSString*)key -(void)removeHeadersForKey:(NSString*)key
{ {
[_headers removeObjectForKey:key]; [_headers removeObjectForKey:key];
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/** Set content with contentData /** Set content with contentData
**/ **/
-(void)setContent:(NSData*)contentData -(void)setContent:(NSData*)contentData
{ {
LOGObjectFnStart(); LOGObjectFnStart();
[_contentData release]; DESTROY(_contentData);
_contentData = nil;
[self appendContentData:contentData]; [self appendContentData:contentData];
LOGObjectFnStop(); LOGObjectFnStop();
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// content // content
// DW
-(NSData*)content -(NSData*)content
{ {
LOGObjectFnStart();
LOGObjectFnStop();
return _contentData; return _contentData;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// DW -(NSString*)contentString
{
NSString* contentString=nil;
LOGObjectFnStart();
NS_DURING
{
contentString=AUTORELEASE([[NSString alloc] initWithData:_contentData
encoding:[self contentEncoding]]);
}
NS_HANDLER
{
NSWarnLog(@"Can't convert contentData to Strong: %@",localException);
}
NS_ENDHANDLER;
return contentString;
};
//--------------------------------------------------------------------
-(void)appendContentData:(NSData*)contentData -(void)appendContentData:(NSData*)contentData
{ {
if (contentData == nil) { LOGObjectFnStart();
return;
} NSDebugMLLog(@"low",@"contentData:%@",contentData);
_checkBody(self); if (contentData)
(*_contentDataADImp)(_contentData,appendDataSel,contentData); {
_checkBody(self);
(*_contentDataADImp)(_contentData,appendDataSel,contentData);
#ifndef NO_GNUSTEP
// Caching management
if (_currentCacheData)
{
assertCurrentCacheDataADImp();
(*_currentCacheDataADImp)(_currentCacheData,appendDataSel,contentData);
};
#endif
};
LOGObjectFnStop();
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// DW
- (void)appendContentString:(NSString *)aValue - (void)appendContentString:(NSString *)aValue
{ {
NSData *myData = nil; LOGObjectFnStart();
// checking [aValue length] takes too long! // checking [aValue length] takes too long!
if (!aValue) { if (aValue)
return; {
} NSData *myData = [aValue dataUsingEncoding:_contentEncoding
allowLossyConversion:NO];
myData = [aValue dataUsingEncoding:_contentEncoding
allowLossyConversion:NO];
if (!myData) {
NSLog(aValue);
[NSException raise:NSInvalidArgumentException
format:@"%s: could not convert '%s' non-lossy to encoding %i",
__PRETTY_FUNCTION__, [aValue lossyCString],_contentEncoding];
}
_checkBody(self); if (!myData)
(*_contentDataADImp)(_contentData,appendDataSel,myData); {
NSLog(aValue);
[NSException raise:NSInvalidArgumentException
format:@"%s: could not convert '%s' non-lossy to encoding %i",
__PRETTY_FUNCTION__, [aValue lossyCString],_contentEncoding];
}
_checkBody(self);
(*_contentDataADImp)(_contentData,appendDataSel,myData);
#ifndef NO_GNUSTEP
// Caching management
if (_currentCacheData)
{
assertCurrentCacheDataADImp();
(*_currentCacheDataADImp)(_currentCacheData,appendDataSel,myData);
};
#endif
};
LOGObjectFnStop();
} }
//--------------------------------------------------------------------
-(void)_appendContentAsciiString:(NSString*) aValue -(void)_appendContentAsciiString:(NSString*) aValue
{ {
NSData *myData = nil; LOGObjectFnStart();
char *lossyCString = NULL;
int length = 0;
int i,ch;
// checking [aValue length] takes too long!
if (!aValue) {
return;
}
lossyCString = [aValue lossyCString];
length = strlen(lossyCString);
_checkBody(self); // checking [aValue length] takes too long!
if (aValue)
{
NSData *myData = nil;
const char *lossyCString = NULL;
int length = 0;
int i = 0;
int ch = 0;
lossyCString = [aValue lossyCString];
length = strlen(lossyCString);
_checkBody(self);
for (i=0; i<length;i++) { for (i=0; i<length;i++)
ch = lossyCString[i]; {
myData=GSWMessageDataCache[ch]; ch = lossyCString[i];
(*_contentDataADImp)(_contentData,appendDataSel,myData); myData=GSWMessageDataCache[ch];
} (*_contentDataADImp)(_contentData,appendDataSel,myData);
#ifndef NO_GNUSTEP
// Caching management
if (_currentCacheData)
{
assertCurrentCacheDataADImp();
(*_currentCacheDataADImp)(_currentCacheData,appendDataSel,myData);
};
#endif
}
};
LOGObjectFnStop();
} }
//--------------------------------------------------------------------
// appendContentCharacter:
// append one ASCII char
-(void)appendContentCharacter:(char)aChar
{
NSData *myData = nil;
int i = aChar;
LOGObjectFnStart();
myData=GSWMessageDataCache[i];
if (!myData)
{
NSString* string=[NSString stringWithCString:&aChar
length:1];
if (string)
{
(*_appendContentStringIMP)(self,appendContentStringSEL,string);
}
}
else
{
_checkBody(self);
(*_contentDataADImp)(_contentData,appendDataSel,myData);
#ifndef NO_GNUSTEP
// Caching management
if (_currentCacheData)
{
assertCurrentCacheDataADImp();
(*_currentCacheDataADImp)(_currentCacheData,appendDataSel,myData);
};
#endif
}
LOGObjectFnStop();
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(int)_contentLength -(int)_contentLength
{ {
@ -503,37 +691,19 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
{ {
[_contentData appendBytes:bytes [_contentData appendBytes:bytes
length:length]; length:length];
#ifndef NO_GNUSTEP
// Caching management
if (_currentCacheData)
{
[_currentCacheData appendBytes:bytes
length:length];
};
#endif
}; };
LOGObjectFnStop(); LOGObjectFnStop();
}; };
//--------------------------------------------------------------------
// appendContentCharacter:
// append one ASCII char
-(void)appendContentCharacter:(char)aChar
{
NSString * string = nil;
NSData *myData = nil;
int i = aChar;
LOGObjectFnStart();
myData=GSWMessageDataCache[i];
if (!myData) {
string=[NSString stringWithCString:&aChar
length:1];
if (string) {
[self appendContentString:string];
}
} else {
_checkBody(self);
(*_contentDataADImp)(_contentData,appendDataSel,myData);
}
LOGObjectFnStop();
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// appendDebugCommentContentString: // appendDebugCommentContentString:
@ -542,13 +712,31 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
#ifndef NDEBUG #ifndef NDEBUG
if (GSDebugSet(@"debugComments") == YES) if (GSDebugSet(@"debugComments") == YES)
{ {
[self appendContentString:@"\n<!-- "]; (*_appendContentStringIMP)(self,appendContentStringSEL,@"\n<!-- ");
[self appendContentString:aString]; (*_appendContentStringIMP)(self,appendContentStringSEL,aString);
[self appendContentString:@" -->\n"]; (*_appendContentStringIMP)(self,appendContentStringSEL,@" -->\n");
}; };
#endif #endif
}; };
//--------------------------------------------------------------------
-(void)replaceContentData:(NSData*)replaceData
byData:(NSData*)byData
{
LOGObjectFnStart();
if ([replaceData length]>0) // is there something to replace ?
{
NSDebugMLog(@"[_contentData length]=%d",[_contentData length]);
if ([_contentData length]>0)
{
[_contentData replaceOccurrencesOfData:replaceData
withData:byData
range:NSMakeRange(0,[_contentData length])];
};
};
LOGObjectFnStop();
};
@end @end
@ -560,11 +748,14 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
-(void)appendContentHTMLAttributeValue:(NSString*)value -(void)appendContentHTMLAttributeValue:(NSString*)value
{ {
NSString* string=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"low",@"response=%p value=%@",self,value); NSDebugMLLog(@"low",@"response=%p value=%@",self,value);
string=[NSString stringWithObject:value];
[self appendContentString:[[self class]stringByEscapingHTMLAttributeValue:string]]; (*_appendContentStringIMP)(self,appendContentStringSEL,
(*_stringByEscapingHTMLAttributeValueIMP)
(_selfClass,stringByEscapingHTMLAttributeValueSEL,value));
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -573,73 +764,67 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
-(void)appendContentHTMLString:(NSString*)aString -(void)appendContentHTMLString:(NSString*)aString
{ {
NSString* string=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"low",@"aString=%@",aString); NSDebugMLLog(@"low",@"aString=%@",aString);
string=[NSString stringWithObject:aString];
NSDebugMLLog(@"low",@"string=%@",string); (*_appendContentStringIMP)(self,appendContentStringSEL,
[self appendContentString:[[self class]stringByEscapingHTMLString:string]]; (*_stringByEscapingHTMLStringIMP)
(_selfClass,stringByEscapingHTMLStringSEL,aString));
LOGObjectFnStop(); LOGObjectFnStop();
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendContentHTMLConvertString:(NSString*)aString -(void)appendContentHTMLConvertString:(NSString*)aString
{ {
NSString* string=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"low",@"aString=%@",aString); NSDebugMLLog(@"low",@"aString=%@",aString);
string=[NSString stringWithObject:aString];
NSDebugMLLog(@"low",@"string=%@",string); (*_appendContentStringIMP)(self,appendContentStringSEL,
[self appendContentString:[[self class]stringByConvertingToHTML:string]]; (*_stringByConvertingToHTMLIMP)
(_selfClass,stringByConvertingToHTMLSEL,aString));
LOGObjectFnStop(); LOGObjectFnStop();
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)appendContentHTMLEntitiesConvertString:(NSString*)aString -(void)appendContentHTMLEntitiesConvertString:(NSString*)aString
{ {
NSString* string=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"low",@"aString=%@",aString); NSDebugMLLog(@"low",@"aString=%@",aString);
string=[NSString stringWithObject:aString];
NSDebugMLLog(@"low",@"string=%@",string); (*_appendContentStringIMP)(self,appendContentStringSEL,
[self appendContentString:[[self class]stringByConvertingToHTMLEntities:string]]; (*_stringByConvertingToHTMLEntitiesIMP)
(_selfClass,stringByConvertingToHTMLEntitiesSEL,aString));
LOGObjectFnStop(); LOGObjectFnStop();
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
+(NSString*)stringByEscapingHTMLString:(NSString*)aString +(NSString*)stringByEscapingHTMLString:(NSString*)aString
{ {
NSString* string=[NSString stringWithObject:aString]; return [NSStringWithObject(aString) stringByEscapingHTMLString];
NSDebugMLLog(@"low",@"aString=%@",aString);
NSDebugMLLog(@"low",@"string=%@",string);
return [string stringByEscapingHTMLString];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
+(NSString*)stringByEscapingHTMLAttributeValue:(NSString*)aString +(NSString*)stringByEscapingHTMLAttributeValue:(NSString*)aString
{ {
NSString* string=[NSString stringWithObject:aString]; return [NSStringWithObject(aString) stringByEscapingHTMLAttributeValue];
NSDebugMLLog(@"low",@"aString=%@",aString);
NSDebugMLLog(@"low",@"string=%@",string);
return [string stringByEscapingHTMLAttributeValue];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
+(NSString*)stringByConvertingToHTMLEntities:(NSString*)aString +(NSString*)stringByConvertingToHTMLEntities:(NSString*)aString
{ {
NSString* string=[NSString stringWithObject:aString]; return [NSStringWithObject(aString) stringByConvertingToHTMLEntities];
NSDebugMLLog(@"low",@"aString=%@",aString);
NSDebugMLLog(@"low",@"string=%@",string);
return [string stringByConvertingToHTMLEntities];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
+(NSString*)stringByConvertingToHTML:(NSString*)aString +(NSString*)stringByConvertingToHTML:(NSString*)aString
{ {
NSString* string=[NSString stringWithObject:aString]; return [NSStringWithObject(aString) stringByConvertingToHTML];
NSDebugMLLog(@"low",@"aString=%@",aString);
NSDebugMLLog(@"low",@"string=%@",string);
return [string stringByConvertingToHTML];
}; };
@end @end
@ -791,3 +976,100 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
@end @end
//====================================================================
#ifndef NO_GNUSTEP
@implementation GSWMessage (GSWMessageCache)
//--------------------------------------------------------------------
-(int)startCache
{
int index=0;
LOGObjectFnStart();
if (!_cachesStack)
{
_cachesStack=[NSMutableArray new];
};
_currentCacheData=(NSMutableData*)[NSMutableData data];
_currentCacheDataADImp=NULL;
[_cachesStack addObject:_currentCacheData];
index=[_cachesStack count]-1;
LOGObjectFnStop();
return index;
};
//--------------------------------------------------------------------
-(id)stopCacheOfIndex:(int)cacheIndex
{
NSMutableData* cachedData=nil;
int cacheStackCount=0;
LOGObjectFnStart();
NSDebugMLLog(@"GSWCacheElement",@"cacheIndex=%d",cacheIndex);
cacheStackCount=[_cachesStack count];
NSDebugMLLog(@"GSWCacheElement",@"cacheStackCount=%d",cacheStackCount);
if (cacheIndex<cacheStackCount)
{
cachedData=[_cachesStack objectAtIndex:cacheIndex];
AUTORELEASE(RETAIN(cachedData));
NSDebugMLLog(@"GSWCacheElement",@"cachedData=%@",cachedData);
// Last one ? (normal case)
if (cacheIndex==(cacheStackCount-1))
{
[_cachesStack removeObjectAtIndex:cacheIndex];
}
else
{
// Strange case: may be an exception which avoided component to retrieve their cache ?
cacheIndex++;
while(cacheIndex<cacheStackCount)
{
NSData* tmp=[_cachesStack objectAtIndex:cacheIndex];
NSDebugMLLog(@"GSWCacheElement",@"tmp=%@",tmp);
[cachedData appendData:tmp];
[_cachesStack removeObjectAtIndex:cacheIndex];
};
};
cacheStackCount=[_cachesStack count];
//Add cachedData to previous cache item data
if (cacheStackCount>0)
{
_currentCacheData=[_cachesStack objectAtIndex:cacheStackCount-1];
_currentCacheDataADImp=NULL;
if ([cachedData length]>0)
{
assertCurrentCacheDataADImp();
(*_currentCacheDataADImp)(_currentCacheData,appendDataSel,cachedData);
};
}
else
{
_currentCacheData=nil;
_currentCacheDataADImp=NULL;
};
};
NSDebugMLLog(@"GSWCacheElement",@"cachedData=%@",cachedData);
LOGObjectFnStop();
return cachedData;
}
@end
#endif

View file

@ -275,21 +275,24 @@ Bindings
if (_noSelectionString) if (_noSelectionString)
{ {
id noSelectionStringValue=nil; id noSelectionStringValue=nil;
[response _appendContentAsciiString:@"\n<OPTION"];
if (_selectedValue && !selectedValueValue)
{
[response appendContentCharacter:' '];
[response _appendContentAsciiString:@"selected"];//TODO
};
[response appendContentCharacter:'>'];
noSelectionStringValue=[_noSelectionString valueInComponent:component]; noSelectionStringValue=[_noSelectionString valueInComponent:component];
if (escapeHTMLBoolValue) if (noSelectionStringValue)
noSelectionStringValue=[GSWResponse stringByEscapingHTMLString:noSelectionStringValue]; {
[response appendContentString:noSelectionStringValue]; [response _appendContentAsciiString:@"\n<OPTION"];
//[response appendContentHTMLString:_noSelectionStringValue]; if (_selectedValue && !selectedValueValue)
// There is no close tag on OPTION {
//[response _appendContentAsciiString:@"</OPTION>"]; [response appendContentCharacter:' '];
[response _appendContentAsciiString:@"selected"];//TODO
};
[response appendContentCharacter:'>'];
if (escapeHTMLBoolValue)
noSelectionStringValue=[GSWResponse stringByEscapingHTMLString:noSelectionStringValue];
[response appendContentString:noSelectionStringValue];
//[response appendContentHTMLString:_noSelectionStringValue];
// There is no close tag on OPTION
//[response _appendContentAsciiString:@"</OPTION>"];
};
}; };
NSDebugMLLog(@"gswdync",@"countValue=%d",countValue); NSDebugMLLog(@"gswdync",@"countValue=%d",countValue);
@ -299,12 +302,12 @@ Bindings
if (listValue) if (listValue)
itemValue=[listValue objectAtIndex:i]; itemValue=[listValue objectAtIndex:i];
else else
itemValue=GSWIntToNSString(i); itemValue=[NSNumber numberWithShort:i];
if (_item) if (_item)
[_item setValue:itemValue [_item setValue:itemValue
inComponent:component]; inComponent:component];
if (_index) if (_index)
[_index setValue: GSWIntToNSString(i) [_index setValue:[NSNumber numberWithShort:i]
inComponent:component]; inComponent:component];
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue); NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
@ -361,7 +364,7 @@ Bindings
}; };
[response _appendContentAsciiString:@" value=\""]; [response _appendContentAsciiString:@" value=\""];
[response _appendContentAsciiString:valueValue]; [response appendContentHTMLAttributeValue:valueValue];
[response appendContentCharacter:'"']; [response appendContentCharacter:'"'];
[response appendContentCharacter:'>']; [response appendContentCharacter:'>'];
}; };
@ -552,7 +555,7 @@ Bindings
if (listValue) if (listValue)
itemValue=[listValue objectAtIndex:i]; itemValue=[listValue objectAtIndex:i];
else else
itemValue=GSWIntToNSString(i); itemValue=[NSNumber numberWithShort:i];
NSDebugMLLog(@"gswdync",@"_itemValue=%@",itemValue); NSDebugMLLog(@"gswdync",@"_itemValue=%@",itemValue);
NSDebugMLLog(@"gswdync",@"_item=%@",_item); NSDebugMLLog(@"gswdync",@"_item=%@",_item);
@ -561,15 +564,20 @@ Bindings
inComponent:component]; inComponent:component];
if (_index) if (_index)
[_index setValue:GSWIntToNSString(i) [_index setValue:[NSNumber numberWithShort:i]
inComponent:component]; inComponent:component];
NSDebugMLLog(@"gswdync",@"value=%@",_value); NSDebugMLLog(@"gswdync",@"value=%@",_value);
if (_value) // Binded Value if (_value) // Binded Value
valueValue = [_value valueInComponent:component]; {
valueValue = [_value valueInComponent:component];
valueValueString=NSStringWithObject(valueValue);
}
else // Auto Value else // Auto Value
valueValue=GSWIntToNSString(i); {
valueValueString=[NSString stringWithFormat:@"%@",valueValue]; valueValue=[NSNumber numberWithShort:i];
valueValueString=GSWIntToNSString(i);
};
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue); NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (valueValue) if (valueValue)

View file

@ -1,9 +1,9 @@
/** GSWRadioButton.m - <title>GSWeb: Class GSWRadioButton</title> /** GSWRadioButton.m - <title>GSWeb: Class GSWRadioButton</title>
Copyright (C) 1999-2002 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
$Revision$ $Revision$
$Date$ $Date$
@ -44,6 +44,8 @@ Bindings
name Name of the element in the form (should be unique). If not specified, GSWeb assign one. name Name of the element in the form (should be unique). If not specified, GSWeb assign one.
disabled If evaluated to yes, the button appear inactivated. disabled If evaluated to yes, the button appear inactivated.
enabled If evaluated to no, the button appear inactivated.
**/ **/
//==================================================================== //====================================================================
@ -155,8 +157,8 @@ Bindings
NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue); NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue);
if (selectionValue) if (selectionValue)
{ {
NSString* valueValueString=[NSString stringWithFormat:@"%@",valueValue]; NSString* valueValueString=NSStringWithObject(valueValue);
NSString* selectionValueString=[NSString stringWithFormat:@"%@",selectionValue]; NSString* selectionValueString=NSStringWithObject(selectionValue);
isChecked=SBIsValueEqual(selectionValueString,valueValueString); isChecked=SBIsValueEqual(selectionValueString,valueValueString);
}; };
}; };
@ -206,7 +208,7 @@ Bindings
if (formValue && valueValue) if (formValue && valueValue)
{ {
NSString* valueValueString=[NSString stringWithFormat:@"%@",valueValue]; NSString* valueValueString=NSStringWithObject(valueValue);
isChecked=SBIsValueEqual(formValue,valueValueString); isChecked=SBIsValueEqual(formValue,valueValueString);
}; };
NSDebugMLLog(@"gswdync",@"isChecked=%s",(isChecked ? "YES" : "NO")); NSDebugMLLog(@"gswdync",@"isChecked=%s",(isChecked ? "YES" : "NO"));

View file

@ -241,10 +241,15 @@ Bindings
NSDebugMLLog(@"gswdync",@"value=%@",_value); NSDebugMLLog(@"gswdync",@"value=%@",_value);
if (_value) // Binded Value if (_value) // Binded Value
valueValue = [_value valueInComponent:component]; {
valueValue = [_value valueInComponent:component];
valueValueString=NSStringWithObject(valueValue);
}
else // Auto Value else // Auto Value
valueValue = [NSNumber numberWithInt:i]; {
valueValueString=[NSString stringWithFormat:@"%@",valueValue]; valueValue = [NSNumber numberWithShort:i];
valueValueString=GSWIntToNSString(i);
};
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue); NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
@ -392,12 +397,17 @@ Bindings
NSDebugMLLog(@"gswdync",@"_value (class: %@): %@",[_value class],_value); NSDebugMLLog(@"gswdync",@"_value (class: %@): %@",[_value class],_value);
// Value property of the INPUT tag // Value property of the INPUT tag
if (_value) // Binded Value if (_value) // Binded Value
valueValue = [_value valueInComponent:component]; {
valueValue = [_value valueInComponent:component];
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
[response appendContentHTMLAttributeValue:valueValue];
}
else // Auto Value else // Auto Value
valueValue = [NSNumber numberWithInt:i]; {
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue); valueValue = [NSNumber numberWithShort:i];
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
[response appendContentHTMLAttributeValue:valueValue]; [response _appendContentAsciiString:GSWIntToNSString(i)];
};
[response appendContentCharacter:'"']; [response appendContentCharacter:'"'];
NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue); NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue);

View file

@ -1,6 +1,6 @@
/** GSWRecording.m - <title>GSWeb: Class GSWRecording</title> /** GSWRecording.m - <title>GSWeb: Class GSWRecording</title>
Copyright (C) 2003 Free Software Foundation, Inc. Copyright (C) 2004 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Aug 2003 Date: Aug 2003
@ -87,7 +87,7 @@ RCS_ID("$Id$")
if (![fileManager createDirectoryAtPath:_recordingPath if (![fileManager createDirectoryAtPath:_recordingPath
attributes:nil]) attributes:nil])
{ {
ExceptionRaise(@"GSWRecording: create directory '@'",_recordingPath); ExceptionRaise(@"GSWRecording: can't create directory '%@'",_recordingPath);
}; };
}; };
LOGObjectFnStop(); LOGObjectFnStop();
@ -173,25 +173,26 @@ RCS_ID("$Id$")
-(GSWResponse*)_wildcardedResponse:(GSWResponse*)response -(GSWResponse*)_wildcardedResponse:(GSWResponse*)response
{ {
NSString* sessionID = nil; NSString* sessionID = nil;
NSMutableString* contentString = nil; NSMutableData* contentData = nil;
int contentLength=0; int contentLength=0;
NSString* applicationURLPrefix=nil; NSString* applicationURLPrefix=nil;
NSStringEncoding contentEncoding=GSUndefinedEncoding;
LOGObjectFnStart(); LOGObjectFnStart();
response = (GSWResponse*)[[response copy]autorelease]; response = (GSWResponse*)[[response copy]autorelease];
sessionID = [response headerForKey:GSWHTTPHeader_RecordingSessionID[GSWebNamingConv]]; sessionID = [response headerForKey:GSWHTTPHeader_RecordingSessionID[GSWebNamingConv]];
NSDebugMLLog(@"GSWRecording",@"sessionID=%@",sessionID); NSDebugMLLog(@"GSWRecording",@"sessionID=%@",sessionID);
contentString = [[[response contentString] mutableCopy]autorelease]; contentEncoding=[response contentEncoding];
contentLength=[contentString length]; contentData = [[[response content] mutableCopy]autorelease];
contentLength=[contentData length];
// Replace sessionID by ##GSWSESSIONID## // Replace sessionID by ##GSWSESSIONID##
if (sessionID) if (sessionID)
{ {
[contentString replaceOccurrencesOfString:sessionID [contentData replaceOccurrencesOfData:[sessionID dataUsingEncoding:contentEncoding]
withString:@"##GSWSESSIONID##" withData:[@"##GSWSESSIONID##" dataUsingEncoding:contentEncoding]
options:0 range:NSMakeRange(0,[contentData length])];
range:NSMakeRange(0,[contentString length])];
}; };
applicationURLPrefix=[_request _applicationURLPrefix]; applicationURLPrefix=[_request _applicationURLPrefix];
@ -199,17 +200,16 @@ RCS_ID("$Id$")
applicationURLPrefix); applicationURLPrefix);
NSAssert(applicationURLPrefix,@"No applicationURLPrefix"); NSAssert(applicationURLPrefix,@"No applicationURLPrefix");
[contentString replaceOccurrencesOfString:applicationURLPrefix [contentData replaceOccurrencesOfData:[applicationURLPrefix dataUsingEncoding:contentEncoding]
withString:@"##GSWAPPURLPREFIX##" withData:[@"##GSWAPPURLPREFIX##" dataUsingEncoding:contentEncoding]
options:0 range:NSMakeRange(0,[contentData length])];
range:NSMakeRange(0,[contentString length])];
// Set new Content Length // Set new Content Length
[response setHeader:GSWIntToNSString([contentString length]) [response setHeader:GSWIntToNSString([contentData length])
forKey:@"GSWHTTPHeader_ContentLength"]; forKey:@"GSWHTTPHeader_ContentLength"];
[response setHeader:GSWIntToNSString(contentLength) [response setHeader:GSWIntToNSString(contentLength)
forKey:@"x-gsweb-unwildcarded-content-length"]; forKey:@"x-gsweb-unwildcarded-content-length"];
[response setContentString:contentString]; [response setContent:contentData];
LOGObjectFnStop(); LOGObjectFnStop();
return response; return response;

View file

@ -35,9 +35,26 @@ RCS_ID("$Id$")
#include "GSWeb.h" #include "GSWeb.h"
static SEL appendZeroElementIDComponentSEL=NULL;
static SEL deleteLastElementIDComponentSEL=NULL;
static SEL startOneIterationWithIndexSEL=NULL;
static SEL stopOneIterationWithIndexSEL=NULL;
//==================================================================== //====================================================================
@implementation GSWRepetition @implementation GSWRepetition
//--------------------------------------------------------------------
+ (void) initialize
{
if (self == [GSWRepetition class])
{
appendZeroElementIDComponentSEL=@selector(appendZeroElementIDComponent);
deleteLastElementIDComponentSEL=@selector(deleteLastElementIDComponent);
startOneIterationWithIndexSEL=@selector(startOneIterationWithIndex:startIndex:list:inContext:);
stopOneIterationWithIndexSEL=@selector(stopOneIterationWithIndex:stopIndex:count:isLastOne:inContext:);
};
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(id)initWithName:(NSString*)name -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations associations:(NSDictionary*)associations
@ -243,10 +260,20 @@ RCS_ID("$Id$")
#ifndef NDEBBUG #ifndef NDEBBUG
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb]; int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
#endif #endif
IMP appendZeroElementIDComponentIMP=NULL;
IMP deleteLastElementIDComponentIMP=NULL;
IMP startOneIterationWithIndexIMP=NULL;
IMP stopOneIterationWithIndexIMP=NULL;
LOGObjectFnStart(); LOGObjectFnStart();
GSWStartElement(context); GSWStartElement(context);
GSWSaveAppendToResponseElementID(context); GSWSaveAppendToResponseElementID(context);
component=[context component]; component=[context component];
[self getParameterValuesReturnList:&listValue [self getParameterValuesReturnList:&listValue
count:&countValue count:&countValue
startIndex:&startIndexValue startIndex:&startIndexValue
@ -254,7 +281,17 @@ RCS_ID("$Id$")
withComponent:component]; withComponent:component];
NSDebugMLLog(@"gswdync",@"countValue=%d",countValue); NSDebugMLLog(@"gswdync",@"countValue=%d",countValue);
[context incrementLoopLevel]; [context incrementLoopLevel];
if (startIndexValue<=stopIndexValue)
{
appendZeroElementIDComponentIMP=[context methodForSelector:appendZeroElementIDComponentSEL];
deleteLastElementIDComponentIMP=[context methodForSelector:deleteLastElementIDComponentSEL];
startOneIterationWithIndexIMP=[self methodForSelector:startOneIterationWithIndexSEL];
stopOneIterationWithIndexIMP=[self methodForSelector:stopOneIterationWithIndexSEL];
};
for(i=startIndexValue;i<=stopIndexValue;i++) for(i=startIndexValue;i<=stopIndexValue;i++)
{ {
#ifndef NDEBUG #ifndef NDEBUG
@ -264,10 +301,14 @@ RCS_ID("$Id$")
startIndex:startIndexValue startIndex:startIndexValue
list:listValue list:listValue
inContext:context]; inContext:context];
[context appendZeroElementIDComponent];
(*appendZeroElementIDComponentIMP)(context,appendZeroElementIDComponentSEL);
[_childrenGroup appendToResponse:response [_childrenGroup appendToResponse:response
inContext:context]; inContext:context];
[context deleteLastElementIDComponent];
(*deleteLastElementIDComponentIMP)(context,deleteLastElementIDComponentSEL);
[self stopOneIterationWithIndex:i [self stopOneIterationWithIndex:i
stopIndex:stopIndexValue stopIndex:stopIndexValue
count:countValue count:countValue
@ -340,16 +381,36 @@ RCS_ID("$Id$")
#ifndef NDEBBUG #ifndef NDEBBUG
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb]; int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
#endif #endif
IMP appendZeroElementIDComponentIMP=NULL;
IMP deleteLastElementIDComponentIMP=NULL;
IMP startOneIterationWithIndexIMP=NULL;
IMP stopOneIterationWithIndexIMP=NULL;
LOGObjectFnStart(); LOGObjectFnStart();
GSWStartElement(context); GSWStartElement(context);
GSWAssertCorrectElementID(context); GSWAssertCorrectElementID(context);
component=[context component]; component=[context component];
[self getParameterValuesReturnList:&listValue [self getParameterValuesReturnList:&listValue
count:&countValue count:&countValue
startIndex:&startIndexValue startIndex:&startIndexValue
stopIndex:&stopIndexValue stopIndex:&stopIndexValue
withComponent:component]; withComponent:component];
[context incrementLoopLevel]; [context incrementLoopLevel];
if (startIndexValue<=stopIndexValue)
{
appendZeroElementIDComponentIMP=[context methodForSelector:appendZeroElementIDComponentSEL];
deleteLastElementIDComponentIMP=[context methodForSelector:deleteLastElementIDComponentSEL];
startOneIterationWithIndexIMP=[self methodForSelector:startOneIterationWithIndexSEL];
stopOneIterationWithIndexIMP=[self methodForSelector:stopOneIterationWithIndexSEL];
};
for(i=startIndexValue;i<=stopIndexValue;i++) for(i=startIndexValue;i<=stopIndexValue;i++)
{ {
#ifndef NDEBUG #ifndef NDEBUG
@ -359,10 +420,14 @@ RCS_ID("$Id$")
startIndex:startIndexValue startIndex:startIndexValue
list:listValue list:listValue
inContext:context]; inContext:context];
[context appendZeroElementIDComponent];
(*appendZeroElementIDComponentIMP)(context,appendZeroElementIDComponentSEL);
[_childrenGroup takeValuesFromRequest:request [_childrenGroup takeValuesFromRequest:request
inContext:context]; inContext:context];
[context deleteLastElementIDComponent];
(*deleteLastElementIDComponentIMP)(context,deleteLastElementIDComponentSEL);
[self stopOneIterationWithIndex:i [self stopOneIterationWithIndex:i
stopIndex:stopIndexValue stopIndex:stopIndexValue
count:countValue count:countValue
@ -401,15 +466,34 @@ RCS_ID("$Id$")
#ifndef NDEBBUG #ifndef NDEBBUG
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb]; int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
#endif #endif
IMP appendZeroElementIDComponentIMP=NULL;
IMP deleteLastElementIDComponentIMP=NULL;
IMP startOneIterationWithIndexIMP=NULL;
IMP stopOneIterationWithIndexIMP=NULL;
LOGObjectFnStart(); LOGObjectFnStart();
GSWStartElement(context); GSWStartElement(context);
component=[context component]; component=[context component];
[self getParameterValuesReturnList:&listValue [self getParameterValuesReturnList:&listValue
count:&countValue count:&countValue
startIndex:&startIndexValue startIndex:&startIndexValue
stopIndex:&stopIndexValue stopIndex:&stopIndexValue
withComponent:component]; withComponent:component];
[context incrementLoopLevel]; [context incrementLoopLevel];
if (startIndexValue<=stopIndexValue)
{
appendZeroElementIDComponentIMP=[context methodForSelector:appendZeroElementIDComponentSEL];
deleteLastElementIDComponentIMP=[context methodForSelector:deleteLastElementIDComponentSEL];
startOneIterationWithIndexIMP=[self methodForSelector:startOneIterationWithIndexSEL];
stopOneIterationWithIndexIMP=[self methodForSelector:stopOneIterationWithIndexSEL];
};
for(i=startIndexValue;!element && i<=stopIndexValue;i++) for(i=startIndexValue;!element && i<=stopIndexValue;i++)
{ {
#ifndef NDEBUG #ifndef NDEBUG
@ -419,7 +503,9 @@ RCS_ID("$Id$")
startIndex:startIndexValue startIndex:startIndexValue
list:listValue list:listValue
inContext:context]; inContext:context];
[context appendZeroElementIDComponent];
(*appendZeroElementIDComponentIMP)(context,appendZeroElementIDComponentSEL);
element=[_childrenGroup invokeActionForRequest:request element=[_childrenGroup invokeActionForRequest:request
inContext:context]; inContext:context];
NSAssert3(!element || [element isKindOfClass:[GSWElement class]], NSAssert3(!element || [element isKindOfClass:[GSWElement class]],
@ -427,7 +513,9 @@ RCS_ID("$Id$")
_childrenGroup, _childrenGroup,
[element class], [element class],
element); element);
[context deleteLastElementIDComponent];
(*deleteLastElementIDComponentIMP)(context,deleteLastElementIDComponentSEL);
[self stopOneIterationWithIndex:i [self stopOneIterationWithIndex:i
stopIndex:stopIndexValue stopIndex:stopIndexValue
count:countValue count:countValue
@ -460,11 +548,22 @@ RCS_ID("$Id$")
#ifndef NDEBBUG #ifndef NDEBBUG
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb]; int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
#endif #endif
IMP appendZeroElementIDComponentIMP=NULL;
IMP deleteLastElementIDComponentIMP=NULL;
IMP startOneIterationWithIndexIMP=NULL;
IMP stopOneIterationWithIndexIMP=NULL;
LOGObjectFnStart(); LOGObjectFnStart();
GSWStartElement(context); GSWStartElement(context);
senderID=[context senderID]; senderID=[context senderID];
NSDebugMLLog(@"gswdync",@"senderID=%@",senderID); NSDebugMLLog(@"gswdync",@"senderID=%@",senderID);
elementID=[context elementID]; elementID=[context elementID];
if ([senderID hasPrefix:elementID]) if ([senderID hasPrefix:elementID])
{ {
#ifndef NDEBUG #ifndef NDEBUG
@ -481,18 +580,32 @@ RCS_ID("$Id$")
startIndex:&startIndexValue startIndex:&startIndexValue
stopIndex:&stopIndexValue stopIndex:&stopIndexValue
withComponent:component]; withComponent:component];
[context incrementLoopLevel]; [context incrementLoopLevel];
if (startIndexValue<=stopIndexValue)
{
appendZeroElementIDComponentIMP=[context methodForSelector:appendZeroElementIDComponentSEL];
deleteLastElementIDComponentIMP=[context methodForSelector:deleteLastElementIDComponentSEL];
startOneIterationWithIndexIMP=[self methodForSelector:startOneIterationWithIndexSEL];
stopOneIterationWithIndexIMP=[self methodForSelector:stopOneIterationWithIndexSEL];
};
for(i=startIndexValue;!element && i<=stopIndexValue;i++) for(i=startIndexValue;!element && i<=stopIndexValue;i++)
{ {
[self startOneIterationWithIndex:i [self startOneIterationWithIndex:i
startIndex:startIndexValue startIndex:startIndexValue
list:listValue list:listValue
inContext:context]; inContext:context];
[context appendZeroElementIDComponent];
(*appendZeroElementIDComponentIMP)(context,appendZeroElementIDComponentSEL);
element=[_childrenGroup invokeActionForRequest:request element=[_childrenGroup invokeActionForRequest:request
inContext:context]; inContext:context];
NSDebugMLLog(@"gswdync",@"element=%@",element); NSDebugMLLog(@"gswdync",@"element=%@",element);
[context deleteLastElementIDComponent];
(*deleteLastElementIDComponentIMP)(context,deleteLastElementIDComponentSEL);
[self stopOneIterationWithIndex:i [self stopOneIterationWithIndex:i
stopIndex:stopIndexValue stopIndex:stopIndexValue
count:countValue count:countValue

View file

@ -1,6 +1,6 @@
/** GSWResourceManager.h - <title>GSWeb: Class GSWResourceManager</title> /** GSWResourceManager.h - <title>GSWeb: Class GSWResourceManager</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
@ -73,6 +73,12 @@ GSWEB_EXPORT NSDictionary* globalMime;
inFramework:(NSString*)frameworkName inFramework:(NSString*)frameworkName
languages:(NSArray*)languages; languages:(NSArray*)languages;
//NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)tableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
foundLanguage:(NSString**)foundLanguagePtr;
//NDFN //NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)tableName -(NSDictionary*)stringsTableNamed:(NSString*)tableName
inFramework:(NSString*)frameworkName inFramework:(NSString*)frameworkName
@ -91,11 +97,32 @@ GSWEB_EXPORT NSDictionary* globalMime;
inTableNamed:(NSString*)tableName inTableNamed:(NSString*)tableName
inFramework:(NSString*)framework inFramework:(NSString*)framework
languages:(NSArray*)languages; languages:(NSArray*)languages;
//NDFN
-(NSDictionary*)lockedStringsTableNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
foundLanguage:(NSString**)foundLanguagePtr;
//NDFN
-(NSString*)lockedStringForKey:(NSString*)aKey
inTableNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
foundLanguage:(NSString**)foundLanguagePtr;
//NDFN //NDFN
-(NSDictionary*)lockedStringsTableNamed:(NSString*)tableName -(NSDictionary*)lockedStringsTableNamed:(NSString*)tableName
inFramework:(NSString*)framework inFramework:(NSString*)framework
languages:(NSArray*)languages; languages:(NSArray*)languages;
//NDFN
-(NSArray*)lockedStringsTableArrayNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
foundLanguage:(NSString**)foundLanguagePtr;
//NDFN //NDFN
-(NSArray*)lockedStringsTableArrayNamed:(NSString*)tableName -(NSArray*)lockedStringsTableArrayNamed:(NSString*)tableName
inFramework:(NSString*)framework inFramework:(NSString*)framework

View file

@ -381,7 +381,8 @@ NSString* localNotFoundMarker=@"NOTFOUND";
//NDFN //NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)tableName -(NSDictionary*)stringsTableNamed:(NSString*)tableName
inFramework:(NSString*)aFrameworkName inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages; languages:(NSArray*)languages
foundLanguage:(NSString**)foundLanguagePtr
{ {
NSDictionary* stringsTable=nil; NSDictionary* stringsTable=nil;
LOGObjectFnStart(); LOGObjectFnStart();
@ -391,7 +392,8 @@ NSString* localNotFoundMarker=@"NOTFOUND";
{ {
stringsTable=[self lockedStringsTableNamed:tableName stringsTable=[self lockedStringsTableNamed:tableName
inFramework:aFrameworkName inFramework:aFrameworkName
languages:languages]; languages:languages
foundLanguage:foundLanguagePtr];
} }
NS_HANDLER NS_HANDLER
{ {
@ -407,6 +409,18 @@ NSString* localNotFoundMarker=@"NOTFOUND";
return stringsTable; return stringsTable;
}; };
//--------------------------------------------------------------------
//NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)tableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages;
{
return [self stringsTableNamed:tableName
inFramework:aFrameworkName
languages:languages
foundLanguage:NULL];
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
//NDFN //NDFN
-(NSArray*)stringsTableArrayNamed:(NSString*)tableName -(NSArray*)stringsTableArrayNamed:(NSString*)tableName
@ -468,6 +482,7 @@ NSString* localNotFoundMarker=@"NOTFOUND";
inTableNamed:(NSString*)aTableName inTableNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages languages:(NSArray*)languages
foundLanguage:(NSString**)foundLanguagePtr
{ {
//OK //OK
NSString* string=nil; NSString* string=nil;
@ -477,33 +492,41 @@ NSString* localNotFoundMarker=@"NOTFOUND";
int iFramework=0; int iFramework=0;
NSArray* frameworks=nil; NSArray* frameworks=nil;
NSString* frameworkName=nil; NSString* frameworkName=nil;
LOGObjectFnStart(); LOGObjectFnStart();
if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all]) if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all])
{ {
frameworks=[_frameworkProjectBundlesCache allKeys]; frameworks=[_frameworkProjectBundlesCache allKeys];
frameworks=[frameworks arrayByAddingObject:@""]; frameworks=[frameworks arrayByAddingObject:@""];
} }
_count=[languages count]; _count=[languages count];
NSDebugMLLog(@"resmanager",@"languages=%@",languages); NSDebugMLLog(@"resmanager",@"languages=%@",languages);
NSDebugMLLog(@"resmanager",@"frameworks=%@",frameworks); NSDebugMLLog(@"resmanager",@"frameworks=%@",frameworks);
for(i=0;!string && i<=_count;i++) for(i=0;!string && i<=_count;i++)
{ {
if (i<_count) if (i<_count)
language=[languages objectAtIndex:i]; language=[languages objectAtIndex:i];
else else
language=nil; language=nil;
for(iFramework=0;!string && iFramework<[frameworks count];iFramework++) for(iFramework=0;!string && iFramework<[frameworks count];iFramework++)
{ {
frameworkName=[frameworks objectAtIndex:iFramework]; frameworkName=[frameworks objectAtIndex:iFramework];
if ([frameworkName length]==0) if ([frameworkName length]==0)
frameworkName=nil; frameworkName=nil;
string=[self lockedCachedStringForKey:aKey string=[self lockedCachedStringForKey:aKey
inTableNamed:aTableName inTableNamed:aTableName
inFramework:frameworkName inFramework:frameworkName
language:language]; language:language];
}; if (string && foundLanguagePtr)
}; *foundLanguagePtr=language;
};
};
LOGObjectFnStop(); LOGObjectFnStop();
return string; return string;
}; };
@ -512,6 +535,7 @@ NSString* localNotFoundMarker=@"NOTFOUND";
-(NSDictionary*)lockedStringsTableNamed:(NSString*)aTableName -(NSDictionary*)lockedStringsTableNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages languages:(NSArray*)languages
foundLanguage:(NSString**)foundLanguagePtr
{ {
//OK //OK
NSDictionary* stringsTable=nil; NSDictionary* stringsTable=nil;
@ -521,7 +545,9 @@ NSString* localNotFoundMarker=@"NOTFOUND";
int iFramework=0; int iFramework=0;
NSArray* frameworks=nil; NSArray* frameworks=nil;
NSString* frameworkName=nil; NSString* frameworkName=nil;
LOGObjectFnStart(); LOGObjectFnStart();
_count=[languages count]; _count=[languages count];
if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all]) if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all])
{ {
@ -530,33 +556,66 @@ NSString* localNotFoundMarker=@"NOTFOUND";
} }
else else
frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""]; frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""];
for(i=0;!stringsTable && i<_count;i++) for(i=0;!stringsTable && i<_count;i++)
{ {
language=[languages objectAtIndex:i]; language=[languages objectAtIndex:i];
for(iFramework=0;!stringsTable && iFramework<[frameworks count];iFramework++) for(iFramework=0;!stringsTable && iFramework<[frameworks count];iFramework++)
{ {
frameworkName=[frameworks objectAtIndex:iFramework]; frameworkName=[frameworks objectAtIndex:iFramework];
if ([frameworkName length]==0) if ([frameworkName length]==0)
frameworkName=nil; frameworkName=nil;
stringsTable=[self lockedCachedStringsTableWithName:aTableName stringsTable=[self lockedCachedStringsTableWithName:aTableName
inFramework:frameworkName inFramework:frameworkName
language:language]; language:language];
}; if (stringsTable && foundLanguagePtr)
}; *foundLanguagePtr=language;
};
};
NSDebugMLLog(@"resmanager",@"lockedStringsTableNamed:%@ inFramework:%@ languages:%@: %@", NSDebugMLLog(@"resmanager",@"lockedStringsTableNamed:%@ inFramework:%@ languages:%@: %@",
aTableName, aTableName,
aFrameworkName, aFrameworkName,
languages, languages,
stringsTable); stringsTable);
LOGObjectFnStop(); LOGObjectFnStop();
return stringsTable; return stringsTable;
}; };
//--------------------------------------------------------------------
//NDFN
-(NSString*)lockedStringForKey:(NSString*)aKey
inTableNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
{
return [self lockedStringForKey:aKey
inTableNamed:aTableName
inFramework:aFrameworkName
languages:languages
foundLanguage:NULL];
};
//--------------------------------------------------------------------
//NDFN
-(NSDictionary*)lockedStringsTableNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
{
return [self lockedStringsTableNamed:aTableName
inFramework:aFrameworkName
languages:languages
foundLanguage:NULL];
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
//NDFN //NDFN
-(NSArray*)lockedStringsTableArrayNamed:(NSString*)aTableName -(NSArray*)lockedStringsTableArrayNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages languages:(NSArray*)languages
foundLanguage:(NSString**)foundLanguagePtr
{ {
//OK //OK
NSArray* stringsTableArray=nil; NSArray* stringsTableArray=nil;
@ -566,32 +625,50 @@ NSString* localNotFoundMarker=@"NOTFOUND";
int iFramework=0; int iFramework=0;
NSArray* frameworks=nil; NSArray* frameworks=nil;
NSString* frameworkName=nil; NSString* frameworkName=nil;
LOGObjectFnStart(); LOGObjectFnStart();
_count=[languages count]; _count=[languages count];
if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all]) if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all])
{ {
frameworks=[_frameworkProjectBundlesCache allKeys]; frameworks=[_frameworkProjectBundlesCache allKeys];
frameworks=[frameworks arrayByAddingObject:@""]; frameworks=[frameworks arrayByAddingObject:@""];
} }
else else
frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""]; frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""];
for(i=0;!stringsTableArray && i<_count;i++) for(i=0;!stringsTableArray && i<_count;i++)
{ {
language=[languages objectAtIndex:i]; language=[languages objectAtIndex:i];
for(iFramework=0;!stringsTableArray && iFramework<[frameworks count];iFramework++) for(iFramework=0;!stringsTableArray && iFramework<[frameworks count];iFramework++)
{ {
frameworkName=[frameworks objectAtIndex:iFramework]; frameworkName=[frameworks objectAtIndex:iFramework];
if ([frameworkName length]==0) if ([frameworkName length]==0)
frameworkName=nil; frameworkName=nil;
stringsTableArray=[self lockedCachedStringsTableArrayWithName:aTableName stringsTableArray=[self lockedCachedStringsTableArrayWithName:aTableName
inFramework:frameworkName inFramework:frameworkName
language:language]; language:language];
}; if (stringsTableArray && foundLanguagePtr)
}; *foundLanguagePtr=language;
};
};
LOGObjectFnStop(); LOGObjectFnStop();
return stringsTableArray; return stringsTableArray;
}; };
//--------------------------------------------------------------------
//NDFN
-(NSArray*)lockedStringsTableArrayNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
{
return [self lockedStringsTableArrayNamed:aTableName
inFramework:aFrameworkName
languages:languages
foundLanguage:NULL];
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)lockedCachedStringForKey:(NSString*)aKey -(NSString*)lockedCachedStringForKey:(NSString*)aKey
inTableNamed:(NSString*)aTableName inTableNamed:(NSString*)aTableName

View file

@ -1,6 +1,6 @@
/** GSWResponse.h - <title>GSWeb: Class GSWResponse</title> /** GSWResponse.h - <title>GSWeb: Class GSWResponse</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
@ -47,6 +47,7 @@
unsigned int _contentStreamBufferSize; unsigned int _contentStreamBufferSize;
unsigned long _contentStreamBufferLength; unsigned long _contentStreamBufferLength;
NSArray* _acceptedEncodings; NSArray* _acceptedEncodings;
BOOL _canDisableClientCaching;
BOOL _isClientCachingDisabled; BOOL _isClientCachingDisabled;
BOOL _contentFaultsHaveBeenResolved; BOOL _contentFaultsHaveBeenResolved;
BOOL _isFinalizeInContextHasBeenCalled; BOOL _isFinalizeInContextHasBeenCalled;
@ -62,6 +63,9 @@
-(void)disableClientCaching; -(void)disableClientCaching;
// should be called before finalizeInContext
-(void)setCanDisableClientCaching:(BOOL)yn;
@end @end
//==================================================================== //====================================================================

View file

@ -1,6 +1,6 @@
/** GSWResponse.m - <title>GSWeb: Class GSWResponse</title> /** GSWResponse.m - <title>GSWeb: Class GSWResponse</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
@ -68,6 +68,7 @@ static NSArray* cacheControlHeaderValues=nil;
LOGObjectFnStart(); LOGObjectFnStart();
if ((self=[super init])) if ((self=[super init]))
{ {
_canDisableClientCaching=YES;
_status=200; _status=200;
}; };
LOGObjectFnStop(); LOGObjectFnStop();
@ -98,6 +99,7 @@ static NSArray* cacheControlHeaderValues=nil;
ASSIGNCOPY(clone->_contentFaults,_contentFaults); ASSIGNCOPY(clone->_contentFaults,_contentFaults);
ASSIGNCOPY(clone->_acceptedEncodings,_acceptedEncodings); ASSIGNCOPY(clone->_acceptedEncodings,_acceptedEncodings);
clone->_isClientCachingDisabled=_isClientCachingDisabled; clone->_isClientCachingDisabled=_isClientCachingDisabled;
clone->_canDisableClientCaching=_canDisableClientCaching;
clone->_contentFaultsHaveBeenResolved=_contentFaultsHaveBeenResolved; clone->_contentFaultsHaveBeenResolved=_contentFaultsHaveBeenResolved;
}; };
return clone; return clone;
@ -146,11 +148,19 @@ static NSArray* cacheControlHeaderValues=nil;
return _status; return _status;
}; };
//--------------------------------------------------------------------
// should be called before finalizeInContext
-(void)setCanDisableClientCaching:(BOOL)yn
{
_canDisableClientCaching=yn;
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)disableClientCaching -(void)disableClientCaching
{ {
LOGObjectFnStart(); LOGObjectFnStart();
if (!_isClientCachingDisabled)
if (!_isClientCachingDisabled && _canDisableClientCaching)
{ {
[self setHeader:disabledCacheDateString [self setHeader:disabledCacheDateString
forKey:@"date"]; forKey:@"date"];
@ -164,6 +174,7 @@ static NSArray* cacheControlHeaderValues=nil;
forKey:@"cache-control"]; forKey:@"cache-control"];
_isClientCachingDisabled=YES; _isClientCachingDisabled=YES;
}; };
LOGObjectFnStop(); LOGObjectFnStop();
}; };

View file

@ -1,6 +1,6 @@
/** GSWSession.h - <title>GSWeb: Class GSWSession</title> /** GSWSession.h - <title>GSWeb: Class GSWSession</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
@ -59,6 +59,7 @@
BOOL _storesIDsInCookies; BOOL _storesIDsInCookies;
BOOL _storesIDsInURLs; BOOL _storesIDsInURLs;
BOOL _hasSessionLockedEditingContext; BOOL _hasSessionLockedEditingContext;
NSString* _domainForIDCookies;
}; };

View file

@ -294,6 +294,8 @@ RCS_ID("$Id$")
DESTROY(_permanentPageCache); DESTROY(_permanentPageCache);
NSDebugFLog0(@"Dealloc GSWSession: permanentContextIDArray"); NSDebugFLog0(@"Dealloc GSWSession: permanentContextIDArray");
DESTROY(_permanentContextIDArray); DESTROY(_permanentContextIDArray);
NSDebugFLog0(@"Dealloc GSWSession: domainForIDCookies");
DESTROY(_domainForIDCookies);
NSDebugFLog0(@"Dealloc GSWSession Super"); NSDebugFLog0(@"Dealloc GSWSession Super");
[super dealloc]; [super dealloc];
NSDebugFLog0(@"End Dealloc GSWSession"); NSDebugFLog0(@"End Dealloc GSWSession");
@ -366,27 +368,34 @@ RCS_ID("$Id$")
-(NSString*)domainForIDCookies -(NSString*)domainForIDCookies
{ {
//OK //OK
NSString* domain=nil;
GSWContext* context=nil;
GSWRequest* request=nil;
NSString* applicationName=nil;
NSString* adaptorPrefix=nil;
LOGObjectFnStart(); LOGObjectFnStart();
[[GSWApplication application]lock];
context=[self context]; if (!_domainForIDCookies)
request=[context request]; {
applicationName=[request applicationName]; GSWContext* context=nil;
NSDebugMLLog(@"sessions",@"applicationName=%@",applicationName); GSWRequest* request=nil;
adaptorPrefix=[request adaptorPrefix]; NSString* applicationName=nil;
NSDebugMLLog(@"sessions",@"adaptorPrefix=%@",adaptorPrefix); NSString* adaptorPrefix=nil;
[[GSWApplication application]unlock]; [[GSWApplication application]lock];
domain=[NSString stringWithFormat:@"%@/%@.%@", context=[self context];
adaptorPrefix, request=[context request];
applicationName, applicationName=[request applicationName];
GSWApplicationSuffix[GSWebNamingConv]]; NSDebugMLLog(@"sessions",@"applicationName=%@",applicationName);
NSDebugMLLog(@"sessions",@"domain=%@",domain); adaptorPrefix=[request adaptorPrefix];
NSDebugMLLog(@"sessions",@"adaptorPrefix=%@",adaptorPrefix);
[[GSWApplication application]unlock];
ASSIGN(_domainForIDCookies,
([NSString stringWithFormat:@"%@/%@.%@",
adaptorPrefix,
applicationName,
GSWApplicationSuffix[GSWebNamingConv]]));
};
NSDebugMLLog(@"sessions",@"_domainForIDCookies=%@",_domainForIDCookies);
LOGObjectFnStop(); LOGObjectFnStop();
return domain;
return _domainForIDCookies;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -866,22 +875,34 @@ RCS_ID("$Id$")
NSString* domainForIDCookies=nil; NSString* domainForIDCookies=nil;
NSString* sessionID=nil; NSString* sessionID=nil;
NSDate* anExpireDate=nil; NSDate* anExpireDate=nil;
GSWCookie* sessionIDCookie=nil;
GSWCookie* instanceIDCookie=nil;
LOGObjectFnStart(); LOGObjectFnStart();
domainForIDCookies=[self domainForIDCookies]; domainForIDCookies=[self domainForIDCookies];
sessionID=[self sessionID]; sessionID=[self sessionID];
anExpireDate=[NSDate date]; // Expire now anExpireDate=[NSDate date]; // Expire now
[aResponse addCookie:[GSWCookie cookieWithName:GSWKey_SessionID[GSWebNamingConv]
value:sessionID sessionIDCookie=[GSWCookie cookieWithName:GSWKey_SessionID[GSWebNamingConv]
path:domainForIDCookies value:sessionID
domain:nil path:domainForIDCookies
expires:anExpireDate domain:nil
isSecure:NO]]; expires:anExpireDate
[aResponse addCookie:[GSWCookie cookieWithName:GSWKey_InstanceID[GSWebNamingConv] isSecure:NO];
value:@"-1" NSDebugMLLog(@"sessions",@"sessionIDCookie=%@",sessionIDCookie);
path:domainForIDCookies
domain:nil [aResponse addCookie:sessionIDCookie];
expires:anExpireDate
isSecure:NO]]; instanceIDCookie=[GSWCookie cookieWithName:GSWKey_InstanceID[GSWebNamingConv]
value:@"-1"
path:domainForIDCookies
domain:nil
expires:anExpireDate
isSecure:NO];
NSDebugMLLog(@"sessions",@"instanceIDCookie=%@",instanceIDCookie);
[aResponse addCookie:instanceIDCookie];
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -1569,8 +1590,7 @@ Returns first element of languages or nil if languages is empty
// awake // awake
-(void)awake -(void)awake
{ {
//ok DESTROY(_domainForIDCookies);
//Does Nothing
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -1578,7 +1598,9 @@ Returns first element of languages or nil if languages is empty
-(void)sleep -(void)sleep
{ {
//Does Nothing // We destroy domainForIDCookies because applictaion name may
// change between pages
DESTROY(_domainForIDCookies);
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View file

@ -1,6 +1,6 @@
/** GSWString.h - <title>GSWeb: Class GSWString</title> /** GSWString.h - <title>GSWeb: Class GSWString</title>
Copyright (C) 1999-2002 Free Software Foundation, Inc. Copyright (C) 1999-2002,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
@ -46,14 +46,10 @@
GSWAssociation* _formatter; GSWAssociation* _formatter;
}; };
-(void)dealloc;
-(id)initWithName:(NSString*)name -(id)initWithName:(NSString*)name
associations:(NSDictionary*)associations associations:(NSDictionary*)associations
contentElements:(NSArray*)elements; contentElements:(NSArray*)elements;
-(NSString*)description;
-(void)appendToResponse:(GSWResponse*)response -(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context; inContext:(GSWContext*)context;
@ -66,6 +62,7 @@
-(NSFormatter*)formatterForComponent:(GSWComponent*)component -(NSFormatter*)formatterForComponent:(GSWComponent*)component
value:(id)value; value:(id)value;
-(NSString*)elementName; -(NSString*)elementName;
-(NSString*)formattedValueInContext:(GSWContext*)context;
@end @end
//==================================================================== //====================================================================

View file

@ -1,6 +1,6 @@
/** GSWString.m - <title>GSWeb: Class GSWString</title> /** GSWString.m - <title>GSWeb: Class GSWString</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
@ -121,37 +121,23 @@ RCS_ID("$Id$")
GSWRequest* request=nil; GSWRequest* request=nil;
BOOL isFromClientComponent=NO; BOOL isFromClientComponent=NO;
GSWComponent* component=nil; GSWComponent* component=nil;
id valueValue = nil;
LOGObjectFnStartC("GSWString"); LOGObjectFnStartC("GSWString");
GSWStartElement(context); GSWStartElement(context);
GSWSaveAppendToResponseElementID(context); GSWSaveAppendToResponseElementID(context);
request=[context request]; request=[context request];
isFromClientComponent=[request isFromClientComponent]; isFromClientComponent=[request isFromClientComponent];
component=[context component]; component=[context component];
NSDebugMLLog(@"gswdync",@"GSWString: component=%@",component);
NSDebugMLLog(@"gswdync",@"GSWString: value=%@",_value); formattedValue=[self formattedValueInContext:context];
valueValue = [_value valueInComponent:component];
NSDebugMLLog(@"gswdync",@"GSWString: valueValue=%@",valueValue); if (formattedValue)
if (valueValue)
{ {
BOOL escapeHTMLValue=YES; BOOL escapeHTMLValue=YES;
BOOL convertHTMLValue=NO; BOOL convertHTMLValue=NO;
BOOL convertHTMLEntitiesValue=NO; BOOL convertHTMLEntitiesValue=NO;
NSFormatter* formatter=[self formatterForComponent:component
value:valueValue];
if (!formatter)
{
formattedValue=valueValue;
// if we dont do this we get an exception on NSNumbers later. dave at turbocat.de
if ([formattedValue isKindOfClass:[NSNumber class]]) {
formattedValue = [(id)formattedValue stringValue];
}
}
else
{
formattedValue=[formatter stringForObjectValue:valueValue];
NSDebugMLLog(@"gswdync",@"valueValue=%@ formattedValue=%@",valueValue,formattedValue);
};
if (!WOStrictFlag && _convertHTML) if (!WOStrictFlag && _convertHTML)
convertHTMLValue=[self evaluateCondition:_convertHTML convertHTMLValue=[self evaluateCondition:_convertHTML
@ -184,7 +170,9 @@ RCS_ID("$Id$")
else else
[response appendContentString:formattedValue]; [response appendContentString:formattedValue];
}; };
GSWStopElement(context); GSWStopElement(context);
LOGObjectFnStopC("GSWString"); LOGObjectFnStopC("GSWString");
}; };
@ -249,6 +237,47 @@ RCS_ID("$Id$")
return nil; return nil;
}; };
//--------------------------------------------------------------------
// return formatted value
-(NSString*)formattedValueInContext:(GSWContext*)context
{
NSString* formattedValue=nil;
GSWComponent* component=nil;
id valueValue = nil;
LOGObjectFnStartC("GSWString");
component=[context component];
NSDebugMLLog(@"gswdync",@"GSWString: value=%@",_value);
valueValue = [_value valueInComponent:component];
NSDebugMLLog(@"gswdync",@"GSWString: valueValue=%@",valueValue);
if (valueValue)
{
NSFormatter* formatter=[self formatterForComponent:component
value:valueValue];
if (!formatter)
{
formattedValue=valueValue;
// if we dont do this we get an exception on NSNumbers later. dave at turbocat.de
if ([formattedValue isKindOfClass:[NSNumber class]])
{
formattedValue = [(id)formattedValue stringValue];
}
}
else
{
formattedValue=[formatter stringForObjectValue:valueValue];
NSDebugMLLog(@"gswdync",@"valueValue=%@ formattedValue=%@",valueValue,formattedValue);
};
}
LOGObjectFnStopC("GSWString");
return formattedValue;
};
@end @end

View file

@ -406,4 +406,15 @@ typedef enum _NSNumFmtType
range: (NSRange)searchRange; range: (NSRange)searchRange;
@end @end
//====================================================================
// this should be in Gnustep base / extensions
@interface NSString (EncodingDataExt)
+ (id)stringWithContentsOfFile:(NSString *)path
encoding:(NSStringEncoding)encoding;
+ (NSStringEncoding) encodingNamed:(NSString*) encodingName;
@end
#endif // _GSWebUtils_h__ #endif // _GSWebUtils_h__

View file

@ -78,68 +78,26 @@ char* GSWIntToString(char* buffer,unsigned int bufferSize,int value,unsigned int
return buffer; return buffer;
}; };
NSString* cachedStringForInt(int value) NSString* cachedStringForInt(int value)
{ {
switch(value) static NSString* cachedString[] = {
{ @"0", @"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9",
case 0: return @"0"; break; @"10", @"11", @"12", @"13", @"14", @"15", @"16", @"17", @"18", @"19",
case 1: return @"1"; break; @"20", @"21", @"22", @"23", @"24", @"25", @"26", @"27", @"28", @"29",
case 2: return @"2"; break; @"30", @"31", @"32", @"33", @"34", @"35", @"36", @"37", @"38", @"39",
case 3: return @"3"; break; @"40", @"41", @"42", @"43", @"44", @"45", @"46", @"47", @"48", @"49",
case 4: return @"4"; break; @"50", @"51", @"52", @"53", @"54", @"55", @"56", @"57", @"58", @"59",
case 5: return @"5"; break; @"60", @"61", @"62", @"63", @"64", @"65", @"66", @"67", @"68", @"69",
case 6: return @"6"; break; @"70", @"71", @"72", @"73", @"74", @"75", @"76", @"77", @"78", @"79",
case 7: return @"7"; break; @"80", @"81", @"82", @"83", @"84", @"85", @"86", @"87", @"88", @"89",
case 8: return @"8"; break; @"90", @"91", @"92", @"93", @"94", @"95", @"96", @"97", @"98", @"99" };
case 9: return @"9"; break; if (value>=0 && value <100)
case 10: return @"10"; break; return cachedString[value];
case 11: return @"11"; break; else
case 12: return @"12"; break;
case 13: return @"13"; break;
case 14: return @"14"; break;
case 15: return @"15"; break;
case 16: return @"16"; break;
case 17: return @"17"; break;
case 18: return @"18"; break;
case 19: return @"19"; break;
case 20: return @"20"; break;
case 21: return @"21"; break;
case 22: return @"22"; break;
case 23: return @"23"; break;
case 24: return @"24"; break;
case 25: return @"25"; break;
case 26: return @"26"; break;
case 27: return @"27"; break;
case 28: return @"28"; break;
case 29: return @"29"; break;
case 30: return @"30"; break;
case 31: return @"31"; break;
case 33: return @"33"; break;
case 34: return @"34"; break;
case 35: return @"35"; break;
case 36: return @"36"; break;
case 37: return @"37"; break;
case 38: return @"38"; break;
case 39: return @"39"; break;
case 40: return @"49"; break;
case 41: return @"41"; break;
case 42: return @"42"; break;
case 43: return @"43"; break;
case 44: return @"44"; break;
case 45: return @"45"; break;
case 46: return @"46"; break;
case 47: return @"47"; break;
case 48: return @"48"; break;
case 49: return @"49"; break;
case 50: return @"50"; break;
default:
break;
};
return nil; return nil;
} }
NSString* GSWIntToNSString(int value) NSString* GSWIntToNSString(int value)
{ {
NSString* s=nil; NSString* s=nil;
@ -244,6 +202,10 @@ BOOL SBIsEqual(id id1,id id2)
{ {
if (id2) if (id2)
equal=[id1 isEqual:id2]; equal=[id1 isEqual:id2];
}
else if (!id2)
{
equal=YES;
}; };
return equal; return equal;
}; };
@ -257,12 +219,12 @@ BOOL SBIsValueEqual(id id1,id id2)
{ {
if ([id1 isKindOfClass:[NSString class]]) if ([id1 isKindOfClass:[NSString class]])
{ {
NSString* id2String=[NSString stringWithObject:id2]; NSString* id2String=NSStringWithObject(id2);
equal=[id1 isEqualToString:id2String]; equal=[id1 isEqualToString:id2String];
} }
else if ([id2 isKindOfClass:[NSString class]]) else if ([id2 isKindOfClass:[NSString class]])
{ {
NSString* id1String=[NSString stringWithObject:id1]; NSString* id1String=NSStringWithObject(id1);
equal=[id2 isEqualToString:id1String]; equal=[id2 isEqualToString:id1String];
}; };
}; };
@ -1872,3 +1834,146 @@ NSString* GSWGetDefaultDocRoot()
return count; return count;
} }
@end @end
//====================================================================
// this should be in Gnustep base / extensions
@implementation NSString (EncodingDataExt)
+ (id)stringWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)encoding
{
NSData * tmpData = nil;
NSString * tmpString = nil;
if ((tmpData = [NSData dataWithContentsOfFile: path]))
{
tmpString = [NSString alloc];
tmpString = [tmpString initWithData:tmpData
encoding:encoding];
if (!tmpString) {
NSLog(@"%s NO STRING for path '%@' encoding:%d", __PRETTY_FUNCTION__, path, encoding);
[NSException raise:NSInvalidArgumentException
format:@"%s: could not open convert file contents '%s' non-lossy to encoding %i",
__PRETTY_FUNCTION__, path, encoding];
}
[tmpString autorelease];
}
return tmpString;
}
#warning XXX TODO MultiTread protection
+ (NSStringEncoding) encodingNamed:(NSString*) encodingName
{
static NSMapTable* encodingsByName=NULL;
NSStringEncoding encoding=GSUndefinedEncoding;
if (!encodingsByName)
{
encodingsByName=NSCreateMapTable(NSObjectMapKeyCallBacks,
NSIntMapValueCallBacks,
32);
NSMapInsert(encodingsByName,
@"NSISOLatin1StringEncoding",
(const void*)NSISOLatin1StringEncoding);
NSMapInsert(encodingsByName,
@"NSASCIIStringEncoding",
(const void*)NSASCIIStringEncoding);
NSMapInsert(encodingsByName,
@"NSISOLatin2StringEncoding",
(const void*)NSISOLatin2StringEncoding);
NSMapInsert(encodingsByName,
@"NSJapaneseEUCStringEncoding",
(const void*)NSJapaneseEUCStringEncoding);
NSMapInsert(encodingsByName,
@"NSMacOSRomanStringEncoding",
(const void*)NSMacOSRomanStringEncoding);
NSMapInsert(encodingsByName,
@"NSNEXTSTEPStringEncoding",
(const void*)NSNEXTSTEPStringEncoding);
NSMapInsert(encodingsByName,
@"NSNonLossyASCIIStringEncoding",
(const void*)NSNonLossyASCIIStringEncoding);
NSMapInsert(encodingsByName,
@"NSUTF8StringEncoding",
(const void*)NSUTF8StringEncoding);
NSMapInsert(encodingsByName,
@"NSUnicodeStringEncoding",
(const void*)NSUnicodeStringEncoding);
NSMapInsert(encodingsByName,
@"NSWindowsCP1253StringEncoding",
(const void*)NSWindowsCP1253StringEncoding);
NSMapInsert(encodingsByName,
@"NSWindowsCP1252StringEncoding",
(const void*)NSWindowsCP1252StringEncoding);
NSMapInsert(encodingsByName,
@"NSWindowsCP1254StringEncoding",
(const void*)NSWindowsCP1254StringEncoding);
}
encoding=(NSStringEncoding)NSMapGet(encodingsByName,(const void*)encodingName);
if (!encoding)
[NSException raise:NSInvalidArgumentException
format:@"%s: does not know about '%s'",
__PRETTY_FUNCTION__, encodingName];
return encoding;
/*
if ([encodingName isEqualToString:@"NSISOLatin1StringEncoding"])
{
return NSISOLatin1StringEncoding;
}
if ([encodingName isEqualToString:@"NSASCIIStringEncoding"])
{
return NSASCIIStringEncoding;
}
if ([encodingName isEqualToString:@"NSISOLatin2StringEncoding"])
{
return NSISOLatin2StringEncoding;
}
if ([encodingName isEqualToString:@"NSJapaneseEUCStringEncoding"])
{
return NSJapaneseEUCStringEncoding;
}
if ([encodingName isEqualToString:@"NSMacOSRomanStringEncoding"])
{
return NSMacOSRomanStringEncoding;
}
if ([encodingName isEqualToString:@"NSNEXTSTEPStringEncoding"])
{
return NSNEXTSTEPStringEncoding;
}
if ([encodingName isEqualToString:@"NSNonLossyASCIIStringEncoding"])
{
return NSNonLossyASCIIStringEncoding;
}
if ([encodingName isEqualToString:@"NSUTF8StringEncoding"])
{
return NSUTF8StringEncoding;
}
if ([encodingName isEqualToString:@"NSUnicodeStringEncoding"])
{
return NSUnicodeStringEncoding;
}
if ([encodingName isEqualToString:@"NSWindowsCP1253StringEncoding"])
{
return NSWindowsCP1253StringEncoding;
}
if ([encodingName isEqualToString:@"NSWindowsCP1252StringEncoding"])
{
return NSWindowsCP1252StringEncoding;
}
if ([encodingName isEqualToString:@"NSWindowsCP1254StringEncoding"])
{
return NSWindowsCP1254StringEncoding;
}
[NSException raise:NSInvalidArgumentException
format:@"%s: does not know about '%s'",
__PRETTY_FUNCTION__, encodingName];
return 0; // to make gcc happy
*/
}
@end

View file

@ -1,6 +1,6 @@
/** NSString+HTML.m - <title>GSWeb: NSString / HTML</title> /** NSString+HTML.m - <title>GSWeb: NSString / HTML</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
@ -509,7 +509,18 @@ initHtmlChars()
if ([self length]>0) if ([self length]>0)
{ {
//TODO speed //TODO speed
NSMutableString* tmp=[[self stringByConvertingToHTMLEntities] mutableCopy]; //From -stringByConvertingToHTMLEntities
int i=0;
NSMutableString* tmp=[self mutableCopy];
if (!normalChars)
initHtmlChars();
for(i=0;i<[normalChars count];i++)
{
[tmp replaceString:[normalChars objectAtIndex:i]
withString:[htmlChars objectAtIndex:i]];
};
//End From -stringByConvertingToHTMLEntities
[tmp replaceString:@"\r\n" withString:@"<BR>"]; [tmp replaceString:@"\r\n" withString:@"<BR>"];
[tmp replaceString:@"\r" withString:@"<BR>"]; [tmp replaceString:@"\r" withString:@"<BR>"];
[tmp replaceString:@"\n" withString:@"<BR>"]; [tmp replaceString:@"\n" withString:@"<BR>"];
@ -526,7 +537,18 @@ initHtmlChars()
if ([self length]>0) if ([self length]>0)
{ {
//TODO speed //TODO speed
NSMutableString* tmp=[[self stringByConvertingFromHTMLEntities] mutableCopy]; //From -stringByConvertingFromHTMLEntities
int i=0;
NSMutableString* tmp=[self mutableCopy];
if (!normalChars)
initHtmlChars();
for(i=0;i<[normalChars count];i++)
{
[tmp replaceString:[htmlChars objectAtIndex:i]
withString:[normalChars objectAtIndex:i]];
};
//End From -stringByConvertingFromHTMLEntities
[tmp replaceString:@"<BR>" withString:@"\n"]; [tmp replaceString:@"<BR>" withString:@"\n"];
str = AUTORELEASE([tmp copy]); str = AUTORELEASE([tmp copy]);
RELEASE(tmp); RELEASE(tmp);

View file

@ -63,6 +63,8 @@
@end @end
//==================================================================== //====================================================================
GSWEB_EXPORT NSString* NSStringWithObject(id object);
@interface NSString (stringWithObject) @interface NSString (stringWithObject)
+(NSString*)stringWithObject:(id)object; +(NSString*)stringWithObject:(id)object;
@end @end

View file

@ -202,21 +202,39 @@ RCS_ID("$Id$")
@end @end
//==================================================================== //====================================================================
@implementation NSString (stringWithObject)
//-------------------------------------------------------------------- NSString* NSStringWithObject(id object)
+(NSString*)stringWithObject:(id)object
{ {
//TODO MultiThread Protection ?
static Class theNSStringClass=Nil;
static Class theNSMutableStringClass=Nil;
static Class theEONullClass=Nil;
static Class theNSNullClass=Nil;
if (!theNSStringClass)
theNSStringClass=[NSString class];
if (!theNSMutableStringClass)
theNSMutableStringClass=[NSMutableString class];
if (!theEONullClass)
theEONullClass=[EONull class];
if (!theNSNullClass)
theNSNullClass=[NSNull class];
NSString* string=nil; NSString* string=nil;
if (object) if (object)
{ {
if ([object isKindOfClass:[NSString class]]) if ([object isKindOfClass:theNSMutableStringClass])
string=[[object copy] autorelease]; string=AUTORELEASE([object copy]);
else if ([object isKindOfClass:theNSStringClass])
string=(NSString*)object;
#ifdef HAVE_GDL2 #ifdef HAVE_GDL2
else if ([object isKindOfClass:[EONull class]]) else if ([object isKindOfClass:theEONullClass])
string=@""; string=@"";
#else #else
else if ([object isKindOfClass:[NSNull class]]) else if ([object isKindOfClass:theNSNullClass])
string=@""; string=@"";
#endif #endif
else if ([object respondsToSelector:@selector(stringValue)]) else if ([object respondsToSelector:@selector(stringValue)])
@ -228,6 +246,14 @@ RCS_ID("$Id$")
}; };
return string; return string;
}; };
@implementation NSString (stringWithObject)
//--------------------------------------------------------------------
+(NSString*)stringWithObject:(id)object
{
return NSStringWithObject(object);
};
@end @end
//==================================================================== //====================================================================