mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-04-23 15:33:43 +00:00
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:
parent
298e88df3c
commit
087b9ed45d
55 changed files with 2341 additions and 902 deletions
126
ChangeLog
126
ChangeLog
|
@ -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>
|
||||
|
||||
* GSWeb.framework/GSWMessage.m
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/* 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>
|
||||
Date: Apr 1999
|
||||
Date: Apr 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -42,6 +43,8 @@
|
|||
-(NSString*)imageFileName;
|
||||
-(id)label;
|
||||
-(NSString*)helpString;
|
||||
-(BOOL)isDisabled;
|
||||
-(BOOL)shouldDisplay;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -75,7 +75,12 @@ RCS_ID("$Id$")
|
|||
NSDebugMLog(@"_isVisibleConditionPassed=%s",(_isVisibleConditionPassed ? "YES" : "NO"));
|
||||
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;
|
||||
};
|
||||
NSDebugMLog(@"_isVisible=%s",(_isVisible ? "YES" : "NO"));
|
||||
|
@ -203,20 +208,22 @@ RCS_ID("$Id$")
|
|||
};
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(id)isDisabled
|
||||
-(BOOL)isDisabled
|
||||
{
|
||||
id isDisabled=NO;
|
||||
BOOL isDisabled=NO;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
if ([self hasBinding:@"disabled"])
|
||||
isDisabled=[self valueForBinding:@"disabled"];
|
||||
isDisabled=boolValueFor([self valueForBinding:@"disabled"]);
|
||||
else if ([self hasBinding:@"enabled"])
|
||||
{
|
||||
BOOL isEnabled=boolValueFor([self valueForBinding:@"enabled"]);
|
||||
isDisabled=[NSNumber numberWithBool:(isEnabled ? NO : YES)];
|
||||
isDisabled=(isEnabled ? NO : YES);
|
||||
};
|
||||
|
||||
NSDebugMLog(@"isDisabled=%s",(isDisabled ? "YES" : "NO"));
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
return isDisabled;
|
||||
|
@ -229,11 +236,13 @@ RCS_ID("$Id$")
|
|||
|
||||
LOGObjectFnStart();
|
||||
|
||||
if (boolValueFor([self isDisabled])
|
||||
if ([self isDisabled]
|
||||
&& [self hasBinding:@"displayDisabled"]
|
||||
&& !boolValueFor([self valueForBinding:@"displayDisabled"]))
|
||||
shouldDisplay=NO;
|
||||
|
||||
NSDebugMLog(@"shouldDisplay=%s",(shouldDisplay ? "YES" : "NO"));
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
return shouldDisplay;
|
||||
|
|
|
@ -72,27 +72,27 @@ Bindings
|
|||
|
||||
_cachedObject = [[associations objectForKey:@"cachedObject"
|
||||
withDefaultObject:[_cachedObject autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"cachedObject=%@",_cachedObject);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"cachedObject=%@",_cachedObject);
|
||||
|
||||
_cache = [[associations objectForKey:@"cache"
|
||||
withDefaultObject:[_cache autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"cache=%@",_cache);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"cache=%@",_cache);
|
||||
|
||||
_duration = [[associations objectForKey:@"duration"
|
||||
withDefaultObject:[_duration autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"duration=%@",_duration);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"duration=%@",_duration);
|
||||
|
||||
_uniqID = [[associations objectForKey:@"uniqID"
|
||||
withDefaultObject:[_uniqID autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"uniqID=%@",_uniqID);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"uniqID=%@",_uniqID);
|
||||
|
||||
_disabled = [[associations objectForKey:disabled__Key
|
||||
withDefaultObject:[_disabled autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"disabled=%@",_disabled);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"disabled=%@",_disabled);
|
||||
|
||||
_enabled = [[associations objectForKey:enabled__Key
|
||||
withDefaultObject:[_enabled autorelease]] retain];
|
||||
NSDebugMLLog(@"gswdync",@"enabled=%@",_enabled);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"enabled=%@",_enabled);
|
||||
|
||||
if (_disabled && _enabled)
|
||||
{
|
||||
|
@ -189,11 +189,11 @@ Bindings
|
|||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)setDefinitionName:(NSString*)definitionName
|
||||
-(void)setDeclarationName:(NSString*)declarationName
|
||||
{
|
||||
[super setDefinitionName:definitionName];
|
||||
if (definitionName && _childrenGroup)
|
||||
[_childrenGroup setDefinitionName:[NSString stringWithFormat:@"%@-StaticGroup",definitionName]];
|
||||
[super setDeclarationName:declarationName];
|
||||
if (declarationName && _childrenGroup)
|
||||
[_childrenGroup setDeclarationName:[NSString stringWithFormat:@"%@-StaticGroup",declarationName]];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -254,19 +254,19 @@ Bindings
|
|||
[aContext appendElementIDComponent:[NSString stringWithFormat:@"CacheElement-%@",uniqID]];
|
||||
|
||||
contextAndElementID=[aContext contextAndElementID];
|
||||
NSDebugMLog(@"contextAndElementID=%@",contextAndElementID);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"contextAndElementID=%@",contextAndElementID);
|
||||
|
||||
elementID=[[[aContext elementID] copy]autorelease]; // because elementID is mutable (and varying)
|
||||
NSDebugMLog(@"elementID=%@",elementID);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"elementID=%@",elementID);
|
||||
|
||||
sessionID=[[aContext session] sessionID];
|
||||
NSDebugMLog(@"sessionID=%@",sessionID);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"sessionID=%@",sessionID);
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"isDisabled=%d",isDisabled);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"isDisabled=%d",isDisabled);
|
||||
|
||||
if (!isDisabled)
|
||||
{
|
||||
id cachedObject=nil;
|
||||
NSMutableData* cachedObject=nil;
|
||||
if (_cachedObject)
|
||||
cachedObject=[_cachedObject valueInComponent:component];
|
||||
else
|
||||
|
@ -276,17 +276,17 @@ Bindings
|
|||
{
|
||||
GSWAssociation* assoc=[_keys objectAtIndex:i];
|
||||
keys[i]=[assoc valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"keys[%d]=%@",i,keys[i]);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"keys[%d]=%@",i,keys[i]);
|
||||
if (!keys[i])
|
||||
{
|
||||
keys[i]=[NSNull null];
|
||||
NSDebugMLLog(@"gswdync",@"keys[%d]=%@",i,keys[i]);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"keys[%d]=%@",i,keys[i]);
|
||||
};
|
||||
};
|
||||
cachedObject=[cache objectForKeys:keys
|
||||
count:keysCount];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"cachedObject=%p",cachedObject);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"cachedObject=%p",cachedObject);
|
||||
|
||||
contextAndElementIDCacheKey=[NSString stringWithFormat:@"##CONTEXT_ELEMENT_ID-%@##",
|
||||
uniqID];
|
||||
|
@ -295,55 +295,33 @@ Bindings
|
|||
|
||||
if (cachedObject)
|
||||
{
|
||||
NSLog(@"GSWCacheElement5: sessionID=%@",sessionID);
|
||||
NSLog(@"GSWCacheElement5: elementID=%@",elementID);
|
||||
NSLog(@"GSWCacheElement5: contextAndElementID=%@",contextAndElementID);
|
||||
cacheUsed=YES;
|
||||
cachedObject=[[cachedObject mutableCopy] autorelease];
|
||||
cachedObject=AUTORELEASE([cachedObject mutableCopy]);
|
||||
//NSLog(@"GSWCacheElement: cachedObject found=%@",cachedObject);
|
||||
if ([cachedObject isKindOfClass:[NSString class]])
|
||||
{
|
||||
NSDebugMLog(@"cachedObject=%@",cachedObject);
|
||||
|
||||
[(NSMutableString*)cachedObject replaceOccurrencesOfString:contextAndElementIDCacheKey
|
||||
withString:contextAndElementID
|
||||
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]]
|
||||
[cachedObject replaceOccurrencesOfData:[contextAndElementIDCacheKey dataUsingEncoding:[aResponse contentEncoding]]
|
||||
withData:[contextAndElementID dataUsingEncoding:[aResponse contentEncoding]]
|
||||
range:NSMakeRange(0,[cachedObject length])];
|
||||
|
||||
[cachedObject replaceOccurrencesOfData:[elementIDCacheKey dataUsingEncoding:[aResponse contentEncoding]]
|
||||
withData:[elementID dataUsingEncoding:[aResponse contentEncoding]]
|
||||
range:NSMakeRange(0,[cachedObject length])];
|
||||
|
||||
[(NSMutableData*)cachedObject replaceOccurrencesOfData:[elementIDCacheKey dataUsingEncoding:[aResponse contentEncoding]]
|
||||
withData:[elementID dataUsingEncoding:[aResponse contentEncoding]]
|
||||
range:NSMakeRange(0,[cachedObject length])];
|
||||
|
||||
[(NSMutableData*)cachedObject replaceOccurrencesOfData:[@"##SESSION_ID##" dataUsingEncoding:[aResponse contentEncoding]]
|
||||
withData:[sessionID dataUsingEncoding:[aResponse contentEncoding]]
|
||||
range:NSMakeRange(0,[cachedObject length])];
|
||||
[aResponse appendContentData:(NSData*)cachedObject];
|
||||
}
|
||||
|
||||
[cachedObject replaceOccurrencesOfData:[@"##SESSION_ID##" dataUsingEncoding:[aResponse contentEncoding]]
|
||||
withData:[sessionID dataUsingEncoding:[aResponse contentEncoding]]
|
||||
range:NSMakeRange(0,[cachedObject length])];
|
||||
[aResponse appendContentData:cachedObject];
|
||||
}
|
||||
else
|
||||
{
|
||||
_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)
|
||||
{
|
||||
NSLog(@"GSWCacheElement Children Start Date=%@",[NSDate date]);
|
||||
|
@ -354,48 +332,29 @@ Bindings
|
|||
|
||||
if (!cacheUsed && !isDisabled)
|
||||
{
|
||||
id cachedObject=[aResponse stopCacheOfIndex:_cacheIndex];
|
||||
NSDebugMLLog(@"gswdync",@"cachedObject=%p",cachedObject);
|
||||
if ([cachedObject isKindOfClass:[NSMutableString class]])
|
||||
{
|
||||
NSDebugMLog(@"cachedObject=%@",cachedObject);
|
||||
[(NSMutableString*)cachedObject replaceOccurrencesOfString:contextAndElementID
|
||||
withString:contextAndElementIDCacheKey
|
||||
options:0
|
||||
range:NSMakeRange(0,[cachedObject length])];
|
||||
|
||||
[(NSMutableString*)cachedObject replaceOccurrencesOfString:elementID
|
||||
withString:elementIDCacheKey
|
||||
options:0
|
||||
range:NSMakeRange(0,[cachedObject length])];
|
||||
|
||||
[(NSMutableString*)cachedObject replaceOccurrencesOfString:sessionID
|
||||
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])];
|
||||
};
|
||||
NSMutableData* cachedObject=[aResponse stopCacheOfIndex:_cacheIndex];
|
||||
NSDebugMLLog(@"GSWCacheElement",@"cachedObject=%p",cachedObject);
|
||||
NSLog(@"GSWCacheElement6: sessionID=%@",sessionID);
|
||||
NSLog(@"GSWCacheElement6: elementID=%@",elementID);
|
||||
NSLog(@"GSWCacheElement6: contextAndElementID=%@",contextAndElementID);
|
||||
[cachedObject replaceOccurrencesOfData:[contextAndElementID dataUsingEncoding:[aResponse contentEncoding]]
|
||||
withData:[contextAndElementIDCacheKey dataUsingEncoding:[aResponse contentEncoding]]
|
||||
range:NSMakeRange(0,[cachedObject length])];
|
||||
|
||||
[cachedObject replaceOccurrencesOfData:[elementID dataUsingEncoding:[aResponse contentEncoding]]
|
||||
withData:[elementIDCacheKey dataUsingEncoding:[aResponse contentEncoding]]
|
||||
range:NSMakeRange(0,[cachedObject length])];
|
||||
|
||||
[cachedObject replaceOccurrencesOfData:[sessionID dataUsingEncoding:[aResponse contentEncoding]]
|
||||
withData:[@"##SESSION_ID##" dataUsingEncoding:[aResponse contentEncoding]]
|
||||
range:NSMakeRange(0,[cachedObject length])];
|
||||
if (_cachedObject)
|
||||
[_cachedObject setValue:cachedObject
|
||||
inComponent:component];
|
||||
else
|
||||
{
|
||||
id duration=[_duration valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"duration=%@",duration);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"duration=%@",duration);
|
||||
if (duration)
|
||||
{
|
||||
NSTimeInterval ts=0;
|
||||
|
@ -422,7 +381,7 @@ Bindings
|
|||
|
||||
[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]);
|
||||
|
||||
|
@ -490,7 +449,7 @@ Bindings
|
|||
element=[_childrenGroup invokeActionForRequest:aRequest
|
||||
inContext:aContext];
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"element=%@",element);
|
||||
NSDebugMLLog(@"GSWCacheElement",@"element=%@",element);
|
||||
NSAssert2(!element || [element isKindOfClass:[GSWElement class]],
|
||||
@"Element is a %@ not a GSWElement: %@",
|
||||
[element class],
|
||||
|
|
|
@ -41,6 +41,92 @@ ImageWithURL: GSWImage
|
|||
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
|
||||
{
|
||||
data = fileInfo.data;
|
||||
|
|
|
@ -1,23 +1,40 @@
|
|||
<table border="0">
|
||||
<gsweb name="ViewCondition">
|
||||
<gsweb name="ViewPathCondition">
|
||||
<gsweb name="LinkViewCondition">
|
||||
<gsweb name="FileLinkWithPath"></gsweb>
|
||||
<tr><td colspan="2" align="center"><gsweb name="FileLinkWithPath"></gsweb></td></tr>
|
||||
</gsweb>
|
||||
<gsweb name="ImageViewCondition">
|
||||
<gsweb name="ImageWithPath"></gsweb>
|
||||
<tr><td colspan="2" align="center"><gsweb name="ImageWithPath"></gsweb></td></tr>
|
||||
</gsweb>
|
||||
</gsweb>
|
||||
<gsweb name="ViewURLCondition">
|
||||
<gsweb name="LinkViewCondition">
|
||||
<gsweb name="FileLinkWithURL"></gsweb>
|
||||
<tr><td colspan="2" align="center"><gsweb name="FileLinkWithURL"></gsweb></td></tr>
|
||||
</gsweb>
|
||||
<gsweb name="ImageViewCondition">
|
||||
<gsweb name="ImageWithURL"></gsweb>
|
||||
<tr><td colspan="2" align="center"><gsweb name="ImageWithURL"></gsweb></td></tr>
|
||||
</gsweb>
|
||||
</gsweb>
|
||||
</gsweb>
|
||||
<br>
|
||||
<gsweb name="UploadFile"></gsweb><br>
|
||||
<gsweb name="DeleteCondition">
|
||||
<gsweb name="DeleteCheckBoxTitle"></gsweb><gsweb name="DeleteCheckBox"></gsweb>
|
||||
<gsweb name="IsFileNameDisplay">
|
||||
<tr><td colspan="2"><gsweb name="FileName"></gsweb></td></tr>
|
||||
</gsweb>
|
||||
<gsweb name="DeleteCondition">
|
||||
<tr><th align="right"><gsweb name="DeleteCheckBoxTitle"></gsweb> : </td><td><gsweb name="DeleteCheckBox"></gsweb></td></tr>
|
||||
</gsweb>
|
||||
<gsweb name="HasWidthAndHeight">
|
||||
<gsweb name="HasWidthAndHeightList">
|
||||
<tr><th align="right"><gsweb name="WidthAndHeightListTitle"></gsweb> : </td><td><gsweb name="WidthAndHeightList"></gsweb></td></tr>
|
||||
</gsweb>
|
||||
<gsweb name="IsCustomWidthAndHeightEnabled">
|
||||
<tr><th align="right"><gsweb name="WidthTitle"></gsweb> x <gsweb name="HeightTitle"></gsweb> : </td><td><gsweb name="WidthField" size="6"></gsweb> x <gsweb name="HeightField" size="6"></gsweb></td></tr>
|
||||
</gsweb>
|
||||
</gsweb>
|
||||
<gsweb name="HasUploadFileTitle">
|
||||
<tr><th align="right"><gsweb name="UploadFileTitle"></gsweb> : </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>
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
@interface GSWFileUploadComponent : GSWComponent
|
||||
{
|
||||
NSMutableDictionary* _tmpFileInfo;
|
||||
id _tmpWithAndHeight;
|
||||
};
|
||||
|
||||
-(NSMutableDictionary*)fileInfo;
|
||||
|
|
|
@ -70,6 +70,7 @@ RCS_ID("$Id$")
|
|||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(_tmpWithAndHeight);
|
||||
[super dealloc];
|
||||
};
|
||||
|
||||
|
@ -109,7 +110,9 @@ RCS_ID("$Id$")
|
|||
NSDebugMLog(@"fileInfo.data %p",[_tmpFileInfo valueForKey:@"data"]);
|
||||
NSDebugMLog(@"fileInfo.data length %d",(int)[[_tmpFileInfo valueForKey:@"data"] length]);
|
||||
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))
|
||||
[self setValue:_tmpFileInfo
|
||||
forBinding:@"fileInfo"];
|
||||
|
@ -172,6 +175,50 @@ RCS_ID("$Id$")
|
|||
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
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/** 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>
|
||||
Date: Feb 1999
|
||||
Date: Feb 1999
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
@ -64,7 +64,9 @@
|
|||
|
||||
//====================================================================
|
||||
@interface GSWAction (GSWActionA)
|
||||
-(GSWContext*)context;
|
||||
-(GSWContext*)_context;
|
||||
-(GSWSession*)session;
|
||||
-(GSWSession*)_session;
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/** 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>
|
||||
Date: Feb 1999
|
||||
Date: Feb 1999
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
@ -196,6 +196,7 @@ RCS_ID("$Id$")
|
|||
LOGObjectFnStart();
|
||||
NS_DURING
|
||||
{
|
||||
NSAssert(_context,@"No Context");
|
||||
component=[[GSWApplication application]pageWithName:pageName
|
||||
inContext:_context];
|
||||
}
|
||||
|
@ -282,12 +283,13 @@ RCS_ID("$Id$")
|
|||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)setLanguages:(NSArray*)languages
|
||||
{
|
||||
[_context _setLanguages:languages];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(NSArray*)languages
|
||||
{
|
||||
return [_context languages];
|
||||
|
@ -297,16 +299,29 @@ RCS_ID("$Id$")
|
|||
|
||||
//====================================================================
|
||||
@implementation GSWAction (GSWActionA)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(GSWContext*)context
|
||||
{
|
||||
return [self _context];
|
||||
};
|
||||
|
||||
-(GSWContext*)_context
|
||||
{
|
||||
//OK
|
||||
return _context;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(GSWSession*)session
|
||||
{
|
||||
return [self _session];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(GSWSession*)_session
|
||||
{
|
||||
return nil;//TODO?
|
||||
return [_context session];
|
||||
};
|
||||
|
||||
@end
|
||||
|
|
|
@ -343,18 +343,22 @@ RCS_ID("$Id$")
|
|||
requestHandlerPathArray);
|
||||
|
||||
// Parse path into actionClassName,actionClass and actionName
|
||||
|
||||
// Be carefull: there's no context created for the moment
|
||||
NS_DURING
|
||||
{ [self getRequestActionClassNameInto:&actionClassName
|
||||
classInto:&actionClass
|
||||
nameInto:&actionName
|
||||
forPath:requestHandlerPathArray];
|
||||
NSDebugMLLog(@"requests",@"className=%@",actionClassName);
|
||||
NSDebugMLLog(@"requests",@"actionClass=%@",actionClass);
|
||||
NSDebugMLLog(@"requests",@"actionName=%@",actionName);
|
||||
{
|
||||
[self getRequestActionClassNameInto:&actionClassName
|
||||
classInto:&actionClass
|
||||
nameInto:&actionName
|
||||
forPath:requestHandlerPathArray];
|
||||
NSDebugMLLog(@"requests",@"className=%@",actionClassName);
|
||||
NSDebugMLLog(@"requests",@"actionClass=%@",actionClass);
|
||||
NSDebugMLLog(@"requests",@"actionName=%@",actionName);
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
LOGException(@"%@ (%@)",localException,[localException reason]);
|
||||
// Be carefull: there's no context created for the moment
|
||||
response=[application handleActionRequestErrorWithRequest:aRequest
|
||||
exception:localException
|
||||
reason:@"InvalidPathError"
|
||||
|
@ -363,7 +367,7 @@ RCS_ID("$Id$")
|
|||
actionName:actionName
|
||||
actionClass:actionClass
|
||||
actionObject:action];
|
||||
[localException raise];
|
||||
[localException raise]; // Will be caught be up level Exception
|
||||
};
|
||||
NS_ENDHANDLER;
|
||||
|
||||
|
@ -379,6 +383,7 @@ RCS_ID("$Id$")
|
|||
|
||||
NS_DURING
|
||||
{
|
||||
// Will also create context
|
||||
action=[self getActionInstanceOfClass:actionClass
|
||||
withRequest:aRequest];
|
||||
}
|
||||
|
@ -393,7 +398,7 @@ RCS_ID("$Id$")
|
|||
actionName:actionName
|
||||
actionClass:actionClass
|
||||
actionObject:action];
|
||||
[localException raise];
|
||||
[localException raise];// Will be caught be up level Exception
|
||||
};
|
||||
NS_ENDHANDLER;
|
||||
|
||||
|
@ -415,7 +420,7 @@ RCS_ID("$Id$")
|
|||
actionName:actionName
|
||||
actionClass:actionClass
|
||||
actionObject:action];
|
||||
[localException raise];
|
||||
[localException raise]; // Will be caught be up level Exception
|
||||
};
|
||||
NS_ENDHANDLER;
|
||||
|
||||
|
@ -464,7 +469,7 @@ RCS_ID("$Id$")
|
|||
};
|
||||
NSDebugMLog(@"Exception=%@",exception);
|
||||
NSDebugMLog(@"Response=%@",response);
|
||||
[exception raise];
|
||||
[exception raise]; // Will be caught be up level Exception
|
||||
NSDebugMLog(@"Not raised ? Exception=%@",exception);
|
||||
};
|
||||
if ([application isCachingEnabled])
|
||||
|
|
|
@ -258,7 +258,7 @@ Bindings
|
|||
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
|
||||
|
||||
if (_index)
|
||||
[_index setValue:GSWIntToNSString(i)
|
||||
[_index setValue:[NSNumber numberWithShort:i]
|
||||
inComponent:component];
|
||||
|
||||
if (itemValue)
|
||||
|
@ -268,7 +268,7 @@ Bindings
|
|||
if (_value) // Binded Value
|
||||
valueValue = [_value valueInComponent:component];
|
||||
else // Auto Value
|
||||
valueValue = GSWIntToNSString(i);
|
||||
valueValue = [NSNumber numberWithShort:i];
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
|
||||
if (valueValue)
|
||||
|
@ -299,7 +299,7 @@ Bindings
|
|||
};
|
||||
|
||||
[response _appendContentAsciiString:@" value=\""];
|
||||
[response _appendContentAsciiString:valueValue];
|
||||
[response appendContentHTMLAttributeValue:valueValue];
|
||||
[response appendContentCharacter:'"'];
|
||||
|
||||
[response appendContentCharacter:'>'];
|
||||
|
@ -457,16 +457,20 @@ Bindings
|
|||
inComponent:component];
|
||||
|
||||
if (_index)
|
||||
[_index setValue:GSWIntToNSString(i)
|
||||
[_index setValue:[NSNumber numberWithShort:i]
|
||||
inComponent:component];
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",_value);
|
||||
if (_value) // Binded Value
|
||||
valueValue = [_value valueInComponent:component];
|
||||
{
|
||||
valueValue = [_value valueInComponent:component];
|
||||
valueValueString=NSStringWithObject(valueValue);
|
||||
}
|
||||
else // Auto Value
|
||||
valueValue = GSWIntToNSString(i);
|
||||
#warning XXX SPEED UP THIS
|
||||
valueValueString=[NSString stringWithFormat:@"%@",valueValue];
|
||||
{
|
||||
valueValue = GSWIntToNSString(i);
|
||||
valueValueString=valueValue;
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
|
||||
if (valueValue)
|
||||
|
|
|
@ -77,96 +77,7 @@ objectForReference:(NSString*)keyPath
|
|||
|
||||
@end
|
||||
#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
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
@ -160,8 +160,8 @@ Bindings
|
|||
NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue);
|
||||
if (selectionValue)
|
||||
{
|
||||
NSString* valueValueString=[NSString stringWithFormat:@"%@",valueValue];
|
||||
NSString* selectionValueString=[NSString stringWithFormat:@"%@",selectionValue];
|
||||
NSString* valueValueString=NSStringWithObject(valueValue);
|
||||
NSString* selectionValueString=NSStringWithObject(selectionValue);
|
||||
isChecked=SBIsValueEqual(selectionValueString,valueValueString);
|
||||
};
|
||||
};
|
||||
|
@ -217,7 +217,7 @@ Bindings
|
|||
|
||||
if (formValues && [formValues count]>0 && valueValue)
|
||||
{
|
||||
NSString* valueValueString=[NSString stringWithFormat:@"%@",valueValue];
|
||||
NSString* valueValueString=NSStringWithObject(valueValue);
|
||||
isChecked=[formValues containsObject:valueValueString];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"isChecked=%s",(isChecked ? "YES" : "NO"));
|
||||
|
|
|
@ -259,10 +259,15 @@ Bindings
|
|||
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",_value);
|
||||
if (_value) // Binded Value
|
||||
valueValue = [_value valueInComponent:component];
|
||||
{
|
||||
valueValue = [_value valueInComponent:component];
|
||||
valueValueString=NSStringWithObject(valueValue);
|
||||
}
|
||||
else // Auto Value
|
||||
valueValue = [NSNumber numberWithInt:i];
|
||||
valueValueString=[NSString stringWithFormat:@"%@",valueValue];
|
||||
{
|
||||
valueValue = GSWIntToNSString(i);
|
||||
valueValueString=valueValue;
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
|
||||
if (valueValue)
|
||||
|
@ -441,12 +446,17 @@ Bindings
|
|||
NSDebugMLLog(@"gswdync",@"_value (class: %@): %@",[_value class],_value);
|
||||
// Value property of the INPUT tag
|
||||
if (_value) // Binded Value
|
||||
valueValue = [_value valueInComponent:component];
|
||||
{
|
||||
valueValue = [_value valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
[response appendContentHTMLAttributeValue:valueValue];
|
||||
}
|
||||
else // Auto Value
|
||||
valueValue = [NSNumber numberWithInt:i];
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
|
||||
[response appendContentHTMLAttributeValue:valueValue];
|
||||
{
|
||||
valueValue = GSWIntToNSString(i);
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
[response _appendContentAsciiString:valueValue];
|
||||
}
|
||||
[response appendContentCharacter:'"'];
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"selectionsValue=%@",selectionsValue);
|
||||
|
|
|
@ -68,8 +68,10 @@
|
|||
-(void)setUserDictionary:(NSDictionary*)userDictionary;
|
||||
-(NSDictionary*)userAssociations;
|
||||
-(void)setUserAssociations:(NSDictionary*)userAssociations;
|
||||
-(GSWAssociation*)userAssociationForKey:(NSString*)key;
|
||||
-(NSDictionary*)defaultAssociations;
|
||||
-(void)setDefaultAssociations:(NSDictionary*)defaultAssociations;
|
||||
-(GSWAssociation*)defaultAssociationForKey:(NSString*)key;
|
||||
#endif
|
||||
-(NSString*)frameworkName;
|
||||
-(NSString*)baseURL;
|
||||
|
|
|
@ -289,38 +289,57 @@ RCS_ID("$Id$")
|
|||
};
|
||||
|
||||
// GSWeb Additions {
|
||||
//--------------------------------------------------------------------
|
||||
-(NSDictionary*)userDictionary
|
||||
{
|
||||
return _userDictionary;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)setUserDictionary:(NSDictionary*)aUserDictionary
|
||||
{
|
||||
ASSIGN(_userDictionary,aUserDictionary);
|
||||
NSDebugMLLog(@"GSWComponent",@"userDictionary:%@",_userDictionary);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(NSDictionary*)userAssociations
|
||||
{
|
||||
return _userAssociations;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)setUserAssociations:(NSDictionary*)userAssociations
|
||||
{
|
||||
ASSIGN(_userAssociations,userAssociations);
|
||||
NSDebugMLLog(@"GSWComponent",@"userAssociations:%@",_userAssociations);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(GSWAssociation*)userAssociationForKey:(NSString*)key
|
||||
{
|
||||
return [[self userAssociations]objectForKey:key];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(NSDictionary*)defaultAssociations
|
||||
{
|
||||
return _defaultAssociations;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)setDefaultAssociations:(NSDictionary*)defaultAssociations
|
||||
{
|
||||
ASSIGN(_defaultAssociations,defaultAssociations);
|
||||
NSDebugMLLog(@"GSWComponent",@"defaultAssociations:%@",_defaultAssociations);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(GSWAssociation*)defaultAssociationForKey:(NSString*)key
|
||||
{
|
||||
return [[self defaultAssociations]objectForKey:key];
|
||||
};
|
||||
|
||||
// }
|
||||
|
||||
@end
|
||||
|
@ -399,7 +418,8 @@ associationsKeys:(NSArray*)associationsKeys
|
|||
&& ![anAssociation isKindOfClass:[GSWBindingNameAssociation class]]) //TODOV
|
||||
{
|
||||
aValue=[self valueForKey:aKey];
|
||||
NSDebugMLLog(@"GSWComponent",@"aKey=%@ aValue=%@",aKey,aValue);
|
||||
NSDebugMLLog(@"GSWComponent",@"aKey=%@ aValue=%@ (%@)",
|
||||
aKey,aValue,NSStringFromClass([aValue class]));
|
||||
if (doLog)
|
||||
[anAssociation logSynchronizeComponentToParentForValue:aValue
|
||||
inComponent:_parent];
|
||||
|
@ -437,7 +457,8 @@ associationsKeys:(NSArray*)associationsKeys
|
|||
if (![anAssociation isKindOfClass:[GSWBindingNameAssociation class]]) //TODOV
|
||||
{
|
||||
aValue=[anAssociation valueInComponent:_parent];
|
||||
NSDebugMLLog(@"GSWComponent",@"aKey=%@ aValue=%@",aKey,aValue);
|
||||
NSDebugMLLog(@"GSWComponent",@"aKey=%@ aValue=%@ (%@)",
|
||||
aKey,aValue,NSStringFromClass([aValue class]));
|
||||
if (doLog)
|
||||
[anAssociation logSynchronizeParentToComponentForValue:aValue
|
||||
inComponent:self];
|
||||
|
@ -787,7 +808,9 @@ associationsKeys:(NSArray*)associationsKeys
|
|||
GSWAssociation* assoc=nil;
|
||||
unsigned int index=NSNotFound;
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"GSWComponent",@"_associationsKeys=%@",_associationsKeys);
|
||||
NSDebugMLLog(@"GSWComponent",@"In %@ Search %@ _associationsKeys=%@",
|
||||
NSStringFromClass([self class]),
|
||||
aName,_associationsKeys);
|
||||
//NSDebugMLLog(@"GSWComponent",@"_associations=%@",[_associations description]);
|
||||
if (_associationsKeys)
|
||||
{
|
||||
|
@ -800,7 +823,9 @@ associationsKeys:(NSArray*)associationsKeys
|
|||
{
|
||||
assoc=[_defaultAssociations objectForKey:aName];
|
||||
};
|
||||
NSDebugMLLog(@"GSWComponent",@"assoc=%@",assoc);
|
||||
NSDebugMLLog(@"GSWComponent",@"In %@ Association for %@=%@",
|
||||
NSStringFromClass([self class]),
|
||||
aName,assoc);
|
||||
LOGObjectFnStop();
|
||||
return assoc;
|
||||
};
|
||||
|
@ -843,15 +868,18 @@ associationsKeys:(NSArray*)associationsKeys
|
|||
//OK
|
||||
GSWAssociation* assoc=nil;
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"GSWComponent",@"declarationName=%@ - parentBindingName_=%@",
|
||||
NSDebugMLLog(@"GSWComponent",@"self=%@ declarationName=%@ - parentBindingName_=%@",
|
||||
NSStringFromClass([self class]),
|
||||
[self declarationName],
|
||||
parentBindingName);
|
||||
NSDebugMLLog(@"GSWComponent",@"value_=%@",value);
|
||||
NSDebugMLLog(@"GSWComponent",@"_parent=%p",(void*)_parent);
|
||||
NSDebugMLLog(@"GSWComponent",@"_parent=%p of class %@",
|
||||
(void*)_parent,
|
||||
NSStringFromClass([_parent class]));
|
||||
if (_parent)
|
||||
{
|
||||
assoc=[self _associationWithName:parentBindingName];
|
||||
NSDebugMLLog(@"GSWComponent",@"assoc=%@",assoc);
|
||||
NSDebugMLLog(@"GSWComponent",@"assoc for %@=%@",parentBindingName,assoc);
|
||||
if(assoc)
|
||||
[assoc setValue:value
|
||||
inComponent:_parent];
|
||||
|
@ -910,7 +938,8 @@ associationsKeys:(NSArray*)associationsKeys
|
|||
}
|
||||
#endif
|
||||
*/
|
||||
NSDebugMLLog(@"GSWComponent",@"aValue=%@",aValue);
|
||||
NSDebugMLLog(@"GSWComponent",@"parentBindingName=%@ aValue=%@ (%@)",
|
||||
parentBindingName,aValue,NSStringFromClass([aValue class]));
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
return aValue;
|
||||
|
|
|
@ -396,6 +396,7 @@ GSWEB_EXPORT id cidKey__Key;
|
|||
GSWEB_EXPORT id isDisplayStringBefore__Key;
|
||||
GSWEB_EXPORT id urlPrefix__Key;
|
||||
GSWEB_EXPORT id pathQueryDictionary__Key;
|
||||
GSWEB_EXPORT id omitElement__Key;
|
||||
|
||||
#endif // _GSWebConstants_h__
|
||||
|
||||
|
|
|
@ -393,3 +393,4 @@ id cidKey__Key = @"cidKey";
|
|||
id isDisplayStringBefore__Key = @"isDisplayStringBefore";
|
||||
id urlPrefix__Key = @"urlPrefix";
|
||||
id pathQueryDictionary__Key = @"pathQueryDictionary";
|
||||
id omitElement__Key = @"omitElement";
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
Date: Jan 1999
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
@ -57,6 +57,7 @@
|
|||
BOOL _pageReplaced;
|
||||
BOOL _generateCompleteURLs;
|
||||
BOOL _isInForm;
|
||||
BOOL _isInEnabledForm;
|
||||
BOOL _actionInvoked;
|
||||
BOOL _formSubmitted;
|
||||
BOOL _isMultipleSubmitForm;
|
||||
|
@ -75,6 +76,8 @@
|
|||
|
||||
-(void)setInForm:(BOOL)flag;
|
||||
-(BOOL)isInForm;
|
||||
-(void)setInEnabledForm:(BOOL)flag;
|
||||
-(BOOL)isInEnabledForm;
|
||||
-(GSWElementIDString*)elementID;
|
||||
-(NSString*)contextAndElementID;
|
||||
-(GSWComponent*)component;
|
||||
|
@ -145,6 +148,7 @@
|
|||
queryString:(NSString*)queryString
|
||||
isSecure:(BOOL)isSecure
|
||||
port:(int)port;
|
||||
|
||||
-(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey
|
||||
path:(NSString*)requestHandlerPath
|
||||
queryString:(NSString*)queryString
|
||||
|
@ -156,6 +160,12 @@
|
|||
path:(NSString*)requestHandlerPath
|
||||
queryString:(NSString*)queryString;
|
||||
|
||||
-(GSWDynamicURLString*)urlWithURLPrefix:(NSString*)urlPrefix
|
||||
RequestHandlerKey:(NSString*)requestHandlerKey
|
||||
path:(NSString*)requestHandlerPath
|
||||
queryString:(NSString*)queryString
|
||||
isSecure:(BOOL)isSecure;
|
||||
|
||||
-(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey
|
||||
path:(NSString*)requestHandlerPath
|
||||
queryString:(NSString*)queryString;
|
||||
|
@ -166,6 +176,12 @@
|
|||
path:(NSString*)requestHandlerPath
|
||||
queryString:(NSString*)queryString;
|
||||
|
||||
//NDFN
|
||||
-(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey
|
||||
path:(NSString*)requestHandlerPath
|
||||
queryString:(NSString*)queryString
|
||||
isSecure:(BOOL)isSecure;
|
||||
|
||||
//NDFN
|
||||
-(GSWDynamicURLString*)completeURLWithRequestHandlerKey:(NSString*)requestHandlerKey
|
||||
path:(NSString*)requestHandlerPath
|
||||
|
|
|
@ -214,6 +214,18 @@ static int dontTraceComponentActionURL=0;
|
|||
return _isInForm;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)setInEnabledForm:(BOOL)flag
|
||||
{
|
||||
_isInEnabledForm=flag;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(BOOL)isInEnabledForm
|
||||
{
|
||||
return _isInEnabledForm;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// elementID
|
||||
-(GSWElementIDString*)elementID
|
||||
|
@ -286,7 +298,7 @@ static int dontTraceComponentActionURL=0;
|
|||
|
||||
if (!_session)
|
||||
{
|
||||
NSDebugMLog(@"_requestSessionID=%@",_requestSessionID);
|
||||
NSDebugMLLog(@"sessions",@"_requestSessionID=%@",_requestSessionID);
|
||||
if (_requestSessionID)
|
||||
[GSWApp restoreSessionWithID:_requestSessionID
|
||||
inContext:self];//Application call context _setSession
|
||||
|
@ -380,12 +392,16 @@ static int dontTraceComponentActionURL=0;
|
|||
queryDictionary:(NSDictionary*)queryDictionary
|
||||
{
|
||||
GSWDynamicURLString* url=nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
url=[self directActionURLForActionNamed:actionName
|
||||
urlPrefix:urlPrefix
|
||||
queryDictionary:queryDictionary
|
||||
isSecure:NO];
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
return url;
|
||||
};
|
||||
|
||||
|
@ -393,9 +409,17 @@ static int dontTraceComponentActionURL=0;
|
|||
-(GSWDynamicURLString*)directActionURLForActionNamed:(NSString*)actionName
|
||||
queryDictionary:(NSDictionary*)queryDictionary
|
||||
{
|
||||
return [self directActionURLForActionNamed:actionName
|
||||
urlPrefix:nil
|
||||
queryDictionary:queryDictionary];
|
||||
GSWDynamicURLString* url=nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
url=[self directActionURLForActionNamed:actionName
|
||||
urlPrefix:nil
|
||||
queryDictionary:queryDictionary];
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
return url;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -405,12 +429,17 @@ static int dontTraceComponentActionURL=0;
|
|||
pathQueryDictionary:(NSDictionary*)pathQueryDictionary
|
||||
{
|
||||
GSWDynamicURLString* url=nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
url=[self directActionURLForActionNamed:actionName
|
||||
urlPrefix:urlPrefix
|
||||
queryDictionary:queryDictionary
|
||||
pathQueryDictionary:pathQueryDictionary];
|
||||
pathQueryDictionary:pathQueryDictionary
|
||||
isSecure:NO];
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
return url;
|
||||
};
|
||||
|
||||
|
@ -419,10 +448,18 @@ static int dontTraceComponentActionURL=0;
|
|||
queryDictionary:(NSDictionary*)queryDictionary
|
||||
pathQueryDictionary:(NSDictionary*)pathQueryDictionary
|
||||
{
|
||||
return [self directActionURLForActionNamed:actionName
|
||||
GSWDynamicURLString* url=nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
url=[self directActionURLForActionNamed:actionName
|
||||
urlPrefix:nil
|
||||
queryDictionary:queryDictionary
|
||||
pathQueryDictionary:pathQueryDictionary];
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
return url;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -432,13 +469,17 @@ static int dontTraceComponentActionURL=0;
|
|||
isSecure:(BOOL)isSecure
|
||||
{
|
||||
GSWDynamicURLString* url=nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
url=[self directActionURLForActionNamed:actionName
|
||||
urlPrefix:urlPrefix
|
||||
queryDictionary:queryDictionary
|
||||
pathQueryDictionary:nil
|
||||
isSecure:NO];
|
||||
isSecure:isSecure];
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
return url;
|
||||
};
|
||||
|
||||
|
@ -447,10 +488,18 @@ static int dontTraceComponentActionURL=0;
|
|||
queryDictionary:(NSDictionary*)queryDictionary
|
||||
isSecure:(BOOL)isSecure
|
||||
{
|
||||
return [self directActionURLForActionNamed:actionName
|
||||
urlPrefix:nil
|
||||
queryDictionary:queryDictionary
|
||||
isSecure:isSecure];
|
||||
GSWDynamicURLString* url=nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
url=[self directActionURLForActionNamed:actionName
|
||||
urlPrefix:nil
|
||||
queryDictionary:queryDictionary
|
||||
isSecure:isSecure];
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -471,7 +520,7 @@ static int dontTraceComponentActionURL=0;
|
|||
isSecure:isSecure
|
||||
url:url];
|
||||
|
||||
NSDebugMLog(@"url=%@",url);
|
||||
NSDebugMLLog(@"GSWContext",@"url=%@",url);
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
|
@ -495,16 +544,19 @@ static int dontTraceComponentActionURL=0;
|
|||
-(GSWDynamicURLString*)componentActionURL
|
||||
{
|
||||
GSWDynamicURLString* url=nil;
|
||||
|
||||
LOGObjectFnStartCond(dontTraceComponentActionURL==0);
|
||||
|
||||
url=[self componentActionURLIsSecure:NO];
|
||||
|
||||
LOGObjectFnStopCond(dontTraceComponentActionURL==0);
|
||||
|
||||
return url;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(GSWDynamicURLString*)componentActionURLIsSecure:(BOOL)isSecure
|
||||
{
|
||||
//TODO: use isSecure
|
||||
BOOL storesIDsInURLs=NO;
|
||||
GSWDynamicURLString* url=nil;
|
||||
GSWSession* session=nil;
|
||||
|
@ -578,7 +630,8 @@ static int dontTraceComponentActionURL=0;
|
|||
NSDebugMLogCond(dontTraceComponentActionURL==0,@"requestHandlerPath=%@",requestHandlerPath);
|
||||
url=[self urlWithRequestHandlerKey:requestHandlerKey
|
||||
path:requestHandlerPath
|
||||
queryString:nil];
|
||||
queryString:nil
|
||||
isSecure:isSecure];
|
||||
NSDebugMLogCond(dontTraceComponentActionURL==0,@"url=%@",url);
|
||||
LOGObjectFnStopCond(dontTraceComponentActionURL==0);
|
||||
return url;
|
||||
|
@ -597,11 +650,11 @@ static int dontTraceComponentActionURL=0;
|
|||
|
||||
LOGObjectFnStartCond(dontTraceComponentActionURL==0);
|
||||
|
||||
NSDebugMLog(@"urlPrefix=%@",urlPrefix);
|
||||
NSDebugMLog(@"requestHandlerKey=%@",requestHandlerKey);
|
||||
NSDebugMLog(@"requestHandlerPath=%@",requestHandlerPath);
|
||||
NSDebugMLog(@"queryString=%@",queryString);
|
||||
NSDebugMLog(@"isSecure=%d",isSecure);
|
||||
NSDebugMLLog(@"GSWContext",@"urlPrefix=%@",urlPrefix);
|
||||
NSDebugMLLog(@"GSWContext",@"requestHandlerKey=%@",requestHandlerKey);
|
||||
NSDebugMLLog(@"GSWContext",@"requestHandlerPath=%@",requestHandlerPath);
|
||||
NSDebugMLLog(@"GSWContext",@"queryString=%@",queryString);
|
||||
NSDebugMLLog(@"GSWContext",@"isSecure=%d",isSecure);
|
||||
NSDebugMLogCond(dontTraceComponentActionURL==0,
|
||||
@"generateCompleteURLs=%s",
|
||||
(_generateCompleteURLs ? "YES" : "NO"));
|
||||
|
@ -645,12 +698,33 @@ static int dontTraceComponentActionURL=0;
|
|||
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
|
||||
-(GSWDynamicURLString*)urlWithURLPrefix:(NSString*)urlPrefix
|
||||
RequestHandlerKey:(NSString*)requestHandlerKey
|
||||
path:(NSString*)requestHandlerPath
|
||||
queryString:(NSString*)queryString
|
||||
isSecure:(BOOL)isSecure
|
||||
{
|
||||
GSWDynamicURLString* url=nil;
|
||||
GSWRequest* request=[self request];
|
||||
|
@ -661,7 +735,9 @@ static int dontTraceComponentActionURL=0;
|
|||
if (_generateCompleteURLs)
|
||||
url=[self completeURLWithRequestHandlerKey:requestHandlerKey
|
||||
path:requestHandlerPath
|
||||
queryString:queryString];
|
||||
queryString:queryString
|
||||
isSecure:isSecure
|
||||
port:0];
|
||||
else
|
||||
{
|
||||
url=[request _urlWithRequestHandlerKey:requestHandlerKey
|
||||
|
@ -683,10 +759,22 @@ static int dontTraceComponentActionURL=0;
|
|||
return [self urlWithURLPrefix:nil
|
||||
RequestHandlerKey:requestHandlerKey
|
||||
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
|
||||
|
@ -1059,11 +1147,11 @@ static int dontTraceComponentActionURL=0;
|
|||
|
||||
LOGObjectFnStart();
|
||||
|
||||
NSDebugMLog(@"actionName=%@",actionName);
|
||||
NSDebugMLog(@"urlPrefix=%@",urlPrefix);
|
||||
NSDebugMLog(@"dict=%@",dict);
|
||||
NSDebugMLog(@"pathQueryDictionary=%@",pathQueryDictionary);
|
||||
NSDebugMLog(@"isSecure=%d",isSecure);
|
||||
NSDebugMLLog(@"GSWContext",@"actionName=%@",actionName);
|
||||
NSDebugMLLog(@"GSWContext",@"urlPrefix=%@",urlPrefix);
|
||||
NSDebugMLLog(@"GSWContext",@"dict=%@",dict);
|
||||
NSDebugMLLog(@"GSWContext",@"pathQueryDictionary=%@",pathQueryDictionary);
|
||||
NSDebugMLLog(@"GSWContext",@"isSecure=%d",isSecure);
|
||||
|
||||
NSDebugMLogCond(dontTraceComponentActionURL==0,
|
||||
@"anURL=%@",anURL);
|
||||
|
@ -1166,25 +1254,25 @@ If none, try request languages
|
|||
LOGObjectFnStart();
|
||||
|
||||
languages=[_session languages];
|
||||
NSDebugMLog(@"_session %p languages=%@",_session,languages);
|
||||
NSDebugMLLog(@"GSWContext",@"_session %p languages=%@",_session,languages);
|
||||
|
||||
if ([languages count]==0)
|
||||
{
|
||||
languages=_languages;
|
||||
NSDebugMLog(@"context %p languages=%@",self,languages);
|
||||
NSDebugMLLog(@"GSWContext",@"context %p languages=%@",self,languages);
|
||||
|
||||
if ([languages count]==0)
|
||||
{
|
||||
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
|
||||
languages=[GSWApp filterLanguages:languages];
|
||||
NSDebugMLog(@"context %p ==> filtered languages=%@",self,languages);
|
||||
NSDebugMLLog(@"GSWContext",@"context %p ==> filtered languages=%@",self,languages);
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
|
@ -1196,7 +1284,7 @@ If none, try request languages
|
|||
{
|
||||
LOGObjectFnStart();
|
||||
|
||||
NSDebugMLog(@"languages=%@",languages);
|
||||
NSDebugMLLog(@"GSWContext",@"languages=%@",languages);
|
||||
|
||||
ASSIGNCOPY(_languages,languages);
|
||||
|
||||
|
@ -1329,17 +1417,17 @@ If none, try request languages
|
|||
storesIDsInURLs=[_session storesIDsInURLs];
|
||||
isDistributionEnabled=[_session isDistributionEnabled];
|
||||
|
||||
NSDebugMLog(@"storesIDsInURLs=%d",storesIDsInURLs);
|
||||
NSDebugMLog(@"isDistributionEnabled=%d",isDistributionEnabled);
|
||||
NSDebugMLLog(@"GSWContext",@"storesIDsInURLs=%d",storesIDsInURLs);
|
||||
NSDebugMLLog(@"GSWContext",@"isDistributionEnabled=%d",isDistributionEnabled);
|
||||
|
||||
NSDebugMLog(@"_session=%p",_session);
|
||||
NSDebugMLog(@"_request=%p",_request);
|
||||
NSDebugMLLog(@"GSWContext",@"_session=%p",_session);
|
||||
NSDebugMLLog(@"GSWContext",@"_request=%p",_request);
|
||||
|
||||
instance=[_request applicationNumber];
|
||||
sessionID=[_request sessionID];
|
||||
|
||||
NSDebugMLog(@"instance=%d",instance);
|
||||
NSDebugMLog(@"sessionID=%@",sessionID);
|
||||
NSDebugMLLog(@"GSWContext",@"instance=%d",instance);
|
||||
NSDebugMLLog(@"GSWContext",@"sessionID=%@",sessionID);
|
||||
|
||||
// Set instance to -1
|
||||
// if we don't store IDs in URLs and distribution is enabled
|
||||
|
@ -1349,7 +1437,7 @@ If none, try request languages
|
|||
instance=-1;
|
||||
};
|
||||
|
||||
NSDebugMLog(@"instance=%d",instance);
|
||||
NSDebugMLLog(@"GSWContext",@"instance=%d",instance);
|
||||
|
||||
_urlApplicationNumber = instance;
|
||||
[_url setURLApplicationNumber:instance];
|
||||
|
|
|
@ -801,7 +801,7 @@ int allow_severity = LOG_INFO;
|
|||
[appName cString], RQ_FILE, [handle fileDescriptor], 0);
|
||||
|
||||
fromhost(&libwrapRequestInfo);
|
||||
if (STR_EQ(eval_hostname(libwrapRequestInfo.client), paranoid)
|
||||
if (STR_EQ(eval_hostname(libwrapRequestInfo.client), "") //!paranoid
|
||||
|| !hosts_access(&libwrapRequestInfo))
|
||||
{
|
||||
allowed = NO;
|
||||
|
|
|
@ -574,49 +574,84 @@ RCS_ID("$Id$")
|
|||
data:(NSData*)data
|
||||
{
|
||||
GSWRequest* request=nil;
|
||||
NSArray* requestLineArray=nil;
|
||||
int requestLineLength=0;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
NSDebugDeepMLog0(@"GSWDefaultAdaptorThread: createRequestFromData");
|
||||
requestLineArray=[requestLine componentsSeparatedByString:@" "];
|
||||
NSDebugDeepMLLog(@"low",@"requestLine:%@",requestLine);
|
||||
NSDebugDeepMLLog(@"info",@"requestLineArray:%@",requestLineArray);
|
||||
if ([requestLineArray count]!=3)
|
||||
|
||||
requestLineLength=[requestLine length];
|
||||
if (requestLineLength==0)
|
||||
{
|
||||
ExceptionRaise(@"GSWDefaultAdaptorThread",
|
||||
@"bad request first line (elements count %d != 3). requestLine: '%@'.RequestLineArray: %@",
|
||||
[requestLineArray count],
|
||||
requestLine,
|
||||
requestLineArray);
|
||||
@"bad request first line: '%@'",
|
||||
requestLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString* method=[requestLineArray objectAtIndex:0];
|
||||
NSString* url=[requestLineArray objectAtIndex:1];
|
||||
NSArray* http=[[requestLineArray objectAtIndex:2] componentsSeparatedByString:@"/"];
|
||||
[GSWApplication statusLogWithFormat:@"RemoteAddress=%@ Request uri=%@",_remoteAddress,url];
|
||||
NSRange spaceRange;
|
||||
NSRange urlRange;
|
||||
NSString* method=nil;
|
||||
NSString* url=nil;
|
||||
NSString* protocolString=nil;
|
||||
NSArray* protocol=nil;
|
||||
|
||||
NSDebugDeepMLLog(@"info",@"method=%@",method);
|
||||
NSDebugDeepMLLog(@"info",@"url=%@",url);
|
||||
NSDebugDeepMLLog(@"info",@"http=%@",http);
|
||||
if ([http count]!=2)
|
||||
spaceRange=[requestLine rangeOfString:@" "];
|
||||
if (spaceRange.length==0 || spaceRange.location+spaceRange.length>=requestLineLength)
|
||||
{
|
||||
ExceptionRaise0(@"GSWDefaultAdaptorThread",@"bad request first line (HTTP)");
|
||||
ExceptionRaise(@"GSWDefaultAdaptorThread",
|
||||
@"bad request first line: No method or no protocol '%@'",
|
||||
requestLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString* httpVersion=[http objectAtIndex:1];
|
||||
/* if (isHeaderKeysEqual(method,GSWHTTPHeader_MethodPost))
|
||||
{
|
||||
*/
|
||||
request=[_application createRequestWithMethod:method
|
||||
uri:url
|
||||
httpVersion:httpVersion
|
||||
headers:headers
|
||||
content:data
|
||||
userInfo:nil];
|
||||
/* };*/
|
||||
method=[requestLine substringToIndex:spaceRange.location];
|
||||
urlRange.location=spaceRange.location+spaceRange.length;//+1 to skip space
|
||||
spaceRange=[requestLine rangeOfString:@" "
|
||||
options:NSBackwardsSearch
|
||||
range:NSMakeRange(urlRange.location,requestLineLength-urlRange.location)];
|
||||
if (spaceRange.length==0 || spaceRange.location<=urlRange.location)
|
||||
{
|
||||
ExceptionRaise(@"GSWDefaultAdaptorThread",
|
||||
@"bad request first line: No protocol or no url '%@'",
|
||||
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();
|
||||
return request;
|
||||
};
|
||||
|
@ -688,7 +723,6 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
|
|||
{
|
||||
int headerN=0;
|
||||
int headerNForKey=0;
|
||||
NSMutableData* allResponseData=nil;//to store response
|
||||
NSMutableData* responseData=(NSMutableData*)[NSMutableData data];
|
||||
NSArray* headerKeys=[response headerKeys];
|
||||
NSArray* headersForKey=nil;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
|
@ -169,8 +169,14 @@
|
|||
- (id)displayBatchContainingSelectedObject;
|
||||
- (NSArray *)displayedObjects;
|
||||
- (NSArray *)allDisplayedObjects;
|
||||
- (id)displayFirstBatch;
|
||||
- (id)displayNextBatch;
|
||||
- (id)displayPreviousBatch;
|
||||
- (id)displayLastBatch;
|
||||
- (BOOL)canDisplayFirstBatch;
|
||||
- (BOOL)canDisplayNextBatch;
|
||||
- (BOOL)canDisplayPreviousBatch;
|
||||
- (BOOL)canDisplayLastBatch;
|
||||
- (BOOL)endEditing;
|
||||
- (id)executeQuery;
|
||||
- (id)fetch;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** 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>
|
||||
Mirko Viviani <mirko.viviani@rccr.cremona.it>
|
||||
|
@ -124,9 +124,9 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
_queryMinMatch = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
_queryMax = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
_queryMaxMatch = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_queryOperator=%@",_queryOperator);
|
||||
_queryOperator = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_queryOperator=%@",_queryOperator);
|
||||
_queryKeyValueQualifierClassName
|
||||
= [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
|
||||
|
@ -138,9 +138,9 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
[[self class]globalDefaultStringMatchOperator]);
|
||||
ASSIGN(_defaultStringMatchFormat,
|
||||
[[self class]globalDefaultStringMatchFormat]);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchOperator=%@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchOperator=%@",
|
||||
_defaultStringMatchOperator);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchFormat=%@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchFormat=%@",
|
||||
_defaultStringMatchFormat);
|
||||
|
||||
[self setFetchesOnLoad:YES];
|
||||
|
@ -154,7 +154,7 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
if ((self=[self init]))
|
||||
{
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"GSWDisplayGroup %p",self);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"GSWDisplayGroup %p",self);
|
||||
[self setNumberOfObjectsPerBatch:
|
||||
[unarchiver decodeIntForKey:@"numberOfObjectsPerBatch"]];
|
||||
[self setFetchesOnLoad:
|
||||
|
@ -180,7 +180,7 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
[self setQueryOperator:[unarchiver decodeObjectForKey:@"queryOperator"]];
|
||||
[self setQueryKeyValueQualifierClassName:[unarchiver decodeObjectForKey:@"queryKeyValueQualifierClassName"]];
|
||||
[self finishInitialization];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"GSWDisplayGroup %p : %@",self,self);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"GSWDisplayGroup %p : %@",self,self);
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
return self;
|
||||
|
@ -198,7 +198,7 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
{
|
||||
NSString* dscr=nil;
|
||||
GSWLogAssertGood(self);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"GSWDisplayGroup description Self=%p",self);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"GSWDisplayGroup description Self=%p",self);
|
||||
dscr=[NSString stringWithFormat:@"<%s %p - \n",
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
|
@ -705,26 +705,26 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
|
||||
+(NSString*)globalDefaultStringMatchOperator
|
||||
{
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"globalDefaultStringMatchOperator=%@",globalDefaultStringMatchOperator);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"globalDefaultStringMatchOperator=%@",globalDefaultStringMatchOperator);
|
||||
return globalDefaultStringMatchOperator;
|
||||
}
|
||||
|
||||
+(void)setGlobalDefaultStringMatchOperator:(NSString*)operatorString
|
||||
{
|
||||
ASSIGN(globalDefaultStringMatchOperator,operatorString);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"globalDefaultStringMatchOperator=%@",globalDefaultStringMatchOperator);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"globalDefaultStringMatchOperator=%@",globalDefaultStringMatchOperator);
|
||||
}
|
||||
|
||||
+(NSString*)globalDefaultStringMatchFormat
|
||||
{
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"globalDefaultStringMatchFormat=%@",globalDefaultStringMatchFormat);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"globalDefaultStringMatchFormat=%@",globalDefaultStringMatchFormat);
|
||||
return globalDefaultStringMatchFormat;
|
||||
}
|
||||
|
||||
+(void)setGlobalDefaultStringMatchFormat:(NSString*)format
|
||||
{
|
||||
ASSIGN(globalDefaultStringMatchFormat,format);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"globalDefaultStringMatchFormat=%@",globalDefaultStringMatchFormat);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"globalDefaultStringMatchFormat=%@",globalDefaultStringMatchFormat);
|
||||
}
|
||||
|
||||
+(BOOL)globalDefaultForValidatesChangesImmediately
|
||||
|
@ -841,7 +841,7 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
|
||||
- (NSString *)defaultStringMatchFormat
|
||||
{
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat);
|
||||
return _defaultStringMatchFormat;
|
||||
}
|
||||
|
||||
|
@ -850,7 +850,7 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
|
||||
- (NSString *)defaultStringMatchOperator
|
||||
{
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchOperator=%@",_defaultStringMatchOperator);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchOperator=%@",_defaultStringMatchOperator);
|
||||
return _defaultStringMatchOperator;
|
||||
}
|
||||
|
||||
|
@ -995,8 +995,8 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
GSWLogAssertGood(_displayedObjects);
|
||||
displayedObjectsCount = [_displayedObjects count];
|
||||
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"displayedObjectsCount=%d",displayedObjectsCount);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"displayedObjectsCount=%d",displayedObjectsCount);
|
||||
|
||||
if (_numberOfObjectsPerBatch == 0 || _numberOfObjectsPerBatch>=displayedObjectsCount)
|
||||
displayedObjects=_displayedObjects;
|
||||
|
@ -1004,12 +1004,12 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
{
|
||||
int currentBatchIndex = [self currentBatchIndex];
|
||||
int startIndex=(currentBatchIndex - 1) * _numberOfObjectsPerBatch;
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"currentBatchIndex=%d",currentBatchIndex);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"startIndex=%d",startIndex);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"currentBatchIndex=%d",currentBatchIndex);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"startIndex=%d",startIndex);
|
||||
|
||||
if( displayedObjectsCount > (currentBatchIndex * _numberOfObjectsPerBatch))
|
||||
displayedObjectsCount = currentBatchIndex * _numberOfObjectsPerBatch;
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"displayedObjectsCount=%d",displayedObjectsCount);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"displayedObjectsCount=%d",displayedObjectsCount);
|
||||
|
||||
displayedObjects=[_displayedObjects subarrayWithRange:NSMakeRange(startIndex,displayedObjectsCount-startIndex)];
|
||||
};
|
||||
|
@ -1032,6 +1032,24 @@ of all Batches, not only the current one.
|
|||
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
|
||||
|
||||
|
@ -1039,7 +1057,7 @@ of all Batches, not only the current one.
|
|||
{
|
||||
LOGObjectFnStart();
|
||||
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch);
|
||||
if (_numberOfObjectsPerBatch>0)
|
||||
{
|
||||
[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
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// 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
|
||||
// deprecatd
|
||||
|
@ -1266,7 +1382,7 @@ of all Batches, not only the current one.
|
|||
|
||||
- (id)insertAfterLastObject
|
||||
{
|
||||
int index= [_allObjects count];
|
||||
int index= [_displayedObjects count];
|
||||
return [self insertObjectAtIndex:index];
|
||||
}
|
||||
|
||||
|
@ -1368,9 +1484,9 @@ of all Batches, not only the current one.
|
|||
|
||||
if ([self endEditing])
|
||||
{
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"Will [_dataSource createObject]");
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"Will [_dataSource createObject]");
|
||||
object = [_dataSource createObject];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"End [_dataSource createObject]. Object %p=%@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"End [_dataSource createObject]. Object %p=%@",
|
||||
object,object);
|
||||
if (!object)
|
||||
{
|
||||
|
@ -1384,10 +1500,10 @@ of all Batches, not only the current one.
|
|||
else
|
||||
{
|
||||
[object takeValuesFromDictionary:[self insertedObjectDefaultValues]];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"Will insertObject:AtIndex:");
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"Will insertObject:AtIndex:");
|
||||
[self insertObject:object
|
||||
atIndex:index];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"End insertObject:AtIndex:");
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"End insertObject:AtIndex:");
|
||||
};
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
|
@ -1494,19 +1610,19 @@ of all Batches, not only the current one.
|
|||
EOQualifier* resultQualifier=nil;
|
||||
NSMutableArray *array=nil;
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_queryMatch=%@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_queryMatch=%@",
|
||||
_queryMatch);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_queryNotMatch=%@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_queryNotMatch=%@",
|
||||
_queryNotMatch);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_queryMin=%@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_queryMin=%@",
|
||||
_queryMin);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_queryMax=%@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_queryMax=%@",
|
||||
_queryMax);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_queryMinMatch=%@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_queryMinMatch=%@",
|
||||
_queryMinMatch);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_queryMaxMatch=%@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_queryMaxMatch=%@",
|
||||
_queryMaxMatch);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchOperator=%@ EOQualifier sel:%p",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchOperator=%@ EOQualifier sel:%p",
|
||||
_defaultStringMatchOperator,
|
||||
(void*)[EOQualifier operatorSelectorForString:_defaultStringMatchOperator]);
|
||||
|
||||
|
@ -1533,12 +1649,12 @@ of all Batches, not only the current one.
|
|||
if (_auxiliaryQueryQualifier)
|
||||
[array addObject:_auxiliaryQueryQualifier];
|
||||
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"array=%@",array);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"array=%@",array);
|
||||
if ([array count]==1)
|
||||
resultQualifier=[array objectAtIndex:0];
|
||||
else if ([array count]>1)
|
||||
resultQualifier=[[[EOAndQualifier alloc] initWithQualifierArray:array] autorelease];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"resultQualifier=%@",resultQualifier);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"resultQualifier=%@",resultQualifier);
|
||||
LOGObjectFnStop();
|
||||
return resultQualifier;
|
||||
}
|
||||
|
@ -1561,9 +1677,9 @@ of all Batches, not only the current one.
|
|||
[self setInQueryMode:NO];
|
||||
|
||||
qualifier=[self qualifierFromQueryValues];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"qualifier=%@",qualifier);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"qualifier=%@",qualifier);
|
||||
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_dataSource=%@",_dataSource);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_dataSource=%@",_dataSource);
|
||||
if (_flags.isCustomDataSourceClass)
|
||||
{
|
||||
if ([_dataSource respondsToSelector:@selector(setAuxiliaryQualifier:)])
|
||||
|
@ -1601,7 +1717,7 @@ of all Batches, not only the current one.
|
|||
LOGObjectFnStart();
|
||||
[self setInQueryMode:NO];
|
||||
qualifier=[self qualifierFromQueryValues];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"qualifier=%@",qualifier);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"qualifier=%@",qualifier);
|
||||
[self setQualifier:qualifier];
|
||||
|
||||
NSDebugMLLog0(@"gswdisplaygroup",@"updateDisplayedObjects");
|
||||
|
@ -1717,10 +1833,10 @@ of all Batches, not only the current one.
|
|||
{
|
||||
id obj=nil;
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_selectedObjects count=%d",[_selectedObjects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_selectedObjects count=%d",[_selectedObjects count]);
|
||||
if([_selectedObjects count]>0)
|
||||
obj=[_selectedObjects objectAtIndex:0];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"selectedObject=%@",obj);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"selectedObject=%@",obj);
|
||||
|
||||
LOGObjectFnStop();
|
||||
return obj;
|
||||
|
@ -1836,19 +1952,19 @@ of all Batches, not only the current one.
|
|||
|
||||
GSWLogAssertGood(_displayedObjects);
|
||||
GSWLogAssertGood(objects);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_displayedObjects count]=%d",[_displayedObjects count]);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"objects count]=%d",[objects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_displayedObjects count]=%d",[_displayedObjects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"objects count]=%d",[objects count]);
|
||||
selectionIndexes = [_displayedObjects indexesOfObjectsIdenticalTo:objects];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"selectionIndexes count]=%d",[selectionIndexes count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"selectionIndexes count]=%d",[selectionIndexes count]);
|
||||
|
||||
if ([selectionIndexes count]==0)
|
||||
{
|
||||
if (selectFirstOnNoMatch && [_displayedObjects count]>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];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"selectionIndexes count]=%d",[selectionIndexes count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"selectionIndexes count]=%d",[selectionIndexes count]);
|
||||
|
||||
LOGObjectFnStop();
|
||||
return result;
|
||||
|
@ -1907,19 +2023,19 @@ of all Batches, not only the current one.
|
|||
{
|
||||
LOGObjectFnStart();
|
||||
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"index=%d",index);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"index=%d",index);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch);
|
||||
if(_numberOfObjectsPerBatch>0)
|
||||
{
|
||||
int batchCount=[self batchCount];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"batchCount=%d",batchCount);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"batchCount=%d",batchCount);
|
||||
if (index<1)
|
||||
_batchIndex=(batchCount>0 ? batchCount : 1);
|
||||
else if (index>batchCount)
|
||||
_batchIndex=1;
|
||||
else
|
||||
_batchIndex=index;
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_batchIndex=%d",_batchIndex);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_batchIndex=%d",_batchIndex);
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
}
|
||||
|
@ -1961,7 +2077,7 @@ of all Batches, not only the current one.
|
|||
{
|
||||
ASSIGN(_defaultStringMatchFormat, format);
|
||||
};
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat);
|
||||
LOGObjectFnStop();
|
||||
}
|
||||
|
||||
|
@ -1972,7 +2088,7 @@ of all Batches, not only the current one.
|
|||
{
|
||||
LOGObjectFnStart();
|
||||
ASSIGN(_defaultStringMatchOperator, operator);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchOperator=%@",_defaultStringMatchOperator);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchOperator=%@",_defaultStringMatchOperator);
|
||||
LOGObjectFnStop();
|
||||
}
|
||||
|
||||
|
@ -2095,17 +2211,17 @@ of all Batches, not only the current one.
|
|||
{
|
||||
EODetailDataSource *source=nil;
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"masterObject=%@",masterObject);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"masterObject=%@",masterObject);
|
||||
if([self hasDetailDataSource] == YES)
|
||||
{
|
||||
source = (EODetailDataSource *)_dataSource;
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"source=%@",source);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"[source detailKey]=%@",[source detailKey]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"source=%@",source);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"[source detailKey]=%@",[source detailKey]);
|
||||
[_dataSource qualifyWithRelationshipKey:[source detailKey]
|
||||
ofObject:masterObject];
|
||||
if ([self fetchesOnLoad])
|
||||
{
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"will fetch");
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"will fetch");
|
||||
[self fetch];
|
||||
};
|
||||
};
|
||||
|
@ -2142,9 +2258,9 @@ of all Batches, not only the current one.
|
|||
RETAIN(selectedObjects);
|
||||
AUTORELEASE(selectedObjects);
|
||||
GSWLogAssertGood(selectedObjects);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"selectedObjects count]=%d",[selectedObjects count]);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_allObjects count]=%d",[_allObjects count]);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"objects count]=%d",[objects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"selectedObjects count]=%d",[selectedObjects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_allObjects count]=%d",[_allObjects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"objects count]=%d",[objects count]);
|
||||
|
||||
if (objects)
|
||||
ASSIGN(_allObjects,[NSMutableArray arrayWithArray:objects]);
|
||||
|
@ -2152,14 +2268,14 @@ of all Batches, not only the current one.
|
|||
ASSIGN(_allObjects,[NSMutableArray array]);
|
||||
GSWLogAssertGood(selectedObjects);
|
||||
GSWLogAssertGood(_allObjects);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"selectedObjects count]=%d",[selectedObjects count]);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_allObjects count]=%d",[_allObjects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"selectedObjects count]=%d",[selectedObjects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_allObjects count]=%d",[_allObjects count]);
|
||||
|
||||
[self updateDisplayedObjects];
|
||||
GSWLogAssertGood(selectedObjects);
|
||||
GSWLogAssertGood(_allObjects);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"selectedObjects count]=%d",[selectedObjects count]);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_allObjects count]=%d",[_allObjects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"selectedObjects count]=%d",[selectedObjects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_allObjects count]=%d",[_allObjects count]);
|
||||
|
||||
[self selectObjectsIdenticalTo:selectedObjects
|
||||
selectFirstOnNoMatch:[self selectsFirstObjectAfterFetch]];
|
||||
|
@ -2232,9 +2348,9 @@ of all Batches, not only the current one.
|
|||
LOGObjectFnStart();
|
||||
|
||||
GSWLogAssertGood(selection);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"selection count]=%d",[selection count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"selection count]=%d",[selection count]);
|
||||
GSWLogAssertGood(_displayedObjects);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_displayedObjects count]=%d",[_displayedObjects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_displayedObjects count]=%d",[_displayedObjects count]);
|
||||
if([selection count]>1)
|
||||
{
|
||||
sortedSelection = [selection sortedArrayUsingSelector:@selector(compare:)];
|
||||
|
@ -2243,10 +2359,10 @@ of all Batches, not only the current one.
|
|||
sortedSelection = [NSArray arrayWithArray:selection];
|
||||
else
|
||||
sortedSelection = [NSArray array];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"sortedSelection count]=%d",[sortedSelection count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"sortedSelection count]=%d",[sortedSelection count]);
|
||||
|
||||
selectedObjects = [[[_displayedObjects objectsAtIndexes:sortedSelection] mutableCopy]autorelease];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"selectedObjects count]=%d",[selectedObjects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"selectedObjects count]=%d",[selectedObjects count]);
|
||||
isSelectedObjectsChanged = ![selectedObjects isEqual:_selectedObjects];
|
||||
isSelectionChanged = ![sortedSelection isEqual:_selection];
|
||||
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();
|
||||
|
||||
|
@ -2333,13 +2449,13 @@ of all Batches, not only the current one.
|
|||
NSArray* newDisplayedObjects = nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"START updateDisplayedObjects");
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"START updateDisplayedObjects");
|
||||
|
||||
selectedObjects = (NSMutableArray*)[self selectedObjects];
|
||||
GSWLogAssertGood(selectedObjects);
|
||||
newDisplayedObjects = _allObjects;
|
||||
GSWLogAssertGood(newDisplayedObjects);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"[newDisplayedObjects count]=%d",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"[newDisplayedObjects count]=%d",
|
||||
[newDisplayedObjects count]);
|
||||
|
||||
// Let's delegate doing the job ?
|
||||
|
@ -2350,35 +2466,35 @@ of all Batches, not only the current one.
|
|||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_qualifier=%d",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_qualifier=%d",
|
||||
_qualifier);
|
||||
// Filter ?
|
||||
if (_qualifier)
|
||||
{
|
||||
newDisplayedObjects=[newDisplayedObjects
|
||||
filteredArrayUsingQualifier:_qualifier];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"[newDisplayedObjects count]=%d",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"[newDisplayedObjects count]=%d",
|
||||
[newDisplayedObjects count]);
|
||||
};
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_sortOrdering=%d",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_sortOrdering=%d",
|
||||
_sortOrdering);
|
||||
// Sort ?
|
||||
if (_sortOrdering)
|
||||
{
|
||||
newDisplayedObjects=[newDisplayedObjects
|
||||
sortedArrayUsingKeyOrderArray:_sortOrdering];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"[newDisplayedObjects count]=%d",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"[newDisplayedObjects count]=%d",
|
||||
[newDisplayedObjects count]);
|
||||
};
|
||||
};
|
||||
ASSIGN(_displayedObjects,([NSMutableArray arrayWithArray:newDisplayedObjects]));
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"[_displayedObjects count]=%d",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"[_displayedObjects count]=%d",
|
||||
[_displayedObjects count]);
|
||||
|
||||
[self selectObjectsIdenticalTo:selectedObjects
|
||||
selectFirstOnNoMatch:NO];
|
||||
[self redisplay];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"STOP updateDisplayedObjects");
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"STOP updateDisplayedObjects");
|
||||
/*
|
||||
NSEnumerator *objsEnum=nil;
|
||||
id object=nil;
|
||||
|
@ -2414,7 +2530,7 @@ of all Batches, not only the current one.
|
|||
[self displayNextBatch];
|
||||
}
|
||||
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_sortOrdering=%@",_sortOrdering);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_sortOrdering=%@",_sortOrdering);
|
||||
if(_sortOrdering)
|
||||
[_displayedObjects sortUsingKeyOrderArray:_sortOrdering];
|
||||
};
|
||||
|
@ -2525,9 +2641,9 @@ of all Batches, not only the current one.
|
|||
NSEnumerator *enumerator=nil;
|
||||
NSString *key=nil;
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"array=%@",array);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"values=%@",values);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"operatorSelector=%p: %@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"array=%@",array);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"values=%@",values);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"operatorSelector=%p: %@",
|
||||
(void*)sel,
|
||||
NSStringFromSelector(sel));
|
||||
enumerator = [values keyEnumerator];
|
||||
|
@ -2535,15 +2651,15 @@ of all Batches, not only the current one.
|
|||
{
|
||||
EOQualifier* qualifier=nil;
|
||||
id value=[values objectForKey:key];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"key=%@ value=%@",key,value);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"key=%@ value=%@",key,value);
|
||||
qualifier=[self _qualifierForKey:key
|
||||
value:value
|
||||
operatorSelector:sel];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"qualifier=%@",qualifier);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"qualifier=%@",qualifier);
|
||||
if (qualifier)
|
||||
[array addObject:qualifier];
|
||||
};
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"array=%@",array);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"array=%@",array);
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
|
@ -2557,8 +2673,8 @@ of all Batches, not only the current one.
|
|||
NSException* validateException=nil;
|
||||
LOGObjectFnStart();
|
||||
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"value=%@",value);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"operatorSelector=%p: %@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"value=%@",value);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"operatorSelector=%p: %@",
|
||||
(void*)operatorSelector,
|
||||
NSStringFromSelector(operatorSelector));
|
||||
|
||||
|
@ -2568,7 +2684,7 @@ of all Batches, not only the current one.
|
|||
// Validate the value against object class description
|
||||
validateException=[cd validateValue:&value
|
||||
forKey:key];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"validateException=%@",validateException);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"validateException=%@",validateException);
|
||||
|
||||
if (validateException)
|
||||
{
|
||||
|
@ -2578,9 +2694,9 @@ of all Batches, not only the current one.
|
|||
{
|
||||
NSString* qualifierClassName=[_queryKeyValueQualifierClassName objectForKey:key];
|
||||
Class qualifierClass=Nil;
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"key=%@",key);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_queryKeyValueQualifierClassName=%@",_queryKeyValueQualifierClassName);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"qualifierClassName=%@",qualifierClassName);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"key=%@",key);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_queryKeyValueQualifierClassName=%@",_queryKeyValueQualifierClassName);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"qualifierClassName=%@",qualifierClassName);
|
||||
if ([qualifierClassName length]>0)
|
||||
{
|
||||
qualifierClass=NSClassFromString(qualifierClassName);
|
||||
|
@ -2591,10 +2707,10 @@ of all Batches, not only the current one.
|
|||
}
|
||||
else
|
||||
qualifierClass=[EOKeyValueQualifier class];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"operatorSelector=%p: %@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"operatorSelector=%p: %@",
|
||||
(void*)operatorSelector,
|
||||
NSStringFromSelector(operatorSelector));
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"EOQualifierOperatorEqual=%p: %@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"EOQualifierOperatorEqual=%p: %@",
|
||||
(void*)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
|
||||
NSString* operatorString=[_queryOperator objectForKey:key];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"key=%@",key);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"operatorString=%@",operatorString);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"[value isKindOfClass:[NSString class]]=%d",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"key=%@",key);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_queryOperator=%@",_queryOperator);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"operatorString=%@",operatorString);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"[value isKindOfClass:[NSString class]]=%d",
|
||||
[value isKindOfClass:[NSString class]]);
|
||||
|
||||
// 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;
|
||||
// Other string operators don't care about empry string
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"stringValue=%@",stringValue);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"stringValue=%@",stringValue);
|
||||
if ([stringValue length]==0)
|
||||
{
|
||||
// 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
|
||||
{
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat);
|
||||
value=[NSString stringWithFormat:_defaultStringMatchFormat,
|
||||
value];
|
||||
operatorString = _defaultStringMatchOperator;
|
||||
|
@ -2658,17 +2774,17 @@ of all Batches, not only the current one.
|
|||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"! string value");
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"! string value");
|
||||
if ([operatorString length]==0)
|
||||
operatorString = @"=";
|
||||
};
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"operatorString=%@",operatorString);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"operatorString=%@",operatorString);
|
||||
operatorSelector = [qualifierClass operatorSelectorForString:operatorString];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"operatorSelector=%p: %@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"operatorSelector=%p: %@",
|
||||
(void*)operatorSelector,
|
||||
NSStringFromSelector(operatorSelector));
|
||||
};
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"%@ %@ %@",
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"%@ %@ %@",
|
||||
key,
|
||||
NSStringFromSelector(operatorSelector),
|
||||
value);
|
||||
|
@ -2680,7 +2796,7 @@ of all Batches, not only the current one.
|
|||
initWithKey:key
|
||||
operatorSelector:operatorSelector
|
||||
value:value] autorelease];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"qualifier=%@",qualifier);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"qualifier=%@",qualifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2689,7 +2805,7 @@ of all Batches, not only the current one.
|
|||
};
|
||||
};
|
||||
};
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"qualifier=%@",qualifier);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"qualifier=%@",qualifier);
|
||||
return qualifier;
|
||||
};
|
||||
|
||||
|
@ -2704,8 +2820,8 @@ of all Batches, not only the current one.
|
|||
int selfCount=0;
|
||||
GSWLogAssertGood(objects);
|
||||
GSWLogAssertGood(self);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"objects count]=%d",[objects count]);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"self count]=%d",[self count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"objects count]=%d",[objects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"self count]=%d",[self count]);
|
||||
selfCount=[self count];
|
||||
if (selfCount>0)
|
||||
{
|
||||
|
@ -2733,7 +2849,7 @@ of all Batches, not only the current one.
|
|||
};
|
||||
if (!indexes)
|
||||
indexes=[NSArray array];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"indexes count]=%d",[indexes count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"indexes count]=%d",[indexes count]);
|
||||
return indexes;
|
||||
};
|
||||
|
||||
|
@ -2743,8 +2859,8 @@ of all Batches, not only the current one.
|
|||
int selfCount=0;
|
||||
GSWLogAssertGood(self);
|
||||
GSWLogAssertGood(indexes);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"indexes count]=%d",[indexes count]);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"self count]=%d",[self count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"indexes count]=%d",[indexes count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"self count]=%d",[self count]);
|
||||
selfCount=[self count];
|
||||
if ([self count]>0)
|
||||
{
|
||||
|
@ -2772,7 +2888,7 @@ of all Batches, not only the current one.
|
|||
};
|
||||
if (!objects)
|
||||
objects=[NSArray array];
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"objects count]=%d",[objects count]);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"objects count]=%d",[objects count]);
|
||||
return objects;
|
||||
};
|
||||
@end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
Date: Jan 1999
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
@ -45,6 +45,11 @@
|
|||
|
||||
//====================================================================
|
||||
@interface GSWDynamicElement (GSWDynamicElement)
|
||||
-(BOOL) evaluateCondition:(id)condition
|
||||
inContext:(GSWContext*)context
|
||||
noConditionAssociationDefault:(BOOL)noConditionAssociationDefault
|
||||
noConditionDefault:(BOOL)noConditionDefault;
|
||||
|
||||
-(BOOL)evaluateCondition:(id)condition
|
||||
inContext:(GSWContext*)context;
|
||||
@end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
|
@ -63,18 +63,22 @@ RCS_ID("$Id$")
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@implementation GSWDynamicElement (GSWDynamicElement)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(BOOL)evaluateCondition:(id)condition
|
||||
inContext:(GSWContext*)context
|
||||
-(BOOL) evaluateCondition:(id)condition
|
||||
inContext:(GSWContext*)context
|
||||
noConditionAssociationDefault:(BOOL)noConditionAssociationDefault
|
||||
noConditionDefault:(BOOL)noConditionDefault
|
||||
{
|
||||
//OK
|
||||
BOOL result=NO;
|
||||
BOOL result=noConditionAssociationDefault;
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"gswdync",@"condition_=%@",
|
||||
condition);
|
||||
NSDebugMLLog(@"gswdync",@"condition_=%@ noConditionAssociationDefault=%s noConditionDefault=%s",
|
||||
condition,(noConditionAssociationDefault ? "YES" : "NO"),
|
||||
(noConditionDefault ? "YES" : "NO"));
|
||||
if (condition)
|
||||
{
|
||||
GSWComponent* component=[context component];
|
||||
|
@ -86,10 +90,27 @@ RCS_ID("$Id$")
|
|||
NSDebugMLLog(@"gswdync",@"unsignedCharValue=%d",(int)[value unsignedCharValue]);
|
||||
};
|
||||
#endif
|
||||
result=boolValueWithDefaultFor(value,YES);
|
||||
result=boolValueWithDefaultFor(value,noConditionDefault);
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"result=%s",
|
||||
(result ? "YES" : "NO"));
|
||||
NSDebugMLLog(@"gswdync",@"condition_=%@ noConditionAssociationDefault=%s noConditionDefault=%s ==> result=%s",
|
||||
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();
|
||||
return result;
|
||||
};
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
GSWAssociation* _disabled;
|
||||
GSWAssociation* _enabled;
|
||||
GSWAssociation* _fragmentIdentifier;
|
||||
GSWAssociation* _displayDisabled;
|
||||
NSDictionary* _otherPathQueryAssociations;
|
||||
// }
|
||||
NSDictionary* _otherQueryAssociations;
|
||||
|
|
|
@ -107,6 +107,12 @@ RCS_ID("$Id$")
|
|||
NSDebugMLLog(@"gswdync",@"fragmentIdentifier=%@",_fragmentIdentifier);
|
||||
|
||||
[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
|
||||
|
@ -152,6 +158,7 @@ RCS_ID("$Id$")
|
|||
DESTROY(_disabled);
|
||||
DESTROY(_enabled);
|
||||
DESTROY(_fragmentIdentifier);
|
||||
DESTROY(_displayDisabled);
|
||||
DESTROY(_otherQueryAssociations);
|
||||
DESTROY(_otherPathQueryAssociations);
|
||||
[super dealloc];
|
||||
|
@ -256,10 +263,14 @@ RCS_ID("$Id$")
|
|||
inContext:(GSWContext*)context
|
||||
{
|
||||
//OK
|
||||
BOOL disabledInContext=NO;
|
||||
BOOL displayDisabledValue=YES;
|
||||
#ifndef NDEBBUG
|
||||
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
|
||||
#endif
|
||||
|
||||
LOGObjectFnStartC("GSWForm");
|
||||
|
||||
GSWStartElement(context);
|
||||
GSWSaveAppendToResponseElementID(context);
|
||||
[response appendDebugCommentContentString:[NSString stringWithFormat:@"declarationName=%@ ID=%@",
|
||||
|
@ -268,25 +279,61 @@ RCS_ID("$Id$")
|
|||
|
||||
if (!WOStrictFlag)
|
||||
{
|
||||
BOOL disabledInContext=NO;
|
||||
disabledInContext=[self disabledInContext:context];
|
||||
[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
|
||||
[context setInForm:YES];
|
||||
|
||||
[self appendToResponse:response
|
||||
inContext:context
|
||||
elementsFromIndex:0
|
||||
toIndex:[_elementsMap length]-2];
|
||||
[self _appendHiddenFieldsToResponse:response
|
||||
inContext:context];
|
||||
[self appendToResponse:response
|
||||
inContext:context
|
||||
elementsFromIndex:[_elementsMap length]-1
|
||||
toIndex:[_elementsMap length]-1];
|
||||
[context setInForm:NO];
|
||||
if (!disabledInContext || displayDisabledValue)
|
||||
{
|
||||
[self appendToResponse:response
|
||||
inContext:context
|
||||
elementsFromIndex:0
|
||||
toIndex:[_elementsMap length]-2];
|
||||
|
||||
[self _appendHiddenFieldsToResponse:response
|
||||
inContext:context];
|
||||
[self appendToResponse:response
|
||||
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);
|
||||
|
||||
#ifndef NDEBBUG
|
||||
NSAssert3(elementsNb==[(GSWElementIDString*)[context elementID]elementsNb],
|
||||
@"GSWForm appendToResponse: bad elementID: elementsNb=%d [context elementID]=%@ [(GSWElementIDString*)[context elementID]elementsNb]=%d",
|
||||
|
@ -334,6 +381,7 @@ RCS_ID("$Id$")
|
|||
if (isFormSubmited)
|
||||
{
|
||||
[context setInForm:YES];
|
||||
[context setInEnabledForm:YES];
|
||||
[context _setFormSubmitted:YES];
|
||||
multipleSubmitValue=[self evaluateCondition:_multipleSubmit
|
||||
inContext:context];
|
||||
|
@ -374,6 +422,7 @@ RCS_ID("$Id$")
|
|||
[context _setActionInvoked:YES];
|
||||
};
|
||||
[context setInForm:NO];
|
||||
[context setInEnabledForm:NO];
|
||||
[context _setFormSubmitted:NO];
|
||||
[context _setIsMultipleSubmitForm:NO];
|
||||
};
|
||||
|
@ -443,6 +492,7 @@ RCS_ID("$Id$")
|
|||
if (isFormSubmited)
|
||||
{
|
||||
[context setInForm:YES];
|
||||
[context setInEnabledForm:YES];
|
||||
[context _setFormSubmitted:YES];
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"\n\ndynamicChildren=%@",_dynamicChildren);
|
||||
|
@ -454,6 +504,7 @@ RCS_ID("$Id$")
|
|||
if (isFormSubmited)
|
||||
{
|
||||
[context setInForm:NO];
|
||||
[context setInEnabledForm:NO];
|
||||
[context _setFormSubmitted:NO];
|
||||
};
|
||||
};
|
||||
|
@ -481,7 +532,13 @@ RCS_ID("$Id$")
|
|||
disabledInContext=[self disabledInContext:context];
|
||||
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];
|
||||
if (_href)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
Date: Jan 1999
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
@ -36,6 +36,9 @@
|
|||
//====================================================================
|
||||
@interface GSWGenericContainer: GSWDynamicElement
|
||||
{
|
||||
GSWAssociation* _elementName;
|
||||
GSWAssociation* _otherTagString;
|
||||
GSWAssociation* _omitElement;
|
||||
GSWAssociation* _children;
|
||||
NSDictionary* _associations;
|
||||
GSWElement* _element;
|
||||
|
@ -44,8 +47,6 @@
|
|||
-(id)initWithName:(NSString*)aName
|
||||
associations:(NSDictionary*)associations
|
||||
template:(GSWElement*)templateElement;
|
||||
-(void)dealloc;
|
||||
-(NSString*)description;
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)aResponse
|
||||
inContext:(GSWContext*)aContext;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
|
@ -40,9 +40,37 @@ RCS_ID("$Id$")
|
|||
associations:(NSDictionary*)associations
|
||||
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);
|
||||
};
|
||||
return self;
|
||||
|
@ -51,6 +79,9 @@ RCS_ID("$Id$")
|
|||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
DESTROY(_elementName);
|
||||
DESTROY(_otherTagString);
|
||||
DESTROY(_omitElement);
|
||||
DESTROY(_associations);
|
||||
DESTROY(_element);
|
||||
[super dealloc];
|
||||
|
@ -73,29 +104,47 @@ RCS_ID("$Id$")
|
|||
id component = [aContext component];
|
||||
id theValue=nil;
|
||||
id otherTag = nil;
|
||||
id tag = [[_associations objectForKey:@"elementName"] valueInComponent:component];
|
||||
|
||||
[aResponse appendContentString:[NSString stringWithFormat:@"<%@",tag]];
|
||||
id tag = nil;
|
||||
BOOL omitElement = NO;
|
||||
|
||||
if ((otherTag = [[_associations objectForKey:@"otherTagString"] valueInComponent:component]))
|
||||
if (!WOStrictFlag && _omitElement)
|
||||
{
|
||||
[aResponse appendContentString:[NSString stringWithFormat:@" %@",otherTag]];
|
||||
}
|
||||
|
||||
assocEnumer = [_associations keyEnumerator];
|
||||
while ((currentAssocKey = [assocEnumer nextObject]))
|
||||
omitElement=[self evaluateCondition:_omitElement
|
||||
inContext:aContext
|
||||
noConditionAssociationDefault:NO
|
||||
noConditionDefault:NO];
|
||||
};
|
||||
|
||||
if (!omitElement)
|
||||
{
|
||||
theValue = [[_associations objectForKey:currentAssocKey] valueInComponent:component];
|
||||
if (([currentAssocKey isEqualToString:@"elementName"] == NO)
|
||||
&& ([currentAssocKey isEqualToString:@"otherTagString"] == NO))
|
||||
tag = [_elementName valueInComponent:component];
|
||||
|
||||
[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];
|
||||
[aResponse appendContentString:[NSString stringWithFormat:@"</%@>",tag]];
|
||||
|
||||
if (!omitElement)
|
||||
[aResponse appendContentString:[NSString stringWithFormat:@"</%@>",tag]];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
@ -279,7 +279,7 @@ An exception is raised if the end quote is not found,...
|
|||
else
|
||||
(*indexPtr)++;
|
||||
}
|
||||
NSDebugMLog(@"startIndex=%d *indexPtr=%d _uniBuf[*indexPtr]='%c'",
|
||||
NSDebugMLLog(@"GSWHTMLRawParser",@"startIndex=%d *indexPtr=%d _uniBuf[*indexPtr]='%c'",
|
||||
startIndex,*indexPtr,(char)_uniBuf[*indexPtr]);
|
||||
if (_uniBuf[*indexPtr]!=quote)
|
||||
{
|
||||
|
@ -300,7 +300,7 @@ An exception is raised if the end quote is not found,...
|
|||
(char)quote,(char)_uniBuf[*indexPtr]);
|
||||
|
||||
//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]);
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
@ -338,12 +338,12 @@ An exception is raised if the end quote is not found,...
|
|||
(char)quote,(char)_uniBuf[*indexPtr]);
|
||||
|
||||
//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]);
|
||||
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
|
||||
|
||||
NSDebugMLog(@"'string'='%@'",string);
|
||||
NSDebugMLLog(@"GSWHTMLRawParser",@"'string'='%@'",string);
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
|
@ -389,7 +389,7 @@ It skip starting blank spaces
|
|||
string=[self _parseQuotedStringWithQuote:_uniBuf[*indexPtr]
|
||||
index:indexPtr
|
||||
stopIndex:stopIndex];
|
||||
NSDebugMLog(@"indexPtr=%d 'string'='%@'",*indexPtr,string);
|
||||
NSDebugMLLog(@"GSWHTMLRawParser",@"indexPtr=%d 'string'='%@'",*indexPtr,string);
|
||||
(*indexPtr)++; // skip last quote
|
||||
}
|
||||
else
|
||||
|
@ -408,16 +408,16 @@ It skip starting blank spaces
|
|||
else
|
||||
(*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]);
|
||||
if (*indexPtr>startIndex)
|
||||
string=[NSString stringWithCharacters:_uniBuf+startIndex
|
||||
length:*indexPtr-startIndex];
|
||||
NSDebugMLog(@"'string'='%@'",string);
|
||||
NSDebugMLLog(@"GSWHTMLRawParser",@"'string'='%@'",string);
|
||||
};
|
||||
};
|
||||
|
||||
NSDebugMLog(@"'string'='%@'",string);
|
||||
NSDebugMLLog(@"GSWHTMLRawParser",@"'string'='%@'",string);
|
||||
|
||||
LOGObjectFnStop();
|
||||
return string;
|
||||
|
@ -444,6 +444,7 @@ if it is not the case but you'll have problems later...)
|
|||
andIndex:(int)stopIndex
|
||||
{
|
||||
NSMutableDictionary* properties=nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
//ParserDebugLogBuffer(_uniBuf,stopIndex+1,startIndex,stopIndex+1);
|
||||
if (stopIndex>=startIndex)
|
||||
|
@ -460,16 +461,18 @@ if it is not the case but you'll have problems later...)
|
|||
{
|
||||
tagName=[NSString stringWithCharacters:_uniBuf+startIndex
|
||||
length:index-startIndex+1];
|
||||
NSDebugMLog(@"tagName=%@",tagName);
|
||||
NSDebugMLLog(@"GSWHTMLRawParser",@"tagName=%@",tagName);
|
||||
};
|
||||
break;
|
||||
}
|
||||
else
|
||||
index++;
|
||||
};
|
||||
if (!tagName && index>stopIndex)
|
||||
{
|
||||
tagName=[NSString stringWithCharacters:_uniBuf+startIndex
|
||||
length:index-startIndex];
|
||||
NSDebugMLog(@"tagName=%@",tagName);
|
||||
NSDebugMLLog(@"GSWHTMLRawParser",@"tagName=%@",tagName);
|
||||
};
|
||||
if (tagName)
|
||||
{
|
||||
|
@ -486,44 +489,60 @@ if it is not the case but you'll have problems later...)
|
|||
|
||||
while(index<=stopIndex)
|
||||
{
|
||||
NSString* key=[self _parsePropertiesStringEndingWith:'='
|
||||
or:' '
|
||||
index:&index
|
||||
stopIndex:stopIndex];
|
||||
NSDebugMLog(@"'key'='%@'",key);
|
||||
// Skip blank
|
||||
while(index<=stopIndex
|
||||
&& _uniBuf[index]==' ')
|
||||
index++;
|
||||
NSString* key=nil;
|
||||
int previousIndex=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];
|
||||
if (!properties)
|
||||
properties=(NSMutableDictionary*)[NSMutableDictionary dictionary];
|
||||
if (index>stopIndex) // key without value
|
||||
[properties setObject:@""
|
||||
forKey:key];
|
||||
else if (_uniBuf[index]=='=') // key=value
|
||||
key=[self _parsePropertiesStringEndingWith:'='
|
||||
or:' '
|
||||
index:&index
|
||||
stopIndex:stopIndex];
|
||||
NSDebugMLLog(@"GSWHTMLRawParser",@"'key'='%@'",key);
|
||||
// Skip blank
|
||||
while(index<=stopIndex
|
||||
&& _uniBuf[index]==' ')
|
||||
index++;
|
||||
|
||||
if ([key length]>0)
|
||||
{
|
||||
NSString *value;
|
||||
index++;
|
||||
value=[self _parsePropertiesStringEndingWith:'='
|
||||
or:' '
|
||||
index:&index
|
||||
stopIndex:stopIndex];
|
||||
NSDebugMLog(@"'value'='%@'",value);
|
||||
NSAssert(value,@"No value");
|
||||
[properties setObject:value
|
||||
forKey:key];
|
||||
}
|
||||
else // key without value
|
||||
[properties setObject:@""
|
||||
forKey:key];
|
||||
key=[key lowercaseString];
|
||||
if (!properties)
|
||||
properties=(NSMutableDictionary*)[NSMutableDictionary dictionary];
|
||||
if (index>stopIndex) // key without value
|
||||
[properties setObject:@""
|
||||
forKey:key];
|
||||
else if (_uniBuf[index]=='=') // key=value
|
||||
{
|
||||
NSString *value;
|
||||
index++;
|
||||
value=[self _parsePropertiesStringEndingWith:'='
|
||||
or:' '
|
||||
index:&index
|
||||
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();
|
||||
return properties;
|
||||
};
|
||||
|
@ -536,7 +555,7 @@ May raise exception.
|
|||
{
|
||||
// Object obj = null;
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLog(@"_string=%@",_string);
|
||||
NSDebugMLLog(@"GSWHTMLRawParser",@"_string=%@",_string);
|
||||
_length=[_string length];
|
||||
|
||||
_uniBuf = (unichar*)objc_malloc(sizeof(unichar)*(_length+1));
|
||||
|
@ -546,12 +565,13 @@ May raise exception.
|
|||
|
||||
_index=0;
|
||||
|
||||
NSDebugMLog(@"index=%d length=%d",_index,_length);
|
||||
NSDebugMLLog(@"GSWHTMLRawParser",@"index=%d length=%d",_index,_length);
|
||||
//ParserDebugLogBuffer(_uniBuf,_length,_index,_length);
|
||||
|
||||
_textStartIndex=_index;
|
||||
while(_index<_length)
|
||||
{
|
||||
int previousIndex=_index;
|
||||
//ParserDebugLogBuffer(_uniBuf,_length,_index,20);
|
||||
switch(_uniBuf[_index])
|
||||
{
|
||||
|
@ -568,7 +588,7 @@ May raise exception.
|
|||
if (_index>=_length)
|
||||
{
|
||||
[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]];
|
||||
}
|
||||
else
|
||||
|
@ -577,7 +597,7 @@ May raise exception.
|
|||
GSWHTMLRawParserTagType tagType=GetTagType(_uniBuf,_length,&_index,&isClosingTag);
|
||||
int tagPropertiesStartIndex=_index;
|
||||
_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))
|
||||
{
|
||||
//ParserDebugLogBuffer(_uniBuf,_length,_index,20);
|
||||
|
@ -600,7 +620,7 @@ May raise exception.
|
|||
BOOL stopTag=NO;
|
||||
int tagStopIndex=_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);
|
||||
if (isClosingTag)
|
||||
{
|
||||
|
@ -617,14 +637,14 @@ May raise exception.
|
|||
stopTag=YES;
|
||||
tagPropertiesStopIndex--;
|
||||
};
|
||||
NSDebugMLog(@"stopTag=%d",stopTag);
|
||||
NSDebugMLLog(@"GSWHTMLRawParser",@"stopTag=%d",stopTag);
|
||||
tagPropertiesString=[NSString stringWithCharacters:_uniBuf+tagPropertiesStartIndex
|
||||
length:tagPropertiesStopIndex-tagPropertiesStartIndex];
|
||||
NSDebugMLog(@"tagPropertiesString='%@'",tagPropertiesString);
|
||||
NSDebugMLLog(@"GSWHTMLRawParser",@"tagPropertiesString='%@'",tagPropertiesString);
|
||||
tagProperties=[self tagPropertiesForType:tagType
|
||||
betweenIndex:tagPropertiesStartIndex
|
||||
andIndex:tagPropertiesStopIndex-1];
|
||||
NSDebugMLog(@"tagProperties='%@'",tagProperties);
|
||||
NSDebugMLLog(@"GSWHTMLRawParser",@"tagProperties='%@'",tagProperties);
|
||||
[self startDynamicTagOfType:tagType
|
||||
withProperties:tagProperties
|
||||
templateInfo:[self lineAndColumnIndexesStringFromIndex:tagStartIndex]];
|
||||
|
@ -636,7 +656,7 @@ May raise exception.
|
|||
_index++;
|
||||
//ParserDebugLogBuffer(_uniBuf,_length,_index,20);
|
||||
_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);
|
||||
};
|
||||
}
|
||||
|
@ -668,7 +688,7 @@ May raise exception.
|
|||
[self didParseCommentWithContentString:commentString];
|
||||
_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);
|
||||
};
|
||||
};
|
||||
|
@ -682,6 +702,12 @@ May raise exception.
|
|||
_index++;
|
||||
break;
|
||||
};
|
||||
if (_index==previousIndex)
|
||||
{
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"Parser blocked at %@.",
|
||||
[self lineAndColumnIndexesStringFromIndex:_index]];
|
||||
};
|
||||
};
|
||||
_textStopIndex=_length-1;
|
||||
[self didParseText];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** 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>
|
||||
Date: Apr 1999
|
||||
|
@ -416,11 +416,20 @@ NS_DURING
|
|||
NSString* path=[resourceManager pathForResourceNamed:filenameValue
|
||||
inFramework:frameworkValue
|
||||
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
|
||||
forCIDKeyAssociation:_cidKey
|
||||
CIDStoreAssociation:_cidStore
|
||||
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
|
||||
{
|
||||
|
@ -428,7 +437,12 @@ NS_DURING
|
|||
inFramework:frameworkValue
|
||||
languages:languages
|
||||
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]);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
Date: Jan 1999
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
@ -64,6 +64,7 @@
|
|||
NSDictionary* _otherPathQueryAssociations;
|
||||
GSWAssociation* _urlPrefix;
|
||||
GSWAssociation* _pathQueryDictionary;
|
||||
GSWAssociation* _escapeHTML;
|
||||
// }
|
||||
GSWElement* _children;
|
||||
};
|
||||
|
|
|
@ -132,6 +132,10 @@ RCS_ID("$Id$")
|
|||
_urlPrefix = [[anAssociationsDict objectForKey:urlPrefix__Key
|
||||
withDefaultObject:[_urlPrefix autorelease]] retain];
|
||||
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:urlPrefix__Key];
|
||||
[tmpOtherAssociations removeObjectForKey:pathQueryDictionary__Key];
|
||||
[tmpOtherAssociations removeObjectForKey:escapeHTML__Key];
|
||||
};
|
||||
|
||||
if (!WOStrictFlag)
|
||||
|
@ -255,6 +260,7 @@ RCS_ID("$Id$")
|
|||
DESTROY(_mimeType);
|
||||
DESTROY(_key);
|
||||
DESTROY(_urlPrefix);
|
||||
DESTROY(_escapeHTML);
|
||||
DESTROY(_pathQueryDictionary);
|
||||
DESTROY(_children);
|
||||
[super dealloc];
|
||||
|
@ -296,7 +302,7 @@ RCS_ID("$Id$")
|
|||
disabledValue=![self evaluateCondition:_enabled
|
||||
inContext:context];
|
||||
|
||||
if (!WOStrictFlag && _displayDisabled)
|
||||
if (!WOStrictFlag && disabledValue && _displayDisabled)
|
||||
{
|
||||
displayDisabledValue=[self evaluateCondition:_displayDisabled
|
||||
inContext:context];
|
||||
|
@ -642,11 +648,23 @@ RCS_ID("$Id$")
|
|||
if (_string)
|
||||
{
|
||||
id stringValue=nil;
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"string=%@",_string);
|
||||
stringValue=[_string valueInComponent:[aContext component]];
|
||||
NSDebugMLLog(@"gswdync",@"stringValue=%@",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();
|
||||
}
|
||||
|
|
|
@ -41,11 +41,20 @@
|
|||
NSStringEncoding _contentEncoding;
|
||||
NSDictionary* _userInfo;
|
||||
// NSMutableString* _contentString;
|
||||
IMP _contentStringASImp;
|
||||
// IMP _contentStringASImp;
|
||||
NSMutableData* _contentData;
|
||||
IMP _contentDataADImp;
|
||||
IMP _appendContentStringIMP;
|
||||
Class _selfClass;
|
||||
IMP _stringByEscapingHTMLStringIMP;
|
||||
IMP _stringByEscapingHTMLAttributeValueIMP;
|
||||
IMP _stringByConvertingToHTMLEntitiesIMP;
|
||||
IMP _stringByConvertingToHTMLIMP;
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
NSMutableArray* _cachesStack; // Cache Stacks
|
||||
NSMutableData* _currentCacheData; // Current Cache Data (last object of _cachesStack). Do not retain/release
|
||||
IMP _currentCacheDataADImp;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -61,6 +70,12 @@
|
|||
forKey:(NSString*)key;
|
||||
-(void)setHeaders:(NSDictionary*)headerList;
|
||||
|
||||
-(void)removeHeader:(NSString*)header
|
||||
forKey:(NSString*)key;
|
||||
|
||||
-(void)removeHeaderForKey:(NSString*)key;
|
||||
-(void)removeHeadersForKey:(NSString*)key;
|
||||
|
||||
-(void)appendHeader:(NSString*)header
|
||||
forKey:(NSString*)key;
|
||||
-(void)appendHeaders:(NSArray*)headers
|
||||
|
@ -77,15 +92,12 @@
|
|||
-(void)setContentEncoding:(NSStringEncoding)encoding;
|
||||
-(NSStringEncoding)contentEncoding;
|
||||
|
||||
-(void)_initContentData;
|
||||
|
||||
-(NSData*)content;
|
||||
-(NSString*)contentString;
|
||||
-(void)setContent:(NSData*)contentData;
|
||||
-(void)setContentString:(NSString*)contentString;
|
||||
|
||||
-(void)_appendContentAsciiString:(NSString*)aString;
|
||||
-(void)_appendContentCharacter:(char)aChar;
|
||||
-(void)appendContentCharacter:(char)aChar;
|
||||
|
||||
-(void)appendContentString:(NSString*)string;
|
||||
-(void)appendContentData:(NSData*)contentData;
|
||||
|
@ -96,10 +108,7 @@
|
|||
@interface GSWMessage (GSWContentConveniences)
|
||||
-(void)appendContentBytes:(const void*)contentsBytes
|
||||
length:(unsigned)length;
|
||||
-(void)appendContentCharacter:(char)aChar;
|
||||
-(void)appendDebugCommentContentString:(NSString*)string;
|
||||
-(void)replaceContentString:(NSString*)replaceString
|
||||
byString:(NSString*)byString;
|
||||
-(void)replaceContentData:(NSData*)replaceData
|
||||
byData:(NSData*)byData;
|
||||
|
||||
|
|
|
@ -40,24 +40,46 @@ RCS_ID("$Id$")
|
|||
static NSStringEncoding globalDefaultEncoding=GSUndefinedEncoding;
|
||||
static NSString* globalDefaultURLEncoding=nil;
|
||||
|
||||
static SEL appendStringSel = 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
|
||||
static id GSWMessageDataCache[GSWMESSGAEDATACHESIZE];
|
||||
|
||||
|
||||
// Default data content size
|
||||
#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(); \
|
||||
{ if (!_contentDataADImp) { \
|
||||
_contentDataADImp=[_contentData \
|
||||
methodForSelector:appendDataSel]; }; };
|
||||
|
||||
#define assertCurrentCacheDataADImp(); \
|
||||
{ if (!_currentCacheDataADImp) { \
|
||||
_currentCacheDataADImp=[_currentCacheData \
|
||||
methodForSelector:appendDataSel]; }; };
|
||||
|
||||
//====================================================================
|
||||
|
||||
// Initialize Ascii string to data cache
|
||||
void initGSWMessageDataCache(void)
|
||||
{
|
||||
int i=0;
|
||||
|
@ -67,17 +89,19 @@ void initGSWMessageDataCache(void)
|
|||
|
||||
cstring[1] = 0;
|
||||
|
||||
for (i=0;i<GSWMESSGAEDATACHESIZE;i++) {
|
||||
cstring[0] = i;
|
||||
myNSString = [NSString stringWithCString:&cstring
|
||||
length:1];
|
||||
for (i=0;i<GSWMESSGAEDATACHESIZE;i++)
|
||||
{
|
||||
cstring[0] = (char)i;
|
||||
myNSString = [NSString stringWithCString:cstring
|
||||
length:1];
|
||||
myData = [myNSString dataUsingEncoding:NSASCIIStringEncoding
|
||||
allowLossyConversion:YES];
|
||||
allowLossyConversion:YES];
|
||||
[myData retain];
|
||||
GSWMessageDataCache[i] = myData;
|
||||
}
|
||||
GSWMessageDataCache[i] = myData;
|
||||
};
|
||||
}
|
||||
|
||||
//====================================================================
|
||||
@implementation GSWMessage
|
||||
|
||||
static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
|
||||
|
@ -90,14 +114,21 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
|
|||
return self->_contentData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [GSWMessage class])
|
||||
{
|
||||
appendStringSel = @selector(appendString:);
|
||||
appendDataSel = @selector(appendData:);
|
||||
globalDefaultEncoding = WOStrictFlag ? NSISOLatin1StringEncoding : GetDefEncoding() ;
|
||||
initGSWMessageDataCache();
|
||||
appendContentStringSEL = @selector(appendContentString:);
|
||||
|
||||
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();
|
||||
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");
|
||||
_headers=[NSMutableDictionary new];
|
||||
_contentEncoding=[[self class] defaultEncoding];
|
||||
_contentEncoding=[_selfClass defaultEncoding];
|
||||
_checkBody(self);
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
|
@ -168,6 +214,11 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
|
|||
#ifndef NO_GNUSTEP
|
||||
DESTROY(clone->_cachesStack);
|
||||
clone->_cachesStack=[_cachesStack mutableCopyWithZone:zone];
|
||||
if ([clone->_cachesStack count]>0)
|
||||
{
|
||||
clone->_currentCacheData=[clone->_cachesStack lastObject];
|
||||
clone->_currentCacheDataADImp=NULL;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
return clone;
|
||||
|
@ -376,93 +427,230 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
|
|||
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
|
||||
{
|
||||
[_headers removeObjectForKey:key];
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
/** Set content with contentData
|
||||
**/
|
||||
-(void)setContent:(NSData*)contentData
|
||||
{
|
||||
LOGObjectFnStart();
|
||||
[_contentData release];
|
||||
_contentData = nil;
|
||||
DESTROY(_contentData);
|
||||
[self appendContentData:contentData];
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// content
|
||||
// DW
|
||||
-(NSData*)content
|
||||
{
|
||||
LOGObjectFnStart();
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
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
|
||||
{
|
||||
if (contentData == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
_checkBody(self);
|
||||
(*_contentDataADImp)(_contentData,appendDataSel,contentData);
|
||||
LOGObjectFnStart();
|
||||
|
||||
NSDebugMLLog(@"low",@"contentData:%@",contentData);
|
||||
|
||||
if (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
|
||||
{
|
||||
NSData *myData = nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
// checking [aValue length] takes too long!
|
||||
if (!aValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
if (aValue)
|
||||
{
|
||||
NSData *myData = [aValue dataUsingEncoding:_contentEncoding
|
||||
allowLossyConversion:NO];
|
||||
|
||||
_checkBody(self);
|
||||
(*_contentDataADImp)(_contentData,appendDataSel,myData);
|
||||
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);
|
||||
(*_contentDataADImp)(_contentData,appendDataSel,myData);
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
// Caching management
|
||||
if (_currentCacheData)
|
||||
{
|
||||
assertCurrentCacheDataADImp();
|
||||
(*_currentCacheDataADImp)(_currentCacheData,appendDataSel,myData);
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
LOGObjectFnStop();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)_appendContentAsciiString:(NSString*) aValue
|
||||
{
|
||||
NSData *myData = nil;
|
||||
char *lossyCString = NULL;
|
||||
int length = 0;
|
||||
int i,ch;
|
||||
|
||||
// checking [aValue length] takes too long!
|
||||
if (!aValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
lossyCString = [aValue lossyCString];
|
||||
length = strlen(lossyCString);
|
||||
LOGObjectFnStart();
|
||||
|
||||
_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++) {
|
||||
ch = lossyCString[i];
|
||||
myData=GSWMessageDataCache[ch];
|
||||
(*_contentDataADImp)(_contentData,appendDataSel,myData);
|
||||
}
|
||||
for (i=0; i<length;i++)
|
||||
{
|
||||
ch = lossyCString[i];
|
||||
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
|
||||
{
|
||||
|
@ -503,37 +691,19 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
|
|||
{
|
||||
[_contentData appendBytes:bytes
|
||||
length:length];
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
// Caching management
|
||||
if (_currentCacheData)
|
||||
{
|
||||
[_currentCacheData appendBytes:bytes
|
||||
length:length];
|
||||
};
|
||||
#endif
|
||||
};
|
||||
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:
|
||||
|
||||
|
@ -542,13 +712,31 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
|
|||
#ifndef NDEBUG
|
||||
if (GSDebugSet(@"debugComments") == YES)
|
||||
{
|
||||
[self appendContentString:@"\n<!-- "];
|
||||
[self appendContentString:aString];
|
||||
[self appendContentString:@" -->\n"];
|
||||
(*_appendContentStringIMP)(self,appendContentStringSEL,@"\n<!-- ");
|
||||
(*_appendContentStringIMP)(self,appendContentStringSEL,aString);
|
||||
(*_appendContentStringIMP)(self,appendContentStringSEL,@" -->\n");
|
||||
};
|
||||
#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
|
||||
|
||||
|
||||
|
@ -560,11 +748,14 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
|
|||
|
||||
-(void)appendContentHTMLAttributeValue:(NSString*)value
|
||||
{
|
||||
NSString* string=nil;
|
||||
LOGObjectFnStart();
|
||||
|
||||
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();
|
||||
};
|
||||
|
||||
|
@ -573,73 +764,67 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
|
|||
|
||||
-(void)appendContentHTMLString:(NSString*)aString
|
||||
{
|
||||
NSString* string=nil;
|
||||
LOGObjectFnStart();
|
||||
|
||||
NSDebugMLLog(@"low",@"aString=%@",aString);
|
||||
string=[NSString stringWithObject:aString];
|
||||
NSDebugMLLog(@"low",@"string=%@",string);
|
||||
[self appendContentString:[[self class]stringByEscapingHTMLString:string]];
|
||||
|
||||
(*_appendContentStringIMP)(self,appendContentStringSEL,
|
||||
(*_stringByEscapingHTMLStringIMP)
|
||||
(_selfClass,stringByEscapingHTMLStringSEL,aString));
|
||||
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendContentHTMLConvertString:(NSString*)aString
|
||||
{
|
||||
NSString* string=nil;
|
||||
LOGObjectFnStart();
|
||||
|
||||
NSDebugMLLog(@"low",@"aString=%@",aString);
|
||||
string=[NSString stringWithObject:aString];
|
||||
NSDebugMLLog(@"low",@"string=%@",string);
|
||||
[self appendContentString:[[self class]stringByConvertingToHTML:string]];
|
||||
|
||||
(*_appendContentStringIMP)(self,appendContentStringSEL,
|
||||
(*_stringByConvertingToHTMLIMP)
|
||||
(_selfClass,stringByConvertingToHTMLSEL,aString));
|
||||
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendContentHTMLEntitiesConvertString:(NSString*)aString
|
||||
{
|
||||
NSString* string=nil;
|
||||
LOGObjectFnStart();
|
||||
|
||||
NSDebugMLLog(@"low",@"aString=%@",aString);
|
||||
string=[NSString stringWithObject:aString];
|
||||
NSDebugMLLog(@"low",@"string=%@",string);
|
||||
[self appendContentString:[[self class]stringByConvertingToHTMLEntities:string]];
|
||||
|
||||
(*_appendContentStringIMP)(self,appendContentStringSEL,
|
||||
(*_stringByConvertingToHTMLEntitiesIMP)
|
||||
(_selfClass,stringByConvertingToHTMLEntitiesSEL,aString));
|
||||
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(NSString*)stringByEscapingHTMLString:(NSString*)aString
|
||||
{
|
||||
NSString* string=[NSString stringWithObject:aString];
|
||||
NSDebugMLLog(@"low",@"aString=%@",aString);
|
||||
NSDebugMLLog(@"low",@"string=%@",string);
|
||||
return [string stringByEscapingHTMLString];
|
||||
return [NSStringWithObject(aString) stringByEscapingHTMLString];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(NSString*)stringByEscapingHTMLAttributeValue:(NSString*)aString
|
||||
{
|
||||
NSString* string=[NSString stringWithObject:aString];
|
||||
NSDebugMLLog(@"low",@"aString=%@",aString);
|
||||
NSDebugMLLog(@"low",@"string=%@",string);
|
||||
return [string stringByEscapingHTMLAttributeValue];
|
||||
return [NSStringWithObject(aString) stringByEscapingHTMLAttributeValue];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(NSString*)stringByConvertingToHTMLEntities:(NSString*)aString
|
||||
{
|
||||
NSString* string=[NSString stringWithObject:aString];
|
||||
NSDebugMLLog(@"low",@"aString=%@",aString);
|
||||
NSDebugMLLog(@"low",@"string=%@",string);
|
||||
return [string stringByConvertingToHTMLEntities];
|
||||
return [NSStringWithObject(aString) stringByConvertingToHTMLEntities];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(NSString*)stringByConvertingToHTML:(NSString*)aString
|
||||
{
|
||||
NSString* string=[NSString stringWithObject:aString];
|
||||
NSDebugMLLog(@"low",@"aString=%@",aString);
|
||||
NSDebugMLLog(@"low",@"string=%@",string);
|
||||
return [string stringByConvertingToHTML];
|
||||
return [NSStringWithObject(aString) stringByConvertingToHTML];
|
||||
};
|
||||
|
||||
@end
|
||||
|
@ -791,3 +976,100 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
|
|||
|
||||
|
||||
@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
|
||||
|
|
|
@ -275,21 +275,24 @@ Bindings
|
|||
if (_noSelectionString)
|
||||
{
|
||||
id noSelectionStringValue=nil;
|
||||
[response _appendContentAsciiString:@"\n<OPTION"];
|
||||
if (_selectedValue && !selectedValueValue)
|
||||
{
|
||||
[response appendContentCharacter:' '];
|
||||
[response _appendContentAsciiString:@"selected"];//TODO
|
||||
};
|
||||
[response appendContentCharacter:'>'];
|
||||
|
||||
noSelectionStringValue=[_noSelectionString valueInComponent:component];
|
||||
if (escapeHTMLBoolValue)
|
||||
noSelectionStringValue=[GSWResponse stringByEscapingHTMLString:noSelectionStringValue];
|
||||
[response appendContentString:noSelectionStringValue];
|
||||
//[response appendContentHTMLString:_noSelectionStringValue];
|
||||
// There is no close tag on OPTION
|
||||
//[response _appendContentAsciiString:@"</OPTION>"];
|
||||
if (noSelectionStringValue)
|
||||
{
|
||||
[response _appendContentAsciiString:@"\n<OPTION"];
|
||||
if (_selectedValue && !selectedValueValue)
|
||||
{
|
||||
[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);
|
||||
|
@ -299,12 +302,12 @@ Bindings
|
|||
if (listValue)
|
||||
itemValue=[listValue objectAtIndex:i];
|
||||
else
|
||||
itemValue=GSWIntToNSString(i);
|
||||
itemValue=[NSNumber numberWithShort:i];
|
||||
if (_item)
|
||||
[_item setValue:itemValue
|
||||
inComponent:component];
|
||||
if (_index)
|
||||
[_index setValue: GSWIntToNSString(i)
|
||||
[_index setValue:[NSNumber numberWithShort:i]
|
||||
inComponent:component];
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
|
||||
|
@ -361,7 +364,7 @@ Bindings
|
|||
};
|
||||
|
||||
[response _appendContentAsciiString:@" value=\""];
|
||||
[response _appendContentAsciiString:valueValue];
|
||||
[response appendContentHTMLAttributeValue:valueValue];
|
||||
[response appendContentCharacter:'"'];
|
||||
[response appendContentCharacter:'>'];
|
||||
};
|
||||
|
@ -552,7 +555,7 @@ Bindings
|
|||
if (listValue)
|
||||
itemValue=[listValue objectAtIndex:i];
|
||||
else
|
||||
itemValue=GSWIntToNSString(i);
|
||||
itemValue=[NSNumber numberWithShort:i];
|
||||
NSDebugMLLog(@"gswdync",@"_itemValue=%@",itemValue);
|
||||
NSDebugMLLog(@"gswdync",@"_item=%@",_item);
|
||||
|
||||
|
@ -561,15 +564,20 @@ Bindings
|
|||
inComponent:component];
|
||||
|
||||
if (_index)
|
||||
[_index setValue:GSWIntToNSString(i)
|
||||
[_index setValue:[NSNumber numberWithShort:i]
|
||||
inComponent:component];
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",_value);
|
||||
if (_value) // Binded Value
|
||||
valueValue = [_value valueInComponent:component];
|
||||
{
|
||||
valueValue = [_value valueInComponent:component];
|
||||
valueValueString=NSStringWithObject(valueValue);
|
||||
}
|
||||
else // Auto Value
|
||||
valueValue=GSWIntToNSString(i);
|
||||
valueValueString=[NSString stringWithFormat:@"%@",valueValue];
|
||||
{
|
||||
valueValue=[NSNumber numberWithShort:i];
|
||||
valueValueString=GSWIntToNSString(i);
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
|
||||
if (valueValue)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
Date: Jan 1999
|
||||
|
||||
$Revision$
|
||||
$Date$
|
||||
|
@ -44,6 +44,8 @@ Bindings
|
|||
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.
|
||||
|
||||
enabled If evaluated to no, the button appear inactivated.
|
||||
**/
|
||||
|
||||
//====================================================================
|
||||
|
@ -155,8 +157,8 @@ Bindings
|
|||
NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue);
|
||||
if (selectionValue)
|
||||
{
|
||||
NSString* valueValueString=[NSString stringWithFormat:@"%@",valueValue];
|
||||
NSString* selectionValueString=[NSString stringWithFormat:@"%@",selectionValue];
|
||||
NSString* valueValueString=NSStringWithObject(valueValue);
|
||||
NSString* selectionValueString=NSStringWithObject(selectionValue);
|
||||
isChecked=SBIsValueEqual(selectionValueString,valueValueString);
|
||||
};
|
||||
};
|
||||
|
@ -206,7 +208,7 @@ Bindings
|
|||
|
||||
if (formValue && valueValue)
|
||||
{
|
||||
NSString* valueValueString=[NSString stringWithFormat:@"%@",valueValue];
|
||||
NSString* valueValueString=NSStringWithObject(valueValue);
|
||||
isChecked=SBIsValueEqual(formValue,valueValueString);
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"isChecked=%s",(isChecked ? "YES" : "NO"));
|
||||
|
|
|
@ -241,10 +241,15 @@ Bindings
|
|||
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",_value);
|
||||
if (_value) // Binded Value
|
||||
valueValue = [_value valueInComponent:component];
|
||||
{
|
||||
valueValue = [_value valueInComponent:component];
|
||||
valueValueString=NSStringWithObject(valueValue);
|
||||
}
|
||||
else // Auto Value
|
||||
valueValue = [NSNumber numberWithInt:i];
|
||||
valueValueString=[NSString stringWithFormat:@"%@",valueValue];
|
||||
{
|
||||
valueValue = [NSNumber numberWithShort:i];
|
||||
valueValueString=GSWIntToNSString(i);
|
||||
};
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
|
||||
|
@ -392,12 +397,17 @@ Bindings
|
|||
NSDebugMLLog(@"gswdync",@"_value (class: %@): %@",[_value class],_value);
|
||||
// Value property of the INPUT tag
|
||||
if (_value) // Binded Value
|
||||
valueValue = [_value valueInComponent:component];
|
||||
{
|
||||
valueValue = [_value valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
[response appendContentHTMLAttributeValue:valueValue];
|
||||
}
|
||||
else // Auto Value
|
||||
valueValue = [NSNumber numberWithInt:i];
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
|
||||
[response appendContentHTMLAttributeValue:valueValue];
|
||||
{
|
||||
valueValue = [NSNumber numberWithShort:i];
|
||||
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
|
||||
[response _appendContentAsciiString:GSWIntToNSString(i)];
|
||||
};
|
||||
[response appendContentCharacter:'"'];
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** 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>
|
||||
Date: Aug 2003
|
||||
|
@ -87,7 +87,7 @@ RCS_ID("$Id$")
|
|||
if (![fileManager createDirectoryAtPath:_recordingPath
|
||||
attributes:nil])
|
||||
{
|
||||
ExceptionRaise(@"GSWRecording: create directory '@'",_recordingPath);
|
||||
ExceptionRaise(@"GSWRecording: can't create directory '%@'",_recordingPath);
|
||||
};
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
|
@ -173,25 +173,26 @@ RCS_ID("$Id$")
|
|||
-(GSWResponse*)_wildcardedResponse:(GSWResponse*)response
|
||||
{
|
||||
NSString* sessionID = nil;
|
||||
NSMutableString* contentString = nil;
|
||||
NSMutableData* contentData = nil;
|
||||
int contentLength=0;
|
||||
NSString* applicationURLPrefix=nil;
|
||||
NSStringEncoding contentEncoding=GSUndefinedEncoding;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
response = (GSWResponse*)[[response copy]autorelease];
|
||||
sessionID = [response headerForKey:GSWHTTPHeader_RecordingSessionID[GSWebNamingConv]];
|
||||
NSDebugMLLog(@"GSWRecording",@"sessionID=%@",sessionID);
|
||||
contentString = [[[response contentString] mutableCopy]autorelease];
|
||||
contentLength=[contentString length];
|
||||
contentEncoding=[response contentEncoding];
|
||||
contentData = [[[response content] mutableCopy]autorelease];
|
||||
contentLength=[contentData length];
|
||||
|
||||
// Replace sessionID by ##GSWSESSIONID##
|
||||
if (sessionID)
|
||||
{
|
||||
[contentString replaceOccurrencesOfString:sessionID
|
||||
withString:@"##GSWSESSIONID##"
|
||||
options:0
|
||||
range:NSMakeRange(0,[contentString length])];
|
||||
[contentData replaceOccurrencesOfData:[sessionID dataUsingEncoding:contentEncoding]
|
||||
withData:[@"##GSWSESSIONID##" dataUsingEncoding:contentEncoding]
|
||||
range:NSMakeRange(0,[contentData length])];
|
||||
};
|
||||
|
||||
applicationURLPrefix=[_request _applicationURLPrefix];
|
||||
|
@ -199,17 +200,16 @@ RCS_ID("$Id$")
|
|||
applicationURLPrefix);
|
||||
NSAssert(applicationURLPrefix,@"No applicationURLPrefix");
|
||||
|
||||
[contentString replaceOccurrencesOfString:applicationURLPrefix
|
||||
withString:@"##GSWAPPURLPREFIX##"
|
||||
options:0
|
||||
range:NSMakeRange(0,[contentString length])];
|
||||
[contentData replaceOccurrencesOfData:[applicationURLPrefix dataUsingEncoding:contentEncoding]
|
||||
withData:[@"##GSWAPPURLPREFIX##" dataUsingEncoding:contentEncoding]
|
||||
range:NSMakeRange(0,[contentData length])];
|
||||
|
||||
// Set new Content Length
|
||||
[response setHeader:GSWIntToNSString([contentString length])
|
||||
[response setHeader:GSWIntToNSString([contentData length])
|
||||
forKey:@"GSWHTTPHeader_ContentLength"];
|
||||
[response setHeader:GSWIntToNSString(contentLength)
|
||||
forKey:@"x-gsweb-unwildcarded-content-length"];
|
||||
[response setContentString:contentString];
|
||||
[response setContent:contentData];
|
||||
|
||||
LOGObjectFnStop();
|
||||
return response;
|
||||
|
|
|
@ -35,9 +35,26 @@ RCS_ID("$Id$")
|
|||
|
||||
#include "GSWeb.h"
|
||||
|
||||
static SEL appendZeroElementIDComponentSEL=NULL;
|
||||
static SEL deleteLastElementIDComponentSEL=NULL;
|
||||
static SEL startOneIterationWithIndexSEL=NULL;
|
||||
static SEL stopOneIterationWithIndexSEL=NULL;
|
||||
|
||||
//====================================================================
|
||||
@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
|
||||
associations:(NSDictionary*)associations
|
||||
|
@ -243,10 +260,20 @@ RCS_ID("$Id$")
|
|||
#ifndef NDEBBUG
|
||||
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
|
||||
#endif
|
||||
|
||||
IMP appendZeroElementIDComponentIMP=NULL;
|
||||
IMP deleteLastElementIDComponentIMP=NULL;
|
||||
|
||||
IMP startOneIterationWithIndexIMP=NULL;
|
||||
IMP stopOneIterationWithIndexIMP=NULL;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
GSWStartElement(context);
|
||||
GSWSaveAppendToResponseElementID(context);
|
||||
|
||||
component=[context component];
|
||||
|
||||
[self getParameterValuesReturnList:&listValue
|
||||
count:&countValue
|
||||
startIndex:&startIndexValue
|
||||
|
@ -254,7 +281,17 @@ RCS_ID("$Id$")
|
|||
withComponent:component];
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"countValue=%d",countValue);
|
||||
|
||||
[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++)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
|
@ -264,10 +301,14 @@ RCS_ID("$Id$")
|
|||
startIndex:startIndexValue
|
||||
list:listValue
|
||||
inContext:context];
|
||||
[context appendZeroElementIDComponent];
|
||||
|
||||
(*appendZeroElementIDComponentIMP)(context,appendZeroElementIDComponentSEL);
|
||||
|
||||
[_childrenGroup appendToResponse:response
|
||||
inContext:context];
|
||||
[context deleteLastElementIDComponent];
|
||||
|
||||
(*deleteLastElementIDComponentIMP)(context,deleteLastElementIDComponentSEL);
|
||||
|
||||
[self stopOneIterationWithIndex:i
|
||||
stopIndex:stopIndexValue
|
||||
count:countValue
|
||||
|
@ -340,16 +381,36 @@ RCS_ID("$Id$")
|
|||
#ifndef NDEBBUG
|
||||
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
|
||||
#endif
|
||||
|
||||
IMP appendZeroElementIDComponentIMP=NULL;
|
||||
IMP deleteLastElementIDComponentIMP=NULL;
|
||||
|
||||
IMP startOneIterationWithIndexIMP=NULL;
|
||||
IMP stopOneIterationWithIndexIMP=NULL;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
GSWStartElement(context);
|
||||
GSWAssertCorrectElementID(context);
|
||||
|
||||
component=[context component];
|
||||
|
||||
[self getParameterValuesReturnList:&listValue
|
||||
count:&countValue
|
||||
startIndex:&startIndexValue
|
||||
stopIndex:&stopIndexValue
|
||||
withComponent:component];
|
||||
|
||||
[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++)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
|
@ -359,10 +420,14 @@ RCS_ID("$Id$")
|
|||
startIndex:startIndexValue
|
||||
list:listValue
|
||||
inContext:context];
|
||||
[context appendZeroElementIDComponent];
|
||||
|
||||
(*appendZeroElementIDComponentIMP)(context,appendZeroElementIDComponentSEL);
|
||||
|
||||
[_childrenGroup takeValuesFromRequest:request
|
||||
inContext:context];
|
||||
[context deleteLastElementIDComponent];
|
||||
|
||||
(*deleteLastElementIDComponentIMP)(context,deleteLastElementIDComponentSEL);
|
||||
|
||||
[self stopOneIterationWithIndex:i
|
||||
stopIndex:stopIndexValue
|
||||
count:countValue
|
||||
|
@ -401,15 +466,34 @@ RCS_ID("$Id$")
|
|||
#ifndef NDEBBUG
|
||||
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
|
||||
#endif
|
||||
|
||||
IMP appendZeroElementIDComponentIMP=NULL;
|
||||
IMP deleteLastElementIDComponentIMP=NULL;
|
||||
|
||||
IMP startOneIterationWithIndexIMP=NULL;
|
||||
IMP stopOneIterationWithIndexIMP=NULL;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
GSWStartElement(context);
|
||||
component=[context component];
|
||||
|
||||
[self getParameterValuesReturnList:&listValue
|
||||
count:&countValue
|
||||
startIndex:&startIndexValue
|
||||
stopIndex:&stopIndexValue
|
||||
withComponent:component];
|
||||
|
||||
[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++)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
|
@ -419,7 +503,9 @@ RCS_ID("$Id$")
|
|||
startIndex:startIndexValue
|
||||
list:listValue
|
||||
inContext:context];
|
||||
[context appendZeroElementIDComponent];
|
||||
|
||||
(*appendZeroElementIDComponentIMP)(context,appendZeroElementIDComponentSEL);
|
||||
|
||||
element=[_childrenGroup invokeActionForRequest:request
|
||||
inContext:context];
|
||||
NSAssert3(!element || [element isKindOfClass:[GSWElement class]],
|
||||
|
@ -427,7 +513,9 @@ RCS_ID("$Id$")
|
|||
_childrenGroup,
|
||||
[element class],
|
||||
element);
|
||||
[context deleteLastElementIDComponent];
|
||||
|
||||
(*deleteLastElementIDComponentIMP)(context,deleteLastElementIDComponentSEL);
|
||||
|
||||
[self stopOneIterationWithIndex:i
|
||||
stopIndex:stopIndexValue
|
||||
count:countValue
|
||||
|
@ -460,11 +548,22 @@ RCS_ID("$Id$")
|
|||
#ifndef NDEBBUG
|
||||
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
|
||||
#endif
|
||||
|
||||
IMP appendZeroElementIDComponentIMP=NULL;
|
||||
IMP deleteLastElementIDComponentIMP=NULL;
|
||||
|
||||
IMP startOneIterationWithIndexIMP=NULL;
|
||||
IMP stopOneIterationWithIndexIMP=NULL;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
GSWStartElement(context);
|
||||
|
||||
senderID=[context senderID];
|
||||
NSDebugMLLog(@"gswdync",@"senderID=%@",senderID);
|
||||
|
||||
elementID=[context elementID];
|
||||
|
||||
if ([senderID hasPrefix:elementID])
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
|
@ -481,18 +580,32 @@ RCS_ID("$Id$")
|
|||
startIndex:&startIndexValue
|
||||
stopIndex:&stopIndexValue
|
||||
withComponent:component];
|
||||
|
||||
[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++)
|
||||
{
|
||||
[self startOneIterationWithIndex:i
|
||||
startIndex:startIndexValue
|
||||
list:listValue
|
||||
inContext:context];
|
||||
[context appendZeroElementIDComponent];
|
||||
|
||||
(*appendZeroElementIDComponentIMP)(context,appendZeroElementIDComponentSEL);
|
||||
|
||||
element=[_childrenGroup invokeActionForRequest:request
|
||||
inContext:context];
|
||||
NSDebugMLLog(@"gswdync",@"element=%@",element);
|
||||
[context deleteLastElementIDComponent];
|
||||
|
||||
(*deleteLastElementIDComponentIMP)(context,deleteLastElementIDComponentSEL);
|
||||
|
||||
[self stopOneIterationWithIndex:i
|
||||
stopIndex:stopIndexValue
|
||||
count:countValue
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
|
@ -73,6 +73,12 @@ GSWEB_EXPORT NSDictionary* globalMime;
|
|||
inFramework:(NSString*)frameworkName
|
||||
languages:(NSArray*)languages;
|
||||
|
||||
//NDFN
|
||||
-(NSDictionary*)stringsTableNamed:(NSString*)tableName
|
||||
inFramework:(NSString*)aFrameworkName
|
||||
languages:(NSArray*)languages
|
||||
foundLanguage:(NSString**)foundLanguagePtr;
|
||||
|
||||
//NDFN
|
||||
-(NSDictionary*)stringsTableNamed:(NSString*)tableName
|
||||
inFramework:(NSString*)frameworkName
|
||||
|
@ -91,11 +97,32 @@ GSWEB_EXPORT NSDictionary* globalMime;
|
|||
inTableNamed:(NSString*)tableName
|
||||
inFramework:(NSString*)framework
|
||||
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
|
||||
-(NSDictionary*)lockedStringsTableNamed:(NSString*)tableName
|
||||
inFramework:(NSString*)framework
|
||||
languages:(NSArray*)languages;
|
||||
|
||||
//NDFN
|
||||
-(NSArray*)lockedStringsTableArrayNamed:(NSString*)aTableName
|
||||
inFramework:(NSString*)aFrameworkName
|
||||
languages:(NSArray*)languages
|
||||
foundLanguage:(NSString**)foundLanguagePtr;
|
||||
|
||||
//NDFN
|
||||
-(NSArray*)lockedStringsTableArrayNamed:(NSString*)tableName
|
||||
inFramework:(NSString*)framework
|
||||
|
|
|
@ -381,7 +381,8 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
|||
//NDFN
|
||||
-(NSDictionary*)stringsTableNamed:(NSString*)tableName
|
||||
inFramework:(NSString*)aFrameworkName
|
||||
languages:(NSArray*)languages;
|
||||
languages:(NSArray*)languages
|
||||
foundLanguage:(NSString**)foundLanguagePtr
|
||||
{
|
||||
NSDictionary* stringsTable=nil;
|
||||
LOGObjectFnStart();
|
||||
|
@ -391,7 +392,8 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
|||
{
|
||||
stringsTable=[self lockedStringsTableNamed:tableName
|
||||
inFramework:aFrameworkName
|
||||
languages:languages];
|
||||
languages:languages
|
||||
foundLanguage:foundLanguagePtr];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
|
@ -407,6 +409,18 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
|||
return stringsTable;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//NDFN
|
||||
-(NSDictionary*)stringsTableNamed:(NSString*)tableName
|
||||
inFramework:(NSString*)aFrameworkName
|
||||
languages:(NSArray*)languages;
|
||||
{
|
||||
return [self stringsTableNamed:tableName
|
||||
inFramework:aFrameworkName
|
||||
languages:languages
|
||||
foundLanguage:NULL];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//NDFN
|
||||
-(NSArray*)stringsTableArrayNamed:(NSString*)tableName
|
||||
|
@ -468,6 +482,7 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
|||
inTableNamed:(NSString*)aTableName
|
||||
inFramework:(NSString*)aFrameworkName
|
||||
languages:(NSArray*)languages
|
||||
foundLanguage:(NSString**)foundLanguagePtr
|
||||
{
|
||||
//OK
|
||||
NSString* string=nil;
|
||||
|
@ -477,33 +492,41 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
|||
int iFramework=0;
|
||||
NSArray* frameworks=nil;
|
||||
NSString* frameworkName=nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all])
|
||||
{
|
||||
frameworks=[_frameworkProjectBundlesCache allKeys];
|
||||
frameworks=[frameworks arrayByAddingObject:@""];
|
||||
}
|
||||
_count=[languages count];
|
||||
|
||||
NSDebugMLLog(@"resmanager",@"languages=%@",languages);
|
||||
NSDebugMLLog(@"resmanager",@"frameworks=%@",frameworks);
|
||||
|
||||
for(i=0;!string && i<=_count;i++)
|
||||
{
|
||||
if (i<_count)
|
||||
language=[languages objectAtIndex:i];
|
||||
else
|
||||
language=nil;
|
||||
for(iFramework=0;!string && iFramework<[frameworks count];iFramework++)
|
||||
{
|
||||
frameworkName=[frameworks objectAtIndex:iFramework];
|
||||
if ([frameworkName length]==0)
|
||||
frameworkName=nil;
|
||||
string=[self lockedCachedStringForKey:aKey
|
||||
inTableNamed:aTableName
|
||||
inFramework:frameworkName
|
||||
language:language];
|
||||
};
|
||||
};
|
||||
{
|
||||
if (i<_count)
|
||||
language=[languages objectAtIndex:i];
|
||||
else
|
||||
language=nil;
|
||||
for(iFramework=0;!string && iFramework<[frameworks count];iFramework++)
|
||||
{
|
||||
frameworkName=[frameworks objectAtIndex:iFramework];
|
||||
if ([frameworkName length]==0)
|
||||
frameworkName=nil;
|
||||
string=[self lockedCachedStringForKey:aKey
|
||||
inTableNamed:aTableName
|
||||
inFramework:frameworkName
|
||||
language:language];
|
||||
if (string && foundLanguagePtr)
|
||||
*foundLanguagePtr=language;
|
||||
};
|
||||
};
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
return string;
|
||||
};
|
||||
|
||||
|
@ -512,6 +535,7 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
|||
-(NSDictionary*)lockedStringsTableNamed:(NSString*)aTableName
|
||||
inFramework:(NSString*)aFrameworkName
|
||||
languages:(NSArray*)languages
|
||||
foundLanguage:(NSString**)foundLanguagePtr
|
||||
{
|
||||
//OK
|
||||
NSDictionary* stringsTable=nil;
|
||||
|
@ -521,7 +545,9 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
|||
int iFramework=0;
|
||||
NSArray* frameworks=nil;
|
||||
NSString* frameworkName=nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
_count=[languages count];
|
||||
if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all])
|
||||
{
|
||||
|
@ -530,33 +556,66 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
|||
}
|
||||
else
|
||||
frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""];
|
||||
|
||||
for(i=0;!stringsTable && i<_count;i++)
|
||||
{
|
||||
language=[languages objectAtIndex:i];
|
||||
for(iFramework=0;!stringsTable && iFramework<[frameworks count];iFramework++)
|
||||
{
|
||||
frameworkName=[frameworks objectAtIndex:iFramework];
|
||||
if ([frameworkName length]==0)
|
||||
frameworkName=nil;
|
||||
stringsTable=[self lockedCachedStringsTableWithName:aTableName
|
||||
inFramework:frameworkName
|
||||
language:language];
|
||||
};
|
||||
};
|
||||
{
|
||||
language=[languages objectAtIndex:i];
|
||||
for(iFramework=0;!stringsTable && iFramework<[frameworks count];iFramework++)
|
||||
{
|
||||
frameworkName=[frameworks objectAtIndex:iFramework];
|
||||
if ([frameworkName length]==0)
|
||||
frameworkName=nil;
|
||||
stringsTable=[self lockedCachedStringsTableWithName:aTableName
|
||||
inFramework:frameworkName
|
||||
language:language];
|
||||
if (stringsTable && foundLanguagePtr)
|
||||
*foundLanguagePtr=language;
|
||||
};
|
||||
};
|
||||
|
||||
NSDebugMLLog(@"resmanager",@"lockedStringsTableNamed:%@ inFramework:%@ languages:%@: %@",
|
||||
aTableName,
|
||||
aFrameworkName,
|
||||
languages,
|
||||
stringsTable);
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
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
|
||||
-(NSArray*)lockedStringsTableArrayNamed:(NSString*)aTableName
|
||||
inFramework:(NSString*)aFrameworkName
|
||||
languages:(NSArray*)languages
|
||||
inFramework:(NSString*)aFrameworkName
|
||||
languages:(NSArray*)languages
|
||||
foundLanguage:(NSString**)foundLanguagePtr
|
||||
{
|
||||
//OK
|
||||
NSArray* stringsTableArray=nil;
|
||||
|
@ -566,32 +625,50 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
|||
int iFramework=0;
|
||||
NSArray* frameworks=nil;
|
||||
NSString* frameworkName=nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
_count=[languages count];
|
||||
|
||||
if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all])
|
||||
{
|
||||
frameworks=[_frameworkProjectBundlesCache allKeys];
|
||||
frameworks=[frameworks arrayByAddingObject:@""];
|
||||
}
|
||||
{
|
||||
frameworks=[_frameworkProjectBundlesCache allKeys];
|
||||
frameworks=[frameworks arrayByAddingObject:@""];
|
||||
}
|
||||
else
|
||||
frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""];
|
||||
frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""];
|
||||
|
||||
for(i=0;!stringsTableArray && i<_count;i++)
|
||||
{
|
||||
language=[languages objectAtIndex:i];
|
||||
for(iFramework=0;!stringsTableArray && iFramework<[frameworks count];iFramework++)
|
||||
{
|
||||
frameworkName=[frameworks objectAtIndex:iFramework];
|
||||
if ([frameworkName length]==0)
|
||||
frameworkName=nil;
|
||||
stringsTableArray=[self lockedCachedStringsTableArrayWithName:aTableName
|
||||
inFramework:frameworkName
|
||||
language:language];
|
||||
};
|
||||
};
|
||||
{
|
||||
language=[languages objectAtIndex:i];
|
||||
for(iFramework=0;!stringsTableArray && iFramework<[frameworks count];iFramework++)
|
||||
{
|
||||
frameworkName=[frameworks objectAtIndex:iFramework];
|
||||
if ([frameworkName length]==0)
|
||||
frameworkName=nil;
|
||||
stringsTableArray=[self lockedCachedStringsTableArrayWithName:aTableName
|
||||
inFramework:frameworkName
|
||||
language:language];
|
||||
if (stringsTableArray && foundLanguagePtr)
|
||||
*foundLanguagePtr=language;
|
||||
};
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
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
|
||||
inTableNamed:(NSString*)aTableName
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
|
@ -47,6 +47,7 @@
|
|||
unsigned int _contentStreamBufferSize;
|
||||
unsigned long _contentStreamBufferLength;
|
||||
NSArray* _acceptedEncodings;
|
||||
BOOL _canDisableClientCaching;
|
||||
BOOL _isClientCachingDisabled;
|
||||
BOOL _contentFaultsHaveBeenResolved;
|
||||
BOOL _isFinalizeInContextHasBeenCalled;
|
||||
|
@ -62,6 +63,9 @@
|
|||
|
||||
-(void)disableClientCaching;
|
||||
|
||||
// should be called before finalizeInContext
|
||||
-(void)setCanDisableClientCaching:(BOOL)yn;
|
||||
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
|
@ -68,6 +68,7 @@ static NSArray* cacheControlHeaderValues=nil;
|
|||
LOGObjectFnStart();
|
||||
if ((self=[super init]))
|
||||
{
|
||||
_canDisableClientCaching=YES;
|
||||
_status=200;
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
|
@ -98,6 +99,7 @@ static NSArray* cacheControlHeaderValues=nil;
|
|||
ASSIGNCOPY(clone->_contentFaults,_contentFaults);
|
||||
ASSIGNCOPY(clone->_acceptedEncodings,_acceptedEncodings);
|
||||
clone->_isClientCachingDisabled=_isClientCachingDisabled;
|
||||
clone->_canDisableClientCaching=_canDisableClientCaching;
|
||||
clone->_contentFaultsHaveBeenResolved=_contentFaultsHaveBeenResolved;
|
||||
};
|
||||
return clone;
|
||||
|
@ -146,11 +148,19 @@ static NSArray* cacheControlHeaderValues=nil;
|
|||
return _status;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// should be called before finalizeInContext
|
||||
-(void)setCanDisableClientCaching:(BOOL)yn
|
||||
{
|
||||
_canDisableClientCaching=yn;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)disableClientCaching
|
||||
{
|
||||
LOGObjectFnStart();
|
||||
if (!_isClientCachingDisabled)
|
||||
|
||||
if (!_isClientCachingDisabled && _canDisableClientCaching)
|
||||
{
|
||||
[self setHeader:disabledCacheDateString
|
||||
forKey:@"date"];
|
||||
|
@ -164,6 +174,7 @@ static NSArray* cacheControlHeaderValues=nil;
|
|||
forKey:@"cache-control"];
|
||||
_isClientCachingDisabled=YES;
|
||||
};
|
||||
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
|
@ -59,6 +59,7 @@
|
|||
BOOL _storesIDsInCookies;
|
||||
BOOL _storesIDsInURLs;
|
||||
BOOL _hasSessionLockedEditingContext;
|
||||
NSString* _domainForIDCookies;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -294,6 +294,8 @@ RCS_ID("$Id$")
|
|||
DESTROY(_permanentPageCache);
|
||||
NSDebugFLog0(@"Dealloc GSWSession: permanentContextIDArray");
|
||||
DESTROY(_permanentContextIDArray);
|
||||
NSDebugFLog0(@"Dealloc GSWSession: domainForIDCookies");
|
||||
DESTROY(_domainForIDCookies);
|
||||
NSDebugFLog0(@"Dealloc GSWSession Super");
|
||||
[super dealloc];
|
||||
NSDebugFLog0(@"End Dealloc GSWSession");
|
||||
|
@ -366,27 +368,34 @@ RCS_ID("$Id$")
|
|||
-(NSString*)domainForIDCookies
|
||||
{
|
||||
//OK
|
||||
NSString* domain=nil;
|
||||
GSWContext* context=nil;
|
||||
GSWRequest* request=nil;
|
||||
NSString* applicationName=nil;
|
||||
NSString* adaptorPrefix=nil;
|
||||
LOGObjectFnStart();
|
||||
[[GSWApplication application]lock];
|
||||
context=[self context];
|
||||
request=[context request];
|
||||
applicationName=[request applicationName];
|
||||
NSDebugMLLog(@"sessions",@"applicationName=%@",applicationName);
|
||||
adaptorPrefix=[request adaptorPrefix];
|
||||
NSDebugMLLog(@"sessions",@"adaptorPrefix=%@",adaptorPrefix);
|
||||
[[GSWApplication application]unlock];
|
||||
domain=[NSString stringWithFormat:@"%@/%@.%@",
|
||||
adaptorPrefix,
|
||||
applicationName,
|
||||
GSWApplicationSuffix[GSWebNamingConv]];
|
||||
NSDebugMLLog(@"sessions",@"domain=%@",domain);
|
||||
|
||||
if (!_domainForIDCookies)
|
||||
{
|
||||
GSWContext* context=nil;
|
||||
GSWRequest* request=nil;
|
||||
NSString* applicationName=nil;
|
||||
NSString* adaptorPrefix=nil;
|
||||
[[GSWApplication application]lock];
|
||||
context=[self context];
|
||||
request=[context request];
|
||||
applicationName=[request applicationName];
|
||||
NSDebugMLLog(@"sessions",@"applicationName=%@",applicationName);
|
||||
adaptorPrefix=[request adaptorPrefix];
|
||||
NSDebugMLLog(@"sessions",@"adaptorPrefix=%@",adaptorPrefix);
|
||||
[[GSWApplication application]unlock];
|
||||
ASSIGN(_domainForIDCookies,
|
||||
([NSString stringWithFormat:@"%@/%@.%@",
|
||||
adaptorPrefix,
|
||||
applicationName,
|
||||
GSWApplicationSuffix[GSWebNamingConv]]));
|
||||
};
|
||||
|
||||
NSDebugMLLog(@"sessions",@"_domainForIDCookies=%@",_domainForIDCookies);
|
||||
|
||||
LOGObjectFnStop();
|
||||
return domain;
|
||||
|
||||
return _domainForIDCookies;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -866,22 +875,34 @@ RCS_ID("$Id$")
|
|||
NSString* domainForIDCookies=nil;
|
||||
NSString* sessionID=nil;
|
||||
NSDate* anExpireDate=nil;
|
||||
GSWCookie* sessionIDCookie=nil;
|
||||
GSWCookie* instanceIDCookie=nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
domainForIDCookies=[self domainForIDCookies];
|
||||
sessionID=[self sessionID];
|
||||
anExpireDate=[NSDate date]; // Expire now
|
||||
[aResponse addCookie:[GSWCookie cookieWithName:GSWKey_SessionID[GSWebNamingConv]
|
||||
value:sessionID
|
||||
path:domainForIDCookies
|
||||
domain:nil
|
||||
expires:anExpireDate
|
||||
isSecure:NO]];
|
||||
[aResponse addCookie:[GSWCookie cookieWithName:GSWKey_InstanceID[GSWebNamingConv]
|
||||
value:@"-1"
|
||||
path:domainForIDCookies
|
||||
domain:nil
|
||||
expires:anExpireDate
|
||||
isSecure:NO]];
|
||||
|
||||
sessionIDCookie=[GSWCookie cookieWithName:GSWKey_SessionID[GSWebNamingConv]
|
||||
value:sessionID
|
||||
path:domainForIDCookies
|
||||
domain:nil
|
||||
expires:anExpireDate
|
||||
isSecure:NO];
|
||||
NSDebugMLLog(@"sessions",@"sessionIDCookie=%@",sessionIDCookie);
|
||||
|
||||
[aResponse addCookie:sessionIDCookie];
|
||||
|
||||
instanceIDCookie=[GSWCookie cookieWithName:GSWKey_InstanceID[GSWebNamingConv]
|
||||
value:@"-1"
|
||||
path:domainForIDCookies
|
||||
domain:nil
|
||||
expires:anExpireDate
|
||||
isSecure:NO];
|
||||
NSDebugMLLog(@"sessions",@"instanceIDCookie=%@",instanceIDCookie);
|
||||
|
||||
[aResponse addCookie:instanceIDCookie];
|
||||
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
@ -1569,8 +1590,7 @@ Returns first element of languages or nil if languages is empty
|
|||
// awake
|
||||
-(void)awake
|
||||
{
|
||||
//ok
|
||||
//Does Nothing
|
||||
DESTROY(_domainForIDCookies);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -1578,7 +1598,9 @@ Returns first element of languages or nil if languages is empty
|
|||
|
||||
-(void)sleep
|
||||
{
|
||||
//Does Nothing
|
||||
// We destroy domainForIDCookies because applictaion name may
|
||||
// change between pages
|
||||
DESTROY(_domainForIDCookies);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
|
@ -46,14 +46,10 @@
|
|||
GSWAssociation* _formatter;
|
||||
};
|
||||
|
||||
-(void)dealloc;
|
||||
|
||||
-(id)initWithName:(NSString*)name
|
||||
associations:(NSDictionary*)associations
|
||||
contentElements:(NSArray*)elements;
|
||||
|
||||
-(NSString*)description;
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
|
@ -66,6 +62,7 @@
|
|||
-(NSFormatter*)formatterForComponent:(GSWComponent*)component
|
||||
value:(id)value;
|
||||
-(NSString*)elementName;
|
||||
-(NSString*)formattedValueInContext:(GSWContext*)context;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
|
@ -121,37 +121,23 @@ RCS_ID("$Id$")
|
|||
GSWRequest* request=nil;
|
||||
BOOL isFromClientComponent=NO;
|
||||
GSWComponent* component=nil;
|
||||
id valueValue = nil;
|
||||
|
||||
LOGObjectFnStartC("GSWString");
|
||||
|
||||
GSWStartElement(context);
|
||||
GSWSaveAppendToResponseElementID(context);
|
||||
|
||||
request=[context request];
|
||||
isFromClientComponent=[request isFromClientComponent];
|
||||
component=[context component];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: component=%@",component);
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: value=%@",_value);
|
||||
valueValue = [_value valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"GSWString: valueValue=%@",valueValue);
|
||||
if (valueValue)
|
||||
|
||||
formattedValue=[self formattedValueInContext:context];
|
||||
|
||||
if (formattedValue)
|
||||
{
|
||||
BOOL escapeHTMLValue=YES;
|
||||
BOOL convertHTMLValue=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)
|
||||
convertHTMLValue=[self evaluateCondition:_convertHTML
|
||||
|
@ -184,7 +170,9 @@ RCS_ID("$Id$")
|
|||
else
|
||||
[response appendContentString:formattedValue];
|
||||
};
|
||||
|
||||
GSWStopElement(context);
|
||||
|
||||
LOGObjectFnStopC("GSWString");
|
||||
};
|
||||
|
||||
|
@ -249,6 +237,47 @@ RCS_ID("$Id$")
|
|||
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
|
||||
|
||||
|
|
|
@ -406,4 +406,15 @@ typedef enum _NSNumFmtType
|
|||
range: (NSRange)searchRange;
|
||||
@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__
|
||||
|
|
|
@ -78,68 +78,26 @@ char* GSWIntToString(char* buffer,unsigned int bufferSize,int value,unsigned int
|
|||
return buffer;
|
||||
};
|
||||
|
||||
|
||||
NSString* cachedStringForInt(int value)
|
||||
{
|
||||
switch(value)
|
||||
{
|
||||
case 0: return @"0"; break;
|
||||
case 1: return @"1"; break;
|
||||
case 2: return @"2"; break;
|
||||
case 3: return @"3"; break;
|
||||
case 4: return @"4"; break;
|
||||
case 5: return @"5"; break;
|
||||
case 6: return @"6"; break;
|
||||
case 7: return @"7"; break;
|
||||
case 8: return @"8"; break;
|
||||
case 9: return @"9"; break;
|
||||
case 10: return @"10"; break;
|
||||
case 11: return @"11"; break;
|
||||
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;
|
||||
};
|
||||
|
||||
static NSString* cachedString[] = {
|
||||
@"0", @"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9",
|
||||
@"10", @"11", @"12", @"13", @"14", @"15", @"16", @"17", @"18", @"19",
|
||||
@"20", @"21", @"22", @"23", @"24", @"25", @"26", @"27", @"28", @"29",
|
||||
@"30", @"31", @"32", @"33", @"34", @"35", @"36", @"37", @"38", @"39",
|
||||
@"40", @"41", @"42", @"43", @"44", @"45", @"46", @"47", @"48", @"49",
|
||||
@"50", @"51", @"52", @"53", @"54", @"55", @"56", @"57", @"58", @"59",
|
||||
@"60", @"61", @"62", @"63", @"64", @"65", @"66", @"67", @"68", @"69",
|
||||
@"70", @"71", @"72", @"73", @"74", @"75", @"76", @"77", @"78", @"79",
|
||||
@"80", @"81", @"82", @"83", @"84", @"85", @"86", @"87", @"88", @"89",
|
||||
@"90", @"91", @"92", @"93", @"94", @"95", @"96", @"97", @"98", @"99" };
|
||||
if (value>=0 && value <100)
|
||||
return cachedString[value];
|
||||
else
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
NSString* GSWIntToNSString(int value)
|
||||
{
|
||||
NSString* s=nil;
|
||||
|
@ -244,6 +202,10 @@ BOOL SBIsEqual(id id1,id id2)
|
|||
{
|
||||
if (id2)
|
||||
equal=[id1 isEqual:id2];
|
||||
}
|
||||
else if (!id2)
|
||||
{
|
||||
equal=YES;
|
||||
};
|
||||
return equal;
|
||||
};
|
||||
|
@ -257,12 +219,12 @@ BOOL SBIsValueEqual(id id1,id id2)
|
|||
{
|
||||
if ([id1 isKindOfClass:[NSString class]])
|
||||
{
|
||||
NSString* id2String=[NSString stringWithObject:id2];
|
||||
NSString* id2String=NSStringWithObject(id2);
|
||||
equal=[id1 isEqualToString:id2String];
|
||||
}
|
||||
else if ([id2 isKindOfClass:[NSString class]])
|
||||
{
|
||||
NSString* id1String=[NSString stringWithObject:id1];
|
||||
NSString* id1String=NSStringWithObject(id1);
|
||||
equal=[id2 isEqualToString:id1String];
|
||||
};
|
||||
};
|
||||
|
@ -1872,3 +1834,146 @@ NSString* GSWGetDefaultDocRoot()
|
|||
return count;
|
||||
}
|
||||
@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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** 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>
|
||||
Date: Jan 1999
|
||||
|
@ -509,7 +509,18 @@ initHtmlChars()
|
|||
if ([self length]>0)
|
||||
{
|
||||
//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" withString:@"<BR>"];
|
||||
[tmp replaceString:@"\n" withString:@"<BR>"];
|
||||
|
@ -526,7 +537,18 @@ initHtmlChars()
|
|||
if ([self length]>0)
|
||||
{
|
||||
//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"];
|
||||
str = AUTORELEASE([tmp copy]);
|
||||
RELEASE(tmp);
|
||||
|
|
|
@ -63,6 +63,8 @@
|
|||
@end
|
||||
|
||||
//====================================================================
|
||||
GSWEB_EXPORT NSString* NSStringWithObject(id object);
|
||||
|
||||
@interface NSString (stringWithObject)
|
||||
+(NSString*)stringWithObject:(id)object;
|
||||
@end
|
||||
|
|
|
@ -202,21 +202,39 @@ RCS_ID("$Id$")
|
|||
@end
|
||||
|
||||
//====================================================================
|
||||
@implementation NSString (stringWithObject)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(NSString*)stringWithObject:(id)object
|
||||
NSString* NSStringWithObject(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;
|
||||
if (object)
|
||||
{
|
||||
if ([object isKindOfClass:[NSString class]])
|
||||
string=[[object copy] autorelease];
|
||||
if ([object isKindOfClass:theNSMutableStringClass])
|
||||
string=AUTORELEASE([object copy]);
|
||||
else if ([object isKindOfClass:theNSStringClass])
|
||||
string=(NSString*)object;
|
||||
#ifdef HAVE_GDL2
|
||||
else if ([object isKindOfClass:[EONull class]])
|
||||
else if ([object isKindOfClass:theEONullClass])
|
||||
string=@"";
|
||||
#else
|
||||
else if ([object isKindOfClass:[NSNull class]])
|
||||
else if ([object isKindOfClass:theNSNullClass])
|
||||
string=@"";
|
||||
#endif
|
||||
else if ([object respondsToSelector:@selector(stringValue)])
|
||||
|
@ -228,6 +246,14 @@ RCS_ID("$Id$")
|
|||
};
|
||||
return string;
|
||||
};
|
||||
|
||||
@implementation NSString (stringWithObject)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(NSString*)stringWithObject:(id)object
|
||||
{
|
||||
return NSStringWithObject(object);
|
||||
};
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
|
|
Loading…
Reference in a new issue