mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-06-01 01:31:19 +00:00
o replaced GDL2 #if by HAVE_GDL2 #if
o modified -setTimeOut: to handle null timeOut (no time out) o added -_setAllowedToViewStatistics: o modified setDistributionEnabled: to call GSWContext -_synchronizeForDistribution o modified setStoresIDsInCookies: to call GSWContext -_synchronizeForDistribution o call -takeValuesFromRequest:inContext: on pageElement instead of pageComponent in -takeValuesFromRequest:inContext: o call -invokeActionForRequest:inContext: on pageElement instead of pageComponent in -invokeActionForRequest:inContext: o call -appendToResponse:inContext: on pageElement instead of pageComponent in -appendToResponse:inContext: o finalized -appendToResponse:inContext: implementation o implemented -statistics o implemented -_formattedStatistics o lock editing context in -awakeInContext: o unlock editing context in -sleepInContext: o in set undo limit and lock editingContext in -defaultEditingContext o lock editing context and disallow setting context when one already exists in -setDefaultEditingContext: o added -validateStatisticsLogin:withPassword: o added -_allowedToViewEvents o added -_allowToViewEvents o added -_setAllowedToViewEvents: o added -validateEventsLogin:withPassword: o added -addLanguage: o added -firstLanguage git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@18144 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e6700eb0e3
commit
6a1272d40b
1 changed files with 299 additions and 68 deletions
|
@ -364,15 +364,14 @@ RCS_ID("$Id$")
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(BOOL)storesIDsInURLs
|
-(BOOL)storesIDsInURLs
|
||||||
{
|
{
|
||||||
//OK
|
|
||||||
return _storesIDsInURLs;
|
return _storesIDsInURLs;
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(void)setStoresIDsInURLs:(BOOL)flag
|
-(void)setStoresIDsInURLs:(BOOL)flag
|
||||||
{
|
{
|
||||||
//OK
|
if (flag!=_storesIDsInURLs)
|
||||||
_storesIDsInURLs=flag;
|
_storesIDsInURLs=flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
@ -390,31 +389,49 @@ RCS_ID("$Id$")
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(BOOL)storesIDsInCookies
|
-(BOOL)storesIDsInCookies
|
||||||
{
|
{
|
||||||
//OK
|
|
||||||
return _storesIDsInCookies;
|
return _storesIDsInCookies;
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(void)setStoresIDsInCookies:(BOOL)flag
|
-(void)setStoresIDsInCookies:(BOOL)flag
|
||||||
{
|
{
|
||||||
//OK
|
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
NSDebugMLLog(@"sessions",@"newflag=%d",(int)flag);
|
NSDebugMLLog(@"sessions",@"newflag=%d",(int)flag);
|
||||||
_storesIDsInCookies=flag;
|
if (flag!=_storesIDsInCookies)
|
||||||
|
{
|
||||||
|
_storesIDsInCookies=flag;
|
||||||
|
[_currentContext _synchronizeForDistribution];
|
||||||
|
};
|
||||||
LOGObjectFnStop();
|
LOGObjectFnStop();
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
/** Returns NO if URLs contains application number so requests are
|
||||||
|
directed to the specific application instance.
|
||||||
|
Resturns YES if URLs doesn't contain application number so requests
|
||||||
|
can be directed to any instance (load balancing)
|
||||||
|
Default value is NO
|
||||||
|
**/
|
||||||
-(BOOL)isDistributionEnabled
|
-(BOOL)isDistributionEnabled
|
||||||
{
|
{
|
||||||
return _isDistributionEnabled;
|
return _isDistributionEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
/** Enables or disables application instance number in URLs.
|
||||||
|
If flag is NO, URLs contains application number so requests are directed
|
||||||
|
to the specific application instance.
|
||||||
|
If flag is YES, URLs doesn't contain application number so requests can
|
||||||
|
be directed to any instance (load balancing)
|
||||||
|
**/
|
||||||
-(void)setDistributionEnabled:(BOOL)flag
|
-(void)setDistributionEnabled:(BOOL)flag
|
||||||
{
|
{
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
_isDistributionEnabled=flag;
|
if (flag!=_isDistributionEnabled)
|
||||||
|
{
|
||||||
|
_isDistributionEnabled=flag;
|
||||||
|
[_currentContext _synchronizeForDistribution];
|
||||||
|
};
|
||||||
LOGObjectFnStop();
|
LOGObjectFnStop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -444,7 +461,7 @@ RCS_ID("$Id$")
|
||||||
application=[GSWApplication application];
|
application=[GSWApplication application];
|
||||||
//applic statisticsStore
|
//applic statisticsStore
|
||||||
//applic _activeSessionsCount
|
//applic _activeSessionsCount
|
||||||
ASSIGN(_birthDate,[NSDate date]);
|
[self _setBirthDate:[NSDate date]];
|
||||||
ASSIGN(_statistics,[NSMutableArray array]);
|
ASSIGN(_statistics,[NSMutableArray array]);
|
||||||
_storesIDsInURLs=YES;
|
_storesIDsInURLs=YES;
|
||||||
[application _finishInitializingSession:self];
|
[application _finishInitializingSession:self];
|
||||||
|
@ -471,22 +488,37 @@ RCS_ID("$Id$")
|
||||||
// terminate
|
// terminate
|
||||||
-(void)terminate
|
-(void)terminate
|
||||||
{
|
{
|
||||||
//OK
|
|
||||||
NSString* sessionID=nil;
|
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
|
|
||||||
_isTerminating=YES;
|
if (!_isTerminating) // don't do it multiple times !
|
||||||
sessionID=[self sessionID];
|
{
|
||||||
[self setTimeOut:(NSTimeInterval) 1]; // forces to call removeSessionWithID in GSWServerSessionStore to dealloc it
|
GSWApplication* application=[GSWApplication application];
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:GSWNotification__SessionDidTimeOutNotification[GSWebNamingConv]
|
NSString* sessionID=[self sessionID];
|
||||||
object:sessionID];
|
|
||||||
//TODO: VERIFY
|
_isTerminating=YES;
|
||||||
[self setTimeOut:(NSTimeInterval) 1]; // forces to call removeSessionWithID in GSWServerSessionStore to dealloc it
|
|
||||||
//goto => GSWApp _sessionDidTimeOutNotification:
|
[[NSNotificationCenter defaultCenter]
|
||||||
//call GSWApp _discountTerminatedSession
|
postNotificationName:GSWNotification__SessionDidTimeOutNotification[GSWebNamingConv]
|
||||||
//call GSWApp statisticsStore
|
object:sessionID];
|
||||||
//call statstore _sessionTerminating:self
|
|
||||||
[[GSWApp statisticsStore] _sessionTerminating:self];
|
[application _discountTerminatedSession];
|
||||||
|
[[application statisticsStore] _sessionTerminating:self];
|
||||||
|
|
||||||
|
if (_editingContext)
|
||||||
|
{
|
||||||
|
if (_hasSessionLockedEditingContext)
|
||||||
|
{
|
||||||
|
[_editingContext unlock];
|
||||||
|
_hasSessionLockedEditingContext = NO;
|
||||||
|
};
|
||||||
|
DESTROY(_editingContext);
|
||||||
|
};
|
||||||
|
/*
|
||||||
|
[self setTimeOut:(NSTimeInterval) 1]; // forces to call removeSessionWithID in GSWServerSessionStore to dealloc it
|
||||||
|
//TODO: VERIFY
|
||||||
|
[self setTimeOut:(NSTimeInterval) 1]; // forces to call removeSessionWithID in GSWServerSessionStore to dealloc it
|
||||||
|
*/
|
||||||
|
};
|
||||||
LOGObjectFnStop();
|
LOGObjectFnStop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -516,7 +548,10 @@ RCS_ID("$Id$")
|
||||||
-(void)setTimeOut:(NSTimeInterval)timeOut
|
-(void)setTimeOut:(NSTimeInterval)timeOut
|
||||||
{
|
{
|
||||||
NSDebugMLLog(@"sessions",@"timeOut=%ld",(long)timeOut);
|
NSDebugMLLog(@"sessions",@"timeOut=%ld",(long)timeOut);
|
||||||
_timeOut=timeOut;
|
if (timeOut==0)
|
||||||
|
_timeOut=[[NSDate distantFuture]timeIntervalSinceDate:_birthDate];
|
||||||
|
else
|
||||||
|
_timeOut=timeOut;
|
||||||
};
|
};
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -656,6 +691,8 @@ RCS_ID("$Id$")
|
||||||
context=[self context];
|
context=[self context];
|
||||||
permanentPageCache=[self _permanentPageCache];
|
permanentPageCache=[self _permanentPageCache];
|
||||||
permanentPageCacheSize=[self permanentPageCacheSize];
|
permanentPageCacheSize=[self permanentPageCacheSize];
|
||||||
|
|
||||||
|
// first we'll remove excessive cached pages.
|
||||||
while([_permanentContextIDArray count]>0 && [_permanentContextIDArray count]>=permanentPageCacheSize)
|
while([_permanentContextIDArray count]>0 && [_permanentContextIDArray count]>=permanentPageCacheSize)
|
||||||
{
|
{
|
||||||
id deletePage=nil;
|
id deletePage=nil;
|
||||||
|
@ -708,7 +745,7 @@ RCS_ID("$Id$")
|
||||||
[permanentPageCache setObject:page
|
[permanentPageCache setObject:page
|
||||||
forKey:contextID];
|
forKey:contextID];
|
||||||
[_permanentContextIDArray addObject:contextID];
|
[_permanentContextIDArray addObject:contextID];
|
||||||
//TODO
|
/*
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
id anObject=nil;
|
id anObject=nil;
|
||||||
|
@ -720,6 +757,7 @@ RCS_ID("$Id$")
|
||||||
[GSWApplication statusLogWithFormat:@"%d contextID=%@ page class=%@",i,anotherContextID,[anObject class]];
|
[GSWApplication statusLogWithFormat:@"%d contextID=%@ page class=%@",i,anotherContextID,[anObject class]];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
if ([_permanentContextIDArray count]!=[permanentPageCache count])
|
if ([_permanentContextIDArray count]!=[permanentPageCache count])
|
||||||
{
|
{
|
||||||
LOGSeriousError(@"[permanentContextIDArray count] %d != [permanentPageCache count] %d",
|
LOGSeriousError(@"[permanentContextIDArray count] %d != [permanentPageCache count] %d",
|
||||||
|
@ -831,7 +869,6 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(void)_createAutoreleasePool
|
-(void)_createAutoreleasePool
|
||||||
{
|
{
|
||||||
//OK
|
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
if (!_autoreleasePool)
|
if (!_autoreleasePool)
|
||||||
{
|
{
|
||||||
|
@ -844,7 +881,6 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(GSWComponent*)_permanentPageWithContextID:(NSString*)aContextID
|
-(GSWComponent*)_permanentPageWithContextID:(NSString*)aContextID
|
||||||
{
|
{
|
||||||
//OK
|
|
||||||
GSWComponent* page=nil;
|
GSWComponent* page=nil;
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
page=[_permanentPageCache objectForKey:aContextID];
|
page=[_permanentPageCache objectForKey:aContextID];
|
||||||
|
@ -855,7 +891,6 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(NSMutableDictionary*)_permanentPageCache
|
-(NSMutableDictionary*)_permanentPageCache
|
||||||
{
|
{
|
||||||
//OK
|
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
if (!_permanentPageCache)
|
if (!_permanentPageCache)
|
||||||
_permanentPageCache=[NSMutableDictionary new];
|
_permanentPageCache=[NSMutableDictionary new];
|
||||||
|
@ -1164,7 +1199,8 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
//OK
|
//OK
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
NSDebugMLLog(@"sessions",@"aContext=%p",(void*)aContext);
|
NSDebugMLLog(@"sessions",@"aContext=%p",(void*)aContext);
|
||||||
_currentContext=aContext;
|
if (aContext!=_currentContext)
|
||||||
|
_currentContext=aContext;
|
||||||
LOGObjectFnStop();
|
LOGObjectFnStop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1174,6 +1210,11 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
//OK
|
//OK
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
[self sleep];
|
[self sleep];
|
||||||
|
if (_hasSessionLockedEditingContext)
|
||||||
|
{
|
||||||
|
[_editingContext unlock];
|
||||||
|
_hasSessionLockedEditingContext = NO;
|
||||||
|
}
|
||||||
[self _setContext:nil];
|
[self _setContext:nil];
|
||||||
LOGObjectFnStop();
|
LOGObjectFnStop();
|
||||||
};
|
};
|
||||||
|
@ -1181,7 +1222,6 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(void)awakeInContext:(GSWContext*)aContext
|
-(void)awakeInContext:(GSWContext*)aContext
|
||||||
{
|
{
|
||||||
//OK
|
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
[self _setContext:aContext];
|
[self _setContext:aContext];
|
||||||
NSDebugMLLog(@"sessions",@"contextCounter=%i",_contextCounter);
|
NSDebugMLLog(@"sessions",@"contextCounter=%i",_contextCounter);
|
||||||
|
@ -1194,6 +1234,13 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
NSDebugMLLog(@"sessions",@"contextCounter=%i",_contextCounter);
|
NSDebugMLLog(@"sessions",@"contextCounter=%i",_contextCounter);
|
||||||
|
if (_editingContext
|
||||||
|
&& !_hasSessionLockedEditingContext
|
||||||
|
&& [GSWApplication _lockDefaultEditingContext])
|
||||||
|
{
|
||||||
|
[_editingContext lock];
|
||||||
|
_hasSessionLockedEditingContext=YES;
|
||||||
|
};
|
||||||
[self awake];
|
[self awake];
|
||||||
LOGObjectFnStop();
|
LOGObjectFnStop();
|
||||||
};
|
};
|
||||||
|
@ -1206,25 +1253,116 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(void)setLanguages:(NSArray*)someLanguages
|
-(void)setLanguages:(NSArray*)someLanguages
|
||||||
{
|
{
|
||||||
//OK
|
LOGObjectFnStart();
|
||||||
|
|
||||||
|
NSDebugMLLog(@"sessions",@"someLanguages=%@",someLanguages);
|
||||||
|
|
||||||
if (!someLanguages)
|
if (!someLanguages)
|
||||||
{
|
{
|
||||||
LOGError0(@"No languages");
|
LOGError0(@"No languages");
|
||||||
};
|
};
|
||||||
ASSIGN(_languages,someLanguages);
|
ASSIGN(_languages,someLanguages);
|
||||||
|
|
||||||
|
LOGObjectFnStop();
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
/** GSWeb specific
|
||||||
|
Insert language language at the begining of session languages array
|
||||||
|
**/
|
||||||
|
-(void)insertLanguage:(NSString*)language
|
||||||
|
{
|
||||||
|
NSArray* languages=nil;
|
||||||
|
LOGObjectFnStart();
|
||||||
|
if ([language length]>0)
|
||||||
|
{
|
||||||
|
languages=[self languages];
|
||||||
|
if ([languages count]>0)
|
||||||
|
{
|
||||||
|
if (![language isEqualToString:[languages objectAtIndex:0]])
|
||||||
|
{
|
||||||
|
NSMutableArray* mutableLanguages=[[languages mutableCopy]autorelease];
|
||||||
|
[mutableLanguages removeObject:language];//Remove language if it exists in languages
|
||||||
|
[mutableLanguages insertObject:language
|
||||||
|
atIndex:0];
|
||||||
|
[self setLanguages:mutableLanguages];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
[self setLanguages:[NSArray arrayWithObject:language]];
|
||||||
|
};
|
||||||
|
LOGObjectFnStop();
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
/** GSWeb specific
|
||||||
|
Add language language at the end of session languages array if language
|
||||||
|
is not present
|
||||||
|
**/
|
||||||
|
-(void)addLanguage:(NSString*)language
|
||||||
|
{
|
||||||
|
NSArray* languages=nil;
|
||||||
|
LOGObjectFnStart();
|
||||||
|
if ([language length]>0)
|
||||||
|
{
|
||||||
|
languages=[self languages];
|
||||||
|
if ([languages count]>0)
|
||||||
|
{
|
||||||
|
if (![languages containsObject:language])
|
||||||
|
[self setLanguages:[languages arrayByAddingObject:language]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
[self setLanguages:[NSArray arrayWithObject:language]];
|
||||||
|
};
|
||||||
|
LOGObjectFnStop();
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
/** GSWeb specific
|
||||||
|
Returns first element of languages or nil if languages is empty
|
||||||
|
**/
|
||||||
|
-(NSString*)firstLanguage
|
||||||
|
{
|
||||||
|
NSArray* languages=nil;
|
||||||
|
NSString* firstLanguage=nil;
|
||||||
|
LOGObjectFnStart();
|
||||||
|
|
||||||
|
languages=[self languages];
|
||||||
|
if ([languages count]>0)
|
||||||
|
firstLanguage=[languages objectAtIndex:0];
|
||||||
|
|
||||||
|
LOGObjectFnStop();
|
||||||
|
|
||||||
|
return firstLanguage;
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(NSArray*)languages
|
-(NSArray*)languages
|
||||||
{
|
{
|
||||||
//OK
|
LOGObjectFnStart();
|
||||||
|
|
||||||
|
NSDebugMLLog(@"sessions",@"_languages=%@",_languages);
|
||||||
|
|
||||||
if (!_languages)
|
if (!_languages)
|
||||||
{
|
{
|
||||||
GSWContext* aContext=[self context];
|
GSWContext* aContext=[self context];
|
||||||
GSWRequest* request=[aContext request];
|
GSWRequest* request=[aContext request];
|
||||||
NSArray* languages=[request browserLanguages];
|
NSArray* languages=[request browserLanguages];
|
||||||
[self setLanguages:languages];
|
[self setLanguages:languages];
|
||||||
|
NSDebugMLLog(@"sessions",@"_languages=%@",_languages);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
LOGObjectFnStop();
|
||||||
|
|
||||||
|
return _languages;
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
-(NSArray*)_languages
|
||||||
|
{
|
||||||
|
LOGObjectFnStart();
|
||||||
|
LOGObjectFnStop();
|
||||||
|
|
||||||
return _languages;
|
return _languages;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1282,10 +1420,16 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(EOEditingContext*)defaultEditingContext
|
-(EOEditingContext*)defaultEditingContext
|
||||||
{
|
{
|
||||||
#if GDL2
|
#if HAVE_GDL2
|
||||||
if(!_editingContext)
|
if(!_editingContext)
|
||||||
{
|
{
|
||||||
ASSIGN(_editingContext,[[[EOEditingContext alloc] init] autorelease]);
|
ASSIGN(_editingContext,[[[EOEditingContext alloc] init] autorelease]);
|
||||||
|
[_editingContext setLevelsOfUndo:[GSWApplication defaultUndoStackLimit]];
|
||||||
|
if ([GSWApplication _lockDefaultEditingContext])
|
||||||
|
{
|
||||||
|
[_editingContext lock];
|
||||||
|
_hasSessionLockedEditingContext=YES;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1295,7 +1439,22 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(void)setDefaultEditingContext:(EOEditingContext*)editingContext
|
-(void)setDefaultEditingContext:(EOEditingContext*)editingContext
|
||||||
{
|
{
|
||||||
ASSIGN(_editingContext,editingContext);
|
if (_editingContext)
|
||||||
|
{
|
||||||
|
// We can't set the editing context if one has already been created
|
||||||
|
[NSException raise:NSInvalidArgumentException
|
||||||
|
format:@"%s Can't set a defautEditingContext when one already exists",
|
||||||
|
object_get_class_name(self)];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ASSIGN(_editingContext,editingContext);
|
||||||
|
if ([GSWApplication _lockDefaultEditingContext])
|
||||||
|
{
|
||||||
|
[_editingContext lock];
|
||||||
|
_hasSessionLockedEditingContext=YES;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -1330,7 +1489,6 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
-(void)takeValuesFromRequest:(GSWRequest*)aRequest
|
-(void)takeValuesFromRequest:(GSWRequest*)aRequest
|
||||||
inContext:(GSWContext*)aContext
|
inContext:(GSWContext*)aContext
|
||||||
{
|
{
|
||||||
//OK
|
|
||||||
GSWElement* pageElement=nil;
|
GSWElement* pageElement=nil;
|
||||||
GSWComponent* pageComponent=nil;
|
GSWComponent* pageComponent=nil;
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
|
@ -1339,9 +1497,9 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
[aContext addDocStructureStep:@"Take Values From Request"];
|
[aContext addDocStructureStep:@"Take Values From Request"];
|
||||||
#endif
|
#endif
|
||||||
[aContext _setCurrentComponent:pageComponent]; //_pageElement ??
|
[aContext _setCurrentComponent:pageComponent];
|
||||||
[pageComponent takeValuesFromRequest:aRequest
|
[pageElement takeValuesFromRequest:aRequest
|
||||||
inContext:aContext]; //_pageComponent ??
|
inContext:aContext];
|
||||||
[aContext _setCurrentComponent:nil];
|
[aContext _setCurrentComponent:nil];
|
||||||
LOGObjectFnStop();
|
LOGObjectFnStop();
|
||||||
};
|
};
|
||||||
|
@ -1362,9 +1520,9 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
[aContext addDocStructureStep:@"Invoke Action For Request"];
|
[aContext addDocStructureStep:@"Invoke Action For Request"];
|
||||||
#endif
|
#endif
|
||||||
[aContext _setCurrentComponent:pageComponent]; //_pageElement ??
|
[aContext _setCurrentComponent:pageComponent];
|
||||||
element=[pageComponent invokeActionForRequest:aRequest
|
element=[pageElement invokeActionForRequest:aRequest
|
||||||
inContext:aContext]; //_pageComponent
|
inContext:aContext];
|
||||||
[aContext _setCurrentComponent:nil];
|
[aContext _setCurrentComponent:nil];
|
||||||
if (!element)
|
if (!element)
|
||||||
element=[aContext page]; //??
|
element=[aContext page]; //??
|
||||||
|
@ -1386,26 +1544,29 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// appendToResponse:inContext:
|
// appendToResponse:inContext:
|
||||||
-(void)appendToResponse:(GSWResponse*)aResponse
|
-(void)appendToResponse:(GSWResponse*)aResponse
|
||||||
inContext:(GSWContext*)aContext
|
inContext:(GSWContext*)aContext
|
||||||
{
|
{
|
||||||
//OK
|
|
||||||
GSWStatisticsStore* statisticsStore=nil;
|
GSWStatisticsStore* statisticsStore=nil;
|
||||||
NSString* logFile=nil;
|
NSString* logFile=nil;
|
||||||
GSWSession* session=nil;
|
|
||||||
GSWElement* pageElement=nil;
|
GSWElement* pageElement=nil;
|
||||||
GSWComponent* pageComponent=nil;
|
GSWComponent* pageComponent=nil;
|
||||||
|
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
|
|
||||||
statisticsStore=[[GSWApplication application] statisticsStore];
|
statisticsStore=[[GSWApplication application] statisticsStore];
|
||||||
|
|
||||||
pageElement=[aContext _pageElement];
|
pageElement=[aContext _pageElement];
|
||||||
pageComponent=[aContext _pageComponent];
|
pageComponent=[aContext _pageComponent];
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
[aContext addDocStructureStep:@"Append To Response"];
|
[aContext addDocStructureStep:@"Append To Response"];
|
||||||
#endif
|
#endif
|
||||||
[aContext _setCurrentComponent:pageComponent]; //_pageElement ??
|
|
||||||
|
[aContext _setCurrentComponent:pageComponent];
|
||||||
NS_DURING
|
NS_DURING
|
||||||
{
|
{
|
||||||
[pageComponent appendToResponse:aResponse
|
[pageElement appendToResponse:aResponse
|
||||||
inContext:aContext]; //_pageComponent??
|
inContext:aContext];
|
||||||
}
|
}
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
{
|
{
|
||||||
|
@ -1419,18 +1580,35 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
[localException raise];
|
[localException raise];
|
||||||
}
|
}
|
||||||
NS_ENDHANDLER;
|
NS_ENDHANDLER;
|
||||||
|
|
||||||
[aContext _setCurrentComponent:nil];
|
[aContext _setCurrentComponent:nil];
|
||||||
session=[aContext existingSession];
|
|
||||||
[session appendCookieToResponse:aResponse];
|
[self appendCookieToResponse:aResponse];
|
||||||
[statisticsStore recordStatisticsForResponse:aResponse
|
|
||||||
inContext:aContext];
|
{
|
||||||
[statisticsStore descriptionForResponse:aResponse
|
NSString* descr=nil;
|
||||||
inContext:aContext];
|
[statisticsStore recordStatisticsForResponse:aResponse
|
||||||
logFile=[statisticsStore logFile];
|
inContext:aContext];
|
||||||
if (logFile)
|
descr=[statisticsStore descriptionForResponse:aResponse
|
||||||
{
|
inContext:aContext];
|
||||||
//TODO
|
if (descr)
|
||||||
};
|
{
|
||||||
|
[_statistics addObject:descr];
|
||||||
|
logFile=[statisticsStore logFile];
|
||||||
|
if (logFile)
|
||||||
|
{
|
||||||
|
NSString* formattedDescr=[GSWStatisticsStore formatDescription:descr
|
||||||
|
forResponse:aResponse
|
||||||
|
inContext:aContext];
|
||||||
|
if (formattedDescr)
|
||||||
|
{
|
||||||
|
if (!_formattedStatistics)
|
||||||
|
_formattedStatistics = [NSMutableString new];
|
||||||
|
[_formattedStatistics appendString:formattedDescr];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
LOGObjectFnStop();
|
LOGObjectFnStop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1443,16 +1621,9 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(NSArray*)statistics
|
-(NSArray*)statistics
|
||||||
{
|
{
|
||||||
//return (Main, DisksList, DisksList, DisksList) (page dans l'ordre des context)
|
return _statistics;
|
||||||
LOGObjectFnNotImplemented(); //TODOFN
|
|
||||||
return nil;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
//====================================================================
|
|
||||||
@implementation GSWSession (GSWSessionM)
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(BOOL)_allowedToViewStatistics
|
-(BOOL)_allowedToViewStatistics
|
||||||
{
|
{
|
||||||
|
@ -1466,10 +1637,29 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(id)_formattedStatistics
|
-(void)_setAllowedToViewStatistics:(BOOL)flag
|
||||||
{
|
{
|
||||||
LOGObjectFnNotImplemented(); //TODOFN
|
_isAllowedToViewStatistics=flag;
|
||||||
return nil;
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
-(BOOL)validateStatisticsLogin:(NSString*)login
|
||||||
|
withPassword:(NSString*)password
|
||||||
|
{
|
||||||
|
GSWStatisticsStore* statsStore = [[GSWApplication application]statisticsStore];
|
||||||
|
if (statsStore)
|
||||||
|
{
|
||||||
|
NSString* statsStorePassword=[statsStore _password];
|
||||||
|
if ([statsStorePassword isEqual:password])
|
||||||
|
[self _allowToViewStatistics];
|
||||||
|
}
|
||||||
|
return [self _allowedToViewStatistics];
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
-(NSString*)_formattedStatistics
|
||||||
|
{
|
||||||
|
return [NSString stringWithString:_formattedStatistics];
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
@ -1478,6 +1668,47 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
|
||||||
return _birthDate;
|
return _birthDate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
-(void)_setBirthDate:(NSDate*)birthDate
|
||||||
|
{
|
||||||
|
ASSIGN(_birthDate,birthDate);
|
||||||
|
};
|
||||||
|
@end
|
||||||
|
|
||||||
|
//====================================================================
|
||||||
|
@implementation GSWSession (GSWEvents)
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
-(BOOL)_allowedToViewEvents
|
||||||
|
{
|
||||||
|
return _isAllowedToViewEvents;
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
-(void)_allowToViewEvents
|
||||||
|
{
|
||||||
|
_isAllowedToViewEvents=YES;
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
-(void)_setAllowedToViewEvents:(BOOL)flag
|
||||||
|
{
|
||||||
|
_isAllowedToViewEvents=flag;
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
-(BOOL)validateEventsLogin:(NSString*)login
|
||||||
|
withPassword:(NSString*)password
|
||||||
|
{
|
||||||
|
//TODO wait for gdl2 implementation
|
||||||
|
/*
|
||||||
|
NSString* eventCenterPassword=[EOEventCenter password];
|
||||||
|
if ([eventCenterPassword isEqual:password])
|
||||||
|
[self _allowToViewEvents];
|
||||||
|
*/
|
||||||
|
return [self _allowedToViewEvents];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue