2002-11-18 Manuel Guesdon <mguesdon@orange-concept.com>

I've rewritten AutoValue handling in GSWBrowser,GSWCheckBoxList,
		GSWRadioButtonList, GSWPopUpButton to make it coherent
		and working like specifications.

	* GSWeb/GSWSwitchComponent.m:
		o add more information when componentName is null
	* GSWRepetition.h/.m:
		o added startIndex, stopIndex
	* GSWeb/GSWConstants.h/.m:
		o added startIndex__Key,stopIndex__Key
	* GSWeb/GSWComponent.h/.m:
		o replace _isSynchronized by _isParentToComponentSynchronized and
			_isComponentToParentSynchronized;
		o added -synchronizesParentToComponentVariablesWithBindings and
		        -synchronizesComponentToParentVariablesWithBindings
	* GSWeb/GSWApplication.m:
		o doc/comments
		o Exception when no session class found
	* GSWeb/GSWComponentDefinition.m
		o doc/comments
	* GSWeb/GSWComponentRequestHandler.m
		o doc/comments
		o response message changed when request handling failed
	* GSWeb/GSWMailDelivery.m
		o implemented composeEmail...component: methods
		o change mail sending code
	* GSWeb/GSWContext.h/.m:
		o replace ASSIGNCOPY by ASSIGN in -copy for _awakePageComponents);
	* GSWeb/GSWHyperlink.m:
		o replaced otherAssociations by otherQueryAssociations in -computeQueryDictionaryInContext
		o hanldle queryDictionary association
		o GSWPopUpButton.m:
	* GSWExtensionsGSW.framework/GSWValidationFailureComponent.gswc/GSWValidationFailureComponent.html:
		o replaced <br> by <br/>
	* GSWeb/GSWInput.h
		o removed autoValue variable  (static var may cause multithread problems and there were different autoValue implementation).
		o remove name key to avoid duplicate name in html produced code
		o some rewrite for auto value
		o doc/comments
	* GSWeb/GSWPopUpButton.h/.m:
		o use super appendToResponse:inContext: (no more name problem)
		o rewriten auto value handling (see Testing/DynamicElements for test)
		o doc/comments
	* GSWeb/GSWBrowser.h/.m:
		o use super appendToResponse:inContext: (no more name problem)
		o rewriten auto value handling (see Testing/DynamicElements for test)
		o doc/comments
	* GSWeb/GSWCheckBoxList.h/.m:
		o rewriten auto value handling (see Testing/DynamicElements for test)
		o handling disabled binding
		o doc/comments
	* GSWeb/GSWRadioButtonList.h/.m:
		o rewriten auto value handling (see Testing/DynamicElements for test)
		o handling disabled binding
		o doc/comments
	* GSWeb/GSWTextField.h/.m:
		o output value in appendValueToResponse:inContext: instead of
			appendGSWebObjectsAssociationsToResponse:inContext:
	* GSWExtensions.framework/GSWLongResponsePage.h/.m
		o added


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@15008 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mguesdon 2002-11-18 11:14:55 +00:00
parent 3cde2f785b
commit c5edf863de
97 changed files with 3815 additions and 794 deletions

View file

@ -1,3 +1,65 @@
2002-11-18 Manuel Guesdon <mguesdon@orange-concept.com>
I've rewritten AutoValue handling in GSWBrowser,GSWCheckBoxList,
GSWRadioButtonList, GSWPopUpButton to make it coherent
and working like specifications.
* GSWeb/GSWSwitchComponent.m:
o add more information when componentName is null
* GSWRepetition.h/.m:
o added startIndex, stopIndex
* GSWeb/GSWConstants.h/.m:
o added startIndex__Key,stopIndex__Key
* GSWeb/GSWComponent.h/.m:
o replace _isSynchronized by _isParentToComponentSynchronized and
_isComponentToParentSynchronized;
o added -synchronizesParentToComponentVariablesWithBindings and
-synchronizesComponentToParentVariablesWithBindings
* GSWeb/GSWApplication.m:
o doc/comments
o Exception when no session class found
* GSWeb/GSWComponentDefinition.m
o doc/comments
* GSWeb/GSWComponentRequestHandler.m
o doc/comments
o response message changed when request handling failed
* GSWeb/GSWMailDelivery.m
o implemented composeEmail...component: methods
o change mail sending code
* GSWeb/GSWContext.h/.m:
o replace ASSIGNCOPY by ASSIGN in -copy for _awakePageComponents);
* GSWeb/GSWHyperlink.m:
o replaced otherAssociations by otherQueryAssociations in -computeQueryDictionaryInContext
o hanldle queryDictionary association
o GSWPopUpButton.m:
* GSWExtensionsGSW.framework/GSWValidationFailureComponent.gswc/GSWValidationFailureComponent.html:
o replaced <br> by <br/>
* GSWeb/GSWInput.h
o removed autoValue variable (static var may cause multithread problems and there were different autoValue implementation).
o remove name key to avoid duplicate name in html produced code
o some rewrite for auto value
o doc/comments
* GSWeb/GSWPopUpButton.h/.m:
o use super appendToResponse:inContext: (no more name problem)
o rewriten auto value handling (see Testing/DynamicElements for test)
o doc/comments
* GSWeb/GSWBrowser.h/.m:
o use super appendToResponse:inContext: (no more name problem)
o rewriten auto value handling (see Testing/DynamicElements for test)
o doc/comments
* GSWeb/GSWCheckBoxList.h/.m:
o rewriten auto value handling (see Testing/DynamicElements for test)
o handling disabled binding
o doc/comments
* GSWeb/GSWRadioButtonList.h/.m:
o rewriten auto value handling (see Testing/DynamicElements for test)
o handling disabled binding
o doc/comments
* GSWeb/GSWTextField.h/.m:
o output value in appendValueToResponse:inContext: instead of
appendGSWebObjectsAssociationsToResponse:inContext:
* GSWExtensions.framework/GSWLongResponsePage.h/.m
o added
2002-10-28 David Wetzel <dave@turbocat.de>
* a start to make statistics work
Modified Files:

View file

@ -1,16 +1,12 @@
/*
* Hello.wod
* HelloPage.gswd
*
* You may freely copy, distribute and reuse the code in this example.
* NeXT disclaims any warranty of any kind, expressed or implied, as to
* We disclaims any warranty of any kind, expressed or implied, as to
* its fitness for any particular use.
*
* This example was written with a Beta version of WebObjects.
*
* Written by WebObjects Development Team
*
* This is the declarations file for the second page (Hello) of the
* HelloWorldObjC application.
* HelloWorld ObjC application.
*/
BODY_NAME_STRING:GSWString {value = nameString}

View file

@ -2,7 +2,7 @@
* HelloPage.h
*
* You may freely copy, distribute and reuse the code in this example.
* Apple disclaims any warranty of any kind, expressed or implied, as to
* We disclaims any warranty of any kind, expressed or implied, as to
* its fitness for any particular use.
*
* This file declares the interface to the object that controls the Hello

View file

@ -2,7 +2,7 @@
* HelloPage.m
*
* You may freely copy, distribute and reuse the code in this example.
* Apple disclaims any warranty of any kind, expressed or implied, as to
* We disclaims any warranty of any kind, expressed or implied, as to
* its fitness for any particular use.
*
* This is the implementation file for the object that controls the Hello

View file

@ -1,17 +1,13 @@
/*
* Main.wod
* Main.gswd
*
* You may freely copy, distribute and reuse the code in this example.
* NeXT disclaims any warranty of any kind, expressed or implied, as to
* We disclaims any warranty of any kind, expressed or implied, as to
* its fitness for any particular use.
*
* Written by WebObjects Development Team
*
* This is the declarations file for the first page (Main) of the
* HelloWorldObjC application. Each declaration corresponds to a WEBOBJECT
* element in Main.html. The declarations specify a WODynamicElement to
* represent the corresponding WEBOBJECT element and configure the dynamic
* element with variables and methods defined in the Main object.
* This is the declarations file for the Main page of the
* HelloWorld ObjC application. Each declaration corresponds to a GNUstepWeb
* element in Main.html.
*
*/

View file

@ -2,7 +2,7 @@
* Main.h
*
* You may freely copy, distribute and reuse the code in this example.
* Apple disclaims any warranty of any kind, expressed or implied, as to
* We disclaims any warranty of any kind, expressed or implied, as to
* its fitness for any particular use.
*
* This file declares the interface to the object that controls the Main

View file

@ -2,11 +2,9 @@
* Main.m
*
* You may freely copy, distribute and reuse the code in this example.
* Apple disclaims any warranty of any kind, expressed or implied, as to
* We disclaims any warranty of any kind, expressed or implied, as to
* its fitness for any particular use.
*
* Written by WebObjects Development Team
*
* This is the implementation file for the object that controls the Main
* page.
*/

View file

@ -115,7 +115,8 @@ GSWExceptionPage.m \
GSWDictionaryRepetition.m \
GSWRedirect.m \
GSWIFrame.m \
GSWMetaRefresh.m
GSWMetaRefresh.m \
GSWLongResponsePage.m \
#GSWCompletionBar.m
@ -130,7 +131,8 @@ GSWPageRestorationErrorPage.h \
GSWRedirect.h \
GSWSessionCreationErrorPage.h \
GSWSessionRestorationErrorPage.h \
GSWStatsPage.h
GSWStatsPage.h \
GSWLongResponsePage.h
#GSWCompletionBar.h
#GSWThresholdColoredNumber.h

View file

@ -0,0 +1,108 @@
/** GSWLongResponsePage.m - <title>GSWeb: Class GSWLongResponsePage</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Sep 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
// $Id$
#ifndef _GSWLongResponsePage_h__
#define _GSWLongResponsePage_h__
//==============================================================================
@interface GSWLongResponsePage: GSWComponent <NSLocking>
{
@private
id _status;
id _result;
NSException *_exception;
NSRecursiveLock *_selfLock;
NSTimeInterval _refreshInterval;
BOOL _performingAction;
BOOL _cancelled;
BOOL _done;
}
/** Locks the page **/
- (void)lock;
/** Unlock the page **/
- (void)unlock;
/** Set status (Lock protected) **/
- (void)setStatus:(id)status;
/** Set the refresh interval. Default is 0. If >0, a refresh header is appended to the response **/
- (void)setRefreshInterval:(NSTimeInterval)interval;
/** Get the refresh interval. **/
- (NSTimeInterval)refreshInterval;
/** Return YES if action is canceled by the user. Used to abort thread. (Lock protected) **/
- (BOOL)isCancelled;
/** This method should be overwritten to return a result. Default implementation raise an exception
Warning: you should first increase app worker thread count.
count=1 ==> you code don't nead to be thread safe
count>1 ==> if your code is not thread safe, you should disable concurrent request handling
count>1 ==> if your code is thread safe, you can enable concurrent request handling
**/
- (id)performAction;
/** This method is call by GSWMetaRefresh -invokeAction.
It can be manually called (for example if the page does not refresh itself.
Status value make it call -pageForException:, -pageForResult:, -refreshPageForStatus: or -cancelPageForStatus:
Don't override it
**/
- (WOComponent *)refresh;
- (WOComponent *)cancel;
/* TODO the cancel action sets cancel to yes and calls cancelPageForStatus:. DO NOT OVERRIDE */
/** Called when an exception occur in the process thread. Replace -pageForResult: call.
Default implemnetation raise the exception **/
- (WOComponent *)pageForException:(NSException *)exception;
/** Called when the process thread is done.
Default implementation stops automatic refresh and returns self.
You can override this to return a newly created result page
**/
- (WOComponent *)pageForResult:(id) result;
/** Called on each refresh. Should return self. **/
- (WOComponent *)refreshPageForStatus:(id) status;
/** Called when the process thread is cancelled. Replace -pageForResult: call.
Default implementation stops automatic refresh and returns self.
**/
- (WOComponent *)cancelPageForStatus:(id) status;
@end
#endif //_GSWLongResponsePage_h__

View file

@ -0,0 +1,405 @@
/** GSWLongResponsePage.m - <title>GSWeb: Class GSWLongResponsePage</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Sep 2002
$Revision$
$Date$
<abstract></abstract>
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
#include <GSWExtensions/GSWLongResponsePage.h>
//===================================================================================
@implementation GSWLongResponsePage
-(id)init
{
if ((self=[super init]))
{
_selfLock=[NSRecursiveLock new];
}
return self;
}
-(void)dealloc
{
DESTROY(_selfLock);
[super dealloc];
}
/** Locks the page **/
-(void) lock
{
LOGObjectFnStartC("GSWLongResponsePage");
[self subclassResponsibility: _cmd];
LOGObjectFnStopC("GSWLongResponsePage");
};
/** Unlock the page **/
-(void) unlock
{
LOGObjectFnStartC("GSWLongResponsePage");
[self subclassResponsibility: _cmd];
LOGObjectFnStopC("GSWLongResponsePage");
};
-(void)appendToResponse:(GSWResponse*)aResponse
inContext:(GSWContext*)aContext
{
LOGObjectFnStartC("GSWLongResponsePage");
[self lock];
NSDebugMLog(@"_refreshInterval=%f",(double)_refreshInterval);
NSDebugMLog(@"_done=%d",(int)_done);
NSDebugMLog(@"_performingAction=%d",(int)_performingAction);
//
if (_refreshInterval>0 && !_done/*_keepRefreshing*/)
{
NSString *url=nil;
NSString *header=nil;
url=[aContext urlWithRequestHandlerKey:@"cr"
path:nil
queryString:nil];
NSDebugMLog(@"url=%@",url);
header=[NSString stringWithFormat:@"%d;url=%@%@/%@.GSWMetaRefresh",
(int)_refreshInterval,
url,
[[aContext session]sessionID],
[aContext contextID]];
NSDebugMLog(@"header=%@",header);
[aResponse setHeader:header
forKey:@"Refresh"];
};
// Exec action on the first time
if (!_performingAction)
{
_performingAction = YES;
NSDebugMLog(@"BEFORE performAction thread=%p",[NSThread currentThread]);
[NSThread detachNewThreadSelector:@selector(_perform)
toTarget:self
withObject:nil];
};
[super appendToResponse:aResponse
inContext:aContext];
[self unlock];
LOGObjectFnStopC("GSWLongResponsePage");
};
-(id)threadExited:(NSNotification*)notif
{
NSThread* thread=nil;
LOGObjectFnStartC("GSWLongResponsePage");
thread=[notif object];
NSDebugMLog(@"threadExited thread=%@",thread);
fflush(stdout);
fflush(stderr);
// threadDict = [thread threadDictionary];
// NSDebugMLLog(@"low",@"threadDict=%@",threadDict);
// adaptorThread=[threadDict objectForKey:GSWThreadKey_DefaultAdaptorThread];
// NSDebugMLLog(@"low",@"adaptorThread=%@",adaptorThread);
// [threadDict removeObjectForKey:GSWThreadKey_DefaultAdaptorThread];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSThreadExiting//NSThreadWillExitNotification
object:thread];
LOGObjectFnStopC("GSWLongResponsePage");
return nil; //??
};
-(void)_perform
{
id result=nil;
NSAutoreleasePool* arp = nil;
LOGObjectFnStartC("GSWLongResponsePage");
arp = [NSAutoreleasePool new];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(threadExited:)
name:NSThreadExiting//NSThreadWillExitNotification
object:[NSThread currentThread]];
NS_DURING
{
[self _setResult:nil];
NSDebugMLog(@"CALL performAction thread=%p",[NSThread currentThread]);
NSDebugMLog(@"CALL performAction thread=%@",[NSThread currentThread]);
result=[self performAction];
fflush(stdout);
fflush(stderr);
printf("==AFTER performAction");
NSDebugMLog(@"result=%@",result);
NSDebugMLog(@"AFTER performAction");
printf("AFTER performAction");
fflush(stdout);
fflush(stderr);
if (!_cancelled)
_done=YES; //???
[self _setResult:result];
}
NS_HANDLER
{
RETAIN(localException);
NSLog(@"EXCEPTION %@",localException);
NSDebugMLog(@"EXCEPTION %@",localException);
fflush(stdout);
fflush(stderr);
DESTROY(arp);
AUTORELEASE(localException);
[localException raise];
}
NS_ENDHANDLER;
DESTROY(arp);
LOGObjectFnStopC("GSWLongResponsePage");
fflush(stdout);
fflush(stderr);
};
/** Set status (Lock protected) **/
-(void)setStatus:(id)status
{
LOGObjectFnStartC("GSWLongResponsePage");
if (status!=_status)
{
[self lock];
ASSIGN(_status,status);
[self unlock];
};
LOGObjectFnStopC("GSWLongResponsePage");
};
-(id) _status
{
//??
LOGObjectFnStartC("GSWLongResponsePage");
LOGObjectFnStopC("GSWLongResponsePage");
return _status;
};
/** Set the refresh interval. Default is 0. If >0, a refresh header is appended to the response **/
-(void)setRefreshInterval:(NSTimeInterval)interval
{
LOGObjectFnStartC("GSWLongResponsePage");
if (interval>0)
_refreshInterval = interval;
else
_refreshInterval = 0;
LOGObjectFnStopC("GSWLongResponsePage");
};
/** Get the refresh interval. **/
-(NSTimeInterval)refreshInterval
{
LOGObjectFnStartC("GSWLongResponsePage");
LOGObjectFnStopC("GSWLongResponsePage");
return _refreshInterval;
};
/** Return YES if action is canceled by the user. Used to abort thread. (Lock protected) **/
-(BOOL)isCancelled
{
//??
LOGObjectFnStartC("GSWLongResponsePage");
LOGObjectFnStopC("GSWLongResponsePage");
return _cancelled;
};
/** This method should be overwritten to return a result. Default implementation raise an exception
Warning: you should first increase app worker thread count.
count=1 ==> you code don't nead to be thread safe
count>1 ==> if your code is not thread safe, you should disable concurrent request handling
count>1 ==> if your code is thread safe, you can enable concurrent request handling
**/
-(id) performAction
{
LOGObjectFnStartC("GSWLongResponsePage");
[self subclassResponsibility:_cmd];
LOGObjectFnStopC("GSWLongResponsePage");
return nil;
};
/** This method is call by GSWMetaRefresh -invokeAction.
It can be manually called (for example if the page does not refresh itself.
Status value make it call -pageForException:, -pageForResult:, -refreshPageForStatus: or -cancelPageForStatus:
Don't override it
**/
-(GSWComponent*)refresh
{
//??
GSWComponent *page=nil;
NSException *exception=nil;
id result=[self _result];//OK
id status=nil;
LOGObjectFnStartC("GSWLongResponsePage");
exception=[self _exception];
status=[self _status];
if (exception)
page=[self pageForException:exception];
else if (_done)//OK
{
//_keepRefreshing = NO;
page=[self pageForResult:result];//OK
}
else if (_cancelled)
page=[self cancelPageForStatus:status];
else
page=[self refreshPageForStatus:status];
LOGObjectFnStopC("GSWLongResponsePage");
return page;
};
-(GSWComponent*)cancel
{
//??
GSWComponent *page=nil;
LOGObjectFnStartC("GSWLongResponsePage");
[self _setCancelled:YES];
page=[self cancelPage];
LOGObjectFnStopC("GSWLongResponsePage");
return page;
};
/** Called when an exception occur in the process thread. Replace -pageForResult: call.
Default implemnetation raise the exception **/
-(GSWComponent *)pageForException:(NSException *)exception
{
//??
LOGObjectFnStartC("GSWLongResponsePage");
[exception raise];//??
LOGObjectFnStopC("GSWLongResponsePage");
return nil;
};
/** Called when the process thread is done.
Default implementation stops automatic refresh and returns self.
You can override this to return a newly created result page
**/
-(GSWComponent *)pageForResult:(id) result
{
LOGObjectFnStartC("GSWLongResponsePage");
//TODO: stop refreshing ?
_done=YES;
LOGObjectFnStopC("GSWLongResponsePage");
return self;
};
/** Called on each refresh. Should return self. **/
-(GSWComponent *)refreshPageForStatus:(id) status
{
LOGObjectFnStartC("GSWLongResponsePage");
LOGObjectFnStopC("GSWLongResponsePage");
return self;
};
/** Called when the process thread is cancelled. Replace -pageForResult: call.
Default implementation stops automatic refresh and returns self.
**/
-(GSWComponent *)cancelPageForStatus:(id) status;
{
LOGObjectFnStartC("GSWLongResponsePage");
//[self subclassResponsibility: _cmd];
_cancelled=YES;
LOGObjectFnStopC("GSWLongResponsePage");
return self;
};
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext
{
//??
GSWElement *element=nil;
LOGObjectFnStartC("GSWLongResponsePage");
if ([[aContext senderID] isEqualToString:@"GSWMetaRefresh"])//GSWMetaRefreshSenderId])//senderID ret: GSWMetaRefresh // Seems OK
{
element=[self refresh];//OK
}
else
element=[super invokeActionForRequest:aRequest
inContext:aContext];
LOGObjectFnStopC("GSWLongResponsePage");
return element;
};
-(void) _setCancelled:(BOOL)cancelled
{
//??
LOGObjectFnStartC("GSWLongResponsePage");
if (cancelled!=_cancelled)
{
[self lock];
_cancelled=cancelled;
[self unlock];
};
LOGObjectFnStopC("GSWLongResponsePage");
};
-(void) _setResult:(id)result
{
LOGObjectFnStartC("GSWLongResponsePage");
if (result!=_result)
{
[self lock];
_result=result;
[self unlock];
};
LOGObjectFnStopC("GSWLongResponsePage");
};
-(id)_result
{
LOGObjectFnStartC("GSWLongResponsePage");
LOGObjectFnStopC("GSWLongResponsePage");
return _result;
};
-(void)_setException:(NSException*)exception
{
//??
LOGObjectFnStartC("GSWLongResponsePage");
if (exception!=_exception)
{
[self lock];
_exception=exception;
[self unlock];
};
[self subclassResponsibility: _cmd];
LOGObjectFnStopC("GSWLongResponsePage");
};
-(NSException*)_exception
{
LOGObjectFnStartC("GSWLongResponsePage");
LOGObjectFnStopC("GSWLongResponsePage");
return _exception;
};
@end

