From 7151edc54de5b6c13da1afc0c130c4025e3dc628 Mon Sep 17 00:00:00 2001 From: Manuel Guesdon Date: Mon, 15 Apr 2002 14:33:16 +0000 Subject: [PATCH] 2002-04-15 Manuel Guesdon * GSWDynamicURLString.h: o remove NSMutableString protocol * GSWUtils.m o removed NSString and NSMutableString protocol use * GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd: o change .png to .mng * GSWExtensions.framework/GSWCollapsibleComponentContent.gswc/GSWCollapsibleComponentContent.gswd: o added framework for image * GSWeb.framework/GSWDisplayGroup.h: o aded -setQueryOperator: o added -initWithKeyValueUnarchiver: * GSWeb.framework/GSWDisplayGroup.m: o added -setQueryOperator: o unarchive queryOperator o changed hasMultipleBatches implementation * GSWeb.framework/GSWBody.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWImage.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWResourceURL.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWFrame.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWElement.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWDynamicElement.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWGenericElement.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWHTMLStaticElement.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWElementIDString.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc o removed logs * GSWeb.framework/GSWActionURL.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc o removed logs * GSWeb.framework/GSWHyperlink.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWHTMLStaticGroup.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWInput.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWText.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWTextField.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWFileUpload.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWBrowser.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWCheckBox.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWCheckBoxList.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWPopUpButton.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWRadioButton.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWRadioButtonList.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWSubmitButton.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWHiddenField.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWPasswordField.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWString.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc * GSWeb.framework/GSWImageButton.h,.m: o ivar names changes to conform to coding standards o headers changed for gsdoc git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@13471 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 100 + .../GSWCollapsibleComponentContent.gswd | 1 + .../GSWExceptionPage.gswd | 2 +- GSWeb.framework/GSWActionURL.h | 24 +- GSWeb.framework/GSWActionURL.m | 44 +- GSWeb.framework/GSWAssociation.m | 3 +- GSWeb.framework/GSWBody.h | 20 +- GSWeb.framework/GSWBody.m | 34 +- GSWeb.framework/GSWBrowser.h | 76 +- GSWeb.framework/GSWBrowser.m | 473 ++-- GSWeb.framework/GSWCheckBox.h | 32 +- GSWeb.framework/GSWCheckBox.m | 289 +-- GSWeb.framework/GSWCheckBoxList.h | 72 +- GSWeb.framework/GSWCheckBoxList.m | 394 +-- GSWeb.framework/GSWDisplayGroup.h | 2 + GSWeb.framework/GSWDisplayGroup.m | 27 +- GSWeb.framework/GSWDynamicElement.h | 24 +- GSWeb.framework/GSWDynamicElement.m | 64 +- GSWeb.framework/GSWDynamicURLString.h | 2 +- GSWeb.framework/GSWElement.h | 45 +- GSWeb.framework/GSWElement.m | 107 +- GSWeb.framework/GSWElementIDString.h | 40 +- GSWeb.framework/GSWElementIDString.m | 90 +- GSWeb.framework/GSWFileUpload.h | 36 +- GSWeb.framework/GSWFileUpload.m | 295 +-- GSWeb.framework/GSWFrame.h | 20 +- GSWeb.framework/GSWFrame.m | 36 +- GSWeb.framework/GSWGenericElement.h | 71 +- GSWeb.framework/GSWGenericElement.m | 46 +- GSWeb.framework/GSWHTMLStaticElement.h | 97 +- GSWeb.framework/GSWHTMLStaticElement.m | 660 ++--- GSWeb.framework/GSWHTMLStaticGroup.h | 22 +- GSWeb.framework/GSWHTMLStaticGroup.m | 81 +- GSWeb.framework/GSWHiddenField.h | 20 +- GSWeb.framework/GSWHiddenField.m | 39 +- GSWeb.framework/GSWHyperlink.h | 84 +- GSWeb.framework/GSWHyperlink.m | 996 ++++---- GSWeb.framework/GSWImage.h | 20 +- GSWeb.framework/GSWImage.m | 34 +- GSWeb.framework/GSWImageButton.h | 92 +- GSWeb.framework/GSWImageButton.m | 921 +++---- GSWeb.framework/GSWInput.h | 58 +- GSWeb.framework/GSWInput.m | 443 ++-- GSWeb.framework/GSWPasswordField.h | 20 +- GSWeb.framework/GSWPasswordField.m | 39 +- GSWeb.framework/GSWPopUpButton.h | 64 +- GSWeb.framework/GSWPopUpButton.m | 769 +++--- GSWeb.framework/GSWRadioButton.h | 32 +- GSWeb.framework/GSWRadioButton.m | 273 +- GSWeb.framework/GSWRadioButtonList.h | 66 +- GSWeb.framework/GSWRadioButtonList.m | 429 ++-- GSWeb.framework/GSWResourceManager.h | 186 +- GSWeb.framework/GSWResourceManager.m | 2197 +++++++++-------- GSWeb.framework/GSWResourceURL.h | 18 +- GSWeb.framework/GSWResourceURL.m | 21 +- GSWeb.framework/GSWString.h | 52 +- GSWeb.framework/GSWString.m | 300 +-- GSWeb.framework/GSWSubmitButton.h | 44 +- GSWeb.framework/GSWSubmitButton.m | 302 +-- GSWeb.framework/GSWText.h | 34 +- GSWeb.framework/GSWText.m | 116 +- GSWeb.framework/GSWTextField.h | 38 +- GSWeb.framework/GSWTextField.m | 388 +-- GSWeb.framework/GSWUtils.m | 4 +- 64 files changed, 5979 insertions(+), 5449 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a3112d..90bd33d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,103 @@ +2002-04-15 Manuel Guesdon + * GSWDynamicURLString.h: + o remove NSMutableString protocol + * GSWUtils.m + o removed NSString and NSMutableString protocol use + * GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd: + o change .png to .mng + * GSWExtensions.framework/GSWCollapsibleComponentContent.gswc/GSWCollapsibleComponentContent.gswd: + o added framework for image + * GSWeb.framework/GSWDisplayGroup.h: + o aded -setQueryOperator: + o added -initWithKeyValueUnarchiver: + * GSWeb.framework/GSWDisplayGroup.m: + o added -setQueryOperator: + o unarchive queryOperator + o changed hasMultipleBatches implementation + * GSWeb.framework/GSWBody.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWImage.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWResourceURL.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWFrame.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWElement.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWDynamicElement.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWGenericElement.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWHTMLStaticElement.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWElementIDString.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + o removed logs + * GSWeb.framework/GSWActionURL.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + o removed logs + * GSWeb.framework/GSWHyperlink.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWHTMLStaticGroup.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWInput.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWText.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWTextField.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWFileUpload.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWBrowser.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWCheckBox.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWCheckBoxList.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWPopUpButton.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWRadioButton.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWRadioButtonList.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWSubmitButton.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWHiddenField.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWPasswordField.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWString.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + * GSWeb.framework/GSWImageButton.h,.m: + o ivar names changes to conform to coding standards + o headers changed for gsdoc + 2002-03-25 Manuel Guesdon * GSWAdaptors/common/GSWConfig.c: changed comments diff --git a/GSWExtensions.framework/GSWCollapsibleComponentContent.gswc/GSWCollapsibleComponentContent.gswd b/GSWExtensions.framework/GSWCollapsibleComponentContent.gswc/GSWCollapsibleComponentContent.gswd index 9eab6cc..2dfbb95 100644 --- a/GSWExtensions.framework/GSWCollapsibleComponentContent.gswc/GSWCollapsibleComponentContent.gswd +++ b/GSWExtensions.framework/GSWCollapsibleComponentContent.gswc/GSWCollapsibleComponentContent.gswd @@ -7,6 +7,7 @@ Link: GSWHyperlink Image: GSWImage { filename = imageFileName; + framework = "GSWExtensions"; alt = helpString; name = helpString; border = "0"; diff --git a/GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd b/GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd index 7e12869..1f3bbc0 100644 --- a/GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd +++ b/GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd @@ -1,6 +1,6 @@ ExclamationImage: GSWImage { - filename = "exclamation.png"; + filename = "exclamation.mng"; framework = "GSWExtensions"; border = 0; } diff --git a/GSWeb.framework/GSWActionURL.h b/GSWeb.framework/GSWActionURL.h index b194efb..eadac11 100644 --- a/GSWeb.framework/GSWActionURL.h +++ b/GSWeb.framework/GSWActionURL.h @@ -1,11 +1,16 @@ -/* GSWActionURL.h - GSWeb: Class GSWActionURL - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWActionURL.h - GSWeb: Class GSWActionURL + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Sept 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -27,15 +33,15 @@ #define _GSWActionURL_h__ @interface GSWActionURL: GSWHyperlink --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)template_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + template:(GSWElement*)template; -(NSString*)elementName; @end @interface GSWActionURL (GSWActionURLA) --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; +(BOOL)hasGSWebObjectsAssociations; @end diff --git a/GSWeb.framework/GSWActionURL.m b/GSWeb.framework/GSWActionURL.m index c27e3a7..80d42d8 100644 --- a/GSWeb.framework/GSWActionURL.m +++ b/GSWeb.framework/GSWActionURL.m @@ -1,11 +1,16 @@ -/* GSWActionURL.h - GSWeb: Class GSWActionURL - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWActionURL.h - GSWeb: Class GSWActionURL + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Sep 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,17 +35,19 @@ static char rcsId[] = "$Id$"; @implementation GSWActionURL //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)template_ +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + template:(GSWElement*)template { IM_StartC("ActionURL"); - MDumpInputObject(name_); - MDumpInputObject(associations_); - MDumpInputObject(template_); - self=[super initWithName:name_ - associations:associations_ - template:template_]; + MDumpInputObject(name); + MDumpInputObject(associations); + MDumpInputObject(template); + if ((self=[super initWithName:name + associations:associations + template:template])) + { + }; IM_StopC("ActionURL"); return self; }; @@ -67,14 +75,12 @@ static char rcsId[] = "$Id$"; @implementation GSWActionURL (GSWActionURLA) //-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { IM_StartC("ActionURL"); - MDumpInputObject(response_); - MDumpInputObject(context_); - [super appendToResponse:response_ - inContext:context_]; + [super appendToResponse:response + inContext:context]; IM_StopC("ActionURL"); }; diff --git a/GSWeb.framework/GSWAssociation.m b/GSWeb.framework/GSWAssociation.m index 8506698..8ffa7c6 100644 --- a/GSWeb.framework/GSWAssociation.m +++ b/GSWeb.framework/GSWAssociation.m @@ -605,7 +605,8 @@ static NSMutableArray* associationsLogsHandlerClasses=nil; id EONullNull=[NSNull null]; #endif LOGClassFnStart(); - NSDebugMLLog(@"associations",@"GSWAssociation: keyPath_=%@ object_=%p",keyPath_,(void*)object_); + NSDebugMLLog(@"associations",@"GSWAssociation: keyPath_=%@ object_=%p (class: %@)", + keyPath_,object_,[object_ class]); if (keyPath_ && object_ && object_!=EONullNull) { #if GDL2 diff --git a/GSWeb.framework/GSWBody.h b/GSWeb.framework/GSWBody.h index d9077eb..409a880 100644 --- a/GSWeb.framework/GSWBody.h +++ b/GSWeb.framework/GSWBody.h @@ -1,11 +1,16 @@ -/* GSWBody.h - GSWeb: Class GSWBody - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWBody.h - GSWeb: Class GSWBody + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,9 +35,9 @@ //==================================================================== @interface GSWBody: GSWHTMLURLValuedElement --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(void)dealloc; -(NSString*)valueAttributeName; -(NSString*)urlAttributeName; diff --git a/GSWeb.framework/GSWBody.m b/GSWeb.framework/GSWBody.m index 24da809..b4b0587 100644 --- a/GSWeb.framework/GSWBody.m +++ b/GSWeb.framework/GSWBody.m @@ -1,11 +1,16 @@ -/* GSWBody.m - GSWeb: Class GSWBody - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWBody.m - GSWeb: Class GSWBody + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,15 +35,15 @@ static char rcsId[] = "$Id$"; @implementation GSWBody //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { - if ((self=[super initWithName:name_ - associations:associations_ - contentElements:elements_])) - { - }; + if ((self=[super initWithName:name + associations:associations + contentElements:elements])) + { + }; return self; }; @@ -69,8 +75,8 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p>", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; diff --git a/GSWeb.framework/GSWBrowser.h b/GSWeb.framework/GSWBrowser.h index 456b3de..f089661 100644 --- a/GSWeb.framework/GSWBrowser.h +++ b/GSWeb.framework/GSWBrowser.h @@ -1,11 +1,16 @@ -/* GSWBrowser.h - GSWeb: Class GSWBrowser - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWBrowser.h - GSWeb: Class GSWBrowser + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Jan 1999 + Written by: Manuel Guesdon + Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,54 +35,56 @@ //OK @interface GSWBrowser: GSWInput { - GSWAssociation* list; - GSWAssociation* item; - GSWAssociation* displayString; - GSWAssociation* selections; + GSWAssociation* _list; + GSWAssociation* _item; + GSWAssociation* _displayString; + GSWAssociation* _selections; //GSWeb Additions { - GSWAssociation* selectionValues; + GSWAssociation* _selectionValues; // } - GSWAssociation* selectedValues; - GSWAssociation* size; - GSWAssociation* multiple; - GSWAssociation* escapeHTML; - BOOL autoValue;//?? + GSWAssociation* _selectedValues; + GSWAssociation* _size; + GSWAssociation* _multiple; + GSWAssociation* _escapeHTML; + BOOL _autoValue;//?? }; -(void)dealloc; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(NSString*)description; -(NSString*)elementName; @end @interface GSWBrowser (GSWBrowserA) --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(void)_slowTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; + +-(void)_slowTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; + +-(void)_fastTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; @end @interface GSWBrowser (GSWBrowserB) --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; --(void)appendValueToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendValueToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; @end @interface GSWBrowser (GSWBrowserC) --(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping; +-(BOOL)appendStringAtRight:(id)unkwnon + withMapping:(char*)mapping; @end #endif //_GSWBrowser_h__ diff --git a/GSWeb.framework/GSWBrowser.m b/GSWeb.framework/GSWBrowser.m index 7cff7ef..9f2edfa 100644 --- a/GSWeb.framework/GSWBrowser.m +++ b/GSWeb.framework/GSWBrowser.m @@ -1,11 +1,16 @@ -/* GSWBrowser.m - GSWeb: Class GSWBrowser - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWBrowser.m - GSWeb: Class GSWBrowser + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,61 +35,62 @@ static char rcsId[] = "$Id$"; @implementation GSWBrowser //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { //OK - NSMutableDictionary* _associations=nil; + NSMutableDictionary* tmpAssociations=nil; LOGObjectFnStartC("GSWBrowser"); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements=%@",name_,associations_,elements_); - _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; - [_associations removeObjectForKey:list__Key]; - [_associations removeObjectForKey:item__Key]; - [_associations removeObjectForKey:displayString__Key]; - [_associations removeObjectForKey:selections__Key]; + NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@", + aName,associations,elements); + tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations]; + [tmpAssociations removeObjectForKey:list__Key]; + [tmpAssociations removeObjectForKey:item__Key]; + [tmpAssociations removeObjectForKey:displayString__Key]; + [tmpAssociations removeObjectForKey:selections__Key]; if (!WOStrictFlag) - [_associations removeObjectForKey:selectionValues__Key]; - [_associations removeObjectForKey:selectedValues__Key]; - [_associations removeObjectForKey:size__Key]; - [_associations removeObjectForKey:multiple__Key]; - [_associations removeObjectForKey:escapeHTML__Key]; + [tmpAssociations removeObjectForKey:selectionValues__Key]; + [tmpAssociations removeObjectForKey:selectedValues__Key]; + [tmpAssociations removeObjectForKey:size__Key]; + [tmpAssociations removeObjectForKey:multiple__Key]; + [tmpAssociations removeObjectForKey:escapeHTML__Key]; - if ((self=[super initWithName:name_ - associations:_associations + if ((self=[super initWithName:aName + associations:tmpAssociations contentElements:nil])) { - list=[[associations_ objectForKey:list__Key - withDefaultObject:[list autorelease]] retain]; - item=[[associations_ objectForKey:item__Key - withDefaultObject:[item autorelease]] retain]; - displayString=[[associations_ objectForKey:displayString__Key - withDefaultObject:[displayString autorelease]] retain]; - selections=[[associations_ objectForKey:selection__Key - withDefaultObject:[selections autorelease]] retain]; - if (selections && ![selections isValueSettable]) + _list=[[associations objectForKey:list__Key + withDefaultObject:[_list autorelease]] retain]; + _item=[[associations objectForKey:item__Key + withDefaultObject:[_item autorelease]] retain]; + _displayString=[[associations objectForKey:displayString__Key + withDefaultObject:[_displayString autorelease]] retain]; + _selections=[[associations objectForKey:selection__Key + withDefaultObject:[_selections autorelease]] retain]; + if (_selections && ![_selections isValueSettable]) { //TODO }; if (!WOStrictFlag) { - selectionValues=[[associations_ objectForKey:selectionValue__Key - withDefaultObject:[selectionValues autorelease]] retain]; - if (selectionValues && ![selectionValues isValueSettable]) + _selectionValues=[[associations objectForKey:selectionValue__Key + withDefaultObject:[_selectionValues autorelease]] retain]; + if (_selectionValues && ![_selectionValues isValueSettable]) { //TODO }; }; - selectedValues=[[associations_ objectForKey:selectedValues__Key - withDefaultObject:[selectedValues autorelease]] retain]; - size=[[associations_ objectForKey:size__Key - withDefaultObject:[size autorelease]] retain]; - multiple=[[associations_ objectForKey:multiple__Key - withDefaultObject:[multiple autorelease]] retain]; - escapeHTML=[[associations_ objectForKey:escapeHTML__Key - withDefaultObject:[escapeHTML autorelease]] retain]; + _selectedValues=[[associations objectForKey:selectedValues__Key + withDefaultObject:[_selectedValues autorelease]] retain]; + _size=[[associations objectForKey:size__Key + withDefaultObject:[_size autorelease]] retain]; + _multiple=[[associations objectForKey:multiple__Key + withDefaultObject:[_multiple autorelease]] retain]; + _escapeHTML=[[associations objectForKey:escapeHTML__Key + withDefaultObject:[_escapeHTML autorelease]] retain]; }; LOGObjectFnStopC("GSWBrowser"); return self; @@ -92,15 +99,15 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(list); - DESTROY(item); - DESTROY(displayString); - DESTROY(selections); - DESTROY(selectionValues); - DESTROY(selectedValues); - DESTROY(size); - DESTROY(multiple); - DESTROY(escapeHTML); + DESTROY(_list); + DESTROY(_item); + DESTROY(_displayString); + DESTROY(_selections); + DESTROY(_selectionValues); + DESTROY(_selectedValues); + DESTROY(_size); + DESTROY(_multiple); + DESTROY(_escapeHTML); [super dealloc]; }; @@ -123,315 +130,315 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWBrowser (GSWBrowserA) --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - GSWRequest* _request=nil; - BOOL _isFromClientComponent=NO; - GSWComponent* _component=nil; - NSArray* _listValue=nil; - id _selectionsValue=nil; - id _selectedValuesValue=nil; - id _valueValue=nil; - id _itemValue=nil; - id _displayStringValue=nil; - BOOL _escapeHTML=YES; - id _escapeHTMLValue=nil; - BOOL _isMultiple=NO; + GSWRequest* request=nil; + BOOL isFromClientComponent=NO; + GSWComponent* component=nil; + NSArray* listValue=nil; + id selectionsValue=nil; + id selectedValuesValue=nil; + id valueValue=nil; + id itemValue=nil; + id displayStringValue=nil; + BOOL escapeHTMLBoolValue=YES; + id escapeHTMLValue=nil; + BOOL isMultiple=NO; int i=0; - BOOL _inOptGroup=NO; + BOOL inOptGroup=NO; #ifndef ENABLE_OPTGROUP - BOOL _optGroupLabel=NO; + BOOL optGroupLabel=NO; #endif LOGObjectFnStartC("GSWBrowser"); [self resetAutoValue]; - autoValue = NO; - _request=[context_ request]; - _isFromClientComponent=[_request isFromClientComponent]; - _component=[context_ component]; + _autoValue = NO; + request=[context request]; + isFromClientComponent=[request isFromClientComponent]; + component=[context component]; //TODO: multiple - [super appendToResponse:response_ - inContext:context_]; - _listValue=[list valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"_listValue=%@",_listValue); - NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], + [super appendToResponse:response + inContext:context]; + listValue=[_list valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"listValue=%@",listValue); + NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)], @"The list (%@) (%@ of class:%@) doesn't respond to 'count'", - list, - _listValue, - [_listValue class]); - _selectionsValue=[selections valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"selections=%@",selections); - NSDebugMLLog(@"gswdync",@"_selectionsValue=%@",_selectionsValue); - _selectedValuesValue=[selectedValues valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"selectedValues=%@",selectedValues); - NSDebugMLLog(@"gswdync",@"_selectedValuesValue=%@",_selectedValuesValue); - if (escapeHTML) + _list, + listValue, + [listValue class]); + selectionsValue=[_selections valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"selections=%@",_selections); + NSDebugMLLog(@"gswdync",@"selectionsValue=%@",selectionsValue); + selectedValuesValue=[_selectedValues valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"selectedValues=%@",_selectedValues); + NSDebugMLLog(@"gswdync",@"selectedValuesValue=%@",selectedValuesValue); + if (_escapeHTML) { - _escapeHTMLValue=[escapeHTML valueInComponent:_component]; - _escapeHTML=boolValueFor(_escapeHTMLValue); + escapeHTMLValue=[_escapeHTML valueInComponent:component]; + escapeHTMLBoolValue=boolValueFor(escapeHTMLValue); }; - if (multiple) + if (_multiple) { - id _multipleValue=nil; - _multipleValue=[multiple valueInComponent:_component]; - _isMultiple=boolValueFor(_multipleValue); + id multipleValue=nil; + multipleValue=[_multiple valueInComponent:component]; + isMultiple=boolValueFor(multipleValue); }; - for(i=0;i<[_listValue count];i++) + for(i=0;i<[listValue count];i++) { - NSDebugMLLog(@"gswdync",@"_inOptGroup=%s",(_inOptGroup ? "YES" : "NO")); - _itemValue=[_listValue objectAtIndex:i]; - if (item) - [item setValue:_itemValue - inComponent:_component]; - NSDebugMLLog(@"gswdync",@"_itemValue=%@",_itemValue); - if (_itemValue) + NSDebugMLLog(@"gswdync",@"inOptGroup=%s",(inOptGroup ? "YES" : "NO")); + itemValue=[listValue objectAtIndex:i]; + if (_item) + [_item setValue:itemValue + inComponent:component]; + NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue); + if (itemValue) { - NSDebugMLLog(@"gswdync",@"value=%@",value); - _valueValue=[self valueInContext:context_]; - NSDebugMLLog(@"gswdync",@"_valueValue=%@",_valueValue); - if (_valueValue) + NSDebugMLLog(@"gswdync",@"value=%@",_value); + valueValue=[self valueInContext:context]; + NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue); + if (valueValue) { - BOOL _isEqual; + BOOL isEqual; NSDebugMLLog0(@"gswdync",@"Adding OPTION"); - [response_ _appendContentAsciiString:@"\n']; + [response appendContentCharacter:'>']; }; - _displayStringValue=nil; - if (displayString) + displayStringValue=nil; + if (_displayString) { - NSDebugMLLog(@"gswdync",@"displayString=%@",displayString); - _displayStringValue=[displayString valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"_displayStringValue=%@",_displayStringValue); + NSDebugMLLog(@"gswdync",@"displayString=%@",_displayString); + displayStringValue=[_displayString valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"displayStringValue=%@",displayStringValue); }; - if (_displayStringValue) + if (displayStringValue) { - if (!_valueValue) + if (!valueValue) { - if (_inOptGroup) + if (inOptGroup) { NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP"); #ifdef ENABLE_OPTGROUP - [response_ _appendContentAsciiString:@"\n"]; + [response _appendContentAsciiString:@"\n"]; #endif - _inOptGroup=NO; + inOptGroup=NO; }; NSDebugMLLog0(@"gswdync",@"Adding OPTGROUP"); #ifdef ENABLE_OPTGROUP - [response_ _appendContentAsciiString:@"\n-- "]; - _optGroupLabel=YES; + [response _appendContentAsciiString:@"\n - if (_escapeHTML) - _displayStringValue=[GSWResponse stringByEscapingHTMLString:_displayStringValue]; - NSDebugMLLog(@"gswdync",@"_displayStringValue=%@",_displayStringValue); + if (escapeHTMLBoolValue) + displayStringValue=[GSWResponse stringByEscapingHTMLString:displayStringValue]; + NSDebugMLLog(@"gswdync",@"displayStringValue=%@",displayStringValue); #ifndef ENABLE_OPTGROUP - if (_optGroupLabel) + if (optGroupLabel) { - _displayStringValue=[NSString stringWithFormat:@"%@ --",_displayStringValue]; + displayStringValue=[NSString stringWithFormat:@"%@ --",displayStringValue]; }; #endif - [response_ appendContentHTMLString:_displayStringValue]; + [response appendContentHTMLString:displayStringValue]; }; - if (_valueValue) + if (valueValue) { //NSDebugMLLog0(@"gswdync",@"Adding /OPTION"); // K2- No /OPTION TAG - //[response_ _appendContentAsciiString:@""]; + //[response _appendContentAsciiString:@""]; } else { NSDebugMLLog0(@"gswdync",@"Adding > or "); #ifdef ENABLE_OPTGROUP - [response_ _appendContentAsciiString:@"\">"]; + [response _appendContentAsciiString:@"\">"]; #else - if (_optGroupLabel) + if (optGroupLabel) { - //[response_ _appendContentAsciiString:@""]; - _optGroupLabel=NO; + //[response _appendContentAsciiString:@""]; + optGroupLabel=NO; }; #endif }; }; }; - if (_inOptGroup) + if (inOptGroup) { #ifdef ENABLE_OPTGROUP NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP"); - [response_ _appendContentAsciiString:@"\n"]; + [response _appendContentAsciiString:@"\n"]; #endif - _inOptGroup=NO; + inOptGroup=NO; }; - [response_ _appendContentAsciiString:@""]; + [response _appendContentAsciiString:@""]; LOGObjectFnStopC("GSWBrowser"); }; //-------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK LOGObjectFnStartC("GSWPopUpButton"); - [self _slowTakeValuesFromRequest:request_ - inContext:context_]; + [self _slowTakeValuesFromRequest:request + inContext:context]; LOGObjectFnStopC("GSWPopUpButton"); }; //-------------------------------------------------------------------- --(void)_slowTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)_slowTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK - BOOL _disabled=NO; - BOOL _wasFormSubmitted=NO; + BOOL disabledValue=NO; + BOOL wasFormSubmitted=NO; LOGObjectFnStartC("GSWPopUpButton"); [self resetAutoValue]; - _disabled=[self disabledInContext:context_]; - if (!_disabled) + disabledValue=[self disabledInContext:context]; + if (!disabledValue) { - _wasFormSubmitted=[context_ _wasFormSubmitted]; - if (_wasFormSubmitted) + wasFormSubmitted=[context _wasFormSubmitted]; + if (wasFormSubmitted) { - BOOL _isMultiple=NO; - NSArray* _foundValues=nil; - NSMutableArray* _mutableFoundValues=[NSMutableArray array]; - GSWComponent* _component=nil; - NSArray* _listValue=nil; - id _valueValue=nil; - id _itemValue=nil; - NSString* _name=nil; - NSArray* _formValues=nil; - id _formValue=nil; - BOOL _found=NO; + BOOL isMultiple=NO; + NSArray* foundValues=nil; + NSMutableArray* mutableFoundValues=[NSMutableArray array]; + GSWComponent* component=nil; + NSArray* listValue=nil; + id valueValue=nil; + id itemValue=nil; + NSString* name=nil; + NSArray* formValues=nil; + id formValue=nil; + BOOL found=NO; int i=0; - _component=[context_ component]; - _name=[self nameInContext:context_]; - NSDebugMLLog(@"gswdync",@"_name=%@",_name); - if (multiple) + component=[context component]; + name=[self nameInContext:context]; + NSDebugMLLog(@"gswdync",@"name=%@",name); + if (_multiple) { - id _multipleValue=[multiple valueInComponent:_component]; - _isMultiple=boolValueFor(_multipleValue); + id multipleValue=[_multiple valueInComponent:component]; + isMultiple=boolValueFor(multipleValue); }; - _formValues=[request_ formValuesForKey:_name]; - NSDebugMLLog(@"gswdync",@"_formValues=%@",_formValues); - if (_formValues && [_formValues count]) + formValues=[request formValuesForKey:name]; + NSDebugMLLog(@"gswdync",@"formValues=%@",formValues); + if (formValues && [formValues count]) { - BOOL _isEqual=NO; - _formValue=[_formValues objectAtIndex:0]; - NSDebugMLLog(@"gswdync",@"_formValue=%@",_formValue); - _listValue=[list valueInComponent:_component]; - NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], + BOOL isEqual=NO; + formValue=[formValues objectAtIndex:0]; + NSDebugMLLog(@"gswdync",@"formValue=%@",formValue); + listValue=[_list valueInComponent:component]; + NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)], @"The list (%@) (%@ of class:%@) doesn't respond to 'count'", - list, - _listValue, - [_listValue class]); - for(i=0;(!_found || _isMultiple) && i<[_listValue count];i++) + _list, + listValue, + [listValue class]); + for(i=0;(!found || isMultiple) && i<[listValue count];i++) { - _itemValue=[_listValue objectAtIndex:i]; - NSDebugMLLog(@"gswdync",@"_itemValue=%@",_itemValue); - NSDebugMLLog(@"gswdync",@"item=%@",item); - if (item) - [item setValue:_itemValue - inComponent:_component]; - NSDebugMLLog(@"gswdync",@"value=%@",value); - _valueValue=[self valueInContext:context_]; + itemValue=[listValue objectAtIndex:i]; + NSDebugMLLog(@"gswdync",@"_itemValue=%@",itemValue); + NSDebugMLLog(@"gswdync",@"item=%@",_item); + if (_item) + [_item setValue:itemValue + inComponent:component]; + NSDebugMLLog(@"gswdync",@"value=%@",_value); + valueValue=[self valueInContext:context]; NSDebugMLLog(@"gswdync",@"_valueValue=%@ [class=%@] _formValue=%@ [class=%@]", - _valueValue,[_valueValue class], - _formValue,[_formValue class]); - _isEqual=SBIsValueIsIn(_valueValue,_formValue); - if (_isEqual) + valueValue,[valueValue class], + formValue,[formValue class]); + isEqual=SBIsValueIsIn(valueValue,formValue); + if (isEqual) { - if(autoValue == NO) - _itemValue = _valueValue; - [_mutableFoundValues addObject:_itemValue]; - _found=YES; + if(_autoValue == NO) + itemValue = valueValue; + [mutableFoundValues addObject:itemValue]; + found=YES; }; }; }; - _foundValues=[NSArray arrayWithArray:_mutableFoundValues]; - NSDebugMLLog(@"gswdync",@"_found=%s",(_found ? "YES" : "NO")); - if (selections) + foundValues=[NSArray arrayWithArray:mutableFoundValues]; + NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO")); + if (_selections) { if (!WOStrictFlag) { NS_DURING { - [selections setValue:_foundValues - inComponent:_component]; + [_selections setValue:foundValues + inComponent:component]; }; NS_HANDLER { [self handleValidationException:localException - inContext:context_]; + inContext:context]; } NS_ENDHANDLER; } else { - [selections setValue:_foundValues - inComponent:_component]; + [_selections setValue:foundValues + inComponent:component]; }; }; if (!WOStrictFlag) { - if (selectionValues) + if (_selectionValues) { NS_DURING { - [selectionValues setValue:_foundValues - inComponent:_component]; + [_selectionValues setValue:foundValues + inComponent:component]; }; NS_HANDLER { [self handleValidationException:localException - inContext:context_]; + inContext:context]; } NS_ENDHANDLER; }; @@ -442,8 +449,8 @@ static char rcsId[] = "$Id$"; }; //-------------------------------------------------------------------- --(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)_fastTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { LOGObjectFnNotImplemented(); //TODOFN }; @@ -453,16 +460,16 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWBrowser (GSWBrowserB) --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(void)appendValueToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendValueToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { LOGObjectFnNotImplemented(); //TODOFN }; diff --git a/GSWeb.framework/GSWCheckBox.h b/GSWeb.framework/GSWCheckBox.h index a6faab4..2fdc2ea 100644 --- a/GSWeb.framework/GSWCheckBox.h +++ b/GSWeb.framework/GSWCheckBox.h @@ -1,11 +1,16 @@ -/* GSWCheckBox.h - GSWeb: Class GSWCheckBox - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWCheckBox.h - GSWeb: Class GSWCheckBox + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,13 +35,13 @@ //==================================================================== @interface GSWCheckBox: GSWInput { - GSWAssociation* checked; - GSWAssociation* selection; + GSWAssociation* _checked; + GSWAssociation* _selection; }; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(void)dealloc; -(NSString*)description; @@ -44,14 +50,14 @@ //==================================================================== @interface GSWCheckBox (GSWCheckBoxA) --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; @end //==================================================================== @interface GSWCheckBox (GSWCheckBoxB) --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; @end diff --git a/GSWeb.framework/GSWCheckBox.m b/GSWeb.framework/GSWCheckBox.m index 613b98e..3729fc1 100644 --- a/GSWeb.framework/GSWCheckBox.m +++ b/GSWeb.framework/GSWCheckBox.m @@ -1,11 +1,16 @@ -/* GSWCheckBox.m - GSWeb: Class GSWCheckBox - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWCheckBox.m - GSWeb: Class GSWCheckBox + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,42 +35,42 @@ static char rcsId[] = "$Id$"; @implementation GSWCheckBox //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)_elements +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { - NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; + NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations]; LOGObjectFnStartC("GSWCheckBox"); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements); - [_associations setObject:[GSWAssociation associationWithValue:@"checkbox"] - forKey:@"type"]; - [_associations removeObjectForKey:selection__Key]; - [_associations removeObjectForKey:checked__Key]; - if ((self=[super initWithName:name_ - associations:_associations - contentElements:nil])) - { - //TODOV - selection=[[associations_ objectForKey:selection__Key - withDefaultObject:[selection autorelease]] retain]; - if (selection && ![selection isValueSettable]) - { - ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable"); - }; - checked=[[associations_ objectForKey:checked__Key - withDefaultObject:[checked autorelease]] retain]; - if (checked && ![checked isValueSettable]) - { - ExceptionRaise0(@"GSWCheckBox",@"'checked' parameter must be settable"); - }; - if (!checked) - { - if (!value || !selection) - { - ExceptionRaise0(@"GSWCheckBox",@"If you don't specify 'checked' parameter, you have to specify 'value' and 'selection' parameter"); - }; - }; - }; + NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ _elements=%@",aName,associations,elements); + [tmpAssociations setObject:[GSWAssociation associationWithValue:@"checkbox"] + forKey:@"type"]; + [tmpAssociations removeObjectForKey:selection__Key]; + [tmpAssociations removeObjectForKey:checked__Key]; + if ((self=[super initWithName:aName + associations:tmpAssociations + contentElements:nil])) + { + //TODOV + _selection=[[associations objectForKey:selection__Key + withDefaultObject:[_selection autorelease]] retain]; + if (_selection && ![_selection isValueSettable]) + { + ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable"); + }; + _checked=[[associations objectForKey:checked__Key + withDefaultObject:[_checked autorelease]] retain]; + if (_checked && ![_checked isValueSettable]) + { + ExceptionRaise0(@"GSWCheckBox",@"'checked' parameter must be settable"); + }; + if (!_checked) + { + if (!_value || !_selection) + { + ExceptionRaise0(@"GSWCheckBox",@"If you don't specify 'checked' parameter, you have to specify 'value' and 'selection' parameter"); + }; + }; + }; LOGObjectFnStopC("GSWCheckBox"); return self; }; @@ -72,8 +78,8 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(checked); - DESTROY(selection); + DESTROY(_checked); + DESTROY(_selection); [super dealloc]; }; @@ -81,8 +87,8 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p>", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; @@ -92,37 +98,37 @@ static char rcsId[] = "$Id$"; @implementation GSWCheckBox (GSWCheckBoxA) //-------------------------------------------------------------------- --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)_response - inContext:(GSWContext*)context_ +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - GSWComponent* _component=nil; - BOOL _disabledInContext=NO; + GSWComponent* component=nil; + BOOL disabledInContext=NO; LOGObjectFnStartC("GSWCheckBox"); - _component=[context_ component]; - _disabledInContext=[self disabledInContext:context_]; - if (!_disabledInContext) - { - BOOL _checked=NO; - [self appendValueToResponse:_response - inContext:context_]; - [self appendNameToResponse:_response - inContext:context_]; + component=[context component]; + disabledInContext=[self disabledInContext:context]; + if (!disabledInContext) + { + BOOL checkedValue=NO; + [self appendValueToResponse:response + inContext:context]; + [self appendNameToResponse:response + inContext:context]; - if (checked) - { - _checked=[self evaluateCondition:checked - inContext:context_]; - } - else if (value) - { - id _valueValue=[value valueInComponent:_component]; - id _selectionValue=[selection valueInComponent:_component]; - _checked=SBIsValueEqual(_selectionValue,_valueValue); - }; - if (_checked) - [_response _appendContentAsciiString:@" checked"]; - }; + if (_checked) + { + checkedValue=[self evaluateCondition:_checked + inContext:context]; + } + else if (_value) + { + id valueValue=[_value valueInComponent:component]; + id selectionValue=[_selection valueInComponent:component]; + checkedValue=SBIsValueEqual(selectionValue,valueValue); + }; + if (checkedValue) + [response _appendContentAsciiString:@" checked"]; + }; LOGObjectFnStopC("GSWCheckBox"); }; @@ -132,83 +138,80 @@ static char rcsId[] = "$Id$"; @implementation GSWCheckBox (GSWCheckBoxB) //-------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK - BOOL _disabledInContext=NO; + BOOL disabledInContext=NO; LOGObjectFnStartC("GSWCheckBox"); - _disabledInContext=[self disabledInContext:context_]; - if (!_disabledInContext) - { - if ([context_ _wasFormSubmitted]) - { - GSWComponent* _component=[context_ component]; - NSString* _name=nil; - NSArray* _formValues=nil; -// GSWElementIDString* _elementID=nil; - BOOL _checkChecked=NO; - _name=[self nameInContext:context_]; - NSDebugMLLog(@"gswdync",@"_name=%@",_name); - _formValues=[request_ formValuesForKey:_name]; -// _elementID=[[context_ elementID] copy]; //!! when release ? - //??? - NSDebugMLLog(@"gswdync",@"_formValues=%@",_formValues); - if (_formValues && [_formValues count]) - { - NSDebugMLLog(@"gswdync",@"[_formValues objectAtIndex:0]=%@",[_formValues objectAtIndex:0]); - _checkChecked=YES; - if (selection) - { - //TODOV - id _valueValue=[value valueInComponent:_component]; - if (!WOStrictFlag) - { - NS_DURING - { - [selection setValue:_valueValue - inComponent:_component]; - }; - NS_HANDLER - { - [self handleValidationException:localException - inContext:context_]; - } - NS_ENDHANDLER; - } - else - { - [selection setValue:_valueValue - inComponent:_component]; - }; - }; - }; - if (checked) - { - id _checkedValue=[NSNumber numberWithBool:_checkChecked]; - NSDebugMLLog(@"gswdync",@"_checkedValue=%@",_checkedValue); - if (!WOStrictFlag) - { - NS_DURING - { - [checked setValue:_checkedValue - inComponent:_component]; - }; - NS_HANDLER - { - [self handleValidationException:localException - inContext:context_]; - } - NS_ENDHANDLER; - } - else - { - [checked setValue:_checkedValue - inComponent:_component]; - }; - }; - }; - }; + disabledInContext=[self disabledInContext:context]; + if (!disabledInContext) + { + if ([context _wasFormSubmitted]) + { + GSWComponent* component=[context component]; + NSString* name=nil; + NSArray* formValues=nil; + BOOL checkChecked=NO; + name=[self nameInContext:context]; + NSDebugMLLog(@"gswdync",@"name=%@",name); + formValues=[request formValuesForKey:name]; + NSDebugMLLog(@"gswdync",@"formValues=%@",formValues); + if (formValues && [formValues count]) + { + NSDebugMLLog(@"gswdync",@"[formValues objectAtIndex:0]=%@",[formValues objectAtIndex:0]); + checkChecked=YES; + if (_selection) + { + //TODOV + id valueValue=[_value valueInComponent:component]; + if (!WOStrictFlag) + { + NS_DURING + { + [_selection setValue:valueValue + inComponent:component]; + }; + NS_HANDLER + { + [self handleValidationException:localException + inContext:context]; + } + NS_ENDHANDLER; + } + else + { + [_selection setValue:valueValue + inComponent:component]; + }; + }; + }; + if (_checked) + { + id checkedValue=[NSNumber numberWithBool:checkChecked]; + NSDebugMLLog(@"gswdync",@"checkedValue=%@",checkedValue); + if (!WOStrictFlag) + { + NS_DURING + { + [_checked setValue:checkedValue + inComponent:component]; + }; + NS_HANDLER + { + [self handleValidationException:localException + inContext:context]; + } + NS_ENDHANDLER; + } + else + { + [_checked setValue:checkedValue + inComponent:component]; + }; + }; + }; + }; LOGObjectFnStopC("GSWCheckBox"); }; diff --git a/GSWeb.framework/GSWCheckBoxList.h b/GSWeb.framework/GSWCheckBoxList.h index b8053f8..7df53ee 100644 --- a/GSWeb.framework/GSWCheckBoxList.h +++ b/GSWeb.framework/GSWCheckBoxList.h @@ -1,11 +1,16 @@ -/* GSWCheckBoxList.h - GSWeb: Class GSWCheckBoxList - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWCheckBoxList.h - GSWeb: Class GSWCheckBoxList + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,22 +35,22 @@ //==================================================================== @interface GSWCheckBoxList: GSWInput { - GSWAssociation* list; - GSWAssociation* item; - GSWAssociation* index; - GSWAssociation* selections; - GSWAssociation* prefix; - GSWAssociation* suffix; - GSWAssociation* displayString; - GSWAssociation* escapeHTML; - GSWAssociation* itemDisabled; - BOOL defaultEscapeHTML; - BOOL autoValue; + GSWAssociation* _list; + GSWAssociation* _item; + GSWAssociation* _index; + GSWAssociation* _selections; + GSWAssociation* _prefix; + GSWAssociation* _suffix; + GSWAssociation* _displayString; + GSWAssociation* _escapeHTML; + GSWAssociation* _itemDisabled; + BOOL _defaultEscapeHTML; + BOOL _autoValue; }; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(void)dealloc; -(NSString*)description; @@ -55,29 +61,31 @@ //==================================================================== @interface GSWCheckBoxList (GSWCheckBoxListA) --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(void)_slowTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; + +-(void)_slowTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; + +-(void)_fastTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; @end //==================================================================== @interface GSWCheckBoxList (GSWCheckBoxListB) --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; @end //==================================================================== @interface GSWCheckBoxList (GSWCheckBoxListC) --(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping; --(BOOL)appendStringAtLeft:(id)_unkwnon - withMapping:(char*)_mapping; +-(BOOL)appendStringAtRight:(id)unkwnon + withMapping:(char*)mapping; +-(BOOL)appendStringAtLeft:(id)unkwnon + withMapping:(char*)mapping; -(BOOL)compactHTMLTags; @end diff --git a/GSWeb.framework/GSWCheckBoxList.m b/GSWeb.framework/GSWCheckBoxList.m index 36f14eb..f655974 100644 --- a/GSWeb.framework/GSWCheckBoxList.m +++ b/GSWeb.framework/GSWCheckBoxList.m @@ -1,11 +1,16 @@ -/* GSWCheckBoxList.m - GSWeb: Class GSWCheckBoxList - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWCheckBoxList.m - GSWeb: Class GSWCheckBoxList + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,79 +35,79 @@ static char rcsId[] = "$Id$"; @implementation GSWCheckBoxList //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations contentElements:(NSArray*)elements_ { - NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; + NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations]; LOGObjectFnStart(); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_); - defaultEscapeHTML=1; - [_associations removeObjectForKey:list__Key]; - [_associations removeObjectForKey:item__Key]; - [_associations removeObjectForKey:index__Key]; - [_associations removeObjectForKey:prefix__Key]; - [_associations removeObjectForKey:suffix__Key]; - [_associations removeObjectForKey:selections__Key]; - [_associations removeObjectForKey:displayString__Key]; - [_associations removeObjectForKey:disabled__Key]; - [_associations removeObjectForKey:escapeHTML__Key]; - if ((self=[super initWithName:name_ - associations:_associations - contentElements:nil])) - { - list = [[associations_ objectForKey:list__Key - withDefaultObject:[list autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"list=%@",list); + NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements_=%@",aName,associations,elements_); + _defaultEscapeHTML=1; + [tmpAssociations removeObjectForKey:list__Key]; + [tmpAssociations removeObjectForKey:item__Key]; + [tmpAssociations removeObjectForKey:index__Key]; + [tmpAssociations removeObjectForKey:prefix__Key]; + [tmpAssociations removeObjectForKey:suffix__Key]; + [tmpAssociations removeObjectForKey:selections__Key]; + [tmpAssociations removeObjectForKey:displayString__Key]; + [tmpAssociations removeObjectForKey:disabled__Key]; + [tmpAssociations removeObjectForKey:escapeHTML__Key]; + if ((self=[super initWithName:aName + associations:tmpAssociations + contentElements:nil])) + { + _list = [[associations objectForKey:list__Key + withDefaultObject:[_list autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"list=%@",_list); - item = [[associations_ objectForKey:item__Key - withDefaultObject:[item autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"item=%@",item); - if (item && ![item isValueSettable]) - { - ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable"); - }; + _item = [[associations objectForKey:item__Key + withDefaultObject:[_item autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"item=%@",_item); + if (_item && ![_item isValueSettable]) + { + ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable"); + }; - value = [[associations_ objectForKey:value__Key - withDefaultObject:[value autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"value=%@",value); + _value = [[associations objectForKey:value__Key + withDefaultObject:[_value autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"value=%@",_value); - index = [[associations_ objectForKey:index__Key - withDefaultObject:[index autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"index=%@",index); - if (index && ![index isValueSettable]) - { - ExceptionRaise0(@"GSWCheckBox",@"'index' parameter must be settable"); - }; + _index = [[associations objectForKey:index__Key + withDefaultObject:[_index autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"index=%@",_index); + if (_index && ![_index isValueSettable]) + { + ExceptionRaise0(@"GSWCheckBox",@"'index' parameter must be settable"); + }; - prefix = [[associations_ objectForKey:prefix__Key - withDefaultObject:[prefix autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"prefix=%@",prefix); + _prefix = [[associations objectForKey:prefix__Key + withDefaultObject:[_prefix autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"prefix=%@",_prefix); - suffix = [[associations_ objectForKey:suffix__Key - withDefaultObject:[suffix autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"suffix=%@",suffix); + _suffix = [[associations objectForKey:suffix__Key + withDefaultObject:[_suffix autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"suffix=%@",_suffix); - selections = [[associations_ objectForKey:selections__Key - withDefaultObject:[selections autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"selections=%@",selections); - if (![selections isValueSettable]) - { - ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable"); - }; - - displayString = [[associations_ objectForKey:displayString__Key - withDefaultObject:[displayString autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"displayString=%@",displayString); + _selections = [[associations objectForKey:selections__Key + withDefaultObject:[_selections autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"selections=%@",_selections); + if (![_selections isValueSettable]) + { + ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable"); + }; + + _displayString = [[associations objectForKey:displayString__Key + withDefaultObject:[_displayString autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"displayString=%@",_displayString); - itemDisabled = [[associations_ objectForKey:disabled__Key - withDefaultObject:[itemDisabled autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"itemDisabled=%@",itemDisabled); + _itemDisabled = [[associations objectForKey:disabled__Key + withDefaultObject:[_itemDisabled autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"itemDisabled=%@",_itemDisabled); - escapeHTML = [[associations_ objectForKey:escapeHTML__Key - withDefaultObject:[escapeHTML autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"escapeHTML=%@",escapeHTML); - }; + _escapeHTML = [[associations objectForKey:escapeHTML__Key + withDefaultObject:[_escapeHTML autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"escapeHTML=%@",_escapeHTML); + }; LOGObjectFnStop(); return self; }; @@ -109,15 +115,15 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(list); - DESTROY(item); - DESTROY(index); - DESTROY(selections); - DESTROY(prefix); - DESTROY(suffix); - DESTROY(displayString); - DESTROY(itemDisabled); - DESTROY(escapeHTML); + DESTROY(_list); + DESTROY(_item); + DESTROY(_index); + DESTROY(_selections); + DESTROY(_prefix); + DESTROY(_suffix); + DESTROY(_displayString); + DESTROY(_itemDisabled); + DESTROY(_escapeHTML); [super dealloc]; } @@ -125,8 +131,8 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p>", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; //-------------------------------------------------------------------- @@ -141,106 +147,105 @@ static char rcsId[] = "$Id$"; @implementation GSWCheckBoxList (GSWCheckBoxListA) //-------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK LOGObjectFnStartC("GSWCheckBoxList"); - [self _slowTakeValuesFromRequest:request_ - inContext:context_]; + [self _slowTakeValuesFromRequest:request + inContext:context]; LOGObjectFnStopC("GSWCheckBoxList"); }; //----------------------------------------------------------------------------------- --(void)_slowTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)_slowTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK - BOOL _disabledInContext=NO; + BOOL disabledInContext=NO; LOGObjectFnStartC("GSWCheckBoxList"); [self resetAutoValue]; - _disabledInContext=[self disabledInContext:context_]; - if (!_disabledInContext) + disabledInContext=[self disabledInContext:context]; + if (!disabledInContext) { - if ([context_ _wasFormSubmitted]) + if ([context _wasFormSubmitted]) { - GSWComponent* _component=[context_ component]; - NSArray* _listValue=nil; - NSMutableArray* _selections=nil; - NSString* _name=nil; - NSArray* _formValues=nil; - id _valueValue=nil; + GSWComponent* component=[context component]; + NSArray* listValue=nil; + NSMutableArray* selectionsValues=nil; + NSString* name=nil; + NSArray* formValues=nil; + id valueValue=nil; int i=0; - _name=[self nameInContext:context_]; - NSDebugMLLog(@"gswdync",@"_name=%@",_name); - _formValues=[request_ formValuesForKey:_name]; - NSDebugMLLog(@"gswdync",@"_formValues=%@",_formValues); - _listValue=[list valueInComponent:_component]; - NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], + name=[self nameInContext:context]; + NSDebugMLLog(@"gswdync",@"name=%@",name); + formValues=[request formValuesForKey:name]; + NSDebugMLLog(@"gswdync",@"formValues=%@",formValues); + listValue=[_list valueInComponent:component]; + NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)], @"The list (%@) (%@ of class:%@) doesn't respond to 'count'", - list, - _listValue, - [_listValue class]); - NSDebugMLLog(@"gswdync",@"_listValue=%@",_listValue); + _list, + listValue, + [listValue class]); + NSDebugMLLog(@"gswdync",@"listValue=%@",listValue); - for(i=0;i<[_listValue count];i++) + for(i=0;i<[listValue count];i++) { - NSDebugMLLog(@"gswdync",@"item=%@",item); - NSDebugMLLog(@"gswdync",@"index=%@",index); + NSDebugMLLog(@"gswdync",@"item=%@",_item); + NSDebugMLLog(@"gswdync",@"index=%@",_index); - if (item) - [item setValue:[_listValue objectAtIndex:i] - inComponent:_component]; - else if (index) - [index setValue:[NSNumber numberWithShort:i] - inComponent:_component]; - NSDebugMLLog(@"gswdync",@"value=%@",value); + if (_item) + [_item setValue:[listValue objectAtIndex:i] + inComponent:component]; + else if (_index) + [_index setValue:[NSNumber numberWithShort:i] + inComponent:component]; + NSDebugMLLog(@"gswdync",@"value=%@",_value); - _valueValue=[self valueInContext:context_]; - NSDebugMLLog(@"gswdync",@"_valueValue=%@",_valueValue); + valueValue=[self valueInContext:context]; + NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue); - if (_valueValue) + if (valueValue) { - BOOL _found=[_formValues containsObject:_valueValue]; + BOOL found=[formValues containsObject:valueValue]; - NSDebugMLLog(@"gswdync",@"_found=%s",(_found ? "YES" : "NO")); - if (_found) + NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO")); + if (found) { - if (!_selections) - _selections=[NSMutableArray array]; + if (!selectionsValues) + selectionsValues=[NSMutableArray array]; - if(autoValue == NO) - [_selections addObject:_valueValue]; + if(_autoValue == NO) + [selectionsValues addObject:valueValue]; else - [_selections - addObject:[_listValue objectAtIndex:i]]; + [selectionsValues addObject:[listValue objectAtIndex:i]]; }; }; }; - NSDebugMLLog(@"gswdync",@"_component=%@",_component); - NSDebugMLLog(@"gswdync",@"_selections=%d",_selections); - NSDebugMLLog(@"gswdync",@"selections=%@",selections); - GSWLogAssertGood(_component); + NSDebugMLLog(@"gswdync",@"component=%@",component); + NSDebugMLLog(@"gswdync",@"selectionsValues=%d",selectionsValues); + NSDebugMLLog(@"gswdync",@"selections=%@",_selections); + GSWLogAssertGood(component); if (!WOStrictFlag) { NS_DURING { - [selections setValue:_selections - inComponent:_component]; + [_selections setValue:selectionsValues + inComponent:component]; }; NS_HANDLER { [self handleValidationException:localException - inContext:context_]; + inContext:context]; } NS_ENDHANDLER; } else { - [selections setValue:_selections - inComponent:_component]; + [_selections setValue:selectionsValues + inComponent:component]; }; }; }; @@ -248,96 +253,95 @@ static char rcsId[] = "$Id$"; }; //----------------------------------------------------------------------------------- --(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)_fastTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { LOGObjectFnStartC("GSWCheckBoxList"); LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnStopC("GSWCheckBoxList"); }; //----------------------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - GSWRequest* _request=nil; - BOOL _isFromClientComponent=NO; - NSString* _name=nil; - GSWComponent* _component=nil; - NSArray* _selectionsValue=nil; - BOOL _isEqual=NO; + GSWRequest* request=nil; + BOOL isFromClientComponent=NO; + NSString* name=nil; + GSWComponent* component=nil; + NSArray* selectionsValue=nil; + BOOL isEqual=NO; LOGObjectFnStartC("GSWCheckBoxList"); [self resetAutoValue]; - autoValue = NO; + _autoValue = NO; - _request=[context_ request]; - _isFromClientComponent=[_request isFromClientComponent]; - _name=[self nameInContext:context_]; - _component=[context_ component]; - _selectionsValue=[selections valueInComponent:_component]; - if (_selectionsValue && ![_selectionsValue isKindOfClass:[NSArray class]]) + request=[context request]; + isFromClientComponent=[request isFromClientComponent]; + name=[self nameInContext:context]; + component=[context component]; + selectionsValue=[_selections valueInComponent:component]; + if (selectionsValue && ![selectionsValue isKindOfClass:[NSArray class]]) { ExceptionRaise(@"GSWCheckBoxList", @"GSWCheckBoxList: selections is not a NSArray: %@ %@", - _selectionsValue, - [_selectionsValue class]); + selectionsValue, + [selectionsValue class]); } else { int i=0; - id _displayStringValue=nil; - id _prefixValue=nil; - id _suffixValue=nil; - id _valueValue=nil; - BOOL _disableValue=NO; - NSArray* _listValue=[list valueInComponent:_component]; + id displayStringValue=nil; + id prefixValue=nil; + id suffixValue=nil; + id valueValue=nil; + BOOL disableValue=NO; + NSArray* listValue=[_list valueInComponent:component]; - NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], + NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)], @"The list (%@) (%@ of class:%@) doesn't respond to 'count'", - list, - _listValue, - [_listValue class]); + _list, + listValue, + [listValue class]); - for(i=0;i<[_listValue count];i++) + for(i=0;i<[listValue count];i++) { - [item setValue:[_listValue objectAtIndex:i] - inComponent:_component]; - _prefixValue=[prefix valueInComponent:_component]; - _suffixValue=[suffix valueInComponent:_component]; - _disableValue=[itemDisabled valueInComponent:_component]; - [index setValue:[NSNumber numberWithShort:i] - inComponent:_component]; - _displayStringValue=[displayString valueInComponent:_component]; - [response_ appendContentString:@"']; - [response_ appendContentString:_prefixValue]; - [response_ appendContentHTMLString:_displayStringValue]; - [response_ appendContentString:_suffixValue]; + [response appendContentCharacter:'>']; + [response appendContentString:prefixValue]; + [response appendContentHTMLString:displayStringValue]; + [response appendContentString:suffixValue]; }; }; LOGObjectFnStopC("GSWCheckBoxList"); @@ -347,8 +351,8 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWCheckBoxList (GSWCheckBoxListB) --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { LOGObjectFnNotImplemented(); //TODOFN }; @@ -358,14 +362,14 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWCheckBoxList (GSWCheckBoxListC) -(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping + withMapping:(char*)_mapping { LOGObjectFnNotImplemented(); //TODOFN return NO; }; -(BOOL)appendStringAtLeft:(id)_unkwnon - withMapping:(char*)_mapping + withMapping:(char*)_mapping { LOGObjectFnNotImplemented(); //TODOFN return NO; diff --git a/GSWeb.framework/GSWDisplayGroup.h b/GSWeb.framework/GSWDisplayGroup.h index acfd50e..1890fc5 100644 --- a/GSWeb.framework/GSWDisplayGroup.h +++ b/GSWeb.framework/GSWDisplayGroup.h @@ -143,6 +143,7 @@ - (unsigned)indexOfFirstDisplayedObject; - (unsigned)indexOfLastDisplayedObject; - (id)init; +- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver*)unarchiver; - (void)awakeFromKeyValueUnarchiver:(EOKeyValueUnarchiver*)object_; - (NSMutableDictionary *)inputObjectForQualifier; - (BOOL)inQueryMode; @@ -191,6 +192,7 @@ - (void)setFetchesOnLoad:(BOOL)flag; - (void)setInQueryMode:(BOOL)flag; - (void)setInsertedObjectDefaultValues:(NSDictionary *)defaultValues; +-(void)setQueryOperator:(NSDictionary*)qo; - (void)setLocalKeys:(NSArray *)keys; - (void)setMasterObject:(id)masterObject; - (void)setNumberOfObjectsPerBatch:(unsigned)count; diff --git a/GSWeb.framework/GSWDisplayGroup.m b/GSWeb.framework/GSWDisplayGroup.m index 601abcb..ff755a3 100644 --- a/GSWeb.framework/GSWDisplayGroup.m +++ b/GSWeb.framework/GSWDisplayGroup.m @@ -46,7 +46,9 @@ static char rcsId[] = "$Id$"; _queryMatch = [[NSMutableDictionary alloc] initWithCapacity:8]; _queryMin = [[NSMutableDictionary alloc] initWithCapacity:8]; _queryMax = [[NSMutableDictionary alloc] initWithCapacity:8]; + NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator); _queryOperator = [[NSMutableDictionary alloc] initWithCapacity:8]; + NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator); _queryBindings = [[NSMutableDictionary alloc] initWithCapacity:8]; @@ -123,8 +125,9 @@ Description: [unarchiver decodeObjectForKey:@"formatForLikeQualifier"]]; [self setInsertedObjectDefaultValues: [unarchiver decodeObjectForKey:@"insertedObjectDefaultValues"]]; - + [self setQueryOperator:[unarchiver decodeObjectForKey:@"queryOperator"]]; [self finishInitialization]; + NSDebugMLLog(@"gswdisplaygroup",@"GSWDisplayGroup %p : %@",self,self); LOGObjectFnStop(); }; return self; @@ -159,6 +162,8 @@ Description: _defaultStringMatchFormat]; _dscr=[_dscr stringByAppendingFormat:@"insertedObjectDefaultValues:[%@]\n", _insertedObjectDefaultValues]; + _dscr=[_dscr stringByAppendingFormat:@"queryOperator:[%@]\n", + _queryOperator]; return _dscr; }; @@ -269,6 +274,7 @@ Description: NSString* fvalue=value; //VERIFY!! + NSDebugMLLog(@"gswdisplaygroup",@"_queryOperator=%@",_queryOperator); op = [_queryOperator objectForKey:key]; NSDebugMLLog(@"gswdisplaygroup",@"op=%@",op); if(op) @@ -281,7 +287,7 @@ Description: if (_defaultStringMatchFormat) fvalue=[NSString stringWithFormat:_defaultStringMatchFormat, - value];//VERIFY !!! + value];//VERIFY !!! NSDebugMLLog(@"gswdisplaygroup",@"fvalue=%@",fvalue); qualifier=[[[EOKeyValueQualifier alloc] initWithKey:key @@ -955,11 +961,12 @@ Description: } //-------------------------------------------------------------------- -// hasMultipleBatches +/** returns YES if the displayGroup paginates display (batchCount>1), false otherwise **/ - (BOOL)hasMultipleBatches { - return !_flags.fetchAll; + //return !_flags.fetchAll; + return ([self batchCount]>1); } //-------------------------------------------------------------------- @@ -1759,6 +1766,18 @@ self setSelectionIndexes:indexes of objects in objects? //ret 1 LOGObjectFnStop(); } +//-------------------------------------------------------------------- +/** sets query operators **/ +-(void)setQueryOperator:(NSDictionary*)qo +{ + NSAssert1((!qo || [qo isKindOfClass:[NSDictionary class]]), + @"queryOperator is not a dictionary but a %@", + [qo class]); + [_queryOperator removeAllObjects]; + if (qo) + [_queryOperator addEntriesFromDictionary:qo]; +}; + //-------------------------------------------------------------------- // setMasterObject: diff --git a/GSWeb.framework/GSWDynamicElement.h b/GSWeb.framework/GSWDynamicElement.h index 4c8d4f6..1953fe1 100644 --- a/GSWeb.framework/GSWDynamicElement.h +++ b/GSWeb.framework/GSWDynamicElement.h @@ -1,11 +1,16 @@ -/* GSWDynamicElement.h - GSWeb: Class GSWDynamicElement - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWDynamicElement.h - GSWeb: Class GSWDynamicElement + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -33,16 +39,16 @@ NSString* _definitionName; // Name of element in def file (.gswd) - Mainly for debugging purpose }; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)template_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + template:(GSWElement*)template; -(NSString*)definitionName; -(void)setDefinitionName:(NSString*)definitionName; @end //==================================================================== @interface GSWDynamicElement (GSWDynamicElement) --(BOOL)evaluateCondition:(id)condition_ - inContext:(GSWContext*)context_; +-(BOOL)evaluateCondition:(id)condition + inContext:(GSWContext*)context; @end #endif //_GSWDynamicElement_h__ diff --git a/GSWeb.framework/GSWDynamicElement.m b/GSWeb.framework/GSWDynamicElement.m index d2cb3fc..d60fe20 100644 --- a/GSWeb.framework/GSWDynamicElement.m +++ b/GSWeb.framework/GSWDynamicElement.m @@ -1,11 +1,16 @@ -/* GSWDynamicElement.m - GSWeb: Class GSWDynamicElement - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWDynamicElement.m - GSWeb: Class GSWDynamicElement + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -32,14 +38,14 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- // initWithName:associations:template: --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)template_ +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + template:(GSWElement*)template { //OK if ((self=[super init])) - { - }; + { + }; return self; }; @@ -62,9 +68,11 @@ static char rcsId[] = "$Id$"; -(void)setDefinitionName:(NSString*)definitionName { - NSDebugMLLog(@"gswdync",@"setDefinitionName1 in %p: %p %@",self,definitionName,definitionName); + NSDebugMLLog(@"gswdync",@"setDefinitionName1 in %p: %p %@", + self,definitionName,definitionName); ASSIGN(_definitionName,definitionName); - NSDebugMLLog(@"gswdync",@"setDefinitionName2 in %p: %p %@",self,_definitionName,_definitionName); + NSDebugMLLog(@"gswdync",@"setDefinitionName2 in %p: %p %@", + self,_definitionName,_definitionName); }; @end @@ -72,30 +80,30 @@ static char rcsId[] = "$Id$"; @implementation GSWDynamicElement (GSWDynamicElement) //-------------------------------------------------------------------- --(BOOL)evaluateCondition:(id)condition_ - inContext:(GSWContext*)_context +-(BOOL)evaluateCondition:(id)condition + inContext:(GSWContext*)context { //OK - BOOL _result=NO; + BOOL result=NO; LOGObjectFnStart(); NSDebugMLLog(@"gswdync",@"condition_=%@", - condition_); - if (condition_) - { - GSWComponent* _component=[_context component]; - id _value=[condition_ valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"_value=%@ class=%@",_value,[_value class]); + condition); + if (condition) + { + GSWComponent* component=[context component]; + id value=[condition valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"_value=%@ class=%@",value,[value class]); #ifndef NDEBUG - if ([_value respondsToSelector:@selector(unsignedCharValue)]) - { - NSDebugMLLog(@"gswdync",@"unsignedCharValue=%d",(int)[_value unsignedCharValue]); - }; + if ([value respondsToSelector:@selector(unsignedCharValue)]) + { + NSDebugMLLog(@"gswdync",@"unsignedCharValue=%d",(int)[value unsignedCharValue]); + }; #endif - _result=boolValueWithDefaultFor(_value,YES); - }; + result=boolValueWithDefaultFor(value,YES); + }; NSDebugMLLog(@"gswdync",@"result=%s", - (_result ? "YES" : "NO")); + (result ? "YES" : "NO")); LOGObjectFnStop(); - return _result; + return result; }; @end diff --git a/GSWeb.framework/GSWDynamicURLString.h b/GSWeb.framework/GSWDynamicURLString.h index 4942bdc..6d0e4b0 100644 --- a/GSWeb.framework/GSWDynamicURLString.h +++ b/GSWeb.framework/GSWDynamicURLString.h @@ -28,7 +28,7 @@ //==================================================================== -@interface GSWDynamicURLString : NSObject +@interface GSWDynamicURLString : NSObject { NSMutableString* url; NSString* protocol;//NDFN diff --git a/GSWeb.framework/GSWElement.h b/GSWeb.framework/GSWElement.h index 140755b..5fd61c6 100644 --- a/GSWeb.framework/GSWElement.h +++ b/GSWeb.framework/GSWElement.h @@ -1,11 +1,16 @@ -/* GSWElement.h - GSWeb: Class GSWElement - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWElement.h - GSWeb: Class GSWElement + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -41,12 +47,12 @@ extern BYTE ElementsMap_attributeElement; #endif #ifndef NDEBBUG --(void)saveAppendToResponseElementIDInContext:(id)context_; --(void)assertCorrectElementIDInContext:(id)context_ - inCLass:(Class)class_ - method:(SEL)method_ - file:(const char*)file_ - line:(int)line_; +-(void)saveAppendToResponseElementIDInContext:(id)context; +-(void)assertCorrectElementIDInContext:(id)context + inCLass:(Class)class + method:(SEL)method + file:(const char*)file + line:(int)line; #endif -(NSString*)definitionName; //return nil (for non dynamic element) @@ -54,25 +60,26 @@ extern BYTE ElementsMap_attributeElement; #ifdef NDEBBUG #define GSWSaveAppendToResponseElementID(context_); {}; -#define GSWAssertCorrectElementID(context_); {}; +#define GSWAssertCorrectElementID(context_); {}; #else #define GSWSaveAppendToResponseElementID(context_); [self saveAppendToResponseElementIDInContext:context_]; -#define GSWAssertCorrectElementID(context_); ([self assertCorrectElementIDInContext:context_ inCLass:[self class] method:_cmd file:__FILE__ line:__LINE__]); +#define GSWAssertCorrectElementID(context_); \ + ([self assertCorrectElementIDInContext:context_ inCLass:[self class] method:_cmd file:__FILE__ line:__LINE__]); #endif //==================================================================== @interface GSWElement (GSWRequestHandling) --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(GSWElement*)invokeActionForRequest:(GSWRequest*)request + inContext:(GSWContext*)context; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(BOOL)prefixMatchSenderIDInContext:(GSWContext*)context_; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; +-(BOOL)prefixMatchSenderIDInContext:(GSWContext*)context; @end #endif //_GSWElement_h__ diff --git a/GSWeb.framework/GSWElement.m b/GSWeb.framework/GSWElement.m index 52f0e40..06aa46d 100644 --- a/GSWeb.framework/GSWElement.m +++ b/GSWeb.framework/GSWElement.m @@ -1,11 +1,16 @@ -/* GSWElement.m - GSWeb: Class GSWElement - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWElement.m - GSWeb: Class GSWElement + + Copyright (C) 1999-2002 Free Software Foundation, Inc. Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -34,42 +40,42 @@ BYTE ElementsMap_attributeElement = (BYTE)0x41; @implementation GSWElement #ifndef NDEBBUG --(void)saveAppendToResponseElementIDInContext:(id)context_ +-(void)saveAppendToResponseElementIDInContext:(id)context { - NSString* _elementID=[context_ elementID]; - ASSIGN(_appendToResponseElementID,_elementID); + NSString* elementID=[context elementID]; + ASSIGN(_appendToResponseElementID,elementID); }; --(void)assertCorrectElementIDInContext:(id)context_ - inCLass:(Class)class_ - method:(SEL)method_ - file:(const char*)file_ - line:(int)line_ +-(void)assertCorrectElementIDInContext:(id)context + inCLass:(Class)class + method:(SEL)method + file:(const char*)file + line:(int)line { if ([_appendToResponseElementID length]>0) - { - NSString* _elementID=[context_ elementID]; - BOOL _appendToResponseElementIDIsFirst=NO; - BOOL _elementIDIsFirst=NO; - BOOL _OK=YES; - _appendToResponseElementIDIsFirst=[_appendToResponseElementID length]==0 || [_appendToResponseElementID isEqualToString:@"0"]; - _elementIDIsFirst=[_elementID length]==0 || [_elementID isEqualToString:@"0"]; - if (_appendToResponseElementIDIsFirst!=_elementIDIsFirst) - { - _OK=[_appendToResponseElementID isEqualToString:_elementID]; - }; - if (!_OK) - { - NSString* _msg=[NSString stringWithFormat:@"In Class %@ (file %s line %d), id %@ in %@ is not the same than in appendToResponse %@", - NSStringFromClass(class_), - file_, - line_, - [context_ elementID], - NSStringFromSelector(method_), - _appendToResponseElementID]; - NSAssert1(_OK,@"%@",_msg); - }; - }; + { + NSString* elementID=[context elementID]; + BOOL appendToResponseElementIDIsFirst=NO; + BOOL elementIDIsFirst=NO; + BOOL OK=YES; + appendToResponseElementIDIsFirst=([_appendToResponseElementID length]==0 || [_appendToResponseElementID isEqualToString:@"0"]); + elementIDIsFirst=([elementID length]==0 || [elementID isEqualToString:@"0"]); + if (appendToResponseElementIDIsFirst!=elementIDIsFirst) + { + OK=[_appendToResponseElementID isEqualToString:elementID]; + }; + if (!OK) + { + NSString* msg=[NSString stringWithFormat:@"In Class %@ (file %s line %d), id %@ in %@ is not the same than in appendToResponse %@", + NSStringFromClass(class), + file, + line, + [context elementID], + NSStringFromSelector(method), + _appendToResponseElementID]; + NSAssert1(OK,@"%@",msg); + }; + }; }; #endif @@ -85,21 +91,22 @@ BYTE ElementsMap_attributeElement = (BYTE)0x41; //-------------------------------------------------------------------- // takeValuesFromRequest:inContext: --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { - GSWAssertCorrectElementID(context_);// Debug Only + GSWAssertCorrectElementID(context);// Debug Only //Does Nothing }; //-------------------------------------------------------------------- // invokeActionForRequest:inContext: --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(GSWElement*)invokeActionForRequest:(GSWRequest*)request + inContext:(GSWContext*)context { - NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@",[self class],[context_ elementID],[context_ senderID]); - GSWAssertCorrectElementID(context_);// Debug Only + NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@", + [self class],[context elementID],[context senderID]); + GSWAssertCorrectElementID(context);// Debug Only //Does Nothing return nil; }; @@ -107,22 +114,22 @@ BYTE ElementsMap_attributeElement = (BYTE)0x41; //-------------------------------------------------------------------- // appendToResponse:inContext: --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { - GSWSaveAppendToResponseElementID(context_);//Debug Only + GSWSaveAppendToResponseElementID(context);//Debug Only //Does Nothing }; //-------------------------------------------------------------------- //NDFN --(BOOL)prefixMatchSenderIDInContext:(GSWContext*)context_ +-(BOOL)prefixMatchSenderIDInContext:(GSWContext*)context { - NSString* _senderID=[context_ senderID]; - NSString* _elementID=[context_ elementID]; - NSDebugMLLog(@"gswdync",@"_senderID=%@",_senderID); - NSDebugMLLog(@"gswdync",@"_elementID=%@",_elementID); - return ([_elementID hasPrefix:_senderID] || [_senderID hasPrefix:_elementID]); + NSString* senderID=[context senderID]; + NSString* elementID=[context elementID]; + NSDebugMLLog(@"gswdync",@"senderID=%@",senderID); + NSDebugMLLog(@"gswdync",@"elementID=%@",elementID); + return ([elementID hasPrefix:senderID] || [senderID hasPrefix:elementID]); }; @end diff --git a/GSWeb.framework/GSWElementIDString.h b/GSWeb.framework/GSWElementIDString.h index 319cb96..532b631 100644 --- a/GSWeb.framework/GSWElementIDString.h +++ b/GSWeb.framework/GSWElementIDString.h @@ -1,11 +1,16 @@ -/* GSWElementIDString.h - GSWeb: Class GSWElementIDString - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWElementIDString.h - GSWeb: Class GSWElementIDString + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Feb 1999 - + + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -33,19 +39,19 @@ NSMutableString* _string; }; -- (id) init; -- (id) initWithCharactersNoCopy: (unichar*)chars - length: (unsigned)length - freeWhenDone: (BOOL)flag; +-(id)init; +-(id)initWithCharactersNoCopy:(unichar*)chars + length:(unsigned)length + freeWhenDone:(BOOL)flag; -- (id) initWithCStringNoCopy: (char*)byteString - length: (unsigned)length - freeWhenDone: (BOOL)flag; -- (id) initWithCapacity: (unsigned)capacity; -- (unsigned) length; -- (unichar) characterAtIndex: (unsigned)index; -- (void) replaceCharactersInRange: (NSRange)range - withString: (NSString*)aString; +-(id)initWithCStringNoCopy:(char*)byteString + length:(unsigned)length + freeWhenDone:(BOOL)flag; +-(id)initWithCapacity:(unsigned)capacity; +-(unsigned)length; +-(unichar)characterAtIndex:(unsigned)index; +-(void)replaceCharactersInRange:(NSRange)range + withString:(NSString*)aString; -(BOOL)canBeConvertedToEncoding:(NSStringEncoding)encoding; -(void)dealloc; -(void)getCString:(char*)buffer diff --git a/GSWeb.framework/GSWElementIDString.m b/GSWeb.framework/GSWElementIDString.m index eed8040..bbf8ceb 100644 --- a/GSWeb.framework/GSWElementIDString.m +++ b/GSWeb.framework/GSWElementIDString.m @@ -1,11 +1,16 @@ -/* GSWElementIDString.m - GSWeb: Class GSWElementIDString - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWElementIDString.m - GSWeb: Class GSWElementIDString + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 - + + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -300,24 +306,22 @@ static char rcsId[] = "$Id$"; { NSArray* ids=nil; LOGObjectFnStart(); -// NSDebugMLLog(@"low",@"self:%@",self); if ([self length]>0) - { - ids=[self componentsSeparatedByString:@"."]; - NSAssert([ids count]>0,@"PROBLEM"); - if ([ids count]==1) - [self setString:@""]; - else - { - [self setString:[[ids subarrayWithRange:NSMakeRange(0,[ids count]-1)] - componentsJoinedByString:@"."]]; - }; - } + { + ids=[self componentsSeparatedByString:@"."]; + NSAssert([ids count]>0,@"PROBLEM"); + if ([ids count]==1) + [self setString:@""]; + else + { + [self setString:[[ids subarrayWithRange:NSMakeRange(0,[ids count]-1)] + componentsJoinedByString:@"."]]; + }; + } else - { - ExceptionRaise0(@"GSWElementIDString",@"Can't deleteLastElementIDComponent of an empty ElementID String"); - }; - NSDebugMLLog(@"low",@"self:%@",self); + { + ExceptionRaise0(@"GSWElementIDString",@"Can't deleteLastElementIDComponent of an empty ElementID String"); + }; LOGObjectFnStop(); }; @@ -326,25 +330,20 @@ static char rcsId[] = "$Id$"; { NSArray* ids=nil; LOGObjectFnStart(); -// NSDebugMLLog(@"low",@"self:%@",self); ids=[self componentsSeparatedByString:@"."]; if (ids && [ids count]>0) - { - NSString* _last=[ids lastObject]; - NSString* _new=nil; - NSDebugMLLog(@"low",@"_last:%@",_last); - _last=[NSString stringWithFormat:@"%d",([_last intValue]+1)]; - NSDebugMLLog(@"low",@"_last:%@",_last); - NSDebugMLLog(@"low",@"ids count:%d",[ids count]); - if ([ids count]>1) - _new=[[[ids subarrayWithRange:NSMakeRange(0,[ids count]-1)] - componentsJoinedByString:@"."] - stringByAppendingFormat:@".%@",_last]; - else - _new=_last; - [self setString:_new]; - }; - NSDebugMLLog(@"low",@"self:%@",self); + { + NSString* _last=[ids lastObject]; + NSString* _new=nil; + _last=[NSString stringWithFormat:@"%d",([_last intValue]+1)]; + if ([ids count]>1) + _new=[[[ids subarrayWithRange:NSMakeRange(0,[ids count]-1)] + componentsJoinedByString:@"."] + stringByAppendingFormat:@".%@",_last]; + else + _new=_last; + [self setString:_new]; + }; LOGObjectFnStop(); }; @@ -352,12 +351,10 @@ static char rcsId[] = "$Id$"; -(void)appendZeroElementIDComponent { LOGObjectFnStart(); -// NSDebugMLLog(@"low",@"self:%@",self); if ([self length]>0) - [self appendString:@".0"]; + [self appendString:@".0"]; else - [self setString:@"0"]; - NSDebugMLLog(@"low",@"self:%@",self); + [self setString:@"0"]; LOGObjectFnStop(); }; @@ -365,13 +362,10 @@ static char rcsId[] = "$Id$"; -(void)appendElementIDComponent:(id)_element { LOGObjectFnStart(); -// NSDebugMLLog(@"low",@"self:%@",self); -// NSDebugMLLog(@"low",@"_element:%@",_element); if (self && [self length]>0) - [self appendFormat:@".%@",_element]; + [self appendFormat:@".%@",_element]; else - [self setString:_element]; - NSDebugMLLog(@"low",@"self:%@",self); + [self setString:_element]; LOGObjectFnStop(); }; @@ -381,7 +375,7 @@ static char rcsId[] = "$Id$"; { GSWElementIDString* _id=[[self copy] autorelease]; if ([self length]>0) - [_id deleteLastElementIDComponent]; + [_id deleteLastElementIDComponent]; return _id; }; //-------------------------------------------------------------------- diff --git a/GSWeb.framework/GSWFileUpload.h b/GSWeb.framework/GSWFileUpload.h index f598670..56265e3 100644 --- a/GSWeb.framework/GSWFileUpload.h +++ b/GSWeb.framework/GSWFileUpload.h @@ -1,11 +1,16 @@ -/* GSWFileUpload.h - GSWeb: Class GSWFileUpload - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWFileUpload.h - GSWeb: Class GSWFileUpload + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Sept 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,13 +35,13 @@ //==================================================================== @interface GSWFileUpload: GSWInput { - GSWAssociation* data; - GSWAssociation* filepath; + GSWAssociation* _data; + GSWAssociation* _filepath; }; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(void)dealloc; @@ -43,12 +49,12 @@ //==================================================================== @interface GSWFileUpload (GSWFileUploadA) --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; +-(GSWElement*)invokeActionForRequest:(GSWRequest*)request + inContext:(GSWContext*)context; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; @end #endif // _GSWFileUpload_h__ diff --git a/GSWeb.framework/GSWFileUpload.m b/GSWeb.framework/GSWFileUpload.m index 17eb383..a56e27d 100644 --- a/GSWeb.framework/GSWFileUpload.m +++ b/GSWeb.framework/GSWFileUpload.m @@ -1,11 +1,16 @@ -/* GSWFileUpload.h - GSWeb: Class GSWFileUpload - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWFileUpload.m - GSWeb: Class GSWFileUpload + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Sep 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,39 +35,40 @@ static char rcsId[] = "$Id$"; @implementation GSWFileUpload //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { - NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; + NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations]; LOGObjectFnStartC("GSWFileUpload"); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_); - [_associations setObject:[GSWAssociation associationWithValue:@"file"] - forKey:@"type"]; - [_associations removeObjectForKey:data__Key]; - [_associations removeObjectForKey:filePath__Key]; - if ((self=[super initWithName:name_ - associations:_associations - contentElements:nil])) //No Childs! - { - data = [[associations_ objectForKey:data__Key - withDefaultObject:[data autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWFileUpload: data=%@",data); + NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements_=%@", + aName,associations,elements); + [tmpAssociations setObject:[GSWAssociation associationWithValue:@"file"] + forKey:@"type"]; + [tmpAssociations removeObjectForKey:data__Key]; + [tmpAssociations removeObjectForKey:filePath__Key]; + if ((self=[super initWithName:aName + associations:tmpAssociations + contentElements:nil])) //No Childs! + { + _data = [[associations objectForKey:data__Key + withDefaultObject:[_data autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWFileUpload: data=%@",_data); - if (!data || ![data isValueSettable]) - { - //TODO - }; - - filepath = [[associations_ objectForKey:filePath__Key - withDefaultObject:[filepath autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWFileUpload: filepath=%@",filepath); - - if (!filepath || ![filepath isValueSettable]) - { - //TODO - }; - }; + if (!_data || ![_data isValueSettable]) + { + //TODO + }; + + _filepath = [[associations objectForKey:filePath__Key + withDefaultObject:[_filepath autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWFileUpload: filepath=%@",_filepath); + + if (!_filepath || ![_filepath isValueSettable]) + { + //TODO + }; + }; LOGObjectFnStopC("GSWFileUpload"); return self; }; @@ -70,8 +77,8 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(data); - DESTROY(filepath); + DESTROY(_data); + DESTROY(_filepath); [super dealloc]; }; @@ -80,126 +87,130 @@ static char rcsId[] = "$Id$"; @implementation GSWFileUpload (GSWFileUploadA) //-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { - [super appendToResponse:response_ - inContext:context_]; + [super appendToResponse:response + inContext:context]; }; //-------------------------------------------------------------------- --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(GSWElement*)invokeActionForRequest:(GSWRequest*)request + inContext:(GSWContext*)context { - GSWAssertCorrectElementID(context_);// Debug Only + GSWAssertCorrectElementID(context);// Debug Only //Bypass GSWInput return nil; }; //-------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK - BOOL _disabled=NO; + BOOL disabledValue=NO; LOGObjectFnStartC("GSWFileUpload"); - GSWAssertCorrectElementID(context_);// Debug Only - _disabled=[self disabledInContext:context_]; - if (!_disabled) - { - BOOL _wasFormSubmitted=[context_ _wasFormSubmitted]; - if (_wasFormSubmitted) - { - GSWComponent* _component=nil; - NSString* _nameInContext=nil; - NSArray* _fileDatas=nil; - NSString* fileNameFormValueName=nil; - NSString* _fileName=nil; - NSData* _data=nil; - int _fileDatasCount=0; - NS_DURING - { - _component=[context_ component]; - _nameInContext=[self nameInContext:context_]; - NSDebugMLLog(@"gswdync",@"_nameInContext=%@",_nameInContext); - _fileDatas=[request_ formValuesForKey:_nameInContext]; - NSDebugMLLog(@"gswdync",@"_value=%@",_fileDatas); - _fileDatasCount=[_fileDatas count]; -/* - if (_fileDatasCount!=1) - { - ExceptionRaise(@"GSWFileUpload", - @"GSWFileUpload: File Data Nb != 1 :%d", - _fileDatasCount); - }; -*/ - if (_fileDatasCount==1) { - - _data=[_fileDatas objectAtIndex:0]; - NSDebugMLLog(@"gswdync",@"_data (class=%@)=%@",[_data class],_data); - if (_data) - { - if ([_data isKindOfClass:[NSData class]]) - { - if ([_data length]==0) - { - LOGError(@"Empty Data: %@",_data); - }; - } - else - { - if ([_data isKindOfClass:[NSString class]] && [_data length]==0) - { - LOGError(@"No Data: %@",_data); - _data=nil; - } - else - { - NSLog(@"content type request : %@",[request_ _contentType]); - NSLog(@"data class = %@",NSStringFromClass([_data class])); - /*if (![_data isMemberOfClass:[NSString class]]) { - ExceptionRaise(@"GSWFileUpload", - @"GSWFileUpload: bad data :%@", - _data); - _data=nil; - }*/ - }; - }; - } - else - { - LOGError0(@"No Data:"); - }; - fileNameFormValueName=[NSString stringWithFormat:@"%@.filename",_nameInContext]; - NSDebugMLLog(@"gswdync",@"fileNameFormValueName=%@",fileNameFormValueName); - _fileName=[request_ formValueForKey:fileNameFormValueName]; - NSDebugMLLog(@"gswdync",@"_fileName=%@",_fileName); - if (!_fileName || [_fileName length]==0) - { - LOGError(@"No fileName: %@",_fileName); - }; - [filepath setValue:_fileName - inComponent:_component]; - [data setValue:_data - inComponent:_component]; - } else { - // bug in omniweb-browser if you click cancel in FileOpenPanel, it transmits incorrect datas - - [filepath setValue:nil - inComponent:_component]; - [data setValue:nil - inComponent:_component]; + GSWAssertCorrectElementID(context);// Debug Only + disabledValue=[self disabledInContext:context]; + if (!disabledValue) + { + BOOL wasFormSubmitted=[context _wasFormSubmitted]; + if (wasFormSubmitted) + { + GSWComponent* component=nil; + NSString* nameInContext=nil; + NSArray* fileDatas=nil; + NSString* fileNameFormValueName=nil; + NSString* fileNameValue=nil; + NSData* dataValue=nil; + int fileDatasCount=0; + NS_DURING + { + component=[context component]; + nameInContext=[self nameInContext:context]; + NSDebugMLLog(@"gswdync",@"nameInContext=%@",nameInContext); + fileDatas=[request formValuesForKey:nameInContext]; + NSDebugMLLog(@"gswdync",@"value=%@",fileDatas); + fileDatasCount=[fileDatas count]; + /* + if (_fileDatasCount!=1) + { + ExceptionRaise(@"GSWFileUpload", + @"GSWFileUpload: File Data Nb != 1 :%d", + _fileDatasCount); + }; + */ + if (fileDatasCount==1) + { + dataValue=[fileDatas objectAtIndex:0]; + NSDebugMLLog(@"gswdync",@"dataValue (class=%@)=%@", + [dataValue class],dataValue); + if (dataValue) + { + if ([dataValue isKindOfClass:[NSData class]]) + { + if ([dataValue length]==0) + { + LOGError(@"Empty Data: %@",dataValue); + }; + } + else + { + if ([dataValue isKindOfClass:[NSString class]] && [dataValue length]==0) + { + LOGError(@"No Data: %@",dataValue); + dataValue=nil; + } + else + { + NSLog(@"content type request : %@",[request _contentType]); + NSLog(@"data class = %@",NSStringFromClass([dataValue class])); + /*if (![dataValue isMemberOfClass:[NSString class]]) { + ExceptionRaise(@"GSWFileUpload", + @"GSWFileUpload: bad data :%@", + dataValue); + dataValue=nil; + }*/ + }; + }; + } + else + { + LOGError0(@"No Data:"); + }; + fileNameFormValueName=[NSString stringWithFormat:@"%@.filename",nameInContext]; + NSDebugMLLog(@"gswdync",@"fileNameFormValueName=%@",fileNameFormValueName); + fileNameValue=[request formValueForKey:fileNameFormValueName]; + NSDebugMLLog(@"gswdync",@"fileNameValue=%@",fileNameValue); + if (!fileNameValue || [fileNameValue length]==0) + { + LOGError(@"No fileName: %@",fileNameValue); + }; + [_filepath setValue:fileNameValue + inComponent:component]; + [_data setValue:dataValue + inComponent:component]; + } + else + { + // bug in omniweb-browser if you click cancel in FileOpenPanel, it transmits incorrect datas + + [_filepath setValue:nil + inComponent:component]; + [_data setValue:nil + inComponent:component]; } - } - NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"GSWFileUpload in takeValuesFromRequest"); - LOGException(@"%@ (%@)",localException,[localException reason]); - [localException raise]; - }; - NS_ENDHANDLER; - }; - }; + } + NS_HANDLER + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"GSWFileUpload in takeValuesFromRequest"); + LOGException(@"%@ (%@)",localException,[localException reason]); + [localException raise]; + }; + NS_ENDHANDLER; + }; + }; LOGObjectFnStopC("GSWFileUpload"); }; @end diff --git a/GSWeb.framework/GSWFrame.h b/GSWeb.framework/GSWFrame.h index b92bd09..731ad4f 100644 --- a/GSWeb.framework/GSWFrame.h +++ b/GSWeb.framework/GSWFrame.h @@ -1,11 +1,16 @@ -/* GSWFrame.h - GSWeb: Class GSWFrame - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWFrame.h - GSWeb: Class GSWFrame + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,9 +35,9 @@ //==================================================================== @interface GSWFrame: GSWHTMLURLValuedElement --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(void)dealloc; -(NSString*)valueAttributeName; -(NSString*)urlAttributeName; diff --git a/GSWeb.framework/GSWFrame.m b/GSWeb.framework/GSWFrame.m index 75b6f07..56a5b8e 100644 --- a/GSWeb.framework/GSWFrame.m +++ b/GSWeb.framework/GSWFrame.m @@ -1,11 +1,16 @@ -/* GSWFrame.m - GSWeb: Class GSWFrame - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWFrame.m - GSWeb: Class GSWFrame + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,16 +35,16 @@ static char rcsId[] = "$Id$"; @implementation GSWFrame //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { - NSString* _elementName=[self elementName]; - if ((self=[super initWithName:_elementName - associations:associations_ - contentElements:nil])) - { - }; + NSString* elementName=[self elementName]; + if ((self=[super initWithName:elementName + associations:associations + contentElements:nil])) + { + }; return self; }; @@ -70,8 +76,8 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p>", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; diff --git a/GSWeb.framework/GSWGenericElement.h b/GSWeb.framework/GSWGenericElement.h index a8e2684..3b8108c 100644 --- a/GSWeb.framework/GSWGenericElement.h +++ b/GSWeb.framework/GSWGenericElement.h @@ -1,11 +1,15 @@ -/* GSWGenericElement.h - GSWeb: Class GSWGenericElement - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWGenericElement.h - GSWeb: Class GSWGenericElement + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +23,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -30,41 +35,45 @@ //==================================================================== @interface GSWGenericElement: GSWDynamicElement { - GSWAssociation* elementName; - GSWAssociation* name; - GSWAssociation* omitTags; - GSWAssociation* formValue; - GSWAssociation* formValues; - GSWAssociation* invokeAction; - GSWAssociation* elementId; - GSWAssociation* otherTagString; - NSDictionary* otherAssociations; - BOOL hasFormValues; + GSWAssociation* _elementName; + GSWAssociation* _name; + GSWAssociation* _omitTags; + GSWAssociation* _formValue; + GSWAssociation* _formValues; + GSWAssociation* _invokeAction; + GSWAssociation* _elementId; + GSWAssociation* _otherTagString; + NSDictionary* _otherAssociations; + BOOL _hasFormValues; }; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)templateElement_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + template:(GSWElement*)templateElement; + -(void)dealloc; -(NSString*)description; --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(GSWElement*)invokeActionForRequest:(GSWRequest*)request + inContext:(GSWContext*)context; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; --(id)_elementNameAppenedToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(void)_appendTagWithName:(NSString*)name_ - toResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(void)_appendOtherAttributesToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(NSString*)_elementNameInContext:(GSWContext*)context_; +-(id)_elementNameAppenedToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; + +-(void)_appendTagWithName:(NSString*)name + toResponse:(GSWResponse*)response + inContext:(GSWContext*)context; + +-(void)_appendOtherAttributesToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; + +-(NSString*)_elementNameInContext:(GSWContext*)context; @end #endif //_GSWGenericElement_h__ diff --git a/GSWeb.framework/GSWGenericElement.m b/GSWeb.framework/GSWGenericElement.m index 646c392..dd63368 100644 --- a/GSWeb.framework/GSWGenericElement.m +++ b/GSWeb.framework/GSWGenericElement.m @@ -1,11 +1,16 @@ -/* GSWGenericElement.m - GSWeb: Class GSWGenericElement - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWGenericElement.m - GSWeb: Class GSWGenericElement + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -28,9 +34,9 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWGenericElement --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)templateElement_ +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + template:(GSWElement*)templateElement { LOGObjectFnNotImplemented(); //TODOFN return nil; @@ -51,16 +57,16 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(GSWElement*)invokeActionForRequest:(GSWRequest*)request + inContext:(GSWContext*)context { LOGObjectFnNotImplemented(); //TODOFN return nil; @@ -68,32 +74,32 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(id)_elementNameAppenedToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(id)_elementNameAppenedToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { LOGObjectFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- --(void)_appendTagWithName:(NSString*)name_ - toResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)_appendTagWithName:(NSString*)name + toResponse:(GSWResponse*)response + inContext:(GSWContext*)context { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(void)_appendOtherAttributesToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)_appendOtherAttributesToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { LOGObjectFnNotImplemented(); //TODOFN }; diff --git a/GSWeb.framework/GSWHTMLStaticElement.h b/GSWeb.framework/GSWHTMLStaticElement.h index 3e9729a..b04717d 100644 --- a/GSWeb.framework/GSWHTMLStaticElement.h +++ b/GSWeb.framework/GSWHTMLStaticElement.h @@ -1,11 +1,16 @@ -/* GSWHTMLStaticElement.h - GSWeb: Class GSWHTMLStaticElement - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWHTMLStaticElement.h - GSWeb: Class GSWHTMLStaticElement + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -30,10 +36,10 @@ //==================================================================== @interface GSWHTMLStaticElement: GSWElement { - NSData* elementsMap; - NSArray* htmlBareStrings; - NSArray* dynamicChildren; - NSString* elementName; + NSData* _elementsMap; + NSArray* _htmlBareStrings; + NSArray* _dynamicChildren; + NSString* _elementName; }; -(NSString*)elementName; @@ -42,20 +48,20 @@ -(NSData*)elementsMap; -(id)_initWithElementsMap:(NSData*)_elementsMap - htmlBareStrings:(NSArray*)htmlBareStrings - dynamicChildren:(NSArray*)dynamicChildren; + htmlBareStrings:(NSArray*)htmlBareStrings + dynamicChildren:(NSArray*)dynamicChildren; --(id) initWithName:(NSString*)elementName_ - attributeDictionary:(NSDictionary*)_attributeDictionary - contentElements:(NSArray*)elements_; +-(id) initWithName:(NSString*)elementName + attributeDictionary:(NSDictionary*)attributeDictionary + contentElements:(NSArray*)elements; --(id) initWithName:(NSString*)elementName_ - attributeString:(NSString*)_attributeString - contentElements:(NSArray*)elements_; +-(id) initWithName:(NSString*)elementName + attributeString:(NSString*)attributeString + contentElements:(NSArray*)elements; -(void)dealloc; --(void)_setEndOfHTMLTag:(unsigned int)_unknown; +-(void)_setEndOfHTMLTag:(unsigned int)unknown; -(NSString*)description; @@ -63,28 +69,29 @@ //==================================================================== @interface GSWHTMLStaticElement (GSWHTMLStaticElementA) --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ - elementsFromIndex:(unsigned int)_fromIndex - toIndex:(unsigned int)_toIndex; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context + elementsFromIndex:(unsigned int)fromIndex + toIndex:(unsigned int)toIndex; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(GSWElement*)invokeActionForRequest:(GSWRequest*)request + inContext:(GSWContext*)context; + +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; @end //==================================================================== @interface GSWHTMLStaticElement (GSWHTMLStaticElementB) -(BOOL)compactHTMLTags; --(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping; --(BOOL)appendStringAtLeft:(id)_unkwnon - withMapping:(char*)_mapping; +-(BOOL)appendStringAtRight:(id)unkwnon + withMapping:(char*)mapping; +-(BOOL)appendStringAtLeft:(id)unkwnon + withMapping:(char*)mapping; -(BOOL)canBeFlattenedAtInitialization; @end @@ -92,30 +99,30 @@ //==================================================================== @interface GSWHTMLStaticElement (GSWHTMLStaticElementC) +(BOOL)charactersNeedingQuotes; -+(void)addURLAttribute:(id)_attribute - forElementNamed:(NSString*)_name; -+(id)urlsForElementNamed:(NSString*)_name; ++(void)addURLAttribute:(id)attribute + forElementNamed:(NSString*)name; ++(id)urlsForElementNamed:(NSString*)name; @end //==================================================================== @interface GSWHTMLStaticElement (GSWHTMLStaticElementD) -+(NSDictionary*)attributeDictionaryForString:(NSString*)_string; -+(NSString*)stringForAttributeDictionary:(NSDictionary*)_attributeDictionary; -+(GSWElement*)elementWithName:(NSString*)_name - attributeString:(NSString*)_attributeString - contentElements:(NSArray*)elements_; ++(NSDictionary*)attributeDictionaryForString:(NSString*)string; ++(NSString*)stringForAttributeDictionary:(NSDictionary*)attributeDictionary; ++(GSWElement*)elementWithName:(NSString*)name + attributeString:(NSString*)attributeString + contentElements:(NSArray*)elements; @end //==================================================================== @interface GSWHTMLStaticElement (GSWHTMLStaticElementE) -+(GSWElement*)elementWithName:(NSString*)_name - attributeDictionary:(NSDictionary*)_attributeDictionary - contentElements:(NSArray*)elements_; ++(GSWElement*)elementWithName:(NSString*)name + attributeDictionary:(NSDictionary*)attributeDictionary + contentElements:(NSArray*)elements; -+(Class)_elementClassForName:(NSString*)_name; -+(void)setElementClass:(Class)_class - forName:(NSString*)_name; ++(Class)_elementClassForName:(NSString*)name; ++(void)setElementClass:(Class)class + forName:(NSString*)name; +(GSWElement*)_theEmptyElement; @end diff --git a/GSWeb.framework/GSWHTMLStaticElement.m b/GSWeb.framework/GSWHTMLStaticElement.m index 3b2115b..73cebd8 100644 --- a/GSWeb.framework/GSWHTMLStaticElement.m +++ b/GSWeb.framework/GSWHTMLStaticElement.m @@ -1,11 +1,16 @@ -/* GSWHTMLStaticElement.m - GSWeb: Class GSWHTMLStaticElement - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWHTMLStaticElement.m - GSWeb: Class GSWHTMLStaticElement + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,197 +35,198 @@ static char rcsId[] = "$Id$"; @implementation GSWHTMLStaticElement //-------------------------------------------------------------------- --(id) initWithName:(NSString*)_elementName - attributeDictionary:(NSDictionary*)attributeAssociations_ - contentElements:(NSArray*)_elements +-(id) initWithName:(NSString*)anElementName + attributeDictionary:(NSDictionary*)aAttributeAssociationsList + contentElements:(NSArray*)anElementsArray { //OK LOGObjectFnStart(); - NSDebugMLLog(@"gswdync",@"_elementName=%@ attributeAssociations_:%@ _elements=%@", - _elementName, - attributeAssociations_, - _elements); + NSDebugMLLog(@"gswdync",@"anElementName=%@ aAttributeAssociationsList:%@ anElementsArray=%@", + anElementName, + aAttributeAssociationsList, + anElementsArray); if ((self=[super init])) - { - NSMutableArray* _attributeAssociationsValues=[NSMutableArray array]; - NSMutableArray* _htmlBareStrings=[NSMutableArray array]; - NSMutableData* _elementsMap=[[NSMutableData new]autorelease]; - ASSIGN(elementName,_elementName);//?? + { + NSMutableArray* attributeAssociationsValues=[NSMutableArray array]; + NSMutableArray* tmpHtmlBareStrings=[NSMutableArray array]; + NSMutableData* tmpElementsMap=[[NSMutableData new]autorelease]; + ASSIGN(_elementName,anElementName);//?? + if (anElementName) + { + NSEnumerator* attributesKeyEnum=nil; + id key=nil; + [tmpHtmlBareStrings addObject:[NSString stringWithFormat:@"<%@", + anElementName]]; + [tmpElementsMap appendBytes:&ElementsMap_htmlBareString + length:1]; - if (_elementName) - { - NSEnumerator* attributesKeyEnum=nil; - id _key=nil; - [_htmlBareStrings addObject:[NSString stringWithFormat:@"<%@", - _elementName]]; - [_elementsMap appendBytes:&ElementsMap_htmlBareString - length:1]; - - attributesKeyEnum= [attributeAssociations_ keyEnumerator]; - NSDebugMLLog(@"gswdync",@"attributesKeyEnum=%@ attributeAssociations_=%@",attributesKeyEnum,attributeAssociations_); - while ((_key = [attributesKeyEnum nextObject])) - { - id _association=[attributeAssociations_ objectForKey:_key]; - id _associationValue=[_association valueInComponent:nil]; - NSDebugMLLog(@"gswdync",@"_association=%@ _associationValue=%@",_association,_associationValue); - [_htmlBareStrings addObject:[NSString stringWithFormat:@" %@",_key]]; - [_elementsMap appendBytes:&ElementsMap_htmlBareString - length:1]; - if (_associationValue) - { - [_htmlBareStrings addObject:[NSString stringWithString:@"="]]; - [_elementsMap appendBytes:&ElementsMap_htmlBareString - length:1]; - [_htmlBareStrings addObject:[NSString stringWithFormat:@"\"%@\"",_associationValue]]; - [_elementsMap appendBytes:&ElementsMap_htmlBareString - length:1]; - } - else - { - //TODO So what next ? - [_attributeAssociationsValues addObject:_association]; - [_elementsMap appendBytes:&ElementsMap_attributeElement - length:1]; - - }; - }; - [_htmlBareStrings addObject:@">"]; - [_elementsMap appendBytes:&ElementsMap_htmlBareString - length:1]; - }; - if (_elements) - { - int elementsN=[_elements count]; - for(;elementsN>0;elementsN--) - [_elementsMap appendBytes:&ElementsMap_dynamicElement - length:1]; - if (_elementName) - { - [_htmlBareStrings addObject:[NSString stringWithFormat:@"", - _elementName]]; - [_elementsMap appendBytes:&ElementsMap_htmlBareString - length:1]; - }; + attributesKeyEnum= [aAttributeAssociationsList keyEnumerator]; + NSDebugMLLog(@"gswdync",@"attributesKeyEnum=%@ aAttributeAssociationsList=%@", + attributesKeyEnum,aAttributeAssociationsList); + while ((key = [attributesKeyEnum nextObject])) + { + id association=[aAttributeAssociationsList objectForKey:key]; + id associationValue=[association valueInComponent:nil]; + NSDebugMLLog(@"gswdync",@"association=%@ associationValue=%@", + association,associationValue); + [tmpHtmlBareStrings addObject:[NSString stringWithFormat:@" %@",key]]; + [tmpElementsMap appendBytes:&ElementsMap_htmlBareString + length:1]; + if (associationValue) + { + [tmpHtmlBareStrings addObject:[NSString stringWithString:@"="]]; + [tmpElementsMap appendBytes:&ElementsMap_htmlBareString + length:1]; + [tmpHtmlBareStrings addObject:[NSString stringWithFormat:@"\"%@\"",associationValue]]; + [tmpElementsMap appendBytes:&ElementsMap_htmlBareString + length:1]; + } + else + { + //TODO So what next ? + [attributeAssociationsValues addObject:association]; + [tmpElementsMap appendBytes:&ElementsMap_attributeElement + length:1]; + }; - - [self _initWithElementsMap:_elementsMap - htmlBareStrings:_htmlBareStrings - dynamicChildren:_elements]; - }; + }; + [tmpHtmlBareStrings addObject:@">"]; + [tmpElementsMap appendBytes:&ElementsMap_htmlBareString + length:1]; + }; + if (anElementsArray) + { + int elementsN=[anElementsArray count]; + for(;elementsN>0;elementsN--) + [tmpElementsMap appendBytes:&ElementsMap_dynamicElement + length:1]; + if (anElementName) + { + [tmpHtmlBareStrings addObject:[NSString stringWithFormat:@"", + anElementName]]; + [tmpElementsMap appendBytes:&ElementsMap_htmlBareString + length:1]; + }; + }; + + [self _initWithElementsMap:tmpElementsMap + htmlBareStrings:tmpHtmlBareStrings + dynamicChildren:anElementsArray]; + }; LOGObjectFnStop(); return self; }; //-------------------------------------------------------------------- --(id) initWithName:(NSString*)_elementName - attributeString:(NSString*)_attributeString - contentElements:(NSArray*)_elements +-(id) initWithName:(NSString*)anElementName + attributeString:(NSString*)attributeString + contentElements:(NSArray*)anElementsArray { //OK LOGObjectFnStart(); - NSDebugMLLog(@"gswdync",@"_elementName=%@ _attributeString:%@ _elements=%@", - _elementName, - _attributeString, - _elements); + NSDebugMLLog(@"gswdync",@"anElementName=%@ attributeString:%@ anElementsArray=%@", + anElementName, + attributeString, + anElementsArray); if ((self=[super init])) - { - NSMutableArray* _htmlBareStrings=[NSMutableArray array]; - NSMutableData* _elementsMap=[[NSMutableData new]autorelease]; - ASSIGN(elementName,_elementName);//?? + { + NSMutableArray* tmpHtmlBareStrings=[NSMutableArray array]; + NSMutableData* tmpElementsMap=[[NSMutableData new]autorelease]; + ASSIGN(_elementName,anElementName);//?? - if (_elementName) - { - [_htmlBareStrings addObject:[NSString stringWithFormat:@"<%@", - _elementName]]; - [_elementsMap appendBytes:&ElementsMap_htmlBareString - length:1]; - [_htmlBareStrings addObject:_attributeString]; - [_elementsMap appendBytes:&ElementsMap_htmlBareString - length:1]; - [_htmlBareStrings addObject:@">"]; - [_elementsMap appendBytes:&ElementsMap_htmlBareString - length:1]; - }; - if (_elements) - { - int elementsN=[_elements count]; - for(;elementsN>0;elementsN--) - [_elementsMap appendBytes:&ElementsMap_dynamicElement - length:1]; - if (_elementName) - { - [_htmlBareStrings addObject:[NSString stringWithFormat:@"", - _elementName]]; - [_elementsMap appendBytes:&ElementsMap_htmlBareString - length:1]; - }; - }; - [self _initWithElementsMap:_elementsMap - htmlBareStrings:_htmlBareStrings - dynamicChildren:_elements]; - }; + if (anElementName) + { + [tmpHtmlBareStrings addObject:[NSString stringWithFormat:@"<%@", + anElementName]]; + [tmpElementsMap appendBytes:&ElementsMap_htmlBareString + length:1]; + [tmpHtmlBareStrings addObject:attributeString]; + [tmpElementsMap appendBytes:&ElementsMap_htmlBareString + length:1]; + [tmpHtmlBareStrings addObject:@">"]; + [tmpElementsMap appendBytes:&ElementsMap_htmlBareString + length:1]; + }; + if (anElementsArray) + { + int elementsN=[anElementsArray count]; + for(;elementsN>0;elementsN--) + [tmpElementsMap appendBytes:&ElementsMap_dynamicElement + length:1]; + if (anElementName) + { + [tmpHtmlBareStrings addObject:[NSString stringWithFormat:@"", + anElementName]]; + [tmpElementsMap appendBytes:&ElementsMap_htmlBareString + length:1]; + }; + }; + [self _initWithElementsMap:tmpElementsMap + htmlBareStrings:tmpHtmlBareStrings + dynamicChildren:anElementsArray]; + }; LOGObjectFnStop(); return self; }; //-------------------------------------------------------------------- --(id)_initWithElementsMap:(NSData*)_elementsMap - htmlBareStrings:(NSArray*)_htmlBareStrings - dynamicChildren:(NSArray*)_dynamicChildren +-(id)_initWithElementsMap:(NSData*)tmpElementsMap + htmlBareStrings:(NSArray*)tmpHtmlBareStrings + dynamicChildren:(NSArray*)aDynamicChildrensArray { - BOOL _compactHTMLTags=NO; + BOOL compactHTMLTags=NO; LOGObjectFnStart(); - NSDebugMLLog(@"gswdync",@"_elementsMap=%@ _htmlBareStrings:%@ dynamicChildren=%@", - _elementsMap, - _htmlBareStrings, - _dynamicChildren); - _compactHTMLTags=[self compactHTMLTags]; + NSDebugMLLog(@"gswdync",@"tmpElementsMap=%@ tmpHtmlBareStrings:%@ dynamicChildren=%@", + tmpElementsMap, + tmpHtmlBareStrings, + aDynamicChildrensArray); + compactHTMLTags=[self compactHTMLTags]; //OK - if (_compactHTMLTags) - { - int elementN=0; - while(elementN<[_elementsMap length] && ((BYTE*)[_elementsMap bytes])[elementN]==ElementsMap_htmlBareString) - elementN++; - [self _setEndOfHTMLTag:elementN]; - if (elementN>0) - { - int rmStringN=0; - NSMutableArray* rmStrings=[NSMutableArray array]; - NSMutableString* rmString=[[NSMutableString new] autorelease]; - NSMutableData* tmpElementsMap=[[NSMutableData new] autorelease]; - [tmpElementsMap appendBytes:&ElementsMap_htmlBareString - length:1]; - if ([_elementsMap length]>elementN) - [tmpElementsMap appendData: - [_elementsMap subdataWithRange: - NSMakeRange(elementN, - [_elementsMap length]-elementN)]]; - _elementsMap=tmpElementsMap; - for(rmStringN=0;rmStringN0) + { + int rmStringN=0; + NSMutableArray* rmStrings=[NSMutableArray array]; + NSMutableString* rmString=[[NSMutableString new] autorelease]; + NSMutableData* tmpElementsMap=[[NSMutableData new] autorelease]; + [tmpElementsMap appendBytes:&ElementsMap_htmlBareString + length:1]; + if ([tmpElementsMap length]>elementN) + [tmpElementsMap appendData: + [tmpElementsMap subdataWithRange: + NSMakeRange(elementN, + [tmpElementsMap length]-elementN)]]; + tmpElementsMap=tmpElementsMap; + for(rmStringN=0;rmStringN",*/ [self class], (void*)self, - elementsMap]; -/* htmlBareStrings, - dynamicChildren, - elementName];*/ + _elementsMap]; +/* _htmlBareStrings, + _dynamicChildren, + _elementName];*/ }; @end @@ -284,155 +291,170 @@ static char rcsId[] = "$Id$"; @implementation GSWHTMLStaticElement (GSWHTMLStaticElementA) //-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK (verifier avec GSWSession appendToR - GSWRequest* _request=[context_ request]; - BOOL _isFromClientComponent=[_request isFromClientComponent]; //bis repetitam - NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ self=%p",[self class],[context_ elementID],self); - GSWSaveAppendToResponseElementID(context_);//Debug Only - if ([elementsMap length]>0) - { - [self appendToResponse:response_ - inContext:context_ - elementsFromIndex:0 - toIndex:[elementsMap length]-1]; - }; - NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@ self=%p",[self class],[context_ elementID],self); + GSWRequest* request=[context request]; + BOOL isFromClientComponent=[request isFromClientComponent]; //bis repetitam + NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ self=%p", + [self class],[context elementID],self); + GSWSaveAppendToResponseElementID(context);//Debug Only + if ([_elementsMap length]>0) + { + [self appendToResponse:response + inContext:context + elementsFromIndex:0 + toIndex:[_elementsMap length]-1]; + }; + NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@ self=%p", + [self class],[context elementID],self); }; //-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ - elementsFromIndex:(unsigned int)_fromIndex - toIndex:(unsigned int)_toIndex +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context + elementsFromIndex:(unsigned int)fromIndex + toIndex:(unsigned int)toIndex { //OK - NSStringEncoding _encoding=[response_ contentEncoding]; - NSArray* _dynamicChildren=[self dynamicChildren];//call dynamicChildren //GSWTextField: nil + NSStringEncoding encoding=[response contentEncoding]; + NSArray* aDynamicChildrensArray=[self dynamicChildren];//call dynamicChildren //GSWTextField: nil int elementN=0; - const BYTE* elements=[elementsMap bytes]; + const BYTE* elements=[_elementsMap bytes]; BYTE element=0; int elementsN[3]={0,0,0}; - NSAssert2(_fromIndex<[elementsMap length],@"_fromIndex out of range:%u (length=%d)",_fromIndex,[elementsMap length]); - NSAssert2(_toIndex<[elementsMap length],@"_toIndex out of range:%u (length=%d)",_toIndex,[elementsMap length]); - NSAssert2(_fromIndex<=_toIndex,@"_fromIndex>_toIndex %u %u ",_fromIndex,_toIndex); - for(elementN=0;elementN<=_toIndex;elementN++) - { - element=(BYTE)elements[elementN]; - if (element==ElementsMap_htmlBareString) - { - NSDebugMLLog(@"gswdync",@"%d:htmlBareString : %@",elementN,[htmlBareStrings objectAtIndex:elementsN[0]]); - if (elementN>=_fromIndex) - [response_ appendContentData:[[htmlBareStrings objectAtIndex:elementsN[0]] - dataUsingEncoding:_encoding]]; - elementsN[0]++; - } - else if (element==ElementsMap_dynamicElement) - { - if (elementN>=_fromIndex) - { - NSDebugMLLog(@"gswdync",@"%d:dynamicElement : %@",elementN,[_dynamicChildren objectAtIndex:elementsN[1]]); - NSDebugMLLog(@"gswdync",@"ET=%@ id=%@", - [[_dynamicChildren objectAtIndex:elementsN[1]] class], - [context_ elementID]); - [[_dynamicChildren objectAtIndex:elementsN[1]] appendToResponse:response_ - inContext:context_]; - [context_ incrementLastElementIDComponent]; - }; - elementsN[1]++; - } - else if (element==ElementsMap_attributeElement) - { - //TODO - NSDebugMLLog(@"gswdync",@"%d:attributeElement",elementN); - elementsN[2]++; - }; - }; -}; - -//-------------------------------------------------------------------- --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ -{ - //OK - GSWElement* _element=nil; - int elementN=0; - NSArray* _dynamicChildren=[self dynamicChildren]; - const BYTE* elements=[elementsMap bytes]; - BYTE element=0; - int elementsN[3]={0,0,0}; - BOOL searchIsOver=NO; - NSString* _senderID=nil; - NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@",[self class],[context_ elementID],[context_ senderID]); - GSWAssertCorrectElementID(context_);// Debug Only - _senderID=[context_ senderID]; - for(elementN=0;!_element && !searchIsOver && elementN<[elementsMap length];elementN++) + NSAssert2(fromIndex<[_elementsMap length],@"fromIndex out of range:%u (length=%d)", + fromIndex,[_elementsMap length]); + NSAssert2(toIndex<[_elementsMap length],@"toIndex out of range:%u (length=%d)", + toIndex,[_elementsMap length]); + NSAssert2(fromIndex<=toIndex,@"fromIndex>toIndex %u %u ", + fromIndex,toIndex); + for(elementN=0;elementN<=toIndex;elementN++) { element=(BYTE)elements[elementN]; if (element==ElementsMap_htmlBareString) - elementsN[0]++; + { + NSDebugMLLog(@"gswdync",@"%d:htmlBareString : %@", + elementN,[_htmlBareStrings objectAtIndex:elementsN[0]]); + if (elementN>=fromIndex) + [response appendContentData:[[_htmlBareStrings objectAtIndex:elementsN[0]] + dataUsingEncoding:encoding]]; + elementsN[0]++; + } else if (element==ElementsMap_dynamicElement) { - NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[[_dynamicChildren objectAtIndex:elementsN[1]] class],[context_ elementID]); - _element=[[_dynamicChildren objectAtIndex:elementsN[1]] invokeActionForRequest:request_ - inContext:context_]; -// if (![context_ _wasFormSubmitted] && [[context_ elementID] compare:_senderID]==NSOrderedDescending) - if (![context_ _wasFormSubmitted] && [[context_ elementID] isSearchOverForSenderID:_senderID]) + if (elementN>=fromIndex) { - NSDebugMLLog(@"gswdync",@"id=%@ senderid=%@ => search is over", - [context_ elementID], - _senderID); - searchIsOver=YES; + NSDebugMLLog(@"gswdync",@"%d:dynamicElement : %@", + elementN,[aDynamicChildrensArray objectAtIndex:elementsN[1]]); + NSDebugMLLog(@"gswdync",@"ET=%@ id=%@", + [[aDynamicChildrensArray objectAtIndex:elementsN[1]] class], + [context elementID]); + [[aDynamicChildrensArray objectAtIndex:elementsN[1]] appendToResponse:response + inContext:context]; + [context incrementLastElementIDComponent]; }; - [context_ incrementLastElementIDComponent]; elementsN[1]++; } else if (element==ElementsMap_attributeElement) { + //TODO + NSDebugMLLog(@"gswdync",@"%d:attributeElement",elementN); elementsN[2]++; }; }; - NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]); - return _element; }; //-------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(GSWElement*)invokeActionForRequest:(GSWRequest*)request + inContext:(GSWContext*)context +{ + //OK + GSWElement* element=nil; + int elementN=0; + NSArray* aDynamicChildrensArray=[self dynamicChildren]; + const BYTE* elements=[_elementsMap bytes]; + BYTE elementIndic=0; + int elementsN[3]={0,0,0}; + BOOL searchIsOver=NO; + NSString* senderID=nil; + NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@", + [self class],[context elementID],[context senderID]); + GSWAssertCorrectElementID(context);// Debug Only + senderID=[context senderID]; + for(elementN=0;!element && !searchIsOver && elementN<[_elementsMap length];elementN++) + { + elementIndic=(BYTE)elements[elementN]; + if (elementIndic==ElementsMap_htmlBareString) + elementsN[0]++; + else if (elementIndic==ElementsMap_dynamicElement) + { + NSDebugMLLog(@"gswdync",@"ET=%@ id=%@", + [[aDynamicChildrensArray objectAtIndex:elementsN[1]] class], + [context elementID]); + element=[[aDynamicChildrensArray objectAtIndex:elementsN[1]] invokeActionForRequest:request + inContext:context]; + //if (![context_ _wasFormSubmitted] && [[context_ elementID] compare:_senderID]==NSOrderedDescending) + if (![context _wasFormSubmitted] && [[context elementID] isSearchOverForSenderID:senderID]) + { + NSDebugMLLog(@"gswdync",@"id=%@ senderid=%@ => search is over", + [context elementID], + senderID); + searchIsOver=YES; + }; + [context incrementLastElementIDComponent]; + elementsN[1]++; + } + else if (elementIndic==ElementsMap_attributeElement) + { + elementsN[2]++; + }; + }; + NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context elementID]); + return element; +}; + +//-------------------------------------------------------------------- +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK int elementN=0; - NSArray* _dynamicChildren=[self dynamicChildren]; - const BYTE* elements=[elementsMap bytes]; - BYTE element=0; + NSArray* aDynamicChildrensArray=[self dynamicChildren]; + const BYTE* elements=[_elementsMap bytes]; + BYTE elementIndic=0; int elementsN[3]={0,0,0}; LOGObjectFnStart(); - NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context_ elementID]); - GSWAssertCorrectElementID(context_);// Debug Only - for(elementN=0;elementN<[elementsMap length];elementN++) - { - NSDebugMLLog(@"gswdync",@"elementN=%d",elementN); - element=(BYTE)elements[elementN]; - NSDebugMLLog(@"gswdync",@"element=%x",(unsigned int)element); - if (element==ElementsMap_htmlBareString) - elementsN[0]++; - else if (element==ElementsMap_dynamicElement) - { - NSDebugMLLog(@"gswdync",@"\n[_dynamicChildren objectAtIndex:elementsN[1]=%@",[_dynamicChildren objectAtIndex:elementsN[1]]); - NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[[_dynamicChildren objectAtIndex:elementsN[1]] class],[context_ elementID]); - [[_dynamicChildren objectAtIndex:elementsN[1]] takeValuesFromRequest:request_ - inContext:context_]; - [context_ incrementLastElementIDComponent]; - elementsN[1]++; - } - else if (element==ElementsMap_attributeElement) - { - elementsN[2]++; - }; - }; - NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]); + NSDebugMLLog(@"gswdync",@"ET=%@ id=%@", + [self class],[context elementID]); + GSWAssertCorrectElementID(context);// Debug Only + for(elementN=0;elementN<[_elementsMap length];elementN++) + { + NSDebugMLLog(@"gswdync",@"elementN=%d",elementN); + elementIndic=(BYTE)elements[elementN]; + NSDebugMLLog(@"gswdync",@"element=%x",(unsigned int)elementIndic); + if (elementIndic==ElementsMap_htmlBareString) + elementsN[0]++; + else if (elementIndic==ElementsMap_dynamicElement) + { + NSDebugMLLog(@"gswdync",@"\n[aDynamicChildrensArray objectAtIndex:elementsN[1]=%@", + [aDynamicChildrensArray objectAtIndex:elementsN[1]]); + NSDebugMLLog(@"gswdync",@"ET=%@ id=%@", + [[aDynamicChildrensArray objectAtIndex:elementsN[1]] class], + [context elementID]); + [[aDynamicChildrensArray objectAtIndex:elementsN[1]] takeValuesFromRequest:request + inContext:context]; + [context incrementLastElementIDComponent]; + elementsN[1]++; + } + else if (elementIndic==ElementsMap_attributeElement) + { + elementsN[2]++; + }; + }; + NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@", + [self class],[context elementID]); LOGObjectFnStop(); }; @@ -449,16 +471,16 @@ static char rcsId[] = "$Id$"; }; //-------------------------------------------------------------------- --(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping +-(BOOL)appendStringAtRight:(id)unkwnon + withMapping:(char*)mapping { LOGObjectFnNotImplemented(); //TODOFN return NO; }; //-------------------------------------------------------------------- --(BOOL)appendStringAtLeft:(id)_unkwnon - withMapping:(char*)_mapping +-(BOOL)appendStringAtLeft:(id)unkwnon + withMapping:(char*)mapping { LOGObjectFnNotImplemented(); //TODOFN return NO; @@ -484,14 +506,14 @@ static char rcsId[] = "$Id$"; }; //-------------------------------------------------------------------- -+(void)addURLAttribute:(id)_attribute - forElementNamed:(NSString*)_name ++(void)addURLAttribute:(id)attribute + forElementNamed:(NSString*)name { LOGClassFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- -+(id)urlsForElementNamed:(NSString*)_name ++(id)urlsForElementNamed:(NSString*)name { LOGClassFnNotImplemented(); //TODOFN return nil; @@ -503,23 +525,23 @@ static char rcsId[] = "$Id$"; @implementation GSWHTMLStaticElement (GSWHTMLStaticElementD) //-------------------------------------------------------------------- -+(NSDictionary*)attributeDictionaryForString:(NSString*)string_ ++(NSDictionary*)attributeDictionaryForString:(NSString*)string { LOGClassFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- -+(NSString*)stringForAttributeDictionary:(NSDictionary*)attributeDictionary_ ++(NSString*)stringForAttributeDictionary:(NSDictionary*)attributeDictionary { LOGClassFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- -+(GSWElement*)elementWithName:(NSString*)name_ - attributeString:(NSString*)attributeString_ - contentElements:(NSArray*)elements_ ++(GSWElement*)elementWithName:(NSString*)name + attributeString:(NSString*)attributeString + contentElements:(NSArray*)elements { LOGClassFnNotImplemented(); //TODOFN return nil; @@ -531,22 +553,22 @@ static char rcsId[] = "$Id$"; @implementation GSWHTMLStaticElement (GSWHTMLStaticElementE) //-------------------------------------------------------------------- -+(GSWElement*)elementWithName:(NSString*)name_ - attributeDictionary:(NSDictionary*)attributeDictionary_ - contentElements:(NSArray*)elements_ ++(GSWElement*)elementWithName:(NSString*)name + attributeDictionary:(NSDictionary*)attributeDictionary + contentElements:(NSArray*)elements { LOGClassFnNotImplemented(); //TODOFN return nil; }; -+(Class)_elementClassForName:(NSString*)name_ ++(Class)_elementClassForName:(NSString*)name { LOGClassFnNotImplemented(); //TODOFN return nil; }; -+(void)setElementClass:(Class)class_ - forName:(NSString*)name_ ++(void)setElementClass:(Class)class + forName:(NSString*)name { LOGClassFnNotImplemented(); //TODOFN }; diff --git a/GSWeb.framework/GSWHTMLStaticGroup.h b/GSWeb.framework/GSWHTMLStaticGroup.h index 24feb07..327b904 100644 --- a/GSWeb.framework/GSWHTMLStaticGroup.h +++ b/GSWeb.framework/GSWHTMLStaticGroup.h @@ -1,11 +1,16 @@ -/* GSWHTMLStaticGroup.h - GSWeb: Class GSWHTMLStaticGroup - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWHTMLStaticGroup.h - GSWeb: Class GSWHTMLStaticGroup + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -31,11 +37,11 @@ { NSString* _documentTypeString; } --(id)initWithContentElements:(NSArray*)elements_; --(void)setDocumentTypeString:(NSString *)documentType_; +-(id)initWithContentElements:(NSArray*)elements; +-(void)setDocumentTypeString:(NSString *)documentType; --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; -(void)dealloc; @end diff --git a/GSWeb.framework/GSWHTMLStaticGroup.m b/GSWeb.framework/GSWHTMLStaticGroup.m index bda9559..88e3f0e 100644 --- a/GSWeb.framework/GSWHTMLStaticGroup.m +++ b/GSWeb.framework/GSWHTMLStaticGroup.m @@ -1,11 +1,16 @@ -/* GSWHTMLStaticGroup.m - GSWeb: Class GSWHTMLStaticGroup - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWHTMLStaticGroup.m - GSWeb: Class GSWHTMLStaticGroup + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -27,54 +33,49 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWHTMLStaticGroup --(id)initWithContentElements:(NSArray*)elements_ +-(id)initWithContentElements:(NSArray*)elements { //OK LOGObjectFnStart(); - NSDebugMLLog(@"gswdync",@"elements_:%@",elements_); - if ([elements_ count]==1 && [[elements_ objectAtIndex:0] class]==[GSWHTMLStaticGroup class]) - self=[super initWithName:nil - attributeDictionary:nil - contentElements:[[elements_ objectAtIndex:0]dynamicChildren]]; + NSDebugMLLog(@"gswdync",@"elements:%@",elements); + if ([elements count]==1 && [[elements objectAtIndex:0] class]==[GSWHTMLStaticGroup class]) + self=[super initWithName:nil + attributeDictionary:nil + contentElements:[[elements objectAtIndex:0]dynamicChildren]]; else - self=[super initWithName:nil - attributeDictionary:nil - contentElements:elements_]; + self=[super initWithName:nil + attributeDictionary:nil + contentElements:elements]; LOGObjectFnStop(); return self; }; -//-------------------------------------------------------------------- --(void)setDocumentTypeString:(NSString *)documentType_ -{ - [_documentTypeString release]; - _documentTypeString = [documentType_ retain]; -} - -//-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ -{ - if (_documentTypeString) - { - NSStringEncoding _encoding=[response_ contentEncoding]; - - NSDebugMLLog(@"gswdync",@"added _documentTypeString = %@", _documentTypeString); - - [response_ appendContentData:[_documentTypeString - dataUsingEncoding:_encoding]]; - }; - - [super appendToResponse:response_ inContext:context_]; -}; - //-------------------------------------------------------------------- -(void)dealloc { - [_documentTypeString release]; - - [super dealloc]; + DESTROY(_documentTypeString); + [super dealloc]; } +//-------------------------------------------------------------------- +-(void)setDocumentTypeString:(NSString *)documentType +{ + ASSIGN(_documentTypeString,documentType); +} + +//-------------------------------------------------------------------- +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context +{ + if (_documentTypeString) + { + NSStringEncoding encoding=[response contentEncoding]; + NSDebugMLLog(@"gswdync",@"added documentTypeString = %@",_documentTypeString); + [response appendContentData:[_documentTypeString dataUsingEncoding:encoding]]; + }; + + [super appendToResponse:response + inContext:context]; +}; @end diff --git a/GSWeb.framework/GSWHiddenField.h b/GSWeb.framework/GSWHiddenField.h index 0f12f1a..9bb7ce4 100644 --- a/GSWeb.framework/GSWHiddenField.h +++ b/GSWeb.framework/GSWHiddenField.h @@ -1,11 +1,16 @@ -/* GSWHiddenField.h - GSWeb: Class GSWHiddenField - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWHiddenField.h - GSWeb: Class GSWHiddenField + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,9 +35,9 @@ //OK //==================================================================== @interface GSWHiddenField: GSWInput --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; @end diff --git a/GSWeb.framework/GSWHiddenField.m b/GSWeb.framework/GSWHiddenField.m index 273d91b..eda0752 100644 --- a/GSWeb.framework/GSWHiddenField.m +++ b/GSWeb.framework/GSWHiddenField.m @@ -1,11 +1,16 @@ -/* GSWHiddenField.m - GSWeb: Class GSWHiddenField - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWHiddenField.m - GSWeb: Class GSWHiddenField + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -27,20 +33,21 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWHiddenField --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { - NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; + NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations]; LOGObjectFnStartC("GSWHiddenField"); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,elements_); - [_associations setObject:[GSWAssociation associationWithValue:@"hidden"] - forKey:@"type"]; - if ((self=[super initWithName:name_ - associations:_associations - contentElements:nil])) //No Childs! - { - }; + NSDebugMLLog(@"gswdync",@"name=%@ associations:%@ elements=%@", + aName,associations,elements); + [tmpAssociations setObject:[GSWAssociation associationWithValue:@"hidden"] + forKey:@"type"]; + if ((self=[super initWithName:aName + associations:tmpAssociations + contentElements:nil])) //No Childs! + { + }; LOGObjectFnStopC("GSWHiddenField"); return self; }; diff --git a/GSWeb.framework/GSWHyperlink.h b/GSWeb.framework/GSWHyperlink.h index 0af982e..7814798 100644 --- a/GSWeb.framework/GSWHyperlink.h +++ b/GSWeb.framework/GSWHyperlink.h @@ -1,11 +1,16 @@ -/* GSWHyperlink.h - GSWeb: Class GSWHyperlink - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWHyperlink.h - GSWeb: Class GSWHyperlink + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,55 +35,55 @@ @interface GSWHyperlink: GSWDynamicElement { - GSWAssociation* action; - GSWAssociation* string; - GSWAssociation* pageName; - GSWAssociation* href; - GSWAssociation* disabled; - GSWAssociation* fragmentIdentifier; - GSWAssociation* queryDictionary; - GSWAssociation* actionClass; - GSWAssociation* directActionName; + GSWAssociation* _action; + GSWAssociation* _string; + GSWAssociation* _pageName; + GSWAssociation* _href; + GSWAssociation* _disabled; + GSWAssociation* _fragmentIdentifier; + GSWAssociation* _queryDictionary; + GSWAssociation* _actionClass; + GSWAssociation* _directActionName; //GSWeb Additions { - GSWAssociation* enabled; - GSWAssociation* displayDisabled; - GSWAssociation* redirectURL; - NSDictionary* pageSetVarAssociations; - GSWAssociation* pageSetVarAssociationsDynamic; + GSWAssociation* _enabled; + GSWAssociation* _displayDisabled; + GSWAssociation* _redirectURL; + NSDictionary* _pageSetVarAssociations; + GSWAssociation* _pageSetVarAssociationsDynamic; // } - NSDictionary* otherQueryAssociations; - NSDictionary* otherAssociations; + NSDictionary* _otherQueryAssociations; + NSDictionary* _otherAssociations; //GSWeb Additions { - GSWAssociation* filename; - GSWAssociation* framework; - GSWAssociation* data; - GSWAssociation* mimeType; - GSWAssociation* key; + GSWAssociation* _filename; + GSWAssociation* _framework; + GSWAssociation* _data; + GSWAssociation* _mimeType; + GSWAssociation* _key; // } - GSWElement* children; + GSWElement* _children; }; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)templateElement_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + template:(GSWElement*)templateElement; -(void)dealloc; -(NSString*)description; @end @interface GSWHyperlink (GSWHyperlinkA) --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; #if !GSWEB_STRICT --(NSString*)frameworkNameInContext:(GSWContext*)context_; +-(NSString*)frameworkNameInContext:(GSWContext*)context; #endif --(void)_appendCGIActionURLToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(id)computeActionStringInContext:(GSWContext*)context_; --(void)_appendQueryStringToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(NSDictionary*)computeQueryDictionaryInContext:(GSWContext*)context_; --(NSString*)hrefInContext:(GSWContext*)context_; //NDFN +-(void)_appendCGIActionURLToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; +-(id)computeActionStringInContext:(GSWContext*)context; +-(void)_appendQueryStringToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; +-(NSDictionary*)computeQueryDictionaryInContext:(GSWContext*)context; +-(NSString*)hrefInContext:(GSWContext*)context; //NDFN @end diff --git a/GSWeb.framework/GSWHyperlink.m b/GSWeb.framework/GSWHyperlink.m index aedb126..86ec6f7 100644 --- a/GSWeb.framework/GSWHyperlink.m +++ b/GSWeb.framework/GSWHyperlink.m @@ -1,11 +1,16 @@ -/* GSWHyperlink.m - GSWeb: Class GSWHyperlink - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWHyperlink.m - GSWeb: Class GSWHyperlink + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,136 +35,136 @@ static char rcsId[] = "$Id$"; @implementation GSWHyperlink //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)templateElement +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)anAssociationsDict + template:(GSWElement*)templateElement { //OK - NSMutableDictionary* _otherAssociations=nil; + NSMutableDictionary* tmpOtherAssociations=nil; LOGObjectFnStart(); - ASSIGN(children,templateElement); - action = [[associations_ objectForKey:action__Key - withDefaultObject:[action autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"action=%@",action); + ASSIGN(_children,templateElement); + _action = [[anAssociationsDict objectForKey:action__Key + withDefaultObject:[_action autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"action=%@",_action); - string = [[associations_ objectForKey:string__Key - withDefaultObject:[string autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"string=%@",string); + _string = [[anAssociationsDict objectForKey:string__Key + withDefaultObject:[_string autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"string=%@",_string); - pageName = [[associations_ objectForKey:pageName__Key - withDefaultObject:[pageName autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"pageName=%@",pageName); + _pageName = [[anAssociationsDict objectForKey:pageName__Key + withDefaultObject:[_pageName autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"pageName=%@",_pageName); - href = [[associations_ objectForKey:href__Key - withDefaultObject:[href autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"href=%@",href); + _href = [[anAssociationsDict objectForKey:href__Key + withDefaultObject:[_href autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"href=%@",_href); - disabled = [[associations_ objectForKey:disabled__Key - withDefaultObject:[disabled autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"disabled=%@",disabled); + _disabled = [[anAssociationsDict objectForKey:disabled__Key + withDefaultObject:[_disabled autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"disabled=%@",_disabled); - fragmentIdentifier = [[associations_ objectForKey:fragmentIdentifier__Key - withDefaultObject:[fragmentIdentifier autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"fragmentIdentifier=%@",fragmentIdentifier); + _fragmentIdentifier = [[anAssociationsDict objectForKey:fragmentIdentifier__Key + withDefaultObject:[_fragmentIdentifier autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"fragmentIdentifier=%@",_fragmentIdentifier); - queryDictionary = [[associations_ objectForKey:queryDictionary__Key - withDefaultObject:[queryDictionary autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"queryDictionary=%@",queryDictionary); + _queryDictionary = [[anAssociationsDict objectForKey:queryDictionary__Key + withDefaultObject:[_queryDictionary autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"queryDictionary=%@",_queryDictionary); - actionClass = [[associations_ objectForKey:actionClass__Key - withDefaultObject:[actionClass autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"actionClass=%@",actionClass); + _actionClass = [[anAssociationsDict objectForKey:actionClass__Key + withDefaultObject:[_actionClass autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"actionClass=%@",_actionClass); - directActionName = [[associations_ objectForKey:directActionName__Key - withDefaultObject:[directActionName autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"directActionName=%@",directActionName); + _directActionName = [[anAssociationsDict objectForKey:directActionName__Key + withDefaultObject:[_directActionName autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"directActionName=%@",_directActionName); if (!WOStrictFlag) { - enabled = [[associations_ objectForKey:enabled__Key - withDefaultObject:[enabled autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"enabled=%@",enabled); - if (disabled && enabled) + _enabled = [[anAssociationsDict objectForKey:enabled__Key + withDefaultObject:[_enabled autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"enabled=%@",_enabled); + if (_disabled && _enabled) { ExceptionRaise(@"GSWHyperlink",@"You can't specify 'disabled' and 'enabled' together. componentAssociations:%@", - associations_); + anAssociationsDict); }; - displayDisabled = [[associations_ objectForKey:displayDisabled__Key - withDefaultObject:[displayDisabled autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"displayDisabled=%@",displayDisabled); + _displayDisabled = [[anAssociationsDict objectForKey:displayDisabled__Key + withDefaultObject:[_displayDisabled autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"displayDisabled=%@",_displayDisabled); - redirectURL = [[associations_ objectForKey:redirectURL__Key - withDefaultObject:[redirectURL autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"redirectURL=%@",redirectURL); + _redirectURL = [[anAssociationsDict objectForKey:redirectURL__Key + withDefaultObject:[_redirectURL autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"redirectURL=%@",_redirectURL); - filename = [[associations_ objectForKey:filename__Key - withDefaultObject:[filename autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"filename=%@",filename); + _filename = [[anAssociationsDict objectForKey:filename__Key + withDefaultObject:[_filename autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"filename=%@",_filename); - framework = [[associations_ objectForKey:framework__Key - withDefaultObject:[framework autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"framework=%@",framework); + _framework = [[anAssociationsDict objectForKey:framework__Key + withDefaultObject:[_framework autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"framework=%@",_framework); - data = [[associations_ objectForKey:data__Key - withDefaultObject:[data autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"data=%@",data); + _data = [[anAssociationsDict objectForKey:data__Key + withDefaultObject:[_data autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"data=%@",_data); - mimeType = [[associations_ objectForKey:mimeType__Key - withDefaultObject:[mimeType autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"mimeType=%@",mimeType); + _mimeType = [[anAssociationsDict objectForKey:mimeType__Key + withDefaultObject:[_mimeType autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"mimeType=%@",_mimeType); - key = [[associations_ objectForKey:key__Key - withDefaultObject:[key autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"key=%@",key); + _key = [[anAssociationsDict objectForKey:key__Key + withDefaultObject:[_key autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"key=%@",_key); }; - _otherAssociations=[NSMutableDictionary dictionaryWithDictionary:associations_]; - [_otherAssociations removeObjectForKey:action__Key]; - [_otherAssociations removeObjectForKey:string__Key]; - [_otherAssociations removeObjectForKey:pageName__Key]; - [_otherAssociations removeObjectForKey:href__Key]; - [_otherAssociations removeObjectForKey:disabled__Key]; - [_otherAssociations removeObjectForKey:fragmentIdentifier__Key]; - [_otherAssociations removeObjectForKey:queryDictionary__Key]; - [_otherAssociations removeObjectForKey:actionClass__Key]; - [_otherAssociations removeObjectForKey:directActionName__Key]; + tmpOtherAssociations=[NSMutableDictionary dictionaryWithDictionary:anAssociationsDict]; + [tmpOtherAssociations removeObjectForKey:action__Key]; + [tmpOtherAssociations removeObjectForKey:string__Key]; + [tmpOtherAssociations removeObjectForKey:pageName__Key]; + [tmpOtherAssociations removeObjectForKey:href__Key]; + [tmpOtherAssociations removeObjectForKey:disabled__Key]; + [tmpOtherAssociations removeObjectForKey:fragmentIdentifier__Key]; + [tmpOtherAssociations removeObjectForKey:queryDictionary__Key]; + [tmpOtherAssociations removeObjectForKey:actionClass__Key]; + [tmpOtherAssociations removeObjectForKey:directActionName__Key]; if (!WOStrictFlag) { - [_otherAssociations removeObjectForKey:enabled__Key]; - [_otherAssociations removeObjectForKey:redirectURL__Key]; + [tmpOtherAssociations removeObjectForKey:enabled__Key]; + [tmpOtherAssociations removeObjectForKey:redirectURL__Key]; - [_otherAssociations removeObjectForKey:filename__Key]; - [_otherAssociations removeObjectForKey:framework__Key]; - [_otherAssociations removeObjectForKey:data__Key]; - [_otherAssociations removeObjectForKey:mimeType__Key]; - [_otherAssociations removeObjectForKey:key__Key]; + [tmpOtherAssociations removeObjectForKey:filename__Key]; + [tmpOtherAssociations removeObjectForKey:framework__Key]; + [tmpOtherAssociations removeObjectForKey:data__Key]; + [tmpOtherAssociations removeObjectForKey:mimeType__Key]; + [tmpOtherAssociations removeObjectForKey:key__Key]; }; if (!WOStrictFlag) //pageSetVarAssociations//GNUstepWeb only { - NSDictionary* _pageSetVarAssociations=[associations_ associationsWithoutPrefix:pageSetVar__Prefix__Key - removeFrom:_otherAssociations]; - if ([_pageSetVarAssociations count]>0) - pageSetVarAssociations=[_pageSetVarAssociations retain]; + NSDictionary* tmpPageSetVarAssociations=[anAssociationsDict associationsWithoutPrefix:pageSetVar__Prefix__Key + removeFrom:tmpOtherAssociations]; + if ([tmpPageSetVarAssociations count]>0) + _pageSetVarAssociations=[tmpPageSetVarAssociations retain]; - pageSetVarAssociationsDynamic=[[associations_ objectForKey:pageSetVars__Key - withDefaultObject:[pageSetVarAssociationsDynamic autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"pageSetVarAssociationsDynamic=%@",pageSetVarAssociationsDynamic); - [_otherAssociations removeObjectForKey:pageSetVars__Key]; + _pageSetVarAssociationsDynamic=[[anAssociationsDict objectForKey:pageSetVars__Key + withDefaultObject:[_pageSetVarAssociationsDynamic autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"pageSetVarAssociationsDynamic=%@",_pageSetVarAssociationsDynamic); + [tmpOtherAssociations removeObjectForKey:pageSetVars__Key]; }; - if ([_otherAssociations count]>0) - otherAssociations=[[NSDictionary dictionaryWithDictionary:_otherAssociations] retain]; + if ([tmpOtherAssociations count]>0) + _otherAssociations=[[NSDictionary dictionaryWithDictionary:tmpOtherAssociations] retain]; //TODO NSDictionary* otherQueryAssociations; - if ((self=[super initWithName:name_ - associations:nil - template:nil])) - { - }; + if ((self=[super initWithName:aName + associations:nil + template:nil])) + { + }; LOGObjectFnStop(); return self; }; @@ -166,28 +172,28 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(action); - DESTROY(string); - DESTROY(pageName); - DESTROY(href); - DESTROY(disabled); - DESTROY(fragmentIdentifier); - DESTROY(queryDictionary); - DESTROY(actionClass); - DESTROY(directActionName); - DESTROY(enabled);//GSWeb Only - DESTROY(displayDisabled); - DESTROY(redirectURL); - DESTROY(pageSetVarAssociations);//GNUstepWeb only - DESTROY(pageSetVarAssociationsDynamic); - DESTROY(otherQueryAssociations); - DESTROY(otherAssociations); - DESTROY(filename); - DESTROY(framework); - DESTROY(data); - DESTROY(mimeType); - DESTROY(key); - DESTROY(children); + DESTROY(_action); + DESTROY(_string); + DESTROY(_pageName); + DESTROY(_href); + DESTROY(_disabled); + DESTROY(_fragmentIdentifier); + DESTROY(_queryDictionary); + DESTROY(_actionClass); + DESTROY(_directActionName); + DESTROY(_enabled);//GSWeb Only + DESTROY(_displayDisabled); + DESTROY(_redirectURL); + DESTROY(_pageSetVarAssociations);//GNUstepWeb only + DESTROY(_pageSetVarAssociationsDynamic); + DESTROY(_otherQueryAssociations); + DESTROY(_otherAssociations); + DESTROY(_filename); + DESTROY(_framework); + DESTROY(_data); + DESTROY(_mimeType); + DESTROY(_key); + DESTROY(_children); [super dealloc]; } @@ -195,8 +201,8 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p>", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; @end @@ -205,456 +211,458 @@ static char rcsId[] = "$Id$"; @implementation GSWHyperlink (GSWHyperlinkA) //-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK (pageName/action/directActionName) - GSWComponent* _component=[context_ component]; - BOOL _disabled=NO; - BOOL _displayDisabled=YES; + GSWComponent* component=[context component]; + BOOL disabledValue=NO; + BOOL displayDisabledValue=YES; #ifndef NDEBBUG - int elementsNb=[(GSWElementIDString*)[context_ elementID]elementsNb]; + int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb]; #endif LOGObjectFnStart(); - NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context_ elementID]); - GSWSaveAppendToResponseElementID(context_);//Debug Only - if (disabled) - _disabled=[self evaluateCondition:disabled - inContext:context_]; - else if (enabled) - _disabled=![self evaluateCondition:enabled - inContext:context_]; + NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context elementID]); + GSWSaveAppendToResponseElementID(context);//Debug Only + if (_disabled) + disabledValue=[self evaluateCondition:_disabled + inContext:context]; + else if (_enabled) + disabledValue=![self evaluateCondition:_enabled + inContext:context]; - if (!WOStrictFlag && disabled && displayDisabled) - { - _displayDisabled=[self evaluateCondition:displayDisabled - inContext:context_]; - }; - if (!_disabled) - { - [response_ _appendContentAsciiString:@"']; - }; - if (!_disabled || _displayDisabled) - { - if (string) - { - id _stringValue=nil; - NSDebugMLLog(@"gswdync",@"string=%@",string); - _stringValue=[string valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"_stringValue=%@",_stringValue); - if (_stringValue) - [response_ appendContentHTMLString:_stringValue]; - }; - if (children) - { - [context_ appendZeroElementIDComponent]; - [children appendToResponse:response_ - inContext:context_]; - [context_ deleteLastElementIDComponent]; - }; - }; - if (!_disabled)//?? - { - [response_ _appendContentAsciiString:@""]; - }; - NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]); + if (!WOStrictFlag && _disabled && _displayDisabled) + { + displayDisabledValue=[self evaluateCondition:_displayDisabled + inContext:context]; + }; + if (!disabledValue) + { + [response _appendContentAsciiString:@"']; + }; + if (!disabledValue || displayDisabledValue) + { + if (_string) + { + id stringValue=nil; + NSDebugMLLog(@"gswdync",@"string=%@",_string); + stringValue=[_string valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"stringValue=%@",stringValue); + if (stringValue) + [response appendContentHTMLString:stringValue]; + }; + if (_children) + { + [context appendZeroElementIDComponent]; + [_children appendToResponse:response + inContext:context]; + [context deleteLastElementIDComponent]; + }; + }; + if (!disabledValue)//?? + { + [response _appendContentAsciiString:@""]; + }; + NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context elementID]); #ifndef NDEBBUG - NSAssert(elementsNb==[(GSWElementIDString*)[context_ elementID]elementsNb],@"GSWHyperlink appendToResponse: bad elementID"); + NSAssert(elementsNb==[(GSWElementIDString*)[context elementID]elementsNb],@"GSWHyperlink appendToResponse: bad elementID"); #endif LOGObjectFnStop(); }; //GSWeb Addintions { //-------------------------------------------------------------------- --(NSString*)frameworkNameInContext:(GSWContext*)context_ +-(NSString*)frameworkNameInContext:(GSWContext*)context { //OK - NSString* _frameworkName=nil; - GSWComponent* _component=[context_ component]; - NSDebugMLog(@"framework=%@",framework); - if (framework) - _frameworkName=[framework valueInComponent:_component]; + NSString* frameworkName=nil; + GSWComponent* component=[context component]; + NSDebugMLog(@"framework=%@",_framework); + if (_framework) + frameworkName=[_framework valueInComponent:component]; else - _frameworkName=[_component frameworkName]; - return _frameworkName; + frameworkName=[component frameworkName]; + return frameworkName; }; // } //-------------------------------------------------------------------- --(void)_appendCGIActionURLToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)_appendCGIActionURLToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - NSString* _actionString=nil; - NSDictionary* _queryDictionary=nil; - NSString* _url=nil; + NSString* actionString=nil; + NSDictionary* queryDictionary=nil; + NSString* anUrl=nil; LOGObjectFnStart(); - _actionString=[self computeActionStringInContext:context_]; - NSDebugMLLog(@"gswdync",@"_actionString=%@",_actionString); - _queryDictionary=[self computeQueryDictionaryInContext:context_]; - NSDebugMLLog(@"gswdync",@"_queryDictionary=%@",_queryDictionary); - _url=(NSString*)[context_ directActionURLForActionNamed:_actionString - queryDictionary:_queryDictionary]; - NSDebugMLLog(@"gswdync",@"_url=%@",_url); - [response_ appendContentString:_url]; + actionString=[self computeActionStringInContext:context]; + NSDebugMLLog(@"gswdync",@"actionString=%@",actionString); + queryDictionary=[self computeQueryDictionaryInContext:context]; + NSDebugMLLog(@"gswdync",@"queryDictionary=%@",queryDictionary); + anUrl=(NSString*)[context directActionURLForActionNamed:actionString + queryDictionary:queryDictionary]; + NSDebugMLLog(@"gswdync",@"anUrl=%@",anUrl); + [response appendContentString:anUrl]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(id)computeActionStringInContext:(GSWContext*)context_ +-(id)computeActionStringInContext:(GSWContext*)context { //OK - GSWComponent* _component=nil; - id _directActionString=nil; - id _directActionName=nil; - id _actionClass=nil; + GSWComponent* component=nil; + id tmpDirectActionString=nil; + id directActionNameValue=nil; + id actionClassValue=nil; LOGObjectFnStart(); - _component=[context_ component]; - if (directActionName) - _directActionName=[directActionName valueInComponent:_component]; - if (actionClass) - _actionClass=[actionClass valueInComponent:_component]; - + component=[context component]; + if (_directActionName) + directActionNameValue=[_directActionName valueInComponent:component]; if (_actionClass) - { - if (_directActionName) - _directActionString=[NSString stringWithFormat:@"%@/%@", - _actionClass, - _directActionName]; - else - _directActionString=_actionClass; - } - else if (_directActionName) - _directActionString=_directActionName; + actionClassValue=[_actionClass valueInComponent:component]; + + if (actionClassValue) + { + if (directActionNameValue) + tmpDirectActionString=[NSString stringWithFormat:@"%@/%@", + actionClassValue, + directActionNameValue]; + else + tmpDirectActionString=actionClassValue; + } + else if (directActionNameValue) + tmpDirectActionString=directActionNameValue; else - { - LOGSeriousError(@"No actionClass (for %@) and no directActionName (for %@)", - actionClass, - directActionName); - }; + { + LOGSeriousError(@"No actionClass (for %@) and no directActionName (for %@)", + actionClass, + directActionName); + }; - NSDebugMLLog(@"gswdync",@"_directActionString=%@",_directActionString); + NSDebugMLLog(@"gswdync",@"tmpDirectActionString=%@",tmpDirectActionString); LOGObjectFnStop(); - return _directActionString; + return tmpDirectActionString; }; //-------------------------------------------------------------------- --(void)_appendQueryStringToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)_appendQueryStringToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - NSDictionary* _queryDictionary=nil; + NSDictionary* queryDictionary=nil; LOGObjectFnStart(); - _queryDictionary=[self computeQueryDictionaryInContext:context_]; + queryDictionary=[self computeQueryDictionaryInContext:context]; //TODOV - if (_queryDictionary && [_queryDictionary count]>0) - { - NSEnumerator* _enumerator = [_queryDictionary keyEnumerator]; - id _key=nil; - id _value=nil; - BOOL first=YES; - [response_ appendContentCharacter:'?']; - while ((_key = [_enumerator nextObject])) - { - if (first) - first=NO; - else - [response_ appendContentCharacter:'&']; - [response_ appendContentHTMLString:_key]; - _value=[_queryDictionary objectForKey:_key]; - _value=[_value description]; - if ([_value length]>0) - { - [response_ appendContentCharacter:'=']; - [response_ appendContentHTMLString:_value]; - }; - }; - }; + if (queryDictionary && [queryDictionary count]>0) + { + NSEnumerator* _enumerator = [queryDictionary keyEnumerator]; + id aKey=nil; + id value=nil; + BOOL first=YES; + [response appendContentCharacter:'?']; + while ((aKey = [_enumerator nextObject])) + { + if (first) + first=NO; + else + [response appendContentCharacter:'&']; + [response appendContentHTMLString:aKey]; + value=[queryDictionary objectForKey:aKey]; + value=[value description]; + if ([value length]>0) + { + [response appendContentCharacter:'=']; + [response appendContentHTMLString:value]; + }; + }; + }; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(NSDictionary*)computeQueryDictionaryInContext:(GSWContext*)context_ +-(NSDictionary*)computeQueryDictionaryInContext:(GSWContext*)context { //OK - NSMutableDictionary* _queryDictionary=nil; - GSWComponent* _component=nil; - GSWSession* _session=nil; + NSMutableDictionary* queryDictionary=nil; + GSWComponent* component=nil; + GSWSession* session=nil; LOGObjectFnStart(); - _queryDictionary=[NSMutableDictionary dictionary]; - _component=[context_ component]; - _session=[context_ existingSession]; - if (_session) - { - if (!action && !pageName - && (WOStrictFlag || (!WOStrictFlag && !redirectURL))) //?? - { - NSString* _sessionID=[_session sessionID]; - [_queryDictionary setObject:_sessionID - forKey:GSWKey_SessionID[GSWebNamingConv]]; - }; - }; + queryDictionary=(NSMutableDictionary*)[NSMutableDictionary dictionary]; + component=[context component]; + session=[context existingSession]; + if (session) + { + if (!_action && !_pageName + && (WOStrictFlag || (!WOStrictFlag && !_redirectURL))) //?? + { + NSString* sessionID=[session sessionID]; + [queryDictionary setObject:sessionID + forKey:GSWKey_SessionID[GSWebNamingConv]]; + }; + }; //TODOV - if (otherQueryAssociations) - { - NSEnumerator *enumerator = [otherAssociations keyEnumerator]; - id _oaKey=nil; - while ((_oaKey = [enumerator nextObject])) - { - id _oaValue=[[otherAssociations objectForKey:_oaKey] valueInComponent:_component]; - if (!_oaValue) - _oaValue=[[NSString new]autorelease]; - [_queryDictionary setObject:_oaValue - forKey:_oaKey]; - }; - }; + if (_otherQueryAssociations) + { + NSEnumerator *enumerator = [_otherAssociations keyEnumerator]; + id oaKey=nil; + while ((oaKey = [enumerator nextObject])) + { + id oaValue=[[_otherAssociations objectForKey:oaKey] valueInComponent:component]; + if (!oaValue) + oaValue=[NSString string]; + [queryDictionary setObject:oaValue + forKey:oaKey]; + }; + }; //TODO finished ?? LOGObjectFnStop(); - return _queryDictionary; + return queryDictionary; }; //-------------------------------------------------------------------- //NDFN --(NSString*)hrefInContext:(GSWContext*)context_ +-(NSString*)hrefInContext:(GSWContext*)context { - GSWComponent* _component=nil; - NSString* _href=nil; - _component=[context_ component]; - _href=[href valueInComponent:_component]; - return _href; + GSWComponent* component=nil; + NSString* hrefValue=nil; + component=[context component]; + hrefValue=[_href valueInComponent:component]; + return hrefValue; }; @end //==================================================================== @implementation GSWHyperlink (GSWHyperlinkB) //-------------------------------------------------------------------- --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(GSWElement*)invokeActionForRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK - GSWElement* _element=nil; - NSString* _senderID=nil; - NSString* _elementID=nil; + GSWElement* element=nil; + NSString* senderID=nil; + NSString* elementID=nil; #ifndef NDEBBUG - int elementsNb=[(GSWElementIDString*)[context_ elementID]elementsNb]; + int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb]; #endif LOGObjectFnStart(); NSDebugMLLog(@"gswdync",@"ET=%@ definition name=%@ id=%@ senderId=%@", [self class],[self definitionName], - [context_ elementID],[context_ senderID]); - GSWAssertCorrectElementID(context_);// Debug Only - _senderID=[context_ senderID]; - _elementID=[context_ elementID]; - if ([_elementID isEqualToString:_senderID]) - { - GSWComponent* _component=[context_ component]; - if (action) - { - NSDebugMLLog(@"gswdync",@"GSWHTMLURLValuedElement invoke action=%@",action); - _element=[action valueInComponent:_component]; - if (_element) - { - if (![_element isKindOfClass:[GSWComponent class]]) //TODO GSWComponent or Element ? - { - ExceptionRaise0(@"GSWHyperlink",@"Invoked element return a not GSWComponent element"); - } else { - // call awakeInContext when _element is sleeping deeply - [_element ensureAwakeInContext:context_]; -/* - if (![_element context]) { - NSDebugMLLog(@"gswdync",@"_element sleeps, awake it = %@",_element); - [_element awakeInContext:context_]; - } -*/ - } - }; - } - else if (pageName) - { - id _pageNameValue=nil; - _pageNameValue=[pageName valueInComponent:_component]; - _element=[GSWApp pageWithName:_pageNameValue - inContext:context_]; - NSDebugMLLog(@"gswdync",@"_element=%@",_element); - if (!WOStrictFlag && _element)//GNUstepWeb only - { - if (pageSetVarAssociations) - { - [pageSetVarAssociations associationsSetValuesFromObject:_component - inObject:(GSWComponent*)_element]; - }; - if (pageSetVarAssociationsDynamic) - { - NSDictionary* _assocs=[pageSetVarAssociationsDynamic valueInComponent:_component]; - if (_assocs) - { - if (![_assocs isKindOfClass:[NSDictionary class]]) - { - ExceptionRaise(@"GSWHyperlink",@"%@ (%@) must return a Dictionary, not a %@ like %@", - pageSetVars__Key, - pageSetVarAssociationsDynamic, - [_assocs class], - _assocs); - } - else - { - [_assocs associationsSetValuesFromObject:_component - inObject:(GSWComponent*)_element]; - }; - }; - }; - }; - } - else if (!WOStrictFlag && redirectURL) //GNUstepWeb only - { - NSString* _url=[redirectURL valueInComponent:_component]; - id _redirectComponent = [GSWApp pageWithName:@"GSWRedirect" - inContext:context_]; - [_redirectComponent setURL:_url]; - _element=_redirectComponent; - } - else if (href) - { - LOGSeriousError(@"We shouldn't come here (href=%@)",href); - } - else - { - //TODO - }; - NSDebugMLLog(@"gswdync",@"GSWHTMLURLValuedElement invoke _element=%@",_element); - //TODOV - if (!_element) - _element=[context_ page]; - //the end ? - } + [context elementID],[context senderID]); + GSWAssertCorrectElementID(context);// Debug Only + senderID=[context senderID]; + elementID=[context elementID]; + if ([elementID isEqualToString:senderID]) + { + GSWComponent* component=[context component]; + if (_action) + { + NSDebugMLLog(@"gswdync",@"GSWHTMLURLValuedElement invoke action=%@",_action); + element=[_action valueInComponent:component]; + if (element) + { + if (![element isKindOfClass:[GSWComponent class]]) //TODO GSWComponent or Element ? + { + ExceptionRaise0(@"GSWHyperlink",@"Invoked element return a not GSWComponent element"); + } + else + { + // call awakeInContext when _element is sleeping deeply + [element ensureAwakeInContext:context]; + /* + if (![_element context]) { + NSDebugMLLog(@"gswdync",@"_element sleeps, awake it = %@",_element); + [_element awakeInContext:context]; + } + */ + } + }; + } + else if (_pageName) + { + id pageNameValue=nil; + pageNameValue=[_pageName valueInComponent:component]; + element=[GSWApp pageWithName:pageNameValue + inContext:context]; + NSDebugMLLog(@"gswdync",@"element=%@",element); + if (!WOStrictFlag && element)//GNUstepWeb only + { + if (_pageSetVarAssociations) + { + [_pageSetVarAssociations associationsSetValuesFromObject:component + inObject:(GSWComponent*)element]; + }; + if (_pageSetVarAssociationsDynamic) + { + NSDictionary* assocs=[_pageSetVarAssociationsDynamic valueInComponent:component]; + if (assocs) + { + if (![assocs isKindOfClass:[NSDictionary class]]) + { + ExceptionRaise(@"GSWHyperlink",@"%@ (%@) must return a Dictionary, not a %@ like %@", + pageSetVars__Key, + _pageSetVarAssociationsDynamic, + [assocs class], + assocs); + } + else + { + [assocs associationsSetValuesFromObject:component + inObject:(GSWComponent*)element]; + }; + }; + }; + }; + } + else if (!WOStrictFlag && _redirectURL) //GNUstepWeb only + { + NSString* anUrl=[_redirectURL valueInComponent:component]; + id redirectComponent = [GSWApp pageWithName:@"GSWRedirect" + inContext:context]; + [redirectComponent setURL:anUrl]; + element=redirectComponent; + } + else if (_href) + { + LOGSeriousError(@"We shouldn't come here (href=%@)",href); + } + else + { + //TODO + }; + NSDebugMLLog(@"gswdync",@"GSWHTMLURLValuedElement invoke _element=%@",element); + //TODOV + if (!element) + element=[context page]; + //the end ? + } else - { - if (children) - { - [context_ appendZeroElementIDComponent]; - _element=[children invokeActionForRequest:request_ - inContext:context_]; - [context_ deleteLastElementIDComponent]; - }; - }; - NSDebugMLLog(@"gswdync",@"GSWHTMLURLValuedElement invoke _element=%@",_element); - NSDebugMLLog(@"gswdync",@"_senderID=%@",[context_ senderID]); - NSDebugMLLog(@"gswdync",@"_elementID=%@",[context_ elementID]); + { + if (_children) + { + [context appendZeroElementIDComponent]; + element=[_children invokeActionForRequest:request + inContext:context]; + [context deleteLastElementIDComponent]; + }; + }; + NSDebugMLLog(@"gswdync",@"GSWHTMLURLValuedElement invoke element=%@",element); + NSDebugMLLog(@"gswdync",@"senderID=%@",[context senderID]); + NSDebugMLLog(@"gswdync",@"elementID=%@",[context elementID]); NSDebugMLLog(@"gswdync",@"END ET=%@ definition name=%@ id=%@", - [self class],[self definitionName],[context_ elementID]); + [self class],[self definitionName],[context elementID]); #ifndef NDEBBUG - NSAssert(elementsNb==[(GSWElementIDString*)[context_ elementID]elementsNb],@"GSWHyperlink invokeActionForRequest: bad elementID"); + NSAssert(elementsNb==[(GSWElementIDString*)[context elementID]elementsNb],@"GSWHyperlink invokeActionForRequest: bad elementID"); #endif LOGObjectFnStop(); - return _element; + return element; }; diff --git a/GSWeb.framework/GSWImage.h b/GSWeb.framework/GSWImage.h index 1c9648f..3204fd3 100644 --- a/GSWeb.framework/GSWImage.h +++ b/GSWeb.framework/GSWImage.h @@ -1,11 +1,16 @@ -/* GSWImage.h - GSWeb: Class GSWImage - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWImage.h - GSWeb: Class GSWImage + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,9 +35,9 @@ @interface GSWImage: GSWHTMLURLValuedElement --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(void)dealloc; -(NSString*)valueAttributeName; -(NSString*)urlAttributeName; diff --git a/GSWeb.framework/GSWImage.m b/GSWeb.framework/GSWImage.m index 1703be7..e785717 100644 --- a/GSWeb.framework/GSWImage.m +++ b/GSWeb.framework/GSWImage.m @@ -1,11 +1,16 @@ -/* GSWImage.m - GSWeb: Class GSWImage - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWImage.m - GSWeb: Class GSWImage + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,15 +35,15 @@ static char rcsId[] = "$Id$"; @implementation GSWImage //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { - if ((self=[super initWithName:name_ - associations:associations_ - contentElements:elements_])) - { - }; + if ((self=[super initWithName:name + associations:associations + contentElements:elements])) + { + }; return self; }; @@ -69,8 +75,8 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p>", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; diff --git a/GSWeb.framework/GSWImageButton.h b/GSWeb.framework/GSWImageButton.h index 38071e1..72efed8 100644 --- a/GSWeb.framework/GSWImageButton.h +++ b/GSWeb.framework/GSWImageButton.h @@ -1,11 +1,16 @@ -/* GSWImageButton.h - GSWeb: Class GSWImageButton - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWImageButton.h - GSWeb: Class GSWImageButton + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -30,62 +36,68 @@ //==================================================================== @interface GSWImageButton: GSWInput { - GSWAssociation* imageMapFileName; + GSWAssociation* _imageMapFileName; //GSWeb Additions { - GSWAssociation* imageMapString; - GSWAssociation* imageMapRegions; + GSWAssociation* _imageMapString; + GSWAssociation* _imageMapRegions; // } - GSWAssociation* action; - GSWAssociation* actionClass; - GSWAssociation* directActionName; - GSWAssociation* xAssoc; - GSWAssociation* yAssoc; - GSWAssociation* filename; - GSWAssociation* framework; - GSWAssociation* src; - GSWAssociation* data; - GSWAssociation* mimeType; - GSWAssociation* key; + GSWAssociation* _action; + GSWAssociation* _actionClass; + GSWAssociation* _directActionName; + GSWAssociation* _xAssoc; + GSWAssociation* _yAssoc; + GSWAssociation* _filename; + GSWAssociation* _framework; + GSWAssociation* _src; + GSWAssociation* _data; + GSWAssociation* _mimeType; + GSWAssociation* _key; }; -(void)dealloc; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(NSString*)description; -(NSString*)elementName; @end //==================================================================== @interface GSWImageButton (GSWImageButtonA) --(GSWAssociation*)hitTestX:(int)x_ - y:(int)y_ - inRegions:(NSArray*)regions_; +-(GSWAssociation*)hitTestX:(int)x + y:(int)y + inRegions:(NSArray*)regions; @end //==================================================================== @interface GSWImageButton (GSWImageButtonB) --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(id)_imageURLInContext:(GSWContext*)context_; --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(void)_appendDirectActionToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(NSString*)frameworkNameInContext:(GSWContext*)context_; +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; + +-(id)_imageURLInContext:(GSWContext*)context; + +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; + +-(void)_appendDirectActionToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; + +-(GSWElement*)invokeActionForRequest:(GSWRequest*)request + inContext:(GSWContext*)context; + +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; + +-(NSString*)frameworkNameInContext:(GSWContext*)context; @end //==================================================================== @interface GSWImageButton (GSWImageButtonC) --(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping; --(BOOL)appendStringAtLeft:(id)_unkwnon - withMapping:(char*)_mapping; +-(BOOL)appendStringAtRight:(id)unkwnon + withMapping:(char*)mapping; +-(BOOL)appendStringAtLeft:(id)unkwnon + withMapping:(char*)mapping; @end #endif //_GSWImageButton_h__ diff --git a/GSWeb.framework/GSWImageButton.m b/GSWeb.framework/GSWImageButton.m index 4c95bcf..32b2197 100644 --- a/GSWeb.framework/GSWImageButton.m +++ b/GSWeb.framework/GSWImageButton.m @@ -1,11 +1,16 @@ -/* GSWImageButton.m - GSWeb: Class GSWImageButton - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWImageButton.m - GSWeb: Class GSWImageButton + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,124 +35,125 @@ static char rcsId[] = "$Id$"; @implementation GSWImageButton //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)_elements; +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; { //OK - NSMutableDictionary* _associations=nil; + NSMutableDictionary* tmpAssociations=nil; LOGObjectFnStart(); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements); - _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; - [_associations removeObjectForKey:imageMapFileName__Key]; + NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@", + aName,associations,elements); + tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations]; + [tmpAssociations removeObjectForKey:imageMapFileName__Key]; if (!WOStrictFlag) { - [_associations removeObjectForKey:imageMapString__Key]; - [_associations removeObjectForKey:imageMapRegions__Key]; + [tmpAssociations removeObjectForKey:imageMapString__Key]; + [tmpAssociations removeObjectForKey:imageMapRegions__Key]; }; - [_associations removeObjectForKey:action__Key]; - [_associations removeObjectForKey:actionClass__Key]; - [_associations removeObjectForKey:directActionName__Key]; - [_associations removeObjectForKey:x__Key]; - [_associations removeObjectForKey:y__Key]; - [_associations removeObjectForKey:filename__Key]; - [_associations removeObjectForKey:framework__Key]; - [_associations removeObjectForKey:src__Key]; - [_associations removeObjectForKey:data__Key]; - [_associations removeObjectForKey:mimeType__Key]; - [_associations removeObjectForKey:key__Key]; - if ((self=[super initWithName:name_ - associations:_associations - contentElements:_elements])) - { - int _imageMapDefNb=0; - action = [[associations_ objectForKey:action__Key - withDefaultObject:[action autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"action=%@",action); - if ([action isValueConstant]) - { - ExceptionRaise0(@"GSWImageButton",@"'Action' parameter can't be a constant association"); - }; + [tmpAssociations removeObjectForKey:action__Key]; + [tmpAssociations removeObjectForKey:actionClass__Key]; + [tmpAssociations removeObjectForKey:directActionName__Key]; + [tmpAssociations removeObjectForKey:x__Key]; + [tmpAssociations removeObjectForKey:y__Key]; + [tmpAssociations removeObjectForKey:filename__Key]; + [tmpAssociations removeObjectForKey:framework__Key]; + [tmpAssociations removeObjectForKey:src__Key]; + [tmpAssociations removeObjectForKey:data__Key]; + [tmpAssociations removeObjectForKey:mimeType__Key]; + [tmpAssociations removeObjectForKey:key__Key]; + if ((self=[super initWithName:aName + associations:tmpAssociations + contentElements:elements])) + { + int imageMapDefNb=0; + _action = [[associations objectForKey:action__Key + withDefaultObject:[_action autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"action=%@",_action); + if ([_action isValueConstant]) + { + ExceptionRaise0(@"GSWImageButton",@"'Action' parameter can't be a constant association"); + }; - imageMapFileName = [[associations_ objectForKey:imageMapFileName__Key - withDefaultObject:[imageMapFileName autorelease]] retain]; - if (imageMapFileName) - _imageMapDefNb++; - NSDebugMLLog(@"gswdync",@"imageMapFileName=%@",imageMapFileName); + _imageMapFileName = [[associations objectForKey:imageMapFileName__Key + withDefaultObject:[_imageMapFileName autorelease]] retain]; + if (_imageMapFileName) + imageMapDefNb++; + NSDebugMLLog(@"gswdync",@"imageMapFileName=%@",_imageMapFileName); - if (!WOStrictFlag) - { - imageMapString = [[associations_ objectForKey:imageMapString__Key - withDefaultObject:[imageMapString autorelease]] retain]; - if (imageMapString) - _imageMapDefNb++; + if (!WOStrictFlag) + { + _imageMapString = [[associations objectForKey:imageMapString__Key + withDefaultObject:[_imageMapString autorelease]] retain]; + if (_imageMapString) + imageMapDefNb++; - imageMapRegions = [[associations_ objectForKey:imageMapRegions__Key - withDefaultObject:[imageMapRegions autorelease]] retain]; - if (imageMapRegions) - _imageMapDefNb++; - if (_imageMapDefNb>0) - { - ExceptionRaise(@"GSWActiveImage",@"you can't specify %@, %@ and %@", - imageMapFileName__Key, - imageMapString__Key, - imageMapRegions__Key); - }; + _imageMapRegions = [[associations objectForKey:imageMapRegions__Key + withDefaultObject:[_imageMapRegions autorelease]] retain]; + if (_imageMapRegions) + imageMapDefNb++; + if (imageMapDefNb>0) + { + ExceptionRaise(@"GSWActiveImage",@"you can't specify %@, %@ and %@", + imageMapFileName__Key, + imageMapString__Key, + imageMapRegions__Key); }; - actionClass = [[associations_ objectForKey:actionClass__Key - withDefaultObject:[actionClass autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"actionClass=%@",actionClass); + }; + _actionClass = [[associations objectForKey:actionClass__Key + withDefaultObject:[_actionClass autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"actionClass=%@",_actionClass); - directActionName = [[associations_ objectForKey:directActionName__Key - withDefaultObject:[directActionName autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"directActionName=%@",directActionName); + _directActionName = [[associations objectForKey:directActionName__Key + withDefaultObject:[_directActionName autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"directActionName=%@",_directActionName); + + _xAssoc = [[associations objectForKey:x__Key + withDefaultObject:[_xAssoc autorelease]] retain]; - xAssoc = [[associations_ objectForKey:x__Key - withDefaultObject:[xAssoc autorelease]] retain]; - - yAssoc = [[associations_ objectForKey:y__Key - withDefaultObject:[yAssoc autorelease]] retain]; + _yAssoc = [[associations objectForKey:y__Key + withDefaultObject:[_yAssoc autorelease]] retain]; - filename = [[associations_ objectForKey:filename__Key - withDefaultObject:[filename autorelease]] retain]; + _filename = [[associations objectForKey:filename__Key + withDefaultObject:[_filename autorelease]] retain]; - framework = [[associations_ objectForKey:framework__Key - withDefaultObject:[framework autorelease]] retain]; + _framework = [[associations objectForKey:framework__Key + withDefaultObject:[_framework autorelease]] retain]; - src = [[associations_ objectForKey:src__Key - withDefaultObject:[src autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"src=%@",src); + _src = [[associations objectForKey:src__Key + withDefaultObject:[_src autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"src=%@",_src); - data = [[associations_ objectForKey:data__Key - withDefaultObject:[data autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"data=%@",data); + _data = [[associations objectForKey:data__Key + withDefaultObject:[_data autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"data=%@",_data); + + _mimeType = [[associations objectForKey:mimeType__Key + withDefaultObject:[_mimeType autorelease]] retain]; - mimeType = [[associations_ objectForKey:mimeType__Key - withDefaultObject:[mimeType autorelease]] retain]; - - key = [[associations_ objectForKey:key__Key - withDefaultObject:[key autorelease]] retain]; - }; + _key = [[associations objectForKey:key__Key + withDefaultObject:[_key autorelease]] retain]; + }; return self; }; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(imageMapFileName); - DESTROY(imageMapString);//GSWeb only - DESTROY(imageMapRegions);//GSWeb Only - DESTROY(action); - DESTROY(actionClass); - DESTROY(directActionName); - DESTROY(xAssoc); - DESTROY(yAssoc); - DESTROY(filename); - DESTROY(framework); - DESTROY(src); - DESTROY(data); - DESTROY(mimeType); - DESTROY(key); + DESTROY(_imageMapFileName); + DESTROY(_imageMapString);//GSWeb only + DESTROY(_imageMapRegions);//GSWeb Only + DESTROY(_action); + DESTROY(_actionClass); + DESTROY(_directActionName); + DESTROY(_xAssoc); + DESTROY(_yAssoc); + DESTROY(_filename); + DESTROY(_framework); + DESTROY(_src); + DESTROY(_data); + DESTROY(_mimeType); + DESTROY(_key); [super dealloc]; }; @@ -160,25 +167,25 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p>", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; //==================================================================== @implementation GSWImageButton (GSWImageButtonA) --(GSWAssociation*)hitTestX:(int)x_ - y:(int)y_ - inRegions:(NSArray*)regions_ +-(GSWAssociation*)hitTestX:(int)x + y:(int)y + inRegions:(NSArray*)regions { - GSWAssociation* _assoc=nil; - GSWGeometricRegion* _region=[GSWGeometricRegion hitTestX:x_ - y:y_ - inRegions:regions_]; - if (_region) - _assoc=[GSWAssociation associationWithKeyPath:[_region userDefinedString]]; + GSWAssociation* assoc=nil; + GSWGeometricRegion* region=[GSWGeometricRegion hitTestX:x + y:y + inRegions:regions]; + if (region) + assoc=[GSWAssociation associationWithKeyPath:[region userDefinedString]]; else - _assoc=action; - return _assoc; + assoc=_action; + return assoc; }; @end @@ -186,131 +193,131 @@ static char rcsId[] = "$Id$"; @implementation GSWImageButton (GSWImageButtonB) //-------------------------------------------------------------------- --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - NSString* _url=nil; - NSString* _name=nil; - BOOL _disabledInContext=NO; - GSWComponent* _component=nil; - GSWResourceManager* _resourceManager=nil; - GSWURLValuedElementData* _dataValue=nil; - NSString* _keyValue=nil; + NSString* urlValue=nil; + NSString* name=nil; + BOOL disabledInContext=NO; + GSWComponent* component=nil; + GSWResourceManager* resourceManager=nil; + GSWURLValuedElementData* dataValue=nil; + NSString* keyValue=nil; LOGObjectFnStart(); - _disabledInContext=[self disabledInContext:context_]; - [response_ _appendContentAsciiString:@" type=image"]; - _name=[self nameInContext:context_]; - NSDebugMLLog(@"gswdync",@"definition name=%@ _name=%@", - [self definitionName],_name); - [response_ _appendContentAsciiString:@" name=\""]; - [response_ appendContentHTMLAttributeValue:_name]; - [response_ appendContentCharacter:'"']; - _component=[context_ component]; - _resourceManager=[[GSWApplication application]resourceManager]; - if (src) - _url=[src valueInComponent:_component]; + disabledInContext=[self disabledInContext:context]; + [response _appendContentAsciiString:@" type=image"]; + name=[self nameInContext:context]; + NSDebugMLLog(@"gswdync",@"definition name=%@ name=%@", + [self definitionName],name); + [response _appendContentAsciiString:@" name=\""]; + [response appendContentHTMLAttributeValue:name]; + [response appendContentCharacter:'"']; + component=[context component]; + resourceManager=[[GSWApplication application]resourceManager]; + if (_src) + urlValue=[_src valueInComponent:component]; else - { - if (key) - { - _keyValue=[key valueInComponent:_component]; - _dataValue=[_resourceManager _cachedDataForKey:_keyValue]; - }; - if (!_dataValue && data) - { - id _data=[data valueInComponent:_component]; - id _mimeTypeValue=[mimeType valueInComponent:_component]; - _dataValue=[[[GSWURLValuedElementData alloc] initWithData:_data - mimeType:_mimeTypeValue - key:_keyValue] autorelease]; - [_resourceManager setURLValuedElementData:_dataValue]; - } - else if (filename) - { - id _filenameValue=nil; - id _frameworkValue=nil; - GSWRequest* _request=nil; - NSArray* _languages=nil; - NSDebugMLLog(@"gswdync",@"filename=%@",filename); - _filenameValue=[filename valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"_filenameValue=%@",_filenameValue); - _frameworkValue=[self frameworkNameInContext:context_]; - NSDebugMLLog(@"gswdync",@"_frameworkValue=%@",_frameworkValue); - _request=[context_ request]; - _languages=[context_ languages]; - _url=[_resourceManager urlForResourceNamed:_filenameValue - inFramework:_frameworkValue - languages:_languages - request:_request]; - }; - }; + { + if (_key) + { + keyValue=[_key valueInComponent:component]; + dataValue=[resourceManager _cachedDataForKey:keyValue]; + }; + if (!dataValue && _data) + { + id tmpDataValue=[_data valueInComponent:component]; + id mimeTypeValue=[_mimeType valueInComponent:component]; + dataValue=[[[GSWURLValuedElementData alloc] initWithData:tmpDataValue + mimeType:mimeTypeValue + key:keyValue] autorelease]; + [resourceManager setURLValuedElementData:dataValue]; + } + else if (_filename) + { + id filenameValue=nil; + id frameworkValue=nil; + GSWRequest* request=nil; + NSArray* languages=nil; + NSDebugMLLog(@"gswdync",@"filename=%@",_filename); + filenameValue=[_filename valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"filenameValue=%@",filenameValue); + frameworkValue=[self frameworkNameInContext:context]; + NSDebugMLLog(@"gswdync",@"frameworkValue=%@",frameworkValue); + request=[context request]; + languages=[context languages]; + urlValue=[resourceManager urlForResourceNamed:filenameValue + inFramework:frameworkValue + languages:languages + request:request]; + }; + }; - [response_ _appendContentAsciiString:@" src=\""]; - if (src) - { - [response_ appendContentString:_url]; - } + [response _appendContentAsciiString:@" src=\""]; + if (_src) + { + [response appendContentString:urlValue]; + } else - { - if (key || data) - { - [_dataValue appendDataURLToResponse:response_ - inContext:context_]; - } - else if (filename) - { - [response_ appendContentString:_url]; - } - else - { - GSWDynamicURLString* _componentActionURL=[context_ componentActionURL]; - NSDebugMLLog(@"gswdync",@"_componentActionURL=%@",_componentActionURL); - [response_ appendContentString:(NSString*)_componentActionURL]; - }; - }; - [response_ appendContentCharacter:'"']; + { + if (_key || _data) + { + [dataValue appendDataURLToResponse:response + inContext:context]; + } + else if (_filename) + { + [response appendContentString:urlValue]; + } + else + { + GSWDynamicURLString* componentActionURL=[context componentActionURL]; + NSDebugMLLog(@"gswdync",@"componentActionURL=%@",componentActionURL); + [response appendContentString:(NSString*)componentActionURL]; + }; + }; + [response appendContentCharacter:'"']; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(id)_imageURLInContext:(GSWContext*)context_ +-(id)_imageURLInContext:(GSWContext*)context { LOGObjectFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - GSWRequest* _request=[context_ request]; - BOOL _isFromClientComponent=[_request isFromClientComponent]; - BOOL _disabledInContext=[self disabledInContext:context_]; - GSWSaveAppendToResponseElementID(context_);//Debug Only - if (_disabledInContext) - { - //TODO - }; - [response_ _appendContentAsciiString:@"GSWeb: Class GSWInput + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -30,23 +36,23 @@ //==================================================================== @interface GSWInput: GSWHTMLDynamicElement { - GSWAssociation* disabled; + GSWAssociation* _disabled; //GSWeb Additions { - GSWAssociation* enabled; + GSWAssociation* _enabled; //} - GSWAssociation* name; - GSWAssociation* value; + GSWAssociation* _name; + GSWAssociation* _value; //GSWeb Additions { - GSWAssociation* handleValidationException; + GSWAssociation* _handleValidationException; // } //GSWeb Additions { - GSWAssociation* tcEscapeHTML; + GSWAssociation* _tcEscapeHTML; // } }; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(void)dealloc; -(NSString*)elementName; @@ -54,27 +60,27 @@ //==================================================================== @interface GSWInput (GSWInputA) --(NSString*)nameInContext:(GSWContext*)context_; --(NSString*)valueInContext:(GSWContext*)context_; +-(NSString*)nameInContext:(GSWContext*)context; +-(NSString*)valueInContext:(GSWContext*)context; -(void)resetAutoValue; --(BOOL)disabledInContext:(GSWContext*)context_; +-(BOOL)disabledInContext:(GSWContext*)context; @end //==================================================================== @interface GSWInput (GSWInputB) --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; @end //==================================================================== @interface GSWInput (GSWInputC) --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(void)appendValueToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(void)appendNameToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; +-(void)appendValueToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; +-(void)appendNameToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; @end @@ -87,8 +93,8 @@ @interface GSWInput (GSWInputE) #if !GSWEB_STRICT --(void)handleValidationException:(NSException*)exception_ - inContext:(GSWContext*)context_; +-(void)handleValidationException:(NSException*)exception + inContext:(GSWContext*)context; #endif @end diff --git a/GSWeb.framework/GSWInput.m b/GSWeb.framework/GSWInput.m index ecebd3f..eef0990 100644 --- a/GSWeb.framework/GSWInput.m +++ b/GSWeb.framework/GSWInput.m @@ -1,11 +1,16 @@ -/* GSWInput.m - GSWeb: Class GSWInput - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWInput.m - GSWeb: Class GSWInput + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,56 +35,57 @@ static char rcsId[] = "$Id$"; @implementation GSWInput //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { - NSMutableDictionary* _attributedAssociations=[[associations_ mutableCopy] autorelease]; + NSMutableDictionary* attributedAssociations=[[associations mutableCopy] autorelease]; LOGObjectFnStartC("GSWInput"); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_); - [_attributedAssociations removeObjectForKey:disabled__Key]; - [_attributedAssociations removeObjectForKey:enabled__Key];//?? - [_attributedAssociations removeObjectForKey:value__Key];//?? + NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",aName,associations,elements); + [attributedAssociations removeObjectForKey:disabled__Key]; + [attributedAssociations removeObjectForKey:enabled__Key];//?? + [attributedAssociations removeObjectForKey:value__Key];//?? if (!WOStrictFlag) - [_attributedAssociations removeObjectForKey:handleValidationException__Key]; - value = [[associations_ objectForKey:value__Key - withDefaultObject:[value autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWInput: value=%@",value); - if ((self=[super initWithName:name_ - attributeAssociations:_attributedAssociations - contentElements:elements_])) - { - disabled = [[associations_ objectForKey:disabled__Key - withDefaultObject:[disabled autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWInput: disabled=%@",disabled); - if (!WOStrictFlag) + [attributedAssociations removeObjectForKey:handleValidationException__Key]; + _value = [[associations objectForKey:value__Key + withDefaultObject:[_value autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWInput: value=%@",_value); + if ((self=[super initWithName:aName + attributeAssociations:attributedAssociations + contentElements:elements])) + { + _disabled = [[associations objectForKey:disabled__Key + withDefaultObject:[_disabled autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWInput: disabled=%@",_disabled); + if (!WOStrictFlag) + { + _enabled = [[associations objectForKey:enabled__Key + withDefaultObject:[_enabled autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWInput: enabled=%@",_enabled); + if (_disabled && _enabled) { - enabled = [[associations_ objectForKey:enabled__Key - withDefaultObject:[enabled autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWInput: enabled=%@",enabled); - if (disabled && enabled) - { - ExceptionRaise0(@"GSWInput",@"You can't use 'diabled' and 'enabled' parameters at the same time."); - }; + ExceptionRaise0(@"GSWInput",@"You can't use 'diabled' and 'enabled' parameters at the same time."); }; - name = [[associations_ objectForKey:name__Key - withDefaultObject:[name autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWInput: name=%@",name); - - if (!WOStrictFlag) + }; + _name = [[associations objectForKey:name__Key + withDefaultObject:[_name autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWInput: name=%@",_name); + + if (!WOStrictFlag) + { + _handleValidationException = [[associations objectForKey:handleValidationException__Key + withDefaultObject:[_handleValidationException autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWInput: handleValidationException=%@",_handleValidationException); + + // Turbocat Additions + // [attributedAssociations removeObjectForKey: escapeHTML__Key]; + if ([associations objectForKey: escapeHTML__Key]) { - handleValidationException = [[associations_ objectForKey:handleValidationException__Key - withDefaultObject:[handleValidationException autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWInput: handleValidationException=%@",handleValidationException); - - // Turbocat Additions - // [_attributedAssociations removeObjectForKey: escapeHTML__Key]; - if ([associations_ objectForKey: escapeHTML__Key]) - { - tcEscapeHTML = [[associations_ objectForKey:escapeHTML__Key withDefaultObject:nil] retain]; - }; + _tcEscapeHTML = [[associations objectForKey:escapeHTML__Key + withDefaultObject:nil] retain]; }; - }; + }; + }; LOGObjectFnStopC("GSWInput"); return self; }; @@ -86,12 +93,12 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(disabled); - DESTROY(enabled);//GSWeb Only - DESTROY(name); - DESTROY(value); - DESTROY(handleValidationException);//GSWeb Only - DESTROY(tcEscapeHTML);//GSWeb Only + DESTROY(_disabled); + DESTROY(_enabled);//GSWeb Only + DESTROY(_name); + DESTROY(_value); + DESTROY(_handleValidationException);//GSWeb Only + DESTROY(_tcEscapeHTML);//GSWeb Only [super dealloc]; }; @@ -107,49 +114,49 @@ static char rcsId[] = "$Id$"; @implementation GSWInput (GSWInputA) //-------------------------------------------------------------------- --(NSString*)nameInContext:(GSWContext*)_context +-(NSString*)nameInContext:(GSWContext*)context { //OK - GSWComponent* _component=nil; - NSString* _name=nil; + GSWComponent* component=nil; + NSString* nameValue=nil; LOGObjectFnStartC("GSWInput"); - if (name) - { - _component=[_context component]; - _name=[name valueInComponent:_component]; - } + if (_name) + { + component=[context component]; + nameValue=[_name valueInComponent:component]; + } else - { - _name=[_context elementID]; - NSDebugMLLog(@"gswdync",@"_elementID=%@",[_context elementID]); - }; + { + nameValue=[context elementID]; + NSDebugMLLog(@"gswdync",@"elementID=%@",[context elementID]); + }; LOGObjectFnStopC("GSWInput"); - return _name; + return nameValue; }; static int countAutoValue = 0; //-------------------------------------------------------------------- -- (NSString *)valueInContext:(GSWContext *)_context +-(NSString*)valueInContext:(GSWContext*)context { //OK - GSWComponent *_component=nil; - NSString *_value=nil; + GSWComponent *component=nil; + NSString *valueValue=nil; LOGObjectFnStartC("GSWInput"); countAutoValue++; - if(value) + if(_value) { - _component=[_context component]; - _value=[value valueInComponent:_component]; + component=[context component]; + valueValue=[_value valueInComponent:component]; } else { - _value=[NSString stringWithFormat:@"%@.%d", [_context elementID], countAutoValue]; - NSDebugMLLog(@"gswdync",@"_elementID=%@ _countAutoValue",[_context elementID], countAutoValue); + valueValue=[NSString stringWithFormat:@"%@.%d", [context elementID], countAutoValue]; + NSDebugMLLog(@"gswdync",@"elementID=%@ _countAutoValue",[context elementID], countAutoValue); } LOGObjectFnStopC("GSWInput"); - return _value; + return valueValue; } //-------------------------------------------------------------------- @@ -163,15 +170,15 @@ static int countAutoValue = 0; } //-------------------------------------------------------------------- --(BOOL)disabledInContext:(GSWContext*)_context +-(BOOL)disabledInContext:(GSWContext*)context { //OK - if (!WOStrictFlag && enabled) - return ![self evaluateCondition:enabled - inContext:_context]; + if (!WOStrictFlag && _enabled) + return ![self evaluateCondition:_enabled + inContext:context]; else - return [self evaluateCondition:disabled - inContext:_context]; + return [self evaluateCondition:_disabled + inContext:context]; }; @end @@ -180,44 +187,43 @@ static int countAutoValue = 0; @implementation GSWInput (GSWInputB) //-------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK - BOOL _disabledInContext=NO; + BOOL disabledInContext=NO; LOGObjectFnStartC("GSWInput"); - GSWAssertCorrectElementID(context_);// Debug Only - _disabledInContext=[self disabledInContext:context_]; //return 0 - if (!_disabledInContext) - { - BOOL _wasFormSubmitted=[context_ _wasFormSubmitted]; - if (_wasFormSubmitted) - { - GSWComponent* _component=[context_ component]; - NSString* _nameInContext=[self nameInContext:context_]; - NSString* _value=[request_ formValueForKey:_nameInContext]; - NSDebugMLLog(@"gswdync",@"_nameInContext=%@",_nameInContext); - NSDebugMLLog(@"gswdync",@"_value=%@",_value); - if (!WOStrictFlag) - { - NS_DURING - { - [value setValue:_value - inComponent:_component]; - }; - NS_HANDLER - { - [self handleValidationException:localException - inContext:context_]; - } - NS_ENDHANDLER; - } - else - [value setValue:_value - inComponent:_component]; - }; - - }; + GSWAssertCorrectElementID(context);// Debug Only + disabledInContext=[self disabledInContext:context]; //return 0 + if (!disabledInContext) + { + BOOL wasFormSubmitted=[context _wasFormSubmitted]; + if (wasFormSubmitted) + { + GSWComponent* component=[context component]; + NSString* nameInContext=[self nameInContext:context]; + NSString* value=[request formValueForKey:nameInContext]; + NSDebugMLLog(@"gswdync",@"nameInContext=%@",nameInContext); + NSDebugMLLog(@"gswdync",@"value=%@",value); + if (!WOStrictFlag) + { + NS_DURING + { + [value setValue:value + inComponent:component]; + }; + NS_HANDLER + { + [self handleValidationException:localException + inContext:context]; + } + NS_ENDHANDLER; + } + else + [value setValue:value + inComponent:component]; + }; + }; LOGObjectFnStopC("GSWInput"); }; @@ -227,73 +233,74 @@ static int countAutoValue = 0; @implementation GSWInput (GSWInputC) //-------------------------------------------------------------------- --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - BOOL _disabledInContext=NO; + BOOL disabledInContext=NO; LOGObjectFnStartC("GSWInput"); - _disabledInContext=[self disabledInContext:context_]; //return 0 - if (_disabledInContext) - [response_ _appendContentAsciiString:@" disabled"]; - [self appendValueToResponse:response_ - inContext:context_]; - [self appendNameToResponse:response_ - inContext:context_]; + disabledInContext=[self disabledInContext:context]; //return 0 + if (disabledInContext) + [response _appendContentAsciiString:@" disabled"]; + [self appendValueToResponse:response + inContext:context]; + [self appendNameToResponse:response + inContext:context]; LOGObjectFnStopC("GSWInput"); }; //-------------------------------------------------------------------- --(void)appendValueToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendValueToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - GSWComponent* _component=nil; + GSWComponent* component=nil; LOGObjectFnStartC("GSWInput"); - GSWSaveAppendToResponseElementID(context_);//Debug Only - _component=[context_ component]; - if (value) - { - id _value=[value valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"_value=%@",_value); - if (_value) - { - [response_ appendContentCharacter:' ']; - [response_ _appendContentAsciiString:@"value"]; - [response_ appendContentCharacter:'=']; - [response_ appendContentCharacter:'"']; - if (tcEscapeHTML && [self evaluateCondition:tcEscapeHTML inContext:context_] == NO) - { - [response_ appendContentString:_value]; - } - else - { - [response_ appendContentHTMLAttributeValue:_value]; - }; - [response_ appendContentCharacter:'"']; - }; - }; + GSWSaveAppendToResponseElementID(context);//Debug Only + component=[context component]; + if (_value) + { + id valueValue=[_value valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue); + if (valueValue) + { + [response appendContentCharacter:' ']; + [response _appendContentAsciiString:@"value"]; + [response appendContentCharacter:'=']; + [response appendContentCharacter:'"']; + if (_tcEscapeHTML && [self evaluateCondition:_tcEscapeHTML + inContext:context] == NO) + { + [response appendContentString:valueValue]; + } + else + { + [response appendContentHTMLAttributeValue:valueValue]; + }; + [response appendContentCharacter:'"']; + }; + }; LOGObjectFnStopC("GSWInput"); }; //-------------------------------------------------------------------- --(void)appendNameToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendNameToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - NSString* _name=nil; + NSString* name=nil; LOGObjectFnStartC("GSWInput"); - _name=[self nameInContext:context_]; - NSDebugMLLog(@"gswdync",@"_name=%@",_name); - if (_name) - { - [response_ appendContentCharacter:' ']; - [response_ _appendContentAsciiString:@"name"]; - [response_ appendContentCharacter:'=']; - [response_ appendContentCharacter:'"']; - [response_ appendContentHTMLAttributeValue:_name]; - [response_ appendContentCharacter:'"']; - }; + name=[self nameInContext:context]; + NSDebugMLLog(@"gswdync",@"name=%@",name); + if (name) + { + [response appendContentCharacter:' ']; + [response _appendContentAsciiString:@"name"]; + [response appendContentCharacter:'=']; + [response appendContentCharacter:'"']; + [response appendContentHTMLAttributeValue:name]; + [response appendContentCharacter:'"']; + }; LOGObjectFnStopC("GSWInput"); }; @@ -314,60 +321,60 @@ static int countAutoValue = 0; @implementation GSWInput (GSWInputE) //GSWeb additions { --(void)handleValidationException:(NSException*)exception_ - inContext:(GSWContext*)context_ +-(void)handleValidationException:(NSException*)exception + inContext:(GSWContext*)context { - BOOL _isValidationException=[exception_ isValidationException]; - BOOL _raise=YES; + BOOL isValidationException=[exception isValidationException]; + BOOL raise=YES; LOGObjectFnStartC("GSWInput"); - if (_isValidationException) - { - GSWComponent* _component=[context_ component]; - id _handleValidationException=[handleValidationException valueInComponent:_component]; - BOOL _handle=NO; - if (!_handleValidationException) - { - _handleValidationException = [_component handleValidationExceptionDefault]; - }; - if (_handleValidationException) - { - if ([_handleValidationException isEqualToString:@"handleAndRaise"]) - { - _handle=YES; - _raise=YES; - } - else if ([_handleValidationException isEqualToString:@"handle"]) - { - _handle=YES; - _raise=NO; - } - else if ([_handleValidationException isEqualToString:@"raise"]) - { - _handle=NO; - _raise=YES; - } - else - { - NSDebugMLog(@"Unknown case for handleValidationException %@",_handleValidationException); - }; - }; - if (_handle) - { - NSDebugMLog(@"Handled validation exception %@",exception_); - [_component setValidationFailureMessage:[[exception_ userInfo]objectForKey:@"message"] - forElement:self]; - } - else - { - NSDebugMLog(@"Unhandled validation exception %@",exception_); - }; - }; - if (_raise) - { - NSDebugMLog(@"Raise exception %@",exception_); - exception_=ExceptionByAddingUserInfoObjectFrameInfo0(exception_,@"handleValidationException:inContext"); - [exception_ raise]; - }; + if (isValidationException) + { + GSWComponent* component=[context component]; + id handleValidationException=[handleValidationException valueInComponent:component]; + BOOL handle=NO; + if (!handleValidationException) + { + handleValidationException = [component handleValidationExceptionDefault]; + }; + if (handleValidationException) + { + if ([handleValidationException isEqualToString:@"handleAndRaise"]) + { + handle=YES; + raise=YES; + } + else if ([handleValidationException isEqualToString:@"handle"]) + { + handle=YES; + raise=NO; + } + else if ([handleValidationException isEqualToString:@"raise"]) + { + handle=NO; + raise=YES; + } + else + { + NSDebugMLog(@"Unknown case for handleValidationException %@",handleValidationException); + }; + }; + if (handle) + { + NSDebugMLog(@"Handled validation exception %@",exception); + [component setValidationFailureMessage:[[exception userInfo]objectForKey:@"message"] + forElement:self]; + } + else + { + NSDebugMLog(@"Unhandled validation exception %@",exception); + }; + }; + if (raise) + { + NSDebugMLog(@"Raise exception %@",exception); + exception=ExceptionByAddingUserInfoObjectFrameInfo0(exception,@"handleValidationException:inContext"); + [exception raise]; + }; LOGObjectFnStopC("GSWInput"); }; // } diff --git a/GSWeb.framework/GSWPasswordField.h b/GSWeb.framework/GSWPasswordField.h index ba33f48..0b19d89 100644 --- a/GSWeb.framework/GSWPasswordField.h +++ b/GSWeb.framework/GSWPasswordField.h @@ -1,11 +1,16 @@ -/* GSWPasswordField.h - GSWeb: Class GSWPasswordField - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWPasswordField.h - GSWeb: Class GSWPasswordField + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,9 +35,9 @@ //OK //==================================================================== @interface GSWPasswordField: GSWInput --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; @end diff --git a/GSWeb.framework/GSWPasswordField.m b/GSWeb.framework/GSWPasswordField.m index 51b2804..06079f9 100644 --- a/GSWeb.framework/GSWPasswordField.m +++ b/GSWeb.framework/GSWPasswordField.m @@ -1,11 +1,16 @@ -/* GSWPasswordField.m - GSWeb: Class GSWPasswordField - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWPasswordField.m - GSWeb: Class GSWPasswordField + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -27,20 +33,21 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWPasswordField --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { - NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; + NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations]; LOGObjectFnStartC("GSWPasswordField"); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,elements_); - [_associations setObject:[GSWAssociation associationWithValue:@"password"] - forKey:@"type"]; - if ((self=[super initWithName:name_ - associations:_associations - contentElements:nil])) //No Childs! - { - }; + NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@", + aName,associations,elements); + [tmpAssociations setObject:[GSWAssociation associationWithValue:@"password"] + forKey:@"type"]; + if ((self=[super initWithName:aName + associations:tmpAssociations + contentElements:nil])) //No Childs! + { + }; LOGObjectFnStopC("GSWPasswordField"); return self; }; diff --git a/GSWeb.framework/GSWPopUpButton.h b/GSWeb.framework/GSWPopUpButton.h index 1dddb8a..329d4b1 100644 --- a/GSWeb.framework/GSWPopUpButton.h +++ b/GSWeb.framework/GSWPopUpButton.h @@ -1,11 +1,16 @@ -/* GSWPopUpButton.h - GSWeb: Class GSWPopUpButton - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWPopUpButton.h - GSWeb: Class GSWPopUpButton + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,24 +35,24 @@ @interface GSWPopUpButton: GSWInput { - GSWAssociation* list; - GSWAssociation* item; - GSWAssociation* displayString; - GSWAssociation* selection; + GSWAssociation* _list; + GSWAssociation* _item; + GSWAssociation* _displayString; + GSWAssociation* _selection; //GSWeb Additions { - GSWAssociation* selectionValue; + GSWAssociation* _selectionValue; // } - GSWAssociation* selectedValue; - GSWAssociation* noSelectionString; - GSWAssociation* escapeHTML; - BOOL autoValue; + GSWAssociation* _selectedValue; + GSWAssociation* _noSelectionString; + GSWAssociation* _escapeHTML; + BOOL _autoValue; }; -(void)dealloc; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(NSString*)description; -(NSString*)elementName; @@ -54,23 +60,25 @@ @interface GSWPopUpButton (GSWPopUpButtonA) --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; --(void)appendValueToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendValueToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(void)_slowTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; + +-(void)_fastTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; + +-(void)_slowTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; @end @interface GSWPopUpButton (GSWPopUpButtonB) --(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping; +-(BOOL)appendStringAtRight:(id)unkwnon + withMapping:(char*)mapping; @end #endif //_GSWPopUpButton_h__ diff --git a/GSWeb.framework/GSWPopUpButton.m b/GSWeb.framework/GSWPopUpButton.m index 03202f6..42deade 100644 --- a/GSWeb.framework/GSWPopUpButton.m +++ b/GSWeb.framework/GSWPopUpButton.m @@ -1,11 +1,16 @@ -/* GSWPopUpButton.m - GSWeb: Class GSWPopUpButton - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWPopUpButton.m - GSWeb: Class GSWPopUpButton + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,59 +35,60 @@ static char rcsId[] = "$Id$"; @implementation GSWPopUpButton //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)_elements +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { //OK - NSMutableDictionary* _associations=nil; + NSMutableDictionary* tmpAssociations=nil; LOGObjectFnStartC("GSWPopUpButton"); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements); - _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; - [_associations removeObjectForKey:list__Key]; - [_associations removeObjectForKey:item__Key]; - [_associations removeObjectForKey:displayString__Key]; - [_associations removeObjectForKey:selection__Key]; + NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ _elements=%@", + aName,associations,elements); + tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations]; + [tmpAssociations removeObjectForKey:list__Key]; + [tmpAssociations removeObjectForKey:item__Key]; + [tmpAssociations removeObjectForKey:displayString__Key]; + [tmpAssociations removeObjectForKey:selection__Key]; if (!WOStrictFlag) - [_associations removeObjectForKey:selectionValue__Key]; - [_associations removeObjectForKey:selectedValue__Key]; - [_associations removeObjectForKey:noSelectionString__Key]; - [_associations removeObjectForKey:escapeHTML__Key]; + [tmpAssociations removeObjectForKey:selectionValue__Key]; + [tmpAssociations removeObjectForKey:selectedValue__Key]; + [tmpAssociations removeObjectForKey:noSelectionString__Key]; + [tmpAssociations removeObjectForKey:escapeHTML__Key]; - if ((self=[super initWithName:name_ - associations:_associations - contentElements:nil])) - { - list=[[associations_ objectForKey:list__Key - withDefaultObject:[list autorelease]] retain]; - item=[[associations_ objectForKey:item__Key - withDefaultObject:[item autorelease]] retain]; - displayString=[[associations_ objectForKey:displayString__Key - withDefaultObject:[displayString autorelease]] retain]; - selection=[[associations_ objectForKey:selection__Key - withDefaultObject:[selection autorelease]] retain]; - if (selection && ![selection isValueSettable]) - { - //TODO - }; - - if (!WOStrictFlag) + if ((self=[super initWithName:aName + associations:tmpAssociations + contentElements:nil])) + { + _list=[[associations objectForKey:list__Key + withDefaultObject:[_list autorelease]] retain]; + _item=[[associations objectForKey:item__Key + withDefaultObject:[_item autorelease]] retain]; + _displayString=[[associations objectForKey:displayString__Key + withDefaultObject:[_displayString autorelease]] retain]; + _selection=[[associations objectForKey:selection__Key + withDefaultObject:[_selection autorelease]] retain]; + if (_selection && ![_selection isValueSettable]) + { + //TODO + }; + + if (!WOStrictFlag) + { + _selectionValue=[[associations objectForKey:selectionValue__Key + withDefaultObject:[_selectionValue autorelease]] retain]; + if (_selectionValue && ![_selectionValue isValueSettable]) { - selectionValue=[[associations_ objectForKey:selectionValue__Key - withDefaultObject:[selectionValue autorelease]] retain]; - if (selectionValue && ![selectionValue isValueSettable]) - { - //TODO - }; + //TODO }; - - selectedValue=[[associations_ objectForKey:selectedValue__Key - withDefaultObject:[selectedValue autorelease]] retain]; - noSelectionString=[[associations_ objectForKey:noSelectionString__Key - withDefaultObject:[noSelectionString autorelease]] retain]; - escapeHTML=[[associations_ objectForKey:escapeHTML__Key - withDefaultObject:[escapeHTML autorelease]] retain]; - }; + }; + + _selectedValue=[[associations objectForKey:selectedValue__Key + withDefaultObject:[_selectedValue autorelease]] retain]; + _noSelectionString=[[associations objectForKey:noSelectionString__Key + withDefaultObject:[_noSelectionString autorelease]] retain]; + _escapeHTML=[[associations objectForKey:escapeHTML__Key + withDefaultObject:[_escapeHTML autorelease]] retain]; + }; LOGObjectFnStopC("GSWPopUpButton"); return self; }; @@ -89,14 +96,14 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(list); - DESTROY(item); - DESTROY(displayString); - DESTROY(selection); - DESTROY(selectionValue);//GSWeb Only - DESTROY(selectedValue); - DESTROY(noSelectionString); - DESTROY(escapeHTML); + DESTROY(_list); + DESTROY(_item); + DESTROY(_displayString); + DESTROY(_selection); + DESTROY(_selectionValue);//GSWeb Only + DESTROY(_selectedValue); + DESTROY(_noSelectionString); + DESTROY(_escapeHTML); [super dealloc]; }; @@ -111,8 +118,8 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p>", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; //==================================================================== @@ -120,378 +127,378 @@ static char rcsId[] = "$Id$"; //#define ENABLE_OPTGROUP //-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - GSWRequest* _request=nil; - BOOL _isFromClientComponent=NO; - GSWComponent* _component=nil; - NSArray* _listValue=nil; - id _selectionValue=nil; - id _selectedValueValue=nil; - id _valueValue=nil; - id _itemValue=nil; - id _displayStringValue=nil; - BOOL _escapeHTML=YES; - id _escapeHTMLValue=nil; + GSWRequest* request=nil; + BOOL isFromClientComponent=NO; + GSWComponent* component=nil; + NSArray* listValue=nil; + id selectionValue=nil; + id selectedValueValue=nil; + id valueValue=nil; + id itemValue=nil; + id displayStringValue=nil; + BOOL escapeHTMLBoolValue=YES; + id escapeHTMLValue=nil; int i=0; - BOOL _inOptGroup=NO; + BOOL inOptGroup=NO; #ifndef ENABLE_OPTGROUP - BOOL _optGroupLabel=NO; + BOOL optGroupLabel=NO; #endif LOGObjectFnStartC("GSWPopUpButton"); [self resetAutoValue]; - autoValue = NO; - _request=[context_ request]; - _isFromClientComponent=[_request isFromClientComponent]; - _component=[context_ component]; - [super appendToResponse:response_ - inContext:context_]; - _listValue=[list valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"_listValue=%@",_listValue); - NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], - @"The list (%@) (%@ of class:%@) doesn't respond to 'count'", - list, - _listValue, - [_listValue class]); - _selectionValue=[selection valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"selection=%@",selection); - NSDebugMLLog(@"gswdync",@"_selectionValue=%@",_selectionValue); - _selectedValueValue=[selectedValue valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"selectedValue=%@",selectedValue); - NSDebugMLLog(@"gswdync",@"_selectedValueValue=%@",_selectedValueValue); - if (escapeHTML) - { - _escapeHTMLValue=[escapeHTML valueInComponent:_component]; - _escapeHTML=boolValueFor(_escapeHTMLValue); - }; - if (noSelectionString) - { - id _noSelectionStringValue=nil; - [response_ _appendContentAsciiString:@"\n']; - _noSelectionStringValue=[noSelectionString valueInComponent:_component]; - if (_escapeHTML) - _noSelectionStringValue=[GSWResponse stringByEscapingHTMLString:_noSelectionStringValue]; - [response_ appendContentString:_noSelectionStringValue]; - //[response_ appendContentHTMLString:_noSelectionStringValue]; - // There is no close tag on OPTION - //[response_ _appendContentAsciiString:@""]; - }; - for(i=0;i<[_listValue count];i++) - { - NSDebugMLLog(@"gswdync",@"_inOptGroup=%s",(_inOptGroup ? "YES" : "NO")); - _itemValue=[_listValue objectAtIndex:i]; - if (item) - [item setValue:_itemValue - inComponent:_component]; - NSDebugMLLog(@"gswdync",@"_itemValue=%@",_itemValue); - if (_itemValue) - { - NSDebugMLLog(@"gswdync",@"value=%@",value); - _valueValue=[self valueInContext:context_]; - NSDebugMLLog(@"gswdync",@"_valueValue=%@",_valueValue); - if (_valueValue) - { - BOOL _isEqual; + _autoValue = NO; + request=[context request]; + isFromClientComponent=[request isFromClientComponent]; + component=[context component]; + [super appendToResponse:response + inContext:context]; + listValue=[_list valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"listValue=%@",listValue); + NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)], + @"The list (%@) (%@ of class:%@) doesn't respond to 'count'", + _list, + listValue, + [listValue class]); + selectionValue=[_selection valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"selection=%@",_selection); + NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue); + selectedValueValue=[_selectedValue valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"selectedValue=%@",_selectedValue); + NSDebugMLLog(@"gswdync",@"selectedValueValue=%@",selectedValueValue); + if (_escapeHTML) + { + escapeHTMLValue=[_escapeHTML valueInComponent:component]; + escapeHTMLBoolValue=boolValueFor(escapeHTMLValue); + }; + if (_noSelectionString) + { + id noSelectionStringValue=nil; + [response _appendContentAsciiString:@"\n']; + 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:@""]; + }; + for(i=0;i<[listValue count];i++) + { + NSDebugMLLog(@"gswdync",@"inOptGroup=%s",(inOptGroup ? "YES" : "NO")); + itemValue=[listValue objectAtIndex:i]; + if (_item) + [_item setValue:itemValue + inComponent:component]; + NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue); + if (itemValue) + { + NSDebugMLLog(@"gswdync",@"value=%@",_value); + valueValue=[self valueInContext:context]; + NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue); + if (valueValue) + { + BOOL isEqual; - NSDebugMLLog0(@"gswdync",@"Adding OPTION"); - [response_ _appendContentAsciiString:@"\n']; - }; - _displayStringValue=nil; - if (displayString) - { - NSDebugMLLog(@"gswdync",@"displayString=%@",displayString); - _displayStringValue=[displayString valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"_displayStringValue=%@",_displayStringValue); - } - else - { - _displayStringValue = _itemValue; - } + if (isEqual) + { + [response appendContentCharacter:' ']; + [response _appendContentAsciiString:@"selected"]; + }; + }; + if (_value == nil) + _autoValue = YES; + if (valueValue) + { + [response _appendContentAsciiString:@" value=\""]; + [response _appendContentAsciiString:valueValue]; + [response appendContentCharacter:'"']; + }; + [response appendContentCharacter:'>']; + }; + displayStringValue=nil; + if (_displayString) + { + NSDebugMLLog(@"gswdync",@"displayString=%@",_displayString); + displayStringValue=[_displayString valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"displayStringValue=%@",displayStringValue); + } + else + { + displayStringValue = itemValue; + } - if (_displayStringValue) - { - if (!_valueValue) - { - if (_inOptGroup) - { - NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP"); + if (displayStringValue) + { + if (!valueValue) + { + if (inOptGroup) + { + NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP"); #ifdef ENABLE_OPTGROUP - [response_ _appendContentAsciiString:@"\n"]; + [response _appendContentAsciiString:@"\n"]; #endif - _inOptGroup=NO; - }; - NSDebugMLLog0(@"gswdync",@"Adding OPTGROUP"); + inOptGroup=NO; + }; + NSDebugMLLog0(@"gswdync",@"Adding OPTGROUP"); #ifdef ENABLE_OPTGROUP - [response_ _appendContentAsciiString:@"\n-- "]; - _optGroupLabel=YES; + [response _appendContentAsciiString:@"\n - - if (_escapeHTML) - _displayStringValue=[GSWResponse stringByEscapingHTMLString:_displayStringValue]; - NSDebugMLLog(@"gswdync",@"_displayStringValue=%@",_displayStringValue); + inOptGroup=YES; + }; + // + + if (escapeHTMLBoolValue) + displayStringValue=[GSWResponse stringByEscapingHTMLString:displayStringValue]; + NSDebugMLLog(@"gswdync",@"displayStringValue=%@",displayStringValue); #ifndef ENABLE_OPTGROUP - if (_optGroupLabel) - { - _displayStringValue=[NSString stringWithFormat:@"%@ --",_displayStringValue]; - }; + if (optGroupLabel) + { + displayStringValue=[NSString stringWithFormat:@"%@ --",displayStringValue]; + }; #endif - [response_ appendContentString:_displayStringValue]; - //[response_ appendContentHTMLString:_displayStringValue]; - }; - if (_valueValue) - { - //NSDebugMLLog0(@"gswdync",@"Adding /OPTION"); - // K2- No /OPTION TAG - //[response_ _appendContentAsciiString:@""]; - } - else - { - NSDebugMLLog0(@"gswdync",@"Adding > or "); + [response appendContentString:displayStringValue]; + //[response appendContentHTMLString:_displayStringValue]; + }; + if (valueValue) + { + //NSDebugMLLog0(@"gswdync",@"Adding /OPTION"); + // K2- No /OPTION TAG + //[response _appendContentAsciiString:@""]; + } + else + { + NSDebugMLLog0(@"gswdync",@"Adding > or "); #ifdef ENABLE_OPTGROUP - [response_ _appendContentAsciiString:@"\">"]; + [response _appendContentAsciiString:@"\">"]; #else - if (_optGroupLabel) - { - //[response_ _appendContentAsciiString:@""]; - _optGroupLabel=NO; - }; + if (optGroupLabel) + { + //[response _appendContentAsciiString:@""]; + optGroupLabel=NO; + }; #endif - }; - }; - }; - if (_inOptGroup) - { + }; + }; + }; + if (inOptGroup) + { #ifdef ENABLE_OPTGROUP - NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP"); - [response_ _appendContentAsciiString:@"\n"]; + NSDebugMLLog0(@"gswdync",@"Adding /OPTGROUP"); + [response _appendContentAsciiString:@"\n"]; #endif - _inOptGroup=NO; - }; - [response_ _appendContentAsciiString:@""]; + inOptGroup=NO; + }; + [response _appendContentAsciiString:@""]; LOGObjectFnStopC("GSWPopUpButton"); }; //-------------------------------------------------------------------- --(void)appendValueToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendValueToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK //Does nothing ! }; //-------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK LOGObjectFnStartC("GSWPopUpButton"); - [self _slowTakeValuesFromRequest:request_ - inContext:context_]; + [self _slowTakeValuesFromRequest:request + inContext:context]; LOGObjectFnStopC("GSWPopUpButton"); }; //-------------------------------------------------------------------- --(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)_fastTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(void)_slowTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)_slowTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK - BOOL _disabled=NO; - BOOL _wasFormSubmitted=NO; + BOOL disabledValue=NO; + BOOL wasFormSubmitted=NO; LOGObjectFnStartC("GSWPopUpButton"); [self resetAutoValue]; - _disabled=[self disabledInContext:context_]; - if (!_disabled) - { - _wasFormSubmitted=[context_ _wasFormSubmitted]; - if (_wasFormSubmitted) - { - GSWComponent* _component=nil; - NSArray* _listValue=nil; - id _valueValue=nil; - id _itemValue=nil; - NSString* _name=nil; - NSArray* _formValues=nil; - id _formValue=nil; - BOOL _found=NO; - int i=0; - _component=[context_ component]; - _name=[self nameInContext:context_]; - NSDebugMLLog(@"gswdync",@"_name=%@",_name); - _formValues=[request_ formValuesForKey:_name]; - NSDebugMLLog(@"gswdync",@"_formValues=%@",_formValues); - if (_formValues && [_formValues count]) - { - BOOL _isEqual=NO; - _formValue=[_formValues objectAtIndex:0]; - NSDebugMLLog(@"gswdync",@"_formValue=%@",_formValue); - _listValue=[list valueInComponent:_component]; - NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], - @"The list (%@) (%@ of class:%@) doesn't respond to 'count'", - list, - _listValue, - [_listValue class]); - for(i=0;!_found && i<[_listValue count];i++) - { - _itemValue=[_listValue objectAtIndex:i]; - NSDebugMLLog(@"gswdync",@"_itemValue=%@",_itemValue); - NSDebugMLLog(@"gswdync",@"item=%@",item); - if (item) - [item setValue:_itemValue - inComponent:_component]; - NSDebugMLLog(@"gswdync",@"value=%@",value); - _valueValue=[self valueInContext:context_]; - NSDebugMLLog(@"gswdync",@"_valueValue=%@ [class=%@] _formValue=%@ [class=%@]", - _valueValue,[_valueValue class], - _formValue,[_formValue class]); - _isEqual=SBIsValueEqual(_valueValue,_formValue); - if (_isEqual) - { - if(autoValue == NO) - _itemValue = _valueValue; + disabledValue=[self disabledInContext:context]; + if (!disabledValue) + { + wasFormSubmitted=[context _wasFormSubmitted]; + if (wasFormSubmitted) + { + GSWComponent* component=nil; + NSArray* listValue=nil; + id valueValue=nil; + id itemValue=nil; + NSString* name=nil; + NSArray* formValues=nil; + id formValue=nil; + BOOL found=NO; + int i=0; + component=[context component]; + name=[self nameInContext:context]; + NSDebugMLLog(@"gswdync",@"name=%@",name); + formValues=[request formValuesForKey:name]; + NSDebugMLLog(@"gswdync",@"formValues=%@",formValues); + if (formValues && [formValues count]) + { + BOOL isEqual=NO; + formValue=[formValues objectAtIndex:0]; + NSDebugMLLog(@"gswdync",@"formValue=%@",formValue); + listValue=[_list valueInComponent:component]; + NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)], + @"The list (%@) (%@ of class:%@) doesn't respond to 'count'", + _list, + listValue, + [listValue class]); + for(i=0;!found && i<[listValue count];i++) + { + itemValue=[listValue objectAtIndex:i]; + NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue); + NSDebugMLLog(@"gswdync",@"item=%@",_item); + if (_item) + [_item setValue:itemValue + inComponent:component]; + NSDebugMLLog(@"gswdync",@"value=%@",_value); + valueValue=[self valueInContext:context]; + NSDebugMLLog(@"gswdync",@"valueValue=%@ [class=%@] formValue=%@ [class=%@]", + valueValue,[valueValue class], + formValue,[formValue class]); + isEqual=SBIsValueEqual(valueValue,formValue); + if (isEqual) + { + if(_autoValue == NO) + itemValue = valueValue; - NSDebugMLLog(@"gswdync",@"selection=%@",selection); - if (selection) - { - if (!WOStrictFlag) - { - NS_DURING - { - [selection setValue:_itemValue - inComponent:_component]; - }; - NS_HANDLER - { - [self handleValidationException:localException - inContext:context_]; - } - NS_ENDHANDLER; - } - else - [selection setValue:_itemValue - inComponent:_component]; - }; - if (!WOStrictFlag) - { - NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue); - if (selectionValue) - { - NS_DURING - { - [selectionValue setValue:_valueValue - inComponent:_component]; - }; - NS_HANDLER - { - [self handleValidationException:localException - inContext:context_]; - } - NS_ENDHANDLER; - }; - }; - _found=YES; - }; - }; - }; - NSDebugMLLog(@"gswdync",@"_found=%s",(_found ? "YES" : "NO")); - if (!_found) - { - if (selection) - { - if (!WOStrictFlag) - { - NS_DURING - { - [selection setValue:nil - inComponent:_component]; - }; - NS_HANDLER - { - [self handleValidationException:localException - inContext:context_]; - } - NS_ENDHANDLER; - } - else - [selection setValue:nil - inComponent:_component]; - }; - if (!WOStrictFlag && selectionValue) - { - NS_DURING - { - [selectionValue setValue:nil - inComponent:_component]; - }; - NS_HANDLER - { - [self handleValidationException:localException - inContext:context_]; - } - NS_ENDHANDLER; - }; - }; - }; - }; + NSDebugMLLog(@"gswdync",@"selection=%@",_selection); + if (_selection) + { + if (!WOStrictFlag) + { + NS_DURING + { + [_selection setValue:itemValue + inComponent:component]; + }; + NS_HANDLER + { + [self handleValidationException:localException + inContext:context]; + } + NS_ENDHANDLER; + } + else + [_selection setValue:itemValue + inComponent:component]; + }; + if (!WOStrictFlag) + { + NSDebugMLLog(@"gswdync",@"selectionValue=%@",_selectionValue); + if (_selectionValue) + { + NS_DURING + { + [_selectionValue setValue:valueValue + inComponent:component]; + }; + NS_HANDLER + { + [self handleValidationException:localException + inContext:context]; + } + NS_ENDHANDLER; + }; + }; + found=YES; + }; + }; + }; + NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO")); + if (!found) + { + if (_selection) + { + if (!WOStrictFlag) + { + NS_DURING + { + [_selection setValue:nil + inComponent:component]; + }; + NS_HANDLER + { + [self handleValidationException:localException + inContext:context]; + } + NS_ENDHANDLER; + } + else + [_selection setValue:nil + inComponent:component]; + }; + if (!WOStrictFlag && _selectionValue) + { + NS_DURING + { + [_selectionValue setValue:nil + inComponent:component]; + }; + NS_HANDLER + { + [self handleValidationException:localException + inContext:context]; + } + NS_ENDHANDLER; + }; + }; + }; + }; LOGObjectFnStopC("GSWPopUpButton"); }; @@ -500,8 +507,8 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWPopUpButton (GSWPopUpButtonB) --(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping +-(BOOL)appendStringAtRight:(id)unkwnon + withMapping:(char*)mapping { LOGObjectFnNotImplemented(); //TODOFN return NO; diff --git a/GSWeb.framework/GSWRadioButton.h b/GSWeb.framework/GSWRadioButton.h index 070917c..bfd7f84 100644 --- a/GSWeb.framework/GSWRadioButton.h +++ b/GSWeb.framework/GSWRadioButton.h @@ -1,11 +1,16 @@ -/* GSWRadioButton.h - GSWeb: Class GSWRadioButton - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWRadioButton.h - GSWeb: Class GSWRadioButton + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,13 +35,13 @@ //==================================================================== @interface GSWRadioButton: GSWInput { - GSWAssociation* checked; - GSWAssociation* selection; + GSWAssociation* _checked; + GSWAssociation* _selection; }; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(void)dealloc; -(NSString*)description; @@ -43,14 +49,14 @@ //==================================================================== @interface GSWRadioButton (GSWRadioButtonA) --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; @end //==================================================================== @interface GSWRadioButton (GSWRadioButtonB) --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; @end diff --git a/GSWeb.framework/GSWRadioButton.m b/GSWeb.framework/GSWRadioButton.m index 089a87a..ef00e2c 100644 --- a/GSWeb.framework/GSWRadioButton.m +++ b/GSWeb.framework/GSWRadioButton.m @@ -1,11 +1,16 @@ -/* GSWRadioButton.m - GSWeb: Class GSWRadioButton - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWRadioButton.m - GSWeb: Class GSWRadioButton + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,49 +35,50 @@ static char rcsId[] = "$Id$"; @implementation GSWRadioButton //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)_elements +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { - NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; + NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations]; LOGObjectFnStart(); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements); - [_associations setObject:[GSWAssociation associationWithValue:@"radio"] + NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ _elements=%@", + aName,associations,elements); + [tmpAssociations setObject:[GSWAssociation associationWithValue:@"radio"] forKey:@"type"]; - [_associations removeObjectForKey:selection__Key]; - [_associations removeObjectForKey:checked__Key]; - if ((self=[super initWithName:name_ - associations:_associations - contentElements:nil])) - { - selection=[[associations_ objectForKey:selection__Key - withDefaultObject:[selection autorelease]] retain]; - if (selection && ![selection isValueSettable]) - { - ExceptionRaise0(@"GSWRadioButton",@"'selection' parameter must be settable"); - }; - checked=[[associations_ objectForKey:checked__Key - withDefaultObject:[checked autorelease]] retain]; - if (checked && ![checked isValueSettable]) - { - ExceptionRaise0(@"GSWRadioButton",@"'checked' parameter must be settable"); - }; - if (!checked) - { - if (!value || !selection) - { - ExceptionRaise0(@"GSWRadioButton",@"if you don't specify 'checked' parameter, you have to specify 'value' and 'selection' parameter"); - }; - }; - }; + [tmpAssociations removeObjectForKey:selection__Key]; + [tmpAssociations removeObjectForKey:checked__Key]; + if ((self=[super initWithName:aName + associations:tmpAssociations + contentElements:nil])) + { + _selection=[[associations objectForKey:selection__Key + withDefaultObject:[_selection autorelease]] retain]; + if (_selection && ![_selection isValueSettable]) + { + ExceptionRaise0(@"GSWRadioButton",@"'selection' parameter must be settable"); + }; + _checked=[[associations objectForKey:checked__Key + withDefaultObject:[_checked autorelease]] retain]; + if (_checked && ![_checked isValueSettable]) + { + ExceptionRaise0(@"GSWRadioButton",@"'checked' parameter must be settable"); + }; + if (!_checked) + { + if (!_value || !_selection) + { + ExceptionRaise0(@"GSWRadioButton",@"if you don't specify 'checked' parameter, you have to specify 'value' and 'selection' parameter"); + }; + }; + }; return self; }; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(checked); - DESTROY(selection); + DESTROY(_checked); + DESTROY(_selection); [super dealloc]; }; @@ -79,8 +86,8 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p>", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; @end @@ -89,33 +96,33 @@ static char rcsId[] = "$Id$"; @implementation GSWRadioButton (GSWRadioButtonA) //-------------------------------------------------------------------- --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - GSWComponent* _component=[context_ component]; - BOOL _disabledInContext=[self disabledInContext:context_]; - if (!_disabledInContext) - { - BOOL _checked=NO; - [self appendValueToResponse:response_ - inContext:context_]; - [self appendNameToResponse:response_ - inContext:context_]; - if (checked) - { - _checked=[self evaluateCondition:checked - inContext:context_]; - } - else if (value) - { - id _valueValue=[value valueInComponent:_component]; - id _selectionValue=[selection valueInComponent:_component]; - _checked=SBIsValueEqual(_selectionValue,_valueValue); - }; - if (_checked) - [response_ _appendContentAsciiString:@" checked"]; - }; + GSWComponent* component=[context component]; + BOOL disabledInContext=[self disabledInContext:context]; + if (!disabledInContext) + { + BOOL isChecked=NO; + [self appendValueToResponse:response + inContext:context]; + [self appendNameToResponse:response + inContext:context]; + if (_checked) + { + isChecked=[self evaluateCondition:_checked + inContext:context]; + } + else if (_value) + { + id valueValue=[_value valueInComponent:component]; + id selectionValue=[_selection valueInComponent:component]; + isChecked=SBIsValueEqual(selectionValue,valueValue); + }; + if (isChecked) + [response _appendContentAsciiString:@" checked"]; + }; }; @end @@ -123,77 +130,77 @@ static char rcsId[] = "$Id$"; @implementation GSWRadioButton (GSWRadioButtonB) //-------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK - BOOL _disabledInContext=NO; + BOOL disabledInContext=NO; LOGObjectFnStart(); - _disabledInContext=[self disabledInContext:context_]; - if (!_disabledInContext) - { - if ([context_ _wasFormSubmitted]) - { - BOOL _isEqual=NO; - GSWComponent* _component=[context_ component]; - NSString* _name=nil; - id _formValue=nil; - id _valueValue=nil; - BOOL _checkChecked=NO; - _name=[self nameInContext:context_]; - NSDebugMLLog(@"gswdync",@"_name=%@",_name); - _formValue=[request_ formValueForKey:_name]; - _valueValue=[value valueInComponent:_component]; - //TODO if checked ! - _isEqual=SBIsValueEqual(_formValue,_valueValue); - if (_isEqual) - { - _checkChecked=YES; - if (selection) - { - if (!WOStrictFlag) - { - NS_DURING - { - [selection setValue:_valueValue - inComponent:_component]; - }; - NS_HANDLER - { - [self handleValidationException:localException - inContext:context_]; - } - NS_ENDHANDLER; - } - else - [selection setValue:_valueValue - inComponent:_component]; - }; - }; - if (checked) - { - id _checkedValue=[NSNumber numberWithBool:_checkChecked]; - NSDebugMLLog(@"gswdync",@"_checkedValue=%@",_checkedValue); - if (!WOStrictFlag) - { - NS_DURING - { - [checked setValue:_checkedValue - inComponent:_component]; - }; - NS_HANDLER - { - [self handleValidationException:localException - inContext:context_]; - } - NS_ENDHANDLER; - } - else - [checked setValue:_checkedValue - inComponent:_component]; - }; - }; - }; + disabledInContext=[self disabledInContext:context]; + if (!disabledInContext) + { + if ([context _wasFormSubmitted]) + { + BOOL isEqual=NO; + GSWComponent* component=[context component]; + NSString* name=nil; + id formValue=nil; + id valueValue=nil; + BOOL checkChecked=NO; + name=[self nameInContext:context]; + NSDebugMLLog(@"gswdync",@"name=%@",name); + formValue=[request formValueForKey:name]; + valueValue=[_value valueInComponent:component]; + //TODO if checked ! + isEqual=SBIsValueEqual(formValue,valueValue); + if (isEqual) + { + checkChecked=YES; + if (_selection) + { + if (!WOStrictFlag) + { + NS_DURING + { + [_selection setValue:valueValue + inComponent:component]; + }; + NS_HANDLER + { + [self handleValidationException:localException + inContext:context]; + } + NS_ENDHANDLER; + } + else + [_selection setValue:valueValue + inComponent:component]; + }; + }; + if (_checked) + { + id checkedValue=[NSNumber numberWithBool:checkChecked]; + NSDebugMLLog(@"gswdync",@"checkedValue=%@",checkedValue); + if (!WOStrictFlag) + { + NS_DURING + { + [_checked setValue:checkedValue + inComponent:component]; + }; + NS_HANDLER + { + [self handleValidationException:localException + inContext:context]; + } + NS_ENDHANDLER; + } + else + [_checked setValue:checkedValue + inComponent:component]; + }; + }; + }; LOGObjectFnStop(); }; diff --git a/GSWeb.framework/GSWRadioButtonList.h b/GSWeb.framework/GSWRadioButtonList.h index 18e78f5..b0fcff2 100644 --- a/GSWeb.framework/GSWRadioButtonList.h +++ b/GSWeb.framework/GSWRadioButtonList.h @@ -1,11 +1,16 @@ -/* GSWRadioButtonList.h - GSWeb: Class GSWRadioButtonList - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWRadioButtonList.h - GSWeb: Class GSWRadioButtonList + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,21 +35,21 @@ @interface GSWRadioButtonList: GSWInput { - GSWAssociation* list; - GSWAssociation* item; - GSWAssociation* index; - GSWAssociation* selection; - GSWAssociation* prefix; - GSWAssociation* suffix; - GSWAssociation* displayString; - GSWAssociation* escapeHTML; - BOOL defaultEscapeHTML; - BOOL autoValue; + GSWAssociation* _list; + GSWAssociation* _item; + GSWAssociation* _index; + GSWAssociation* _selection; + GSWAssociation* _prefix; + GSWAssociation* _suffix; + GSWAssociation* _displayString; + GSWAssociation* _escapeHTML; + BOOL _defaultEscapeHTML; + BOOL _autoValue; }; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(void)dealloc; -(NSString*)description; @@ -54,23 +60,25 @@ //==================================================================== @interface GSWRadioButtonList (GSWRadioButtonListA) --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(void)_slowTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; + +-(void)_slowTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; + +-(void)_fastTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; @end //==================================================================== @interface GSWRadioButtonList (GSWRadioButtonListB) --(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping; --(BOOL)appendStringAtLeft:(id)_unkwnon - withMapping:(char*)_mapping; +-(BOOL)appendStringAtRight:(id)unkwnon + withMapping:(char*)mapping; +-(BOOL)appendStringAtLeft:(id)unkwnon + withMapping:(char*)mapping; -(BOOL)compactHTMLTags; @end diff --git a/GSWeb.framework/GSWRadioButtonList.m b/GSWeb.framework/GSWRadioButtonList.m index 747433d..3d98536 100644 --- a/GSWeb.framework/GSWRadioButtonList.m +++ b/GSWeb.framework/GSWRadioButtonList.m @@ -1,11 +1,16 @@ -/* GSWRadioButtonList.m - GSWeb: Class GSWRadioButtonList - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWRadioButtonList.m - GSWeb: Class GSWRadioButtonList + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,71 +35,72 @@ static char rcsId[] = "$Id$"; @implementation GSWRadioButtonList //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { //OK - NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; + NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations]; LOGObjectFnStart(); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_); - defaultEscapeHTML=1; - [_associations removeObjectForKey:list__Key]; - [_associations removeObjectForKey:item__Key]; - [_associations removeObjectForKey:index__Key]; - [_associations removeObjectForKey:selection__Key]; - [_associations removeObjectForKey:prefix__Key]; - [_associations removeObjectForKey:suffix__Key]; - [_associations removeObjectForKey:displayString__Key]; - [_associations removeObjectForKey:escapeHTML__Key]; - if ((self=[super initWithName:name_ - associations:_associations - contentElements:nil])) - { - list=[[associations_ objectForKey:list__Key - withDefaultObject:[list autorelease]] retain]; - item=[[associations_ objectForKey:item__Key - withDefaultObject:[item autorelease]] retain]; - if (item && ![item isValueSettable]) - { - ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable"); - }; - index=[[associations_ objectForKey:index__Key - withDefaultObject:[index autorelease]] retain]; - if (index && ![index isValueSettable]) - { - ExceptionRaise0(@"GSWCheckBox",@"'index' parameter must be settable"); - }; - - selection=[[associations_ objectForKey:selection__Key - withDefaultObject:[selection autorelease]] retain]; - if (![selection isValueSettable]) - { - ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable"); - }; - prefix=[[associations_ objectForKey:prefix__Key - withDefaultObject:[prefix autorelease]] retain]; - suffix=[[associations_ objectForKey:suffix__Key - withDefaultObject:[suffix autorelease]] retain]; - displayString=[[associations_ objectForKey:displayString__Key - withDefaultObject:[displayString autorelease]] retain]; - escapeHTML=[[associations_ objectForKey:escapeHTML__Key - withDefaultObject:[escapeHTML autorelease]] retain]; - }; + NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@", + aName,associations,elements); + _defaultEscapeHTML=1; + [tmpAssociations removeObjectForKey:list__Key]; + [tmpAssociations removeObjectForKey:item__Key]; + [tmpAssociations removeObjectForKey:index__Key]; + [tmpAssociations removeObjectForKey:selection__Key]; + [tmpAssociations removeObjectForKey:prefix__Key]; + [tmpAssociations removeObjectForKey:suffix__Key]; + [tmpAssociations removeObjectForKey:displayString__Key]; + [tmpAssociations removeObjectForKey:escapeHTML__Key]; + if ((self=[super initWithName:aName + associations:tmpAssociations + contentElements:nil])) + { + _list=[[associations objectForKey:list__Key + withDefaultObject:[_list autorelease]] retain]; + _item=[[associations objectForKey:item__Key + withDefaultObject:[_item autorelease]] retain]; + if (_item && ![_item isValueSettable]) + { + ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable"); + }; + _index=[[associations objectForKey:index__Key + withDefaultObject:[_index autorelease]] retain]; + if (_index && ![_index isValueSettable]) + { + ExceptionRaise0(@"GSWCheckBox",@"'index' parameter must be settable"); + }; + + _selection=[[associations objectForKey:selection__Key + withDefaultObject:[_selection autorelease]] retain]; + if (![_selection isValueSettable]) + { + ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable"); + }; + _prefix=[[associations objectForKey:prefix__Key + withDefaultObject:[_prefix autorelease]] retain]; + _suffix=[[associations objectForKey:suffix__Key + withDefaultObject:[_suffix autorelease]] retain]; + _displayString=[[associations objectForKey:displayString__Key + withDefaultObject:[_displayString autorelease]] retain]; + _escapeHTML=[[associations objectForKey:escapeHTML__Key + withDefaultObject:[_escapeHTML autorelease]] retain]; + }; return self; }; //----------------------------------------------------------------------------------- -(void)dealloc { - DESTROY(list); - DESTROY(item); - DESTROY(index); - DESTROY(selection); - DESTROY(prefix); - DESTROY(suffix); - DESTROY(displayString); - DESTROY(escapeHTML); + DESTROY(_list); + DESTROY(_item); + DESTROY(_index); + DESTROY(_selection); + DESTROY(_prefix); + DESTROY(_suffix); + DESTROY(_displayString); + DESTROY(_escapeHTML); [super dealloc]; } @@ -101,8 +108,8 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p>", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; //-------------------------------------------------------------------- @@ -117,117 +124,117 @@ static char rcsId[] = "$Id$"; @implementation GSWRadioButtonList (GSWRadioButtonListA) //----------------------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK LOGObjectFnStart(); - [self _slowTakeValuesFromRequest:request_ - inContext:context_]; + [self _slowTakeValuesFromRequest:request + inContext:context]; LOGObjectFnStop(); }; //----------------------------------------------------------------------------------- --(void)_slowTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)_slowTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK - BOOL _disabledInContext=NO; + BOOL disabledInContext=NO; LOGObjectFnStart(); [self resetAutoValue]; - _disabledInContext=[self disabledInContext:context_]; - if (!_disabledInContext) - { - if ([context_ _wasFormSubmitted]) - { - GSWComponent* _component=[context_ component]; - NSArray* _listValue=nil; - NSString* _name=nil; - int _foundIndex=-1; - id _formValue=nil; - id _valueValue=nil; - id _valueToSet=nil; - int i=0; - _name=[self nameInContext:context_]; - NSDebugMLLog(@"gswdync",@"_name=%@",_name); - _formValue=[request_ formValueForKey:_name]; - NSDebugMLLog(@"gswdync",@"_formValue=%@",_formValue); - _listValue=[list valueInComponent:_component]; - NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], - @"The list (%@) (%@ of class:%@) doesn't respond to 'count'", - list, - _listValue, - [_listValue class]); - NSDebugMLLog(@"gswdync",@"_listValue=%@",_listValue); - for(i=0;i<[_listValue count] && _foundIndex<0;i++) - { - NSDebugMLLog(@"gswdync",@"item=%@",item); - NSDebugMLLog(@"gswdync",@"index=%@",index); - if (item) - [item setValue:[_listValue objectAtIndex:i] - inComponent:_component]; - else if (index) - [index setValue:[NSNumber numberWithShort:i] - inComponent:_component]; - NSDebugMLLog(@"gswdync",@"value=%@",value); + disabledInContext=[self disabledInContext:context]; + if (!disabledInContext) + { + if ([context _wasFormSubmitted]) + { + GSWComponent* component=[context component]; + NSArray* listValue=nil; + NSString* name=nil; + int foundIndex=-1; + id formValue=nil; + id valueValue=nil; + id valueToSet=nil; + int i=0; + name=[self nameInContext:context]; + NSDebugMLLog(@"gswdync",@"name=%@",name); + formValue=[request formValueForKey:name]; + NSDebugMLLog(@"gswdync",@"formValue=%@",formValue); + listValue=[_list valueInComponent:component]; + NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)], + @"The list (%@) (%@ of class:%@) doesn't respond to 'count'", + _list, + listValue, + [listValue class]); + NSDebugMLLog(@"gswdync",@"listValue=%@",listValue); + for(i=0;i<[listValue count] && foundIndex<0;i++) + { + NSDebugMLLog(@"gswdync",@"item=%@",_item); + NSDebugMLLog(@"gswdync",@"index=%@",_index); + if (_item) + [_item setValue:[listValue objectAtIndex:i] + inComponent:component]; + else if (_index) + [_index setValue:[NSNumber numberWithShort:i] + inComponent:component]; + NSDebugMLLog(@"gswdync",@"value=%@",_value); - //TODOV - _valueValue=[self valueInContext:context_]; - NSDebugMLLog(@"gswdync",@"_valueValue=%@",_valueValue); - if (_valueValue) - { - BOOL _isEqual=SBIsValueEqual(_valueValue,_formValue); - NSDebugMLLog(@"gswdync",@"_isEqual=%s",(_isEqual ? "YES" : "NO")); - if (_isEqual) - { - if(autoValue == NO) - _valueToSet=_valueValue; - else - _valueToSet=[_listValue objectAtIndex:i]; - _foundIndex=i; - }; - }; - }; - NSDebugMLLog(@"gswdync",@"_component=%@",_component); - NSDebugMLLog(@"gswdync",@"_foundIndex=%d",_foundIndex); - NSDebugMLLog(@"gswdync",@"selection=%@",selection); - GSWLogAssertGood(_component); - if (!WOStrictFlag) + //TODOV + valueValue=[self valueInContext:context]; + NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue); + if (valueValue) + { + BOOL isEqual=SBIsValueEqual(valueValue,formValue); + NSDebugMLLog(@"gswdync",@"isEqual=%s",(isEqual ? "YES" : "NO")); + if (isEqual) { - NS_DURING - { - if (_foundIndex>=0) - [selection setValue:_valueToSet - inComponent:_component]; - else - [selection setValue:nil - inComponent:_component]; - }; - NS_HANDLER - { - [self handleValidationException:localException - inContext:context_]; - } - NS_ENDHANDLER; - } - else - { - if (_foundIndex>=0) - [selection setValue:_valueToSet - inComponent:_component]; + if(_autoValue == NO) + valueToSet=valueValue; else - [selection setValue:nil - inComponent:_component]; + valueToSet=[listValue objectAtIndex:i]; + foundIndex=i; }; - }; - }; + }; + }; + NSDebugMLLog(@"gswdync",@"component=%@",component); + NSDebugMLLog(@"gswdync",@"foundIndex=%d",foundIndex); + NSDebugMLLog(@"gswdync",@"selection=%@",_selection); + GSWLogAssertGood(component); + if (!WOStrictFlag) + { + NS_DURING + { + if (foundIndex>=0) + [_selection setValue:valueToSet + inComponent:component]; + else + [_selection setValue:nil + inComponent:component]; + }; + NS_HANDLER + { + [self handleValidationException:localException + inContext:context]; + } + NS_ENDHANDLER; + } + else + { + if (foundIndex>=0) + [_selection setValue:valueToSet + inComponent:component]; + else + [_selection setValue:nil + inComponent:component]; + }; + }; + }; LOGObjectFnStop(); }; //----------------------------------------------------------------------------------- --(void)_fastTakeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)_fastTakeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { LOGObjectFnStart(); LOGObjectFnNotImplemented(); //TODOFN @@ -235,65 +242,65 @@ static char rcsId[] = "$Id$"; }; //----------------------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - GSWRequest* _request=nil; - BOOL _isFromClientComponent=NO; - NSString* _name=nil; - GSWComponent* _component=nil; - NSArray* _listValue=nil; - id _selectionValue=nil; + GSWRequest* request=nil; + BOOL isFromClientComponent=NO; + NSString* name=nil; + GSWComponent* component=nil; + NSArray* listValue=nil; + id selectionValue=nil; int i=0; - id _displayStringValue=nil; - id _prefixValue=nil; - id _suffixValue=nil; - id _valueValue=nil; - BOOL _isEqual=NO; + id displayStringValue=nil; + id prefixValue=nil; + id suffixValue=nil; + id valueValue=nil; + BOOL isEqual=NO; LOGObjectFnStart(); [self resetAutoValue]; - autoValue = NO; - _request=[context_ request]; - _isFromClientComponent=[_request isFromClientComponent]; - _name=[self nameInContext:context_]; - _component=[context_ component]; - _selectionValue=[selection valueInComponent:_component]; - _listValue=[list valueInComponent:_component]; - NSAssert3(!_listValue || [_listValue respondsToSelector:@selector(count)], - @"The list (%@) (%@ of class:%@) doesn't respond to 'count'", - list, - _listValue, - [_listValue class]); - for(i=0;i<[_listValue count];i++) - { - [item setValue:[_listValue objectAtIndex:i] - inComponent:_component]; - _prefixValue=[prefix valueInComponent:_component]; - _suffixValue=[suffix valueInComponent:_component]; - [index setValue:[NSNumber numberWithShort:i] - inComponent:_component]; - _displayStringValue=[displayString valueInComponent:_component]; - [response_ appendContentString:@"']; - [response_ appendContentString:_prefixValue]; - [response_ appendContentHTMLString:_displayStringValue]; - [response_ appendContentString:_suffixValue]; + _autoValue = NO; + request=[context request]; + isFromClientComponent=[request isFromClientComponent]; + name=[self nameInContext:context]; + component=[context component]; + selectionValue=[_selection valueInComponent:component]; + listValue=[_list valueInComponent:component]; + NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)], + @"The list (%@) (%@ of class:%@) doesn't respond to 'count'", + _list, + listValue, + [listValue class]); + for(i=0;i<[listValue count];i++) + { + [_item setValue:[listValue objectAtIndex:i] + inComponent:component]; + prefixValue=[_prefix valueInComponent:component]; + suffixValue=[_suffix valueInComponent:component]; + [_index setValue:[NSNumber numberWithShort:i] + inComponent:component]; + displayStringValue=[_displayString valueInComponent:component]; + [response appendContentString:@"']; + [response appendContentString:prefixValue]; + [response appendContentHTMLString:displayStringValue]; + [response appendContentString:suffixValue]; }; LOGObjectFnStop(); }; @@ -302,15 +309,15 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWRadioButtonList (GSWRadioButtonListB) --(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping +-(BOOL)appendStringAtRight:(id)unkwnon + withMapping:(char*)mapping { LOGObjectFnNotImplemented(); //TODOFN return NO; }; --(BOOL)appendStringAtLeft:(id)_unkwnon - withMapping:(char*)_mapping +-(BOOL)appendStringAtLeft:(id)unkwnon + withMapping:(char*)mapping { LOGObjectFnNotImplemented(); //TODOFN return NO; diff --git a/GSWeb.framework/GSWResourceManager.h b/GSWeb.framework/GSWResourceManager.h index 06fe537..f198186 100644 --- a/GSWeb.framework/GSWResourceManager.h +++ b/GSWeb.framework/GSWResourceManager.h @@ -1,7 +1,7 @@ /* GSWResourceManager.h - GSWeb: Class GSWResourceManager - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 This file is part of the GNUstep Web Library. @@ -32,21 +32,21 @@ extern NSDictionary* globalMime; @interface GSWResourceManager : NSObject { @private - NSMutableDictionary* frameworkProjectBundlesCache; - NSMutableDictionary* appURLs; - NSMutableDictionary* frameworkURLs; - NSMutableDictionary* appPaths; - GSWMultiKeyDictionary* frameworkPaths; - NSMutableDictionary* urlValuedElementsData; + NSMutableDictionary* _frameworkProjectBundlesCache; + NSMutableDictionary* _appURLs; + NSMutableDictionary* _frameworkURLs; + NSMutableDictionary* _appPaths; + GSWMultiKeyDictionary* _frameworkPaths; + NSMutableDictionary* _urlValuedElementsData; NSMutableDictionary* _stringsTablesByFrameworkByLanguageByName;//NDFN NSMutableDictionary* _stringsTableArraysByFrameworkByLanguageByName;//NDFN -// NSMutableDictionary* frameworkPathsToFrameworksNames; - NSArray* frameworkClassPaths; - NSRecursiveLock* selfLock; +// NSMutableDictionary* _frameworkPathsToFrameworksNames; + NSArray* _frameworkClassPaths; + NSRecursiveLock* _selfLock; #ifndef NDEBUG - int selfLockn; + int _selfLockn; #endif - BOOL applicationRequiresJavaVirtualMachine; + BOOL _applicationRequiresJavaVirtualMachine; }; -(void)dealloc; @@ -55,84 +55,84 @@ extern NSDictionary* globalMime; -(void)_initFrameworkProjectBundles; //-(NSString*)frameworkNameForPath:(NSString*)path_; --(NSString*)pathForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; --(NSString*)urlForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ - request:(GSWRequest*)request_; +-(NSString*)pathForResourceNamed:(NSString*)name + inFramework:(NSString*)frameworkName + languages:(NSArray*)languages; +-(NSString*)urlForResourceNamed:(NSString*)name + inFramework:(NSString*)frameworkName + languages:(NSArray*)languages + request:(GSWRequest*)request; -(NSString*)stringForKey:(NSString*)key_ - inTableNamed:(NSString*)tableName_ - withDefaultValue:(NSString*)defaultValue_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; + inTableNamed:(NSString*)tableName + withDefaultValue:(NSString*)defaultValue_ + inFramework:(NSString*)frameworkName + languages:(NSArray*)languages; //NDFN --(NSDictionary*)stringsTableNamed:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; +-(NSDictionary*)stringsTableNamed:(NSString*)tableName + inFramework:(NSString*)frameworkName + languages:(NSArray*)languages; //NDFN --(NSArray*)stringsTableArrayNamed:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; - +-(NSArray*)stringsTableArrayNamed:(NSString*)tableName + inFramework:(NSString*)frameworkName + languages:(NSArray*)languages; + -(void)lock; -(void)unlock; --(NSString*)lockedStringForKey:(NSString*)_key - inTableNamed:(NSString*)_tableName - inFramework:(NSString*)_framework - languages:(NSArray*)languages_; +-(NSString*)lockedStringForKey:(NSString*)key + inTableNamed:(NSString*)tableName + inFramework:(NSString*)framework + languages:(NSArray*)languages; //NDFN --(NSDictionary*)lockedStringsTableNamed:(NSString*)_tableName - inFramework:(NSString*)_framework - languages:(NSArray*)languages_; +-(NSDictionary*)lockedStringsTableNamed:(NSString*)tableName + inFramework:(NSString*)framework + languages:(NSArray*)languages; //NDFN --(NSArray*)lockedStringsTableArrayNamed:(NSString*)_tableName - inFramework:(NSString*)_framework - languages:(NSArray*)languages_; +-(NSArray*)lockedStringsTableArrayNamed:(NSString*)tableName + inFramework:(NSString*)framework + languages:(NSArray*)languages; --(NSString*)lockedCachedStringForKey:(NSString*)key_ - inTableNamed:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_; +-(NSString*)lockedCachedStringForKey:(NSString*)key + inTableNamed:(NSString*)tableName + inFramework:(NSString*)frameworkName + language:(NSString*)language; --(NSDictionary*)lockedCachedStringsTableWithName:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_; +-(NSDictionary*)lockedCachedStringsTableWithName:(NSString*)tableName + inFramework:(NSString*)frameworkName + language:(NSString*)language; //NDFN --(NSArray*)lockedCachedStringsTableArrayWithName:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_; +-(NSArray*)lockedCachedStringsTableArrayWithName:(NSString*)tableName + inFramework:(NSString*)frameworkName + language:(NSString*)language; --(NSDictionary*)lockedStringsTableWithName:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_; +-(NSDictionary*)lockedStringsTableWithName:(NSString*)tableName + inFramework:(NSString*)frameworkName + language:(NSString*)language; //NDFN --(NSArray*)lockedStringsTableArrayWithName:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_; +-(NSArray*)lockedStringsTableArrayWithName:(NSString*)tableName + inFramework:(NSString*)frameworkName + language:(NSString*)language; --(NSString*)lockedUrlForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ - request:(GSWRequest*)_request; +-(NSString*)lockedUrlForResourceNamed:(NSString*)name + inFramework:(NSString*)frameworkName + languages:(NSArray*)languages_ + request:(GSWRequest*)request; --(NSString*)lockedCachedURLForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; +-(NSString*)lockedCachedURLForResourceNamed:(NSString*)name + inFramework:(NSString*)frameworkName + languages:(NSArray*)languages; --(NSString*)lockedPathForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; +-(NSString*)lockedPathForResourceNamed:(NSString*)name + inFramework:(NSString*)frameworkName + languages:(NSArray*)languages; --(GSWDeployedBundle*)lockedCachedBundleForFrameworkNamed:(NSString*)name_; +-(GSWDeployedBundle*)lockedCachedBundleForFrameworkNamed:(NSString*)name; @end //==================================================================== @@ -142,33 +142,33 @@ extern NSDictionary* globalMime; -(void)setURLValuedElementData:(GSWURLValuedElementData*)data_; --(void)setData:(NSData*)data_ - forKey:(NSString*)key_ - mimeType:(NSString*)type_ - session:(GSWSession*)session_; +-(void)setData:(NSData*)data + forKey:(NSString*)key + mimeType:(NSString*)type + session:(GSWSession*)session; --(void)removeDataForKey:(NSString*)key_ - session:(GSWSession*)session_; +-(void)removeDataForKey:(NSString*)key + session:(GSWSession*)session; @end //==================================================================== @interface GSWResourceManager (GSWResourceManagerA) --(NSString*)pathForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_; --(NSString*)lockedPathForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_; +-(NSString*)pathForResourceNamed:(NSString*)name + inFramework:(NSString*)frameworkName + language:(NSString*)language; +-(NSString*)lockedPathForResourceNamed:(NSString*)name + inFramework:(NSString*)frameworkName + language:(NSString*)language; -(GSWDeployedBundle*)_appProjectBundle; -(NSArray*)_allFrameworkProjectBundles; --(void)lockedRemoveDataForKey:(NSString*)key_; +-(void)lockedRemoveDataForKey:(NSString*)key; -(BOOL)_doesRequireJavaVirualMachine; --(NSString*)_absolutePathForJavaClassPath:(NSString*)path_; --(GSWURLValuedElementData*)_cachedDataForKey:(NSString*)key_; --(void)lockedCacheData:(GSWURLValuedElementData*)data_; --(NSString*)contentTypeForResourcePath:(NSString*)path_; +-(NSString*)_absolutePathForJavaClassPath:(NSString*)path; +-(GSWURLValuedElementData*)_cachedDataForKey:(NSString*)key; +-(void)lockedCacheData:(GSWURLValuedElementData*)data; +-(NSString*)contentTypeForResourcePath:(NSString*)path; -(NSArray*)_frameworkClassPaths; @end @@ -176,10 +176,10 @@ extern NSDictionary* globalMime; //==================================================================== @interface GSWResourceManager (GSWResourceManagerOldFn) --(NSString*)urlForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_; --(NSString*)pathForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_; +-(NSString*)urlForResourceNamed:(NSString*)name + inFramework:(NSString*)frameworkName; +-(NSString*)pathForResourceNamed:(NSString*)name + inFramework:(NSString*)frameworkName; @end @@ -190,10 +190,10 @@ extern NSDictionary* globalMime; //==================================================================== @interface GSWResourceManager (GSWResourceManagerClassA) -+(NSString*)GSLanguageFromISOLanguage:(NSString*)ISOLanguage_; //NDFN -+(NSArray*)GSLanguagesFromISOLanguages:(NSArray*)ISOLanguages_; //NDFN -+(NSString*)ISOLanguageFromGSLanguage:(NSString*)GSLanguage_; //NDFN -+(NSArray*)ISOLanguagesFromGSLanguages:(NSArray*)GSLanguages_; //NDFN ++(NSString*)GSLanguageFromISOLanguage:(NSString*)ISOLanguage; //NDFN ++(NSArray*)GSLanguagesFromISOLanguages:(NSArray*)ISOlanguages; //NDFN ++(NSString*)ISOLanguageFromGSLanguage:(NSString*)GSLanguage; //NDFN ++(NSArray*)ISOLanguagesFromGSLanguages:(NSArray*)GSlanguages; //NDFN +(GSWBundle*)_applicationGSWBundle; @end diff --git a/GSWeb.framework/GSWResourceManager.m b/GSWeb.framework/GSWResourceManager.m index a6033be..cb7e205 100644 --- a/GSWeb.framework/GSWResourceManager.m +++ b/GSWeb.framework/GSWResourceManager.m @@ -1,11 +1,17 @@ -/* GSWResourceManager.m - GSWeb: Class GSWResourceManager +/** GSWResourceManager.m - GSWeb: Class GSWResourceManager Copyright (C) 1999-2002 Free Software Foundation, Inc. Written by: Manuel Guesdon Date: Jan 1999 - This file is part of the GNUstep Web Library. + $Revision$ + $Date$ + + + This file is part of the GNUstep Web Library. + + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +25,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -41,31 +48,31 @@ NSString* localNotFoundMarker=@"NOTFOUND"; +(void)initialize { if (self==[GSWResourceManager class]) - { - NSBundle* _mainBundle=nil; - GSWDeployedBundle* _deployedBundle=nil; - GSWLogC("Start GSWResourceManager +initialize"); - if ((self=[[super superclass] initialize])) - { - NSString* _bundlePath=nil; - _mainBundle=[GSWApplication mainBundle]; - //NSDebugMLLog(@"resmanager",@"_mainBundle:%p",_mainBundle); - //NSDebugMLLog(@"resmanager",@"_mainBundle:%@",_mainBundle); - _bundlePath=[_mainBundle bundlePath]; - //NSDebugMLLog(@"resmanager",@"_bundlePath:%@",_bundlePath); - _deployedBundle=[GSWDeployedBundle bundleWithPath:_bundlePath]; - //NSDebugMLLog(@"resmanager",@"_deployedBundle:%@",_deployedBundle); + { + NSBundle* mainBundle=nil; + GSWDeployedBundle* deployedBundle=nil; + GSWLogC("Start GSWResourceManager +initialize"); + if ((self=[[super superclass] initialize])) + { + NSString* bundlePath=nil; + mainBundle=[GSWApplication mainBundle]; + //NSDebugMLLog(@"resmanager",@"mainBundle:%p",mainBundle); + //NSDebugMLLog(@"resmanager",@"mainBundle:%@",mainBundle); + bundlePath=[mainBundle bundlePath]; + //NSDebugMLLog(@"resmanager",@"bundlePath:%@",bundlePath); + deployedBundle=[GSWDeployedBundle bundleWithPath:bundlePath]; + //NSDebugMLLog(@"resmanager",@"deployedBundle:%@",deployedBundle); - globalAppProjectBundle=[[_deployedBundle projectBundle] retain]; - //NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle); - NSAssert(globalAppProjectBundle,@"no globalAppProjectBundle"); -// LOGDumpObject(globalAppProjectBundle,2); - //call _deployedBundle bundlePath - //call globalAppProjectBundle bundlePath - //call isDebuggingEnabled - }; - GSWLogC("Stop GSWResourceManager +init"); - }; + globalAppProjectBundle=[[deployedBundle projectBundle] retain]; + //NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle); + NSAssert(globalAppProjectBundle,@"no globalAppProjectBundle"); + // LOGDumpObject(globalAppProjectBundle,2); + //call deployedBundle bundlePath + //call globalAppProjectBundle bundlePath + //call isDebuggingEnabled + }; + GSWLogC("Stop GSWResourceManager +init"); + }; }; //-------------------------------------------------------------------- @@ -87,52 +94,52 @@ NSString* localNotFoundMarker=@"NOTFOUND"; { LOGObjectFnStart(); if ((self=[super init])) - { - //TODO - NSBundle* _mainBundle=[NSBundle mainBundle]; - NSArray* _allFrameworks=[NSBundle allFrameworks]; - int i=0; - NSString* _bundlePath=nil; - NSBundle* _bundle=nil; - NSDictionary* _infoDictionary=nil; - for(i=0;i<[_allFrameworks count];i++) - { - _bundle=[_allFrameworks objectAtIndex:i]; - _bundlePath=[_bundle bundlePath]; - NSDebugMLLog(@"resmanager",@"_bundlePath=%@",_bundlePath); - //So what ? - }; + { + //TODO + NSBundle* mainBundle=[NSBundle mainBundle]; + NSArray* allFrameworks=[NSBundle allFrameworks]; + int i=0; + NSString* bundlePath=nil; + NSBundle* bundle=nil; + NSDictionary* infoDictionary=nil; + for(i=0;i<[allFrameworks count];i++) + { + bundle=[allFrameworks objectAtIndex:i]; + bundlePath=[bundle bundlePath]; + NSDebugMLLog(@"resmanager",@"bundlePath=%@",bundlePath); + //So what ? + }; + + _selfLock=[NSRecursiveLock new]; + + [self _validateAPI]; + _frameworkProjectBundlesCache=[NSMutableDictionary new]; + _appURLs=[NSMutableDictionary new]; + _frameworkURLs=[NSMutableDictionary new]; + _appPaths=[NSMutableDictionary new]; + _frameworkPaths=[GSWMultiKeyDictionary new]; + _urlValuedElementsData=[NSMutableDictionary new]; + _stringsTablesByFrameworkByLanguageByName=[NSMutableDictionary new]; + _stringsTableArraysByFrameworkByLanguageByName=[NSMutableDictionary new]; + [self _initFrameworkProjectBundles]; + // _frameworkPathsToFrameworksNames=[NSMutableDictionary new]; - selfLock=[NSRecursiveLock new]; - - [self _validateAPI]; - frameworkProjectBundlesCache=[NSMutableDictionary new]; - appURLs=[NSMutableDictionary new]; - frameworkURLs=[NSMutableDictionary new]; - appPaths=[NSMutableDictionary new]; - frameworkPaths=[GSWMultiKeyDictionary new]; - urlValuedElementsData=[NSMutableDictionary new]; - _stringsTablesByFrameworkByLanguageByName=[NSMutableDictionary new]; - _stringsTableArraysByFrameworkByLanguageByName=[NSMutableDictionary new]; - [self _initFrameworkProjectBundles]; -// frameworkPathsToFrameworksNames=[NSMutableDictionary new]; - - _allFrameworks=[NSBundle allFrameworks]; - for(i=0;i<[_allFrameworks count];i++) - { - _bundle=[_allFrameworks objectAtIndex:i]; - _infoDictionary=[_bundle infoDictionary]; - //So what ? -/* - NSDebugMLLog(@"resmanager",@"****_bundlePath=%@",_bundlePath); - NSDebugMLLog(@"resmanager",@"****[_bundle bundleName]=%@",[_bundle bundleName]); - _bundlePath=[_bundle bundlePath]; - if ([_bundle bundleName]) - [frameworkPathsToFrameworksNames setObject:[_bundle bundleName] - forKey:_bundlePath]; -*/ - }; - }; + allFrameworks=[NSBundle allFrameworks]; + for(i=0;i<[allFrameworks count];i++) + { + bundle=[allFrameworks objectAtIndex:i]; + infoDictionary=[bundle infoDictionary]; + //So what ? + /* + NSDebugMLLog(@"resmanager",@"****bundlePath=%@",bundlePath); + NSDebugMLLog(@"resmanager",@"****[bundle bundleName]=%@",[bundle bundleName]); + bundlePath=[bundle bundlePath]; + if ([bundle bundleName]) + [_frameworkPathsToFrameworksNames setObject:[bundle bundleName] + forKey:bundlePath]; + */ + }; + }; LOGObjectFnStop(); return self; }; @@ -141,20 +148,20 @@ NSString* localNotFoundMarker=@"NOTFOUND"; -(void)dealloc { GSWLogC("Dealloc GSWResourceManager"); - GSWLogC("Dealloc GSWResourceManager: frameworkProjectBundlesCache"); - DESTROY(frameworkProjectBundlesCache); - GSWLogC("Dealloc GSWResourceManager: appURLs"); - DESTROY(appURLs); - DESTROY(frameworkURLs); - DESTROY(appPaths); - DESTROY(frameworkPaths); - DESTROY(urlValuedElementsData); + GSWLogC("Dealloc GSWResourceManager: _frameworkProjectBundlesCache"); + DESTROY(_frameworkProjectBundlesCache); + GSWLogC("Dealloc GSWResourceManager: _appURLs"); + DESTROY(_appURLs); + DESTROY(_frameworkURLs); + DESTROY(_appPaths); + DESTROY(_frameworkPaths); + DESTROY(_urlValuedElementsData); DESTROY(_stringsTablesByFrameworkByLanguageByName); DESTROY(_stringsTableArraysByFrameworkByLanguageByName); - DESTROY(frameworkClassPaths); -// DESTROY(frameworkPathsToFrameworksNames); - GSWLogC("Dealloc GSWResourceManager: selfLock"); - DESTROY(selfLock); + DESTROY(_frameworkClassPaths); +// DESTROY(_frameworkPathsToFrameworksNames); + GSWLogC("Dealloc GSWResourceManager: _selfLock"); + DESTROY(_selfLock); GSWLogC("Dealloc GSWResourceManager Super"); [super dealloc]; GSWLogC("End Dealloc GSWResourceManager"); @@ -163,94 +170,95 @@ NSString* localNotFoundMarker=@"NOTFOUND"; //-------------------------------------------------------------------- -(NSString*)description { - NSString* _dscr=nil; + NSString* dscr=nil; [self lock]; NS_DURING - { - _dscr=[NSString stringWithFormat:@"<%s %p - frameworkProjectBundlesCache:%p appURLs:%@ frameworkURLs:%@ appPaths:%@ frameworkPaths:%@ urlValuedElementsData:%@ frameworkClassPaths:%@>", - object_get_class_name(self), - (void*)self, - (void*)frameworkProjectBundlesCache, - appURLs, - frameworkURLs, - appPaths, - frameworkPaths, - urlValuedElementsData, - frameworkClassPaths]; - } + { + dscr=[NSString stringWithFormat:@"<%s %p - _frameworkProjectBundlesCache:%p _appURLs:%@ _frameworkURLs:%@ _appPaths:%@ _frameworkPaths:%@ _urlValuedElementsData:%@ _frameworkClassPaths:%@>", + object_get_class_name(self), + (void*)self, + (void*)_frameworkProjectBundlesCache, + _appURLs, + _frameworkURLs, + _appPaths, + _frameworkPaths, + _urlValuedElementsData, + _frameworkClassPaths]; + } NS_HANDLER - { - NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; - return _dscr; + return dscr; }; //-------------------------------------------------------------------- -(void)_initFrameworkProjectBundles { //OK - NSArray* _allFrameworks=nil; + NSArray* allFrameworks=nil; int i=0; - NSBundle* _bundle=nil; - NSString* _frameworkName=nil; + NSBundle* bundle=nil; + NSString* frameworkName=nil; LOGObjectFnStart(); NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle); - _allFrameworks=[NSBundle allFrameworks]; + allFrameworks=[NSBundle allFrameworks]; NSDebugMLLog(@"resmanager",@"allBundles=%@",[NSBundle allBundles]); - NSDebugMLLog(@"resmanager",@"_allFrameworks=%@",_allFrameworks); - for(i=0;i<[_allFrameworks count];i++) - { - _bundle=[_allFrameworks objectAtIndex:i]; - NSDebugMLLog(@"resmanager",@"_bundle=%@",_bundle); - _frameworkName=[_bundle bundleName]; - NSDebugMLLog(@"resmanager",@"_frameworkName=%@",_frameworkName); - [self lockedCachedBundleForFrameworkNamed:_frameworkName]; - }; + NSDebugMLLog(@"resmanager",@"allFrameworks=%@",allFrameworks); + for(i=0;i<[allFrameworks count];i++) + { + bundle=[allFrameworks objectAtIndex:i]; + NSDebugMLLog(@"resmanager",@"bundle=%@",bundle); + frameworkName=[bundle bundleName]; + NSDebugMLLog(@"resmanager",@"frameworkName=%@",frameworkName); + [self lockedCachedBundleForFrameworkNamed:frameworkName]; + }; LOGObjectFnStop(); }; /* //-------------------------------------------------------------------- --(NSString*)frameworkNameForPath:(NSString*)path_ +-(NSString*)frameworkNameForPath:(NSString*)aPath { NSString* _name=nil; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"path_=%@",path_); + NSDebugMLLog(@"resmanager",@"aPath=%@",aPath); [self lock]; NS_DURING { - NSDebugMLLog(@"resmanager",@"frameworkPathsToFrameworksNames=%@",frameworkPathsToFrameworksNames); - _name=[frameworkPathsToFrameworksNames objectForKey:path_]; + NSDebugMLLog(@"resmanager",@"_frameworkPathsToFrameworksNames=%@",_frameworkPathsToFrameworksNames); + _name=[_frameworkPathsToFrameworksNames objectForKey:aPath]; NSDebugMLLog(@"resmanager",@"_name=%@",_name); if (!_name) { - NSArray* _allFrameworks=[NSBundle allFrameworks]; - NSString* _bundlePath=nil; - NSBundle* _bundle=nil; + NSArray* allFrameworks=[NSBundle allFrameworks]; + NSString* bundlePath=nil; + NSBundle* bundle=nil; int i=0; - for(i=0;i<[_allFrameworks count];i++) + for(i=0;i<[allFrameworks count];i++) { - _bundle=[_allFrameworks objectAtIndex:i]; - _bundlePath=[_bundle bundlePath]; - if (![frameworkPathsToFrameworksNames objectForKey:_bundlePath]) + bundle=[allFrameworks objectAtIndex:i]; + bundlePath=[bundle bundlePath]; + if (![_frameworkPathsToFrameworksNames objectForKey:bundlePath]) { - NSDebugMLLog(@"resmanager",@"****_bundlePath=%@",_bundlePath); - NSDebugMLLog(@"resmanager",@"****[_bundle bundleName]=%@",[_bundle bundleName]); - if ([_bundle bundleName]) - [frameworkPathsToFrameworksNames setObject:[_bundle bundleName] - forKey:_bundlePath]; + NSDebugMLLog(@"resmanager",@"****bundlePath=%@",bundlePath); + NSDebugMLLog(@"resmanager",@"****[bundle bundleName]=%@",[bundle bundleName]); + if ([bundle bundleName]) + [_frameworkPathsToFrameworksNames setObject:[bundle bundleName] + forKey:bundlePath]; else { - NSDebugMLLog(@"resmanager",@"no name for bundle %@",_bundle); + NSDebugMLLog(@"resmanager",@"no name for bundle %@",bundle); }; }; }; - NSDebugMLLog(@"resmanager",@"frameworkPathsToFrameworksNames=%@",frameworkPathsToFrameworksNames); - _name=[frameworkPathsToFrameworksNames objectForKey:path_]; + NSDebugMLLog(@"resmanager",@"_frameworkPathsToFrameworksNames=%@",_frameworkPathsToFrameworksNames); + _name=[_frameworkPathsToFrameworksNames objectForKey:aPath]; NSDebugMLLog(@"resmanager",@"_name=%@",_name); }; } @@ -269,116 +277,20 @@ NSString* localNotFoundMarker=@"NOTFOUND"; }; */ //-------------------------------------------------------------------- --(NSString*)pathForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ +-(NSString*)pathForResourceNamed:(NSString*)resourceName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages { //OK - NSString* _path=nil; + NSString* path=nil; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"name_=%@ frameworkName_=%@ languages_=%@",name_,frameworkName_,languages_); - [self lock]; - NS_DURING - { - _path=[self lockedPathForResourceNamed:name_ - inFramework:frameworkName_ - languages:languages_]; - } - NS_HANDLER - { - NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } - NS_ENDHANDLER; - [self unlock]; - LOGObjectFnStop(); - return _path; -}; - -//-------------------------------------------------------------------- --(NSString*)urlForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ - request:(GSWRequest*)request_ -{ - //OK - NSString* _url=nil; - LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"name_=%@ frameworkName_=%@ languages_=%@ request_=%@",name_,frameworkName_,languages_,request_); -// NSDebugMLLog(@"resmanager",@"[frameworkProjectBundlesCache count]=%d",[frameworkProjectBundlesCache count]); -// NSDebugMLLog(@"resmanager",@"frameworkProjectBundlesCache=%@",frameworkProjectBundlesCache); - [self lock]; - NS_DURING - { - _url=[self lockedUrlForResourceNamed:name_ - inFramework:frameworkName_ - languages:languages_ - request:request_]; - } - NS_HANDLER - { - NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } - NS_ENDHANDLER; - [self unlock]; -// NSDebugMLLog(@"resmanager",@"[frameworkProjectBundlesCache count]=%d",[frameworkProjectBundlesCache count]); -// NSDebugMLLog(@"resmanager",@"frameworkProjectBundlesCache=%@",frameworkProjectBundlesCache); - LOGObjectFnStop(); - return _url; -}; - -//-------------------------------------------------------------------- --(NSString*)stringForKey:(NSString*)key_ - inTableNamed:(NSString*)tableName_ - withDefaultValue:(NSString*)defaultValue_ - inFramework:(NSString*)framework_ - languages:(NSArray*)languages_ -{ - NSString* _string=nil; - LOGObjectFnStart(); - [self lock]; - NS_DURING - { - _string=[self lockedStringForKey:key_ - inTableNamed:tableName_ - inFramework:framework_ - languages:languages_]; - } - NS_HANDLER - { - NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } - NS_ENDHANDLER; - [self unlock]; - if (!_string) - _string=defaultValue_; - LOGObjectFnStop(); - return _string; -}; - -//-------------------------------------------------------------------- -//NDFN --(NSDictionary*)stringsTableNamed:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; -{ - NSDictionary* _stringsTable=nil; - LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"tableName=%@ frameworkName=%@",tableName_,frameworkName_); + NSDebugMLLog(@"resmanager",@"resourceName=%@ aFrameworkName=%@ languages=%@",resourceName,aFrameworkName,languages); [self lock]; NS_DURING { - _stringsTable=[self lockedStringsTableNamed:tableName_ - inFramework:frameworkName_ - languages:languages_]; + path=[self lockedPathForResourceNamed:resourceName + inFramework:aFrameworkName + languages:languages]; } NS_HANDLER { @@ -390,28 +302,99 @@ NSString* localNotFoundMarker=@"NOTFOUND"; NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); - return _stringsTable; + return path; +}; + +//-------------------------------------------------------------------- +-(NSString*)urlForResourceNamed:(NSString*)name + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages + request:(GSWRequest*)request +{ + //OK + NSString* url=nil; + LOGObjectFnStart(); + NSDebugMLLog(@"resmanager",@"name=%@ aFrameworkName=%@ languages=%@ request=%@", + name,aFrameworkName,languages,request); +// NSDebugMLLog(@"resmanager",@"[_frameworkProjectBundlesCache count]=%d",[_frameworkProjectBundlesCache count]); +// NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache); + [self lock]; + NS_DURING + { + url=[self lockedUrlForResourceNamed:name + inFramework:aFrameworkName + languages:languages + request:request]; + } + NS_HANDLER + { + NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } + NS_ENDHANDLER; + [self unlock]; +// NSDebugMLLog(@"resmanager",@"[_frameworkProjectBundlesCache count]=%d",[_frameworkProjectBundlesCache count]); +// NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache); + LOGObjectFnStop(); + return url; +}; + +//-------------------------------------------------------------------- +-(NSString*)stringForKey:(NSString*)key + inTableNamed:(NSString*)tableName + withDefaultValue:(NSString*)defaultValue + inFramework:(NSString*)framework + languages:(NSArray*)languages +{ + NSString* string=nil; + LOGObjectFnStart(); + [self lock]; + NS_DURING + { + string=[self lockedStringForKey:key + inTableNamed:tableName + inFramework:framework + languages:languages]; + } + NS_HANDLER + { + NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } + NS_ENDHANDLER; + [self unlock]; + if (!string) + string=defaultValue; + LOGObjectFnStop(); + return string; }; //-------------------------------------------------------------------- //NDFN --(NSArray*)stringsTableArrayNamed:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; +-(NSDictionary*)stringsTableNamed:(NSString*)tableName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages; { - NSArray* _stringsTableArray=nil; + NSDictionary* stringsTable=nil; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"tableName=%@ frameworkName=%@",tableName_,frameworkName_); + NSDebugMLLog(@"resmanager",@"tableName=%@ frameworkName=%@",tableName,aFrameworkName); [self lock]; NS_DURING { - _stringsTableArray=[self lockedStringsTableArrayNamed:tableName_ - inFramework:frameworkName_ - languages:languages_]; + stringsTable=[self lockedStringsTableNamed:tableName + inFramework:aFrameworkName + languages:languages]; } NS_HANDLER { - NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); + NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); //TODO [self unlock]; [localException raise]; @@ -419,19 +402,49 @@ NSString* localNotFoundMarker=@"NOTFOUND"; NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); - return _stringsTableArray; + return stringsTable; +}; + +//-------------------------------------------------------------------- +//NDFN +-(NSArray*)stringsTableArrayNamed:(NSString*)tableName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages +{ + NSArray* stringsTableArray=nil; + LOGObjectFnStart(); + NSDebugMLLog(@"resmanager",@"tableName=%@ frameworkName=%@",tableName,aFrameworkName); + [self lock]; + NS_DURING + { + stringsTableArray=[self lockedStringsTableArrayNamed:tableName + inFramework:aFrameworkName + languages:languages]; + } + NS_HANDLER + { + NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } + NS_ENDHANDLER; + [self unlock]; + LOGObjectFnStop(); + return stringsTableArray; }; //-------------------------------------------------------------------- -(void)unlock { LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"selfLockn=%d",selfLockn); - TmpUnlock(selfLock); + NSDebugMLLog(@"resmanager",@"_selfLockn=%d",_selfLockn); + TmpUnlock(_selfLock); #ifndef NDEBUG - selfLockn--; + _selfLockn--; #endif - NSDebugMLLog(@"resmanager",@"selfLockn=%d",selfLockn); + NSDebugMLLog(@"resmanager",@"_selfLockn=%d",_selfLockn); LOGObjectFnStop(); }; @@ -439,673 +452,689 @@ NSString* localNotFoundMarker=@"NOTFOUND"; -(void)lock { LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"selfLockn=%d",selfLockn); - TmpLockBeforeDate(selfLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]); + NSDebugMLLog(@"resmanager",@"_selfLockn=%d",_selfLockn); + TmpLockBeforeDate(_selfLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]); #ifndef NDEBUG - selfLockn++; + _selfLockn++; #endif - NSDebugMLLog(@"resmanager",@"selfLockn=%d",selfLockn); + NSDebugMLLog(@"resmanager",@"_selfLockn=%d",_selfLockn); LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(NSString*)lockedStringForKey:(NSString*)key_ - inTableNamed:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ +-(NSString*)lockedStringForKey:(NSString*)aKey + inTableNamed:(NSString*)aTableName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages { //OK - NSString* _string=nil; - NSString* _language=nil; + NSString* string=nil; + NSString* language=nil; int i=0; int _count=0; int iFramework=0; - NSArray* _frameworks=nil; - NSString* _frameworkName=nil; + NSArray* frameworks=nil; + NSString* frameworkName=nil; LOGObjectFnStart(); - if (!WOStrictFlag && [frameworkName_ isEqualToString:GSWFramework_all]) + if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all]) { - _frameworks=[frameworkProjectBundlesCache allKeys]; - _frameworks=[_frameworks arrayByAddingObject:@""]; + frameworks=[_frameworkProjectBundlesCache allKeys]; + frameworks=[frameworks arrayByAddingObject:@""]; } - _count=[languages_ count]; - NSDebugMLLog(@"resmanager",@"languages_=%@",languages_); - NSDebugMLLog(@"resmanager",@"_frameworks=%@",_frameworks); - for(i=0;!_string && i<=_count;i++) + _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]; + language=[languages objectAtIndex:i]; else - _language=nil; - for(iFramework=0;!_string && iFramework<[_frameworks count];iFramework++) + language=nil; + for(iFramework=0;!string && iFramework<[frameworks count];iFramework++) { - _frameworkName=[_frameworks objectAtIndex:iFramework]; - if ([_frameworkName length]==0) - _frameworkName=nil; - _string=[self lockedCachedStringForKey:key_ - inTableNamed:tableName_ - inFramework:_frameworkName - language:_language]; + frameworkName=[frameworks objectAtIndex:iFramework]; + if ([frameworkName length]==0) + frameworkName=nil; + string=[self lockedCachedStringForKey:aKey + inTableNamed:aTableName + inFramework:frameworkName + language:language]; }; }; LOGObjectFnStop(); - return _string; + return string; }; //-------------------------------------------------------------------- //NDFN --(NSDictionary*)lockedStringsTableNamed:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ +-(NSDictionary*)lockedStringsTableNamed:(NSString*)aTableName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages { //OK - NSDictionary* _stringsTable=nil; - NSString* _language=nil; + NSDictionary* stringsTable=nil; + NSString* language=nil; int i=0; int _count=0; int iFramework=0; - NSArray* _frameworks=nil; - NSString* _frameworkName=nil; + NSArray* frameworks=nil; + NSString* frameworkName=nil; LOGObjectFnStart(); - _count=[languages_ count]; - if (!WOStrictFlag && [frameworkName_ isEqualToString:GSWFramework_all]) + _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:frameworkName_ ? frameworkName_ : @""]; - for(i=0;!_stringsTable && i<_count;i++) + frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""]; + for(i=0;!stringsTable && i<_count;i++) { - _language=[languages_ objectAtIndex:i]; - for(iFramework=0;!_stringsTable && iFramework<[_frameworks count];iFramework++) + 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:tableName_ - inFramework:_frameworkName - language:_language]; + frameworkName=[frameworks objectAtIndex:iFramework]; + if ([frameworkName length]==0) + frameworkName=nil; + stringsTable=[self lockedCachedStringsTableWithName:aTableName + inFramework:frameworkName + language:language]; }; }; NSDebugMLLog(@"resmanager",@"lockedStringsTableNamed:%@ inFramework:%@ languages:%@: %@", - tableName_, - frameworkName_, - languages_, - _stringsTable); + aTableName, + aFrameworkName, + languages, + stringsTable); LOGObjectFnStop(); - return _stringsTable; + return stringsTable; }; //-------------------------------------------------------------------- //NDFN --(NSArray*)lockedStringsTableArrayNamed:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ +-(NSArray*)lockedStringsTableArrayNamed:(NSString*)aTableName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages { //OK - NSArray* _stringsTableArray=nil; - NSString* _language=nil; + NSArray* stringsTableArray=nil; + NSString* language=nil; int i=0; int _count=0; int iFramework=0; - NSArray* _frameworks=nil; - NSString* _frameworkName=nil; + NSArray* frameworks=nil; + NSString* frameworkName=nil; LOGObjectFnStart(); - _count=[languages_ count]; - if (!WOStrictFlag && [frameworkName_ isEqualToString:GSWFramework_all]) + _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:frameworkName_ ? frameworkName_ : @""]; - for(i=0;!_stringsTableArray && i<_count;i++) + frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""]; + for(i=0;!stringsTableArray && i<_count;i++) { - _language=[languages_ objectAtIndex:i]; - for(iFramework=0;!_stringsTableArray && iFramework<[_frameworks count];iFramework++) + 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:tableName_ - inFramework:_frameworkName - language:_language]; + frameworkName=[frameworks objectAtIndex:iFramework]; + if ([frameworkName length]==0) + frameworkName=nil; + stringsTableArray=[self lockedCachedStringsTableArrayWithName:aTableName + inFramework:frameworkName + language:language]; }; }; LOGObjectFnStop(); - return _stringsTableArray; + return stringsTableArray; }; //-------------------------------------------------------------------- --(NSString*)lockedCachedStringForKey:(NSString*)key_ - inTableNamed:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_ +-(NSString*)lockedCachedStringForKey:(NSString*)aKey + inTableNamed:(NSString*)aTableName + inFramework:(NSString*)aFrameworkName + language:(NSString*)aLanguage { //OK - NSString* _string=nil; - NSDictionary* _stringsTable=nil; + NSString* string=nil; + NSDictionary* stringsTable=nil; LOGObjectFnStart(); - _stringsTable=[self lockedCachedStringsTableWithName:tableName_ - inFramework:frameworkName_ - language:language_]; - if (_stringsTable) - _string=[_stringsTable objectForKey:key_]; + stringsTable=[self lockedCachedStringsTableWithName:aTableName + inFramework:aFrameworkName + language:aLanguage]; + if (stringsTable) + string=[stringsTable objectForKey:aKey]; LOGObjectFnStop(); - return _string; + return string; }; //-------------------------------------------------------------------- --(NSDictionary*)lockedCachedStringsTableWithName:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_ +-(NSDictionary*)lockedCachedStringsTableWithName:(NSString*)aTableName + inFramework:(NSString*)aFrameworkName + language:(NSString*)aLanguage { //OK - NSDictionary* _stringsTable=nil; + NSDictionary* stringsTable=nil; LOGObjectFnStart(); - _stringsTable=[[[_stringsTablesByFrameworkByLanguageByName objectForKey:frameworkName_] - objectForKey:language_] - objectForKey:tableName_]; - if (!_stringsTable) - _stringsTable=[self lockedStringsTableWithName:tableName_ - inFramework:frameworkName_ - language:language_]; - else if (_stringsTable==localNotFoundMarker) - _stringsTable=nil; + stringsTable=[[[_stringsTablesByFrameworkByLanguageByName objectForKey:aFrameworkName] + objectForKey:aLanguage] + objectForKey:aTableName]; + if (!stringsTable) + stringsTable=[self lockedStringsTableWithName:aTableName + inFramework:aFrameworkName + language:aLanguage]; + else if (stringsTable==localNotFoundMarker) + stringsTable=nil; NSDebugMLLog(@"resmanager",@"lockedCachedStringsTableNamed:%@ inFramework:%@ language:%@: %@", - tableName_, - frameworkName_, - language_, - _stringsTable); + aTableName, + aFrameworkName, + aLanguage, + stringsTable); LOGObjectFnStop(); - return _stringsTable; + return stringsTable; }; //-------------------------------------------------------------------- //NDFN --(NSArray*)lockedCachedStringsTableArrayWithName:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_ +-(NSArray*)lockedCachedStringsTableArrayWithName:(NSString*)aTableName + inFramework:(NSString*)aFrameworkName + language:(NSString*)aLanguage { //OK - NSArray* _stringsTableArray=nil; + NSArray* stringsTableArray=nil; LOGObjectFnStart(); - _stringsTableArray=[[[_stringsTableArraysByFrameworkByLanguageByName objectForKey:frameworkName_] - objectForKey:language_] - objectForKey:tableName_]; - if (!_stringsTableArray) - _stringsTableArray=[self lockedStringsTableArrayWithName:tableName_ - inFramework:frameworkName_ - language:language_]; - else if (_stringsTableArray==localNotFoundMarker) - _stringsTableArray=nil; + stringsTableArray=[[[_stringsTableArraysByFrameworkByLanguageByName objectForKey:aFrameworkName] + objectForKey:aLanguage] + objectForKey:aTableName]; + if (!stringsTableArray) + stringsTableArray=[self lockedStringsTableArrayWithName:aTableName + inFramework:aFrameworkName + language:aLanguage]; + else if (stringsTableArray==localNotFoundMarker) + stringsTableArray=nil; LOGObjectFnStop(); - return _stringsTableArray; + return stringsTableArray; }; //-------------------------------------------------------------------- --(NSDictionary*)lockedStringsTableWithName:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_ +-(NSDictionary*)lockedStringsTableWithName:(NSString*)aTableName + inFramework:(NSString*)aFrameworkName + language:(NSString*)aLanguage { //OK - NSDictionary* _stringsTable=nil; - NSString* _relativePath=nil; - NSString* _path=nil; - GSWDeployedBundle* _bundle=nil; - NSString* _resourceName=nil; + NSDictionary* stringsTable=nil; + NSString* relativePath=nil; + NSString* path=nil; + GSWDeployedBundle* bundle=nil; + NSString* resourceName=nil; int i=0; - NSArray* _frameworks=nil; - NSString* _frameworkName=nil; + NSArray* frameworks=nil; + NSString* frameworkName=nil; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"tableName_=%@ frameworkName_=%@ language_=%@",tableName_,frameworkName_,language_); - _resourceName=[tableName_ stringByAppendingString:GSWStringTablePSuffix]; - if (!WOStrictFlag && [frameworkName_ isEqualToString:GSWFramework_all]) + NSDebugMLLog(@"resmanager",@"aTableName=%@ aFrameworkName=%@ aLanguage=%@", + aTableName,aFrameworkName,aLanguage); + resourceName=[aTableName stringByAppendingString:GSWStringTablePSuffix]; + if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all]) { - _frameworks=[frameworkProjectBundlesCache allKeys]; - _frameworks=[_frameworks arrayByAddingObject:@""]; + frameworks=[_frameworkProjectBundlesCache allKeys]; + frameworks=[frameworks arrayByAddingObject:@""]; } else - _frameworks=[NSArray arrayWithObject:frameworkName_ ? frameworkName_ : @""]; + frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""]; - for(i=0;!_path && i<[_frameworks count];i++) - { - _frameworkName=[_frameworks objectAtIndex:i]; - if ([_frameworkName length]==0) - _frameworkName=nil; - if (_frameworkName) - { -// NSDebugMLLog(@"resmanager",@"frameworkName=%@",frameworkName_); - _bundle=[self lockedCachedBundleForFrameworkNamed:_frameworkName]; - if (_bundle) - { -// NSDebugMLLog(@"resmanager",@"found cached bundle=%@",_bundle); - _relativePath=[_bundle relativePathForResourceNamed:_resourceName - forLanguage:language_]; -// NSDebugMLLog(@"resmanager",@"_relativePath=%@",_relativePath); - if (_relativePath) - { - _path=[[_bundle bundlePath] stringByAppendingPathComponent:_relativePath]; - }; - }; - } - else - { -// NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle); - _relativePath=[globalAppProjectBundle relativePathForResourceNamed:_resourceName - forLanguage:language_]; -// NSDebugMLLog(@"resmanager",@"_relativePath=%@",_relativePath); - if (_relativePath) - { - NSString* _applicationPath=[GSWApp path]; - _path=[_applicationPath stringByAppendingPathComponent:_relativePath]; - }; - }; - }; -// NSDebugMLLog(@"resmanager",@"_path=%@",_path); - if (_path) + for(i=0;!path && i<[frameworks count];i++) + { + frameworkName=[frameworks objectAtIndex:i]; + if ([frameworkName length]==0) + frameworkName=nil; + if (frameworkName) + { + // NSDebugMLLog(@"resmanager",@"frameworkName=%@",aFrameworkName); + bundle=[self lockedCachedBundleForFrameworkNamed:frameworkName]; + if (bundle) + { + // NSDebugMLLog(@"resmanager",@"found cached bundle=%@",bundle); + relativePath=[bundle relativePathForResourceNamed:resourceName + forLanguage:aLanguage]; + // NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath); + if (relativePath) + { + path=[[bundle bundlePath] stringByAppendingPathComponent:relativePath]; + }; + }; + } + else + { + // NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle); + relativePath=[globalAppProjectBundle relativePathForResourceNamed:resourceName + forLanguage:aLanguage]; + // NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath); + if (relativePath) + { + NSString* applicationPath=[GSWApp path]; + path=[applicationPath stringByAppendingPathComponent:relativePath]; + }; + }; + }; +// NSDebugMLLog(@"resmanager",@"path=%@",path); + if (path) { //TODO use encoding ?? - _stringsTable=[NSDictionary dictionaryWithContentsOfFile:_path]; - if (!_stringsTable) + stringsTable=[NSDictionary dictionaryWithContentsOfFile:path]; + if (!stringsTable) { - NSString* _tmpString=[NSString stringWithContentsOfFile:_path]; + NSString* tmpString=[NSString stringWithContentsOfFile:path]; LOGSeriousError(@"Bad stringTable \n%@\n from file %@", - _tmpString, - _path); + tmpString, + path); }; }; { - NSMutableDictionary* frameworkDict=[_stringsTablesByFrameworkByLanguageByName objectForKey:frameworkName_]; + NSMutableDictionary* frameworkDict=[_stringsTablesByFrameworkByLanguageByName objectForKey:aFrameworkName]; NSMutableDictionary* languageDict=nil; if (!frameworkDict) { frameworkDict=[NSMutableDictionary dictionary]; + if (!aFrameworkName) + aFrameworkName=@"";//Global [_stringsTablesByFrameworkByLanguageByName setObject:frameworkDict - forKey:frameworkName_]; + forKey:aFrameworkName]; }; - languageDict=[frameworkDict objectForKey:language_]; + languageDict=[frameworkDict objectForKey:aLanguage]; if (!languageDict) { languageDict=[NSMutableDictionary dictionary]; + if (!aLanguage) + aLanguage=@""; [frameworkDict setObject:languageDict - forKey:language_]; + forKey:aLanguage]; }; - if (_stringsTable) - [languageDict setObject:_stringsTable - forKey:tableName_]; + NSAssert(aTableName,@"No tableName"); + if (stringsTable) + [languageDict setObject:stringsTable + forKey:aTableName]; else [languageDict setObject:localNotFoundMarker - forKey:tableName_]; + forKey:aTableName]; } NSDebugMLLog(@"resmanager",@"lockedStringsTableWithName:%@ inFramework:%@ language:%@: %sFOUND", - tableName_, - frameworkName_, - language_, - (_stringsTable ? "" : "NOT ")); + aTableName, + aFrameworkName, + aLanguage, + (stringsTable ? "" : "NOT ")); LOGObjectFnStop(); - return _stringsTable; + return stringsTable; }; //-------------------------------------------------------------------- //NDFN --(NSArray*)lockedStringsTableArrayWithName:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_ +-(NSArray*)lockedStringsTableArrayWithName:(NSString*)aTableName + inFramework:(NSString*)aFrameworkName + language:(NSString*)aLanguage { //OK - NSArray* _stringsTableArray=nil; - NSString* _relativePath=nil; - NSString* _path=nil; - GSWDeployedBundle* _bundle=nil; - NSString* _resourceName=nil; + NSArray* stringsTableArray=nil; + NSString* relativePath=nil; + NSString* path=nil; + GSWDeployedBundle* bundle=nil; + NSString* resourceName=nil; int i=0; - NSArray* _frameworks=nil; - NSString* _frameworkName=nil; + NSArray* frameworks=nil; + NSString* frameworkName=nil; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"tableName_=%@ frameworkName_=%@ language_=%@",tableName_,frameworkName_,language_); - _resourceName=[tableName_ stringByAppendingString:GSWStringTableArrayPSuffix]; - if (!WOStrictFlag && [frameworkName_ isEqualToString:GSWFramework_all]) - { - _frameworks=[frameworkProjectBundlesCache allKeys]; - _frameworks=[_frameworks arrayByAddingObject:@""]; - } + NSDebugMLLog(@"resmanager",@"aTableName=%@ aFrameworkName=%@ aLanguage=%@",aTableName,aFrameworkName,aLanguage); + resourceName=[aTableName stringByAppendingString:GSWStringTableArrayPSuffix]; + if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all]) + { + frameworks=[_frameworkProjectBundlesCache allKeys]; + frameworks=[frameworks arrayByAddingObject:@""]; + } else - _frameworks=[NSArray arrayWithObject:frameworkName_ ? frameworkName_ : @""]; - - for(i=0;!_path && i<[_frameworks count];i++) - { - _frameworkName=[_frameworks objectAtIndex:i]; - if ([_frameworkName length]==0) - _frameworkName=nil; - - if (_frameworkName) - { -// NSDebugMLLog(@"resmanager",@"frameworkName=%@",frameworkName_); - _bundle=[self lockedCachedBundleForFrameworkNamed:_frameworkName]; - if (_bundle) - { -// NSDebugMLLog(@"resmanager",@"found cached bundle=%@",_bundle); - _relativePath=[_bundle relativePathForResourceNamed:_resourceName - forLanguage:language_]; -// NSDebugMLLog(@"resmanager",@"_relativePath=%@",_relativePath); - if (_relativePath) - { - _path=[[_bundle bundlePath] stringByAppendingPathComponent:_relativePath]; - }; - }; - } - else - { -// NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle); - _relativePath=[globalAppProjectBundle relativePathForResourceNamed:_resourceName - forLanguage:language_]; -// NSDebugMLLog(@"resmanager",@"_relativePath=%@",_relativePath); - if (_relativePath) - { - NSString* _applicationPath=[GSWApp path]; - _path=[_applicationPath stringByAppendingPathComponent:_relativePath]; - }; - }; - }; -// NSDebugMLLog(@"resmanager",@"_path=%@",_path); - if (_path) - { - //TODO use encoding ?? - _stringsTableArray=[NSArray arrayWithContentsOfFile:_path]; - if (!_stringsTableArray) - { - NSString* _tmpString=[NSString stringWithContentsOfFile:_path]; - LOGSeriousError(@"Bad stringTableArray \n%@\n from file %@", - _tmpString, - _path); - }; - }; + frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""]; + + for(i=0;!path && i<[frameworks count];i++) + { + frameworkName=[frameworks objectAtIndex:i]; + if ([frameworkName length]==0) + frameworkName=nil; + + if (frameworkName) + { + // NSDebugMLLog(@"resmanager",@"frameworkName=%@",aFrameworkName); + bundle=[self lockedCachedBundleForFrameworkNamed:frameworkName]; + if (bundle) + { + // NSDebugMLLog(@"resmanager",@"found cached bundle=%@",bundle); + relativePath=[bundle relativePathForResourceNamed:resourceName + forLanguage:aLanguage]; + // NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath); + if (relativePath) + { + path=[[bundle bundlePath] stringByAppendingPathComponent:relativePath]; + }; + }; + } + else + { + // NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle); + relativePath=[globalAppProjectBundle relativePathForResourceNamed:resourceName + forLanguage:aLanguage]; + // NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath); + if (relativePath) + { + NSString* applicationPath=[GSWApp path]; + path=[applicationPath stringByAppendingPathComponent:relativePath]; + }; + }; + }; + // NSDebugMLLog(@"resmanager",@"path=%@",path); + if (path) + { + //TODO use encoding ?? + stringsTableArray=[NSArray arrayWithContentsOfFile:path]; + if (!stringsTableArray) + { + NSString* tmpString=[NSString stringWithContentsOfFile:path]; + LOGSeriousError(@"Bad stringTableArray \n%@\n from file %@", + tmpString, + path); + }; + }; { - NSMutableDictionary* frameworkDict=[_stringsTableArraysByFrameworkByLanguageByName objectForKey:frameworkName_]; + NSMutableDictionary* frameworkDict=[_stringsTableArraysByFrameworkByLanguageByName objectForKey:aFrameworkName]; NSMutableDictionary* languageDict=nil; if (!frameworkDict) { frameworkDict=[NSMutableDictionary dictionary]; + if (!aFrameworkName) + aFrameworkName=@"";//Global [_stringsTableArraysByFrameworkByLanguageByName setObject:frameworkDict - forKey:frameworkName_]; + forKey:aFrameworkName]; }; - languageDict=[frameworkDict objectForKey:language_]; + languageDict=[frameworkDict objectForKey:aLanguage]; if (!languageDict) { languageDict=[NSMutableDictionary dictionary]; + if (!aLanguage) + aLanguage=@""; [frameworkDict setObject:languageDict - forKey:language_]; + forKey:aLanguage]; }; - if (_stringsTableArray) - [languageDict setObject:_stringsTableArray - forKey:tableName_]; + NSAssert(aTableName,@"No tableName"); + if (stringsTableArray) + [languageDict setObject:stringsTableArray + forKey:aTableName]; else [languageDict setObject:localNotFoundMarker - forKey:tableName_]; + forKey:aTableName]; } LOGObjectFnStop(); - return _stringsTableArray; + return stringsTableArray; }; //-------------------------------------------------------------------- --(NSString*)lockedUrlForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ - request:(GSWRequest*)_request +-(NSString*)lockedUrlForResourceNamed:(NSString*)resourceName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages + request:(GSWRequest*)request { //OK TODOV - NSString* _url=nil; - BOOL _isUsingWebServer=NO; + NSString* url=nil; + BOOL isUsingWebServer=NO; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"name_=%@ frameworkName_=%@ languages_=%@ _request=%@",name_,frameworkName_,languages_,_request); -// NSDebugMLLog(@"resmanager",@"[frameworkProjectBundlesCache count]=%d",[frameworkProjectBundlesCache count]); -// NSDebugMLLog(@"resmanager",@"frameworkProjectBundlesCache=%@",frameworkProjectBundlesCache); - _isUsingWebServer=!_request || [_request _isUsingWebServer]; - NSDebugMLLog(@"resmanager",@"_isUsingWebServer=%s",(_isUsingWebServer ? "YES" : "NO")); - if (_isUsingWebServer) - { - _url=[self lockedCachedURLForResourceNamed:name_ - inFramework:frameworkName_ - languages:languages_]; - } + NSDebugMLLog(@"resmanager",@"resourceName=%@ aFrameworkName=%@ languages=%@ _request=%@", + resourceName,aFrameworkName,languages,request); +// NSDebugMLLog(@"resmanager",@"[_frameworkProjectBundlesCache count]=%d",[_frameworkProjectBundlesCache count]); +// NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache); + isUsingWebServer=!request || [request _isUsingWebServer]; + NSDebugMLLog(@"resmanager",@"_isUsingWebServer=%s",(isUsingWebServer ? "YES" : "NO")); + if (isUsingWebServer) + { + url=[self lockedCachedURLForResourceNamed:resourceName + inFramework:aFrameworkName + languages:languages]; + } else - { - NSString* _path=[self pathForResourceNamed:name_ - inFramework:frameworkName_ - languages:languages_]; - if (_path) - { - GSWURLValuedElementData* _cachedData=[self _cachedDataForKey:_path]; - if (!_cachedData) - { - NSString* _type=[self contentTypeForResourcePath:_url]; - [self setData:nil - forKey:_path - mimeType:_type - session:nil]; - }; - } - else - _path=[NSString stringWithFormat:@"ERROR_NOT_FOUND_framework_*%@*_filename_%@", - frameworkName_, - name_]; - _url=[_request _urlWithRequestHandlerKey:GSWResourceRequestHandlerKey[GSWebNamingConv] - path:nil - queryString:[NSString stringWithFormat: - @"%@=%@", - GSWKey_Data[GSWebNamingConv], - _path]];//TODO Escape - }; -// NSDebugMLLog(@"resmanager",@"[frameworkProjectBundlesCache count]=%d",[frameworkProjectBundlesCache count]); -// NSDebugMLLog(@"resmanager",@"frameworkProjectBundlesCache=%@",frameworkProjectBundlesCache); + { + NSString* path=[self pathForResourceNamed:resourceName + inFramework:aFrameworkName + languages:languages]; + if (path) + { + GSWURLValuedElementData* cachedData=[self _cachedDataForKey:path]; + if (!cachedData) + { + NSString* type=[self contentTypeForResourcePath:url]; + [self setData:nil + forKey:path + mimeType:type + session:nil]; + }; + } + else + path=[NSString stringWithFormat:@"ERROR_NOT_FOUND_framework_*%@*_filename_%@", + aFrameworkName, + resourceName]; + url=[request _urlWithRequestHandlerKey:GSWResourceRequestHandlerKey[GSWebNamingConv] + path:nil + queryString:[NSString stringWithFormat: + @"%@=%@", + GSWKey_Data[GSWebNamingConv], + path]];//TODO Escape + }; + // NSDebugMLLog(@"resmanager",@"[_frameworkProjectBundlesCache count]=%d",[_frameworkProjectBundlesCache count]); + // NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache); LOGObjectFnStop(); - return _url; + return url; }; //-------------------------------------------------------------------- --(NSString*)lockedCachedURLForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ +-(NSString*)lockedCachedURLForResourceNamed:(NSString*)resourceName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages { //OK - NSString* _url=nil; - NSString* _relativePath=nil; - GSWDeployedBundle* _bundle=nil; + NSString* url=nil; + NSString* relativePath=nil; + GSWDeployedBundle* bundle=nil; int i=0; - NSArray* _frameworks=nil; - NSString* _frameworkName=nil; + NSArray* frameworks=nil; + NSString* frameworkName=nil; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"name_=%@ frameworkName_=%@ languages_=%@",name_,frameworkName_,languages_); - if (!WOStrictFlag && [frameworkName_ isEqualToString:GSWFramework_all]) - { - _frameworks=[frameworkProjectBundlesCache allKeys]; - _frameworks=[_frameworks arrayByAddingObject:@""]; - } + NSDebugMLLog(@"resmanager",@"resourceName=%@ aFrameworkName=%@ languages=%@",resourceName,aFrameworkName,languages); + if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all]) + { + frameworks=[_frameworkProjectBundlesCache allKeys]; + frameworks=[frameworks arrayByAddingObject:@""]; + } else - _frameworks=[NSArray arrayWithObject:frameworkName_ ? frameworkName_ : @""]; - - for(i=0;!_url && i<[_frameworks count];i++) - { - _frameworkName=[_frameworks objectAtIndex:i]; - if ([_frameworkName length]==0) - _frameworkName=nil; - if (_frameworkName) - { -// NSDebugMLLog(@"resmanager",@"frameworkName=%@",_frameworkName); - _bundle=[self lockedCachedBundleForFrameworkNamed:_frameworkName]; - if (_bundle) - { -// NSDebugMLLog(@"resmanager",@"found cached bundle=%@",_bundle); - _relativePath=[_bundle relativePathForResourceNamed:name_ - forLanguages:languages_]; -// NSDebugMLLog(@"resmanager",@"_relativePath=%@",_relativePath); - if (_relativePath) - { - //TODOV - NSString* _applicationBaseURL=[GSWApplication applicationBaseURL]; - NSString* _wrapperName=[_bundle wrapperName]; - NSDebugMLLog(@"resmanager",@"_applicationBaseURL=%@",_applicationBaseURL); - NSDebugMLLog(@"resmanager",@"_wrapperName=%@",_wrapperName); - _url=[_applicationBaseURL stringByAppendingPathComponent:_wrapperName]; - NSDebugMLLog(@"resmanager",@"_url=%@",_url); - _url=[_url stringByAppendingPathComponent:_relativePath]; - NSDebugMLLog(@"resmanager",@"_url=%@",_url); - }; - }; - } - else - { - NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle); - _relativePath=[globalAppProjectBundle relativePathForResourceNamed:name_ - forLanguages:languages_]; - NSDebugMLLog(@"resmanager",@"_relativePath=%@",_relativePath); - if (_relativePath) - { - NSString* _applicationBaseURL=[GSWApplication applicationBaseURL]; - NSString* _wrapperName=[globalAppProjectBundle wrapperName]; - NSDebugMLLog(@"resmanager",@"_applicationBaseURL=%@",_applicationBaseURL); - NSDebugMLLog(@"resmanager",@"_wrapperName=%@",_wrapperName); - _url=[_applicationBaseURL stringByAppendingPathComponent:_wrapperName]; - _url=[_url stringByAppendingPathComponent:_relativePath]; - }; - }; - }; - if (!_url) - { - LOGSeriousError(@"No URL for resource named: %@ in framework named: %@ for languages: %@", - name_, - frameworkName_, - languages_); - }; -// NSDebugMLLog(@"resmanager",@"[frameworkProjectBundlesCache count]=%d",[frameworkProjectBundlesCache count]); -// NSDebugMLLog(@"resmanager",@"frameworkProjectBundlesCache=%@",frameworkProjectBundlesCache); -// NSDebugMLLog(@"resmanager",@"_url=%@",_url); + frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""]; + + for(i=0;!url && i<[frameworks count];i++) + { + frameworkName=[frameworks objectAtIndex:i]; + if ([frameworkName length]==0) + frameworkName=nil; + if (frameworkName) + { + // NSDebugMLLog(@"resmanager",@"frameworkName=%@",frameworkName); + bundle=[self lockedCachedBundleForFrameworkNamed:frameworkName]; + if (bundle) + { + // NSDebugMLLog(@"resmanager",@"found cached bundle=%@",bundle); + relativePath=[bundle relativePathForResourceNamed:resourceName + forLanguages:languages]; + // NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath); + if (relativePath) + { + //TODOV + NSString* applicationBaseURL=[GSWApplication applicationBaseURL]; + NSString* wrapperName=[bundle wrapperName]; + NSDebugMLLog(@"resmanager",@"applicationBaseURL=%@",applicationBaseURL); + NSDebugMLLog(@"resmanager",@"wrapperName=%@",wrapperName); + url=[applicationBaseURL stringByAppendingPathComponent:wrapperName]; + NSDebugMLLog(@"resmanager",@"url=%@",url); + url=[url stringByAppendingPathComponent:relativePath]; + NSDebugMLLog(@"resmanager",@"url=%@",url); + }; + }; + } + else + { + NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle); + relativePath=[globalAppProjectBundle relativePathForResourceNamed:resourceName + forLanguages:languages]; + NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath); + if (relativePath) + { + NSString* applicationBaseURL=[GSWApplication applicationBaseURL]; + NSString* wrapperName=[globalAppProjectBundle wrapperName]; + NSDebugMLLog(@"resmanager",@"applicationBaseURL=%@",applicationBaseURL); + NSDebugMLLog(@"resmanager",@"wrapperName=%@",wrapperName); + url=[applicationBaseURL stringByAppendingPathComponent:wrapperName]; + url=[url stringByAppendingPathComponent:relativePath]; + }; + }; + }; + if (!url) + { + LOGSeriousError(@"No URL for resource named: %@ in framework named: %@ for languages: %@", + resourceName, + aFrameworkName, + languages); + }; + // NSDebugMLLog(@"resmanager",@"[_frameworkProjectBundlesCache count]=%d",[_frameworkProjectBundlesCache count]); + // NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache); + // NSDebugMLLog(@"resmanager",@"url=%@",url); LOGObjectFnStop(); - return _url; + return url; }; //-------------------------------------------------------------------- --(NSString*)lockedPathForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ +-(NSString*)lockedPathForResourceNamed:(NSString*)resourceName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages { - NSString* _path=nil; - NSString* _relativePath=nil; - GSWDeployedBundle* _bundle=nil; + NSString* path=nil; + NSString* relativePath=nil; + GSWDeployedBundle* bundle=nil; int i=0; - NSArray* _frameworks=nil; - NSString* _frameworkName=nil; + NSArray* frameworks=nil; + NSString* frameworkName=nil; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"name_=%@ frameworkName_=%@ languages_=%@",name_,frameworkName_,languages_); - if (!WOStrictFlag && [frameworkName_ isEqualToString:GSWFramework_all]) - { - _frameworks=[frameworkProjectBundlesCache allKeys]; - _frameworks=[_frameworks arrayByAddingObject:@""]; - } + NSDebugMLLog(@"resmanager",@"resourceName=%@ aFrameworkName=%@ languages=%@", + resourceName,aFrameworkName,languages); + if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all]) + { + frameworks=[_frameworkProjectBundlesCache allKeys]; + frameworks=[frameworks arrayByAddingObject:@""]; + } else - _frameworks=[NSArray arrayWithObject:frameworkName_ ? frameworkName_ : @""]; - NSDebugMLLog(@"resmanager",@"frameworks=%@",_frameworks); + frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""]; + NSDebugMLLog(@"resmanager",@"frameworks=%@",frameworks); - for(i=0;!_path && i<[_frameworks count];i++) - { - _frameworkName=[_frameworks objectAtIndex:i]; - if ([_frameworkName length]==0) - _frameworkName=nil; - if (_frameworkName) - { -// NSDebugMLLog(@"resmanager",@"frameworkName=%@",_frameworkName); - _bundle=[self lockedCachedBundleForFrameworkNamed:_frameworkName]; - NSDebugMLLog(@"resmanager",@"bundle=%@",_bundle); - if (_bundle) - { -// NSDebugMLLog(@"resmanager",@"found cached bundle=%@",_bundle); - _relativePath=[_bundle relativePathForResourceNamed:name_ - forLanguages:languages_]; -// NSDebugMLLog(@"resmanager",@"_relativePath=%@",_relativePath); - if (_relativePath) - { - _path=[[_bundle bundlePath] stringByAppendingPathComponent:_relativePath]; - }; - }; - } - else - { - NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle); - _relativePath=[globalAppProjectBundle relativePathForResourceNamed:name_ - forLanguages:languages_]; - NSDebugMLLog(@"resmanager",@"_relativePath=%@",_relativePath); - if (_relativePath) - { - NSString* _applicationPath=[GSWApp path]; - _path=[_applicationPath stringByAppendingPathComponent:_relativePath]; - }; - }; - }; -// NSDebugMLLog(@"resmanager",@"_path=%@",_path); + for(i=0;!path && i<[frameworks count];i++) + { + frameworkName=[frameworks objectAtIndex:i]; + if ([frameworkName length]==0) + frameworkName=nil; + if (frameworkName) + { + // NSDebugMLLog(@"resmanager",@"frameworkName=%@",frameworkName); + bundle=[self lockedCachedBundleForFrameworkNamed:frameworkName]; + NSDebugMLLog(@"resmanager",@"bundle=%@",bundle); + if (bundle) + { + // NSDebugMLLog(@"resmanager",@"found cached bundle=%@",bundle); + relativePath=[bundle relativePathForResourceNamed:resourceName + forLanguages:languages]; + // NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath); + if (relativePath) + { + path=[[bundle bundlePath] stringByAppendingPathComponent:relativePath]; + }; + }; + } + else + { + NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle); + relativePath=[globalAppProjectBundle relativePathForResourceNamed:resourceName + forLanguages:languages]; + NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath); + if (relativePath) + { + NSString* applicationPath=[GSWApp path]; + path=[applicationPath stringByAppendingPathComponent:relativePath]; + }; + }; + }; + // NSDebugMLLog(@"resmanager",@"path=%@",path); LOGObjectFnStop(); - return _path; + return path; }; //-------------------------------------------------------------------- --(GSWDeployedBundle*)lockedCachedBundleForFrameworkNamed:(NSString*)name_ +-(GSWDeployedBundle*)lockedCachedBundleForFrameworkNamed:(NSString*)resourceName { //OK - GSWDeployedBundle* _bundle=nil; + GSWDeployedBundle* bundle=nil; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"name_=%@",name_); -// NSDebugMLLog(@"resmanager",@"frameworkProjectBundlesCache=%@",frameworkProjectBundlesCache); - if ([name_ isEqualToString:GSWFramework_app]) - { - name_=[globalAppProjectBundle projectName]; - _bundle=globalAppProjectBundle; - } + NSDebugMLLog(@"resmanager",@"resourceName=%@",resourceName); + NSAssert(resourceName,@"No name"); +// NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache); + if ([resourceName isEqualToString:GSWFramework_app]) + { + resourceName=[globalAppProjectBundle projectName]; + bundle=globalAppProjectBundle; + } else - _bundle=[frameworkProjectBundlesCache objectForKey:name_]; -// NSDebugMLLog(@"resmanager",@"bundle %@ %s cached",name_,(_bundle ? "" : "NOT")); - if (!_bundle) - { - NSArray* _allFrameworks=[NSBundle allFrameworks]; - int i=0; - NSString* _bundlePath=nil; - NSBundle* _tmpBundle=nil; - NSDictionary* _infoDict=nil; - NSString* _frameworkName=nil; - GSWDeployedBundle* _projectBundle=nil; - for(i=0;!_bundle && i<[_allFrameworks count];i++) - { - _tmpBundle=[_allFrameworks objectAtIndex:i]; -// NSDebugMLLog(@"resmanager",@"_tmpBundle=%@",_tmpBundle); - _bundlePath=[_tmpBundle bundlePath]; -// NSDebugMLLog(@"resmanager",@"_bundlePath=%@",_bundlePath); - _frameworkName=[_bundlePath lastPathComponent]; -// NSDebugMLLog(@"resmanager",@"_frameworkName=%@",_frameworkName); - _frameworkName=[_frameworkName stringByDeletingPathExtension]; -// NSDebugMLLog(@"resmanager",@"_frameworkName=%@",_frameworkName); - if ([_frameworkName isEqualToString:name_]) - { - _bundle=[GSWDeployedBundle bundleWithPath:_bundlePath]; - NSDebugMLLog(@"resmanager",@"_bundle=%@",_bundle); -/* _projectBundle=[GSWProjectBundle projectBundleForProjectNamed:name_ - isFramework:YES]; - NSDebugMLLog(@"resmanager",@"_projectBundle=%@",_projectBundle); - if (_projectBundle) - { - //TODO - }; -*/ - [frameworkProjectBundlesCache setObject:_bundle - forKey:name_]; -// NSDebugMLLog(@"resmanager",@"frameworkProjectBundlesCache=%@",frameworkProjectBundlesCache); - }; - }; - }; -// NSDebugMLLog(@"resmanager",@"frameworkProjectBundlesCache=%@",frameworkProjectBundlesCache); -// NSDebugMLLog(@"resmanager",@"_bundle=%@",_bundle); + bundle=[_frameworkProjectBundlesCache objectForKey:resourceName]; + // NSDebugMLLog(@"resmanager",@"bundle %@ %s cached",resourceName,(bundle ? "" : "NOT")); + if (!bundle) + { + NSArray* allFrameworks=[NSBundle allFrameworks]; + int i=0; + NSString* bundlePath=nil; + NSBundle* tmpBundle=nil; + NSDictionary* infoDict=nil; + NSString* frameworkName=nil; + GSWDeployedBundle* projectBundle=nil; + for(i=0;!bundle && i<[allFrameworks count];i++) + { + tmpBundle=[allFrameworks objectAtIndex:i]; + // NSDebugMLLog(@"resmanager",@"tmpBundle=%@",tmpBundle); + bundlePath=[tmpBundle bundlePath]; + // NSDebugMLLog(@"resmanager",@"bundlePath=%@",bundlePath); + frameworkName=[bundlePath lastPathComponent]; + // NSDebugMLLog(@"resmanager",@"frameworkName=%@",frameworkName); + frameworkName=[frameworkName stringByDeletingPathExtension]; + // NSDebugMLLog(@"resmanager",@"frameworkName=%@",frameworkName); + if ([frameworkName isEqualToString:resourceName]) + { + bundle=[GSWDeployedBundle bundleWithPath:bundlePath]; + NSDebugMLLog(@"resmanager",@"bundle=%@",bundle); + /*projectBundle=[GSWProjectBundle projectBundleForProjectNamed:resourceName + isFramework:YES]; + NSDebugMLLog(@"resmanager",@"projectBundle=%@",projectBundle); + if (projectBundle) + { + //TODO + }; + */ + NSAssert(bundle,@"No bundle"); + NSAssert(resourceName,@"No name"); + [_frameworkProjectBundlesCache setObject:bundle + forKey:resourceName]; + //NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache); + }; + }; + }; + // NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache); + // NSDebugMLLog(@"resmanager",@"bundle=%@",bundle); LOGObjectFnStop(); - return _bundle; + return bundle; }; @end @@ -1119,79 +1148,82 @@ NSString* localNotFoundMarker=@"NOTFOUND"; LOGObjectFnStart(); [self lock]; NS_DURING - { - [urlValuedElementsData removeAllObjects]; - } + { + [_urlValuedElementsData removeAllObjects]; + } NS_HANDLER - { - NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); + { + NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); //TODO - [self unlock]; - [localException raise]; - } + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)setURLValuedElementData:(GSWURLValuedElementData*)data_ +-(void)setURLValuedElementData:(GSWURLValuedElementData*)aData { LOGObjectFnStart(); [self lock]; - NSDebugMLLog(@"resmanager",@"data_=%@",data_); + NSDebugMLLog(@"resmanager",@"aData=%@",aData); NS_DURING - { - [self lockedCacheData:data_]; - } + { + [self lockedCacheData:aData]; + } NS_HANDLER - { - NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)setData:(NSData*)data_ - forKey:(NSString*)key_ - mimeType:(NSString*)type_ - session:(GSWSession*)session_ //unused +-(void)setData:(NSData*)aData + forKey:(NSString*)aKey + mimeType:(NSString*)aType + session:(GSWSession*)session_ //unused { - GSWURLValuedElementData* _dataValue=nil; + GSWURLValuedElementData* dataValue=nil; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"data_=%@",data_); - NSDebugMLLog(@"resmanager",@"key_=%@",key_); - NSDebugMLLog(@"resmanager",@"type_=%@",type_); - _dataValue=[[[GSWURLValuedElementData alloc] initWithData:data_ - mimeType:type_ - key:key_] autorelease]; - NSDebugMLLog(@"resmanager",@"_dataValue=%@",_dataValue); - [self setURLValuedElementData:_dataValue]; + NSDebugMLLog(@"resmanager",@"aData=%@",aData); + NSDebugMLLog(@"resmanager",@"aKey=%@",aKey); + NSDebugMLLog(@"resmanager",@"aType=%@",aType); + dataValue=[[[GSWURLValuedElementData alloc] initWithData:aData + mimeType:aType + key:aKey] autorelease]; + NSDebugMLLog(@"resmanager",@"dataValue=%@",dataValue); + [self setURLValuedElementData:dataValue]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)removeDataForKey:(NSString*)key_ - session:(GSWSession*)session_ //unused +-(void)removeDataForKey:(NSString*)aKey + session:(GSWSession*)session //unused { LOGObjectFnStart(); [self lock]; NS_DURING - { - [self lockedRemoveDataForKey:key_]; - } + { + [self lockedRemoveDataForKey:aKey]; + } NS_HANDLER - { - NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); @@ -1204,97 +1236,98 @@ NSString* localNotFoundMarker=@"NOTFOUND"; @implementation GSWResourceManager (GSWResourceManagerA) //-------------------------------------------------------------------- --(NSString*)pathForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_ +-(NSString*)pathForResourceNamed:(NSString*)resourceName + inFramework:(NSString*)aFrameworkName + language:(NSString*)aLanguage { //OK - NSString* _path=nil; + NSString* path=nil; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"name_=%@ frameworkName_=%@ language_=%@",name_,frameworkName_,language_); -// NSDebugMLLog(@"resmanager",@"[frameworkProjectBundlesCache count]=%d",[frameworkProjectBundlesCache count]); -// NSDebugMLLog(@"resmanager",@"frameworkProjectBundlesCache=%@",frameworkProjectBundlesCache); + NSDebugMLLog(@"resmanager",@"resourceName=%@ aFrameworkName=%@ aLanguage=%@",resourceName,aFrameworkName,aLanguage); +// NSDebugMLLog(@"resmanager",@"[_frameworkProjectBundlesCache count]=%d",[_frameworkProjectBundlesCache count]); +// NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache); [self lock]; NS_DURING - { - _path=[self lockedPathForResourceNamed:name_ - inFramework:frameworkName_ - language:language_]; - } + { + path=[self lockedPathForResourceNamed:resourceName + inFramework:aFrameworkName + language:aLanguage]; + } NS_HANDLER - { - NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); - return _path; + return path; }; //-------------------------------------------------------------------- --(NSString*)lockedPathForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - language:(NSString*)language_ +-(NSString*)lockedPathForResourceNamed:(NSString*)resourceName + inFramework:(NSString*)aFrameworkName + language:(NSString*)aLanguage { //OK - NSString* _path=nil; - NSString* _relativePath=nil; - GSWDeployedBundle* _bundle=nil; + NSString* path=nil; + NSString* relativePath=nil; + GSWDeployedBundle* bundle=nil; int i=0; - NSArray* _frameworks=nil; - NSString* _frameworkName=nil; + NSArray* frameworks=nil; + NSString* frameworkName=nil; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"name_=%@ frameworkName_=%@ language_=%@",name_,frameworkName_,language_); -// NSDebugMLLog(@"resmanager",@"frameworkProjectBundlesCache=%@",frameworkProjectBundlesCache); - if (!WOStrictFlag && [frameworkName_ isEqualToString:GSWFramework_all]) - { - _frameworks=[frameworkProjectBundlesCache allKeys]; - _frameworks=[_frameworks arrayByAddingObject:@""]; - } + NSDebugMLLog(@"resmanager",@"resourceName=%@ aFrameworkName=%@ aLanguage=%@",resourceName,aFrameworkName,aLanguage); +// NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache); + if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all]) + { + frameworks=[_frameworkProjectBundlesCache allKeys]; + frameworks=[frameworks arrayByAddingObject:@""]; + } else - _frameworks=[NSArray arrayWithObject:frameworkName_ ? frameworkName_ : @""]; - - for(i=0;!_path && i<[_frameworks count];i++) - { - _frameworkName=[_frameworks objectAtIndex:i]; - if ([_frameworkName length]==0) - _frameworkName=nil; - - if (_frameworkName) - { -// NSDebugMLLog(@"resmanager",@"frameworkName=%@",_frameworkName); - _bundle=[self lockedCachedBundleForFrameworkNamed:_frameworkName]; - if (_bundle) - { -// NSDebugMLLog(@"resmanager",@"found cached bundle=%@",_bundle); - _relativePath=[_bundle relativePathForResourceNamed:name_ - forLanguage:language_]; -// NSDebugMLLog(@"resmanager",@"_relativePath=%@",_relativePath); - if (_relativePath) - { - _path=[[_bundle bundlePath] stringByAppendingPathComponent:_relativePath]; - }; - }; - } - else - { - NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle); - _relativePath=[globalAppProjectBundle relativePathForResourceNamed:name_ - forLanguage:language_]; - NSDebugMLLog(@"resmanager",@"_relativePath=%@",_relativePath); - if (_relativePath) - { - NSString* _applicationPath=[GSWApp path]; - _path=[_applicationPath stringByAppendingPathComponent:_relativePath]; - }; - }; - }; -// NSDebugMLLog(@"resmanager",@"_path=%@",_path); + frameworks=[NSArray arrayWithObject:aFrameworkName ? aFrameworkName : @""]; + + for(i=0;!path && i<[frameworks count];i++) + { + frameworkName=[frameworks objectAtIndex:i]; + if ([frameworkName length]==0) + frameworkName=nil; + + if (frameworkName) + { + // NSDebugMLLog(@"resmanager",@"frameworkName=%@",frameworkName); + bundle=[self lockedCachedBundleForFrameworkNamed:frameworkName]; + if (bundle) + { + // NSDebugMLLog(@"resmanager",@"found cached bundle=%@",bundle); + relativePath=[bundle relativePathForResourceNamed:resourceName + forLanguage:aLanguage]; + // NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath); + if (relativePath) + { + path=[[bundle bundlePath] stringByAppendingPathComponent:relativePath]; + }; + }; + } + else + { + NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle); + relativePath=[globalAppProjectBundle relativePathForResourceNamed:resourceName + forLanguage:aLanguage]; + NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath); + if (relativePath) + { + NSString* applicationPath=[GSWApp path]; + path=[applicationPath stringByAppendingPathComponent:relativePath]; + }; + }; + }; + // NSDebugMLLog(@"resmanager",@"path=%@",path); LOGObjectFnStop(); - return _path; + return path; }; //-------------------------------------------------------------------- @@ -1307,18 +1340,18 @@ NSString* localNotFoundMarker=@"NOTFOUND"; -(NSArray*)_allFrameworkProjectBundles { //OK - NSArray* _array=nil; + NSArray* array=nil; LOGObjectFnStart(); - _array=[frameworkProjectBundlesCache allValues]; + array=[_frameworkProjectBundlesCache allValues]; LOGObjectFnStop(); - return _array; + return array; }; //-------------------------------------------------------------------- -(void)lockedRemoveDataForKey:(NSString*)key { LOGObjectFnStart(); - [urlValuedElementsData removeObjectForKey:key]; + [_urlValuedElementsData removeObjectForKey:key]; LOGObjectFnStop(); }; @@ -1330,7 +1363,7 @@ NSString* localNotFoundMarker=@"NOTFOUND"; }; //-------------------------------------------------------------------- --(id)_absolutePathForJavaClassPath:(NSString*)_path +-(id)_absolutePathForJavaClassPath:(NSString*)path { LOGObjectFnNotImplemented(); //TODOFN return nil; @@ -1340,91 +1373,95 @@ NSString* localNotFoundMarker=@"NOTFOUND"; -(GSWURLValuedElementData*)_cachedDataForKey:(NSString*)key { //OK - GSWURLValuedElementData* _data=nil; + GSWURLValuedElementData* data=nil; LOGObjectFnStart(); NSDebugMLLog(@"resmanager",@"key=%@",key); [self lock]; NS_DURING - { - _data=[urlValuedElementsData objectForKey:key]; - NSDebugMLLog(@"resmanager",@"_data=%@",_data); - } + { + data=[_urlValuedElementsData objectForKey:key]; + NSDebugMLLog(@"resmanager",@"data=%@",data); + } NS_HANDLER - { - NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); - return _data; + return data; }; //-------------------------------------------------------------------- --(void)lockedCacheData:(GSWURLValuedElementData*)data_ +-(void)lockedCacheData:(GSWURLValuedElementData*)aData { //OK - NSData* _data=nil; - BOOL _isTemporary=NO; - NSString* _key=nil; - NSString* _type=nil; + NSData* data=nil; + BOOL isTemporary=NO; + NSString* key=nil; + NSString* type=nil; LOGObjectFnStart(); - _data=[data_ data]; - _isTemporary=[data_ isTemporary]; - _key=[data_ key]; - _type=[data_ type]; + data=[aData data]; + NSAssert(data,@"Data"); + isTemporary=[aData isTemporary]; + key=[aData key]; + NSAssert(key,@"No key"); + type=[aData type]; [self lock]; NS_DURING - { - if (!urlValuedElementsData) - urlValuedElementsData=[NSMutableDictionary new]; - [urlValuedElementsData setObject:data_ - forKey:_key]; - } + { + if (!_urlValuedElementsData) + _urlValuedElementsData=[NSMutableDictionary new]; + [_urlValuedElementsData setObject:aData + forKey:key]; + } NS_HANDLER - { - NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(NSString*)contentTypeForResourcePath:(NSString*)_path +-(NSString*)contentTypeForResourcePath:(NSString*)path { //OK - NSString* _type=nil; - NSString* _extension=nil; - NSDictionary* _tmpMimeTypes=nil; - NSMutableDictionary* _mimeTypes=[NSMutableDictionary dictionary]; + NSString* type=nil; + NSString* extension=nil; + NSDictionary* tmpMimeTypes=nil; + NSMutableDictionary* mimeTypes=[NSMutableDictionary dictionary]; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"_path=%@",_path); - _extension=[_path pathExtension]; - NSDebugMLLog(@"resmanager",@"_extension=%@",_extension); - if (_extension) - { - _extension=[_extension lowercaseString]; - NSDebugMLLog(@"resmanager",@"_extension=%@",_extension); - _type=[globalMime objectForKey:_extension]; - NSDebugMLLog(@"resmanager",@"_type=%@",_type); - }; - if (!_type) - _type=[NSString stringWithString:@"application/octet-stream"]; - NSDebugMLLog(@"resmanager",@"_type=%@",_type); + NSDebugMLLog(@"resmanager",@"path=%@",path); + extension=[path pathExtension]; + NSDebugMLLog(@"resmanager",@"extension=%@",extension); + if (extension) + { + extension=[extension lowercaseString]; + NSDebugMLLog(@"resmanager",@"extension=%@",extension); + type=[globalMime objectForKey:extension]; + NSDebugMLLog(@"resmanager",@"type=%@",type); + }; + if (!type) + type=[NSString stringWithString:@"application/octet-stream"]; + NSDebugMLLog(@"resmanager",@"type=%@",type); LOGObjectFnStop(); - return _type; + return type; }; //-------------------------------------------------------------------- -(NSArray*)_frameworkClassPaths { - return frameworkClassPaths; + return _frameworkClassPaths; }; @end @@ -1434,32 +1471,32 @@ NSString* localNotFoundMarker=@"NOTFOUND"; @implementation GSWResourceManager (GSWResourceManagerOldFn) //-------------------------------------------------------------------- --(NSString*)urlForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ +-(NSString*)urlForResourceNamed:(NSString*)resourceName + inFramework:(NSString*)aFrameworkName { - NSString* _url=nil; + NSString* url=nil; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"name_=%@ frameworkName_=%@",name_,frameworkName_); - _url=[self urlForResourceNamed:name_ - inFramework:frameworkName_ + NSDebugMLLog(@"resmanager",@"resourceName=%@ aFrameworkName=%@",resourceName,aFrameworkName); + url=[self urlForResourceNamed:resourceName + inFramework:aFrameworkName languages:nil request:nil]; LOGObjectFnStop(); - return _url; + return url; }; //-------------------------------------------------------------------- --(NSString*)pathForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ +-(NSString*)pathForResourceNamed:(NSString*)resourceName + inFramework:(NSString*)aFrameworkName { - NSString* _path=nil; + NSString* path=nil; LOGObjectFnStart(); - NSDebugMLLog(@"resmanager",@"name_=%@ frameworkName_=%@",name_,frameworkName_); - _path=[self pathForResourceNamed:name_ - inFramework:frameworkName_ - language:nil]; + NSDebugMLLog(@"resmanager",@"resourceName=%@ aFrameworkName=%@",resourceName,aFrameworkName); + path=[self pathForResourceNamed:resourceName + inFramework:aFrameworkName + language:nil]; LOGObjectFnStop(); - return _path; + return path; }; @end @@ -1482,175 +1519,177 @@ NSString* localNotFoundMarker=@"NOTFOUND"; //-------------------------------------------------------------------- //NDFN -+(NSString*)GSLanguageFromISOLanguage:(NSString*)ISOLanguage_ ++(NSString*)GSLanguageFromISOLanguage:(NSString*)ISOLanguage { - return [localISO2GSLanguages objectForKey:[[ISOLanguage_ stringByTrimmingSpaces] lowercaseString]]; + return [localISO2GSLanguages objectForKey:[[ISOLanguage stringByTrimmingSpaces] lowercaseString]]; }; //-------------------------------------------------------------------- //NDFN -+(NSArray*)GSLanguagesFromISOLanguages:(NSArray*)ISOLanguages_ ++(NSArray*)GSLanguagesFromISOLanguages:(NSArray*)ISOLanguages { - NSArray* _languages=nil; - if (ISOLanguages_) - { - NSMutableArray* _array=[NSMutableArray array]; - NSString* _ISOLanguage=nil; - NSString* _GSLanguage=nil; - int i=0; - for(i=0;i<[ISOLanguages_ count];i++) - { - _ISOLanguage=[ISOLanguages_ objectAtIndex:i]; - _GSLanguage=[self GSLanguageFromISOLanguage:_ISOLanguage]; - if (_GSLanguage) - [_array addObject:_GSLanguage]; - else - { - LOGError(@"Unknown language: %@\nKnown languages are : %@",_ISOLanguage,localISO2GSLanguages); - }; - }; - _languages=[NSArray arrayWithArray:_array]; - } - return _languages; + NSArray* GSLanguages=nil; + if (ISOLanguages) + { + NSMutableArray* array=[NSMutableArray array]; + NSString* ISOLanguage=nil; + NSString* GSLanguage=nil; + int i=0; + for(i=0;i<[ISOLanguages count];i++) + { + ISOLanguage=[ISOLanguages objectAtIndex:i]; + GSLanguage=[self GSLanguageFromISOLanguage:ISOLanguage]; + if (GSLanguage) + [array addObject:GSLanguage]; + else + { + LOGError(@"Unknown language: %@\nKnown languages are : %@",ISOLanguage,localISO2GSLanguages); + }; + }; + GSLanguages=[NSArray arrayWithArray:array]; + } + return GSLanguages; }; //-------------------------------------------------------------------- //NDFN -+(NSString*)ISOLanguageFromGSLanguage:(NSString*)GSLanguage_ ++(NSString*)ISOLanguageFromGSLanguage:(NSString*)GSLanguage { - return [localGS2ISOLanguages objectForKey:[[GSLanguage_ stringByTrimmingSpaces] lowercaseString]]; + return [localGS2ISOLanguages objectForKey:[[GSLanguage stringByTrimmingSpaces] lowercaseString]]; }; //-------------------------------------------------------------------- //NDFN -+(NSArray*)ISOLanguagesFromGSLanguages:(NSArray*)GSLanguages_ ++(NSArray*)ISOLanguagesFromGSLanguages:(NSArray*)GSLanguages { - NSArray* _languages=nil; - if (GSLanguages_) - { - NSMutableArray* _array=[NSMutableArray array]; - NSString* _ISOLanguage=nil; - NSString* _GSLanguage=nil; - int i=0; - for(i=0;i<[GSLanguages_ count];i++) - { - _GSLanguage=[GSLanguages_ objectAtIndex:i]; - _ISOLanguage=[self ISOLanguageFromGSLanguage:_GSLanguage]; - [_array addObject:_ISOLanguage]; - }; - _languages=[NSArray arrayWithArray:_array]; - } - return _languages; + NSArray* ISOLanguages=nil; + if (GSLanguages) + { + NSMutableArray* array=[NSMutableArray array]; + NSString* ISOLanguage=nil; + NSString* GSLanguage=nil; + int i=0; + for(i=0;i<[GSLanguages count];i++) + { + GSLanguage=[GSLanguages objectAtIndex:i]; + ISOLanguage=[self ISOLanguageFromGSLanguage:GSLanguage]; + [array addObject:ISOLanguage]; + }; + ISOLanguages=[NSArray arrayWithArray:array]; + } + return ISOLanguages; }; //-------------------------------------------------------------------- +(GSWBundle*)_applicationGSWBundle { LOGClassFnStart(); if (!globalAppGSWBundle) - { - NSString* _applicationBaseURL=nil; - NSString* _baseURL=nil; - NSString* _wrapperName=nil; - _applicationBaseURL=[GSWApplication applicationBaseURL]; //(retourne /GSWeb) - NSDebugMLLog(@"resmanager",@"_applicationBaseURL=%@",_applicationBaseURL); - _wrapperName=[globalAppProjectBundle wrapperName]; - NSDebugMLLog(@"resmanager",@"_wrapperName=%@",_wrapperName); - _baseURL=[_applicationBaseURL stringByAppendingFormat:@"/%@",_wrapperName]; - NSDebugMLLog(@"resmanager",@"_baseURL=%@",_baseURL); - globalAppGSWBundle=[[GSWBundle alloc]initWithPath:[globalAppProjectBundle bundlePath] - baseURL:_baseURL]; - NSDebugMLLog(@"resmanager",@"globalAppGSWBundle=%@",globalAppGSWBundle); - //??? - { - NSBundle* _resourceManagerBundle=[NSBundle bundleForClass: - NSClassFromString(@"GSWResourceManager")]; - NSDebugMLLog(@"resmanager",@"_resourceManagerBundle bundlePath=%@",[_resourceManagerBundle bundlePath]); - globalMimePListPathName=[_resourceManagerBundle pathForResource:@"MIME" - ofType:@"plist"]; //TODO should return /usr/GNUstep/Libraries/GNUstepWeb/GSWeb.framework/Resources/MIME.plist - NSDebugMLLog(@"resmanager",@"globalMimePListPathName=%@",globalMimePListPathName); - if (!globalMimePListPathName) - globalMimePListPathName = [[NSBundle bundleForClass: self] - pathForResource:@"MIME" - ofType:@"plist"]; - - NSDebugMLLog(@"resmanager",@"globalMimePListPathName=%@",globalMimePListPathName); + { + NSString* applicationBaseURL=nil; + NSString* baseURL=nil; + NSString* wrapperName=nil; + applicationBaseURL=[GSWApplication applicationBaseURL]; //(retourne /GSWeb) + NSDebugMLLog(@"resmanager",@"applicationBaseURL=%@",applicationBaseURL); + wrapperName=[globalAppProjectBundle wrapperName]; + NSDebugMLLog(@"resmanager",@"wrapperName=%@",wrapperName); + baseURL=[applicationBaseURL stringByAppendingFormat:@"/%@",wrapperName]; + NSDebugMLLog(@"resmanager",@"baseURL=%@",baseURL); + globalAppGSWBundle=[[GSWBundle alloc]initWithPath:[globalAppProjectBundle bundlePath] + baseURL:baseURL]; + NSDebugMLLog(@"resmanager",@"globalAppGSWBundle=%@",globalAppGSWBundle); + //??? + { + NSBundle* resourceManagerBundle=[NSBundle bundleForClass: + NSClassFromString(@"GSWResourceManager")]; + NSDebugMLLog(@"resmanager",@"resourceManagerBundle bundlePath=%@",[resourceManagerBundle bundlePath]); + globalMimePListPathName=[resourceManagerBundle pathForResource:@"MIME" + ofType:@"plist"]; //TODO should return /usr/GNUstep/Libraries/GNUstepWeb/GSWeb.framework/Resources/MIME.plist + NSDebugMLLog(@"resmanager",@"globalMimePListPathName=%@",globalMimePListPathName); + if (!globalMimePListPathName) + globalMimePListPathName = [[NSBundle bundleForClass: self] + pathForResource:@"MIME" + ofType:@"plist"]; + + NSDebugMLLog(@"resmanager",@"globalMimePListPathName=%@",globalMimePListPathName); #ifdef DEBUG - if (!globalMimePListPathName) - { - NSDictionary* env=[[NSProcessInfo processInfo] environment]; + if (!globalMimePListPathName) + { + NSDictionary* env=[[NSProcessInfo processInfo] environment]; - NSDebugMLLog(@"error",@"GNUSTEP_USER_ROOT=%@",[env objectForKey: @"GNUSTEP_USER_ROOT"]); - NSDebugMLLog(@"error",@"GNUSTEP_LOCAL_ROOT=%@",[env objectForKey: @"GNUSTEP_LOCAL_ROOT"]); - NSDebugMLLog(@"error",@"gnustepBundle resourcePath=%@",[[NSBundle gnustepBundle]resourcePath]); - }; + NSDebugMLLog(@"error",@"GNUSTEP_USER_ROOT=%@",[env objectForKey: @"GNUSTEP_USER_ROOT"]); + NSDebugMLLog(@"error",@"GNUSTEP_LOCAL_ROOT=%@",[env objectForKey: @"GNUSTEP_LOCAL_ROOT"]); + NSDebugMLLog(@"error",@"gnustepBundle resourcePath=%@",[[NSBundle gnustepBundle]resourcePath]); + }; #endif - NSAssert(globalMimePListPathName,@"No resource MIME.plist"); - { - NSDictionary* _tmpMimeTypes=nil; - NSMutableDictionary* _mimeTypes=[NSMutableDictionary dictionary]; - LOGObjectFnStart(); - _tmpMimeTypes=[NSDictionary dictionaryWithContentsOfFile:globalMimePListPathName]; -// NSDebugMLLog(@"resmanager",@"_tmpMimeTypes=%@",_tmpMimeTypes); - if (_tmpMimeTypes) - { - NSEnumerator* enumerator = [_tmpMimeTypes keyEnumerator]; - id _key; - id _value; - while ((_key = [enumerator nextObject])) - { - _value=[_tmpMimeTypes objectForKey:_key]; - _value=[_value lowercaseString]; - _key=[_key lowercaseString]; - [_mimeTypes setObject:_value - forKey:_key]; - }; -// NSDebugMLLog(@"resmanager",@"_mimeTypes=%@",_mimeTypes); - }; - ASSIGN(globalMime,[NSDictionary dictionaryWithDictionary:_mimeTypes]); - }; - globalLanguagesPListPathName=[_resourceManagerBundle pathForResource:@"languages" - ofType:@"plist"]; - NSDebugMLLog(@"resmanager",@"globalLanguagesPListPathName=%@",globalLanguagesPListPathName); - if (!globalLanguagesPListPathName) - globalLanguagesPListPathName=[[NSBundle bundleForClass: self] - pathForResource:@"languages" - ofType:@"plist"]; - - NSDebugMLLog(@"resmanager",@"globalLanguagesPListPathName=%@",globalLanguagesPListPathName); - NSAssert(globalLanguagesPListPathName,@"No resource languages.plist"); - { - NSDictionary* _tmpLanguages=nil; - NSMutableDictionary* _ISO2GS=[NSMutableDictionary dictionary]; - NSMutableDictionary* _GS2ISO=[NSMutableDictionary dictionary]; - LOGObjectFnStart(); - _tmpLanguages=[NSDictionary dictionaryWithContentsOfFile:globalLanguagesPListPathName]; - NSDebugMLLog(@"resmanager",@"_tmpLanguages=%@",_tmpLanguages); - if (_tmpLanguages) - { - NSEnumerator* enumerator = [_tmpLanguages keyEnumerator]; - id _iso=nil; - id _gs=nil; - while ((_iso = [enumerator nextObject])) - { - _gs=[_tmpLanguages objectForKey:_iso]; - [_ISO2GS setObject:_gs - forKey:[_iso lowercaseString]]; - if ([_iso length]==2)//No xx-xx - { - [_GS2ISO setObject:_iso - forKey:[_gs lowercaseString]]; - }; - }; - NSDebugMLLog(@"resmanager",@"_ISO2GS=%@",_ISO2GS); - NSDebugMLLog(@"resmanager",@"_GS2ISO=%@",_GS2ISO); - }; - ASSIGN(localISO2GSLanguages,[NSDictionary dictionaryWithDictionary:_ISO2GS]); - ASSIGN(localGS2ISOLanguages,[NSDictionary dictionaryWithDictionary:_GS2ISO]); - }; - }; + NSAssert(globalMimePListPathName,@"No resource MIME.plist"); + { + NSDictionary* tmpMimeTypes=nil; + NSMutableDictionary* mimeTypes=[NSMutableDictionary dictionary]; + LOGObjectFnStart(); + tmpMimeTypes=[NSDictionary dictionaryWithContentsOfFile:globalMimePListPathName]; + // NSDebugMLLog(@"resmanager",@"tmpMimeTypes=%@",tmpMimeTypes); + if (tmpMimeTypes) + { + NSEnumerator* enumerator = [tmpMimeTypes keyEnumerator]; + id key; + id value; + while ((key = [enumerator nextObject])) + { + value=[tmpMimeTypes objectForKey:key]; + value=[value lowercaseString]; + key=[key lowercaseString]; + NSAssert(key,@"No key"); + [mimeTypes setObject:value + forKey:key]; + }; + // NSDebugMLLog(@"resmanager",@"mimeTypes=%@",mimeTypes); + }; + ASSIGN(globalMime,[NSDictionary dictionaryWithDictionary:mimeTypes]); + }; + globalLanguagesPListPathName=[resourceManagerBundle pathForResource:@"languages" + ofType:@"plist"]; + NSDebugMLLog(@"resmanager",@"globalLanguagesPListPathName=%@",globalLanguagesPListPathName); + if (!globalLanguagesPListPathName) + globalLanguagesPListPathName=[[NSBundle bundleForClass: self] + pathForResource:@"languages" + ofType:@"plist"]; + + NSDebugMLLog(@"resmanager",@"globalLanguagesPListPathName=%@",globalLanguagesPListPathName); + NSAssert(globalLanguagesPListPathName,@"No resource languages.plist"); + { + NSDictionary* tmpLanguages=nil; + NSMutableDictionary* ISO2GS=[NSMutableDictionary dictionary]; + NSMutableDictionary* GS2ISO=[NSMutableDictionary dictionary]; + LOGObjectFnStart(); + tmpLanguages=[NSDictionary dictionaryWithContentsOfFile:globalLanguagesPListPathName]; + NSDebugMLLog(@"resmanager",@"tmpLanguages=%@",tmpLanguages); + if (tmpLanguages) + { + NSEnumerator* enumerator = [tmpLanguages keyEnumerator]; + id iso=nil; + id gs=nil; + while ((iso = [enumerator nextObject])) + { + gs=[tmpLanguages objectForKey:iso]; + NSAssert(gs,@"No gs"); + [ISO2GS setObject:gs + forKey:[iso lowercaseString]]; + if ([iso length]==2)//No xx-xx + { + [GS2ISO setObject:iso + forKey:[gs lowercaseString]]; + }; + }; + NSDebugMLLog(@"resmanager",@"ISO2GS=%@",ISO2GS); + NSDebugMLLog(@"resmanager",@"GS2ISO=%@",GS2ISO); + }; + ASSIGN(localISO2GSLanguages,[NSDictionary dictionaryWithDictionary:ISO2GS]); + ASSIGN(localGS2ISOLanguages,[NSDictionary dictionaryWithDictionary:GS2ISO]); + }; + }; - [globalAppGSWBundle clearCache]; - }; + [globalAppGSWBundle clearCache]; + }; LOGClassFnStop(); return globalAppGSWBundle; }; diff --git a/GSWeb.framework/GSWResourceURL.h b/GSWeb.framework/GSWResourceURL.h index caa7a00..ead1ca2 100644 --- a/GSWeb.framework/GSWResourceURL.h +++ b/GSWeb.framework/GSWResourceURL.h @@ -1,11 +1,16 @@ -/* GSWResourceURL.h - GSWeb: Class GSWResourceURL - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWResourceURL.h - GSWeb: Class GSWResourceURL + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Sept 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -31,8 +37,8 @@ @end @interface GSWResourceURL (GSWResourceURLA) --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; -(NSString*)valueAttributeName; -(NSString*)urlAttributeName; +(BOOL)hasGSWebObjectsAssociations; diff --git a/GSWeb.framework/GSWResourceURL.m b/GSWeb.framework/GSWResourceURL.m index 2845e97..4704d4f 100644 --- a/GSWeb.framework/GSWResourceURL.m +++ b/GSWeb.framework/GSWResourceURL.m @@ -1,11 +1,15 @@ -/* GSWResourceURL.m - GSWeb: Class GSWResourceURL - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWResourceURL.m - GSWeb: Class GSWResourceURL + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Sep 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +23,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -46,12 +51,12 @@ static char rcsId[] = "$Id$"; @implementation GSWResourceURL (GSWResourceURLA) //-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { LOGObjectFnStartC("GSWResourceURL"); - [self appendURLToResponse:response_ - inContext:context_]; + [self appendURLToResponse:response + inContext:context]; LOGObjectFnStopC("GSWResourceURL"); }; diff --git a/GSWeb.framework/GSWString.h b/GSWeb.framework/GSWString.h index f5a4e2a..91d4ffb 100644 --- a/GSWeb.framework/GSWString.h +++ b/GSWeb.framework/GSWString.h @@ -1,11 +1,16 @@ -/* GSWString.h - GSWeb: Class GSWString - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWString.h - GSWeb: Class GSWString + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,34 +35,36 @@ @interface GSWString: GSWHTMLDynamicElement { - GSWAssociation* value; - GSWAssociation* dateFormat; - GSWAssociation* numberFormat; - GSWAssociation* escapeHTML; + GSWAssociation* _value; + GSWAssociation* _dateFormat; + GSWAssociation* _numberFormat; + GSWAssociation* _escapeHTML; //GSWeb Additions { - GSWAssociation* convertHTML; - GSWAssociation* convertHTMLEntities; + GSWAssociation* _convertHTML; + GSWAssociation* _convertHTMLEntities; // } - GSWAssociation* formatter; + GSWAssociation* _formatter; }; -(void)dealloc; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(NSString*)description; --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; --(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping; --(BOOL)appendStringAtLeft:(id)_unkwnon - withMapping:(char*)_mapping; --(NSFormatter*)formatterForComponent:(GSWComponent*)_component - value:(id)value_; +-(BOOL)appendStringAtRight:(id)unkwnon + withMapping:(char*)mapping; + +-(BOOL)appendStringAtLeft:(id)unkwnon + withMapping:(char*)mapping; + +-(NSFormatter*)formatterForComponent:(GSWComponent*)component + value:(id)value; -(NSString*)elementName; @end diff --git a/GSWeb.framework/GSWString.m b/GSWeb.framework/GSWString.m index 7b36f23..ea8ee82 100644 --- a/GSWeb.framework/GSWString.m +++ b/GSWeb.framework/GSWString.m @@ -1,11 +1,16 @@ -/* GSWString.m - GSWeb: Class GSWString - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWString.m - GSWeb: Class GSWString + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -30,50 +36,50 @@ static char rcsId[] = "$Id$"; @implementation GSWString //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)_elements +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { //OK LOGObjectFnStartC("GSWString"); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements); + NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@", + aName,associations,elements); if ((self=[super initWithName:nil - associations:nil - contentElements:nil])) - { - value = [[associations_ objectForKey:value__Key - withDefaultObject:[value autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWString: value=%@",value); + associations:nil + contentElements:nil])) + { + _value = [[associations objectForKey:value__Key + withDefaultObject:[_value autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWString: value=%@",_value); - dateFormat = [[associations_ objectForKey:dateFormat__Key - withDefaultObject:[dateFormat autorelease]] retain]; + _dateFormat = [[associations objectForKey:dateFormat__Key + withDefaultObject:[_dateFormat autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWString: dateFormat=%@",dateFormat); + NSDebugMLLog(@"gswdync",@"GSWString: dateFormat=%@",_dateFormat); - numberFormat = [[associations_ objectForKey:numberFormat__Key - withDefaultObject:[numberFormat autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWString: numberFormat=%@",numberFormat); + _numberFormat = [[associations objectForKey:numberFormat__Key + withDefaultObject:[_numberFormat autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWString: numberFormat=%@",_numberFormat); - escapeHTML = [[associations_ objectForKey:escapeHTML__Key - withDefaultObject:[escapeHTML autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWString: escapeHTML=%@",escapeHTML); + _escapeHTML = [[associations objectForKey:escapeHTML__Key + withDefaultObject:[_escapeHTML autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWString: escapeHTML=%@",_escapeHTML); - if (!WOStrictFlag) - { - convertHTML = [[associations_ objectForKey:convertHTML__Key - withDefaultObject:[convertHTML autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWString: convertHTML=%@",convertHTML); + if (!WOStrictFlag) + { + _convertHTML = [[associations objectForKey:convertHTML__Key + withDefaultObject:[_convertHTML autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWString: convertHTML=%@",_convertHTML); - convertHTMLEntities = [[associations_ objectForKey:convertHTMLEntities__Key - withDefaultObject:[convertHTMLEntities autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWString: convertHTMLEntities=%@",convertHTMLEntities); - }; - - formatter = [[associations_ objectForKey:formatter__Key - withDefaultObject:[formatter autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWString: formatter=%@",formatter); - - }; + _convertHTMLEntities = [[associations objectForKey:convertHTMLEntities__Key + withDefaultObject:[_convertHTMLEntities autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWString: convertHTMLEntities=%@",_convertHTMLEntities); + }; + + _formatter = [[associations objectForKey:formatter__Key + withDefaultObject:[_formatter autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWString: formatter=%@",_formatter); + }; LOGObjectFnStopC("GSWString"); return self; }; @@ -81,13 +87,13 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(value); - DESTROY(dateFormat); - DESTROY(numberFormat); - DESTROY(escapeHTML); - DESTROY(convertHTML); //GSWeb Only - DESTROY(convertHTMLEntities); //GSWeb Only - DESTROY(formatter); + DESTROY(_value); + DESTROY(_dateFormat); + DESTROY(_numberFormat); + DESTROY(_escapeHTML); + DESTROY(_convertHTML); //GSWeb Only + DESTROY(_convertHTMLEntities); //GSWeb Only + DESTROY(_formatter); [super dealloc]; }; @@ -95,138 +101,138 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p - value=%@ dateFormat=%@ numberFormat=%@ escapeHTML=%@ formatter=%@>", - object_get_class_name(self), - (void*)self, - value, - dateFormat, - numberFormat, - escapeHTML, - formatter]; + object_get_class_name(self), + (void*)self, + _value, + _dateFormat, + _numberFormat, + _escapeHTML, + _formatter]; }; //-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - NSString* _formattedValue=nil; - GSWRequest* _request=nil; - BOOL _isFromClientComponent=NO; - GSWComponent* _component=nil; - id _valueValue = nil; + NSString* formattedValue=nil; + GSWRequest* request=nil; + BOOL isFromClientComponent=NO; + GSWComponent* component=nil; + id valueValue = nil; LOGObjectFnStartC("GSWString"); - NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context_ elementID]); - _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) - { - BOOL _escapeHTMLValue=YES; - BOOL _convertHTMLValue=NO; - BOOL _convertHTMLEntitiesValue=NO; - NSFormatter* _formatter=[self formatterForComponent:_component - value:_valueValue]; - if (!_formatter) - { - _formattedValue=_valueValue; - } - else - { - _formattedValue=[_formatter stringForObjectValue:_valueValue]; - NSDebugMLog(@"_valueValue=%@ _formattedValue=%@",_valueValue,_formattedValue); - }; + NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context elementID]); + 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) + { + BOOL escapeHTMLValue=YES; + BOOL convertHTMLValue=NO; + BOOL convertHTMLEntitiesValue=NO; + NSFormatter* formatter=[self formatterForComponent:component + value:valueValue]; + if (!formatter) + { + formattedValue=valueValue; + } + else + { + formattedValue=[formatter stringForObjectValue:valueValue]; + NSDebugMLog(@"valueValue=%@ formattedValue=%@",valueValue,formattedValue); + }; - if (!WOStrictFlag && convertHTML) - _convertHTMLValue=[self evaluateCondition:convertHTML - inContext:context_]; - if (!WOStrictFlag) + if (!WOStrictFlag && _convertHTML) + convertHTMLValue=[self evaluateCondition:_convertHTML + inContext:context]; + if (!WOStrictFlag) + { + if (!convertHTMLValue) { - if (!_convertHTMLValue) - { - if (convertHTMLEntities) - _convertHTMLEntitiesValue=[self evaluateCondition:convertHTMLEntities - inContext:context_]; - if (!_convertHTMLEntitiesValue) - { - if (escapeHTML) - _escapeHTMLValue=[self evaluateCondition:escapeHTML - inContext:context_]; - }; - }; - } - else if (escapeHTML) - _escapeHTMLValue=[self evaluateCondition:escapeHTML - inContext:context_]; + if (_convertHTMLEntities) + convertHTMLEntitiesValue=[self evaluateCondition:_convertHTMLEntities + inContext:context]; + if (!convertHTMLEntitiesValue) + { + if (_escapeHTML) + escapeHTMLValue=[self evaluateCondition:_escapeHTML + inContext:context]; + }; + }; + } + else if (_escapeHTML) + escapeHTMLValue=[self evaluateCondition:_escapeHTML + inContext:context]; - if (!WOStrictFlag && _convertHTMLValue) - [response_ appendContentHTMLConvertString:_formattedValue]; - else if (!WOStrictFlag && _convertHTMLEntitiesValue) - [response_ appendContentHTMLEntitiesConvertString:_formattedValue]; - else if (_escapeHTMLValue) - [response_ appendContentHTMLString:_formattedValue]; - else - [response_ appendContentString:_formattedValue]; - }; - NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]); + if (!WOStrictFlag && convertHTMLValue) + [response appendContentHTMLConvertString:formattedValue]; + else if (!WOStrictFlag && convertHTMLEntitiesValue) + [response appendContentHTMLEntitiesConvertString:formattedValue]; + else if (escapeHTMLValue) + [response appendContentHTMLString:formattedValue]; + else + [response appendContentString:formattedValue]; + }; + NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context elementID]); LOGObjectFnStopC("GSWString"); }; //-------------------------------------------------------------------- --(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping +-(BOOL)appendStringAtRight:(id)unkwnon + withMapping:(char*)mapping { LOGObjectFnNotImplemented(); //TODOFN return NO; }; //-------------------------------------------------------------------- --(BOOL)appendStringAtLeft:(id)_unkwnon - withMapping:(char*)_mapping +-(BOOL)appendStringAtLeft:(id)unkwnon + withMapping:(char*)mapping { LOGObjectFnNotImplemented(); //TODOFN return NO; }; //-------------------------------------------------------------------- --(NSFormatter*)formatterForComponent:(GSWComponent*)_component - value:(id)value_ +-(NSFormatter*)formatterForComponent:(GSWComponent*)component + value:(id)value { //OK - id _formatValue = nil; - NSFormatter* _formatter = nil; + id formatValue = nil; + NSFormatter* formatter = nil; LOGObjectFnStartC("GSWString"); - if (dateFormat) - { - NSDebugMLog0(@"DateFormat"); - _formatValue=[dateFormat valueInComponent:_component]; - if (_formatValue) - _formatter=[[[NSDateFormatter alloc]initWithDateFormat:_formatValue - allowNaturalLanguage:YES]autorelease]; - } - else if (numberFormat) - { - NSDebugMLog0(@"NumberFormat"); - _formatValue=[numberFormat valueInComponent:_component]; - if (_formatValue) - { -//TODO -/* _formatter=[[NSNumberFormatter new]autorelease]; - [_formatter setFormat:_formatValue]; -*/ - }; - } + if (_dateFormat) + { + NSDebugMLog0(@"DateFormat"); + formatValue=[_dateFormat valueInComponent:component]; + if (formatValue) + formatter=[[[NSDateFormatter alloc]initWithDateFormat:formatValue + allowNaturalLanguage:YES]autorelease]; + } + else if (_numberFormat) + { + NSDebugMLog0(@"NumberFormat"); + formatValue=[_numberFormat valueInComponent:component]; + if (formatValue) + { + //TODO + /* _formatter=[[NSNumberFormatter new]autorelease]; + [_formatter setFormat:_formatValue]; + */ + }; + } else - { - NSDebugMLog0(@"Formatter"); - _formatter=[formatter valueInComponent:_component]; - }; - NSDebugMLog(@"_formatter=%@",_formatter); + { + NSDebugMLog0(@"Formatter"); + formatter=[_formatter valueInComponent:component]; + }; + NSDebugMLog(@"formatter=%@",formatter); LOGObjectFnStopC("GSWString"); - return _formatter; + return formatter; }; //-------------------------------------------------------------------- diff --git a/GSWeb.framework/GSWSubmitButton.h b/GSWeb.framework/GSWSubmitButton.h index ee2c2f4..b467e91 100644 --- a/GSWeb.framework/GSWSubmitButton.h +++ b/GSWeb.framework/GSWSubmitButton.h @@ -1,11 +1,16 @@ -/* GSWSubmitButton.h - GSWeb: Class GSWSubmitButton - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWSubmitButton.h - GSWeb: Class GSWSubmitButton + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,13 +35,13 @@ //OK @interface GSWSubmitButton: GSWInput { - GSWAssociation* action; - GSWAssociation* actionClass; - GSWAssociation* directActionName; + GSWAssociation* _action; + GSWAssociation* _actionClass; + GSWAssociation* _directActionName; }; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations contentElements:(NSArray*)elements; -(void)dealloc; @@ -43,20 +49,20 @@ @end @interface GSWSubmitButton (GSWSubmitButtonA) --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(GSWElement*)invokeActionForRequest:(GSWRequest*)request + inContext:(GSWContext*)context; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; --(void)appendNameToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendNameToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; --(void)_appendActionClassAndNameToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)_appendActionClassAndNameToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; @end #endif //_GSWSubmitButton_h__ diff --git a/GSWeb.framework/GSWSubmitButton.m b/GSWeb.framework/GSWSubmitButton.m index a261d51..ffe8d22 100644 --- a/GSWeb.framework/GSWSubmitButton.m +++ b/GSWeb.framework/GSWSubmitButton.m @@ -1,11 +1,16 @@ -/* GSWSubmitButton.m - GSWeb: Class GSWSubmitButton - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWSubmitButton.m - GSWeb: Class GSWSubmitButton + + Copyright (C) 1999-2002 Free Software Foundation, Inc. Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,37 +35,39 @@ static char rcsId[] = "$Id$"; @implementation GSWSubmitButton //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)_elements +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { - NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; + NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations]; LOGObjectFnStart(); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ _elements=%@",name_,associations_,_elements); - [_associations setObject:[GSWAssociation associationWithValue:@"submit"] - forKey:@"type"]; - [_associations removeObjectForKey:action__Key]; - [_associations removeObjectForKey:actionClass__Key]; - if (directActionName) [_associations removeObjectForKey:directActionName]; + NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ _elements=%@", + aName,associations,elements); + [tmpAssociations setObject:[GSWAssociation associationWithValue:@"submit"] + forKey:@"type"]; + [tmpAssociations removeObjectForKey:action__Key]; + [tmpAssociations removeObjectForKey:actionClass__Key]; + if (_directActionName) + [tmpAssociations removeObjectForKey:_directActionName]; + + if (![tmpAssociations objectForKey:value__Key]) + [tmpAssociations setObject:[GSWAssociation associationWithValue:@"submit"] + forKey:value__Key]; - if (![_associations objectForKey:value__Key]) - [_associations setObject:[GSWAssociation associationWithValue:@"submit"] - forKey:value__Key]; - - if ((self=[super initWithName:name_ - associations:_associations - contentElements:nil])) - { - action = [[associations_ objectForKey:action__Key - withDefaultObject:[action autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWSumbitButton: action=%@",action); - actionClass = [[associations_ objectForKey:actionClass__Key - withDefaultObject:[actionClass autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWSumbitButton: actionClass=%@",actionClass); - directActionName = [[associations_ objectForKey:directActionName__Key - withDefaultObject:[directActionName autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWSumbitButton: directActionName=%@",directActionName); - }; + if ((self=[super initWithName:aName + associations:tmpAssociations + contentElements:nil])) + { + _action = [[associations objectForKey:action__Key + withDefaultObject:[_action autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWSumbitButton: action=%@",_action); + _actionClass = [[associations objectForKey:actionClass__Key + withDefaultObject:[_actionClass autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWSumbitButton: actionClass=%@",_actionClass); + _directActionName = [[associations objectForKey:directActionName__Key + withDefaultObject:[_directActionName autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWSumbitButton: directActionName=%@",_directActionName); + }; LOGObjectFnStop(); return self; }; @@ -67,9 +75,9 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(action); - DESTROY(actionClass); - DESTROY(directActionName); + DESTROY(_action); + DESTROY(_actionClass); + DESTROY(_directActionName); [super dealloc]; }; @@ -79,146 +87,148 @@ static char rcsId[] = "$Id$"; @implementation GSWSubmitButton (GSWSubmitButtonA) //-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK LOGObjectFnStart(); - GSWSaveAppendToResponseElementID(context_);//Debug Only - [super appendToResponse:response_ - inContext:context_]; + GSWSaveAppendToResponseElementID(context);//Debug Only + [super appendToResponse:response + inContext:context]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(GSWElement*)invokeActionForRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK - GSWElement* _element=nil; - BOOL _disabled=NO; + GSWElement* element=nil; + BOOL disabledValue=NO; LOGObjectFnStart(); - NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@",[self class],[context_ elementID],[context_ senderID]); + NSDebugMLLog(@"gswdync",@"ET=%@ id=%@ senderId=%@", + [self class],[context elementID],[context senderID]); NS_DURING - { - GSWAssertCorrectElementID(context_);// Debug Only - _disabled=[self disabledInContext:context_]; - NSDebugMLLog(@"gswdync",@"_disabled=%s",(_disabled ? "YES" : "NO")); - if (!_disabled) - { - BOOL _wasFormSubmitted=[context_ _wasFormSubmitted]; - if (_wasFormSubmitted) - { - BOOL _invoked=NO; - GSWComponent* _component=[context_ component]; - BOOL _isMultipleSubmitForm=[context_ _isMultipleSubmitForm]; - if (_isMultipleSubmitForm) - { - NSString* _nameInContext=[self nameInContext:context_]; - NSString* _formValue=[request_ formValueForKey:_nameInContext]; - NSDebugMLLog(@"gswdync",@"_formValue=%@",_formValue); - if (_formValue) - _invoked=YES; - else - { - NSDebugMLLog(@"gswdync",@"[request_ formValueKeys]=%@",[request_ formValueKeys]); - }; - } - else - _invoked=YES; - if (_invoked) - { - id _actionValue=nil; - NSDebugMLLog0(@"gswdync",@"Invoked Object Found !!"); - [context_ _setActionInvoked:1]; - NS_DURING - { - NSDebugMLLog(@"gswdync",@"Invoked Object Found: action=%@",action); - _actionValue=[action valueInComponent:_component]; - } - NS_HANDLER - { - LOGException0(@"exception in GSWSubmitButton invokeActionForRequest:inContext action"); - LOGException(@"exception=%@",localException); - localException=ExceptionByAddingUserInfoObjectFrameInfo(localException, - @"In GSWSubmitButton invokeActionForRequest:inContext action %@",action); - LOGException(@"exception=%@",localException); - [localException raise]; - } - NS_ENDHANDLER; - if (_actionValue) - _element=_actionValue; - if (_element) - { - if (![_element isKindOfClass:[GSWComponent class]]) //TODO GSWComponent or Element ? - { - ExceptionRaise0(@"GSWHyperlink",@"Invoked element return a not GSWComponent element"); - } - else - { - // call awakeInContext when _element is sleeping deeply - [_element ensureAwakeInContext:context_]; - /* - if (![_element context]) { - NSDebugMLLog(@"gswdync",@"_element sleeps, awake it = %@",_element); - [_element awakeInContext:context_]; - } else { - [_element awakeInContext:context_]; - } - */ - } - } - /* ??? - if (!_element) - _element=[context_ page]; - */ - }; - }; - }; - } + { + GSWAssertCorrectElementID(context);// Debug Only + disabledValue=[self disabledInContext:context]; + NSDebugMLLog(@"gswdync",@"disabledValue=%s",(disabledValue ? "YES" : "NO")); + if (!disabledValue) + { + BOOL wasFormSubmitted=[context _wasFormSubmitted]; + if (wasFormSubmitted) + { + BOOL invoked=NO; + GSWComponent* component=[context component]; + BOOL isMultipleSubmitForm=[context _isMultipleSubmitForm]; + if (isMultipleSubmitForm) + { + NSString* nameInContext=[self nameInContext:context]; + NSString* formValue=[request formValueForKey:nameInContext]; + NSDebugMLLog(@"gswdync",@"formValue=%@",formValue); + if (formValue) + invoked=YES; + else + { + NSDebugMLLog(@"gswdync",@"[request formValueKeys]=%@",[request formValueKeys]); + }; + } + else + invoked=YES; + if (invoked) + { + id actionValue=nil; + NSDebugMLLog0(@"gswdync",@"Invoked Object Found !!"); + [context setActionInvoked:1]; + NS_DURING + { + NSDebugMLLog(@"gswdync",@"Invoked Object Found: action=%@",_action); + actionValue=[_action valueInComponent:component]; + } + NS_HANDLER + { + LOGException0(@"exception in GSWSubmitButton invokeActionForRequest:inContext action"); + LOGException(@"exception=%@",localException); + localException=ExceptionByAddingUserInfoObjectFrameInfo(localException, + @"In GSWSubmitButton invokeActionForRequest:inContext action %@", + _action); + LOGException(@"exception=%@",localException); + [localException raise]; + } + NS_ENDHANDLER; + if (actionValue) + element=actionValue; + if (element) + { + if (![element isKindOfClass:[GSWComponent class]]) //TODO GSWComponent or Element ? + { + ExceptionRaise0(@"GSWHyperlink",@"Invoked element return a not GSWComponent element"); + } + else + { + // call awakeInContext when _element is sleeping deeply + [element ensureAwakeInContext:context]; + /* + if (![_element context]) { + NSDebugMLLog(@"gswdync",@"_element sleeps, awake it = %@",_element); + [_element awakeInContext:context]; + } else { + [_element awakeInContext:context]; + } + */ + } + } + /* ??? + if (!_element) + _element=[context page]; + */ + }; + }; + }; + } NS_HANDLER - { - LOGException0(@"exception in GSWSubmitButton invokeActionForRequest:inContext"); - LOGException(@"exception=%@",localException); - localException=ExceptionByAddingUserInfoObjectFrameInfo(localException, - @"In GSWSubmitButton invokeActionForRequest:inContext"); - LOGException(@"exception=%@",localException); - [localException raise]; - } + { + LOGException0(@"exception in GSWSubmitButton invokeActionForRequest:inContext"); + LOGException(@"exception=%@",localException); + localException=ExceptionByAddingUserInfoObjectFrameInfo(localException, + @"In GSWSubmitButton invokeActionForRequest:inContext"); + LOGException(@"exception=%@",localException); + [localException raise]; + } NS_ENDHANDLER; - //if (![context_ _wasActionInvoked] && [[[context_ elementID] parentElementIDString] compare:[context_ senderID]]!=NSOrderedAscending) - if (![context_ _wasActionInvoked] && [[[context_ elementID] parentElementIDString] isSearchOverForSenderID:[context_ senderID]]) - { - LOGError(@"Action not invoked at the end of %@ (id=%@) senderId=%@", - [self class], - [context_ elementID], - [context_ senderID]); - }; + //if (![context _wasActionInvoked] && [[[context elementID] parentElementIDString] compare:[context senderID]]!=NSOrderedAscending) + if (![context _wasActionInvoked] && [[[context elementID] parentElementIDString] isSearchOverForSenderID:[context senderID]]) + { + LOGError(@"Action not invoked at the end of %@ (id=%@) senderId=%@", + [self class], + [context elementID], + [context senderID]); + }; LOGObjectFnStop(); - return _element; + return element; }; //-------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //Does Nothing ? - GSWAssertCorrectElementID(context_);// Debug Only + GSWAssertCorrectElementID(context);// Debug Only }; //-------------------------------------------------------------------- --(void)appendNameToResponse:(GSWResponse*)_response - inContext:(GSWContext*)_context +-(void)appendNameToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK //Here we call parent (GSWInput) method instead of doing it by ourself (as GSW) - [super appendNameToResponse:_response - inContext:_context]; + [super appendNameToResponse:response + inContext:context]; }; //-------------------------------------------------------------------- --(void)_appendActionClassAndNameToResponse:(GSWResponse*)_response - inContext:(GSWContext*)_context +-(void)_appendActionClassAndNameToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { LOGObjectFnNotImplemented(); //TODOFN }; diff --git a/GSWeb.framework/GSWText.h b/GSWeb.framework/GSWText.h index 6f3c4cb..0c03181 100644 --- a/GSWeb.framework/GSWText.h +++ b/GSWeb.framework/GSWText.h @@ -1,11 +1,16 @@ -/* GSWText.h - GSWeb: Class GSWText - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWText.h - GSWeb: Class GSWText + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -30,9 +36,9 @@ //==================================================================== @interface GSWText: GSWInput --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(void)dealloc; -(NSString*)description; @@ -42,18 +48,18 @@ //==================================================================== @interface GSWText (GSWTextA) --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; --(NSString*)_filterSoftReturnsFromString:(NSString*)string_; +-(NSString*)_filterSoftReturnsFromString:(NSString*)string; @end //==================================================================== @interface GSWText (GSWTextB) --(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping; +-(BOOL)appendStringAtRight:(id)unkwnon + withMapping:(char*)mapping; @end #endif //_GSWText_h__ diff --git a/GSWeb.framework/GSWText.m b/GSWeb.framework/GSWText.m index 66ea492..05a92b5 100644 --- a/GSWeb.framework/GSWText.m +++ b/GSWeb.framework/GSWText.m @@ -1,11 +1,16 @@ -/* GSWText.h - GSWeb: Class GSWText - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWText.m - GSWeb: Class GSWText + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,15 +35,15 @@ static char rcsId[] = "$Id$"; @implementation GSWText //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { - if ((self=[super initWithName:name_ - associations:associations_ - contentElements:nil])) - { - }; + if ((self=[super initWithName:name + associations:associations + contentElements:nil])) + { + }; return self; }; @@ -51,8 +57,8 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p>", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; //-------------------------------------------------------------------- @@ -67,67 +73,67 @@ static char rcsId[] = "$Id$"; @implementation GSWText (GSWTextA) //-------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { - if (value && [value isValueSettable]) - { - GSWComponent* _component=[context_ component]; - id _formValue=[request_ formValueForKey:[context_ elementID]]; - if (!WOStrictFlag) + if (_value && [_value isValueSettable]) + { + GSWComponent* component=[context component]; + id formValue=[request formValueForKey:[context elementID]]; + if (!WOStrictFlag) + { + NS_DURING { - NS_DURING - { - [value setValue:_formValue - inComponent:_component]; - }; - NS_HANDLER - { - [self handleValidationException:localException - inContext:context_]; - } - NS_ENDHANDLER; + [_value setValue:formValue + inComponent:component]; + }; + NS_HANDLER + { + [self handleValidationException:localException + inContext:context]; } - else - [value setValue:_formValue - inComponent:_component]; - }; - [super takeValuesFromRequest:request_ - inContext:context_]; + NS_ENDHANDLER; + } + else + [_value setValue:formValue + inComponent:component]; + }; + [super takeValuesFromRequest:request + inContext:context]; }; //-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - GSWRequest* _request=[context_ request]; - NSString* _valueValue=nil; - NSString* _valueValueFiltered=nil; - BOOL _isFromClientComponent=[_request isFromClientComponent]; - GSWComponent* _component=[context_ component]; - [super appendToResponse:response_ - inContext:context_]; - _valueValue=[value valueInComponent:_component]; - _valueValueFiltered=[self _filterSoftReturnsFromString:_valueValue]; - [response_ appendContentHTMLString:_valueValueFiltered]; - [response_ _appendContentAsciiString:@""]; + GSWRequest* request=[context request]; + NSString* valueValue=nil; + NSString* valueValueFiltered=nil; + BOOL isFromClientComponent=[request isFromClientComponent]; + GSWComponent* component=[context component]; + [super appendToResponse:response + inContext:context]; + valueValue=[_value valueInComponent:component]; + valueValueFiltered=[self _filterSoftReturnsFromString:valueValue]; + [response appendContentHTMLString:valueValueFiltered]; + [response _appendContentAsciiString:@""]; }; //-------------------------------------------------------------------- --(NSString*)_filterSoftReturnsFromString:(NSString*)string_ +-(NSString*)_filterSoftReturnsFromString:(NSString*)string { LOGObjectFnNotImplemented(); //TODOFN - return string_; + return string; }; @end //==================================================================== @implementation GSWText (GSWTextB) --(BOOL)appendStringAtRight:(id)_unkwnon - withMapping:(char*)_mapping +-(BOOL)appendStringAtRight:(id)unkwnon + withMapping:(char*)mapping { LOGObjectFnNotImplemented(); //TODOFN return NO; diff --git a/GSWeb.framework/GSWTextField.h b/GSWeb.framework/GSWTextField.h index 1395a81..7376d8b 100644 --- a/GSWeb.framework/GSWTextField.h +++ b/GSWeb.framework/GSWTextField.h @@ -1,11 +1,16 @@ -/* GSWTextField.h - GSWeb: Class GSWTextField - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWTextField.h - GSWeb: Class GSWTextField + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,20 +35,20 @@ //OK @interface GSWTextField: GSWInput { - GSWAssociation* dateFormat; - GSWAssociation* numberFormat; - GSWAssociation* useDecimalNumber; - GSWAssociation* formatter; + GSWAssociation* _dateFormat; + GSWAssociation* _numberFormat; + GSWAssociation* _useDecimalNumber; + GSWAssociation* _formatter; }; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(void)dealloc; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(NSFormatter*)formatterForComponent:(GSWComponent*)_component; +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context; +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context; +-(NSFormatter*)formatterForComponent:(GSWComponent*)component; @end diff --git a/GSWeb.framework/GSWTextField.m b/GSWeb.framework/GSWTextField.m index 063a031..265a3e5 100644 --- a/GSWeb.framework/GSWTextField.m +++ b/GSWeb.framework/GSWTextField.m @@ -1,11 +1,16 @@ -/* GSWTextField.h - GSWeb: Class GSWTextField - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWTextField.m - GSWeb: Class GSWTextField + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web Library. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,36 +35,36 @@ static char rcsId[] = "$Id$"; @implementation GSWTextField //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { - NSMutableDictionary* _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; + NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations]; LOGObjectFnStartC("GSWTextField"); - NSDebugMLLog(@"gswdync",@"name_=%@ associations_:%@ elements_=%@",name_,associations_,elements_); - [_associations setObject:[GSWAssociation associationWithValue:@"text"] - forKey:@"type"]; - [_associations removeObjectForKey:dateFormat__Key]; - [_associations removeObjectForKey:numberFormat__Key]; - [_associations removeObjectForKey:useDecimalNumber__Key]; - [_associations removeObjectForKey:formatter__Key]; - if ((self=[super initWithName:name_ - associations:_associations - contentElements:nil])) //No Childs! - { - dateFormat = [[associations_ objectForKey:dateFormat__Key - withDefaultObject:[dateFormat autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWTextField: dateFormat=%@",dateFormat); - numberFormat = [[associations_ objectForKey:numberFormat__Key - withDefaultObject:[numberFormat autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWTextField: numberFormat=%@",numberFormat); - useDecimalNumber = [[associations_ objectForKey:useDecimalNumber__Key - withDefaultObject:[useDecimalNumber autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWTextField: useDecimalNumber=%@",useDecimalNumber); - formatter = [[associations_ objectForKey:formatter__Key - withDefaultObject:[formatter autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"GSWTextField: formatter=%@",formatter); - }; + NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",aName,associations,elements); + [tmpAssociations setObject:[GSWAssociation associationWithValue:@"text"] + forKey:@"type"]; + [tmpAssociations removeObjectForKey:dateFormat__Key]; + [tmpAssociations removeObjectForKey:numberFormat__Key]; + [tmpAssociations removeObjectForKey:useDecimalNumber__Key]; + [tmpAssociations removeObjectForKey:formatter__Key]; + if ((self=[super initWithName:aName + associations:tmpAssociations + contentElements:nil])) //No Childs! + { + _dateFormat = [[associations objectForKey:dateFormat__Key + withDefaultObject:[_dateFormat autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWTextField: dateFormat=%@",_dateFormat); + _numberFormat = [[associations objectForKey:numberFormat__Key + withDefaultObject:[_numberFormat autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWTextField: numberFormat=%@",_numberFormat); + _useDecimalNumber = [[associations objectForKey:useDecimalNumber__Key + withDefaultObject:[_useDecimalNumber autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWTextField: useDecimalNumber=%@",_useDecimalNumber); + _formatter = [[associations objectForKey:formatter__Key + withDefaultObject:[_formatter autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"GSWTextField: formatter=%@",_formatter); + }; LOGObjectFnStopC("GSWTextField"); return self; }; @@ -66,167 +72,171 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(dateFormat); - DESTROY(numberFormat); - DESTROY(useDecimalNumber); - DESTROY(formatter); + DESTROY(_dateFormat); + DESTROY(_numberFormat); + DESTROY(_useDecimalNumber); + DESTROY(_formatter); [super dealloc]; }; //-------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)request + inContext:(GSWContext*)context { //OK - BOOL _disabled=NO; + BOOL disabledValue=NO; LOGObjectFnStartC("GSWTextField"); - GSWAssertCorrectElementID(context_);// Debug Only - _disabled=[self disabledInContext:context_]; - if (!_disabled) - { - BOOL _wasFormSubmitted=[context_ _wasFormSubmitted]; - if (_wasFormSubmitted) - { - GSWComponent* _component=[context_ component]; - NSString* _nameInContext=[self nameInContext:context_]; - NSString* _value=[request_ formValueForKey:_nameInContext]; - id _resultValue=nil; - NSDebugMLLog(@"gswdync",@"_nameInContext=%@",_nameInContext); - NSDebugMLLog(@"gswdync",@"_value=%@",_value); - if (_value) - { - NSFormatter* _formatter=[self formatterForComponent:_component]; - NSDebugMLLog(@"gswdync",@"_formatter=%@",_formatter); - if (_formatter) - { - NSString* _errorDscr=nil; - if (![_formatter getObjectValue:&_resultValue - forString:_value - errorDescription:&_errorDscr]) - { - NSException* _exception=nil; - NSString* _valueKeyPath=[value keyPath]; - LOGException(@"EOValidationException _resultValue=%@ _valueKeyPath=%@",_resultValue,_valueKeyPath); - _exception=[NSException exceptionWithName:@"EOValidationException" - reason:_errorDscr /*_exceptionDscr*/ - userInfo:[NSDictionary - dictionaryWithObjectsAndKeys: - (_resultValue ? _resultValue : @"nil"),@"EOValidatedObjectUserInfoKey", - _valueKeyPath,@"EOValidatedPropertyUserInfoKey", - nil,nil]]; - [_component validationFailedWithException:_exception - value:_resultValue - keyPath:_valueKeyPath]; - }; - } - else - _resultValue=_value; - }; - NSDebugMLLog(@"gswdync",@"_resultValue=%@",_resultValue); - - // Turbocat - if ([self _isFormattedValueInComponent:_component equalToFormattedValue:_value]) { - // does nothing, old formatted values are equal - } else { - - if (!WOStrictFlag) + GSWAssertCorrectElementID(context);// Debug Only + disabledValue=[self disabledInContext:context]; + if (!disabledValue) + { + BOOL wasFormSubmitted=[context _wasFormSubmitted]; + if (wasFormSubmitted) + { + GSWComponent* component=[context component]; + NSString* nameInContext=[self nameInContext:context]; + NSString* value=[request formValueForKey:nameInContext]; + id resultValue=nil; + NSDebugMLLog(@"gswdync",@"nameInContext=%@",nameInContext); + NSDebugMLLog(@"gswdync",@"value=%@",value); + if (value) + { + NSFormatter* formatter=[self formatterForComponent:component]; + NSDebugMLLog(@"gswdync",@"formatter=%@",formatter); + if (formatter) + { + NSString* errorDscr=nil; + if (![formatter getObjectValue:&resultValue + forString:value + errorDescription:&errorDscr]) { - NS_DURING - { - [value setValue:_resultValue - inComponent:_component]; - }; - NS_HANDLER - { - [self handleValidationException:localException - inContext:context_]; - } - NS_ENDHANDLER; + NSException* exception=nil; + NSString* valueKeyPath=[value keyPath]; + LOGException(@"EOValidationException resultValue=%@ valueKeyPath=%@", + resultValue,valueKeyPath); + exception=[NSException exceptionWithName:@"EOValidationException" + reason:errorDscr /*_exceptionDscr*/ + userInfo:[NSDictionary + dictionaryWithObjectsAndKeys: + (resultValue ? resultValue : @"nil"),@"EOValidatedObjectUserInfoKey", + valueKeyPath,@"EOValidatedPropertyUserInfoKey", + nil,nil]]; + [component validationFailedWithException:exception + value:resultValue + keyPath:valueKeyPath]; + }; + } + else + resultValue=value; + }; + NSDebugMLLog(@"gswdync",@"resultValue=%@",resultValue); + + // Turbocat + if ([self _isFormattedValueInComponent:component + equalToFormattedValue:value]) + { + // does nothing, old formatted values are equal + } + else + { + if (!WOStrictFlag) + { + NS_DURING + { + [_value setValue:resultValue + inComponent:component]; + }; + NS_HANDLER + { + [self handleValidationException:localException + inContext:context]; } - else - [value setValue:_resultValue - inComponent:_component]; - } - }; - }; + NS_ENDHANDLER; + } + else + [_value setValue:resultValue + inComponent:component]; + } + }; + }; LOGObjectFnStopC("GSWTextField"); }; //-------------------------------------------------------------------- --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)_response - inContext:(GSWContext*)context_ +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response + inContext:(GSWContext*)context { //OK - id _valueValue=nil; - id _formattedValue=nil; - NSFormatter* _formatter=nil; - GSWComponent* _component=nil; - id _valueTmp=nil; + id valueValue=nil; + id formattedValue=nil; + NSFormatter* formatter=nil; + GSWComponent* component=nil; + id valueTmp=nil; LOGObjectFnStartC("GSWTextField"); - _component=[context_ component]; + component=[context component]; //To avoid input value printing (stupid original hack !) - _valueTmp=value; - value=nil; - [super appendGSWebObjectsAssociationsToResponse:_response - inContext:context_]; + valueTmp=_value; + _value=nil; + [super appendGSWebObjectsAssociationsToResponse:response + inContext:context]; //To avoid input value printing (stupid original hack !) - value=_valueTmp; - _valueTmp=nil; - _valueValue=[value valueInComponent:_component]; - _formatter=[self formatterForComponent:_component]; - if (!_formatter) - { - NSDebugMLog0(@"No Formatter"); - _formattedValue=_valueValue; - } + _value=valueTmp; + valueTmp=nil; + valueValue=[_value valueInComponent:component]; + formatter=[self formatterForComponent:component]; + if (!formatter) + { + NSDebugMLog0(@"No Formatter"); + formattedValue=valueValue; + } else - { - _formattedValue=[_formatter stringForObjectValue:_valueValue]; - }; - [_response appendContentCharacter:' ']; - [_response _appendContentAsciiString:@"value"]; - [_response appendContentCharacter:'=']; - [_response appendContentCharacter:'"']; - [_response appendContentHTMLAttributeValue:_formattedValue]; - [_response appendContentCharacter:'"']; + { + formattedValue=[formatter stringForObjectValue:valueValue]; + }; + [response appendContentCharacter:' ']; + [response _appendContentAsciiString:@"value"]; + [response appendContentCharacter:'=']; + [response appendContentCharacter:'"']; + [response appendContentHTMLAttributeValue:formattedValue]; + [response appendContentCharacter:'"']; LOGObjectFnStopC("GSWTextField"); }; //-------------------------------------------------------------------- --(NSFormatter*)formatterForComponent:(GSWComponent*)_component +-(NSFormatter*)formatterForComponent:(GSWComponent*)component { //OK - id _formatValue = nil; - id _formatter = nil; + id formatValue = nil; + id formatter = nil; LOGObjectFnStartC("GSWTextField"); - if (dateFormat) - { - NSDebugMLog0(@"DateFormat"); - _formatValue=[dateFormat valueInComponent:_component]; - if (_formatValue) - _formatter=[[[NSDateFormatter alloc]initWithDateFormat:_formatValue - allowNaturalLanguage:YES]autorelease]; - } - else if (numberFormat) - { - NSDebugMLog0(@"NumberFormat"); - _formatValue=[numberFormat valueInComponent:_component]; - if (_formatValue) - { -//TODO -/* - _formatter=[[NSNumberFormatter new]autorelease]; - [_formatter setFormat:_formatValue]; -*/ - }; - } + if (_dateFormat) + { + NSDebugMLog0(@"DateFormat"); + formatValue=[_dateFormat valueInComponent:component]; + if (formatValue) + formatter=[[[NSDateFormatter alloc]initWithDateFormat:formatValue + allowNaturalLanguage:YES]autorelease]; + } + else if (_numberFormat) + { + NSDebugMLog0(@"NumberFormat"); + formatValue=[_numberFormat valueInComponent:component]; + if (formatValue) + { + //TODO + /* + formatter=[[NSNumberFormatter new]autorelease]; + [formatter setFormat:formatValue]; + */ + }; + } else - { - NSDebugMLog0(@"Formatter"); - _formatter=[formatter valueInComponent:_component]; - }; + { + NSDebugMLog0(@"Formatter"); + formatter=[_formatter valueInComponent:component]; + }; LOGObjectFnStopC("GSWTextField"); - return _formatter; + return formatter; }; @end @@ -235,32 +245,36 @@ static char rcsId[] = "$Id$"; @implementation GSWTextField (TurbocatAdditions) //-------------------------------------------------------------------- -- (BOOL)_isFormattedValueInComponent:(GSWComponent *)_component equalToFormattedValue:(NSString *)newFormattedValue +- (BOOL)_isFormattedValueInComponent:(GSWComponent *)component + equalToFormattedValue:(NSString *)newFormattedValue { - id _valueValue=nil; - id _formattedValue=nil; - NSFormatter* _formatter=nil; - - if (!newFormattedValue) { - return NO; - } + id valueValue=nil; + id formattedValue=nil; + NSFormatter* formatter=nil; + if (!newFormattedValue) + { + return NO; + } + // get own value - _valueValue=[value valueInComponent:_component]; - _formatter=[self formatterForComponent:_component]; - if (!_formatter) - { - //NSLog(@"No Formatter in _isFormattedValueInComponent"); - _formattedValue=_valueValue; - } + valueValue=[_value valueInComponent:component]; + formatter=[self formatterForComponent:component]; + if (!formatter) + { + formattedValue=valueValue; + } else - { - _formattedValue=[_formatter stringForObjectValue:_valueValue]; - }; + { + formattedValue=[formatter stringForObjectValue:valueValue]; + }; - if (_formattedValue && [newFormattedValue isEqualToString:_formattedValue]) { - NSLog(@"### GSWTextField : are EQUAL ###"); - return YES; - } + if (formattedValue && [newFormattedValue isEqualToString:formattedValue]) + { + NSLog(@"### GSWTextField : are EQUAL ###"); + return YES; + } return NO; } + +@end diff --git a/GSWeb.framework/GSWUtils.m b/GSWeb.framework/GSWUtils.m index 8a6fc6b..c69d501 100644 --- a/GSWeb.framework/GSWUtils.m +++ b/GSWeb.framework/GSWUtils.m @@ -52,7 +52,7 @@ BOOL boolValueFor(id id_) return YES; else if (/*id_==BNNO ||*/ id_==NSTNO) return NO; - else if ([id_ conformsTo:@protocol(NSString)] && [id_ length]>0) + else if (/*[id_ conformsTo:@protocol(NSString)]*/ [id_ isKindOfClass:[NSString class]] && [id_ length]>0) return ([id_ caseInsensitiveCompare: @"NO"]!=NSOrderedSame); else if ([id_ respondsToSelector:@selector(boolValue)] && [id_ boolValue]) return YES; @@ -78,7 +78,7 @@ BOOL boolValueWithDefaultFor(id id_,BOOL default_) else if (/*id_==BNNO ||*/ id_==NSTNO) return NO; //@protocol NSString - else if ([id_ conformsTo:@protocol(NSString)] && [id_ length]>0) + else if (/*[id_ conformsTo:@protocol(NSString)]*/ [id_ isKindOfClass:[NSString class]] && [id_ length]>0) return ([id_ caseInsensitiveCompare: @"NO"]!=NSOrderedSame); else if ([id_ respondsToSelector:@selector(boolValue)]) return ([id_ boolValue]!=NO);