mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-04-25 00:11:46 +00:00
* added GSWeb/GSWApplication+Defaults.h
* GSWeb/GNUmakefile: use -Werror * GSWeb/GSWFileUpload.* added multiple file support * Testing/DynamicElements/FileUpload1Page.wo added multiple file support * GSWeb/* fixed warnings on Mountain Lion git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@36200 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
041da71850
commit
2658ffe6b6
61 changed files with 1099 additions and 1054 deletions
|
@ -1,3 +1,10 @@
|
|||
2013-02-26 David Wetzel <dave@turbocat.de>
|
||||
* added GSWeb/GSWApplication+Defaults.h
|
||||
* GSWeb/GNUmakefile: use -Werror
|
||||
* GSWeb/GSWFileUpload.* added multiple file support
|
||||
* Testing/DynamicElements/FileUpload1Page.wo added multiple file support
|
||||
* GSWeb/* fixed warnings on Mountain Lion
|
||||
|
||||
2011-05-13 David Wetzel <dave@turbocat.de>
|
||||
* GSWAdaptors/Apache2/mod_gsw.c
|
||||
modified find_app_by_name() wen dealing with single instances
|
||||
|
|
|
@ -397,6 +397,6 @@ ifeq ($(doc),yes)
|
|||
include $(GNUSTEP_MAKEFILES)/documentation.make
|
||||
endif
|
||||
|
||||
ADDITIONAL_OBJCFLAGS = -Werror-implicit-function-declaration
|
||||
ADDITIONAL_OBJCFLAGS = -Werror-implicit-function-declaration -Werror
|
||||
|
||||
-include Makefile.postamble
|
||||
|
|
|
@ -70,8 +70,6 @@
|
|||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)aContext;
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)aContext;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)aContext;
|
||||
|
||||
|
|
|
@ -309,10 +309,10 @@ static NSString * static_tempQueryKey = nil;
|
|||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
GSWElement* element=nil;
|
||||
NSObject <GSWActionResults> * results = nil;
|
||||
NSString* senderID=nil;
|
||||
NSString* elementID=nil;
|
||||
BOOL disabledInContext=NO;
|
||||
|
@ -320,8 +320,8 @@ static NSString * static_tempQueryKey = nil;
|
|||
BOOL XYValues=NO;
|
||||
BOOL thisOne=NO;
|
||||
GSWComponent* component=nil;
|
||||
int x=0;
|
||||
int y=0;
|
||||
NSInteger x=0;
|
||||
NSInteger y=0;
|
||||
|
||||
|
||||
component=GSWContext_component(aContext);
|
||||
|
@ -427,13 +427,13 @@ static NSString * static_tempQueryKey = nil;
|
|||
if (actionAssociation)
|
||||
{
|
||||
[aContext _setActionInvoked:YES];
|
||||
element=[actionAssociation valueInComponent:component];
|
||||
NSAssert4(!element || [element isKindOfClass:[GSWElement class]],
|
||||
results = (NSObject <GSWActionResults> *) [actionAssociation valueInComponent:component];
|
||||
NSAssert4(!results || [results isKindOfClass:[GSWElement class]],
|
||||
@"actionAssociation=%@, component=%@ Element is a %@ not a GSWElement: %@",
|
||||
actionAssociation,
|
||||
component,
|
||||
[element class],
|
||||
element);
|
||||
[results class],
|
||||
results);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -445,48 +445,48 @@ static NSString * static_tempQueryKey = nil;
|
|||
else if (_action)
|
||||
{
|
||||
[aContext _setActionInvoked:YES];
|
||||
element=[_action valueInComponent:component];
|
||||
NSAssert4(!element || [element isKindOfClass:[GSWElement class]],
|
||||
results = (NSObject <GSWActionResults> *)[_action valueInComponent:component];
|
||||
NSAssert4(!results || [results isKindOfClass:[GSWElement class]],
|
||||
@"_action=%@, component=%@ Element is a %@ not a GSWElement: %@",
|
||||
_action,
|
||||
component,
|
||||
[element class],
|
||||
element);
|
||||
[results class],
|
||||
results);
|
||||
}
|
||||
else
|
||||
{
|
||||
//NSDebugMLLog0(@"gswdync",@"GSWActiveImage Couldn't trigger action.");
|
||||
};
|
||||
};
|
||||
if (!element)
|
||||
if (!results)
|
||||
{
|
||||
element=[aContext page];
|
||||
NSAssert2(!element || [element isKindOfClass:[GSWElement class]],
|
||||
results=[aContext page];
|
||||
NSAssert2(!results || [results isKindOfClass:[GSWElement class]],
|
||||
@"Element is a %@ not a GSWElement: %@",
|
||||
[element class],
|
||||
element);
|
||||
[results class],
|
||||
results);
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
element=[super invokeActionForRequest:request
|
||||
results = (NSObject <GSWActionResults> *) [super invokeActionForRequest:request
|
||||
inContext:aContext];
|
||||
NSAssert2(!element || [element isKindOfClass:[GSWElement class]],
|
||||
NSAssert2(!results || [results isKindOfClass:[GSWElement class]],
|
||||
@"Element is a %@ not a GSWElement: %@",
|
||||
[element class],
|
||||
element);
|
||||
};
|
||||
[results class],
|
||||
results);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
element=[super invokeActionForRequest:request
|
||||
results = (NSObject <GSWActionResults> *) [super invokeActionForRequest:request
|
||||
inContext:aContext];
|
||||
NSAssert2(!element || [element isKindOfClass:[GSWElement class]],
|
||||
NSAssert2(!results || [results isKindOfClass:[GSWElement class]],
|
||||
@"Element is a %@ not a GSWElement: %@",
|
||||
[element class],
|
||||
element);
|
||||
[results class],
|
||||
results);
|
||||
};
|
||||
return element;
|
||||
return results;
|
||||
};
|
||||
|
||||
-(void)appendAttributesToResponse:(GSWResponse*) response
|
||||
|
|
57
GSWeb/GSWApplication+Defaults.h
Normal file
57
GSWeb/GSWApplication+Defaults.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
/** GSWApplication+Defaults.h - <title>GSWeb: GSWApplication+Defaults.h</title>
|
||||
|
||||
Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
|
||||
Written by: David Wetzel <dave@turbocat.de>
|
||||
|
||||
$Revision: 30698 $
|
||||
$Date: 2010-06-13 21:19:25 -0700 (So, 13 Jun 2010) $
|
||||
|
||||
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: GSWToggle.h 30698 2010-06-14 04:19:25Z dwetzel $
|
||||
|
||||
#ifndef _GSWApplication_Defaults_h__
|
||||
#define _GSWApplication_Defaults_h__
|
||||
|
||||
|
||||
@interface GSWApplication (GSWApplicationDefaults)
|
||||
|
||||
+(void)_initUserDefaultsKeys;
|
||||
+(void)_initRegistrationDomainDefaults;
|
||||
-(void)_initAdaptorsWithUserDefaults:(NSUserDefaults*)userDefault;
|
||||
|
||||
-(NSDictionary*)_argsDictionaryWithUserDefaults:(NSUserDefaults*)userDefault;
|
||||
|
||||
-(void)setResponseClassName:(NSString*)className;
|
||||
|
||||
-(NSString*)responseClassName;
|
||||
|
||||
-(void)setRequestClassName:(NSString*)className;
|
||||
-(NSString*)requestClassName;
|
||||
|
||||
-(void)setContextClassName:(NSString*)className;
|
||||
-(NSString*)contextClassName;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
#endif //_GSWApplication_Defaults_h__
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
RCS_ID("$Id$")
|
||||
|
||||
#include "GSWeb.h"
|
||||
#include "GSWApplication+Defaults.h"
|
||||
#include <GNUstepBase/NSObject+GNUstepBase.h>
|
||||
|
||||
|
||||
|
@ -69,14 +70,18 @@ GSWeb_ApplicationDebugSetChange()
|
|||
NSString * debugSetConfigFilePath = nil;
|
||||
NSString * newStateString = nil;
|
||||
BOOL change=NO;
|
||||
NSStringEncoding usedEncoding;
|
||||
NSError * error = nil;
|
||||
|
||||
debugSetConfigFilePath = [GSWApplication debugSetConfigFilePath];
|
||||
NSDebugFLog(@"debugSetConfigFilePath=%@", debugSetConfigFilePath);
|
||||
|
||||
if (debugSetConfigFilePath)
|
||||
newStateString = [NSString stringWithContentsOfFile:
|
||||
[GSWApplication debugSetConfigFilePath]];
|
||||
if (debugSetConfigFilePath) {
|
||||
newStateString = [NSString stringWithContentsOfFile:[GSWApplication debugSetConfigFilePath]
|
||||
usedEncoding:&usedEncoding
|
||||
error:&error];
|
||||
|
||||
}
|
||||
NSDebugFLog(@"debugSet=%@", debugSet);
|
||||
NSDebugFLog(@"newStateString=%@", newStateString);
|
||||
NSDebugFLog(@"prevStateString=%@", prevStateString);
|
||||
|
@ -99,11 +104,11 @@ GSWeb_ApplicationDebugSetChange()
|
|||
for(i=0;i<count;i++)
|
||||
{
|
||||
[debugSet addObject:[pList objectAtIndex:i]];
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
ASSIGN(prevStateString,newStateString);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GSWApplicationSetDebugSetOption(NSString* opt)
|
||||
|
@ -526,27 +531,27 @@ GSWeb_DestroyGlobalAppDefaultOptions(void)
|
|||
They may be merged later. */
|
||||
#define INIT_DFLT_OBJ(name,opt) \
|
||||
if (_dflt_init_##name == NO) { \
|
||||
id key = [NSString stringWithCString: #name]; \
|
||||
id key = [NSString stringWithCString: #name encoding:NSUTF8StringEncoding]; \
|
||||
id val = [NSUSERDEFAULTS objectForKey: opt]; \
|
||||
TAKEVALUEFORKEY; }
|
||||
|
||||
#define INIT_DFLT_BOOL(name, opt) \
|
||||
if (_dflt_init_##name == NO) { \
|
||||
id key = [NSString stringWithCString: #name]; \
|
||||
id key = [NSString stringWithCString: #name encoding:NSUTF8StringEncoding]; \
|
||||
BOOL v = [NSUSERDEFAULTS boolForKey: opt]; \
|
||||
id val = [NSNumber numberWithBool: v]; \
|
||||
TAKEVALUEFORKEY; }
|
||||
|
||||
#define INIT_DFLT_INT(name, opt) \
|
||||
if (_dflt_init_##name == NO) { \
|
||||
id key = [NSString stringWithCString: #name]; \
|
||||
id key = [NSString stringWithCString: #name encoding:NSUTF8StringEncoding]; \
|
||||
int v = [NSUSERDEFAULTS integerForKey: opt]; \
|
||||
id val = GSWIntNumber(v); \
|
||||
TAKEVALUEFORKEY; }
|
||||
|
||||
#define INIT_DFLT_FLT(name, opt) \
|
||||
if (_dflt_init_##name == NO) { \
|
||||
id key = [NSString stringWithCString: #name]; \
|
||||
id key = [NSString stringWithCString: #name encoding:NSUTF8StringEncoding]; \
|
||||
float v = [NSUSERDEFAULTS floatForKey: opt]; \
|
||||
id val = [NSNumber numberWithFloat: v]; \
|
||||
TAKEVALUEFORKEY; }
|
||||
|
@ -676,11 +681,6 @@ static NSString *_dflt_requestClassName = nil;
|
|||
return _dflt_requestClassName;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
//====================================================================
|
||||
@implementation GSWApplication (UserDefaults)
|
||||
//--------------------------------------------------------------------
|
||||
static BOOL _dflt_init_loadFrameworks = NO;
|
||||
static NSArray *_dflt_loadFrameworks = nil;
|
||||
|
@ -1143,12 +1143,6 @@ static NSNumber *_dflt_sessionTimeOut = nil;
|
|||
return _dflt_sessionTimeOut;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
//====================================================================
|
||||
@implementation GSWApplication (GSWUserDefaults)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//NDFN
|
||||
static BOOL _dflt_init_statusDebuggingEnabled = NO;
|
||||
|
|
|
@ -203,7 +203,7 @@ GSWEB_EXPORT BOOL WOStrictFlag;
|
|||
|
||||
-(GSWContext*)createContextForRequest:(GSWRequest*)aRequest;
|
||||
|
||||
-(Class)responseClass;
|
||||
//-(Class)responseClass;
|
||||
|
||||
-(GSWResponse*)createResponseInContext:(GSWContext*)aContext;
|
||||
|
||||
|
@ -230,7 +230,7 @@ GSWEB_EXPORT BOOL WOStrictFlag;
|
|||
|
||||
-(int)lockedDecrementActiveSessionCount;
|
||||
|
||||
-(int)lockedIncrementActiveSessionCount;
|
||||
//-(int)lockedIncrementActiveSessionCount;
|
||||
|
||||
-(int)_activeSessionsCount;
|
||||
|
||||
|
@ -290,8 +290,8 @@ GSWEB_EXPORT BOOL WOStrictFlag;
|
|||
-(GSWSession*)restoreSessionWithID:(NSString*)aSessionID
|
||||
inContext:(GSWContext*)aContext;
|
||||
|
||||
-(GSWSession*)_restoreSessionWithID:(NSString*)aSessionID
|
||||
inContext:(GSWContext*)aContext;
|
||||
//-(GSWSession*)_restoreSessionWithID:(NSString*)aSessionID
|
||||
// inContext:(GSWContext*)aContext;
|
||||
|
||||
-(void)saveSessionForContext:(GSWContext*)aContext;
|
||||
|
||||
|
@ -362,7 +362,7 @@ GSWEB_EXPORT BOOL WOStrictFlag;
|
|||
|
||||
-(void)awake;
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)aContext;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)aRequest
|
||||
|
@ -543,18 +543,11 @@ GSWEB_EXPORT BOOL WOStrictFlag;
|
|||
|
||||
-(GSWRequestHandler*)handlerForRequest:(GSWRequest*)aRequest;
|
||||
|
||||
+(void)_initRegistrationDomainDefaults;
|
||||
+(void)_initUserDefaultsKeys;
|
||||
|
||||
-(void)_initAdaptorsWithUserDefaults:(NSUserDefaults*)userDefault;
|
||||
-(NSDictionary*)_argsDictionaryWithUserDefaults:(NSUserDefaults*)userDefault;
|
||||
|
||||
-(void)setContextClassName:(NSString*)className;
|
||||
-(NSString*)contextClassName;
|
||||
-(void)setResponseClassName:(NSString*)className;
|
||||
-(NSString*)responseClassName;
|
||||
-(void)setRequestClassName:(NSString*)className;
|
||||
-(NSString*)requestClassName;
|
||||
//-(void)setResponseClassName:(NSString*)className;
|
||||
//-(NSString*)responseClassName;
|
||||
//-(void)setRequestClassName:(NSString*)className;
|
||||
//-(NSString*)requestClassName;
|
||||
|
||||
//NDFN
|
||||
-(id)propListWithResourceNamed:(NSString*)aName
|
||||
|
@ -587,13 +580,13 @@ GSWEB_EXPORT BOOL WOStrictFlag;
|
|||
inFramework:(NSString*)aFrameworkName
|
||||
languages:(NSArray*)languages;
|
||||
//NDFN
|
||||
-(NSDictionary*)stringsTableNamed:(NSString*)aTableName
|
||||
inFramework:(NSString*)aFrameworkName
|
||||
languages:(NSArray*)languages;
|
||||
//-(NSDictionary*)stringsTableNamed:(NSString*)aTableName
|
||||
// inFramework:(NSString*)aFrameworkName
|
||||
// languages:(NSArray*)languages;
|
||||
//NDFN
|
||||
-(NSArray*)stringsTableArrayNamed:(NSString*)aTableName
|
||||
inFramework:(NSString*)aFrameworkName
|
||||
languages:(NSArray*)languages;
|
||||
//-(NSArray*)stringsTableArrayNamed:(NSString*)aTableName
|
||||
// inFramework:(NSString*)aFrameworkName
|
||||
// languages:(NSArray*)languages;
|
||||
//NDFN
|
||||
-(NSArray*)filterLanguages:(NSArray*)languages;
|
||||
@end
|
||||
|
|
|
@ -36,6 +36,7 @@ RCS_ID("$Id$")
|
|||
#include "GSWPrivate.h"
|
||||
#include "GSWLifebeatThread.h"
|
||||
#include "GSWRecording.h"
|
||||
#include "GSWApplication+Defaults.h"
|
||||
|
||||
#include "stacktrace.h"
|
||||
#include "attach.h"
|
||||
|
@ -64,6 +65,7 @@ application unlock
|
|||
- (NSString *)adaptor;
|
||||
- (NSString *)host;
|
||||
- (NSNumber *)port;
|
||||
+ (id)defaultGroup;
|
||||
@end
|
||||
|
||||
#ifdef GNUSTEP
|
||||
|
@ -77,7 +79,7 @@ application unlock
|
|||
@end
|
||||
|
||||
#define GSWFPutSL(string, file) \
|
||||
do { fputs([string lossyCString],file); fputs("\n",file); fflush(file); } \
|
||||
do { fputs([[string dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES] bytes], file); fputs("\n",file); fflush(file); } \
|
||||
while (0)
|
||||
|
||||
/* GSWApplication+Defaults.m */
|
||||
|
@ -659,7 +661,7 @@ int GSWApplicationMain(NSString* applicationClassName,
|
|||
{
|
||||
NSString* path=nil;
|
||||
|
||||
path=[[_resourceManager _appProjectBundle] path];
|
||||
path=[[_resourceManager _appProjectBundle] bundlePath];
|
||||
|
||||
return path;
|
||||
};
|
||||
|
@ -847,8 +849,8 @@ int GSWApplicationMain(NSString* applicationClassName,
|
|||
-(void)_resetCache
|
||||
{
|
||||
//OK
|
||||
NSEnumerator * anEnum = nil;
|
||||
GSWComponentDefinition * definition = nil;
|
||||
// NSEnumerator * anEnum = nil;
|
||||
// GSWComponentDefinition * definition = nil;
|
||||
|
||||
[self lock];
|
||||
NS_DURING
|
||||
|
@ -1539,12 +1541,12 @@ to another instance **/
|
|||
if (!_remoteMonitor)
|
||||
{
|
||||
NSString* monitorHost=[self _monitorHost];
|
||||
NSNumber* workerThreadCount=[[self class]workerThreadCount];
|
||||
// NSNumber* workerThreadCount=[[self class]workerThreadCount];
|
||||
id proxy=nil;
|
||||
if ([[NSDistantObject class] respondsToSelector:@selector(setDebug:)])
|
||||
{
|
||||
[NSDistantObject setDebug:YES];
|
||||
}
|
||||
// if ([[NSDistantObject class] respondsToSelector:@selector(setDebug:)])
|
||||
// {
|
||||
// [NSDistantObject setDebug:YES];
|
||||
// }
|
||||
_remoteMonitorConnection = [NSConnection connectionWithRegisteredName:GSWMonitorServiceName
|
||||
host:monitorHost];
|
||||
proxy=[_remoteMonitorConnection rootProxy];
|
||||
|
@ -2257,17 +2259,16 @@ to another instance **/
|
|||
//--------------------------------------------------------------------
|
||||
//invokeActionForRequest:inContext:
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
//OK
|
||||
GSWElement* element=nil;
|
||||
GSWSession* session=nil;
|
||||
id <GSWActionResults> results = nil;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
session = [aContext existingSession];
|
||||
element=[session invokeActionForRequest:aRequest
|
||||
results = [session invokeActionForRequest:aRequest
|
||||
inContext:aContext];
|
||||
}
|
||||
NS_HANDLER
|
||||
|
@ -2278,8 +2279,8 @@ to another instance **/
|
|||
}
|
||||
NS_ENDHANDLER;
|
||||
|
||||
return element;
|
||||
};
|
||||
return results;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//appendToResponse:inContext:
|
||||
|
@ -2471,7 +2472,7 @@ to another instance **/
|
|||
{
|
||||
NSString* message=[NSString stringWithFormat:@"Exception Handling failed. Can't find Error Page named '%@'",
|
||||
pageName];
|
||||
NSLog(message);
|
||||
NSLog(@"%@", message);
|
||||
|
||||
response=[GSWResponse responseWithMessage:message
|
||||
inContext:context
|
||||
|
@ -2729,7 +2730,7 @@ to another instance **/
|
|||
NSBundle* bundle=[NSBundle bundleWithPath:path];
|
||||
if (bundle)
|
||||
{
|
||||
BOOL result=[bundle load];
|
||||
[bundle load];
|
||||
aClass=[bundle principalClass];
|
||||
};
|
||||
return aClass;
|
||||
|
@ -3565,19 +3566,6 @@ to another instance **/
|
|||
return 1;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(BOOL)_lockDefaultEditingContext
|
||||
{
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
return YES;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(void)_setLockDefaultEditingContext:(BOOL)flag
|
||||
{
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(id)_allowsConcurrentRequestHandling
|
||||
{
|
||||
|
@ -3644,7 +3632,12 @@ to another instance **/
|
|||
languages:languages];
|
||||
if (pathName)
|
||||
{
|
||||
NSString* propListString=[NSString stringWithContentsOfFile:pathName];
|
||||
NSStringEncoding encoding;
|
||||
NSError *error = nil;
|
||||
|
||||
NSString* propListString=[NSString stringWithContentsOfFile:pathName
|
||||
usedEncoding:&encoding
|
||||
error:&error];
|
||||
propList = [propListString propertyList];
|
||||
if (!propList)
|
||||
{
|
||||
|
@ -3655,7 +3648,7 @@ to another instance **/
|
|||
};
|
||||
|
||||
return propList;
|
||||
};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(BOOL)createUnknownComponentClasses:(NSArray*)classes
|
||||
|
@ -3799,31 +3792,31 @@ to another instance **/
|
|||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//NDFN
|
||||
-(NSDictionary*)stringsTableNamed:(NSString*)aTableName
|
||||
inFramework:(NSString*)aFrameworkName
|
||||
languages:(NSArray*)languages
|
||||
{
|
||||
NSDictionary* st=nil;
|
||||
|
||||
st=[[self resourceManager]stringsTableNamed:aTableName
|
||||
inFramework:aFrameworkName
|
||||
languages:languages];
|
||||
|
||||
return st;
|
||||
};
|
||||
////--------------------------------------------------------------------
|
||||
////NDFN
|
||||
//-(NSDictionary*)stringsTableNamed:(NSString*)aTableName
|
||||
// inFramework:(NSString*)aFrameworkName
|
||||
// languages:(NSArray*)languages
|
||||
//{
|
||||
// NSDictionary* st=nil;
|
||||
//
|
||||
// st=[[self resourceManager]stringsTableNamed:aTableName
|
||||
// inFramework:aFrameworkName
|
||||
// languages:languages];
|
||||
//
|
||||
// return st;
|
||||
//};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//NDFN
|
||||
-(NSArray*)stringsTableArrayNamed:(NSString*)aTableName
|
||||
inFramework:(NSString*)aFrameworkName
|
||||
languages:(NSArray*)languages
|
||||
{
|
||||
return [[self resourceManager]stringsTableArrayNamed:aTableName
|
||||
inFramework:aFrameworkName
|
||||
languages:languages];
|
||||
};
|
||||
//-(NSArray*)stringsTableArrayNamed:(NSString*)aTableName
|
||||
// inFramework:(NSString*)aFrameworkName
|
||||
// languages:(NSArray*)languages
|
||||
//{
|
||||
// return [[self resourceManager]stringsTableArrayNamed:aTableName
|
||||
// inFramework:aFrameworkName
|
||||
// languages:languages];
|
||||
//};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//NDFN
|
||||
|
|
|
@ -378,7 +378,7 @@ static Class NSStringClass = Nil;
|
|||
{
|
||||
NSString* numberString=[trimmedString stringByDeletingPrefix:@"#"];
|
||||
//char* cString=[numberString lossyCString];//TODO
|
||||
const char* cString=[numberString cString];//TODO
|
||||
const char* cString=[numberString UTF8String];
|
||||
char* endPtr=NULL;
|
||||
int value=strtol(cString,&endPtr,16);
|
||||
if (endPtr && *endPtr)
|
||||
|
@ -410,7 +410,7 @@ static Class NSStringClass = Nil;
|
|||
else
|
||||
{
|
||||
//char* cString=[trimmedString lossyCString];//TODO
|
||||
const char* cString=[trimmedString cString];//TODO
|
||||
const char* cString=[trimmedString UTF8String];
|
||||
char* endPtr=NULL;
|
||||
int value=strtol(cString,&endPtr,10);
|
||||
|
||||
|
|
|
@ -178,8 +178,10 @@ static Class standardClass = Nil;
|
|||
NSString* scriptFileName=[_scriptFile valueInComponent:component];
|
||||
if (scriptFileName)
|
||||
{
|
||||
NSError * error = nil;
|
||||
GSWResourceManager * resourceManager = nil;
|
||||
NSString * path = nil;
|
||||
|
||||
resourceManager=[GSWApp resourceManager];
|
||||
path=[resourceManager pathForResourceNamed:scriptFileName
|
||||
inFramework:nil
|
||||
|
@ -187,7 +189,11 @@ static Class standardClass = Nil;
|
|||
if (path)
|
||||
{
|
||||
NSString * scriptValue = nil;
|
||||
scriptValue=[NSString stringWithContentsOfFile:path];
|
||||
NSStringEncoding usedEncoding;
|
||||
|
||||
scriptValue = [NSString stringWithContentsOfFile:path
|
||||
usedEncoding:&usedEncoding
|
||||
error:&error];
|
||||
if (scriptValue)
|
||||
{
|
||||
GSWResponse_appendContentString(aResponse,scriptValue);
|
||||
|
@ -202,15 +208,20 @@ static Class standardClass = Nil;
|
|||
NSException* exception=nil;
|
||||
exception=[NSException exceptionWithName:NSInvalidArgumentException
|
||||
reason:[NSString stringWithFormat:
|
||||
@"Can't find script file '%@'",
|
||||
scriptFileName]
|
||||
@"Can't open script file '%@' - %@",
|
||||
scriptFileName, error]
|
||||
userInfo:nil];
|
||||
[exception raise];
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO
|
||||
NSException* exception=nil;
|
||||
exception=[NSException exceptionWithName:NSInvalidArgumentException
|
||||
reason:[NSString stringWithFormat:
|
||||
@"No script file name"]
|
||||
userInfo:nil];
|
||||
[exception raise];
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "GSWResponse.h"
|
||||
#include "GSWContext.h"
|
||||
|
||||
@interface GSWComponent : GSWElement <NSCopying>
|
||||
@interface GSWComponent : GSWElement <NSCopying, GSWActionResults>
|
||||
{
|
||||
//TODO ==> private @private
|
||||
NSString* _name;
|
||||
|
@ -157,7 +157,7 @@
|
|||
-(void)sleepInContext:(GSWContext*)aContext;
|
||||
-(void)appendToResponse:(GSWResponse*)aResponse
|
||||
inContext:(GSWContext*)aContext;
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)aContext;
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)aContext;
|
||||
|
@ -269,6 +269,5 @@ Call this method before using a component which was cached in a variable.
|
|||
|
||||
+(void)_registerObserver:(id)observer;
|
||||
|
||||
-(void)validateAPIAssociations;
|
||||
@end
|
||||
#endif //_GSWComponent_h__
|
||||
|
|
|
@ -85,9 +85,9 @@ static Class GSWHTMLBareStringClass = Nil;
|
|||
if (myClass == ([GSWComponent class])) {
|
||||
ASSIGN(_name, [aContext _componentName]);
|
||||
} else {
|
||||
ASSIGN(_name, [NSString stringWithCString:object_getClassName(self)]);
|
||||
ASSIGN(_name, NSStringFromClass([self class]));
|
||||
}
|
||||
ASSIGN(_templateName,[NSString stringWithCString:class_getName(myClass)]);
|
||||
ASSIGN(_templateName,NSStringFromClass(myClass));
|
||||
_isPage = NO;
|
||||
_subComponents = nil;
|
||||
[self setCachingEnabled:[GSWApp isCachingEnabled]];
|
||||
|
@ -901,18 +901,18 @@ static Class GSWHTMLBareStringClass = Nil;
|
|||
}
|
||||
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
-(id <GSWActionResults>) invokeActionForRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
id <GSWActionResults> results = nil;
|
||||
GSWElement * template = nil;
|
||||
GSWElement* element=nil;
|
||||
|
||||
NS_DURING
|
||||
|
||||
template = [self template];
|
||||
if (template != nil) {
|
||||
if ([template class] != GSWHTMLBareStringClass) {
|
||||
element=[template invokeActionForRequest:aRequest
|
||||
results = [template invokeActionForRequest:aRequest
|
||||
inContext:aContext];
|
||||
}
|
||||
}
|
||||
|
@ -922,7 +922,7 @@ static Class GSWHTMLBareStringClass = Nil;
|
|||
[localException raise];
|
||||
NS_ENDHANDLER
|
||||
|
||||
return element;
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1306,7 +1306,7 @@ Call this method before using a component which was cached in a variable.
|
|||
|
||||
[response setHTTPVersion:httpVersion];
|
||||
[response setHeader:@"text/html"
|
||||
forKey:@"content-type"];
|
||||
forKey:@"Content-Type"];
|
||||
[aContext _setResponse:response];
|
||||
|
||||
pageElement=[aContext _pageElement];
|
||||
|
@ -1467,7 +1467,6 @@ Call this method before using a component which was cached in a variable.
|
|||
__PRETTY_FUNCTION__);
|
||||
|
||||
url=[[GSWApp resourceManager] urlForResourceNamed:aName
|
||||
ofType:type
|
||||
inFramework:nil
|
||||
languages:[self languages]
|
||||
request:nil];
|
||||
|
@ -1487,7 +1486,6 @@ Call this method before using a component which was cached in a variable.
|
|||
__PRETTY_FUNCTION__);
|
||||
|
||||
path=[[GSWApp resourceManager] pathForResourceNamed:aName
|
||||
ofType:type
|
||||
inFramework:nil
|
||||
languages:[self languages]];
|
||||
|
||||
|
@ -1554,32 +1552,6 @@ Call this method before using a component which was cached in a variable.
|
|||
[self notImplemented: _cmd]; //TODOFN
|
||||
}
|
||||
|
||||
-(void)validateAPIAssociations
|
||||
{
|
||||
NSDictionary* api=[[self _componentDefinition] componentAPI];
|
||||
if (api)
|
||||
{
|
||||
NSArray* required=[api objectForKey:@"Required"];
|
||||
//TODO useit NSArray* optional=[api objectForKey:@"Optional"];
|
||||
int i=0;
|
||||
int count=[required count];
|
||||
id aName=nil;
|
||||
for(i=0;i<count;i++)
|
||||
{
|
||||
aName=[required objectAtIndex:i];
|
||||
if (![self hasBinding:aName])
|
||||
{
|
||||
[NSException raise:NSGenericException
|
||||
format:@"There is no binding for '%@' in parent '%@' for component '%@' [parents : %@]",
|
||||
aName,
|
||||
[_parent class],
|
||||
[self class],
|
||||
[self parentsClasses]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (id)unarchiver: (WOKeyValueUnarchiver*)archiver objectForReference: (id)keyPath
|
||||
{
|
||||
if ([keyPath isKindOfClass:[NSString class]])
|
||||
|
|
|
@ -80,7 +80,7 @@ static Class GSWHTMLBareStringClass = Nil;
|
|||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
GSWElement* element=nil;
|
||||
id <GSWActionResults, NSObject> element=nil;
|
||||
GSWComponent* component=nil;
|
||||
GSWComponent* parent=nil;
|
||||
GSWElement* childTemplate=nil;
|
||||
|
@ -93,7 +93,7 @@ static Class GSWHTMLBareStringClass = Nil;
|
|||
if ([childTemplate class] != GSWHTMLBareStringClass) {
|
||||
parent=[component parent];
|
||||
[aContext _setCurrentComponent:parent];
|
||||
element=[childTemplate invokeActionForRequest:request
|
||||
element = (id <GSWActionResults, NSObject>)[childTemplate invokeActionForRequest:request
|
||||
inContext:aContext];
|
||||
NSAssert3(!element || [element isKindOfClass:[GSWElement class]],
|
||||
@"childTemplate=%@ Element is a %@ not a GSWElement: %@",
|
||||
|
|
|
@ -99,18 +99,14 @@
|
|||
*/
|
||||
- (NSDictionary *) archive;
|
||||
|
||||
-(NSString*)pathForResourceNamed:(NSString*)aName
|
||||
ofType:(NSString*)aType
|
||||
languages:(NSArray*)languages;
|
||||
// does this exist in wo?
|
||||
//-(NSString*)pathForResourceNamed:(NSString*)aName
|
||||
// ofType:(NSString*)aType
|
||||
// languages:(NSArray*)languages;
|
||||
|
||||
- (GSWComponentReference*) componentReferenceWithAssociations:(NSDictionary*)associations
|
||||
template:(GSWElement*)template;
|
||||
|
||||
-(NSDictionary*)componentAPI;
|
||||
|
||||
//+ (id) copyWithZone: (NSZone*)z;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -169,52 +169,17 @@ RCS_ID("$Id$")
|
|||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
GSWElement* element=nil;
|
||||
// GSWComponent* component=nil;
|
||||
// GSWComponent* componentPrev=nil;
|
||||
id <GSWActionResults, NSObject> element=nil;
|
||||
|
||||
[self _pushComponentInContext:aContext];
|
||||
element = [GSWContext_component(aContext) invokeActionForRequest: request
|
||||
|
||||
element = (id <GSWActionResults, NSObject>) [GSWContext_component(aContext) invokeActionForRequest: request
|
||||
inContext: aContext];
|
||||
[self _popComponentFromContext:aContext];
|
||||
|
||||
return element;
|
||||
|
||||
//
|
||||
// GSWStartElement(aContext);
|
||||
// GSWAssertCorrectElementID(aContext);
|
||||
//
|
||||
// NSDebugMLLog(@"gswdync",@"name=%@ senderId=%@",
|
||||
// _name,GSWContext_senderID(aContext));
|
||||
//
|
||||
// componentPrev=GSWContext_component(aContext);
|
||||
// [self _pushComponentInContext:aContext];
|
||||
//
|
||||
// component=GSWContext_component(aContext);
|
||||
// if (component)
|
||||
// {
|
||||
// if ([self prefixMatchSenderIDInContext:aContext]) //Avoid trying to find action if we are not the good component
|
||||
// {
|
||||
// element=[component invokeActionForRequest:request
|
||||
// inContext:aContext];
|
||||
// NSAssert4(!element || [element isKindOfClass:[GSWElement class]],
|
||||
// @"Name= %@, from: %@, Element is a %@ not a GSWElement: %@",
|
||||
// _name,
|
||||
// component,
|
||||
// [element class],
|
||||
// element);
|
||||
// };
|
||||
// [self _popComponentFromContext:aContext];
|
||||
// }
|
||||
// else
|
||||
// [aContext _setCurrentComponent:componentPrev];
|
||||
//
|
||||
// GSWStopElement(aContext);
|
||||
// GSWAssertDebugElementIDsCount(aContext);
|
||||
//
|
||||
|
||||
// return element;
|
||||
};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
|
|
|
@ -160,7 +160,7 @@ GSWResponse * _dispatchWithPreparedPage(GSWComponent * aPage, GSWSession * aSess
|
|||
|
||||
[aResponse setHTTPVersion:[aRequest httpVersion]];
|
||||
[aResponse setHeader:@"text/html"
|
||||
forKey:@"content-type"];
|
||||
forKey:@"Content-Type"];
|
||||
[aContext _setResponse:aResponse];
|
||||
|
||||
if (oldContextID == nil) {
|
||||
|
@ -170,7 +170,8 @@ GSWResponse * _dispatchWithPreparedPage(GSWComponent * aPage, GSWSession * aSess
|
|||
[aContext _setPageChanged:NO];
|
||||
|
||||
if (aSenderID != nil) {
|
||||
GSWElement * anActionResults = [anApplication invokeActionForRequest:aRequest inContext:aContext];
|
||||
id <GSWActionResults, NSObject> anActionResults = (id <GSWActionResults, NSObject>) [anApplication invokeActionForRequest:aRequest
|
||||
inContext:aContext];
|
||||
|
||||
if ((anActionResults == nil) || ([anActionResults isKindOfClass: [GSWComponent class]])) {
|
||||
GSWComponent * aResultComponent = (GSWComponent*) anActionResults;
|
||||
|
|
|
@ -117,7 +117,7 @@ static Class standardClass = Nil;
|
|||
}
|
||||
}
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*) request
|
||||
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*) request
|
||||
inContext:(GSWContext*) context
|
||||
{
|
||||
GSWComponent * component = GSWContext_component(context);
|
||||
|
|
|
@ -146,16 +146,16 @@ NSString* GSWHTTPHeader_AdaptorStats[2] = { @"x-gsweb-adaptorstats", @"x-webobje
|
|||
|
||||
NSString* GSWHTTPHeader_MethodPost=@"POST";
|
||||
NSString* GSWHTTPHeader_MethodGet=@"GET";
|
||||
NSString* GSWHTTPHeader_AcceptLanguage=@"accept-language";
|
||||
NSString* GSWHTTPHeader_AcceptEncoding=@"accept-encoding";
|
||||
NSString* GSWHTTPHeader_ContentType=@"content-type";
|
||||
NSString* GSWHTTPHeader_AcceptLanguage=@"Accept-Language";
|
||||
NSString* GSWHTTPHeader_AcceptEncoding=@"Accept-Encoding";
|
||||
NSString* GSWHTTPHeader_ContentType=@"Content-Type";
|
||||
NSString* GSWHTTPHeader_FormURLEncoded=@"application/x-www-form-urlencoded";
|
||||
NSString* GSWHTTPHeader_MultipartFormData=@"multipart/form-data";
|
||||
NSString* GSWHTTPHeader_MimeType_TextPlain=@"text/plain";
|
||||
NSString* GSWHTTPHeader_UserAgent=@"user-agent";
|
||||
NSString* GSWHTTPHeader_Referer=@"referer";
|
||||
NSString* GSWHTTPHeader_UserAgent=@"User-Agent";
|
||||
NSString* GSWHTTPHeader_Referer=@"Referer";
|
||||
|
||||
NSString* GSWHTTPHeader_ContentLength=@"content-length";
|
||||
NSString* GSWHTTPHeader_ContentLength=@"Content-Length";
|
||||
|
||||
NSString* GSWHTTPHeader_Response_OK=@"OK";
|
||||
|
||||
|
|
|
@ -59,12 +59,12 @@ BOOL GSWDynamicElement_evaluateValueInContext(GSWDynamicElement* element,Class s
|
|||
GSWIMP_BOOL imp,GSWAssociation* condition,GSWContext* context)
|
||||
{
|
||||
// was object_get_class
|
||||
if (imp && object_getClass(element)==standardClass)
|
||||
{
|
||||
return (*imp)(element,evaluateConditionInContextSEL,
|
||||
condition,context);
|
||||
}
|
||||
else
|
||||
// if (imp && object_getClass(element)==standardClass)
|
||||
// {
|
||||
// return (*imp)(element,evaluateConditionInContextSEL,
|
||||
// condition,context);
|
||||
// }
|
||||
// else
|
||||
return [element evaluateCondition:condition
|
||||
inContext:context];
|
||||
};
|
||||
|
|
|
@ -64,11 +64,11 @@
|
|||
freeWhenDone:(BOOL)flag;
|
||||
-(id)initWithCharacters:(const unichar*)chars
|
||||
length:(NSUInteger)length;
|
||||
-(id)initWithCStringNoCopy:(char*)byteString
|
||||
length:(NSUInteger)length
|
||||
freeWhenDone:(BOOL)flag;
|
||||
-(id)initWithCString:(const char*)byteString
|
||||
length:(NSUInteger)length;
|
||||
//-(id)initWithCStringNoCopy:(char*)byteString
|
||||
// length:(NSUInteger)length
|
||||
// freeWhenDone:(BOOL)flag;
|
||||
//-(id)initWithCString:(const char*)byteString
|
||||
// length:(NSUInteger)length;
|
||||
-(id)initWithCString:(const char*)byteString;
|
||||
-(id)initWithString:(NSString*)string;
|
||||
-(id)initWithFormat:(NSString*)format,...;
|
||||
|
|
|
@ -97,31 +97,31 @@ static SEL appendStringSel = NULL;
|
|||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithCStringNoCopy:(char*)byteString
|
||||
length:(NSUInteger)length
|
||||
freeWhenDone:(BOOL)flag
|
||||
{
|
||||
_url = [(NSMutableString*) [NSMutableString alloc] initWithCStringNoCopy:byteString
|
||||
length:length
|
||||
freeWhenDone:flag];
|
||||
if (byteString) {
|
||||
[self _parse];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
//-(id)initWithCStringNoCopy:(char*)byteString
|
||||
// length:(NSUInteger)length
|
||||
// freeWhenDone:(BOOL)flag
|
||||
//{
|
||||
// _url = [(NSMutableString*) [NSMutableString alloc] initWithCStringNoCopy:byteString
|
||||
// length:length
|
||||
// freeWhenDone:flag];
|
||||
// if (byteString) {
|
||||
// [self _parse];
|
||||
// }
|
||||
// return self;
|
||||
//}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithCString:(const char*)byteString
|
||||
length:(NSUInteger)length;
|
||||
{
|
||||
_url = [(NSMutableString*) [NSMutableString alloc] initWithCString:byteString
|
||||
length:length];
|
||||
if (byteString) {
|
||||
[self _parse];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
//-(id)initWithCString:(const char*)byteString
|
||||
// length:(NSUInteger)length;
|
||||
//{
|
||||
// _url = [(NSMutableString*) [NSMutableString alloc] initWithCString:byteString
|
||||
// length:length];
|
||||
// if (byteString) {
|
||||
// [self _parse];
|
||||
// }
|
||||
//
|
||||
// return self;
|
||||
//}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)initWithCString:(const char*)byteString;
|
||||
|
@ -250,7 +250,7 @@ static SEL appendStringSel = NULL;
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
- (unichar) characterAtIndex: (unsigned)index
|
||||
- (unichar)characterAtIndex:(NSUInteger)index
|
||||
{
|
||||
if (!_flags.composed)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "GSWDefines.h"
|
||||
#include "GSWConstants.h"
|
||||
#include "GSWUtils.h"
|
||||
#include "GSWResponse.h"
|
||||
|
||||
GSWEB_EXPORT BYTE ElementsMap_htmlBareString;
|
||||
GSWEB_EXPORT BYTE ElementsMap_gswebElement;
|
||||
|
@ -147,8 +148,11 @@ GSWEB_EXPORT BYTE ElementsMap_attributeElement;
|
|||
-(void)appendToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
-(id <GSWActionResults>) invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)aContext;
|
||||
|
||||
//-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
// inContext:(GSWContext*)context;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
|
|
@ -197,7 +197,7 @@ BYTE ElementsMap_attributeElement = (BYTE)0x41; // 'A'
|
|||
//--------------------------------------------------------------------
|
||||
// invokeActionForRequest:inContext:
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//Does Nothing
|
||||
|
|
|
@ -33,6 +33,12 @@
|
|||
#define _GSWFileUpload_h__
|
||||
|
||||
//====================================================================
|
||||
/*
|
||||
|
||||
if multiple is yes, filepath, mimeType and data will be in arrays.
|
||||
|
||||
*/
|
||||
|
||||
@interface GSWFileUpload: GSWInput
|
||||
{
|
||||
GSWAssociation* _data;
|
||||
|
@ -46,7 +52,8 @@
|
|||
GSWAssociation* _streamToFilePath;
|
||||
GSWAssociation* _overwrite;
|
||||
GSWAssociation* _finalFilePath;
|
||||
|
||||
// new in modern browsers
|
||||
GSWAssociation* _multiple;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -89,6 +89,11 @@ RCS_ID("$Id$")
|
|||
}
|
||||
*/
|
||||
|
||||
ASSIGN(_multiple, [_associations objectForKey: multiple__Key]);
|
||||
if (_multiple != nil) {
|
||||
[_associations removeObjectForKey: multiple__Key];
|
||||
}
|
||||
|
||||
if (((_data == nil) && (_filepath == nil)) || ((_data != nil) && (![_data isValueSettable])) ||
|
||||
((_filepath != nil) && (![_filepath isValueSettable]))) {
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
|
@ -111,6 +116,7 @@ RCS_ID("$Id$")
|
|||
DESTROY(_streamToFilePath);
|
||||
DESTROY(_overwrite);
|
||||
DESTROY(_finalFilePath);
|
||||
DESTROY(_multiple);
|
||||
|
||||
[super dealloc];
|
||||
};
|
||||
|
@ -124,7 +130,13 @@ RCS_ID("$Id$")
|
|||
-(void) _appendValueAttributeToResponse:(GSWResponse *) response
|
||||
inContext:(GSWContext*) context
|
||||
{
|
||||
// nothing!
|
||||
GSWComponent * component = GSWContext_component(context);
|
||||
|
||||
if (_multiple != nil && ([_multiple boolValueInComponent:component])) {
|
||||
GSWResponse_appendContentCharacter(response,' ');
|
||||
GSWResponse_appendContentAsciiString(response,@"multiple");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-(void) _appendCloseTagToResponse:(GSWResponse *) response
|
||||
|
@ -134,87 +146,79 @@ RCS_ID("$Id$")
|
|||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
//Bypass GSWInput
|
||||
return nil;
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
"7.1.filename" = (
|
||||
"15072009(002).jpg",
|
||||
"31082009.jpg"
|
||||
);
|
||||
"7.3" = (
|
||||
Submit
|
||||
);
|
||||
*/
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
GSWComponent * component = GSWContext_component(context);
|
||||
if ((![self disabledInComponent: component]) && ([context _wasFormSubmitted])) {
|
||||
if ((![self disabledInComponent: component]) && ([context _wasFormSubmitted]))
|
||||
{
|
||||
GSWComponent * component=nil;
|
||||
NSString * nameInContext=nil;
|
||||
NSArray * fileDatas=nil;
|
||||
NSString * fileNameFormValueName=nil;
|
||||
NSString* fileNameValue=nil;
|
||||
NSData* dataValue=nil;
|
||||
int fileDatasCount=0;
|
||||
NSString * mimeValueName=nil;
|
||||
NSUInteger fileDatasCount=0;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
component=GSWContext_component(context);
|
||||
nameInContext=[self nameInContext:context];
|
||||
fileDatas=[request formValuesForKey:nameInContext];
|
||||
fileDatasCount=[fileDatas count];
|
||||
/*
|
||||
if (_fileDatasCount!=1)
|
||||
{
|
||||
ExceptionRaise(@"GSWFileUpload",
|
||||
@"GSWFileUpload: File Data Nb != 1 :%d",
|
||||
_fileDatasCount);
|
||||
};
|
||||
*/
|
||||
if (fileDatasCount==1)
|
||||
{
|
||||
dataValue=[fileDatas objectAtIndex:0];
|
||||
if (dataValue)
|
||||
{
|
||||
if ([dataValue isKindOfClass:[NSData class]])
|
||||
{
|
||||
if ([dataValue length]==0)
|
||||
{
|
||||
// LOGError(@"Empty Data: %@",dataValue);
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([dataValue isKindOfClass:[NSString class]] && [dataValue length]==0)
|
||||
{
|
||||
// LOGError(@"No Data: %@",dataValue);
|
||||
dataValue=nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
};
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
// LOGError0(@"No Data:");
|
||||
};
|
||||
|
||||
fileNameFormValueName = [NSString stringWithFormat:@"%@.filename", nameInContext];
|
||||
fileNameValue=[request formValueForKey:fileNameFormValueName];
|
||||
if (!fileNameValue || [fileNameValue length]==0)
|
||||
mimeValueName = [NSString stringWithFormat:@"%@.%@",nameInContext, @"content-type"];
|
||||
|
||||
fileDatas = [request formValuesForKey:nameInContext];
|
||||
|
||||
fileDatasCount = [fileDatas count];
|
||||
|
||||
if (fileDatasCount >= 1)
|
||||
{
|
||||
//LOGError(@"No fileName: %@",fileNameValue);
|
||||
};
|
||||
NSArray * fileNameValue = [request formValuesForKey:fileNameFormValueName];
|
||||
NSArray * mimeValue = [request formValuesForKey:mimeValueName];;
|
||||
|
||||
if ([[fileNameValue objectAtIndex:0] length] == 0) {
|
||||
fileNameValue = nil;
|
||||
fileDatas = nil;
|
||||
mimeValue = nil;
|
||||
}
|
||||
|
||||
if (_multiple != nil && ([_multiple boolValueInComponent:component])) {
|
||||
[_filepath setValue:fileNameValue
|
||||
inComponent:component];
|
||||
[_data setValue:dataValue
|
||||
|
||||
[_data setValue:fileDatas
|
||||
inComponent:component];
|
||||
|
||||
[_mimeType setValue:mimeValue
|
||||
inComponent:component];
|
||||
} else {
|
||||
|
||||
[_filepath setValue:[fileNameValue objectAtIndex:0]
|
||||
inComponent:component];
|
||||
|
||||
[_data setValue:[fileDatas objectAtIndex:0]
|
||||
inComponent:component];
|
||||
|
||||
[_mimeType setValue:[mimeValue objectAtIndex:0]
|
||||
inComponent:component];
|
||||
}
|
||||
else
|
||||
{
|
||||
// bug in omniweb-browser if you click cancel in FileOpenPanel, it transmits incorrect datas
|
||||
|
||||
[_filepath setValue:nil
|
||||
inComponent:component];
|
||||
[_data setValue:nil
|
||||
inComponent:component];
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
|
@ -222,10 +226,10 @@ RCS_ID("$Id$")
|
|||
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
|
||||
@"GSWFileUpload in takeValuesFromRequest");
|
||||
[localException raise];
|
||||
};
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -51,9 +51,6 @@
|
|||
-(void)appendToResponse:(GSWResponse*)aResponse
|
||||
inContext:(GSWContext*)aContext;
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)aContext;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)aContext;
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ static Class GSWHTMLBareStringClass = Nil;
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
|
||||
|
@ -172,7 +172,7 @@ static Class GSWHTMLBareStringClass = Nil;
|
|||
inContext:aContext];
|
||||
}
|
||||
return nil;
|
||||
};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -103,11 +103,16 @@ BOOL canBeOnSegment(NSPoint m,NSPoint a,NSPoint b)
|
|||
+(NSArray*)geometricRegionsWithFile:(NSString*)fileName
|
||||
{
|
||||
NSArray * regions = nil;
|
||||
NSString* string=[NSString stringWithContentsOfFile:fileName];
|
||||
NSStringEncoding usedEncoding;
|
||||
NSError * error = nil;
|
||||
|
||||
NSString* string=[NSString stringWithContentsOfFile:fileName
|
||||
usedEncoding:&usedEncoding
|
||||
error:&error];
|
||||
if (!string)
|
||||
{
|
||||
ExceptionRaise(@"GSWGeometricRegion: Can't open File '%@'",
|
||||
fileName);
|
||||
ExceptionRaise(@"GSWGeometricRegion: Can't open File '%@' %@",
|
||||
fileName, error);
|
||||
}
|
||||
else
|
||||
regions=[self geometricRegionsWithString:string];
|
||||
|
|
|
@ -92,7 +92,7 @@ RCS_ID("$Id$")
|
|||
{
|
||||
}
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
|
||||
|
|
|
@ -395,7 +395,7 @@ static Class GSWHTMLBareStringClass = Nil;
|
|||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
GSWElement* element=nil;
|
||||
id <GSWActionResults, NSObject> element=nil;
|
||||
BOOL searchIsOver=NO;
|
||||
NSString* senderID=nil;
|
||||
int length=0;
|
||||
|
@ -430,7 +430,7 @@ id currentEl = nil;
|
|||
currentEl = (*objectAtIndexIMP)(aDynamicChildrensArray,objectAtIndexSEL,elementsN[1]);
|
||||
if ([currentEl class] != GSWHTMLBareStringClass) {
|
||||
|
||||
element=[currentEl invokeActionForRequest:request
|
||||
element = (id <GSWActionResults, NSObject>) [currentEl invokeActionForRequest:request
|
||||
inContext:aContext];
|
||||
|
||||
NSAssert3(!element || [element isKindOfClass:[GSWElement class]],
|
||||
|
|
|
@ -188,7 +188,7 @@ RCS_ID("$Id$")
|
|||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
GSWElement* element = nil;
|
||||
id <GSWActionResults, NSObject> element = nil;
|
||||
NSString* senderID = nil;
|
||||
NSString* elementID = nil;
|
||||
GSWComponent * component = nil;
|
||||
|
@ -211,7 +211,7 @@ RCS_ID("$Id$")
|
|||
}
|
||||
}
|
||||
} else {
|
||||
element = [super invokeActionForRequest: aRequest inContext: context];
|
||||
element = (id <GSWActionResults, NSObject>) [super invokeActionForRequest: aRequest inContext: context];
|
||||
}
|
||||
return element;
|
||||
};
|
||||
|
|
|
@ -49,8 +49,7 @@
|
|||
#define READ_SIZE 2048
|
||||
|
||||
static NSString *URIResponseString = @" GNUstep Web\r\n";
|
||||
static NSString *CONTENT_LENGTH = @"content-length";
|
||||
static NSString *CONTENT_LENGTHCOLON = @"content-length: ";
|
||||
static NSString *CONTENT_LENGTHCOLON = @"Content-Length: ";
|
||||
static NSString *GET = @"GET";
|
||||
static NSString *POST = @"POST";
|
||||
static NSString *HEAD = @"HEAD";
|
||||
|
@ -59,7 +58,7 @@ static NSString *HEADERSEP = @": ";
|
|||
static NSString *NEWLINE = @"\r\n";
|
||||
static NSString *NEWLINE2 = @"\r\n";
|
||||
static NSString *HTTP11 = @"HTTP/1.1";
|
||||
static NSString *CONNECTION = @"connection";
|
||||
static NSString *CONNECTION = @"Connection";
|
||||
static NSString *KEEP_ALIVE = @"keep-alive";
|
||||
static BOOL _alwaysAppendContentLength = YES;
|
||||
|
||||
|
@ -139,7 +138,8 @@ void _unpackHeaderLineAddToDict(NSString *line, NSMutableDictionary* headers)
|
|||
if ((components) && ([components count] == 2)) {
|
||||
value = [components objectAtIndex:1];
|
||||
key = [components objectAtIndex:0];
|
||||
key = [[key stringByTrimmingSpaces] lowercaseString];
|
||||
|
||||
key = [key stringByTrimmingSpaces];
|
||||
|
||||
if ([key isEqualToString:GSWHTTPHeader_AdaptorVersion[GSWNAMES_INDEX]]
|
||||
|| [key isEqualToString:GSWHTTPHeader_ServerName[GSWNAMES_INDEX]]) {
|
||||
|
@ -180,7 +180,7 @@ void _appendMessageHeaders(GSWResponse * message,NSMutableString * headers)
|
|||
if (![headerDict isKindOfClass:[NSMutableDictionary class]]) {
|
||||
headerDict = [[headerDict mutableCopy] autorelease];
|
||||
}
|
||||
[headerDict removeObjectForKey:CONTENT_LENGTH];
|
||||
[headerDict removeObjectForKey:GSWHTTPHeader_ContentLength];
|
||||
keyArray = [headerDict allKeys];
|
||||
count = [keyArray count];
|
||||
|
||||
|
@ -237,9 +237,9 @@ void _sendMessage(GSWResponse * message, NSFileHandle* fh, NSString * httpVersio
|
|||
// I am uable to reproduce the need for double clicking on links/forms,
|
||||
// but for now, we send close. -- dw
|
||||
if (YES /*keepAlive == NO*/) {
|
||||
[headers appendString:@"connection: close\r\n"];
|
||||
[headers appendString:@"Connection: close\r\n"];
|
||||
} else {
|
||||
[headers appendString:@"connection: keep-alive\r\n"];
|
||||
[headers appendString:@"Connection: keep-alive\r\n"];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -397,7 +397,7 @@ void _sendMessage(GSWResponse * message, NSFileHandle* fh, NSString * httpVersio
|
|||
method = [requestArray objectAtIndex:0];
|
||||
|
||||
|
||||
if ((tmpValue = [headers objectForKey:CONTENT_LENGTH]) && ([tmpValue count])) {
|
||||
if ((tmpValue = [headers objectForKey:GSWHTTPHeader_ContentLength]) && ([tmpValue count])) {
|
||||
NSString * tmpString = [tmpValue objectAtIndex:0];
|
||||
|
||||
contentLength = [tmpString intValue];
|
||||
|
|
|
@ -72,9 +72,6 @@
|
|||
-(void)_appendDirectActionToResponse:(GSWResponse*)response
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context;
|
||||
|
||||
|
|
|
@ -388,18 +388,18 @@ RCS_ID("$Id$")
|
|||
|
||||
// todo: check if 100% compatible
|
||||
//--------------------------------------------------------------------
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
GSWElement* element=nil;
|
||||
id <GSWActionResults, NSObject> element=nil;
|
||||
NSString* senderID=nil;
|
||||
NSString* elementID=nil;
|
||||
BOOL isInForm=NO;
|
||||
BOOL XYValues=NO;
|
||||
BOOL thisOne=NO;
|
||||
GSWComponent* component=nil;
|
||||
int x=0;
|
||||
int y=0;
|
||||
NSInteger x=0;
|
||||
NSInteger y=0;
|
||||
component=GSWContext_component(aContext);
|
||||
GSWContext_appendZeroElementIDComponent(aContext);
|
||||
senderID=GSWContext_senderID(aContext);
|
||||
|
@ -534,11 +534,11 @@ RCS_ID("$Id$")
|
|||
element=[aContext page];
|
||||
}
|
||||
else
|
||||
element=[super invokeActionForRequest:request
|
||||
element = (id <GSWActionResults, NSObject>) [super invokeActionForRequest:request
|
||||
inContext:aContext];
|
||||
}
|
||||
else
|
||||
element=[super invokeActionForRequest:request
|
||||
element = (id <GSWActionResults, NSObject>) [super invokeActionForRequest:request
|
||||
inContext:aContext];
|
||||
return element;
|
||||
};
|
||||
|
|
|
@ -265,10 +265,11 @@ static GSWMailDelivery *sharedInstance;
|
|||
// -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=[sendmailPath stringByAppendingString:@" -i -t"];
|
||||
sendmailFile=popen([sendmailCommand lossyCString],"w");
|
||||
sendmailFile=popen([sendmailCommand UTF8String],"w");
|
||||
if (sendmailFile)
|
||||
{
|
||||
const char* cString=[emailString lossyCString];
|
||||
const char* cString=[[emailString dataUsingEncoding:NSASCIIStringEncoding
|
||||
allowLossyConversion:YES] bytes];
|
||||
size_t len=strlen(cString);
|
||||
size_t written=fwrite(cString, sizeof(char),len,sendmailFile);
|
||||
if (written!=len)
|
||||
|
|
|
@ -298,7 +298,7 @@ void initGSWMessageDataCache(void)
|
|||
{
|
||||
cstring[0] = (char)i;
|
||||
myNSString = [NSString stringWithCString:cstring
|
||||
length:1];
|
||||
encoding:NSASCIIStringEncoding];
|
||||
myData = [myNSString dataUsingEncoding:NSASCIIStringEncoding
|
||||
allowLossyConversion:YES];
|
||||
[myData retain];
|
||||
|
@ -830,15 +830,19 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
|
|||
|
||||
if (!myData)
|
||||
{
|
||||
NSData *lossyData = [aValue dataUsingEncoding:_contentEncoding
|
||||
allowLossyConversion:YES];
|
||||
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"%s: could not convert '%s' non-lossy to encoding %i",
|
||||
__PRETTY_FUNCTION__, [aValue lossyCString],_contentEncoding];
|
||||
__PRETTY_FUNCTION__, [lossyData bytes], _contentEncoding];
|
||||
}
|
||||
|
||||
_checkBody(self);
|
||||
(*_contentDataADImp)(_contentData,appendDataSel,myData);
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
#warning check this. -- dw
|
||||
// Caching management
|
||||
if (_currentCacheData)
|
||||
{
|
||||
|
@ -884,11 +888,19 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
|
|||
|
||||
if (!myData)
|
||||
{
|
||||
NSString* string=[NSString stringWithCString:&aChar
|
||||
length:1];
|
||||
if (string)
|
||||
char string[2];
|
||||
|
||||
string[0] = aChar;
|
||||
string[1] = '\0';
|
||||
|
||||
NSString* nsstring=[NSString stringWithCString:string
|
||||
encoding:_contentEncoding];
|
||||
|
||||
NSLog(@"%s - '%s' '%@'",__PRETTY_FUNCTION__, string, nsstring);
|
||||
|
||||
if (nsstring)
|
||||
{
|
||||
GSWMessage_appendContentString(self,string);
|
||||
GSWMessage_appendContentString(self,nsstring);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -902,10 +914,10 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
|
|||
{
|
||||
assertCurrentCacheDataADImp();
|
||||
(*_currentCacheDataADImp)(_currentCacheData,appendDataSel,myData);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(int)_contentLength
|
||||
|
|
|
@ -186,11 +186,16 @@ NSString* formattedByteSizeValue(unsigned int value)
|
|||
{
|
||||
NSString * path;
|
||||
NSString * content;
|
||||
NSStringEncoding usedEncoding;
|
||||
NSError * error = nil;
|
||||
|
||||
path = [NSString stringWithFormat: @"/proc/%@", procFile];
|
||||
content = [NSString stringWithContentsOfFile: path];
|
||||
|
||||
if ([content length] == 0)
|
||||
content = [NSString stringWithContentsOfFile:path
|
||||
usedEncoding:&usedEncoding
|
||||
error:&error];
|
||||
|
||||
if (!content)
|
||||
{
|
||||
//LOGSeriousError(@"Read (%@) attempt failed", path);
|
||||
}
|
||||
|
@ -217,7 +222,7 @@ NSString* formattedByteSizeValue(unsigned int value)
|
|||
|
||||
if (pidstat)
|
||||
{
|
||||
const char* statsChars=[pidstat cString];
|
||||
const char* statsChars=[pidstat UTF8String];
|
||||
if (sscanf(statsChars, "%ld %ld %ld %ld %ld %ld %ld",
|
||||
&_pagesNb,//size
|
||||
&_residentPagesNb,//resident
|
||||
|
@ -242,7 +247,7 @@ NSString* formattedByteSizeValue(unsigned int value)
|
|||
NSRange cmdEnd=[pidstat rangeOfString:@") "];
|
||||
if (cmdEnd.length>0)
|
||||
{
|
||||
NSString* pid_cmd=[pidstat substringToIndex:cmdEnd.location];
|
||||
// NSString* pid_cmd=[pidstat substringToIndex:cmdEnd.location];
|
||||
|
||||
if (cmdEnd.location+cmdEnd.length<[pidstat length])
|
||||
{
|
||||
|
@ -254,7 +259,7 @@ NSString* formattedByteSizeValue(unsigned int value)
|
|||
memset(P->cmd, 0, sizeof P->cmd); // clear even though *P xcalloc'd ?!
|
||||
sscanf(S, "%d (%39c", &P->pid, P->cmd);
|
||||
*/
|
||||
const char* statsChars=[stats cString];
|
||||
const char* statsChars=[stats UTF8String];
|
||||
char cState;
|
||||
long utime;
|
||||
long stime;
|
||||
|
|
|
@ -82,11 +82,14 @@ RCS_ID("$Id$")
|
|||
|
||||
ASSIGN(_recordingPath,recordingPath);
|
||||
NSDebugMLog(@"_recordingPath=%@",_recordingPath);
|
||||
NSError *error = nil;
|
||||
|
||||
if (![fileManager createDirectoryAtPath:_recordingPath
|
||||
attributes:nil])
|
||||
if (![fileManager createDirectoryAtURL:[NSURL fileURLWithPath:_recordingPath]
|
||||
withIntermediateDirectories:YES
|
||||
attributes:nil
|
||||
error:&error])
|
||||
{
|
||||
ExceptionRaise(@"GSWRecording: can't create directory '%@'",_recordingPath);
|
||||
ExceptionRaise(@"GSWRecording: can't create directory '%@' - %@",_recordingPath, error);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -223,6 +226,7 @@ RCS_ID("$Id$")
|
|||
{
|
||||
NSString * headerString = nil;
|
||||
NSString * requestString = nil;
|
||||
NSError * error = nil;
|
||||
|
||||
NSString* requestURI=[_request uri];
|
||||
NSString* filePath= [_recordingPath stringByAppendingPathComponent:
|
||||
|
@ -239,8 +243,10 @@ RCS_ID("$Id$")
|
|||
requestString = [headerString stringByAppendingString:[request contentString]];
|
||||
|
||||
[requestString writeToFile:filePath
|
||||
atomically:NO];
|
||||
};
|
||||
atomically:NO
|
||||
encoding:NSUTF8StringEncoding
|
||||
error:&error];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -250,6 +256,7 @@ RCS_ID("$Id$")
|
|||
NSString* filePath=nil;
|
||||
NSString* responseString=nil;
|
||||
NSString* headerString=nil;
|
||||
NSError * error = nil;
|
||||
|
||||
|
||||
NSDebugMLog(@"_recordingStep=%d",_recordingStep);
|
||||
|
@ -275,7 +282,10 @@ RCS_ID("$Id$")
|
|||
responseString = [headerString stringByAppendingString:[response contentString]];
|
||||
|
||||
[responseString writeToFile:filePath
|
||||
atomically:NO];
|
||||
atomically:NO
|
||||
encoding:NSUTF8StringEncoding
|
||||
error:&error];
|
||||
|
||||
_recordingStep++;
|
||||
|
||||
NSDebugMLog(@"_recordingStep=%d",_recordingStep);
|
||||
|
|
|
@ -222,11 +222,11 @@ static inline NSString* _indexStringForSenderAndElement(NSString * senderStr, NS
|
|||
}
|
||||
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)context
|
||||
{
|
||||
GSWComponent * component = GSWContext_component(context);
|
||||
GSWElement * element = nil;
|
||||
id <GSWActionResults, NSObject> element = nil;
|
||||
NSString * indexStr = nil;
|
||||
|
||||
NSString * senderID = [context senderID];
|
||||
|
@ -266,7 +266,7 @@ static inline NSString* _indexStringForSenderAndElement(NSString * senderStr, NS
|
|||
inComponent:component];
|
||||
}
|
||||
[context appendElementIDComponent: indexStr];
|
||||
element = [super invokeActionForRequest:request
|
||||
element = (id <GSWActionResults, NSObject>) [super invokeActionForRequest:request
|
||||
inContext:context];
|
||||
[context deleteLastElementIDComponent];
|
||||
} else {
|
||||
|
@ -287,7 +287,7 @@ static inline NSString* _indexStringForSenderAndElement(NSString * senderStr, NS
|
|||
|
||||
for (k = 0; k < count && element == nil; k++) {
|
||||
_prepareForIterationWithIndex(k, count, arrayValue, context, component, _item, _index);
|
||||
element = [super invokeActionForRequest:request
|
||||
element = (id <GSWActionResults, NSObject>) [super invokeActionForRequest:request
|
||||
inContext:context];
|
||||
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ Cf RFC 2616 (http://www.rfc-editor.org/rfc/rfc2616.txt)
|
|||
-(NSArray*)browserLanguages;
|
||||
-(NSArray*)browserAcceptedEncodings;
|
||||
-(NSArray*)requestHandlerPathArray;
|
||||
-(NSString*)uri;
|
||||
-(GSWDynamicURLString*) uri;
|
||||
-(NSString*)urlProtocol;//NDFN
|
||||
-(NSString*)urlHost;//NDFN
|
||||
-(NSString*)urlPortString;//NDFN
|
||||
|
|
|
@ -813,7 +813,6 @@ RCS_ID("$Id$")
|
|||
-(void)appendFormValue:(id)value
|
||||
forKey:(NSString*)key
|
||||
{
|
||||
|
||||
if (value)
|
||||
{
|
||||
NSMutableDictionary* formValues=nil;
|
||||
|
@ -1494,7 +1493,7 @@ RCS_ID("$Id$")
|
|||
}
|
||||
else
|
||||
{
|
||||
//NSDebugMLLog(@"requests",@"contentType=%@",contentType);
|
||||
NSLog(@"%s contentType=%@",__PRETTY_FUNCTION__, contentType);
|
||||
};
|
||||
_finishedParsingMultipartFormData=YES;
|
||||
};
|
||||
|
@ -1643,6 +1642,7 @@ RCS_ID("$Id$")
|
|||
contentDispositionHeader=[aDoc headerNamed:@"content-disposition"];
|
||||
contentDispositionValue=[contentDispositionHeader value];
|
||||
contentDispositionParams=[contentDispositionHeader parameters];
|
||||
|
||||
if ([contentDispositionValue isEqual:@"form-data"])
|
||||
{
|
||||
NSString* formDataName=[contentDispositionParams objectForKey:@"name"];
|
||||
|
@ -1661,21 +1661,44 @@ RCS_ID("$Id$")
|
|||
if (![paramName isEqualToString:@"name"])
|
||||
{
|
||||
NSArray * previous = nil;
|
||||
NSArray * prevContentType = nil;
|
||||
NSString * paramFormValueName = nil;
|
||||
NSString * typeFormValueName = nil;
|
||||
NSString * contentType = nil;
|
||||
id paramValue = nil;
|
||||
|
||||
paramValue = [contentDispositionParams objectForKey:paramName];
|
||||
|
||||
paramFormValueName = [NSString stringWithFormat:@"%@.%@",formDataName,paramName];
|
||||
previous = [formValues objectForKey:paramFormValueName];
|
||||
typeFormValueName = [NSString stringWithFormat:@"%@.%@",formDataName, @"content-type"];
|
||||
prevContentType = [formValues objectForKey:typeFormValueName];
|
||||
|
||||
if (previous)
|
||||
contentType = [NSString stringWithFormat:@"%@/%@",
|
||||
[aDoc contentType],
|
||||
[aDoc contentSubtype]];
|
||||
|
||||
if (prevContentType) {
|
||||
[formValues setObject:[prevContentType arrayByAddingObject:contentType]
|
||||
forKey:typeFormValueName];
|
||||
} else {
|
||||
[formValues setObject:[NSArray arrayWithObject:contentType]
|
||||
forKey:typeFormValueName];
|
||||
}
|
||||
|
||||
if (previous) {
|
||||
if (paramValue) {
|
||||
[formValues setObject:[previous arrayByAddingObject:paramValue]
|
||||
forKey:paramFormValueName];
|
||||
else
|
||||
}
|
||||
} else {
|
||||
if (paramValue) {
|
||||
[formValues setObject:[NSArray arrayWithObject:paramValue]
|
||||
forKey:paramFormValueName];
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (aDocContent)
|
||||
{
|
||||
NSArray* previous=[formValues objectForKey:formDataName];
|
||||
|
|
|
@ -44,7 +44,7 @@ RCS_ID("$Id$")
|
|||
|
||||
[aResponse setStatus:404];
|
||||
[aResponse setHeader:@"0"
|
||||
forKey:@"content-length"];
|
||||
forKey:GSWHTTPHeader_ContentLength];
|
||||
return aResponse;
|
||||
}
|
||||
|
||||
|
@ -112,8 +112,8 @@ RCS_ID("$Id$")
|
|||
{
|
||||
GSWResponse * response=nil;
|
||||
NSString * wodataValue=nil;
|
||||
NSDictionary * elements=nil;
|
||||
NSString * uri = nil;
|
||||
// NSDictionary * elements=nil;
|
||||
GSWDynamicURLString * uri = nil;
|
||||
NSString * urlRequestHandlerPath = nil;
|
||||
NSString * filePath = nil;
|
||||
|
||||
|
@ -174,6 +174,8 @@ RCS_ID("$Id$")
|
|||
timeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]
|
||||
locale:nil];
|
||||
|
||||
NSLog(@"dateString is %@", dateString);
|
||||
|
||||
aResponse = [GSWApp createResponseInContext:nil];
|
||||
|
||||
[aResponse setHeader:dateString
|
||||
|
@ -204,7 +206,7 @@ RCS_ID("$Id$")
|
|||
if (contentType)
|
||||
{
|
||||
[aResponse setHeader:contentType
|
||||
forKey:@"content-type"];
|
||||
forKey:@"Content-Type"];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ GSWEB_EXPORT void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(
|
|||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWResponse : GSWMessage
|
||||
@interface GSWResponse: GSWMessage <GSWActionResults>
|
||||
{
|
||||
@private
|
||||
unsigned int _status;
|
||||
|
|
|
@ -205,11 +205,11 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
|
|||
if (!_isClientCachingDisabled && _canDisableClientCaching)
|
||||
{
|
||||
[self setHeader:disabledCacheDateString
|
||||
forKey:@"date"];
|
||||
forKey:@"Date"];
|
||||
[self setHeader:disabledCacheDateString
|
||||
forKey:@"expires"];
|
||||
forKey:@"Expires"];
|
||||
[self setHeader:@"no-cache"
|
||||
forKey:@"pragma"];
|
||||
forKey:@"Pragma"];
|
||||
|
||||
if([[GSWApp class] _allowsCacheControlHeader])
|
||||
[self setHeaders:cacheControlHeaderValues
|
||||
|
@ -262,7 +262,7 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
|
|||
NSString *value;
|
||||
NSRange range;
|
||||
|
||||
if (aRequest && ((value = [aRequest headerForKey:@"accept-encoding"]))) {
|
||||
if (aRequest && ((value = [aRequest headerForKey:GSWHTTPHeader_AcceptEncoding]))) {
|
||||
range = [value rangeOfString:@"gzip" options:0];
|
||||
|
||||
if (range.length) {
|
||||
|
@ -293,8 +293,8 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
|
|||
// it does not make sense to compress data less than 150 bytes.
|
||||
if ((dataLength > 150) && ([self _browserSupportsCompression:[aContext request]]))
|
||||
{
|
||||
NSString* contentType=[self headerForKey:@"content-type"];
|
||||
NSString* contentEncoding=[self headerForKey:@"content-encoding"];
|
||||
NSString* contentType=[self headerForKey:@"Content-Type"];
|
||||
NSString* contentEncoding=[self headerForKey:@"Content-Encoding"];
|
||||
|
||||
if ((contentEncoding) || (!compressableContentTypesCache)) {
|
||||
return;
|
||||
|
@ -322,7 +322,7 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
|
|||
[self setContent:compressedData];
|
||||
dataLength=[self _contentLength];
|
||||
[self setHeader:@"gzip"
|
||||
forKey:@"content-encoding"];
|
||||
forKey:@"Content-Encoding"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ escapingHTMLAttributeValue:(BOOL)escape
|
|||
if (httpVersion)
|
||||
[aResponse setHTTPVersion:httpVersion];
|
||||
[aResponse setHeader:@"text/html"
|
||||
forKey:@"content-type"];
|
||||
forKey:@"Content-Type"];
|
||||
[aContext _setResponse:aResponse];
|
||||
responseString=[NSString stringWithFormat:@"<HTML>\n<TITLE>GNUstepWeb Error</TITLE>\n</HEAD>\n<BODY bgcolor=\"white\">\n<CENTER>\n%@\n</CENTER>\n</BODY>\n</HTML>\n",
|
||||
GSWResponse_stringByEscapingHTMLString(aResponse,aMessage)];
|
||||
|
@ -553,7 +553,7 @@ escapingHTMLAttributeValue:(BOOL)escape
|
|||
[self setHeader:location
|
||||
forKey:@"Location"];
|
||||
[self setHeader:@"text/html"
|
||||
forKey:@"content-type"];
|
||||
forKey:@"Content-Type"];
|
||||
[self setHeader:@"YES"
|
||||
forKey:@"x-gsweb-refusing-redirection"];
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ Returns first element of languages or nil if languages is empty
|
|||
-(void)takeValuesFromRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)aContext;
|
||||
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)aContext;
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)aResponse
|
||||
|
|
|
@ -1339,10 +1339,10 @@ Returns first element of languages or nil if languages is empty
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
// invokeActionForRequest:inContext:
|
||||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
|
||||
-(id <GSWActionResults>) invokeActionForRequest:(GSWRequest*)aRequest
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
GSWElement* element=nil;
|
||||
id <GSWActionResults> results = nil;
|
||||
GSWElement* pageElement=nil;
|
||||
GSWComponent* pageComponent=nil;
|
||||
|
||||
|
@ -1351,7 +1351,7 @@ Returns first element of languages or nil if languages is empty
|
|||
pageComponent = [aContext _pageComponent];
|
||||
[aContext _setCurrentComponent:pageComponent];
|
||||
|
||||
element=[pageElement invokeActionForRequest:aRequest
|
||||
results = [pageElement invokeActionForRequest:aRequest
|
||||
inContext:aContext];
|
||||
[aContext _setCurrentComponent:nil];
|
||||
NS_HANDLER
|
||||
|
@ -1360,7 +1360,7 @@ Returns first element of languages or nil if languages is empty
|
|||
[localException raise];
|
||||
NS_ENDHANDLER;
|
||||
|
||||
return element;
|
||||
return results;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
@ -59,10 +59,12 @@ RCS_ID("$Id$")
|
|||
NSString* documentRoot = [self _documentRoot];
|
||||
[resourcePath appendString:documentRoot];
|
||||
[resourcePath appendString:uri];
|
||||
NSError *error = nil;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
NSDictionary* fileAttributes=[[NSFileManager defaultManager]fileAttributesAtPath:resourcePath
|
||||
traverseLink:YES];
|
||||
NSDictionary* fileAttributes=[[NSFileManager defaultManager] attributesOfItemAtPath:resourcePath
|
||||
error:&error];
|
||||
resourceLength=(unsigned long)[fileAttributes fileSize];
|
||||
|
||||
resourceFileHandle=[NSFileHandle fileHandleForReadingAtPath:resourcePath];
|
||||
|
|
|
@ -766,8 +766,8 @@ RCS_ID("$Id$")
|
|||
}
|
||||
else
|
||||
{
|
||||
NSTimeInterval userTime=NSTimeIntervalFromTimeVal(&rusageStruct.ru_utime);
|
||||
NSTimeInterval systemTime=NSTimeIntervalFromTimeVal(&rusageStruct.ru_stime);
|
||||
// NSTimeInterval userTime=NSTimeIntervalFromTimeVal(&rusageStruct.ru_utime);
|
||||
// NSTimeInterval systemTime=NSTimeIntervalFromTimeVal(&rusageStruct.ru_stime);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ RCS_ID("$Id$")
|
|||
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
|
||||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
GSWElement* resultElement=nil;
|
||||
id <GSWActionResults, NSObject> resultElement=nil;
|
||||
GSWElement* element=nil;
|
||||
NSString* elementNameInContext=nil;
|
||||
|
||||
|
@ -135,12 +135,12 @@ RCS_ID("$Id$")
|
|||
};
|
||||
element=[self _realComponentWithName:elementNameInContext
|
||||
inContext:aContext];
|
||||
resultElement=[element invokeActionForRequest:request
|
||||
resultElement = (id <GSWActionResults, NSObject>) [element invokeActionForRequest:request
|
||||
inContext:aContext];
|
||||
GSWContext_deleteLastElementIDComponent(aContext);
|
||||
|
||||
return resultElement;
|
||||
};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)takeValuesFromRequest:(GSWRequest*)aRequest
|
||||
|
|
|
@ -457,13 +457,14 @@ Method for GSWDeclarationParserPragmaDelegate protocol
|
|||
if (path)
|
||||
{
|
||||
NSString * declarationsString=nil;
|
||||
NSStringEncoding encoding;
|
||||
NSError * error = nil;
|
||||
|
||||
[_processedDeclarationsFilePaths addObject:path];
|
||||
|
||||
//NSString* pageDefPath=[path stringByAppendingString:_declarationsPath];
|
||||
//TODO use encoding !
|
||||
|
||||
declarationsString=[NSString stringWithContentsOfFile:path];
|
||||
declarationsString = [NSString stringWithContentsOfFile:path
|
||||
usedEncoding:&encoding
|
||||
error:&error];
|
||||
|
||||
if (declarationsString)
|
||||
{
|
||||
|
@ -474,11 +475,12 @@ Method for GSWDeclarationParserPragmaDelegate protocol
|
|||
if (!declarations)
|
||||
{
|
||||
ExceptionRaise(@"%@ Template componentDeclaration parse failed for "
|
||||
@"included file:%@ in framework:%@ (processedFiles=%@)",
|
||||
@"included file:%@ in framework:%@ (processedFiles=%@) error=%@",
|
||||
[self logPrefix],
|
||||
declarationFileName,
|
||||
declarationFrameworkName,
|
||||
_processedDeclarationsFilePaths);
|
||||
_processedDeclarationsFilePaths,
|
||||
error);
|
||||
};
|
||||
}
|
||||
else
|
||||
|
|
|
@ -185,7 +185,7 @@ static Class standardClass = Nil;
|
|||
inContext:(GSWContext*)aContext
|
||||
{
|
||||
//OK
|
||||
GSWElement* element=nil;
|
||||
id <GSWActionResults, NSObject> element=nil;
|
||||
NSString* senderID=nil;
|
||||
NSString* elementID=nil;
|
||||
|
||||
|
@ -223,7 +223,7 @@ static Class standardClass = Nil;
|
|||
}
|
||||
else
|
||||
{
|
||||
element=[_children invokeActionForRequest:aRequest
|
||||
element = (id <GSWActionResults, NSObject>)[_children invokeActionForRequest:aRequest
|
||||
inContext:aContext];
|
||||
NSDebugMLLog(@"gswdync",@"element=%@",element);
|
||||
};
|
||||
|
|
|
@ -224,10 +224,10 @@ static Class NSStringClass = Nil;
|
|||
else
|
||||
[response setContent:data];
|
||||
[response setHeader:GSWIntToNSString((int)[data length])
|
||||
forKey:@"content-length"];
|
||||
forKey:@"Content-Length"];
|
||||
|
||||
[response setHeader:_mimeType
|
||||
forKey:@"content-type"];
|
||||
forKey:@"Content-Type"];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
@ -762,7 +762,7 @@ void ValidationExceptionRaiseFn0(const char *func,
|
|||
NSTimeZone* gmtTZ=[NSTimeZone timeZoneWithName:@"GMT"];
|
||||
if (!gmtTZ)
|
||||
NSWarnLog(@"no time zone for GMT");
|
||||
return [self descriptionWithCalendarFormat:@"%A, %d-%b-%Y %H:%M:%S GMT"
|
||||
return [self descriptionWithCalendarFormat:@"%a, %d %b %Y %H:%M:%S GMT"
|
||||
timeZone:gmtTZ
|
||||
locale:nil];
|
||||
};
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#ifndef GNUSTEP
|
||||
#include <GNUstepBase/GNUstep.h>
|
||||
#include <GNUstepBase/NSDebug+GNUstepBase.h>
|
||||
#include <GNUstepBase/Additions.h>
|
||||
#endif
|
||||
|
||||
#if GDL2
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
- (NSString*) encodeXMLPrefix
|
||||
{
|
||||
return [NSString stringWithFormat:@"<element type=\"%@\">\n", [self className]];
|
||||
return [NSString stringWithFormat:@"<element type=\"%@\">\n", NSStringFromClass([self class])];
|
||||
}
|
||||
|
||||
- (NSString*) encodeXMLSuffix
|
||||
|
@ -92,7 +92,7 @@
|
|||
format: @"key is missing"];
|
||||
}
|
||||
|
||||
prefixStr = [NSString stringWithFormat:@"<%@ type=\"%@\">\n", key, [self className]];
|
||||
prefixStr = [NSString stringWithFormat:@"<%@ type=\"%@\">\n", key, NSStringFromClass([self class])];
|
||||
[contentStr appendString:prefixStr];
|
||||
|
||||
suffixStr = [NSString stringWithFormat:@"</%@>\n", key];
|
||||
|
@ -136,7 +136,7 @@
|
|||
format: @"key is missing"];
|
||||
}
|
||||
|
||||
prefixStr = [NSString stringWithFormat:@"<%@ type=\"%@\">\n", key, [self className]];
|
||||
prefixStr = [NSString stringWithFormat:@"<%@ type=\"%@\">\n", key, NSStringFromClass([self class])];
|
||||
[contentStr appendString:prefixStr];
|
||||
|
||||
suffixStr = [NSString stringWithFormat:@"</%@>\n", key];
|
||||
|
|
|
@ -262,7 +262,7 @@ static void initNormalHTMLChars(GSWHTMLConvertingStruct* htmlConvertStruct,
|
|||
};
|
||||
}
|
||||
|
||||
static void testStringByConvertingHTML();
|
||||
//static void testStringByConvertingHTML();
|
||||
|
||||
void NSStringHTML_Initialize()
|
||||
{
|
||||
|
@ -310,19 +310,6 @@ void NSStringHTML_Initialize()
|
|||
\"&\r\n2\\U00E8\", \
|
||||
\"<ee>\")"
|
||||
|
||||
void testStringByConvertingHTML()
|
||||
{
|
||||
/*
|
||||
NSArray* testStrings=[HTML_TEST_STRINGS propertyList];
|
||||
NSUInteger i=0;
|
||||
for(i=0;i<[testStrings count];i++)
|
||||
{
|
||||
NSString* string=[testStrings objectAtIndex:i];
|
||||
NSString* result=[string stringByConvertingToHTML];
|
||||
NSString* reverse=[result stringByConvertingFromHTML];
|
||||
};
|
||||
*/
|
||||
};
|
||||
|
||||
void allocOrReallocUnicharString(unichar** ptrPtr,NSUInteger* capacityPtr,NSUInteger length,NSUInteger newCapacity)
|
||||
{
|
||||
|
@ -653,9 +640,9 @@ NSString* baseStringByConvertingFromHTML(NSString* string,GSWHTMLConvertingStruc
|
|||
{
|
||||
NSMutableString* temp=[NSMutableString stringWithCapacity:[self length]];
|
||||
const char* p=NULL;
|
||||
const char* valid=[validString cString];
|
||||
const char* valid=[validString cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
static char *digits = "0123456789ABCDEF";
|
||||
for (p =[self cString]; p && *p; p++)
|
||||
for (p =[self cStringUsingEncoding:NSUTF8StringEncoding]; p && *p; p++)
|
||||
{
|
||||
if (isdigit(*p) || isalpha(*p) || (valid && strchr(valid, *p)))
|
||||
[temp appendFormat:@"%c",*p];
|
||||
|
@ -771,7 +758,7 @@ NSString* baseStringByConvertingFromHTML(NSString* string,GSWHTMLConvertingStruc
|
|||
if ([scanner scanString:@","
|
||||
intoString:NULL])
|
||||
{
|
||||
if ([scanner scanInt:y])
|
||||
if ([scanner scanInteger:y])
|
||||
{
|
||||
// if (y)
|
||||
// {
|
||||
|
|
|
@ -37,19 +37,20 @@
|
|||
-(BOOL)isANumber;
|
||||
-(BOOL)isAFloatNumber;
|
||||
-(BOOL)isAnIntegerNumber;
|
||||
#ifdef LONG_LONG_MAX
|
||||
-(BOOL)isAnIntegerNumberWithMin:(long long)min
|
||||
max:(long long)max;
|
||||
#else
|
||||
-(BOOL)isAnIntegerNumberWithMin:(long)min
|
||||
max:(long)max;
|
||||
#endif
|
||||
//#ifdef LONG_LONG_MAX
|
||||
//-(BOOL)isAnIntegerNumberWithMin:(long long)min
|
||||
// max:(long long)max;
|
||||
|
||||
-(BOOL) isAnIntegerNumberWithMin:(NSInteger) min
|
||||
max:(NSInteger) max;
|
||||
|
||||
-(BOOL)isAnUnsignedIntegerNumber;
|
||||
#ifdef LONG_LONG_MAX
|
||||
-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long long)max;
|
||||
#else
|
||||
-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long)max;
|
||||
#endif
|
||||
//#ifdef LONG_LONG_MAX
|
||||
//-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long long)max;
|
||||
//#else
|
||||
|
||||
-(BOOL)isAnUnsignedIntegerNumberWithMax:(NSUInteger) max;
|
||||
|
||||
-(BOOL)isStartingWithNumber;
|
||||
|
||||
@end
|
||||
|
|
|
@ -71,18 +71,12 @@ RCS_ID("$Id$")
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
#ifdef LONG_LONG_MAX
|
||||
-(BOOL)isAnIntegerNumberWithMin:(long long)min
|
||||
max:(long long)max
|
||||
#else
|
||||
-(BOOL)isAnIntegerNumberWithMin:(long)min
|
||||
max:(long)max
|
||||
#endif
|
||||
-(BOOL)isAnIntegerNumberWithMin:(NSInteger) min
|
||||
max:(NSInteger) max
|
||||
{
|
||||
if ([self isAnIntegerNumber])
|
||||
{
|
||||
//TODO
|
||||
long v=[self longValue];
|
||||
NSInteger v=[self integerValue];
|
||||
if (v>=min && v<=max)
|
||||
return YES;
|
||||
else
|
||||
|
@ -106,16 +100,15 @@ RCS_ID("$Id$")
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
#ifdef LONG_LONG_MAX
|
||||
-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long long)max
|
||||
#else
|
||||
-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long)max
|
||||
#endif
|
||||
-(BOOL)isAnUnsignedIntegerNumberWithMax:(NSUInteger) max
|
||||
{
|
||||
unsigned int v;
|
||||
|
||||
if ([self isAnUnsignedIntegerNumber])
|
||||
{
|
||||
//TODO
|
||||
unsigned long v=[self ulongValue];
|
||||
sscanf([self UTF8String], "%u", &v);
|
||||
// v=[self unsignedIntegerValue];
|
||||
if (v<=max)
|
||||
return YES;
|
||||
else
|
||||
|
@ -123,7 +116,7 @@ RCS_ID("$Id$")
|
|||
}
|
||||
else
|
||||
return NO;
|
||||
};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(BOOL)isStartingWithNumber
|
||||
|
@ -204,11 +197,16 @@ RCS_ID("$Id$")
|
|||
NSString * filename = nil;
|
||||
NSFileManager * fileManager = nil;
|
||||
NSArray * directoryContents = nil;
|
||||
NSError * error = nil;
|
||||
|
||||
fileManager = [NSFileManager defaultManager];
|
||||
directoryContents=[fileManager directoryContentsAtPath:directory];
|
||||
|
||||
directoryContents = [fileManager contentsOfDirectoryAtPath:directory
|
||||
error:&error];
|
||||
if (!directoryContents)
|
||||
{
|
||||
//ERROR
|
||||
NSDebugMLog(@"error %s %@",__PRETTY_FUNCTION__, error);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -224,7 +222,8 @@ RCS_ID("$Id$")
|
|||
if (filename)
|
||||
filename=[directory stringByAppendingPathComponent:filename];
|
||||
return filename;
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
|
|
|
@ -3,6 +3,7 @@ AFileUpload: WOFileUpload
|
|||
{
|
||||
filePath=aFilePath;
|
||||
data=aFileData;
|
||||
multiple="multiple";
|
||||
};
|
||||
|
||||
FileName: WOString
|
||||
|
|
|
@ -3,7 +3,6 @@ ARadioButtonList: WORadioButtonList
|
|||
{
|
||||
list = application.bundleInfo.RadioButtonList.list;
|
||||
item = anItem;
|
||||
value = anItem.value;
|
||||
displayString = anItem.label;
|
||||
selection = selectedItem;
|
||||
name = "RADIONAME";
|
||||
|
|
Loading…
Reference in a new issue