View file

@ -1,7 +1,7 @@
<gsweb name="ValidationFailureCondition">
<font color="#FF0000">
<gsweb name="ValidationFailureRepetition">
<gsweb name="ValidationFailure"></gsweb><br>
</gsweb>
<gsweb name="ValidationFailureCondition">
<font color="#FF0000">
<gsweb name="ValidationFailureRepetition">
<gsweb name="ValidationFailure"></gsweb><br/>
</gsweb>
</font>
</gsweb>
</gsweb>

View file

@ -2021,6 +2021,7 @@ selfLockn,
{
//TODO erreur
NSDebugMLLog0(@"application",@"No Session Class");
NSAssert(NO,@"Can't find session class");
}
else
{
@ -2123,11 +2124,17 @@ selfLockn,
[self lock];
NS_DURING
{
// If the pageName is empty, try to get one from -defaultPageName
if ([aName length]<=0)
aName=[self defaultPageName];//NDFN
// If the pageName is still empty, use a default one ("Main")
if ([aName length]<=0)
aName=GSWMainPageName;
// Retrieve context languages
languages=[aContext languages];
// Find component definition for pageName and languages
componentDefinition=[self lockedComponentDefinitionWithName:aName
languages:languages];
NSDebugMLLog(@"info",@"componentDefinition %p=%@ (%@)",
@ -2154,10 +2161,14 @@ selfLockn,
}
else
{
// As we've found a component defintion, we create an instance (an object of class GSWComponent)
NSAssert(aContext,@"No Context");
component=[componentDefinition componentInstanceInContext:aContext];
NSAssert(aContext,@"No Context");
// Next we awake it
[component awakeInContext:aContext];
// And flag it as a page.
[component _setIsPage:YES];
};
}

View file

@ -772,6 +772,7 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
};
if (retValue)
{
NSDebugMLLog(@"associations",@"retValue ptr=%p",retValue);
NSDebugMLLog(@"associations",@"retValue=%@",retValue);
}
else

View file

