* GSWeb.framework/GSWWOCompatibility.h: Fix typo.

* GSWeb.framework/GSWURLValuedElementData.m
	([GSWURLValuedElementData initWithData:mimeType:key:]): Call
	stringUniqueIdWithLength: with minimal allowed length.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@18434 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Ayers 2004-01-18 13:06:12 +00:00
parent 96fe2fa296
commit 6828d6442f
9 changed files with 349 additions and 34 deletions

View file

@ -1622,6 +1622,40 @@ selfLockn,
};
};
};
if (!componentDefinition)
{
static Class gswCClass = nil;
Class cClass = NSClassFromString([aName lastPathComponent]);
if (gswCClass == nil)
{
gswCClass = [GSWComponent class];
}
if (cClass != 0 && [cClass isSubclassOfClass: gswCClass])
{
NSString *baseURL
= @"/ERROR/RelativeUrlsNotSupportedWhenCompenentHasNoWrapper";
NSString *bundlePath
= [[NSBundle bundleForClass: cClass] bundlePath];
NSString *frameworkName
= [[bundlePath lastPathComponent] stringByDeletingPathExtension];
componentDefinition
= AUTORELEASE([[GSWComponentDefinition alloc]
initWithName: aName
path: bundlePath
baseURL: baseURL
frameworkName: frameworkName]);
if ([self isCachingEnabled])
{
[_componentDefinitionCache setObject: componentDefinition
forKeys: aName, nil];
}
}
}
if (!componentDefinition)
{
NSLog(@"EXCEPTION: allFrameworks pathes=%@",[[NSBundle allFrameworks] valueForKey:@"resourcePath"]);

View file

@ -355,6 +355,12 @@ extern id noSelectionString__Key;
extern id displayString__Key;
extern id filePath__Key;
extern id language__Key;
extern id omitTags__Key;
extern id formValue__Key;
extern id formValues__Key;
extern id invokeAction__Key;
extern id elementID__Key;
extern id otherTagString__Key;
//GSWeb Additions
extern id redirectURL__Key;

View file

@ -354,6 +354,12 @@ id noSelectionString__Key = @"noSelectionString";
id displayString__Key = @"displayString";
id filePath__Key = @"filePath";
id language__Key= @"language";
id omitTags__Key = @"omitTag";
id formValue__Key = @"formValue";
id formValues__Key = @"formValues";
id invokeAction__Key = @"invokeAction";
id elementID__Key = @"elementID";
id otherTagString__Key = @"otherTagString";
//GSWeb additions
id redirectURL__Key = @"redirectURL";

View file

@ -41,7 +41,7 @@
GSWAssociation* _formValue;
GSWAssociation* _formValues;
GSWAssociation* _invokeAction;
GSWAssociation* _elementId;
GSWAssociation* _elementID;
GSWAssociation* _otherTagString;
NSDictionary* _otherAssociations;
BOOL _hasFormValues;
@ -63,8 +63,8 @@
-(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context;
-(id)_elementNameAppenedToResponse:(GSWResponse*)response
inContext:(GSWContext*)context;
-(id)_elementNameAppendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context;
-(void)_appendTagWithName:(NSString*)name
toResponse:(GSWResponse*)response

View file

@ -40,21 +40,69 @@ RCS_ID("$Id$")
associations:(NSDictionary*)associations
template:(GSWElement*)templateElement
{
LOGObjectFnNotImplemented(); //TODOFN
return nil;
if ((self=[super initWithName: name
associations: associations
template: templateElement]))
{
NSMutableDictionary *dict;
ASSIGN(_name, [associations objectForKey: name__Key]);
ASSIGN(_omitTags, [associations objectForKey: omitTags__Key]);
ASSIGN(_formValue, [associations objectForKey: formValue__Key]);
ASSIGN(_formValues, [associations objectForKey: formValues__Key]);
ASSIGN(_invokeAction, [associations objectForKey: invokeAction__Key]);
ASSIGN(_elementID, [associations objectForKey: elementID__Key]);
ASSIGN(_otherTagString, [associations objectForKey: otherTagString__Key]);
if(_formValue || _formValues)
{
_hasFormValues = YES;
if (name == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"%@(%@):Attribute 'name' is manditory "
@"when formValue(s) are supplied. (%@)",
[self description],
NSStringFromSelector(_cmd),
associations];
}
}
dict = AUTORELEASE([associations mutableCopy]);
[dict removeObjectForKey: name__Key];
[dict removeObjectForKey: omitTags__Key];
[dict removeObjectForKey: formValue__Key];
[dict removeObjectForKey: formValues__Key];
[dict removeObjectForKey: invokeAction__Key];
[dict removeObjectForKey: elementID__Key];
[dict removeObjectForKey: otherTagString__Key];
ASSIGNCOPY(_otherAssociations, dict);
}
return self;
};
//--------------------------------------------------------------------
-(void)dealloc
{
LOGObjectFnNotImplemented(); //TODOFN
RELEASE (_name);
RELEASE (_omitTags);
RELEASE (_formValue);
RELEASE (_formValues);
RELEASE (_invokeAction);
RELEASE (_elementID);
RELEASE (_otherTagString);
RELEASE (_otherAssociations);
[super dealloc];
};
//--------------------------------------------------------------------
-(NSString*)description
{
LOGObjectFnNotImplemented(); //TODOFN
return nil;
return [NSString stringWithFormat:@"%@(%p)\n(%@)",
NSStringFromClass([self class]), self, _otherAssociations];
};
//--------------------------------------------------------------------
@ -62,7 +110,7 @@ RCS_ID("$Id$")
-(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context
{
LOGObjectFnNotImplemented(); //TODOFN
[self _elementNameAppendToResponse: response inContext: context];
};
//--------------------------------------------------------------------
@ -70,8 +118,57 @@ RCS_ID("$Id$")
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context
{
LOGObjectFnNotImplemented(); //TODOFN
return nil;
GSWElement *element;
GSWComponent *comp;
element = nil;
comp = [context component];
if (_invokeAction != nil
&& [_invokeAction isImplementedForComponent: comp])
{
NSString *elementID;
NSString *senderID;
elementID = [context elementID];
senderID = [context senderID];
if ([elementID isEqualToString: senderID])
{
id nameValue;
id formValue;
/* This implicitly also tests _hasFormValues
as then we must have a _name,
but since we need the _name anyway,
we can skip the extra test. */
if (_name == nil)
{
return element;
}
nameValue = [_name valueInComponent: comp];
formValue = [request formValueForKey: nameValue];
if (formValue == nil)
{
return element;
}
}
if (_elementID != nil)
{
[_elementID setValue: [elementID description]
inComponent: comp];
}
element = [_invokeAction valueInComponent: comp];
if (element != nil)
{
return element;
}
element = [context page];
}
return element;
};
//--------------------------------------------------------------------
@ -79,16 +176,56 @@ RCS_ID("$Id$")
-(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context
{
LOGObjectFnNotImplemented(); //TODOFN
if (_hasFormValues)
{
GSWComponent *comp;
NSString *elementID;
id nameValue;
comp = [context component];
elementID = [context elementID];
nameValue = [_name valueInComponent: comp];
if (_elementID != nil)
{
[_elementID setValue: [elementID description]
inComponent: comp];
}
if (_formValue != nil)
{
[_formValue setValue: [request formValueForKey: nameValue]
inComponent: comp];
}
if (_formValues != nil)
{
[_formValue setValue: [request formValuesForKey: nameValue]
inComponent: comp];
}
}
};
//--------------------------------------------------------------------
-(id)_elementNameAppenedToResponse:(GSWResponse*)response
inContext:(GSWContext*)context
-(id)_elementNameAppendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context
{
LOGObjectFnNotImplemented(); //TODOFN
return nil;
NSString *elementName;
if (_elementID != nil)
{
[_elementID setValue: [[context elementID] description]
inComponent: [context component]];
}
elementName = [self _elementNameInContext: context];
if (elementName != nil)
{
[self _appendTagWithName: elementName
toResponse: response
inContext: context];
}
return elementName;
};
//--------------------------------------------------------------------
@ -96,20 +233,83 @@ RCS_ID("$Id$")
toResponse:(GSWResponse*)response
inContext:(GSWContext*)context
{
LOGObjectFnNotImplemented(); //TODOFN
GSWComponent *comp;
comp = [context component];
[response appendContentCharacter:'<'];
[response appendContentString: name];
if (_name != nil)
{
NSString *compName = [_name valueInComponent: comp];
[response _appendContentAsciiString: @" name=\""];
[response appendContentString: compName];
[response appendContentCharacter: '"'];
}
if (_otherAssociations != nil)
{
[self _appendOtherAttributesToResponse: response
inContext: context];
}
if (_otherTagString != nil)
{
NSString *oTagComp = [_otherTagString valueInComponent: comp];
if (oTagComp != nil && [oTagComp length])
{
[response appendContentCharacter: ' '];
[response appendContentString: oTagComp];
}
}
[response appendContentCharacter: '>'];
};
//--------------------------------------------------------------------
-(void)_appendOtherAttributesToResponse:(GSWResponse*)response
inContext:(GSWContext*)context
{
LOGObjectFnNotImplemented(); //TODOFN
GSWComponent *comp;
NSEnumerator *keyEnum;
NSString *key;
comp = [context component];
keyEnum = [_otherAssociations keyEnumerator];
while ((key = [keyEnum nextObject]))
{
GSWAssociation *assoc;
id val;
NSString *desc;
assoc = [_otherAssociations objectForKey: key];
val = [assoc valueInComponent: comp];
if (val != nil)
{
desc = [val description];
[response _appendTagAttribute: key
value: desc
escapingHTMLAttributeValue:NO];
}
}
};
//--------------------------------------------------------------------
-(NSString*)_elementNameInContext:(GSWContext*)context_
-(NSString*)_elementNameInContext:(GSWContext*)context
{
LOGObjectFnNotImplemented(); //TODOFN
if (_elementName)
{
BOOL omit = NO;
if (_omitTags)
{
omit = [self evaluateCondition: _omitTags inContext: context];
}
if (omit == NO)
{
return [_elementName valueInComponent: [context component]];
}
}
return nil;
};

View file

@ -1146,22 +1146,27 @@ bundle if none is found
-(void)setURLValuedElementData:(GSWURLValuedElementData*)aData
{
LOGObjectFnStart();
[self lock];
NSDebugMLLog(@"resmanager",@"aData=%@",aData);
NS_DURING
if ([aData data])
{
[self lockedCacheData:aData];
}
NS_HANDLER
{
NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",
localException,[localException reason],__FILE__,__LINE__);
//TODO
[self lock];
NS_DURING
{
[self lockedCacheData:aData];
}
NS_HANDLER
{
NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",
localException,[localException reason],
__FILE__,__LINE__);
//TODO
[self unlock];
[localException raise];
}
NS_ENDHANDLER
[self unlock];
[localException raise];
}
NS_ENDHANDLER;
[self unlock];
LOGObjectFnStop();
};

View file

@ -76,6 +76,70 @@ RCS_ID("$Id$")
}
//--------------------------------------------------------------------
+(GSWElement*)templateWithHTMLString:(NSString *)HTMLString
declarationString:(NSString *)pageDefString
languages:(NSArray *)languages
{
return [self templateNamed: nil
inFrameworkNamed: nil
withParserType: [self defaultTemplateParserType]
parserClassName: nil
withString: HTMLString
encoding: NSISOLatin1StringEncoding
fromPath: nil
definitionsString: pageDefString
languages: languages
definitionPath: nil];
/*
GSWTemplateParserType parserType;
GSWElement *rootElement;
NSDictionary *declarations;
declarations = [GSWDeclarationParser declarationsWithString: pageDefString];
parserType=[self defaultTemplateParserType];
switch(parserType)
{
case GSWTemplateParserType_XMLHTML:
case GSWTemplateParserType_XMLHTMLNoOmittedTags:
{
rootElement
= [GSWTemplateParserXMLHTML templateWithHTMLString: HTMLString
declarations: declarations
languages: languages];
break;
}
case GSWTemplateParserType_XML:
{
rootElement
= [GSWTemplateParserXML templateWithHTMLString: HTMLString
declarations: declarations
languages: languages];
break;
}
case GSWTemplateParserType_ANTLR:
{
rootElement
= [GSWTemplateParserANTLR templateWithHTMLString: HTMLString
declarations: declarations
languages: languages];
break;
}
default:
{
rootElement
= [GSWTemplateParserXMLHTML templateWithHTMLString: HTMLString
declarations: declarations
languages: languages];
break;
}
};
return rootElement;
*/
}
+(GSWElement*)templateNamed:(NSString*)aName
inFrameworkNamed:(NSString*)aFrameworkName
withParserType:(GSWTemplateParserType)parserType

View file

@ -57,7 +57,7 @@ RCS_ID("$Id$")
else
{
_temporaryKey=YES;
ASSIGN(_key,[NSString stringUniqueIdWithLength:4]);
ASSIGN(_key,[NSString stringUniqueIdWithLength:MAX(4,sizeof(NSTimeInterval))]);
};
NSDebugMLog(@"key=%@",_key);
};

View file

@ -114,7 +114,7 @@
#define GSWHyperlink WOHyperlink
#define GSWImage WOImage
#define GSWImageButton WOImageButton
#define GSWJavaScript WOJaveScript
#define GSWJavaScript WOJavaScript
#define GSWNestedList WONestedList
#define GSWParam WOParam
#define GSWPasswordField WOPasswordField