2002-05-16 18:01:40 +00:00
|
|
|
/** GSWRepetition.m - <title>GSWeb: Class GSWRepetition</title>
|
|
|
|
|
2004-04-06 11:16:34 +00:00
|
|
|
Copyright (C) 1999-2004 Free Software Foundation, Inc.
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-05-16 18:01:40 +00:00
|
|
|
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
2000-01-22 12:49:49 +00:00
|
|
|
Date: Jan 1999
|
|
|
|
|
2002-05-16 18:01:40 +00:00
|
|
|
$Revision$
|
|
|
|
$Date$
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-05-16 18:01:40 +00:00
|
|
|
<abstract></abstract>
|
|
|
|
|
|
|
|
This file is part of the GNUstep Web Library.
|
|
|
|
|
|
|
|
<license>
|
2000-01-22 12:49:49 +00:00
|
|
|
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.
|
2002-05-16 18:01:40 +00:00
|
|
|
</license>
|
|
|
|
**/
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2003-03-21 14:32:57 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
RCS_ID("$Id$")
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2003-01-22 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/Makefile.postamble:
o use $(LN_S) -f in install-WO-headers
o added $(MKDIRS) $(GNUSTEP_HEADERS)/$(GSWExtensions_wo_HEADER_FILES_INSTALL_DIR);
* GSWExtensionsGSW.framework/Makefile.postamble: use $(LN_S) -f in install-WO-headers
2003-01-20 David Ayers <d.ayers@inode.at>
* Makefile.postamble
o added support for make gswnames=(gsw,wo,all) (corrected
typo)
o reinserted support for $(INSTALL_ROOT_DIR)
* config.h.in
o added HAVE_GDL2
* configure
o added support for --with-gswnames=(gsw,wo,all)
o set LIBWRAP during configure
o added config.mak.in as configurable file
* configure.ac
o (see configure)
* config.mak: removed (replaced by config.mak.in)
* config.mak.in: new file
o added support for make gswnames=(gsw,wo,all)
* gsweb.make.in
o add GSANTLR as auxiliary lib
o add gsweb libs to AUXILIARY_GSW_LIBS
o include correct extensions for GSW/WO-libs
* gsweb_wo.make: new file
* GSWeb/GSWConfig.h
o changed support for GSWEB_WONAMES
o conditionally import file GSWWOCompatiblity
here instead of in GSWeb.h
* GSWeb/GNUMakefile
o added support for make gswnames=(gsw,wo,all)
o ensure each lib gets built with its own object files
o removed deactivated framework extension determination code
o removed reference to unused files:
GSWeb.m, GSWWOCompatibility.m
o added references to new files:
GSWExtenstions.h, GSWExtWOCompatibility.h
o added support to create WO header files
* GSWeb/Makefile.postamble
o changed support to install WO header files according to
make gswnames=(gsw,wo,all)
o remove Makefile.preamble during distclean
* GSWeb/Makefile.preamble.in
o fixed typo
* GSWeb/GSWeb.h
o moved GSW/WO-Name-mapping to GSWWOCompatibility.h
o replaced inclusions of
<GSWeb/file.h> with "file.h"
* GSWeb/GSWeb.m: removed
* GSWeb/GSWWOCompatibility.h
o changed GSWEB_WONAMES handling
o removed hybrid namespace WO subclasses
o moved & reorganized GSW/WO-Name-mapping from GSWeb.h
o inlucluded missing GSW/WO-Name-mappings
* GSWeb/GSWWOCompatibility.m: removed
* GSWeb/*.m
o replaced inclusions of
<GSWeb/file.h> with "file.h"
* GSWeb/GSWApplication.m
o remove special GSW/WO handling of WOApp
* GSWeb/WebObject/WO*: removed
* GSWeb/WebObject/WebObjects
o replaced inclusions of
<GSWeb/file.h> with "file.h"
* GSWExtensions/GNUMakefile
o added support for make gswnames=(gsw,wo,all)
o ensure each lib gets built with its own object files
o removed deactivated framework extension determination code
o added references to new files:
GSWExtenstions.h, GSWExtWOCompatibility.h
o added support to create WO header files
* GSWExtensions/Makefile.preamble
o let gnustep make figure whether to link agains debug libs
o added support for make gswnames=(gsw,wo,all)
* GSWExtensions/Makefile.postamble
o changed support to install WO header files according to
make gswnames=(gsw,wo,all)
* GSWExtensions/*.m
o replaced inclusions of
<GSWeb/GSWeb.h> with "GSWExtWOCompatibility.h"
o replaces inclusions of
<GSWExtensions/file.h> with "file.h"
* GSWExtensions/GSWExtensions.h: new file
* GSWExtensions/WOExtensions.h: new file
* GSWExtensions/GSWExtWOCompatibility.h: new file
* GSWExtensionsGSW/GNUMakefile
o added support for make gswnames=(gsw,wo,all)
o ensure each lib gets built with its own object files
o removed deactivated framework extension determination code
o added references to new file GSWExtGSWWOCompatibility.h
o added support to create WO header files
* GSWExtensionsGSW/Makefile.pramble
o let gnustep make figure whether to link agains debug libs
o added support for make gswnames=(gsw,wo,all)
o removed GSWExtensions from ADDITIONAL_LIB_DIRS
* GSWExtensionsGSW/*.m
o replaced inclusions of
<GSWeb/GSWeb.h> with "GSWExtGSWWOCompatibility.h"
* GSWExtensions/GSWExtGSWWOCompatibility.h: new file
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@15675 72102866-910b-0410-8b05-ffd578937521
2003-01-22 12:24:26 +00:00
|
|
|
#include "GSWeb.h"
|
2008-08-20 20:32:10 +00:00
|
|
|
#include "GSWPrivate.h"
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2004-12-31 14:33:16 +00:00
|
|
|
static SEL prepareIterationSEL=NULL;
|
|
|
|
static SEL objectAtIndexSEL = NULL;
|
|
|
|
static SEL setValueInComponentSEL = NULL;
|
2004-12-14 12:54:40 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
//====================================================================
|
|
|
|
@implementation GSWRepetition
|
|
|
|
|
2004-12-14 12:54:40 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
+ (void) initialize
|
|
|
|
{
|
|
|
|
if (self == [GSWRepetition class])
|
|
|
|
{
|
2004-12-31 14:33:16 +00:00
|
|
|
prepareIterationSEL=@selector(_prepareIterationWithIndex:startIndex:stopIndex:list:listCount:listObjectAtIndexIMP:itemSetValueIMP:indexSetValueIMP:component:inContext:);
|
|
|
|
objectAtIndexSEL=@selector(objectAtIndex:);
|
|
|
|
setValueInComponentSEL=@selector(setValue:inComponent:);
|
2004-12-14 12:54:40 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
-(id)initWithName:(NSString*)aName
|
2001-03-11 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWWOCompatibility.h/.m: added
* GSWeb.framework/GNUmakefile: added GSWWOCompatibility.h/.m
* GSWeb.framework/GSWApplication.h/m: added WOApplicationMain, handle WO/GSWeb names
* GSWeb.framework/GSWContext.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWConstants.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWDynamicURLString.m: handle WO/GSWeb names
* GSWeb.framework/GSWProjectBundle.m/.h: handle WO/GSWeb names, suppress warnings
* GSWeb.framework/GSWSession.m: handle WO/GSWeb names
* GSWeb.framework/GSWRequest.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParser.m: handle WO/GSWeb names,
added tag counts to help errors hunt
* GSWeb.framework/GSWBundle.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWResourceManager.m: handle WO/GSWeb names
* GSWeb.framework/GSWURLValuedElementData.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectAction.m: handle WO/GSWeb names
* GSWeb.framework/GSWForm.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWHyperlink.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWResourceRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectActionRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWActiveImage.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWBindingNameAssociation.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWBrowser.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponent.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWHTMLURLValuedElement.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWImageButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWInput.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWPopUpButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWString.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWAssociation.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBox.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBoxList.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentDefinition.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButton.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButtonList.m: handle WO/GSWeb names
* GSWeb.framework/GSWText.m: handle WO/GSWeb names
* GSWeb.framework/GSWTextField.m: handle WO/GSWeb names
* GSWeb.framework/GSWDeployedBundle.m: warnings
* GSWeb.framework/GSWeb.h: added include GSWeb/GSWSessionTimeOut.h, GSWWOCompatibility.h
* GSWeb.framework/GSWAdaptor.m: traces
* GSWeb.framework/GSWDefaultAdaptor.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWDefaultAdaptorThread.m/.h: handle WO/GSWeb names
* GSWeb.framework/NSNonBlockingFileHandle.m: added traces
* GSWeb.framework/GSWTemplateParserANTLR.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParserXML.m: handle WO/GSWeb names
added tag count to help errors hunt
remove "Tag gsweb invalid" message
handle unicode strings in node content traces
remove html and body tags if they are not present in the template
* GSWeb.framework/GSWTemplateParseXML.h: added ivar _isHTMLTag, _isBodyTag
* GSWeb.framework/GSWSessionTimeOutManager.m: dealloc sessionOrderedTimeOuts instead
of deallocating 2 times sessionTimeOuts
* GSWExtensions.framework/French.lproj/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch, Encode french characters
* GSWExtensions.framework/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch
* GSWHTMLBareString.m: handle unicode strings in description
* GSWExtensions.framework/French.lproj/GSWExceptionPage.gswc/GSWExceptionPage.html:
Encode french characters, Tag Mismatch
* GSWExtensions.framework/French.lproj/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.html:
Encode french characters
* GSWExtensions.framework/French.lproj/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.html:
Encode french characters
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.html:
Tag Mismatch
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd:
added convertHTMLEntities for strings
* GSWeb.framework/GSWRepetition.m: added traces, fix "count" property bug, standardize ivars
* GSWeb.framework/NSObject+IVarAccess+PerformSel.m: added traces, handle underscored ivars search
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@9332 72102866-910b-0410-8b05-ffd578937521
2001-03-11 17:15:44 +00:00
|
|
|
associations:(NSDictionary*)associations
|
2007-04-13 18:32:02 +00:00
|
|
|
template:(GSWElement*)template
|
|
|
|
{
|
|
|
|
self = [super initWithName:nil associations:nil template: template];
|
|
|
|
if (!self) {
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSIGN(_list, [associations objectForKey: list__Key]);
|
|
|
|
ASSIGN(_item, [associations objectForKey: item__Key]);
|
|
|
|
ASSIGN(_count, [associations objectForKey: count__Key]);
|
|
|
|
ASSIGN(_index, [associations objectForKey: index__Key]);
|
|
|
|
|
|
|
|
if (!WOStrictFlag) {
|
|
|
|
ASSIGN(_startIndex, [associations objectForKey: startIndex__Key]);
|
|
|
|
ASSIGN(_stopIndex, [associations objectForKey: stopIndex__Key]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_list == nil && _count == nil) {
|
|
|
|
[NSException raise:NSInvalidArgumentException
|
|
|
|
format:@"%s: Missing 'list' or 'count' attribute.",
|
|
|
|
__PRETTY_FUNCTION__];
|
|
|
|
}
|
|
|
|
if (_list != nil && _item == nil) {
|
|
|
|
[NSException raise:NSInvalidArgumentException
|
|
|
|
format:@"%s: Missing 'item' attribute with 'list' attribute.",
|
|
|
|
__PRETTY_FUNCTION__];
|
|
|
|
}
|
|
|
|
if (_list != nil && _count != nil) {
|
|
|
|
[NSException raise:NSInvalidArgumentException
|
|
|
|
format:@"%s: Illegal use of 'count' attribute with 'list' attribute.",
|
|
|
|
__PRETTY_FUNCTION__];
|
|
|
|
}
|
|
|
|
if (_count != nil && (_list != nil || _item != nil)) {
|
|
|
|
[NSException raise:NSInvalidArgumentException
|
|
|
|
format:@"%s: Illegal use of 'list' or 'item' attribute with 'count' attribute.",
|
|
|
|
__PRETTY_FUNCTION__];
|
|
|
|
}
|
|
|
|
if (_item != nil && (![_item isValueSettable])) {
|
|
|
|
[NSException raise:NSInvalidArgumentException
|
|
|
|
format:@"%s: The 'item' attribute must be settable.",
|
|
|
|
__PRETTY_FUNCTION__];
|
|
|
|
}
|
|
|
|
if (_index != nil && (![_index isValueSettable])) {
|
|
|
|
[NSException raise:NSInvalidArgumentException
|
|
|
|
format:@"%s: The 'index' attribute must be settable.",
|
|
|
|
__PRETTY_FUNCTION__];
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
return self;
|
|
|
|
};
|
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(void)dealloc
|
|
|
|
{
|
2001-03-11 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWWOCompatibility.h/.m: added
* GSWeb.framework/GNUmakefile: added GSWWOCompatibility.h/.m
* GSWeb.framework/GSWApplication.h/m: added WOApplicationMain, handle WO/GSWeb names
* GSWeb.framework/GSWContext.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWConstants.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWDynamicURLString.m: handle WO/GSWeb names
* GSWeb.framework/GSWProjectBundle.m/.h: handle WO/GSWeb names, suppress warnings
* GSWeb.framework/GSWSession.m: handle WO/GSWeb names
* GSWeb.framework/GSWRequest.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParser.m: handle WO/GSWeb names,
added tag counts to help errors hunt
* GSWeb.framework/GSWBundle.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWResourceManager.m: handle WO/GSWeb names
* GSWeb.framework/GSWURLValuedElementData.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectAction.m: handle WO/GSWeb names
* GSWeb.framework/GSWForm.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWHyperlink.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWResourceRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectActionRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWActiveImage.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWBindingNameAssociation.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWBrowser.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponent.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWHTMLURLValuedElement.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWImageButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWInput.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWPopUpButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWString.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWAssociation.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBox.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBoxList.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentDefinition.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButton.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButtonList.m: handle WO/GSWeb names
* GSWeb.framework/GSWText.m: handle WO/GSWeb names
* GSWeb.framework/GSWTextField.m: handle WO/GSWeb names
* GSWeb.framework/GSWDeployedBundle.m: warnings
* GSWeb.framework/GSWeb.h: added include GSWeb/GSWSessionTimeOut.h, GSWWOCompatibility.h
* GSWeb.framework/GSWAdaptor.m: traces
* GSWeb.framework/GSWDefaultAdaptor.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWDefaultAdaptorThread.m/.h: handle WO/GSWeb names
* GSWeb.framework/NSNonBlockingFileHandle.m: added traces
* GSWeb.framework/GSWTemplateParserANTLR.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParserXML.m: handle WO/GSWeb names
added tag count to help errors hunt
remove "Tag gsweb invalid" message
handle unicode strings in node content traces
remove html and body tags if they are not present in the template
* GSWeb.framework/GSWTemplateParseXML.h: added ivar _isHTMLTag, _isBodyTag
* GSWeb.framework/GSWSessionTimeOutManager.m: dealloc sessionOrderedTimeOuts instead
of deallocating 2 times sessionTimeOuts
* GSWExtensions.framework/French.lproj/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch, Encode french characters
* GSWExtensions.framework/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch
* GSWHTMLBareString.m: handle unicode strings in description
* GSWExtensions.framework/French.lproj/GSWExceptionPage.gswc/GSWExceptionPage.html:
Encode french characters, Tag Mismatch
* GSWExtensions.framework/French.lproj/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.html:
Encode french characters
* GSWExtensions.framework/French.lproj/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.html:
Encode french characters
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.html:
Tag Mismatch
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd:
added convertHTMLEntities for strings
* GSWeb.framework/GSWRepetition.m: added traces, fix "count" property bug, standardize ivars
* GSWeb.framework/NSObject+IVarAccess+PerformSel.m: added traces, handle underscored ivars search
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@9332 72102866-910b-0410-8b05-ffd578937521
2001-03-11 17:15:44 +00:00
|
|
|
DESTROY(_list);
|
|
|
|
DESTROY(_item);
|
|
|
|
DESTROY(_count);
|
|
|
|
DESTROY(_index);
|
2002-11-18 11:14:55 +00:00
|
|
|
DESTROY(_startIndex);
|
|
|
|
DESTROY(_stopIndex);
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
-(NSString*)description
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
return [NSString stringWithFormat:@"<%s %p list:%@ item:%@ count:%@ index:%@>",
|
2010-04-22 04:28:50 +00:00
|
|
|
object_getClassName(self),
|
2007-04-13 18:32:02 +00:00
|
|
|
(void*)self,
|
|
|
|
_list, _item, _count, _index];
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
2003-05-14 08:30:22 +00:00
|
|
|
|
2004-12-31 14:33:16 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
static inline void _prepareForIterationWithIndex(int i, int j, NSArray * array, GSWContext * context,
|
|
|
|
GSWComponent *component, GSWAssociation* item, GSWAssociation* index)
|
2004-12-31 14:33:16 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
if (item != nil) {
|
|
|
|
id obj = [array objectAtIndex:i];
|
2007-11-30 21:24:24 +00:00
|
|
|
[item _setValueNoValidation:obj
|
|
|
|
inComponent:component];
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
|
|
|
if (index != nil) {
|
2007-11-30 21:24:24 +00:00
|
|
|
[index _setValueNoValidation:[NSNumber numberWithInt:i]
|
|
|
|
inComponent:component];
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
|
|
|
if (i != 0) {
|
|
|
|
[context incrementLastElementIDComponent];
|
|
|
|
} else {
|
|
|
|
[context appendZeroElementIDComponent];
|
|
|
|
}
|
|
|
|
}
|
2004-12-31 14:33:16 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
static inline void _cleanupAfterIteration(GSWContext * context,
|
|
|
|
GSWComponent * component, int i, GSWAssociation* item, GSWAssociation* index)
|
2004-12-31 14:33:16 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
if (item != nil) {
|
2007-11-30 21:24:24 +00:00
|
|
|
[item _setValueNoValidation:nil
|
|
|
|
inComponent:component];
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
|
|
|
if (index != nil) {
|
2007-11-30 21:24:24 +00:00
|
|
|
[index _setValueNoValidation:[NSNumber numberWithInt:i]
|
|
|
|
inComponent:component];
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
|
|
|
[context deleteLastElementIDComponent];
|
|
|
|
}
|
2004-12-31 14:33:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2002-11-18 11:14:55 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(void)appendToResponse:(GSWResponse*)response
|
|
|
|
inContext:(GSWContext*)context
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
GSWComponent * component = GSWContext_component(context);
|
|
|
|
NSArray * myArray = nil;
|
|
|
|
NSNumber * countValue = nil;
|
|
|
|
unsigned int count = 0;
|
|
|
|
unsigned int i = 0;
|
|
|
|
|
|
|
|
if (_list != nil) {
|
|
|
|
myArray = [_list valueInComponent:component];
|
|
|
|
if (myArray != nil)
|
|
|
|
count = [myArray count];
|
|
|
|
} else {
|
|
|
|
countValue = [_count valueInComponent:component];
|
|
|
|
if (countValue != nil) {
|
|
|
|
count = [countValue intValue];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
_prepareForIterationWithIndex(i, count, myArray, context, component,_item, _index);
|
|
|
|
[super appendChildrenToResponse:response
|
|
|
|
inContext:context];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (count > 0) {
|
|
|
|
_cleanupAfterIteration(context, component, count, _item, _index);
|
|
|
|
}
|
|
|
|
}
|
2004-12-14 12:54:40 +00:00
|
|
|
|
2004-12-14 23:48:51 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
static inline NSString* _indexStringForSenderAndElement(NSString * senderStr, NSString * elementStr)
|
|
|
|
{
|
|
|
|
int elementLen = [elementStr length]+ 1;
|
|
|
|
int senderLen = [senderStr length];
|
|
|
|
|
|
|
|
NSRange myRange = [senderStr rangeOfString:@"."
|
|
|
|
options:0
|
|
|
|
range:NSMakeRange(elementLen, (senderLen - elementLen))];
|
|
|
|
|
|
|
|
|
|
|
|
// NSLog(@"elementLen:%d", elementLen);
|
|
|
|
// NSLog(@"senderLen:%d", senderLen);
|
|
|
|
|
|
|
|
if (myRange.location == NSNotFound) {
|
|
|
|
return [senderStr substringFromIndex: elementLen];
|
|
|
|
} else {
|
|
|
|
// NSLog(@"found myRange.location:%d", myRange.location);
|
|
|
|
return [senderStr substringWithRange: NSMakeRange(elementLen, myRange.location-elementLen)];
|
|
|
|
}
|
|
|
|
return nil;
|
|
|
|
}
|
2004-12-14 23:48:51 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2013-02-27 04:27:07 +00:00
|
|
|
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)request
|
2001-03-11 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWWOCompatibility.h/.m: added
* GSWeb.framework/GNUmakefile: added GSWWOCompatibility.h/.m
* GSWeb.framework/GSWApplication.h/m: added WOApplicationMain, handle WO/GSWeb names
* GSWeb.framework/GSWContext.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWConstants.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWDynamicURLString.m: handle WO/GSWeb names
* GSWeb.framework/GSWProjectBundle.m/.h: handle WO/GSWeb names, suppress warnings
* GSWeb.framework/GSWSession.m: handle WO/GSWeb names
* GSWeb.framework/GSWRequest.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParser.m: handle WO/GSWeb names,
added tag counts to help errors hunt
* GSWeb.framework/GSWBundle.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWResourceManager.m: handle WO/GSWeb names
* GSWeb.framework/GSWURLValuedElementData.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectAction.m: handle WO/GSWeb names
* GSWeb.framework/GSWForm.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWHyperlink.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWResourceRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectActionRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWActiveImage.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWBindingNameAssociation.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWBrowser.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponent.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWHTMLURLValuedElement.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWImageButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWInput.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWPopUpButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWString.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWAssociation.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBox.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBoxList.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentDefinition.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButton.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButtonList.m: handle WO/GSWeb names
* GSWeb.framework/GSWText.m: handle WO/GSWeb names
* GSWeb.framework/GSWTextField.m: handle WO/GSWeb names
* GSWeb.framework/GSWDeployedBundle.m: warnings
* GSWeb.framework/GSWeb.h: added include GSWeb/GSWSessionTimeOut.h, GSWWOCompatibility.h
* GSWeb.framework/GSWAdaptor.m: traces
* GSWeb.framework/GSWDefaultAdaptor.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWDefaultAdaptorThread.m/.h: handle WO/GSWeb names
* GSWeb.framework/NSNonBlockingFileHandle.m: added traces
* GSWeb.framework/GSWTemplateParserANTLR.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParserXML.m: handle WO/GSWeb names
added tag count to help errors hunt
remove "Tag gsweb invalid" message
handle unicode strings in node content traces
remove html and body tags if they are not present in the template
* GSWeb.framework/GSWTemplateParseXML.h: added ivar _isHTMLTag, _isBodyTag
* GSWeb.framework/GSWSessionTimeOutManager.m: dealloc sessionOrderedTimeOuts instead
of deallocating 2 times sessionTimeOuts
* GSWExtensions.framework/French.lproj/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch, Encode french characters
* GSWExtensions.framework/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch
* GSWHTMLBareString.m: handle unicode strings in description
* GSWExtensions.framework/French.lproj/GSWExceptionPage.gswc/GSWExceptionPage.html:
Encode french characters, Tag Mismatch
* GSWExtensions.framework/French.lproj/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.html:
Encode french characters
* GSWExtensions.framework/French.lproj/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.html:
Encode french characters
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.html:
Tag Mismatch
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd:
added convertHTMLEntities for strings
* GSWeb.framework/GSWRepetition.m: added traces, fix "count" property bug, standardize ivars
* GSWeb.framework/NSObject+IVarAccess+PerformSel.m: added traces, handle underscored ivars search
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@9332 72102866-910b-0410-8b05-ffd578937521
2001-03-11 17:15:44 +00:00
|
|
|
inContext:(GSWContext*)context
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
GSWComponent * component = GSWContext_component(context);
|
2013-02-27 04:27:07 +00:00
|
|
|
id <GSWActionResults, NSObject> element = nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
NSString * indexStr = nil;
|
|
|
|
|
|
|
|
NSString * senderID = [context senderID];
|
|
|
|
NSString * elementID = [context elementID];
|
|
|
|
NSArray * arrayValue = nil;
|
|
|
|
id currentValue = nil;
|
|
|
|
int count = 0;
|
|
|
|
int k = 0;
|
|
|
|
|
|
|
|
if ([senderID hasPrefix:elementID]) {
|
|
|
|
int i = [elementID length];
|
|
|
|
// code taken from http://www.unicode.org/charts/PDF/U0000.pdf
|
|
|
|
// '.'
|
|
|
|
if (([senderID length] > i) && ([senderID characterAtIndex:i] == 0x002e)) {
|
|
|
|
indexStr = _indexStringForSenderAndElement(senderID, elementID);
|
|
|
|
// NSLog(@"indexStr is '%@' senderID:'%@' elementID:'%@'", indexStr, senderID, elementID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (indexStr != nil) {
|
|
|
|
int i = [indexStr intValue];
|
|
|
|
if (_list != nil) {
|
|
|
|
arrayValue = [_list valueInComponent:component];
|
|
|
|
|
|
|
|
if (arrayValue != nil) {
|
|
|
|
if ((i >= 0) && (i < [arrayValue count])) {
|
|
|
|
currentValue = [arrayValue objectAtIndex:i];
|
|
|
|
}
|
|
|
|
if (_item != nil) {
|
2007-11-30 21:24:24 +00:00
|
|
|
[_item _setValueNoValidation:currentValue
|
|
|
|
inComponent:component];
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (_index != nil) {
|
2007-11-30 21:24:24 +00:00
|
|
|
[_index _setValueNoValidation:[NSNumber numberWithInt:i]
|
|
|
|
inComponent:component];
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
|
|
|
[context appendElementIDComponent: indexStr];
|
2013-02-27 04:27:07 +00:00
|
|
|
element = (id <GSWActionResults, NSObject>) [super invokeActionForRequest:request
|
|
|
|
inContext:context];
|
2007-04-13 18:32:02 +00:00
|
|
|
[context deleteLastElementIDComponent];
|
|
|
|
} else {
|
|
|
|
count = 0;
|
|
|
|
|
|
|
|
if (_list != nil) {
|
|
|
|
arrayValue = [_list valueInComponent:component];
|
|
|
|
count = [arrayValue count];
|
|
|
|
} else {
|
|
|
|
id countValue = [_count valueInComponent:component];
|
|
|
|
if (countValue != nil) {
|
|
|
|
count = [countValue intValue]; // or first into a string?
|
|
|
|
} else {
|
|
|
|
NSLog(@"%s:'count' evaluated to nil in component %@. Repetition count reset to zero.",
|
|
|
|
__PRETTY_FUNCTION__, component);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (k = 0; k < count && element == nil; k++) {
|
|
|
|
_prepareForIterationWithIndex(k, count, arrayValue, context, component, _item, _index);
|
2013-02-27 04:27:07 +00:00
|
|
|
element = (id <GSWActionResults, NSObject>) [super invokeActionForRequest:request
|
|
|
|
inContext:context];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
}
|
2004-12-14 23:48:51 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
if (count > 0) {
|
|
|
|
_cleanupAfterIteration(context, component, count, _item, _index);
|
|
|
|
}
|
|
|
|
}
|
2001-03-11 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWWOCompatibility.h/.m: added
* GSWeb.framework/GNUmakefile: added GSWWOCompatibility.h/.m
* GSWeb.framework/GSWApplication.h/m: added WOApplicationMain, handle WO/GSWeb names
* GSWeb.framework/GSWContext.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWConstants.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWDynamicURLString.m: handle WO/GSWeb names
* GSWeb.framework/GSWProjectBundle.m/.h: handle WO/GSWeb names, suppress warnings
* GSWeb.framework/GSWSession.m: handle WO/GSWeb names
* GSWeb.framework/GSWRequest.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParser.m: handle WO/GSWeb names,
added tag counts to help errors hunt
* GSWeb.framework/GSWBundle.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWResourceManager.m: handle WO/GSWeb names
* GSWeb.framework/GSWURLValuedElementData.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectAction.m: handle WO/GSWeb names
* GSWeb.framework/GSWForm.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWHyperlink.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWResourceRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectActionRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWActiveImage.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWBindingNameAssociation.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWBrowser.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponent.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWHTMLURLValuedElement.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWImageButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWInput.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWPopUpButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWString.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWAssociation.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBox.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBoxList.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentDefinition.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButton.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButtonList.m: handle WO/GSWeb names
* GSWeb.framework/GSWText.m: handle WO/GSWeb names
* GSWeb.framework/GSWTextField.m: handle WO/GSWeb names
* GSWeb.framework/GSWDeployedBundle.m: warnings
* GSWeb.framework/GSWeb.h: added include GSWeb/GSWSessionTimeOut.h, GSWWOCompatibility.h
* GSWeb.framework/GSWAdaptor.m: traces
* GSWeb.framework/GSWDefaultAdaptor.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWDefaultAdaptorThread.m/.h: handle WO/GSWeb names
* GSWeb.framework/NSNonBlockingFileHandle.m: added traces
* GSWeb.framework/GSWTemplateParserANTLR.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParserXML.m: handle WO/GSWeb names
added tag count to help errors hunt
remove "Tag gsweb invalid" message
handle unicode strings in node content traces
remove html and body tags if they are not present in the template
* GSWeb.framework/GSWTemplateParseXML.h: added ivar _isHTMLTag, _isBodyTag
* GSWeb.framework/GSWSessionTimeOutManager.m: dealloc sessionOrderedTimeOuts instead
of deallocating 2 times sessionTimeOuts
* GSWExtensions.framework/French.lproj/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch, Encode french characters
* GSWExtensions.framework/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch
* GSWHTMLBareString.m: handle unicode strings in description
* GSWExtensions.framework/French.lproj/GSWExceptionPage.gswc/GSWExceptionPage.html:
Encode french characters, Tag Mismatch
* GSWExtensions.framework/French.lproj/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.html:
Encode french characters
* GSWExtensions.framework/French.lproj/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.html:
Encode french characters
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.html:
Tag Mismatch
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd:
added convertHTMLEntities for strings
* GSWeb.framework/GSWRepetition.m: added traces, fix "count" property bug, standardize ivars
* GSWeb.framework/NSObject+IVarAccess+PerformSel.m: added traces, handle underscored ivars search
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@9332 72102866-910b-0410-8b05-ffd578937521
2001-03-11 17:15:44 +00:00
|
|
|
return element;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
- (void) takeValuesFromRequest:(GSWRequest *) request
|
|
|
|
inContext:(GSWContext*)context
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
GSWComponent * component = GSWContext_component(context);
|
|
|
|
NSArray * arrayValue = nil;
|
|
|
|
id countValue = nil;
|
|
|
|
int i = 0;
|
2004-12-14 12:54:40 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
int count = 0;
|
2004-12-14 12:54:40 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
if (_list != nil) {
|
|
|
|
arrayValue = [_list valueInComponent:component];
|
|
|
|
if (arrayValue != nil) {
|
|
|
|
count = [arrayValue count];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
countValue = [_count valueInComponent:component];
|
|
|
|
if (countValue != nil) {
|
|
|
|
count = [countValue intValue]; // or first into a string?
|
|
|
|
} else {
|
|
|
|
NSLog(@"%s: 'count' evaluated to nil in %@. Resetting to zero. (%@)",
|
|
|
|
__PRETTY_FUNCTION__, component, _count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < count; i++) {
|
2004-12-14 23:48:51 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
_prepareForIterationWithIndex(i, count, arrayValue, context, component,_item, _index);
|
2004-12-14 23:48:51 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
[super takeValuesFromRequest:request
|
|
|
|
inContext:context];
|
|
|
|
|
|
|
|
}
|
2004-12-14 23:48:51 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
if (count > 0)
|
|
|
|
{
|
|
|
|
_cleanupAfterIteration(context, component, count, _item, _index);
|
|
|
|
}
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-04-02 18:26:02 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
@end
|
2002-11-18 11:14:55 +00:00
|
|
|
|