@ -37,6 +37,9 @@
{
GSWAssociation* _list;
GSWAssociation* _item;
//GSWeb Additions {
GSWAssociation* _index;
// }
GSWAssociation* _displayString;
GSWAssociation* _selections;
//GSWeb Additions {

View file

@ -31,6 +31,35 @@ static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
/**
Bindings
list Array of objects that the dynamic element iterate through.
index On each iteration the element put the current index in this binding
item On each iteration the element take the item at the current index and put it in this binding
displayString String to display for each check box.
value Value for each OPTION tag
selections Array of selected objects (used to pre-select items and modified to reflect user choices)
It contains objects from list, not value binding evaluated ones !
selectedValues Array of pre selected values (not objects !)
name Name of the element in the form (should be unique). If not specified, GSWeb assign one.
disabled If evaluated to yes, the check box appear inactivated.
escapeHTML If evaluated to yes, escape displayString
size show 'size' iems at one time. Default=5. Must be > 1
multiple multiple selection allowed
**/
//====================================================================
@implementation GSWBrowser
@ -47,6 +76,10 @@ static char rcsId[] = "$Id$";
tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
[tmpAssociations removeObjectForKey:list__Key];
[tmpAssociations removeObjectForKey:item__Key];
if (!WOStrictFlag)
{
[tmpAssociations removeObjectForKey:index__Key];
};
[tmpAssociations removeObjectForKey:displayString__Key];
[tmpAssociations removeObjectForKey:selections__Key];
if (!WOStrictFlag)
@ -62,24 +95,41 @@ static char rcsId[] = "$Id$";
{
_list=[[associations objectForKey:list__Key
withDefaultObject:[_list autorelease]] retain];
_item=[[associations objectForKey:item__Key
withDefaultObject:[_item autorelease]] retain];
if (_item && ![_item isValueSettable])
{
ExceptionRaise0(@"GSWBrowser",@"'item' parameter must be settable");
};
if (!WOStrictFlag)
{
_index = [[associations objectForKey:index__Key
withDefaultObject:[_index autorelease]] retain];
NSDebugMLLog(@"gswdync",@"index=%@",_index);
if (_index && ![_index isValueSettable])
{
ExceptionRaise0(@"GSWBrowser",@"'index' parameter must be settable");
};
};
_displayString=[[associations objectForKey:displayString__Key
withDefaultObject:[_displayString autorelease]] retain];
_selections=[[associations objectForKey:selections__Key
withDefaultObject:[_selections autorelease]] retain];
if (_selections && ![_selections isValueSettable])
{
//TODO
ExceptionRaise0(@"GSWBrowser",@"'selections' parameter must be settable");
};
if (!WOStrictFlag)
{
_selectionValues=[[associations objectForKey:selectionValue__Key
_selectionValues=[[associations objectForKey:selectionValues__Key
withDefaultObject:[_selectionValues autorelease]] retain];
if (_selectionValues && ![_selectionValues isValueSettable])
{
//TODO
ExceptionRaise0(@"GSWBrowser",@"'selectionValues' parameter must be settable");
};
};
@ -101,6 +151,7 @@ static char rcsId[] = "$Id$";
{
DESTROY(_list);
DESTROY(_item);
DESTROY(_index);
DESTROY(_displayString);
DESTROY(_selections);
DESTROY(_selectionValues);
@ -131,8 +182,7 @@ static char rcsId[] = "$Id$";
@implementation GSWBrowser (GSWBrowserA)
/*
On WO it looks like that:
On WO it looks like that when value is not binded:
<SELECT name="4.2.7" size=5 multiple>
<OPTION value="0">blau</OPTION>
@ -158,28 +208,21 @@ static char rcsId[] = "$Id$";
id valueValue=nil;
id itemValue=nil;
id displayStringValue=nil;
NSString * browserName=nil;
BOOL escapeHTMLBoolValue=YES;
id escapeHTMLValue=nil;
BOOL isMultiple=NO;
int i=0;
BOOL inOptGroup=NO;
#ifndef ENABLE_OPTGROUP
BOOL optGroupLabel=NO;
#endif
LOGObjectFnStartC("GSWBrowser");
[self resetAutoValue];
_autoValue = NO;
request=[context request];
isFromClientComponent=[request isFromClientComponent];
component=[context component];
browserName=[self nameInContext:context];
//TODO: multiple
// [super appendToResponse:response
// inContext:context];
[response _appendContentAsciiString:@"<SELECT"];
[super appendToResponse:response
inContext:context];
listValue=[_list valueInComponent:component];
NSDebugMLLog(@"gswdync",@"listValue=%@",listValue);
@ -188,41 +231,21 @@ static char rcsId[] = "$Id$";
_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];
escapeHTMLBoolValue=boolValueFor(escapeHTMLValue);
};
[response _appendContentAsciiString:[NSString stringWithFormat:@" NAME=\"%@\"",browserName]];
if (_size)
{
[response _appendContentAsciiString:@" SIZE="];
[response _appendContentAsciiString:[_size valueInComponent:component]];
} else {
// do we get an PopUp if we leave that out?
[response _appendContentAsciiString:@" SIZE=1"];
}
if (_multiple)
{
id multipleValue=nil;
multipleValue=[_multiple valueInComponent:component];
isMultiple=boolValueFor(multipleValue);
if (isMultiple) {
[response _appendContentAsciiString:@" MULTIPLE"];
}
};
[response _appendContentAsciiString:@">"];
for(i=0;i<[listValue count];i++)
{
NSDebugMLLog(@"gswdync",@"inOptGroup=%s",(inOptGroup ? "YES" : "NO"));
@ -231,52 +254,52 @@ static char rcsId[] = "$Id$";
[_item setValue:itemValue
inComponent:component];
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
if (_index)
[_index setValue:[NSNumber numberWithShort:i]
inComponent:component];
if (itemValue)
{
NSDebugMLLog(@"gswdync",@"value=%@",_value);
valueValue=[self valueInContext:context];
NSDebugMLLog(@"gswdync",@"_value (class: %@): %@",[_value class],_value);
// Value property of the INPUT tag
if (_value) // Binded Value
valueValue = [_value valueInComponent:component];
else // Auto Value
valueValue = [NSNumber numberWithInt:i];
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (valueValue)
{
BOOL isEqual;
BOOL isEqual=NO;
NSDebugMLLog0(@"gswdync",@"Adding OPTION");
[response _appendContentAsciiString:@"\n<OPTION"];
if (_selections)
{
if(_value)
isEqual=SBIsValueIsIn(valueValue,selectionsValue);
else
isEqual=SBIsValueIsIn(itemValue,selectionsValue);
if (isEqual)
{
[response appendContentCharacter:' '];
[response _appendContentAsciiString:@"selected"];
};
NSDebugMLLog(@"gswdync",@"selectionsValue=%@",selectionsValue);
NSDebugMLLog(@"gswdync",@"selectionsValue classes=%@",[selectionsValue valueForKey:@"class"]);
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
NSDebugMLLog(@"gswdync",@"itemValue class=%@",[itemValue class]);
if (selectionsValue)
{
isEqual = [selectionsValue containsObject:itemValue];
};
if (isEqual == NO && _selectedValues)
{
if(_value)
isEqual=SBIsValueIsIn(valueValue,selectedValuesValue);
else
isEqual=SBIsValueIsIn(itemValue,selectedValuesValue);
if (isEqual)
{
[response appendContentCharacter:' '];
[response _appendContentAsciiString:@"selected"];
};
// selected values is selections but on valueValue not itemValue
isEqual = [selectionsValue containsObject:valueValue];
};
if (_value == nil)
_autoValue = YES;
if (valueValue)
{
[response _appendContentAsciiString:@" value=\""];
// [response _appendContentAsciiString:valueValue];
[response _appendContentAsciiString:[NSString stringWithFormat:@"%d",i]];
[response appendContentCharacter:'"'];
};
if (isEqual)
{
[response appendContentCharacter:' '];
[response _appendContentAsciiString:@"selected"];
};
[response _appendContentAsciiString:@" value=\""];
[response _appendContentAsciiString:valueValue];
[response appendContentCharacter:'"'];
[response appendContentCharacter:'>'];
};
displayStringValue=nil;
@ -328,7 +351,6 @@ static char rcsId[] = "$Id$";
};
if (valueValue)
{
//NSDebugMLLog0(@"gswdync",@"Adding /OPTION");
// K2- No /OPTION TAG
//[response _appendContentAsciiString:@"</OPTION>"];
}
@ -377,30 +399,25 @@ static char rcsId[] = "$Id$";
{
//OK
BOOL disabledValue=NO;
BOOL wasFormSubmitted=NO;
id selectionsValue=nil;
BOOL selectionsAreMutable=NO;
LOGObjectFnStartC("GSWPopUpButton");
[self resetAutoValue];
disabledValue=[self disabledInContext:context];
if (!disabledValue)
{
wasFormSubmitted=[context _wasFormSubmitted];
BOOL wasFormSubmitted=[context _wasFormSubmitted];
if (wasFormSubmitted)
{
BOOL isMultiple=NO;
NSArray* foundValues=nil;
NSMutableArray* mutableFoundValues=[NSMutableArray array];
NSMutableArray* selectionsValue=nil;
NSMutableArray* selectionValuesValue=nil;
GSWComponent* component=nil;
NSArray* listValue=nil;
id valueValue=nil;
NSString* valueValueString=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);
@ -414,18 +431,14 @@ static char rcsId[] = "$Id$";
//NSLog(@"formValues=%@",formValues);
//NSLog(@"formValues class=%@",[formValues class]);
if (formValues && [formValues count])
{
BOOL isEqual=NO;
formValue=[formValues objectAtIndex:0];
NSDebugMLLog(@"gswdync",@"formValue=%@",formValue);
BOOL found=NO;
int i=0;
listValue=[_list valueInComponent:component];
selectionsValue=[_selections valueInComponent:component];
NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
_list,
@ -440,56 +453,86 @@ static char rcsId[] = "$Id$";
if (_item)
[_item setValue:itemValue
inComponent:component];
if (_index)
[_index setValue:[NSNumber numberWithShort:i]
inComponent:component];
NSDebugMLLog(@"gswdync",@"value=%@",_value);
if ([formValues containsObject:[NSString stringWithFormat:@"%d",i]])
if (_value) // Binded Value
valueValue = [_value valueInComponent:component];
else // Auto Value
valueValue = [NSNumber numberWithInt:i];
valueValueString=[NSString stringWithFormat:@"%@",valueValue];
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (valueValue)
{
[mutableFoundValues addObject:itemValue];
found=YES;
// we compare (with object equality not pointer equality)
found=[formValues containsObject:valueValueString];
NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO"));
if (found)
{
// We add list object
if (_selections)
{
if (!selectionsValue)
selectionsValue=[NSMutableArray array];
[selectionsValue addObject:itemValue];
};
// We add valueValue
if (_selectionValues)
{
if (!selectionValuesValue)
selectionValuesValue=[NSMutableArray array];
[selectionValuesValue addObject:valueValue];
};
};
};
};
};
foundValues=[NSArray arrayWithArray:mutableFoundValues];
// NSLog(@"new foundValues = %@",foundValues);
NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO"));
};
NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO"));
if (_selections)
{
if (!WOStrictFlag)
NS_DURING
{
NS_DURING
[_selections setValue:selectionsValue
inComponent:component];
};
NS_HANDLER
{
LOGException(@"GSWBrowser _selections=%@ itemValueToSet=%@ exception=%@",
_selections,itemValueToSet,localException);
if (WOStrictFlag)
{
[_selections setValue:foundValues
inComponent:component];
};
NS_HANDLER
[localException raise];
}
else
{
[self handleValidationException:localException
inContext:context];
}
NS_ENDHANDLER;
};
}
else
{
[_selections setValue:foundValues
inComponent:component];
};
};
if (!WOStrictFlag)
NS_ENDHANDLER;
};
if (!WOStrictFlag && _selectionValues)
{
if (_selectionValues)
NS_DURING
{
NS_DURING
{
[_selectionValues setValue:foundValues
inComponent:component];
};
NS_HANDLER
{
[self handleValidationException:localException
inContext:context];
}
NS_ENDHANDLER;
[_selectionValues setValue:selectionValuesValue
inComponent:component];
};
NS_HANDLER
{
[self handleValidationException:localException
inContext:context];
}
NS_ENDHANDLER;
};
};
};
@ -511,15 +554,42 @@ static char rcsId[] = "$Id$";
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context
{
LOGObjectFnNotImplemented(); //TODOFN
BOOL isMultiple=NO;
id sizeValue=nil;
GSWComponent* component=nil;
LOGObjectFnStartC("GSWPopUpButton");
[super appendGSWebObjectsAssociationsToResponse:response
inContext:context];
component=[context component];
if (_size)
sizeValue=[_size valueInComponent:component];
else
sizeValue=@"5"; //Default is 5
[response _appendContentAsciiString:@" SIZE="];
[response _appendContentAsciiString:sizeValue];
if (_multiple)
{
id multipleValue=nil;
multipleValue=[_multiple valueInComponent:component];
isMultiple=boolValueFor(multipleValue);
if (isMultiple)
[response _appendContentAsciiString:@" MULTIPLE"];
};
// [response _appendContentAsciiString:@">"];
LOGObjectFnStopC("GSWPopUpButton");
};
//--------------------------------------------------------------------
-(void)appendValueToResponse:(GSWResponse*)response
inContext:(GSWContext*)context
{
LOGObjectFnNotImplemented(); //TODOFN
//Does nothing because value is only printed in OPTION tag
};
//--------------------------------------------------------------------

View file

@ -39,13 +39,15 @@
GSWAssociation* _item;
GSWAssociation* _index;
GSWAssociation* _selections;
//GSWeb Additions {
GSWAssociation* _selectionValues;
// }
GSWAssociation* _prefix;
GSWAssociation* _suffix;
GSWAssociation* _displayString;
GSWAssociation* _escapeHTML;
GSWAssociation* _itemDisabled;
BOOL _defaultEscapeHTML;
BOOL _autoValue;
};
-(id)initWithName:(NSString*)name

View file

@ -31,6 +31,36 @@ static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
/**
Bindings
list Array of objects that the dynamic element iterate through.
index On each iteration the element put the current index in this binding
item On each iteration the element take the item at the current index and put it in this binding
displayString String to display for each check box.
value Value for the INPUT tag for each check box
prefix An html string to insert before each value.
suffix An html string to insert after each value.
selections Array of selected objects (used to pre-check checkboxes and modified to reflect user choices)
It contains objects from list, not value binding evaluated ones !
selectionValues Array of selected values (used to pre-check checkboxes and modified to reflect user choices)
It contains evaluated values binding !
name Name of the element in the form (should be unique). If not specified, GSWeb assign one.
disabled If evaluated to yes, the check box appear inactivated.
escapeHTML If evaluated to yes, escape displayString
**/
//====================================================================
@implementation GSWCheckBoxList
@ -50,7 +80,6 @@ static char rcsId[] = "$Id$";
[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
@ -65,7 +94,7 @@ static char rcsId[] = "$Id$";
NSDebugMLLog(@"gswdync",@"item=%@",_item);
if (_item && ![_item isValueSettable])
{
ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable");
ExceptionRaise0(@"GSWCheckBoxList",@"'item' parameter must be settable");
};
_value = [[associations objectForKey:value__Key
@ -77,7 +106,7 @@ static char rcsId[] = "$Id$";
NSDebugMLLog(@"gswdync",@"index=%@",_index);
if (_index && ![_index isValueSettable])
{
ExceptionRaise0(@"GSWCheckBox",@"'index' parameter must be settable");
ExceptionRaise0(@"GSWCheckBoxList",@"'index' parameter must be settable");
};
_prefix = [[associations objectForKey:prefix__Key
@ -93,17 +122,23 @@ static char rcsId[] = "$Id$";
NSDebugMLLog(@"gswdync",@"selections=%@",_selections);
if (![_selections isValueSettable])
{
ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable");
ExceptionRaise0(@"GSWCheckBoxList",@"'selection' parameter must be settable");
};
if (!WOStrictFlag)
{
_selectionValues=[[associations objectForKey:selectionValues__Key
withDefaultObject:[_selectionValues autorelease]] retain];
if (_selectionValues && ![_selectionValues isValueSettable])
{
ExceptionRaise0(@"GSWCheckBoxList",@"'selectionValues' 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);
_escapeHTML = [[associations objectForKey:escapeHTML__Key
withDefaultObject:[_escapeHTML autorelease]] retain];
NSDebugMLLog(@"gswdync",@"escapeHTML=%@",_escapeHTML);
@ -119,6 +154,7 @@ static char rcsId[] = "$Id$";
DESTROY(_item);
DESTROY(_index);
DESTROY(_selections);
DESTROY(_selectionValues);//GSWeb Only
DESTROY(_prefix);
DESTROY(_suffix);
DESTROY(_displayString);
@ -165,24 +201,29 @@ static char rcsId[] = "$Id$";
BOOL disabledInContext=NO;
LOGObjectFnStartC("GSWCheckBoxList");
[self resetAutoValue];
disabledInContext=[self disabledInContext:context];
if (!disabledInContext)
{
if ([context _wasFormSubmitted])
{
GSWComponent* component=[context component];
NSArray* listValue=nil;
NSMutableArray* selectionsValues=nil;
NSArray* listValue=nil; // _list value
NSMutableArray* selectionsValue=nil;
NSMutableArray* selectionValuesValue=nil;
NSString* name=nil;
NSArray* formValues=nil;
id valueValue=nil;
id valueValue=nil; // _value value
NSString* valueValueString=nil; // _value value
id itemValue=nil; // _item value
int i=0;
name=[self nameInContext:context];
NSDebugMLLog(@"gswdync",@"name=%@",name);
formValues=[request formValuesForKey:name];
NSDebugMLLog(@"gswdync",@"formValues=%@",formValues);
NSDebugMLLog(@"gswdync",@"formValues class=%@",[formValues valueForKey:@"class"]);
listValue=[_list valueInComponent:component];
NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
@ -196,56 +237,98 @@ static char rcsId[] = "$Id$";
NSDebugMLLog(@"gswdync",@"item=%@",_item);
NSDebugMLLog(@"gswdync",@"index=%@",_index);
itemValue=[listValue objectAtIndex:i];
if (_item)
[_item setValue:[listValue objectAtIndex:i]
[_item setValue:itemValue
inComponent:component];
else if (_index)
if (_index)
[_index setValue:[NSNumber numberWithShort:i]
inComponent:component];
NSDebugMLLog(@"gswdync",@"value=%@",_value);
valueValue=[self valueInContext:context];
NSDebugMLLog(@"gswdync",@"value=%@",_value);
if (_value) // Binded Value
valueValue = [_value valueInComponent:component];
else // Auto Value
valueValue = [NSNumber numberWithInt:i];
valueValueString=[NSString stringWithFormat:@"%@",valueValue];
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (valueValue)
{
BOOL found=[formValues containsObject:valueValue];
// we compare (with object equality not pointer equality)
BOOL found=[formValues containsObject:valueValueString];
NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO"));
if (found)
{
if (!selectionsValues)
selectionsValues=[NSMutableArray array];
if (_selections)
{
if (!selectionsValue)
selectionsValue=[NSMutableArray array];
// We add list object
[selectionsValue addObject:itemValue];
};
if(_autoValue == NO)
[selectionsValues addObject:valueValue];
else
[selectionsValues addObject:[listValue objectAtIndex:i]];
if (_selectionValues)
{
if (!selectionValuesValue)
selectionValuesValue=[NSMutableArray array];
// We add list object
[selectionValuesValue addObject:valueValue];
};
};
};
};
NSDebugMLLog(@"gswdync",@"component=%@",component);
NSDebugMLLog(@"gswdync",@"selectionsValues=%d",selectionsValues);
NSDebugMLLog(@"gswdync",@"selectionsValue=%d",selectionsValue);
NSDebugMLLog(@"gswdync",@"selections=%@",_selections);
GSWLogAssertGood(component);
if (!WOStrictFlag)
NS_DURING
{
NS_DURING
[_selections setValue:selectionsValue
inComponent:component];
};
NS_HANDLER
{
LOGException(@"GSWCheckBoxList _selections=%@ selectionsValue=%@ exception=%@",
_selections,selectionsValue,localException);
if (WOStrictFlag)
{
[_selections setValue:selectionsValues
inComponent:component];
};
NS_HANDLER
[localException raise];
}
else
{
[self handleValidationException:localException
inContext:context];
};
}
NS_ENDHANDLER;
if (!WOStrictFlag && _selectionValues)
{
NS_DURING
{
[_selectionValues setValue:selectionValuesValue
inComponent:component];
};
NS_HANDLER
{
LOGException(@"GSWCheckBoxList _selectionValues=%@ selectionValuesValue=%@ exception=%@",
_selectionValues,selectionValuesValue,localException);
if (WOStrictFlag)
{
[localException raise];
}
else
{
[self handleValidationException:localException
inContext:context];
};
}
NS_ENDHANDLER;
}
else
{
[_selections setValue:selectionsValues
inComponent:component];
};
};
};
@ -270,13 +353,10 @@ static char rcsId[] = "$Id$";
NSString* name=nil;
GSWComponent* component=nil;
NSArray* selectionsValue=nil;
BOOL isEqual=NO;
NSArray* selectionValuesValue=nil;
LOGObjectFnStartC("GSWCheckBoxList");
[self resetAutoValue];
_autoValue = NO;
request=[context request];
isFromClientComponent=[request isFromClientComponent];
name=[self nameInContext:context];
@ -291,59 +371,99 @@ static char rcsId[] = "$Id$";
}
else
{
int i=0;
id displayStringValue=nil;
id prefixValue=nil;
id suffixValue=nil;
id valueValue=nil;
BOOL disableValue=NO;
NSArray* listValue=[_list valueInComponent:component];
selectionValuesValue=[_selectionValues valueInComponent:component];
if (selectionValuesValue && ![selectionValuesValue isKindOfClass:[NSArray class]])
{
ExceptionRaise(@"GSWCheckBoxList",
@"GSWCheckBoxList: selectionValues is not a NSArray: %@ %@",
selectionValuesValue,
[selectionValuesValue class]);
}
else
{
int i=0;
id displayStringValue=nil;
id prefixValue=nil;
id suffixValue=nil;
id valueValue=nil;
id itemValue=nil;
BOOL disabledInContext=NO;
NSArray* 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++)
{
BOOL isEqual=NO;
NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
_list,
listValue,
[listValue class]);
disabledInContext=[self disabledInContext:context];
itemValue=[listValue objectAtIndex:i];
[_item setValue:itemValue
inComponent:component];
prefixValue=[_prefix valueInComponent:component];
suffixValue=[_suffix valueInComponent:component];
[_index setValue:[NSNumber numberWithShort:i]
inComponent:component];
displayStringValue=[_displayString valueInComponent:component];
[response appendContentString:@"<INPUT NAME=\""];
[response appendContentString:name];
[response appendContentString:@"\" TYPE=checkbox VALUE=\""];
NSDebugMLLog(@"gswdync",@"_value (class: %@): %@",[_value class],_value);
// Value property of the INPUT tag
if (_value) // Binded Value
valueValue = [_value valueInComponent:component];
else // Auto Value
valueValue = [NSNumber numberWithInt:i];
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
[response appendContentHTMLAttributeValue:valueValue];
[response appendContentCharacter:'"'];
NSDebugMLLog(@"gswdync",@"selectionsValue=%@",selectionsValue);
NSDebugMLLog(@"gswdync",@"selectionsValue classes=%@",[selectionsValue valueForKey:@"class"]);
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
NSDebugMLLog(@"gswdync",@"itemValue class=%@",[itemValue class]);
if (_selections)
{
// we compare (with object equality not pointer equality) on list object, not valueValue !
isEqual = [selectionsValue containsObject:itemValue];
NSDebugMLLog(@"gswdync",@"isEqual=%s",(isEqual ? "YES" : "NO"));
}
for(i=0;i<[listValue count];i++)
{
[_item setValue:[listValue objectAtIndex:i]
inComponent:component];
prefixValue=[_prefix valueInComponent:component];
suffixValue=[_suffix valueInComponent:component];
disableValue=[self evaluateCondition:_itemDisabled
inContext:context];
[_index setValue:[NSNumber numberWithShort:i]
inComponent:component];
displayStringValue=[_displayString valueInComponent:component];
[response appendContentString:@"<INPUT NAME=\""];
[response appendContentString:name];
[response appendContentString:@"\" TYPE=checkbox VALUE=\""];
valueValue = [self valueInContext:context];
[response appendContentHTMLAttributeValue:valueValue];
[response appendContentCharacter:'"'];
//TODOV
if(_value)
isEqual = [selectionsValue containsObject:valueValue];
else
{
isEqual = [selectionsValue containsObject:[listValue objectAtIndex:i]];
_autoValue = YES;
}
if(isEqual)
[response appendContentString:@"\" CHECKED"];
if (disableValue)
[response appendContentString:@"\" DISABLED"];
[response appendContentCharacter:'>'];
[response appendContentString:prefixValue];
[response appendContentHTMLString:displayStringValue];
[response appendContentString:suffixValue];
};
NSDebugMLLog(@"gswdync",@"selectionValuesValue=%@",selectionValuesValue);
NSDebugMLLog(@"gswdync",@"selectionValuesValue classes=%@",[selectionValuesValue valueForKey:@"class"]);
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
NSDebugMLLog(@"gswdync",@"valueValue class=%@",[valueValue class]);
if (isEqual==NO && _selectionValues)
{
// we compare (with object equality not pointer equality) on valueValue !
isEqual = [selectionValuesValue containsObject:valueValue];
NSDebugMLLog(@"gswdync",@"isEqual=%s",(isEqual ? "YES" : "NO"));
}
if(isEqual)
[response appendContentString:@" CHECKED"];
if (disabledInContext)
[response appendContentString:@" DISABLED"];
[response appendContentCharacter:'>'];
[response appendContentString:prefixValue];
[response appendContentHTMLString:displayStringValue];
[response appendContentString:suffixValue];
};
};
};
LOGObjectFnStopC("GSWCheckBoxList");
};

View file

@ -56,7 +56,9 @@
// }
BOOL _isPage;
BOOL _isCachingEnabled;
BOOL _isSynchronized;
BOOL _isParentToComponentSynchronized;
BOOL _isComponentToParentSynchronized;
};
-(id)init;
@ -160,6 +162,8 @@ associationsKeys:(NSArray*)associationsKeys
forBinding:(NSString*)parentBindingName;
-(id)valueForBinding:(NSString*)parentBindingName;
-(BOOL)synchronizesVariablesWithBindings;
-(BOOL)synchronizesParentToComponentVariablesWithBindings;
-(BOOL)synchronizesComponentToParentVariablesWithBindings;
-(NSDictionary*)bindingAssociations;
@end

View file

@ -47,6 +47,7 @@ static char rcsId[] = "$Id$";
{
NSMutableDictionary* currentThreadDictionary=GSCurrentThreadDictionary();
GSWContext* aContext=[currentThreadDictionary objectForKey:GSWThreadKey_Context];
// This was set by GSWComponentDefintion -componentInstanceInContext:
GSWComponentDefinition* aComponentDefinition=[currentThreadDictionary objectForKey:GSWThreadKey_ComponentDefinition];
NSAssert(aContext,@"No Context in GSWComponent Init");
NSAssert(aComponentDefinition,@"No ComponentDefinition in GSWComponent Init");
@ -60,8 +61,10 @@ static char rcsId[] = "$Id$";
NSDebugMLLog(@"GSWComponent",@"_templateName=%@",_templateName);
[self setCachingEnabled:[GSWApp isCachingEnabled]];
[_componentDefinition _finishInitializingComponent:self];
_isSynchronized=[self synchronizesVariablesWithBindings];
NSDebugMLLog(@"GSWComponent",@"_isSynchronized=%s",(_isSynchronized ? "YES" : "NO"));
_isParentToComponentSynchronized=[self synchronizesParentToComponentVariablesWithBindings];
_isComponentToParentSynchronized=[self synchronizesComponentToParentVariablesWithBindings];
NSDebugMLLog(@"GSWComponent",@"_isParentToComponentSynchronized=%s",(_isParentToComponentSynchronized ? "YES" : "NO"));
NSDebugMLLog(@"GSWComponent",@"_isComponentToParentSynchronized=%s",(_isComponentToParentSynchronized ? "YES" : "NO"));
};
LOGObjectFnStop();
return self;
@ -123,7 +126,8 @@ static char rcsId[] = "$Id$";
ASSIGNCOPY(clone->_session,_session);
clone->_isPage=_isPage;
clone->_isCachingEnabled=_isCachingEnabled;
clone->_isSynchronized=_isSynchronized;
clone->_isParentToComponentSynchronized=_isParentToComponentSynchronized;
clone->_isComponentToParentSynchronized=_isComponentToParentSynchronized;
return clone;
};
@ -148,7 +152,9 @@ static char rcsId[] = "$Id$";
[aCoder encodeValueOfObjCType:@encode(BOOL)
at:&_isCachingEnabled];
[aCoder encodeValueOfObjCType:@encode(BOOL)
at:&_isSynchronized];
at:&_isParentToComponentSynchronized];
[aCoder encodeValueOfObjCType:@encode(BOOL)
at:&_isComponentToParentSynchronized];
}
//--------------------------------------------------------------------
@ -184,7 +190,9 @@ static char rcsId[] = "$Id$";
[aCoder decodeValueOfObjCType:@encode(BOOL)
at:&_isCachingEnabled];
[aCoder decodeValueOfObjCType:@encode(BOOL)
at:&_isSynchronized];
at:&_isParentToComponentSynchronized];
[aCoder decodeValueOfObjCType:@encode(BOOL)
at:&_isComponentToParentSynchronized];
};
return self;
}
@ -365,9 +373,9 @@ associationsKeys:(NSArray*)associationsKeys
{
//OK
LOGObjectFnStart();
NSDebugMLLog(@"GSWComponent",@"Name=%@ - isSynchronized=%s",
[self definitionName],(_isSynchronized ? "YES" : "NO"));
if (_isSynchronized)
NSDebugMLLog(@"GSWComponent",@"Name=%@ - isComponentToParentSynchronized=%s",
[self definitionName],(_isComponentToParentSynchronized ? "YES" : "NO"));
if (_isComponentToParentSynchronized)
{
int i=0;
id aKey=nil;
@ -404,9 +412,9 @@ associationsKeys:(NSArray*)associationsKeys
{
//OK
LOGObjectFnStart();
NSDebugMLLog(@"GSWComponent",@"Name=%@ - isSynchronized=%s",
[self definitionName],(_isSynchronized ? "YES" : "NO"));
if (_isSynchronized)
NSDebugMLLog(@"GSWComponent",@"Name=%@ - isParentToComponentSynchronized=%s",
[self definitionName],(_isParentToComponentSynchronized ? "YES" : "NO"));
if (_isParentToComponentSynchronized)
{
//Synchro Component->SubComponent
int i=0;
@ -906,6 +914,62 @@ associationsKeys:(NSArray*)associationsKeys
return aValue;
};
//--------------------------------------------------------------------
//NDFN
/** Do we need to synchronize parent to component **/
-(BOOL)synchronizesParentToComponentVariablesWithBindings
{
//OK
NSDictionary* userDictionary=nil;
id synchronizesParentToComponentVariablesWithBindingsValue=nil;
BOOL synchronizesParentToComponentVariablesWithBindings=YES;
LOGObjectFnStart();
userDictionary=[self userDictionary];
synchronizesParentToComponentVariablesWithBindingsValue=[userDictionary objectForKey:@"synchronizesParentToComponentVariablesWithBindings"];
NSDebugMLLog(@"GSWComponent",@"defName=%@ - userDictionary _synchronizesVariablesWithBindingsValue=%@",
[self definitionName],
synchronizesParentToComponentVariablesWithBindingsValue);
//NDFN
if (synchronizesParentToComponentVariablesWithBindingsValue)
{
synchronizesParentToComponentVariablesWithBindings=[synchronizesParentToComponentVariablesWithBindingsValue boolValue];
NSDebugMLLog(@"GSWComponent",@"userDictionary synchronizesParentToComponentVariablesWithBindings=%s",
(synchronizesParentToComponentVariablesWithBindings ? "YES" : "NO"));
}
else
synchronizesParentToComponentVariablesWithBindings=[self synchronizesVariablesWithBindings];
LOGObjectFnStop();
return synchronizesParentToComponentVariablesWithBindings;
};
//--------------------------------------------------------------------
//NDFN
/** Do we need to synchronize component to parent **/
-(BOOL)synchronizesComponentToParentVariablesWithBindings
{
//OK
NSDictionary* userDictionary=nil;
id synchronizesComponentToParentVariablesWithBindingsValue=nil;
BOOL synchronizesComponentToParentVariablesWithBindings=YES;
LOGObjectFnStart();
userDictionary=[self userDictionary];
synchronizesComponentToParentVariablesWithBindingsValue=[userDictionary objectForKey:@"synchronizesComponentToParentVariablesWithBindings"];
NSDebugMLLog(@"GSWComponent",@"defName=%@ - userDictionary _synchronizesVariablesWithBindingsValue=%@",
[self definitionName],
synchronizesComponentToParentVariablesWithBindingsValue);
//NDFN
if (synchronizesComponentToParentVariablesWithBindingsValue)
{
synchronizesComponentToParentVariablesWithBindings=[synchronizesComponentToParentVariablesWithBindingsValue boolValue];
NSDebugMLLog(@"GSWComponent",@"userDictionary synchronizesComponentToParentVariablesWithBindings=%s",
(synchronizesComponentToParentVariablesWithBindings ? "YES" : "NO"));
}
else
synchronizesComponentToParentVariablesWithBindings=[self synchronizesVariablesWithBindings];
LOGObjectFnStop();
return synchronizesComponentToParentVariablesWithBindings;
};
//--------------------------------------------------------------------
-(BOOL)synchronizesVariablesWithBindings
{
@ -1535,11 +1599,13 @@ associationsKeys:(NSArray*)associationsKeys
NSDebugMLLog(@"GSWComponent",@"sessionID=%@",[session sessionID]);
[session appendCookieToResponse:response];
//==>11
NSDebugMLLog(@"GSWComponent",@"sessionID=%@",[session sessionID]);
[session _saveCurrentPage];
[aContext _incrementContextID];
[aContext deleteAllElementIDComponents];
[aContext _setPageChanged:pageChanged];
[aContext _setPageReplaced:NO];
NSDebugMLLog(@"GSWComponent",@"sessionID=%@",[session sessionID]);
//<==========
LOGObjectFnStop();
@ -1895,3 +1961,4 @@ associationsKeys:(NSArray*)associationsKeys
};
};
@end

View file

@ -350,14 +350,19 @@ languages:(NSArray*)languages
LOGObjectFnStart();
NSAssert(aContext,@"No Context");
NSDebugMLLog(@"gswcomponents",@"aContext=%@",aContext);
// Get component class
componentClass=[self componentClass];
NSAssert(componentClass,@"No componentClass");
NSDebugMLLog(@"gswcomponents",@"componentClass=%p",(void*)componentClass);
// Put the component definition in the thread dictionary because we need it during component initialization
threadDictionary=GSCurrentThreadDictionary();
[threadDictionary setObject:self
forKey:GSWThreadKey_ComponentDefinition];
NS_DURING
{
// Now, create the component by allocation a new instance of the class.
component=[[componentClass new] autorelease];
}
NS_HANDLER
@ -368,6 +373,8 @@ languages:(NSArray*)languages
[localException raise];
};
NS_ENDHANDLER;
// Remove the component from the thread dictionary
[threadDictionary removeObjectForKey:GSWThreadKey_ComponentDefinition];
// [_component context];//so what ?
LOGObjectFnStop();
@ -382,6 +389,7 @@ languages:(NSArray*)languages
};
//--------------------------------------------------------------------
/** Find the class of the component **/
-(Class)_componentClass
{
//OK To Verify
@ -392,13 +400,14 @@ languages:(NSArray*)languages
if (!componentClass)
componentClass=NSClassFromString(_name);//???
NSDebugMLLog(@"gswcomponents",@"componentClass=%@",componentClass);
NSDebugMLLog(@"gswcomponents",@"componentClass superclass=%@",[componentClass superclass]);
if (!componentClass)
NSDebugMLLog(@"gswcomponents",@"componentClass superclass=%@",[componentClass superclass]);
if (!componentClass) // There's no class with that name
{
BOOL createClassesOk=NO;
NSString* superClassName=nil;
if (!WOStrictFlag)
{
// Search component archive for a superclass (superClassName keyword)
NSDictionary* archive=[_bundle archiveNamed:_name];
NSDebugMLLog(@"gswcomponents",@"archive=%@",archive);
superClassName=[archive objectForKey:@"superClassName"];
@ -413,15 +422,20 @@ languages:(NSArray*)languages
};
};
};
// If we haven't found a superclass, use GSWComponent as the superclass
if (!superClassName)
superClassName=@"GSWComponent";
NSDebugMLLog(@"gswcomponents",@"superClassName=%@",superClassName);
// Create class
createClassesOk=[GSWApplication createUnknownComponentClasses:[NSArray arrayWithObject:_name]
superClassName:superClassName];
// Use it
componentClass=NSClassFromString(_name);
NSDebugMLLog(@"gswcomponents",@"componentClass=%p",(void*)componentClass);
};
//call GSWApp isCaching
//call GSWApp isCaching
NSDebugMLLog(@"gswcomponents",@"componentClass=%@",componentClass);
LOGObjectFnStop();
return componentClass;

View file

