/* Copyright (C) 2000-2003 SKYRIX Software AG This file is part of OGo OGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. OGo 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with OGo; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // $Id$ #include "common.h" #include /* WOSession JavaScript object Properties String sessionID String domainForIDCookies Date expirationDateForIDCookies bool isDistributionEnabled bool isTerminating Array languages Object statistics Number timeOut bool storesIDsInCookies bool storesIDsInURLs Methods WOComponent restorePageForContextID(ctxid) savePage(page) savePageInPermanentCache(page) terminate() print(string [,..string]) */ static NSNumber *nYes = nil; static NSNumber *nNo = nil; @implementation WOSession(JSFunctions) - (id)_jsfunc_restorePageForContextID:(NSArray *)_args { return [self restorePageForContextID:[[_args objectAtIndex:0] stringValue]]; } - (id)_jsfunc_savePage:(NSArray *)_args { [self savePage:[_args objectAtIndex:0]]; return self; } - (id)_jsfunc_savePageInPermanentCache:(NSArray *)_args { [self savePageInPermanentCache:[_args objectAtIndex:0]]; return self; } - (id)_jsfunc_terminate:(NSArray *)_args { [self terminate]; return self; } - (id)_jsfunc_print:(NSArray *)_args { NSEnumerator *e; id o; BOOL isFirst; NSMutableString *ms; isFirst = YES; ms = [NSMutableString stringWithCapacity:128]; e = [_args objectEnumerator]; while ((o = [e nextObject])) { NSString *s; if (!isFirst) [ms appendString:@" "]; else isFirst = NO; s = [o stringValue]; [ms appendString:s]; } [self logWithFormat:@"%@", ms]; return self; } @end @implementation WOSession(JSProperties) + (void)initialize { if (nYes == nil) nYes = [[NSNumber alloc] initWithBool:YES]; if (nNo == nil) nNo = [[NSNumber alloc] initWithBool:NO]; } - (id)_jsprop_sessionID { return [self sessionID]; } - (id)_jsprop_domainForIDCookies { return [self domainForIDCookies]; } - (id)_jsprop_expirationDateForIDCookies { return [self expirationDateForIDCookies]; } - (id)_jsprop_isDistributionEnabled:(id)_value { [self setDistributionEnabled:[_value boolValue]]; return self; } - (id)_jsprop_isDistributionEnabled { return [self isDistributionEnabled] ? nYes : nNo; } - (id)_jsprop_isTerminating { return [self isTerminating] ? nYes : nNo; } - (id)_jsprop_languages:(id)_value { [self setLanguages:_value]; return self; } - (id)_jsprop_languages { return [self languages]; } - (id)_jsprop_statistics { return [self statistics]; } - (id)_jsprop_timeOut:(id)_value { [self setTimeOut:[_value doubleValue]]; return self; } - (id)_jsprop_timeOut { return [NSNumber numberWithDouble:[self timeOut]]; } - (id)_jsprop_storesIDsInCookies:(id)_value { [self setStoresIDsInCookies:[_value boolValue]]; return self; } - (id)_jsprop_storesIDsInCookies { return [self storesIDsInCookies] ? nYes : nNo; } - (id)_jsprop_storesIDsInURLs:(id)_value { [self setStoresIDsInURLs:[_value boolValue]]; return self; } - (id)_jsprop_storesIDsInURLs { return [self storesIDsInURLs] ? nYes : nNo; } @end /* WOSession(JSProperties) */