@ -35,6 +35,9 @@ static char rcsId[] = "$Id$";
@implementation GSWComponentRequestHandler
//--------------------------------------------------------------------
/** Handle request aRequest and return the response
This lock application
**/
-(GSWResponse*)handleRequest:(GSWRequest*)aRequest
{
//OK
@ -45,7 +48,7 @@ static char rcsId[] = "$Id$";
response=[self lockedHandleRequest:aRequest];
if (!response)
{
response=[GSWResponse responseWithMessage:@"Component Handle request failed"
response=[GSWResponse responseWithMessage:@"Component Handle request failed. No Response"
inContext:nil
forRequest:aRequest];
[response _finalizeInContext:nil]; //DO Call _finalizeInContext: !
@ -57,6 +60,9 @@ static char rcsId[] = "$Id$";
};
//--------------------------------------------------------------------
/** Handle request aRequest and return the response
Application should be locked before this
**/
-(GSWResponse*)lockedHandleRequest:(GSWRequest*)aRequest
{
//OK
@ -69,7 +75,7 @@ static char rcsId[] = "$Id$";
BOOL exceptionRaised=NO;
LOGObjectFnStart();
NS_DURING
{
{
requestHandlerValues=[GSWComponentRequestHandler _requestHandlerValuesForRequest:aRequest];
}
NS_HANDLER
@ -190,6 +196,7 @@ static char rcsId[] = "$Id$";
{
// check for refuseNewSessions
session=[application _initializeSessionInContext:aContext];
NSDebugMLLog(@"requests",@"session=%@",session);
}
}
NS_HANDLER

View file

@ -314,6 +314,8 @@ extern id imageMapString__Key;
extern id imageMapRegions__Key;
extern id handleValidationException__Key;
extern id selectedValues__Key;
extern id startIndex__Key;
extern id stopIndex__Key;
#endif // _GSWebConstants_h__

View file

@ -318,4 +318,6 @@ id imageMapString__Key = @"imageMapString";
id imageMapRegions__Key = @"imageMapRegions";
id handleValidationException__Key = @"handleValidationException";
id selectedValues__Key = @"selectedValues";
id startIndex__Key = @"startIndex";
id stopIndex__Key = @"stopIndex";

View file

@ -133,7 +133,7 @@ static int dontTraceComponentActionURL=0;
ASSIGN(clone->_pageComponent,_pageComponent);
ASSIGN(clone->_currentComponent,_currentComponent);
ASSIGNCOPY(clone->_url,_url);
ASSIGNCOPY(clone->_awakePageComponents,_awakePageComponents);
ASSIGN(clone->_awakePageComponents,_awakePageComponents);
clone->_urlApplicationNumber=_urlApplicationNumber;
clone->_isClientComponentRequest=_isClientComponentRequest;
clone->_distributionEnabled=_distributionEnabled;

View file

@ -27,6 +27,7 @@
#define _GSWebDebug_h__
#ifdef DEBUG
extern NSString* GSWDebugMethodMsg(id obj, SEL sel, const char *file, int line, NSString *fmt);
extern void GSWLogC_(CONST char* file,int line,CONST char* string);
extern void GSWLogDumpObjectFn(CONST char* file,int line,id object,int deep);
extern void GSWLogAssertGoodFn(CONST char* file,int line,NSObject* object);
@ -69,6 +70,7 @@ extern void GSWLogAssertGoodFn(CONST char* file,int line,NSObject* object);
// Normal Debug
#ifdef GSWDEBUG
#define LOGClassFnStart() \
do { if (GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugFunctionMsg(__PRETTY_FUNCTION__, __FILE__, __LINE__,@"FNSTART"); \
@ -111,47 +113,47 @@ extern void GSWLogAssertGoodFn(CONST char* file,int line,NSObject* object);
#define LOGObjectFnStart() \
do { if (GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART"); \
NSLog(fmt); }} while (0)
#define LOGObjectFnStop() \
do { if (GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP"); \
NSLog(fmt); }} while (0)
#define LOGObjectFnStartC(comment) \
do { if (GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART %s"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART %s"); \
NSLog(fmt,comment); }} while (0)
#define LOGObjectFnStopC(comment) \
do { if (GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP %s"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP %s"); \
NSLog(fmt,comment); }} while (0)
#define LOGObjectFnStartCond(cond) \
do { if (cond && GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART"); \
NSLog(fmt); }} while (0)
#define LOGObjectFnStopCond(cond) \
do { if (cond && GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP"); \
NSLog(fmt); }} while (0)
#define LOGObjectFnStartCondC(cond,comment) \
do { if (cond && GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART %s"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART %s"); \
NSLog(fmt,comment); }} while (0)
#define LOGObjectFnStopCondC(cond,comment) \
do { if (cond && GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP %s"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP %s"); \
NSLog(fmt,comment); }} while (0)
#define LOGObjectFnNotImplemented() \
do { if (GSDebugSet(@"dflt") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"NOT IMPLEMENTED"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"NOT IMPLEMENTED"); \
NSLog(fmt); }} while (0)
#define LOGClassFnNotImplemented() \
@ -202,25 +204,25 @@ extern void GSWLogAssertGoodFn(CONST char* file,int line,NSObject* object);
#define NSDebugMLLogCond(cond, level, format, args...) \
do { if (cond && GSDebugSet(level) == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt, ## args); }} while (0)
#define NSDebugMLogCond(cond, format, args...) \
do { if (cond && GSDebugSet(@"dflt") == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt, ## args); }} while (0)
#define NSDebugMLog0(format) \
do { if (GSDebugSet(@"dflt") == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt); }} while (0)
#define NSDebugMLLog0(level,format) \
do { if (GSDebugSet(level) == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt); }} while (0)
@ -313,47 +315,47 @@ extern void GSWLogAssertGoodFn(CONST char* file,int line,NSObject* object);
#define LOGDEEPObjectFnStart() \
do { if (GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART"); \
NSLog(fmt); }} while (0)
#define LOGDEEPObjectFnStop() \
do { if (GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP"); \
NSLog(fmt); }} while (0)
#define LOGDEEPObjectFnStartC(comment) \
do { if (GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART %s"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART %s"); \
NSLog(fmt,comment); }} while (0)
#define LOGDEEPObjectFnStopC(comment) \
do { if (GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP %s"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP %s"); \
NSLog(fmt,comment); }} while (0)
#define LOGDEEPObjectFnStartCond(cond) \
do { if (cond && GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART"); \
NSLog(fmt); }} while (0)
#define LOGDEEPObjectFnStopCond(cond) \
do { if (cond && GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP"); \
NSLog(fmt); }} while (0)
#define LOGDEEPObjectFnStartCondC(cond,comment) \
do { if (cond && GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART %s"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART %s"); \
NSLog(fmt,comment); }} while (0)
#define LOGDEEPObjectFnStopCondC(cond,comment) \
do { if (cond && GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP %s"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP %s"); \
NSLog(fmt,comment); }} while (0)
#define LOGDEEPObjectFnNotImplemented() \
do { if (GSDebugSet(@"dflt") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"NOT IMPLEMENTED"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"NOT IMPLEMENTED"); \
NSLog(fmt); }} while (0)
#define LOGDEEPClassFnNotImplemented() \
@ -404,37 +406,37 @@ extern void GSWLogAssertGoodFn(CONST char* file,int line,NSObject* object);
#define NSDebugDeepMLLogCond(cond, level, format, args...) \
do { if (cond && GSDebugSet(level) == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt, ## args); }} while (0)
#define NSDebugDeepMLog(format, args...) \
do { if (GSDebugSet(@"dflt") == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt, ## args); }} while (0)
#define NSDebugDeepMLLog(level, format, args...) \
do { if (GSDebugSet(level) == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt, ## args); }} while (0)
#define NSDebugDeepMLogCond(cond, format, args...) \
do { if (cond && GSDebugSet(@"dflt") == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt, ## args); }} while (0)
#define NSDebugDeepMLog0(format) \
do { if (GSDebugSet(@"dflt") == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt); }} while (0)
#define NSDebugDeepMLLog0(level,format) \
do { if (GSDebugSet(level) == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt); }} while (0)
@ -529,47 +531,47 @@ extern void GSWLogAssertGoodFn(CONST char* file,int line,NSObject* object);
#define LOGLOCKObjectFnStart() \
do { if (GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART"); \
NSLog(fmt); }} while (0)
#define LOGLOCKObjectFnStop() \
do { if (GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP"); \
NSLog(fmt); }} while (0)
#define LOGLOCKObjectFnStartC(comment) \
do { if (GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART %s"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART %s"); \
NSLog(fmt,comment); }} while (0)
#define LOGLOCKObjectFnStopC(comment) \
do { if (GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP %s"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP %s"); \
NSLog(fmt,comment); }} while (0)
#define LOGLOCKObjectFnStartCond(cond) \
do { if (cond && GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART"); \
NSLog(fmt); }} while (0)
#define LOGLOCKObjectFnStopCond(cond) \
do { if (cond && GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP"); \
NSLog(fmt); }} while (0)
#define LOGLOCKObjectFnStartCondC(cond,comment) \
do { if (cond && GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART %s"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTART %s"); \
NSLog(fmt,comment); }} while (0)
#define LOGLOCKObjectFnStopCondC(cond,comment) \
do { if (cond && GSDebugSet(@"GSWebFn") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP %s"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"FNSTOP %s"); \
NSLog(fmt,comment); }} while (0)
#define LOGLOCKObjectFnNotImplemented() \
do { if (GSDebugSet(@"dflt") == YES) { \
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"NOT IMPLEMENTED"); \
NSString *fmt = GSWDebugMethodMsg(self, _cmd, __FILE__, __LINE__,@"NOT IMPLEMENTED"); \
NSLog(fmt); }} while (0)
#define LOGLOCKClassFnNotImplemented() \
@ -620,37 +622,37 @@ extern void GSWLogAssertGoodFn(CONST char* file,int line,NSObject* object);
#define NSDebugLockMLLogCond(cond, level, format, args...) \
do { if (cond && GSDebugSet(level) == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt, ## args); }} while (0)
#define NSDebugLockMLLog(level, format, args...) \
do { if (GSDebugSet(level) == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt, ## args); }} while (0)
#define NSDebugLockMLogCond(cond, format, args...) \
do { if (cond && GSDebugSet(@"dflt") == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt, ## args); }} while (0)
#define NSDebugLockMLog(format, args...) \
do { if (GSDebugSet(@"dflt") == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt, ## args); }} while (0)
#define NSDebugLockMLog0(format) \
do { if (GSDebugSet(@"dflt") == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt); }} while (0)
#define NSDebugLockMLLog0(level,format) \
do { if (GSDebugSet(level) == YES) { \
NSString *fmt = GSDebugMethodMsg( \
NSString *fmt = GSWDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt); }} while (0)

View file

@ -50,6 +50,22 @@ static char rcsId[] = "$Id$";
@end
#ifdef DEBUG
NSString* GSWDebugMethodMsg(id obj, SEL sel, const char *file, int line, NSString *fmt)
{
NSString *message;
Class cls = (Class)obj;
char c = '+';
if ([obj isInstance] == YES)
{
c = '-';
cls = [obj class];
}
message = [NSString stringWithFormat: @"File %s: %d. In object %p [%@ %c%@] %@",
file, line, obj,NSStringFromClass(cls), c, NSStringFromSelector(sel), fmt];
return message;
}
//--------------------------------------------------------------------
void GSWLogC_(CONST char* file,int line,CONST char* string)
{

View file

@ -513,17 +513,37 @@ static char rcsId[] = "$Id$";
//TODOV
if (_otherQueryAssociations)
{
NSEnumerator *enumerator = [_otherAssociations keyEnumerator];
NSEnumerator *enumerator = [_otherQueryAssociations keyEnumerator];
id oaKey=nil;
while ((oaKey = [enumerator nextObject]))
{
id oaValue=[[_otherAssociations objectForKey:oaKey] valueInComponent:component];
id oaValue=[[_otherQueryAssociations objectForKey:oaKey] valueInComponent:component];
if (!oaValue)
oaValue=[NSString string];
[queryDictionary setObject:oaValue
forKey:oaKey];
};
};
if (_queryDictionary)
{
NSEnumerator *enumerator = nil;
NSDictionary* queryDictionaryValue=[_queryDictionary valueInComponent:component];
NSAssert3(!queryDictionaryValue || [queryDictionaryValue isKindOfClass:[NSDictionary class]],
@"queryDictionary value is not a dictionary but a %@. association was: %@. queryDictionaryValue is:",
[queryDictionaryValue class],
_queryDictionary,
queryDictionaryValue);
enumerator = [queryDictionaryValue keyEnumerator];
id oaKey=nil;
while ((oaKey = [enumerator nextObject]))
{
id oaValue=[queryDictionaryValue objectForKey:oaKey];
if (!oaValue)
oaValue=@"";
[queryDictionary setObject:oaValue
forKey:oaKey];
};
};
//TODO finished ??
LOGObjectFnStop();
return queryDictionary;

View file

@ -60,9 +60,14 @@
//====================================================================
@interface GSWInput (GSWInputA)
/** Return the name for html output.
If no name is binded, it return the context id **/
-(NSString*)nameInContext:(GSWContext*)context;
-(NSString*)valueInContext:(GSWContext*)context;
-(void)resetAutoValue;
/** Return YES if element is disabled, NO otherwise,
depending on disabled/enabled binding
**/
-(BOOL)disabledInContext:(GSWContext*)context;
@end
@ -75,10 +80,24 @@
//====================================================================
@interface GSWInput (GSWInputC)
/** Append the following elements to response:
tag
name (by calling -appendNameToResponse:inContext:)
value (by calling -appendValueToResponse:inContext:)
and others specified tag properties
**/
-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response
inContext:(GSWContext*)context;
/** Append value property to response.
(Called by -appendGSWebObjectsAssociationsToResponse:inContext:)
**/
-(void)appendValueToResponse:(GSWResponse*)response
inContext:(GSWContext*)context;
/** Append name property to response.
name come from -nameInContext:
*/
-(void)appendNameToResponse:(GSWResponse*)response
inContext:(GSWContext*)context;

View file

@ -43,8 +43,9 @@ static char rcsId[] = "$Id$";
LOGObjectFnStartC("GSWInput");
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",aName,associations,elements);
[attributedAssociations removeObjectForKey:disabled__Key];
[attributedAssociations removeObjectForKey:enabled__Key];//??
[attributedAssociations removeObjectForKey:value__Key];//??
[attributedAssociations removeObjectForKey:enabled__Key];
[attributedAssociations removeObjectForKey:value__Key];
[attributedAssociations removeObjectForKey:name__Key];
if (!WOStrictFlag)
[attributedAssociations removeObjectForKey:handleValidationException__Key];
_value = [[associations objectForKey:value__Key
@ -131,50 +132,15 @@ static char rcsId[] = "$Id$";
nameValue=[context elementID];
NSDebugMLLog(@"gswdync",@"elementID=%@",[context elementID]);
};
NSDebugMLLog(@"gswdync",@"nameValue=%@",nameValue);
GSWAssertIsElementID(context);
LOGObjectFnStopC("GSWInput");
return nameValue;
};
static int countAutoValue = 0;
//--------------------------------------------------------------------
-(NSString*)valueInContext:(GSWContext*)context
{
//OK
GSWComponent *component=nil;
NSString *valueValue=nil;
LOGObjectFnStartC("GSWInput");
countAutoValue++;
if(_value)
{
component=[context component];
valueValue=[_value valueInComponent:component];
}
else
{
valueValue=[NSString stringWithFormat:@"%@.%d", [context elementID], countAutoValue];
NSDebugMLLog(@"gswdync",@"elementID=%@ _countAutoValue",[context elementID], countAutoValue);
}
LOGObjectFnStopC("GSWInput");
return valueValue;
}
//--------------------------------------------------------------------
- (void)resetAutoValue
{
LOGObjectFnStartC("GSWInput");
countAutoValue = 0;
LOGObjectFnStopC("GSWInput");
}
//--------------------------------------------------------------------
-(BOOL)disabledInContext:(GSWContext*)context
{
//OK
if (!WOStrictFlag && _enabled)
return ![self evaluateCondition:_enabled
inContext:context];
@ -249,10 +215,10 @@ static int countAutoValue = 0;
disabledInContext=[self disabledInContext:context]; //return 0
if (disabledInContext)
[response _appendContentAsciiString:@" disabled"];
[self appendValueToResponse:response
inContext:context];
[self appendNameToResponse:response
inContext:context];
[self appendValueToResponse:response
inContext:context];
LOGObjectFnStopC("GSWInput");
};

View file

@ -46,12 +46,15 @@
plainText:(NSString*)plainTextMessage
send:(BOOL)sendNow;
-(NSString*)composeEmailFrom:(NSString*)sender
to:(NSArray*)to
cc:(NSArray*)cc
subject:(NSString*)subject
component:(GSWComponent*)component
send:(BOOL)sendNow;
//NDFN
-(NSString*)composeEmailFrom:(NSString*)sender
to:(NSArray*)to
@ -60,6 +63,9 @@
subject:(NSString*)subject
plainText:(NSString*)plainTextMessage
send:(BOOL)sendNow;
//NDFN
//NDFN
-(NSString*)composeEmailFrom:(NSString*)sender
to:(NSArray*)to
@ -69,6 +75,7 @@
component:(GSWComponent*)component
send:(BOOL)sendNow;
-(void)sendEmail:(NSString*)emailString;
-(void)_invokeGSWSendMailAt:(id)at
withEmail:(id)email;

View file

@ -54,19 +54,24 @@ static GSWMailDelivery *sharedInstance;
plainText:(NSString*)plainTextMessage
send:(BOOL)sendNow
{
NSString* emailString=nil;
LOGObjectFnStart();
NSDebugMLog(@"sender=%@",sender);
NSDebugMLog(@"to=%@",to);
NSDebugMLog(@"cc=%@",cc);
NSDebugMLog(@"subject=%@",subject);
NSDebugMLog(@"plainTextMessage=%@",plainTextMessage);
NSDebugMLog(@"sendNow=%d",(int)sendNow);
return [self composeEmailFrom:sender
to:to
cc:cc
bcc:nil
subject:subject
plainText:plainTextMessage
send:sendNow];
emailString=[self composeEmailFrom:sender
to:to
cc:cc
bcc:nil
subject:subject
plainText:plainTextMessage
send:sendNow];
NSDebugMLog(@"emailString=%@",emailString);
LOGObjectFnStop();
return emailString;
};
-(NSString*)composeEmailFrom:(NSString*)sender
@ -76,10 +81,27 @@ static GSWMailDelivery *sharedInstance;
component:(GSWComponent*)component
send:(BOOL)sendNow
{
LOGObjectFnNotImplemented(); //TODOFN
return nil;
NSString* emailString=nil;
LOGObjectFnStart();
NSDebugMLog(@"sender=%@",sender);
NSDebugMLog(@"to=%@",to);
NSDebugMLog(@"cc=%@",cc);
NSDebugMLog(@"subject=%@",subject);
NSDebugMLog(@"component=%@",component);
NSDebugMLog(@"sendNow=%d",(int)sendNow);
emailString=[self composeEmailFrom:sender
to:to
cc:cc
bcc:nil
subject:subject
component:component
send:sendNow];
NSDebugMLog(@"emailString=%@",emailString);
LOGObjectFnStop();
return emailString;
};
//NDFN
-(NSString*)composeEmailFrom:(NSString*)sender
to:(NSArray*)to
@ -93,7 +115,10 @@ static GSWMailDelivery *sharedInstance;
NSMutableString* toString=nil;
int i=0;
int count=0;
LOGObjectFnStart();
NSAssert1(!to || [to isKindOfClass:[NSArray class]],@"to is a %@, not a NSArray",[to class]);
NSAssert1(!cc || [cc isKindOfClass:[NSArray class]],@"cc is a %@, not a NSArray",[cc class]);
NSAssert1(!bcc || [bcc isKindOfClass:[NSArray class]],@"bcc is a %@, not a NSArray",[bcc class]);
count=[to count];
NSDebugMLog(@"sender=%@",sender);
NSDebugMLog(@"to=%@",to);
@ -147,10 +172,12 @@ static GSWMailDelivery *sharedInstance;
NSDebugMLog(@"messageString=%@",messageString);
if (sendNow)
[self sendEmail:messageString];
LOGObjectFnStop();
return messageString;
};
//NDFN
// Be carefull: this call [context _generateCompleteURLs]
-(NSString*)composeEmailFrom:(NSString*)sender
to:(NSArray*)to
cc:(NSArray*)cc
@ -159,16 +186,107 @@ static GSWMailDelivery *sharedInstance;
component:(GSWComponent*)component
send:(BOOL)sendNow
{
LOGObjectFnNotImplemented(); //TODOFN
return nil;
//TODO setting the content type of the email as Content-type: text/html.
GSWContext* context=nil;
NSString* plainTextMessage=nil;
NSString* messageString=nil;
GSWResponse* response=nil;
LOGObjectFnStart();
NSDebugMLog(@"component=%@",component);
context=[component context];
NSDebugMLog(@"context=%@",context);
[context _generateCompleteURLs];
response=[component generateResponse];
NSDebugMLog(@"response=%@",response);
plainTextMessage=[[[NSString alloc]initWithData:[response content]
encoding:[response contentEncoding]] autorelease];
NSDebugMLog(@"plainTextMessage=%@",plainTextMessage);
messageString=[self composeEmailFrom:sender
to:to
cc:cc
bcc:bcc
subject:subject
plainText:plainTextMessage
send:sendNow];
messageString=[[response content]description];
NSDebugMLog(@"messageString=%@",messageString);
LOGObjectFnStop();
return messageString;
};
-(void)sendEmail:(NSString *)emailString_
{
int files[2];
pid_t pid;
NSDebugMLog(@"emailString_=%@",emailString_);
-(void)sendEmail:(NSString *)emailString
{
FILE* sendmailFile=NULL;
NSString* sendmailPath=nil;
NSString* sendmailCommand=nil;
NSFileManager* fileManager=nil;
LOGObjectFnStart();
//TODO: here we should contact smtp server,... instead au using sendmail
NSDebugMLog(@"emailString=%@",emailString);
fileManager=[NSFileManager defaultManager];
NSAssert(fileManager,@"No fileManager");
sendmailPath=@"/usr/bin/sendmail";
if (![fileManager isExecutableFileAtPath:sendmailPath])
{
sendmailPath=@"/usr/lib/sendmail";
if (![fileManager isExecutableFileAtPath:sendmailPath])
{
sendmailPath=@"/usr/sbin/sendmail";
if (![fileManager isExecutableFileAtPath:sendmailPath])
{
sendmailPath=@"/bin/sendmail";
if (![fileManager isExecutableFileAtPath:sendmailPath])
{
sendmailPath=@"/sbin/sendmail";
if (![fileManager isExecutableFileAtPath:sendmailPath])
{
sendmailPath=@"/usr/local/bin/sendmail";
if (![fileManager isExecutableFileAtPath:sendmailPath])
{
sendmailPath=@"/usr/local/lib/sendmail";
if (![fileManager isExecutableFileAtPath:sendmailPath])
{
sendmailPath=@"/usr/local/sbin/sendmail";
if (![fileManager isExecutableFileAtPath:sendmailPath])
{
sendmailPath=@"sendmail"; //try without absolute path
};
};
};
};
};
};
};
};
NSDebugMLog(@"sendmailPath=%@",sendmailPath);
// -i When reading a message from standard input, don't treat a line with only a . character as the end of input.
// -t Extract recipients from message headers. This requires that no recipients be specified on the command line.
sendmailCommand=[NSString stringWithFormat:@"%@ -i -t",sendmailPath];
NSDebugMLog(@"sendmailCommand=%@",sendmailCommand);
sendmailFile=popen([sendmailCommand lossyCString],"w");
if (sendmailFile)
{
const char* cString=[emailString lossyCString];
size_t len=strlen(cString);
size_t written=fwrite(cString, sizeof(char),len,sendmailFile);
if (written!=len)
{
NSDebugMLog(@"Error writing to sendmail (written %d / %d",written,len);
};
fclose(sendmailFile);
}
else
{
NSDebugMLog(@"Can't run sendmail (%@)",sendmailCommand);
};
LOGObjectFnStop();
/* int files[2];
pid_t pid;
LOGObjectFnStart();
NSDebugMLog(@"emailString=%@",emailString);
if(pipe(files))
[NSException raise:NSInternalInconsistencyException format:@"%@ -- %@ 0x%x: cannot create pipe",
@ -179,6 +297,7 @@ static GSWMailDelivery *sharedInstance;
switch(pid = fork())
{
case 0:
NSDebugMLog(@"FORK0");
close(0);
dup(files[0]);
close(files[0]);
@ -189,6 +308,7 @@ static GSWMailDelivery *sharedInstance;
break;
case -1:
NSDebugMLog(@"FORK-1");
close(files[0]);
close(files[1]);
[NSException raise:NSInternalInconsistencyException format:@"%@ -- %@ 0x%x: cannot fork process",
@ -198,13 +318,16 @@ static GSWMailDelivery *sharedInstance;
break;
default:
write(files[1], [emailString_ cString], strlen([emailString_ cString]));
NSDebugMLog(@"FORKDEF");
write(files[1], [emailString cString], strlen([emailString cString]));
close(files[0]);
close(files[1]);
waitpid(pid, NULL, 0);
break;
}
LOGObjectFnStop();
*/
};
-(void)_invokeGSWSendMailAt:(id)at
@ -215,3 +338,4 @@ static GSWMailDelivery *sharedInstance;
@end

View file

@ -46,7 +46,6 @@
GSWAssociation* _noSelectionString;
GSWAssociation* _escapeHTML;
//GSWeb Additions {
BOOL _autoValue;
GSWAssociation* _count;
GSWAssociation* _index;
// }

View file

@ -31,6 +31,35 @@ static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
/**
Bindings
list Array of objects that the dynamic element iterate through.
index On each iteration the element put the current index in this binding
item On each iteration the element take the item at the current index and put it in this binding
displayString String to display for each item.
value Value for each OPTION tag
selection Selected object (used to pre-select item and modified to reflect user choice)
It contains object from list, not value binding evaluated one !
selectedValue Array of pre selected values (not objects !)
name Name of the element in the form (should be unique). If not specified, GSWeb assign one.
disabled If evaluated to yes, the check box appear inactivated.
escapeHTML If evaluated to yes, escape displayString
noSelectionString If binded, displayed as the first item. If selected, considered as
an empty selection (selection is set to nil, selectionValue too)
**/
//====================================================================
@implementation GSWPopUpButton
@ -147,7 +176,7 @@ static char rcsId[] = "$Id$";
/*
On WO it looks like that:
On WO it looks like that when value is not binded:
<SELECT name="4.2.7">
<OPTION value="0">blau</OPTION>
@ -181,8 +210,6 @@ static char rcsId[] = "$Id$";
id escapeHTMLValue=nil;
int i=0;
BOOL inOptGroup=NO;
NSString * popupName=nil;
#ifndef ENABLE_OPTGROUP
BOOL optGroupLabel=NO;
#endif
@ -190,17 +217,13 @@ static char rcsId[] = "$Id$";
LOGObjectFnStartC("GSWPopUpButton");
GSWStartElement(context);
GSWSaveAppendToResponseElementID(context);
[self resetAutoValue];
_autoValue = NO;
request=[context request];
isFromClientComponent=[request isFromClientComponent];
component=[context component];
popupName=[self nameInContext:context];
//[super appendToResponse:response
// inContext:context];
[response _appendContentAsciiString:@"<SELECT"];
[response _appendContentAsciiString:[NSString stringWithFormat:@" NAME=\"%@\">",popupName]];
[super appendToResponse:response
inContext:context];
NSDebugMLLog(@"gswdync",@"_list=%@",_list);
if (_list)
@ -215,8 +238,6 @@ static char rcsId[] = "$Id$";
countValue=[listValue count];
};
// NSLog(@"listValue=%@",listValue);
NSDebugMLLog(@"gswdync",@"_count=%@",_count);
if (_count)
{
@ -246,6 +267,7 @@ static char rcsId[] = "$Id$";
escapeHTMLValue=[_escapeHTML valueInComponent:component];
escapeHTMLBoolValue=boolValueFor(escapeHTMLValue);
};
if (_noSelectionString)
{
id noSelectionStringValue=nil;
@ -256,6 +278,7 @@ static char rcsId[] = "$Id$";
[response _appendContentAsciiString:@"selected"];//TODO
};
[response appendContentCharacter:'>'];
noSelectionStringValue=[_noSelectionString valueInComponent:component];
if (escapeHTMLBoolValue)
noSelectionStringValue=[GSWResponse stringByEscapingHTMLString:noSelectionStringValue];
@ -264,6 +287,7 @@ static char rcsId[] = "$Id$";
// There is no close tag on OPTION
//[response _appendContentAsciiString:@"</OPTION>"];
};
NSDebugMLLog(@"gswdync",@"countValue=%d",countValue);
for(i=0;i<countValue;i++)
{
@ -278,18 +302,18 @@ static char rcsId[] = "$Id$";
if (_index)
[_index setValue:[NSNumber numberWithShort:i]
inComponent:component];
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
if (itemValue)
{
NSDebugMLLog(@"gswdync",@"value=%@",_value);
if (_value)
valueValue=[self valueInContext:context];
else
{
_autoValue = YES;
valueValue = itemValue;
};
NSDebugMLLog(@"gswdync",@"_value (class: %@): %@",[_value class],_value);
// Value property of the INPUT tag
if (_value) // Binded Value
valueValue = [_value valueInComponent:component];
else // Auto Value
valueValue = [NSNumber numberWithInt:i];
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (valueValue)
{
BOOL isEqual=NO;
@ -297,41 +321,15 @@ static char rcsId[] = "$Id$";
NSDebugMLLog0(@"gswdync",@"Adding OPTION");
[response _appendContentAsciiString:@"\n<OPTION"];
NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue);
if (_selection)
{
if (_value)
{
//NSLog(@"%s:%d valueValue:%@ selectionValue:%@",__FILE__,__LINE__,valueValue,selectionValue);
isEqual=SBIsValueEqual(valueValue,selectionValue);
// dave
// isEqual=[valueValue isEqual:selectionValue];
//We can have a value but want to compare on item/selection object
if (!isEqual) {
// isEqual=(itemValue && (itemValue==selectionValue));
isEqual=(itemValue && ([itemValue isEqual:selectionValue]));
} // ??
} else {
//NSLog(@"%s:%d itemValue:%@ selectionValue:%@",__FILE__,__LINE__,itemValue,selectionValue);
NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue);
NSDebugMLLog(@"gswdync",@"selectionValue class=%@",[selectionValue class]);
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
NSDebugMLLog(@"gswdync",@"itemValue class=%@",[itemValue class]);
if (selectionValue)
{
isEqual=SBIsValueEqual(itemValue,selectionValue);
}
NSDebugMLLog(@"gswdync",@"isEqual=%s",(isEqual ? "YES" : "NO"));
if (isEqual)
{
[response appendContentCharacter:' '];
[response _appendContentAsciiString:@"selected"];
};
};
if (isEqual == NO && _selectedValue)
{
if(_value) {
//NSLog(@"%s:%d valueValue:%@ selectedValueValue:%@",__FILE__,__LINE__,valueValue,selectedValueValue);
isEqual=SBIsValueEqual(valueValue,selectedValueValue);
} else {
//NSLog(@"%s:%d itemValue:%@ selectedValueValue:%@",__FILE__,__LINE__,itemValue,selectedValueValue);
isEqual=SBIsValueEqual(itemValue,selectedValueValue);
}
NSDebugMLLog(@"gswdync",@"isEqual=%s",(isEqual ? "YES" : "NO"));
if (isEqual)
{
@ -339,13 +337,23 @@ static char rcsId[] = "$Id$";
[response _appendContentAsciiString:@"selected"];
};
};
if (valueValue)
{
[response _appendContentAsciiString:@" value=\""];
//[response _appendContentAsciiString:valueValue];
[response _appendContentAsciiString:[NSString stringWithFormat:@"%d",i]];
[response appendContentCharacter:'"'];
};
if (isEqual == NO && _selectedValue)
{
// selected values is selections but on valueValue not itemValue
isEqual=SBIsValueEqual(valueValue,selectedValueValue);
NSDebugMLLog(@"gswdync",@"isEqual=%s",(isEqual ? "YES" : "NO"));
if (isEqual)
{
[response appendContentCharacter:' '];
[response _appendContentAsciiString:@"selected"];
};
};
[response _appendContentAsciiString:@" value=\""];
[response _appendContentAsciiString:valueValue];
[response appendContentCharacter:'"'];
[response appendContentCharacter:'>'];
};
displayStringValue=nil;
@ -402,7 +410,6 @@ static char rcsId[] = "$Id$";
};
if (valueValue)
{
//NSDebugMLLog0(@"gswdync",@"Adding /OPTION");
// K2- No /OPTION TAG
//[response _appendContentAsciiString:@"</OPTION>"];
}
@ -439,8 +446,7 @@ static char rcsId[] = "$Id$";
-(void)appendValueToResponse:(GSWResponse*)response
inContext:(GSWContext*)context
{
//OK
//Does nothing !
//Does nothing because value is only printed in OPTION tag
};
//--------------------------------------------------------------------
@ -475,7 +481,6 @@ static char rcsId[] = "$Id$";
LOGObjectFnStartC("GSWPopUpButton");
GSWStartElement(context);
GSWAssertCorrectElementID(context);
[self resetAutoValue];
disabledValue=[self disabledInContext:context];
if (!disabledValue)
{
@ -485,6 +490,7 @@ static char rcsId[] = "$Id$";
GSWComponent* component=nil;
NSArray* listValue=nil;
id valueValue=nil;
NSString* valueValueString=nil;
id itemValue=nil;
NSString* name=nil;
NSArray* formValues=nil;
@ -492,127 +498,124 @@ static char rcsId[] = "$Id$";
BOOL found=NO;
int i=0;
int countValue=0;
id itemValueToSet=nil; // Object from list found (==> _selection)
id valueValueToSet=nil; // Value Found (==> _selectionValue)
component=[context component];
name=[self nameInContext:context];
NSDebugMLLog(@"gswdync",@"name=%@",name);
formValues=[request formValuesForKey:name];
NSDebugMLLog(@"gswdync",@"formValues=%@",formValues);
if (formValues && [formValues count]>0)
{
BOOL isEqual=NO;
formValue=[formValues objectAtIndex:0];
//NSLog(@"GSWPopUpButton formValue=%@",formValue);
NSDebugMLLog(@"gswdync",@"formValue=%@",formValue);
if (_list)
{
listValue=[_list valueInComponent:component];
NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
_list,
listValue,
[listValue class]);
countValue=[listValue count];
}
if (_count)
{
id tmpCountValue=[_count valueInComponent:component];
int tmpCount=0;
NSAssert3(!tmpCountValue || [tmpCountValue respondsToSelector:@selector(intValue)],
@"The 'count' (%@) value %@ (of class:%@) doesn't respond to 'intValue'",
_count,
tmpCountValue,
[tmpCountValue class]);
tmpCount=[tmpCountValue intValue];
NSDebugMLog(@"tmpCount=%d",tmpCount);
formValue=[formValues objectAtIndex:0];
NSDebugMLLog(@"gswdync",@"formValue=%@",formValue);
if (_list)
countValue=min(tmpCount,countValue);
else
countValue=tmpCount;
}
for(i=0;!found && i<countValue;i++) {
itemValue=[listValue objectAtIndex:i];
// NSDebugMLLog(@"gswdync",@"_itemValue=%@",itemValue);
// NSDebugMLLog(@"gswdync",@"item=%@",_item);
if (_item)
[_item setValue:itemValue
inComponent:component];
//NSDebugMLLog(@"gswdync",@"value=%@",_value);
if ([formValues containsObject:[NSString stringWithFormat:@"%d",i]])
{
found=YES;
if (_selection)
{
NS_DURING
{
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
[_selection setValue:itemValue
inComponent:component];
}
NS_HANDLER
{
LOGException(@"GSWPopUpButton _value=%@ resultValue=%@ exception=%@",
_value,resultValue,localException);
if (WOStrictFlag)
listValue=[_list valueInComponent:component];
NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
_list,
listValue,
[listValue class]);
countValue=[listValue count];
}
if (_count)
{
id tmpCountValue=[_count valueInComponent:component];
int tmpCount=0;
NSAssert3(!tmpCountValue || [tmpCountValue respondsToSelector:@selector(intValue)],
@"The 'count' (%@) value %@ (of class:%@) doesn't respond to 'intValue'",
_count,
tmpCountValue,
[tmpCountValue class]);
tmpCount=[tmpCountValue intValue];
NSDebugMLog(@"tmpCount=%d",tmpCount);
if (_list)
countValue=min(tmpCount,countValue);
else
countValue=tmpCount;
}
for(i=0;!found && i<countValue;i++)
{
if (listValue)
itemValue=[listValue objectAtIndex:i];
else
itemValue=[NSNumber numberWithShort:i];
NSDebugMLLog(@"gswdync",@"_itemValue=%@",itemValue);
NSDebugMLLog(@"gswdync",@"_item=%@",_item);
if (_item)
[_item setValue:itemValue
inComponent:component];
if (_index)
[_index setValue:[NSNumber numberWithShort:i]
inComponent:component];
NSDebugMLLog(@"gswdync",@"value=%@",_value);
if (_value) // Binded Value
valueValue = [_value valueInComponent:component];
else // Auto Value
valueValue = [NSNumber numberWithInt:i];
valueValueString=[NSString stringWithFormat:@"%@",valueValue];
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (valueValue)
{
// we compare (with object equality not pointer equality)
found=[formValues containsObject:valueValueString];
if (found)
{
itemValueToSet=itemValue;
valueValueToSet=valueValue;
}
};
};
};
if (_selection)
{
NS_DURING
{
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
[_selection setValue:itemValueToSet
inComponent:component];
}
NS_HANDLER
{
LOGException(@"GSWPopUpButton _selection=%@ itemValueToSet=%@ exception=%@",
_selection,itemValueToSet,localException);
if (WOStrictFlag)
{
[localException raise];
}
else
else
{
[self handleValidationException:localException
inContext:context];
};
}
NS_ENDHANDLER;
};
};
};// for
};
NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO"));
if (!found)
{
if (_selection)
{
NS_DURING
{
[_selection setValue:nil
inComponent:component];
}
NS_HANDLER
{
LOGException(@"GSWPopUpButton _selection=%@ exception=%@",
_selection,localException);
if (WOStrictFlag)
{
[localException raise];
}
else
{
[self handleValidationException:localException
inContext:context];
};
}
NS_ENDHANDLER;
};
if (!WOStrictFlag && _selectionValue)
{
NS_DURING
{
[_selectionValue setValue:nil
inComponent:component];
};
NS_HANDLER
{
LOGException(@"GSWPopUpButton _selectionValue=%@ exception=%@",
_selectionValue,localException);
[self handleValidationException:localException
inContext:context];
}
NS_ENDHANDLER;
};
};
}
NS_ENDHANDLER;
};
NSDebugMLLog(@"gswdync",@"selectionValue=%@",_selectionValue);
if (!WOStrictFlag && _selectionValue)
{
NS_DURING
{
[_selectionValue setValue:valueValueToSet
inComponent:component];
}
NS_HANDLER
{
LOGException(@"GSWPopUpButton _selectionValue=%@ valueValueToSet=%@ exception=%@",
_selectionValue,valueValue,localException);
[self handleValidationException:localException
inContext:context];
}
NS_ENDHANDLER;
};
};
};

View file

@ -39,6 +39,9 @@
GSWAssociation* _item;
GSWAssociation* _index;
GSWAssociation* _selection;
//GSWeb Additions {
GSWAssociation* _selectionValue;
// }
GSWAssociation* _prefix;
GSWAssociation* _suffix;
GSWAssociation* _displayString;

View file

@ -31,6 +31,36 @@ static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
/**
Bindings
list Array of objects that the dynamic element iterate through.
index On each iteration the element put the current index in this binding
item On each iteration the element take the item at the current index and put it in this binding
displayString String to display for each radio button.
value Value for the INPUT tag for each radio button
prefix An html string to insert before each value.
suffix An html string to insert after each value.
selection Selected object (used to pre-check radio button and modified to reflect user choice)
It contains object from list, not value binding evaluated one !
selectionValue Selected value (used to pre-check radio button and modified to reflect user choice)
It contains evaluated value binding !
name Name of the element in the form (should be unique). If not specified, GSWeb assign one.
disabled If evaluated to yes, the radio button appear inactivated.
escapeHTML If evaluated to yes, escape displayString
**/
//====================================================================
@implementation GSWRadioButtonList
@ -41,7 +71,7 @@ static char rcsId[] = "$Id$";
{
//OK
NSMutableDictionary* tmpAssociations=[NSMutableDictionary dictionaryWithDictionary:associations];
LOGObjectFnStart();
LOGObjectFnStartC("GSWRadioButtonList");
NSDebugMLLog(@"gswdync",@"aName=%@ associations:%@ elements=%@",
aName,associations,elements);
_defaultEscapeHTML=1;
@ -49,6 +79,8 @@ static char rcsId[] = "$Id$";
[tmpAssociations removeObjectForKey:item__Key];
[tmpAssociations removeObjectForKey:index__Key];
[tmpAssociations removeObjectForKey:selection__Key];
if (!WOStrictFlag)
[tmpAssociations removeObjectForKey:selectionValue__Key];
[tmpAssociations removeObjectForKey:prefix__Key];
[tmpAssociations removeObjectForKey:suffix__Key];
[tmpAssociations removeObjectForKey:displayString__Key];
@ -63,20 +95,29 @@ static char rcsId[] = "$Id$";
withDefaultObject:[_item autorelease]] retain];
if (_item && ![_item isValueSettable])
{
ExceptionRaise0(@"GSWCheckBox",@"'item' parameter must be settable");
ExceptionRaise0(@"GSWRadioButtonList",@"'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");
ExceptionRaise0(@"GSWRadioButtonList",@"'index' parameter must be settable");
};
_selection=[[associations objectForKey:selection__Key
withDefaultObject:[_selection autorelease]] retain];
if (![_selection isValueSettable])
if (_selection && ![_selection isValueSettable])
{
ExceptionRaise0(@"GSWCheckBox",@"'selection' parameter must be settable");
ExceptionRaise0(@"GSWRadioButtonList",@"'selection' parameter must be settable");
};
if (!WOStrictFlag)
{
_selectionValue=[[associations objectForKey:selectionValue__Key
withDefaultObject:[_selectionValue autorelease]] retain];
if (_selectionValue && ![_selectionValue isValueSettable])
{
ExceptionRaise0(@"GSWRadioButtonList",@"'selectionValue' parameter must be settable");
};
};
_prefix=[[associations objectForKey:prefix__Key
withDefaultObject:[_prefix autorelease]] retain];
@ -97,6 +138,7 @@ static char rcsId[] = "$Id$";
DESTROY(_item);
DESTROY(_index);
DESTROY(_selection);
DESTROY(_selectionValue);//GSWeb Only
DESTROY(_prefix);
DESTROY(_suffix);
DESTROY(_displayString);
@ -128,10 +170,10 @@ static char rcsId[] = "$Id$";
inContext:(GSWContext*)context
{
//OK
LOGObjectFnStart();
LOGObjectFnStartC("GSWRadioButtonList");
[self _slowTakeValuesFromRequest:request
inContext:context];
LOGObjectFnStop();
LOGObjectFnStopC("GSWRadioButtonList");
};
//-----------------------------------------------------------------------------------
@ -140,26 +182,31 @@ static char rcsId[] = "$Id$";
{
//OK
BOOL disabledInContext=NO;
LOGObjectFnStart();
LOGObjectFnStartC("GSWRadioButtonList");
[self resetAutoValue];
disabledInContext=[self disabledInContext:context];
if (!disabledInContext)
{
if ([context _wasFormSubmitted])
{
GSWComponent* component=[context component];
NSArray* listValue=nil;
NSArray* listValue=nil; // _list value
NSString* name=nil;
int foundIndex=-1;
BOOL found=NO;
id formValue=nil;
id valueValue=nil;
id valueToSet=nil;
id valueValue=nil; // _value value (or autoValue)
id itemValue=nil; // _item value
NSString* valueValueString=nil; // _value value as string
id itemValueToSet=nil; // item value to set to _selection
id valueValueToSet=nil; // valueValue to set to _selectionValue
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'",
@ -167,78 +214,103 @@ static char rcsId[] = "$Id$";
listValue,
[listValue class]);
NSDebugMLLog(@"gswdync",@"listValue=%@",listValue);
for(i=0;i<[listValue count] && foundIndex<0;i++)
for(i=0;i<[listValue count] && !found;i++)
{
NSDebugMLLog(@"gswdync",@"item=%@",_item);
NSDebugMLLog(@"gswdync",@"index=%@",_index);
if (_item)
[_item setValue:[listValue objectAtIndex:i]
itemValue=[listValue objectAtIndex:i];
if (_item)
[_item setValue:itemValue
inComponent:component];
else if (_index)
if (_index)
[_index setValue:[NSNumber numberWithShort:i]
inComponent:component];
NSDebugMLLog(@"gswdync",@"value=%@",_value);
//TODOV
valueValue=[self valueInContext:context];
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
NSDebugMLLog(@"gswdync",@"value=%@",_value);
if (_value) // Binded Value
valueValue = [_value valueInComponent:component];
else // Auto Value
valueValue = [NSNumber numberWithInt:i];
valueValueString=[NSString stringWithFormat:@"%@",valueValue];
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
if (valueValue)
{
BOOL isEqual=SBIsValueEqual(valueValue,formValue);
// we compare (with object equality not pointer equality)
BOOL isEqual=SBIsValueEqual(valueValueString,formValue);
NSDebugMLLog(@"gswdync",@"isEqual=%s",(isEqual ? "YES" : "NO"));
if (isEqual)
{
if(_autoValue == NO)
valueToSet=valueValue;
else
valueToSet=[listValue objectAtIndex:i];
foundIndex=i;
itemValueToSet=itemValue;
valueValueToSet=valueValue;
found=YES;
};
};
};
NSDebugMLLog(@"gswdync",@"component=%@",component);
NSDebugMLLog(@"gswdync",@"foundIndex=%d",foundIndex);
NSDebugMLLog(@"gswdync",@"found=%s",(found ? "YES" : "NO"));
NSDebugMLLog(@"gswdync",@"selection=%@",_selection);
GSWLogAssertGood(component);
if (!WOStrictFlag)
NS_DURING
{
NS_DURING
[_selection setValue:itemValueToSet
inComponent:component];
};
NS_HANDLER
{
LOGException(@"GSWRadioButtonList _selection=%@ itemValueToSet=%@ exception=%@",
_selection,itemValueToSet,localException);
if (WOStrictFlag)
{
if (foundIndex>=0)
[_selection setValue:valueToSet
inComponent:component];
else
[_selection setValue:nil
inComponent:component];
};
NS_HANDLER
[localException raise];
}
else
{
[self handleValidationException:localException
inContext:context];
};
}
NS_ENDHANDLER;
if (!WOStrictFlag && _selectionValue)
{
NS_DURING
{
[_selectionValue setValue:valueValueToSet
inComponent:component];
};
NS_HANDLER
{
LOGException(@"GSWRadioButtonList _selectionValue=%@ valueValueToSet=%@ exception=%@",
_selectionValue,valueValueToSet,localException);
if (WOStrictFlag)
{
[localException raise];
}
else
{
[self handleValidationException:localException
inContext:context];
};
}
NS_ENDHANDLER;
}
else
{
if (foundIndex>=0)
[_selection setValue:valueToSet
inComponent:component];
else
[_selection setValue:nil
inComponent:component];
};
};
};
LOGObjectFnStop();
LOGObjectFnStopC("GSWRadioButtonList");
};
//-----------------------------------------------------------------------------------
-(void)_fastTakeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context
{
LOGObjectFnStart();
LOGObjectFnStartC("GSWRadioButtonList");
LOGObjectFnNotImplemented(); //TODOFN
LOGObjectFnStop();
LOGObjectFnStopC("GSWRadioButtonList");
};
//-----------------------------------------------------------------------------------
@ -248,24 +320,28 @@ static char rcsId[] = "$Id$";
//OK
GSWRequest* request=nil;
BOOL isFromClientComponent=NO;
BOOL disabledInContext=NO;
NSString* name=nil;
GSWComponent* component=nil;
NSArray* listValue=nil;
id selectionValue=nil;
id selectionValueValue=nil;
int i=0;
id displayStringValue=nil;
id prefixValue=nil;
id suffixValue=nil;
id valueValue=nil;
BOOL isEqual=NO;
LOGObjectFnStart();
[self resetAutoValue];
_autoValue = NO;
id valueValue=nil; // _value value (or auto value)
id itemValue=nil; // _item value
LOGObjectFnStartC("GSWRadioButtonList");
request=[context request];
isFromClientComponent=[request isFromClientComponent];
name=[self nameInContext:context];
component=[context component];
selectionValue=[_selection valueInComponent:component];
selectionValueValue=[_selectionValue valueInComponent:component];
listValue=[_list valueInComponent:component];
NSAssert3(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (%@ of class:%@) doesn't respond to 'count'",
@ -274,35 +350,70 @@ static char rcsId[] = "$Id$";
[listValue class]);
for(i=0;i<[listValue count];i++)
{
[_item setValue:[listValue objectAtIndex:i]
BOOL isEqual=NO;
disabledInContext=[self disabledInContext:context];
itemValue=[listValue objectAtIndex:i];
[_item setValue:itemValue
inComponent:component];
prefixValue=[_prefix valueInComponent:component];
suffixValue=[_suffix valueInComponent:component];
[_index setValue:[NSNumber numberWithShort:i]
inComponent:component];
displayStringValue=[_displayString valueInComponent:component];
[response appendContentString:@"<INPUT NAME=\""];
[response appendContentString:name];
[response appendContentString:@"\" TYPE=radio VALUE=\""];
valueValue=[self valueInContext:context];
NSDebugMLLog(@"gswdync",@"_value (class: %@): %@",[_value class],_value);
// Value property of the INPUT tag
if (_value) // Binded Value
valueValue = [_value valueInComponent:component];
else // Auto Value
valueValue = [NSNumber numberWithInt:i];
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
[response appendContentHTMLAttributeValue:valueValue];
[response appendContentCharacter:'"'];
//TODOV
if(_value)
isEqual=SBIsValueEqual(valueValue,selectionValue);
else
NSDebugMLLog(@"gswdync",@"selectionValue=%@",selectionValue);
NSDebugMLLog(@"gswdync",@"selectionValue class=%@",[selectionValue class]);
NSDebugMLLog(@"gswdync",@"itemValue=%@",itemValue);
NSDebugMLLog(@"gswdync",@"itemValue class=%@",[itemValue class]);
if (selectionValue)
{
isEqual=SBIsValueEqual([listValue objectAtIndex:i],selectionValue);
_autoValue = YES;
isEqual=SBIsValueEqual(itemValue,selectionValue);
NSDebugMLLog(@"gswdync",@"isEqual=%s",(isEqual ? "YES" : "NO"));
}
NSDebugMLLog(@"gswdync",@"selectionValueValue=%@",selectionValueValue);
NSDebugMLLog(@"gswdync",@"selectionValueValue class=%@",[selectionValueValue class]);
NSDebugMLLog(@"gswdync",@"valueValue=%@",valueValue);
NSDebugMLLog(@"gswdync",@"valueValue class=%@",[valueValue class]);
if (isEqual==NO && selectionValueValue)
{
isEqual=SBIsValueEqual(valueValue,selectionValueValue);
NSDebugMLLog(@"gswdync",@"isEqual=%s",(isEqual ? "YES" : "NO"));
}
if (isEqual)
[response appendContentString:@"\" CHECKED"];
[response appendContentString:@" CHECKED"];
if (disabledInContext)
[response _appendContentAsciiString:@" DISABLED"];
[response appendContentCharacter:'>'];
[response appendContentString:prefixValue];
[response appendContentHTMLString:displayStringValue];
[response appendContentString:suffixValue];
};
LOGObjectFnStop();
};
LOGObjectFnStopC("GSWRadioButtonList");
};
@end

View file

@ -42,6 +42,10 @@
GSWAssociation* _identifier;
GSWAssociation* _count;
GSWAssociation* _index;
//GSWeb Additions {
GSWAssociation* _startIndex; /** Don't begin à 0 but at startIndex **/
GSWAssociation* _stopIndex; /** Don't end à count-1 or list count -1 but at stopIndex **/
//}
GSWHTMLStaticGroup* _childrenGroup;
};
@ -75,10 +79,12 @@
inContext:(GSWContext*)aContext;
-(void)stopOneIterationWithIndex:(int)index
stopIndex:(int)stopIndex
count:(int)count
isLastOne:(BOOL)isLastOne
inContext:(GSWContext*)aContext;
-(void)startOneIterationWithIndex:(unsigned int)index
startIndex:(unsigned int)startIndex
list:(NSArray*)aList
inContext:(GSWContext*)aContext;
@end

View file

@ -70,6 +70,18 @@ static char rcsId[] = "$Id$";
{
ExceptionRaise0(@"GSWRepetition",@"'index' parameter must be settable");
};
if (!WOStrictFlag)
{
_startIndex=[[associations objectForKey:startIndex__Key
withDefaultObject:[_startIndex autorelease]] retain];
NSDebugMLLog(@"gswdync",@"startIndex=%@",_startIndex);
_stopIndex=[[associations objectForKey:stopIndex__Key
withDefaultObject:[_stopIndex autorelease]] retain];
NSDebugMLLog(@"gswdync",@"stopIndex=%@",_stopIndex);
};
if (elements)
{
_childrenGroup=[[GSWHTMLStaticGroup alloc]initWithContentElements:elements];
@ -100,6 +112,8 @@ static char rcsId[] = "$Id$";
DESTROY(_identifier);
DESTROY(_count);
DESTROY(_index);
DESTROY(_startIndex);
DESTROY(_stopIndex);
DESTROY(_childrenGroup);
[super dealloc];
}
@ -123,31 +137,22 @@ static char rcsId[] = "$Id$";
//====================================================================
@implementation GSWRepetition (GSWRepetitionA)
//--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context
-(void)getParameterValuesReturnList:(NSArray**)listValuePtr
count:(int*)countValuePtr
startIndex:(int*)startIndexValuePtr
stopIndex:(int*)stopIndexValuePtr
withComponent:(GSWComponent*)component
{
//OK
GSWComponent* component=nil;
NSArray* listValue=nil;
int i=0;
int countValue=0;
#ifndef NDEBBUG
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
#endif
LOGObjectFnStart();
GSWStartElement(context);
GSWSaveAppendToResponseElementID(context);
component=[context component];
NSDebugMLLog(@"gswdync",@"_list=%@",_list);
if (_list)
{
listValue=[_list valueInComponent:component];
NSAssert2(!listValue || [listValue respondsToSelector:@selector(count)],
*listValuePtr=[_list valueInComponent:component];
NSAssert2(!(*listValuePtr) || [(*listValuePtr) respondsToSelector:@selector(count)],
@"The list (%@) (of class:%@) doesn't respond to 'count'",
_list,
[listValue class]);
countValue=[listValue count];
[(*listValuePtr) class]);
*countValuePtr=[(*listValuePtr) count];
};
NSDebugMLLog(@"gswdync",@"_count=%@",_count);
if (_count)
@ -162,19 +167,91 @@ static char rcsId[] = "$Id$";
tmpCount=[tmpCountValue intValue];
NSDebugMLLog(@"gswdync",@"tmpCount=%d",tmpCount);
if (_list)
countValue=min(tmpCount,countValue);
*countValuePtr=min(tmpCount,(*countValuePtr));
else
countValue=tmpCount;
*countValuePtr=tmpCount;
};
if (WOStrictFlag)
*stopIndexValuePtr=(*countValuePtr)-1;
else
{
NSDebugMLLog(@"gswdync",@"_startIndex=%@",_startIndex);
if (_startIndex)
{
id tmpStartIndexValue=[_startIndex valueInComponent:component];
NSAssert3(!tmpStartIndexValue || [tmpStartIndexValue respondsToSelector:@selector(intValue)],
@"The 'startIndex' (%@) value %@ (of class:%@) doesn't respond to 'intValue'",
_count,
tmpStartIndexValue,
[tmpStartIndexValue class]);
*startIndexValuePtr=[tmpStartIndexValue intValue];
*startIndexValuePtr=max(0,(*startIndexValuePtr));
}
else
*startIndexValuePtr=0;
NSDebugMLLog(@"gswdync",@"*startIndexValuePtr=%d",(*startIndexValuePtr));
NSDebugMLLog(@"gswdync",@"_stopIndex=%@",_stopIndex);
if (_stopIndex)
{
id tmpStopIndexValue=[_stopIndex valueInComponent:component];
NSAssert3(!tmpStopIndexValue || [tmpStopIndexValue respondsToSelector:@selector(intValue)],
@"The 'startIndex' (%@) value %@ (of class:%@) doesn't respond to 'intValue'",
_count,
tmpStopIndexValue,
[tmpStopIndexValue class]);
*stopIndexValuePtr=[tmpStopIndexValue intValue];
NSDebugMLLog(@"gswdync",@"*stopIndexValuePtr=%d",(*stopIndexValuePtr));
if ((*countValuePtr)>((*stopIndexValuePtr)+1))
*countValuePtr=(*stopIndexValuePtr)+1;
else
*stopIndexValuePtr=(*countValuePtr)-1;
NSDebugMLLog(@"gswdync",@"*stopIndexValuePtr=%d",(*stopIndexValuePtr));
NSDebugMLLog(@"gswdync",@"*countValuePtr=%d",(*countValuePtr));
}
else
*stopIndexValuePtr=(*countValuePtr)-1;
NSDebugMLLog(@"gswdync",@"*stopIndexValuePtr=%d",(*stopIndexValuePtr));
};
NSDebugMLLog(@"gswdync",@"PARAMETERS: list: %p startIndex: %d stopIndex: %d count: %d",
*listValuePtr,
*startIndexValuePtr,
*stopIndexValuePtr,
*countValuePtr);
LOGObjectFnStop();
};
//--------------------------------------------------------------------
-(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context
{
//OK
GSWComponent* component=nil;
NSArray* listValue=nil;
int i=0;
int countValue=0;
int startIndexValue = 0;
int stopIndexValue = 0;
#ifndef NDEBBUG
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
#endif
LOGObjectFnStart();
GSWStartElement(context);
GSWSaveAppendToResponseElementID(context);
component=[context component];
[self getParameterValuesReturnList:&listValue
count:&countValue
startIndex:&startIndexValue
stopIndex:&stopIndexValue
withComponent:component];
NSDebugMLLog(@"gswdync",@"countValue=%d",countValue);
[context incrementLoopLevel];
for(i=0;i<countValue;i++)
for(i=startIndexValue;i<=stopIndexValue;i++)
{
#ifndef NDEBUG
GSWElementIDString* debugElementID=[context elementID];
#endif
[self startOneIterationWithIndex:i
startIndex:startIndexValue
list:listValue
inContext:context];
[context appendZeroElementIDComponent];
@ -182,6 +259,7 @@ static char rcsId[] = "$Id$";
inContext:context];
[context deleteLastElementIDComponent];
[self stopOneIterationWithIndex:i
stopIndex:stopIndexValue
count:countValue
isLastOne:NO
inContext:context];
@ -197,8 +275,12 @@ static char rcsId[] = "$Id$";
[context decrementLoopLevel];
GSWStopElement(context);
#ifndef NDEBBUG
NSAssert(elementsNb==[(GSWElementIDString*)[context elementID]elementsNb],
@"GSWRepetion appendToResponse: bad elementID");
NSAssert4(elementsNb==[(GSWElementIDString*)[context elementID]elementsNb],
@"GSWRepetion %p appendToResponse: bad elementID %d!=%d (%@)",
self,
elementsNb,
[(GSWElementIDString*)[context elementID]elementsNb],
[context elementID]);
#endif
LOGObjectFnStop();
};
@ -243,6 +325,8 @@ static char rcsId[] = "$Id$";
NSArray* listValue=nil;
int i=0;
int countValue=0;
int startIndexValue = 0;
int stopIndexValue = 0;
#ifndef NDEBBUG
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
#endif
@ -250,36 +334,19 @@ static char rcsId[] = "$Id$";
GSWStartElement(context);
GSWAssertCorrectElementID(context);
component=[context component];
if (_list)
{
listValue=[_list valueInComponent:component];
NSAssert2(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (of class:%@) doesn't respond to 'count'",
_list,
[listValue class]);
countValue=[listValue count];
};
if (_count)
{
id tmpCountValue=[_count valueInComponent:component];
int tmpCount=0;
NSAssert2(!tmpCountValue || [tmpCountValue respondsToSelector:@selector(intValue)],
@"The 'count' (%@) (of class:%@) doesn't respond to 'intValue'",
_count,
[tmpCountValue class]);
tmpCount=[tmpCountValue intValue];
if (_list)
countValue=min(tmpCount,countValue);
else
countValue=tmpCount;
};
[self getParameterValuesReturnList:&listValue
count:&countValue
startIndex:&startIndexValue
stopIndex:&stopIndexValue
withComponent:component];
[context incrementLoopLevel];
for(i=0;i<countValue;i++)
for(i=startIndexValue;i<=stopIndexValue;i++)
{
#ifndef NDEBUG
GSWElementIDString* debugElementID=[context elementID];
#endif
[self startOneIterationWithIndex:i
startIndex:startIndexValue
list:listValue
inContext:context];
[context appendZeroElementIDComponent];
@ -287,6 +354,7 @@ static char rcsId[] = "$Id$";
inContext:context];
[context deleteLastElementIDComponent];
[self stopOneIterationWithIndex:i
stopIndex:stopIndexValue
count:countValue
isLastOne:NO
inContext:context];
@ -318,42 +386,27 @@ static char rcsId[] = "$Id$";
NSArray* listValue=nil;
int i=0;
int countValue=0;
int startIndexValue = 0;
int stopIndexValue = 0;
#ifndef NDEBBUG
int elementsNb=[(GSWElementIDString*)[context elementID]elementsNb];
#endif
LOGObjectFnStart();
GSWStartElement(context);
component=[context component];
if (_list)
{
listValue=[_list valueInComponent:component];
NSAssert2(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (of class:%@) doesn't respond to 'count'",
_list,
[listValue class]);
countValue=[listValue count];
};
if (_count)
{
id tmpCountValue=[_count valueInComponent:component];
int tmpCount=0;
NSAssert2(!tmpCountValue || [tmpCountValue respondsToSelector:@selector(intValue)],
@"The 'count' (%@) (of class:%@) doesn't respond to 'intValue'",
_count,
[tmpCountValue class]);
tmpCount=[tmpCountValue intValue];
if (_list)
countValue=min(tmpCount,countValue);
else
countValue=tmpCount;
};
[self getParameterValuesReturnList:&listValue
count:&countValue
startIndex:&startIndexValue
stopIndex:&stopIndexValue
withComponent:component];
[context incrementLoopLevel];
for(i=0;!element && i<countValue;i++)
for(i=startIndexValue;!element && i<=stopIndexValue;i++)
{
#ifndef NDEBUG
GSWElementIDString* debugElementID=[context elementID];
#endif
[self startOneIterationWithIndex:i
startIndex:startIndexValue
list:listValue
inContext:context];
[context appendZeroElementIDComponent];
@ -361,6 +414,7 @@ static char rcsId[] = "$Id$";
inContext:context];
[context deleteLastElementIDComponent];
[self stopOneIterationWithIndex:i
stopIndex:stopIndexValue
count:countValue
isLastOne:(element!=nil)
inContext:context];
@ -403,35 +457,20 @@ static char rcsId[] = "$Id$";
#endif
int countValue=0;
NSArray* listValue=nil;
int startIndexValue = 0;
int stopIndexValue = 0;
int i=0;
GSWComponent* component=[context component];
if (_list)
{
listValue=[_list valueInComponent:component];
NSAssert2(!listValue || [listValue respondsToSelector:@selector(count)],
@"The list (%@) (of class:%@) doesn't respond to 'count'",
_list,
[listValue class]);
countValue=[listValue count];
};
if (_count)
{
id tmpCountValue=[_count valueInComponent:component];
int tmpCount=0;
NSAssert2(!tmpCountValue || [tmpCountValue respondsToSelector:@selector(intValue)],
@"The 'count' (%@) (of class:%@) doesn't respond to 'intValue'",
_count,
[tmpCountValue class]);
tmpCount=[tmpCountValue intValue];
if (_list)
countValue=min(tmpCount,countValue);
else
countValue=tmpCount;
};
[self getParameterValuesReturnList:&listValue
count:&countValue
startIndex:&startIndexValue
stopIndex:&stopIndexValue
withComponent:component];
[context incrementLoopLevel];
for(i=0;!element && i<countValue;i++)
for(i=startIndexValue;!element && i<=stopIndexValue;i++)
{
[self startOneIterationWithIndex:i
startIndex:startIndexValue
list:listValue
inContext:context];
[context appendZeroElementIDComponent];
@ -440,6 +479,7 @@ static char rcsId[] = "$Id$";
NSDebugMLLog(@"gswdync",@"element=%@",element);
[context deleteLastElementIDComponent];
[self stopOneIterationWithIndex:i
stopIndex:stopIndexValue
count:countValue
isLastOne:(element!=nil)
inContext:context];
@ -462,13 +502,17 @@ static char rcsId[] = "$Id$";
//--------------------------------------------------------------------
-(void)stopOneIterationWithIndex:(int)currentIndex
stopIndex:(int)stopIndex
count:(int)count
isLastOne:(BOOL)isLastOne
inContext:(GSWContext*)context
{
//OK
LOGObjectFnStart();
if (currentIndex==(count-1) || isLastOne)
NSDebugMLLog(@"gswdync",@"self=%p currentIndex=%d stopIndex=%d count=%d isLastOne=%s [context elementID]=%@",
self,currentIndex,stopIndex,count,(isLastOne ? "YES" : "NO"),
[context elementID]);
if (currentIndex==(count-1) || currentIndex==stopIndex ||isLastOne)
{
NS_DURING
{
@ -493,6 +537,7 @@ static char rcsId[] = "$Id$";
//--------------------------------------------------------------------
-(void)startOneIterationWithIndex:(unsigned int)currentIndex
startIndex:(unsigned int)startIndex
list:(NSArray*)list
inContext:(GSWContext*)context
{
@ -502,10 +547,12 @@ static char rcsId[] = "$Id$";
NS_DURING
{
component=[context component];
NSDebugMLLog(@"gswdync",@"currentIndex=%d startIndex=%d",currentIndex,startIndex);
NSDebugMLLog(@"gswdync",@"_index=%@",_index);
NSDebugMLLog(@"gswdync",@"_item=%@",_item);
if (_list && _item) {
if ([list count]>currentIndex) {
NSDebugMLLog(@"gswdync",@"[list objectAtIndex:currentIndex]=%@",[list objectAtIndex:currentIndex]);
NSDebugMLLog(@"gswdync",@"[list objectAtIndex:%d]=%@",currentIndex,[list objectAtIndex:currentIndex]);
[_item setValue:[list objectAtIndex:currentIndex]
inComponent:component];
} else {
@ -513,12 +560,10 @@ static char rcsId[] = "$Id$";
}
}
NSDebugMLLog(@"gswdync",@"currentIndex=%d",currentIndex);
NSDebugMLLog(@"gswdync",@"_index=%@",_index);
if (_index)
[_index setValue:[NSNumber numberWithShort:currentIndex]
inComponent:component];
if (currentIndex==0)
if (currentIndex==startIndex)
[context appendZeroElementIDComponent];
else
[context incrementLastElementIDComponent];
@ -533,3 +578,4 @@ static char rcsId[] = "$Id$";
};
@end

View file

@ -115,6 +115,11 @@ static char rcsId[] = "$Id$";
GSWSaveAppendToResponseElementID(aContext);
elementNameInContext=[self _elementNameInContext:aContext];
[aContext appendElementIDComponent:elementNameInContext];
if ([elementNameInContext length]==0)
{
ExceptionRaise(@"GSWSwitchComponent",@"ComponentName Value is null ! componentName: %@",
_componentName);
};
element=[self _realComponentWithName:elementNameInContext
inContext:aContext];
[element appendToResponse:response
@ -135,8 +140,13 @@ static char rcsId[] = "$Id$";
GSWAssertCorrectElementID(aContext);
elementNameInContext=[self _elementNameInContext:aContext];
[aContext appendElementIDComponent:elementNameInContext];
if ([elementNameInContext length]==0)
{
ExceptionRaise(@"GSWSwitchComponent",@"ComponentName Value is null ! componentName: %@",
_componentName);
};
element=[self _realComponentWithName:elementNameInContext
inContext:aContext];
inContext:aContext];
resultElement=[element invokeActionForRequest:request
inContext:aContext];
[aContext deleteLastElementIDComponent];
@ -155,6 +165,11 @@ static char rcsId[] = "$Id$";
GSWAssertCorrectElementID(aContext);
elementNameInContext=[self _elementNameInContext:aContext];
[aContext appendElementIDComponent:elementNameInContext];
if ([elementNameInContext length]==0)
{
ExceptionRaise(@"GSWSwitchComponent",@"ComponentName Value is null ! componentName: %@",
_componentName);
};
element=[self _realComponentWithName:elementNameInContext
inContext:aContext];
[element takeValuesFromRequest:aRequest
@ -177,9 +192,10 @@ if the component has already been created, it get it from the cache; otherwise,
component=[aContext component];
NSDebugMLLog(@"gswdync",@"GSWSwitchComponent %p (defName=%@): componentName=%@ parent=%@",
self,[self definitionName],_componentName,[component parent]);
if (!aName)
if ([aName length]==0)
{
ExceptionRaise0(@"GSWSwitchComponent",@"ComponentName is null !");
ExceptionRaise(@"GSWSwitchComponent",@"ComponentName is null ! componentName key: %@",
_componentName);
}
else
{

View file

@ -54,9 +54,11 @@ typedef enum _GSWTemplateParserType
NSString* _stringPath;
NSString* _definitionsString;
NSArray* _languages;
NSMutableSet* _definitionFilePath;
NSString* _definitionFilePath;
NSMutableSet* _processedDefinitionFilePaths;
GSWElement* _template;
NSDictionary* _definitions;
NSMutableArray* _errorMessages; /** Template/definition errors. If non empty, raise an exception **/
int gswebTagN;
int tagN;
}
@ -93,6 +95,12 @@ typedef enum _GSWTemplateParserType
forLanguages:(NSArray*)someLanguages;
-(void)dealloc;
-(NSString*)logPrefix;
-(void)addErrorMessage:(NSString*)errorMessage;
-(void)addErrorMessageFormat:(NSString*)format
arguments:(va_list)arguments;
-(void)addErrorMessageFormat:(NSString*)format,...;
-(NSMutableArray*)errorMessages;
-(NSString*)errorMessagesAsText;
-(GSWElement*)template;
-(NSArray*)templateElements;
-(NSDictionary*)definitions;

View file

@ -207,8 +207,10 @@ static char rcsId[] = "$Id$";
DESTROY(_definitionsString);
DESTROY(_languages);
DESTROY(_definitionFilePath);
DESTROY(_processedDefinitionFilePaths);
DESTROY(_template);
DESTROY(_definitions);
DESTROY(_errorMessages);
[super dealloc];
};
@ -221,6 +223,47 @@ static char rcsId[] = "$Id$";
_stringPath];
};
//--------------------------------------------------------------------
-(void)addErrorMessage:(NSString*)errorMessage
{
if (!_errorMessages)
_errorMessages=(NSMutableArray*)[NSMutableArray new];
[_errorMessages addObject:[NSString stringWithFormat:@"%@%@",
[self logPrefix],
errorMessage]];
};
//--------------------------------------------------------------------
-(void)addErrorMessageFormat:(NSString*)format
arguments:(va_list)arguments
{
NSString* string=[NSString stringWithFormat:format
arguments:arguments];
[self addErrorMessage:string];
}
//--------------------------------------------------------------------
-(void)addErrorMessageFormat:(NSString*)format,...
{
va_list ap=NULL;
va_start(ap,format);
[self addErrorMessageFormat:format
arguments:ap];
va_end(ap);
};
//--------------------------------------------------------------------
-(NSMutableArray*)errorMessages
{
return _errorMessages;
};
//--------------------------------------------------------------------
-(NSString*)errorMessagesAsText
{
return [[self errorMessages]componentsJoinedByString:@"\n"];
};
//--------------------------------------------------------------------
-(GSWElement*)template
{
@ -320,11 +363,12 @@ static char rcsId[] = "$Id$";
}
else
{
NSMutableSet* processedFiles=[NSMutableSet setWithObject:_definitionFilePath];
DESTROY(_processedDefinitionFilePaths);
ASSIGN(_processedDefinitionFilePaths,[NSMutableSet setWithObject:_definitionFilePath]);
NSDictionary* tmpDefinitions=[self parseDefinitionsString:_definitionsString
named:_templateName
inFrameworkNamed:_frameworkName
processedFiles:processedFiles];
processedFiles:_processedDefinitionFilePaths];
if (tmpDefinitions)
ASSIGN(_definitions,[NSDictionary dictionaryWithDictionary:tmpDefinitions]);
};

View file

@ -825,7 +825,16 @@ static NSString* TabsForLevel(int level)
{
gswebTagN=0;
tagN=0;
elements=[self createElementsFromNode:node];
elements=[self createElementsFromNode:node];
// If we've found error raise exception
NSDebugMLog(@"_errorMessages=%@",_errorMessages);
if ([[self errorMessages]count]>0)
{
NSDebugMLog(@"definitionFilePath=%@",_definitionFilePath);
ExceptionRaise(@"GSWTemplateParser",@"%@\nDefinitionFiles: %@",
[self errorMessagesAsText],
_processedDefinitionFilePaths);
};
}
NS_HANDLER
{
@ -958,16 +967,12 @@ text [Type:XML_TEXT_NODE] [{}] ####
{
// allow null name tags
elem=[[[GSWHTMLStaticGroup alloc]initWithContentElements:children]autorelease];
/* ExceptionRaise(@"GSWTemplateParser",
@"%@ No element name for gsweb tag (%@) [#%d,#%d]",
[self logPrefix],
nodeName,
currentGSWebTagN,
currentTagN);
*/
}
else
{
NSDictionary* _associations=nil;
NSString* className=nil;
GSWHTMLStaticGroup* aStaticGroup=nil;
definitionsElement=[_definitions objectForKey:nodeNameAttribute];
NSDebugMLLog(@"GSWTemplateParser",@"definitionsElement:[%@]",
definitionsElement);
@ -975,79 +980,76 @@ text [Type:XML_TEXT_NODE] [{}] ####
definitionsElement);
if (!definitionsElement)
{
ExceptionRaise(@"GSWTemplateParser",
@"%@ No element definition for tag named:%@ [#%d,#%d]",
[self logPrefix],
nodeNameAttribute,
currentGSWebTagN,
currentTagN);
// We don't raise exception know because it's better for developper to collect and report all errors before :-)
[self addErrorMessageFormat:@"No element definition for tag named:%@ [#%d,#%d]",
nodeNameAttribute,
currentGSWebTagN,
currentTagN];
}
else
{
NSDictionary* _associations=[definitionsElement associations];
NSString* className=[definitionsElement className];
_associations=[definitionsElement associations];
className=[definitionsElement className];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p GSWeb Tag className:[%@]",currentNode,className);
if (!className)
{
ExceptionRaise(@"GSWTemplateParser",
@"%@No class name in page definition for tag named:%@ definitionsElement=%@ [#%d,#%d]",
[self logPrefix],
nodeNameAttribute,
definitionsElement,
currentGSWebTagN,
currentTagN);
}
else
{
GSWHTMLStaticGroup* aStaticGroup=nil;
NSDebugMLLog(@"GSWTemplateParser",@"node=%p associations:%@",currentNode,_associations);
// We don't raise exception know because it's better for developper to collect and report all errors before :-)
[self addErrorMessageFormat:@"No class name in page definition for tag named:%@ definitionsElement=%@ [#%d,#%d]",
nodeNameAttribute,
definitionsElement,
currentGSWebTagN,
currentTagN];
};
};
// No class name mean we'll raise an exception after so don't care about this part...
if (className) //
{
NSDebugMLLog(@"GSWTemplateParser",@"node=%p associations:%@",currentNode,_associations);
{
NSEnumerator* _nodeAttributesEnum = [nodeAttributes keyEnumerator];
id _tagAttrKey=nil;
id _tagAttrValue=nil;
NSMutableDictionary* _addedAssoc=nil;
while ((_tagAttrKey = [_nodeAttributesEnum nextObject]))
{
NSEnumerator* _nodeAttributesEnum = [nodeAttributes keyEnumerator];
id _tagAttrKey=nil;
id _tagAttrValue=nil;
NSMutableDictionary* _addedAssoc=nil;
while ((_tagAttrKey = [_nodeAttributesEnum nextObject]))
if (![_tagAttrKey isEqualToString:@"name"] && ![_associations objectForKey:_tagAttrKey])
{
if (![_tagAttrKey isEqualToString:@"name"] && ![_associations objectForKey:_tagAttrKey])
{
if (!_addedAssoc)
_addedAssoc=(NSMutableDictionary*)[NSMutableDictionary dictionary];
_tagAttrValue=[nodeAttributes objectForKey:_tagAttrKey];
if (!_addedAssoc)
_addedAssoc=(NSMutableDictionary*)[NSMutableDictionary dictionary];
_tagAttrValue=[nodeAttributes objectForKey:_tagAttrKey];
[_addedAssoc setObject:[GSWAssociation associationWithValue:_tagAttrValue]
forKey:_tagAttrKey];
};
};
if (_addedAssoc)
{
_associations=[_associations dictionaryByAddingEntriesFromDictionary:_addedAssoc];
};
};
NSDebugMLLog(@"GSWTemplateParser",@"node=%p gsweb name=%@ dynamicElementWithName: children=%@",
currentNode,
nodeNameAttribute,
children);
NSDebugMLLog(@"GSWTemplateParser",@"node=%p %@ [Type:%@] [%@] ##%s##\n",
currentNode,
[currentNode name],
[currentNode typeDescription],
[currentNode propertiesAsDictionaryWithKeyTransformationSel:NULL],
[[currentNode content] lossyCString]);
aStaticGroup=[[[GSWHTMLStaticGroup alloc]initWithContentElements:children]autorelease];
elem=[GSWApp dynamicElementWithName:className
associations:_associations
template:aStaticGroup
languages:_languages];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p element=%@ StaticGroup %p=%@",currentNode,elem,aStaticGroup,aStaticGroup);
if (elem)
[elem setDefinitionName:[definitionsElement elementName]];
else
{
ExceptionRaise(@"GSWTemplateParser",
@"%@ Creation failed for element named:%@ className:%@",
[self logPrefix],
[definitionsElement elementName],
className);
};
if (_addedAssoc)
{
_associations=[_associations dictionaryByAddingEntriesFromDictionary:_addedAssoc];
};
};
NSDebugMLLog(@"GSWTemplateParser",@"node=%p gsweb name=%@ dynamicElementWithName: children=%@",
currentNode,
nodeNameAttribute,
children);
NSDebugMLLog(@"GSWTemplateParser",@"node=%p %@ [Type:%@] [%@] ##%s##\n",
currentNode,
[currentNode name],
[currentNode typeDescription],
[currentNode propertiesAsDictionaryWithKeyTransformationSel:NULL],
[[currentNode content] lossyCString]);
aStaticGroup=[[[GSWHTMLStaticGroup alloc]initWithContentElements:children]autorelease];
elem=[GSWApp dynamicElementWithName:className
associations:_associations
template:aStaticGroup
languages:_languages];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p element=%@ StaticGroup %p=%@",currentNode,elem,aStaticGroup,aStaticGroup);
if (elem)
[elem setDefinitionName:[definitionsElement elementName]];
else
{
// We don't raise exception know because it's better for developper to collect and report all errors before :-)
[self addErrorMessageFormat:@"Creation failed for element named:%@ className:%@",
[definitionsElement elementName],
className];
};
};
};

View file

@ -182,21 +182,23 @@ static char rcsId[] = "$Id$";
inContext:(GSWContext*)context
{
//OK
LOGObjectFnStartC("GSWTextField");
//Does nothing special
[super appendGSWebObjectsAssociationsToResponse:response
inContext:context];
LOGObjectFnStopC("GSWTextField");
};
//--------------------------------------------------------------------
-(void)appendValueToResponse:(GSWResponse*)response
inContext:(GSWContext*)context
{
id valueValue=nil;
id formattedValue=nil;
NSFormatter* formatter=nil;
GSWComponent* component=nil;
id valueTmp=nil;
LOGObjectFnStartC("GSWTextField");
component=[context component];
//To avoid input value printing (stupid original hack !)
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)

View file

@ -0,0 +1,40 @@
/** BasePage.h - <title>GSWeb Testing: Class BasePage</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
// $Id$
#ifndef _BasePage_h__
#define _BasePage_h__
@interface BasePage: GSWComponent
{
}
@end
#endif //_BasePage_h__

View file

@ -0,0 +1,43 @@
/** BasePage.m - <title>GSWeb Testing: Class BasePage</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
#include "BasePage.h"
@implementation BasePage
-(GSWComponent*)submitAction
{
return nil;
};
@end

View file

@ -0,0 +1,25 @@
#include "Base"
ABrowser: GSWBrowser
{
list = application.bundleInfo.Browser.list;
item = anItem;
value = anItem.value;
displayString = anItem.label;
selections = selectedItems;
selectionValues = selectedValues;
selectedValues = selectedValues;
multiple = YES;
name = "BROWSERNAME";
};
SelectedItems: GSWString
{
value = selectedItems;
};
SelectedValues: GSWString
{
value = selectedValues;
};

View file

@ -0,0 +1,18 @@
<html>
<head>
<title>GSWBrowser Test 1</title>
</head>
<body>
<h2>GSWBrowser Test 1 (With value)</h2>
<br/>
Selected items : <gsweb name="SelectedItems"></gsweb><br/>
Selected item values : <gsweb name="SelectedValues"></gsweb><br/>
<br/>
<gsweb name="Form">
<gsweb name="ABrowser"></gsweb>
<gsweb name="SubmitButton"></gsweb>
</gsweb>
<hr/>
<gsweb name="MainPageLink"></gsweb>
</body>
</html>

View file

@ -0,0 +1,43 @@
/** Browser1Page.h - <title>GSWeb Testing: Class Browser1Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
// $Id$
#ifndef _Browser1Page_h__
#define _Browser1Page_h__
@interface Browser1Page: BasePage
{
id anItem;
id selectedItems;
id selectedValues;
}
@end
#endif //_Browser1Page_h__

View file

@ -0,0 +1,40 @@
/** Browser1Page.m - <title>GSWeb Testing: Class Browser1Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
#include "BasePage.h"
#include "Browser1Page.h"
@implementation Browser1Page
@end

View file

@ -0,0 +1,24 @@
#include "Base"
ABrowser: GSWBrowser
{
list = application.bundleInfo.Browser.list;
item = anItem;
displayString = anItem.label;
selections = selectedItems;
selectionValues = selectedValues;
selectedValues = selectedValues;
multiple = YES;
name = "BROWSERNAME";
};
SelectedItems: GSWString
{
value = selectedItems;
};
SelectedValues: GSWString
{
value = selectedValues;
};

View file

@ -0,0 +1,18 @@
<html>
<head>
<title>GSWBrowser Test 2</title>
</head>
<body>
<h2>GSWBrowser Test 2 (Without value: AutoValue)</h2>
<br/>
Selected items : <gsweb name="SelectedItems"></gsweb><br/>
Selected item values : <gsweb name="SelectedValues"></gsweb><br/>
<br/>
<gsweb name="Form">
<gsweb name="ABrowser"></gsweb>
<gsweb name="SubmitButton"></gsweb>
</gsweb>
<hr/>
<gsweb name="MainPageLink"></gsweb>
</body>
</html>

View file

@ -0,0 +1,43 @@
/** Browser2Page.h - <title>GSWeb Testing: Class Browser2Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
// $Id$
#ifndef _Browser2Page_h__
#define _Browser2Page_h__
@interface Browser2Page: BasePage
{
id anItem;
id selectedItems;
id selectedValues;
}
@end
#endif //_Browser2Page_h__

View file

@ -0,0 +1,40 @@
/** Browser2Page.m - <title>GSWeb Testing: Class Browser2Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
#include "BasePage.h"
#include "Browser2Page.h"
@implementation Browser2Page
@end

View file

@ -0,0 +1,22 @@
#include "Base"
ACheckBoxList: GSWCheckBoxList
{
list = application.bundleInfo.CheckBoxList.list;
item = anItem;
value = anItem.value;
displayString = anItem.label;
selections = selectedItems;
name = "CHECKNAME";
};
SelectedItems: GSWString
{
value = selectedItems;
};
SelectedValues: GSWString
{
value = selectedValues;
};

View file

@ -0,0 +1,17 @@
<html>
<head>
<title>GSWCheckBoxList Test 1</title>
</head>
<body>
<h2>GSWCheckBoxList Test 1 (With value)</h2>
<br/>
Selected items : <gsweb name="SelectedItems"></gsweb><br/>
<br/>
<gsweb name="Form">
<gsweb name="ACheckBoxList"></gsweb>
<gsweb name="SubmitButton"></gsweb>
</gsweb>
<hr/>
<gsweb name="MainPageLink"></gsweb>
</body>
</html>

View file

@ -0,0 +1,16 @@
#include "Base"
ARadioButtonList: GSWRadioButtonList
{
list = application.bundleInfo.RadioButtonList.list;
item = anItem;
value = anItem.value;
displayString = anItem.label;
selection = selectedItem;
};
SelectedItem: GSWString
{
value = selectedItem;
};

View file

@ -0,0 +1,17 @@
<html>
<head>
<title>GSWRadioButtonList Test 1</title>
</head>
<body>
<h2>GSWRadioButtonList Test 1 (With value)</h2>
<br/>
Selected item : <gsweb name="SelectedItem"></gsweb><br/>
<br/>
<gsweb name="Form">
<gsweb name="ARadioButtonList"></gsweb>
<gsweb name="SubmitButton"></gsweb>
</gsweb>
<hr/>
<gsweb name="MainPageLink"></gsweb>
</body>
</html>

View file

@ -0,0 +1,42 @@
/** CheckBoxList1Page.h - <title>GSWeb Testing: Class CheckBoxList1Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
// $Id$
#ifndef _CheckBoxList1Page_h__
#define _CheckBoxList1Page_h__
@interface CheckBoxList1Page: BasePage
{
id anItem;
id selectedItems;
}
@end
#endif //_RadioButtonList1Page_h__

View file

@ -0,0 +1,40 @@
/** CheckBoxList1Page.m - <title>GSWeb Testing: Class CheckBoxList1Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
#include "BasePage.h"
#include "CheckBoxList1Page.h"
@implementation CheckBoxList1Page
@end

View file

@ -0,0 +1,16 @@
#include "Base"
ACheckBoxList: GSWCheckBoxList
{
list = application.bundleInfo.CheckBoxList.list;
item = anItem;
displayString = anItem.label;
selections = selectedItems;
name = "CHECKNAME";
};
SelectedItems: GSWString
{
value = selectedItems;
};

View file

@ -0,0 +1,17 @@
<html>
<head>
<title>GSWCheckBoxList Test 2</title>
</head>
<body>
<h2>GSWCheckBoxList Test 2 (Without value: AutoValue)</h2>
<br/>
Selected items : <gsweb name="SelectedItems"></gsweb><br/>
<br/>
<gsweb name="Form">
<gsweb name="ACheckBoxList"></gsweb>
<gsweb name="SubmitButton"></gsweb>
</gsweb>
<hr/>
<gsweb name="MainPageLink"></gsweb>
</body>
</html>

View file

@ -0,0 +1,15 @@
#include "Base"
ARadioButtonList: GSWRadioButtonList
{
list = application.bundleInfo.RadioButtonList.list;
item = anItem;
displayString = anItem.label;
selection = selectedItem;
};
SelectedItem: GSWString
{
value = selectedItem;
};

View file

@ -0,0 +1,17 @@
<html>
<head>
<title>GSWRadioButtonList Test 1</title>
</head>
<body>
<h2>GSWRadioButtonList Test 2 (Without value: AutoValue)</h2>
<br/>
Selected item : <gsweb name="SelectedItem"></gsweb><br/>
<br/>
<gsweb name="Form">
<gsweb name="ARadioButtonList"></gsweb>
<gsweb name="SubmitButton"></gsweb>
</gsweb>
<hr/>
<gsweb name="MainPageLink"></gsweb>
</body>
</html>

View file

@ -0,0 +1,42 @@
/** CheckBoxList2Page.h - <title>GSWeb Testing: Class CheckBoxList2Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
// $Id$
#ifndef _CheckBoxList2Page_h__
#define _CheckBoxList2Page_h__
@interface CheckBoxList2Page: BasePage
{
id anItem;
id selectedItems;
}
@end
#endif //_CheckBoxList2Page_h__

View file

@ -0,0 +1,40 @@
/** CheckBoxList2Page.m - <title>GSWeb Testing: Class CheckBoxList2Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
#include "BasePage.h"
#include "CheckBoxList2Page.h"
@implementation CheckBoxList2Page
@end

View file

@ -0,0 +1,3 @@
//====================================================================
@interface DynamicElements : GSWApplication
@end

View file

@ -0,0 +1,12 @@
#import <GSWeb/GSWeb.h>
#include "DynamicElements.h"
@implementation DynamicElements
@end
@interface Session: GSWSession
@end
@implementation Session
@end

View file

@ -0,0 +1,10 @@
#import <GSWeb/GSWeb.h>
int main(int argc, const char *argv[])
{
int ret=0;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
ret=GSWApplicationMain(@"DynamicElements", argc, argv);
[arp release];
return ret;
}

View file

@ -0,0 +1,83 @@
#
# Dynamic Elements Testing makefile for the GNUstepWeb
#
# Copyright (C) 2002 Free Software Foundation, Inc.
#
# Written by: Manuel Guesdon <mguedon@orange-concept.com>
#
# This file is part of GNUstepWeb
#
# 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
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# 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.
#
# Install into the system root by default
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
GNUSTEP_MAKEFILES = $(GNUSTEP_SYSTEM_ROOT)/Makefiles
include $(GNUSTEP_MAKEFILES)/common.make
include config.mak
GSWAPP_NAME=DynamicElements
DynamicElements_HAS_GSWCOMPONENTS=YES
DynamicElements_PRINCIPAL_CLASS=DynamicElements
DynamicElements_GSWAPP_INFO_PLIST=Resources/Info-DynamicElements.plist
# The bundle resource files and directories
DynamicElements_RESOURCE_FILES = \
Resources/Info-DynamicElements.plist \
Resources/Base.gswd \
# The Objective-C source files to be compiled
DynamicElements_OBJC_FILES = \
BasePage.m \
DynamicElements.m \
DynamicElements_main.m \
Main.m \
RadioButtonList1Page.m \
RadioButtonList2Page.m \
CheckBoxList1Page.m \
CheckBoxList2Page.m \
Browser1Page.m \
Browser2Page.m \
PopUpButton1Page.m \
PopUpButton2Page.m \
TextField1Page.m \
DynamicElements_COMPONENTS = \
Main.gswc \
RadioButtonList1Page.gswc \
RadioButtonList2Page.gswc \
CheckBoxList1Page.gswc \
CheckBoxList2Page.gswc \
Browser1Page.gswc \
Browser2Page.gswc \
PopUpButton1Page.gswc \
PopUpButton2Page.gswc \
TextField1Page.gswc \
SRCS = $(GSWAPP_NAME:=.m)
HDRS =
DIST_FILES = $(SRCS) $(HDRS) GNUmakefile Makefile.postamble Makefile.preamble
-include Makefile.preamble
include $(GNUSTEP_MAKEFILES)/gswapp.make
-include Makefile.postamble

View file

@ -0,0 +1,23 @@
To install this little application:
o install GNUstep, GNUstepWeb (including apache module),..
o do a make install in this directory
o add entry for this application in your apache module configuration file:
DynamicElements = {
adaptorTemplatesPath = "/home/httpd/GSWAdaptorTemplates";
GSWExtensionsFrameworkWebServerResources="/GSW/GSWExtensions/WebServerResources";
canDump = YES;
instances = {
1 = {
host=localhost;
port=9004;
parameters= {
transport=socket;
};
};
};
};
o cd /usr/GNUstep/System/GSWApps/DynamicElements.gswa
o run ./ix86/linux-gnu/gnu-gnu-gnu/DynamicElements
o open your browser a goto: http://YourHostName/GSWeb/DynamicElements

View file

@ -0,0 +1,27 @@
/*
* Main.gswd
*
* You may freely copy, distribute and reuse the code in this example.
* We disclaims any warranty of any kind, expressed or implied, as to
* its fitness for any particular use.
*
* This is the declarations file for the main page of the
* DynamicElements Testing application.
*/
Repetition: GSWRepetition
{
item = tmpDynamicElement;
list = application.bundleInfo.dynamicElements;
};
Link: GSWHyperlink
{
pageName = tmpDynamicElement.pageName;
string = tmpDynamicElement.label;
};
Comment: GSWString
{
value = tmpDynamicElement.comment;
};

View file

@ -0,0 +1,13 @@
<html>
<head>
<title>GNUstepWeb Dynamic Elements Testing</title>
</head>
<body>
<h2>GNUstepWeb Dynamic Elements Testing</h2>
<ul>
<gsweb name="Repetition">
<li><gsweb name="Link"></gsweb> <gsweb name="Comment"></gsweb></li>
</gsweb>
</ul>
</body>
</html>

View file

@ -0,0 +1,20 @@
/*
* Main.h
*
* You may freely copy, distribute and reuse the code in this example.
* We disclaims any warranty of any kind, expressed or implied, as to
* its fitness for any particular use.
*
* This file declares the interface to the object that controls the DynamicElements
* page.
*/
#import <GSWeb/GSWeb.h>
@interface Main: GSWComponent
{
id tmpDynamicElement;
}
@end

View file

@ -0,0 +1,16 @@
/*
* Main.m
*
* You may freely copy, distribute and reuse the code in this example.
* We disclaims any warranty of any kind, expressed or implied, as to
* its fitness for any particular use.
*
* This is the implementation file for the object that controls the DynamicElements
* page.
*/
#import "Main.h"
@implementation Main
@end

View file

@ -0,0 +1,71 @@
# Makefile.postamble
# Copyright (C) 2002 Free Software Foundation, Inc.
#
# Written by: Manuel Guesdon <mguesdon@orange-concept.com>
# Date: Nov 2002
#
# 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
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# 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.
#
# Makefile.postamble
#
# Project specific makefile rules
#
# Uncomment the targets you want.
# The double colons (::) are important, do not make them single colons
# otherwise the normal makefile rules will not be performed.
#
# Things to do before compiling
# before-all::
# Things to do after compiling
# after-all::
# Things to do before installing
# before-install::
# Things to do after installing
# after-install::
# Things to do before uninstalling
# before-uninstall::
# Things to do after uninstalling
# after-uninstall::
# Things to do before cleaning
# before-clean::
# Things to do after cleaning
# after-clean::
# Things to do before distcleaning
# before-distclean::
# Things to do after distcleaning
# after-distclean::
# Things to do before checking
# before-check::
# Things to do after checking
# after-check::
regenerate:
copy-dist: $(DIST_FILES)

View file

@ -0,0 +1,77 @@
# Copyright (C) 2002 Free Software Foundation, Inc.
#
# Written by: Manuel Guesdon <mguesdon@orange-concept.Com>
# Date: Nov 2002
#
# 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
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# 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.
#
# Makefile.preamble
#
# Project specific makefile variables, and additional
#
# Do not put any Makefile rules in this file, instead they should
# be put into Makefile.postamble.
#
#
# Flags dealing with compiling and linking
#
# Additional flags to pass to the preprocessor
ADDITIONAL_CPPFLAGS =
# Additional flags to pass to the Objective-C compiler
ADDITIONAL_OBJCFLAGS =
# Additional flags to pass to the C compiler
ADDITIONAL_CFLAGS =
# Additional flags to pass to the Objective-C compiler
#new
ifeq ($(GDL2), yes)
ADDITIONAL_OBJCFLAGS = -DUSE_BUILTIN -DGDL2
else
ADDITIONAL_OBJCFLAGS = -DUSE_BUILTIN
endif
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS = -I$(GNUSTEP_SYSTEM_ROOT)/db -I../..
# Additional LDFLAGS to pass to the linker
ifeq ($(debug), yes)
ADDITIONAL_LDFLAGS = -lFoundationExt_d -lGSWeb -lGSANTLR_d -lgnustep-db2_d -lgnustep-db2control_d
else
ADDITIONAL_LDFLAGS = -lFoundationExt -lGSWeb -lGSANTLR -lgnustep-db2 -lgnustep-db2control
endif
ifeq ($(LIBWRAP), yes)
ADDITIONAL_OBJCFLAGS := $(ADDITIONAL_OBJCFLAGS) -DHAVE_LIBWRAP
ADDITIONAL_LDFLAGS := $(ADDITIONAL_LDFLAGS) -lwrap
endif
#-lgnustep-xraw
# Additional library directories the linker should search
ADDITIONAL_LIB_DIRS =
#
# Flags dealing with installing and uninstalling
#
# Additional directories to be created during installation
ADDITIONAL_INSTALL_DIRS =

View file

@ -0,0 +1,25 @@
#include "Base"
APopUpButton: GSWPopUpButton
{
list = application.bundleInfo.PopUpButton.list;
item = anItem;
value = anItem.value;
displayString = anItem.label;
selection = selectedItem;
selectedValue = selectedValue;
selectionValue = selectedValue;
noSelectionString = "Nothing Selected";
name = "POPNAME";
};
SelectedItem: GSWString
{
value = selectedItem;
};
SelectedValue: GSWString
{
value = selectedValue;
};

View file

@ -0,0 +1,18 @@
<html>
<head>
<title>GSWPopUpButton Test 1</title>
</head>
<body>
<h2>GSWPopUpButton Test 1 (With value)</h2>
<br/>
Selected item : <gsweb name="SelectedItem"></gsweb><br/>
Selected value : <gsweb name="SelectedValue"></gsweb><br/>
<br/>
<gsweb name="Form">
<gsweb name="APopUpButton"></gsweb>
<gsweb name="SubmitButton"></gsweb>
</gsweb>
<hr/>
<gsweb name="MainPageLink"></gsweb>
</body>
</html>

View file

@ -0,0 +1,43 @@
/** PopUpButton1Page.h - <title>GSWeb Testing: Class PopUpButton1Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
// $Id$
#ifndef _PopUpButton1Page_h__
#define _PopUpButton1Page_h__
@interface PopUpButton1Page: BasePage
{
id anItem;
id selectedItem;
id selectedValue;
}
@end
#endif //_PopUpButton1Page_h__

View file

@ -0,0 +1,40 @@
/** PopUpButton1Page.m - <title>GSWeb Testing: Class PopUpButton1Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
#include "BasePage.h"
#include "PopUpButton1Page.h"
@implementation PopUpButton1Page
@end

View file

@ -0,0 +1,24 @@
#include "Base"
APopUpButton: GSWPopUpButton
{
list = application.bundleInfo.PopUpButton.list;
item = anItem;
displayString = anItem.label;
selection = selectedItem;
selectedValue = selectedValue;
selectionValue = selectedValue;
noSelectionString = "Nothing Selected";
name = "POPNAME";
};
SelectedItem: GSWString
{
value = selectedItem;
};
SelectedValue: GSWString
{
value = selectedValue;
};

View file

@ -0,0 +1,18 @@
<html>
<head>
<title>GSWPopUpButton Test 2</title>
</head>
<body>
<h2>GSWPopUpButton Test 2 (Without value: AutoValue)</h2>
<br/>
Selected item : <gsweb name="SelectedItem"></gsweb><br/>
Selected value : <gsweb name="SelectedValue"></gsweb><br/>
<br/>
<gsweb name="Form">
<gsweb name="APopUpButton"></gsweb>
<gsweb name="SubmitButton"></gsweb>
</gsweb>
<hr/>
<gsweb name="MainPageLink"></gsweb>
</body>
</html>

View file

@ -0,0 +1,43 @@
/** PopUpButton2Page.h - <title>GSWeb Testing: Class PopUpButton2Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
// $Id$
#ifndef _PopUpButton2Page_h__
#define _PopUpButton2Page_h__
@interface PopUpButton2Page: BasePage
{
id anItem;
id selectedItem;
id selectedValue;
}
@end
#endif //_PopUpButton2Page_h__

View file

@ -0,0 +1,40 @@
/** PopUpButton2Page.m - <title>GSWeb Testing: Class PopUpButton2Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
#include "BasePage.h"
#include "PopUpButton2Page.h"
@implementation PopUpButton2Page
@end

View file

@ -0,0 +1,17 @@
#include "Base"
ARadioButtonList: GSWRadioButtonList
{
list = application.bundleInfo.RadioButtonList.list;
item = anItem;
value = anItem.value;
displayString = anItem.label;
selection = selectedItem;
name = "RADIONAME";
};
SelectedItem: GSWString
{
value = selectedItem;
};

View file

@ -0,0 +1,17 @@
<html>
<head>
<title>GSWRadioButtonList Test 1</title>
</head>
<body>
<h2>GSWRadioButtonList Test 1 (With value)</h2>
<br/>
Selected item : <gsweb name="SelectedItem"></gsweb><br/>
<br/>
<gsweb name="Form">
<gsweb name="ARadioButtonList"></gsweb>
<gsweb name="SubmitButton"></gsweb>
</gsweb>
<hr/>
<gsweb name="MainPageLink"></gsweb>
</body>
</html>

View file

@ -0,0 +1,42 @@
/** RadioButtonList1Page.h - <title>GSWeb Testing: Class RadioButtonList1Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
// $Id$
#ifndef _RadioButtonList1Page_h__
#define _RadioButtonList1Page_h__
@interface RadioButtonList1Page: BasePage
{
id anItem;
id selectedItem;
}
@end
#endif //_RadioButtonList1Page_h__

View file

@ -0,0 +1,40 @@
/** RadioButtonList1Page.m - <title>GSWeb Testing: Class RadioButtonList1Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
#include "BasePage.h"
#include "RadioButtonList1Page.h"
@implementation RadioButtonList1Page
@end

View file

@ -0,0 +1,16 @@
#include "Base"
ARadioButtonList: GSWRadioButtonList
{
list = application.bundleInfo.RadioButtonList.list;
item = anItem;
displayString = anItem.label;
selection = selectedItem;
name = "RADIONAME";
};
SelectedItem: GSWString
{
value = selectedItem;
};

View file

@ -0,0 +1,17 @@
<html>
<head>
<title>GSWRadioButtonList Test 2</title>
</head>
<body>
<h2>GSWRadioButtonList Test 2 (Without value: AutoValue)</h2>
<br/>
Selected item : <gsweb name="SelectedItem"></gsweb><br/>
<br/>
<gsweb name="Form">
<gsweb name="ARadioButtonList"></gsweb>
<gsweb name="SubmitButton"></gsweb>
</gsweb>
<hr/>
<gsweb name="MainPageLink"></gsweb>
</body>
</html>

View file

@ -0,0 +1,42 @@
/** RadioButtonList2Page.h - <title>GSWeb Testing: Class RadioButtonList2Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
// $Id$
#ifndef _RadioButtonList2Page_h__
#define _RadioButtonList2Page_h__
@interface RadioButtonList2Page: BasePage
{
id anItem;
id selectedItem;
}
@end
#endif //_RadioButtonList2Page_h__

View file

@ -0,0 +1,40 @@
/** RadioButtonList2Page.m - <title>GSWeb Testing: Class RadioButtonList2Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
#include "BasePage.h"
#include "RadioButtonList2Page.h"
@implementation RadioButtonList2Page
@end

View file

@ -0,0 +1,17 @@
MainPageLink: GSWHyperlink
{
pageName = "Main";
string = "Main Page";
};
Form: GSWForm
{
enctype = "multipart/form-data";
};
SubmitButton: GSWSubmitButton
{
action = submitAction;
value = "Submit";
};

View file

@ -0,0 +1,158 @@
defaults = {
GSWAdaptor = GSWDefaultAdaptor;
GSWDebugSetConfigFilePath = "/etc/gsweb/DynamicEelements.logstate";
GSWHost = "localhost";
GSWPort = 9004;
GSWApplicationBaseURL = "/GSW";
GSWFrameworksBaseURL = "/GSW/frameworks";
GSWLoadFrameworks = (
"GSWExtensionsGSW",
"GSWExtensions"
);
GSWMonitorAppConfFilePath = "/etc/httpd/conf/GSWebMonitor.conf";
GSWSessionTimeOut = 1200;
};
dynamicElements = (
{
pageName = "RadioButtonList1Page";
label = "GSWRadioButtonList 1";
comment = "GSWRadioButtonList Test 1";
},
{
pageName = "RadioButtonList2Page";
label = "GSWRadioButtonList 2";
comment = "GSWRadioButtonList Test 2";
},
{
pageName = "CheckBoxList1Page";
label = "GSWCheckBoxList 1";
comment = "GSWCheckBoxList Test 1";
},
{
pageName = "CheckBoxList2Page";
label = "GSWCheckBoxList 2";
comment = "GSWCheckBoxList Test 2";
},
{
pageName = "PopUpButton1Page";
label = "GSWPopUpButton 1";
comment = "GSWPopUpButton Test 1";
},
{
pageName = "PopUpButton2Page";
label = "GSWPopUpButton 2";
comment = "GSWPopUpButton Test 2";
},
{
pageName = "Browser1Page";
label = "GSWBrowser 1";
comment = "GSWBrowser Test 1";
},
{
pageName = "Browser2Page";
label = "GSWBrowser 2";
comment = "GSWBrowser Test 2";
},
{
pageName = "TextField1Page";
label = "TextField 1";
comment = "GSWTextField Test 1";
}
);
RadioButtonList = {
list = (
{
label = "An Apple";
value = "apple";
},
{
label = "A Fish";
value = "fisch";
},
{
label = "A table";
value = "table";
},
{
label = "An icon";
value = "icon";
},
{
label = "A turtle";
value = "turtle";
}
);
};
CheckBoxList = {
list = (
{
label = "An Apple";
value = "apple";
},
{
label = "A Fish";
value = "fisch";
},
{
label = "A table";
value = "table";
},
{
label = "An icon";
value = "icon";
},
{
label = "A turtle";
value = "turtle";
}
);
};
Browser = {
list = (
{
label = "An Apple";
value = "apple";
},
{
label = "A Fish";
value = "fisch";
},
{
label = "A table";
value = "table";
},
{
label = "An icon";
value = "icon";
},
{
label = "A turtle";
value = "turtle";
}
);
};
PopUpButton = {
list = (
{
label = "An Apple";
value = "apple";
},
{
label = "A Fish";
value = "fisch";
},
{
label = "A table";
value = "table";
},
{
label = "An icon";
value = "icon";
},
{
label = "A turtle";
value = "turtle";
}
);
};

View file

@ -0,0 +1,12 @@
#include "Base"
ATextField: GSWTextField
{
value = aString;
};
EnteredString: GSWString
{
value = aString;
};

View file

@ -0,0 +1,17 @@
<html>
<head>
<title>GSWTextField Test 1</title>
</head>
<body>
<h2>GSWTextField Test 1</h2>
<br/>
Entered String : <gsweb name="EnteredString"></gsweb><br/>
<br/>
<gsweb name="Form">
<gsweb name="ATextField"></gsweb>
<gsweb name="SubmitButton"></gsweb>
</gsweb>
<hr/>
<gsweb name="MainPageLink"></gsweb>
</body>
</html>

View file

@ -0,0 +1,41 @@
/** TextField1Page.h - <title>GSWeb Testing: Class TextField1Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
// $Id$
#ifndef _TextField1Page_h__
#define _TextField1Page_h__
@interface TextField1Page: BasePage
{
id aString;
}
@end
#endif //_TextField1Page_h__

View file

@ -0,0 +1,40 @@
/** TextField1Page.m - <title>GSWeb Testing: Class TextField1Page</title>
Copyright (C) 2002 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Nov 2002
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
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
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
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.
</license>
**/
static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
#include "BasePage.h"
#include "TextField1Page.h"
@implementation TextField1Page
@end