2009-11-29 05:19:32 +01:00
|
|
|
|
2006-06-15 21:34:10 +02:00
|
|
|
/*
|
|
|
|
Copyright (C) 2004-2005 SKYRIX Software AG
|
|
|
|
|
|
|
|
This file is part of OpenGroupware.org.
|
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2008-08-20 05:21:33 +02:00
|
|
|
#import <Foundation/NSEnumerator.h>
|
|
|
|
#import <Foundation/NSString.h>
|
|
|
|
|
|
|
|
#import <NGObjWeb/WOResourceManager.h>
|
2007-03-18 16:13:30 +01:00
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
#import <SOGo/NSDictionary+Utilities.h>
|
2009-09-11 16:38:43 +02:00
|
|
|
#import <SOGo/SOGoUser.h>
|
|
|
|
#import <SOGo/SOGoUserDefaults.h>
|
2009-11-29 05:19:32 +01:00
|
|
|
#import <SOGo/SOGoUserProfile.h>
|
|
|
|
#import <SOGo/SOGoUserSettings.h>
|
|
|
|
#import <SOGo/SOGoSystemDefaults.h>
|
2009-09-11 16:38:43 +02:00
|
|
|
#import <SOGo/SOGoWebAuthenticator.h>
|
2007-10-18 16:44:58 +02:00
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
#import "UIxPageFrame.h"
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
@implementation UIxPageFrame
|
|
|
|
|
2006-11-07 19:15:16 +01:00
|
|
|
- (id) init
|
|
|
|
{
|
|
|
|
if ((self = [super init]))
|
|
|
|
{
|
2007-10-18 22:08:35 +02:00
|
|
|
item = nil;
|
|
|
|
title = nil;
|
2006-11-07 19:15:16 +01:00
|
|
|
toolbar = nil;
|
2007-10-18 22:08:35 +02:00
|
|
|
additionalJSFiles = nil;
|
2009-10-13 16:04:02 +02:00
|
|
|
additionalCSSFiles = nil;
|
2006-11-07 19:15:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (void) dealloc
|
|
|
|
{
|
2006-11-07 19:15:16 +01:00
|
|
|
[item release];
|
|
|
|
[title release];
|
2007-10-18 22:08:35 +02:00
|
|
|
[toolbar release];
|
|
|
|
[additionalJSFiles release];
|
2009-10-13 16:04:02 +02:00
|
|
|
[additionalCSSFiles release];
|
2006-06-15 21:34:10 +02:00
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* accessors */
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (void) setTitle: (NSString *) _value
|
|
|
|
{
|
2007-10-18 22:08:35 +02:00
|
|
|
ASSIGN (title, _value);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
2006-07-29 00:59:11 +02:00
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) title
|
|
|
|
{
|
2006-06-15 21:34:10 +02:00
|
|
|
if ([self isUIxDebugEnabled])
|
2006-11-07 19:15:16 +01:00
|
|
|
return title;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2006-09-19 17:20:03 +02:00
|
|
|
return [self labelForKey: @"SOGo"];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (void) setItem: (id) _item
|
|
|
|
{
|
2007-10-18 22:08:35 +02:00
|
|
|
ASSIGN (item, _item);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
2006-07-29 00:59:11 +02:00
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (id) item
|
|
|
|
{
|
2006-11-07 19:15:16 +01:00
|
|
|
return item;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) ownerInContext
|
|
|
|
{
|
|
|
|
return [[self clientObject] ownerInContext: nil];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2006-09-26 20:40:04 +02:00
|
|
|
- (NSString *) doctype
|
|
|
|
{
|
2008-01-31 17:07:09 +01:00
|
|
|
return (@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
2006-10-03 16:36:03 +02:00
|
|
|
@"<!DOCTYPE html"
|
2009-08-13 12:40:25 +02:00
|
|
|
@" PUBLIC \"-//W3C//DTD XHTML 1.1//EN\""
|
|
|
|
@" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">");
|
2006-09-26 20:40:04 +02:00
|
|
|
}
|
|
|
|
|
2006-06-15 21:34:10 +02:00
|
|
|
/* Help URL/target */
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) helpURL
|
2006-07-29 00:59:11 +02:00
|
|
|
{
|
2006-11-07 19:15:16 +01:00
|
|
|
return [NSString stringWithFormat: @"help/%@.html", title];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
2006-07-29 00:59:11 +02:00
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) helpWindowTarget
|
2006-07-29 00:59:11 +02:00
|
|
|
{
|
2006-11-07 19:15:16 +01:00
|
|
|
return [NSString stringWithFormat: @"Help_%@", title];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* notifications */
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (void) sleep
|
|
|
|
{
|
2006-11-07 19:15:16 +01:00
|
|
|
[item release];
|
|
|
|
item = nil;
|
2006-06-15 21:34:10 +02:00
|
|
|
[super sleep];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* URL generation */
|
|
|
|
// TODO: I think all this should be done by the clientObject?!
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (NSString *) relativeHomePath
|
|
|
|
{
|
2006-07-12 00:29:19 +02:00
|
|
|
return [self relativePathToUserFolderSubPath: @""];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) relativeCalendarPath
|
2006-07-29 00:59:11 +02:00
|
|
|
{
|
2006-07-12 00:29:19 +02:00
|
|
|
return [self relativePathToUserFolderSubPath: @"Calendar/"];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) relativeContactsPath
|
2006-07-29 00:59:11 +02:00
|
|
|
{
|
2006-07-12 00:29:19 +02:00
|
|
|
return [self relativePathToUserFolderSubPath: @"Contacts/"];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) relativeMailPath
|
2006-07-29 00:59:11 +02:00
|
|
|
{
|
2006-07-12 00:29:19 +02:00
|
|
|
return [self relativePathToUserFolderSubPath: @"Mail/"];
|
|
|
|
}
|
|
|
|
|
2007-06-19 20:05:22 +02:00
|
|
|
- (NSString *) relativePreferencesPath
|
|
|
|
{
|
|
|
|
return [self relativePathToUserFolderSubPath: @"preferences"];
|
|
|
|
}
|
|
|
|
|
2009-08-13 12:40:25 +02:00
|
|
|
- (NSString *) relativeAdministrationPath
|
|
|
|
{
|
|
|
|
return [self relativePathToUserFolderSubPath: @"Administration/"];
|
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) logoffPath
|
2006-07-29 00:59:11 +02:00
|
|
|
{
|
2006-07-12 00:29:19 +02:00
|
|
|
return [self relativePathToUserFolderSubPath: @"logoff"];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
/* popup handling */
|
|
|
|
- (void) setPopup: (BOOL) popup
|
|
|
|
{
|
|
|
|
isPopup = popup;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2006-07-07 23:19:48 +02:00
|
|
|
- (BOOL) isPopup
|
|
|
|
{
|
2006-07-29 00:59:11 +02:00
|
|
|
return isPopup;
|
2006-07-07 23:19:48 +02:00
|
|
|
}
|
|
|
|
|
2006-12-14 22:20:13 +01:00
|
|
|
- (NSString *) bodyClasses
|
2006-11-01 21:30:36 +01:00
|
|
|
{
|
2006-12-14 22:20:13 +01:00
|
|
|
return (isPopup ? @"popup" : @"main");
|
2006-11-01 21:30:36 +01:00
|
|
|
}
|
|
|
|
|
2009-03-25 22:43:56 +01:00
|
|
|
- (NSString *) siteFavicon
|
|
|
|
{
|
2009-11-29 05:19:32 +01:00
|
|
|
NSString *siteFavicon;
|
|
|
|
|
|
|
|
siteFavicon = [[SOGoSystemDefaults sharedSystemDefaults]
|
|
|
|
faviconRelativeURL];
|
|
|
|
|
|
|
|
return (siteFavicon
|
|
|
|
? siteFavicon
|
|
|
|
: [self urlForResourceFilename: @"sogo.ico"]);
|
2009-03-25 22:43:56 +01:00
|
|
|
}
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
/* page based JavaScript */
|
|
|
|
|
2007-10-18 16:44:58 +02:00
|
|
|
- (NSString *) _stringsForFramework: (NSString *) framework
|
|
|
|
{
|
|
|
|
NSString *language, *frameworkName;
|
2009-11-29 05:19:32 +01:00
|
|
|
SOGoUserDefaults *ud;
|
2007-10-18 22:08:35 +02:00
|
|
|
id table;
|
2007-10-18 16:44:58 +02:00
|
|
|
|
|
|
|
frameworkName = [NSString stringWithFormat: @"%@.SOGo",
|
|
|
|
(framework ? framework : [self frameworkName])];
|
2009-11-29 05:19:32 +01:00
|
|
|
ud = [[context activeUser] userDefaults];
|
2009-12-14 15:37:24 +01:00
|
|
|
if (!ud)
|
|
|
|
ud = [SOGoSystemDefaults sharedSystemDefaults];
|
2009-11-29 05:19:32 +01:00
|
|
|
language = [ud language];
|
2007-10-23 00:25:03 +02:00
|
|
|
|
2007-10-18 16:44:58 +02:00
|
|
|
table
|
|
|
|
= [[self resourceManager] stringTableWithName: @"Localizable"
|
|
|
|
inFramework: frameworkName
|
|
|
|
languages: [NSArray arrayWithObject: language]];
|
|
|
|
|
2007-10-18 22:08:35 +02:00
|
|
|
/* table is not really an NSDictionary but a hackish variation thereof */
|
|
|
|
return [[NSDictionary dictionaryWithDictionary: table] jsonRepresentation];
|
2007-10-18 16:44:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) commonLocalizableStrings
|
|
|
|
{
|
2009-09-14 15:52:24 +02:00
|
|
|
NSString *rc;
|
|
|
|
|
|
|
|
if (isPopup)
|
|
|
|
rc = @"";
|
|
|
|
else
|
|
|
|
rc = [NSString stringWithFormat: @"var clabels = %@;",
|
|
|
|
[self _stringsForFramework: nil]];
|
|
|
|
|
|
|
|
return rc;
|
2007-10-18 16:44:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) productLocalizableStrings
|
|
|
|
{
|
|
|
|
NSString *frameworkName;
|
|
|
|
|
|
|
|
frameworkName = [[context page] frameworkName];
|
|
|
|
|
|
|
|
return [NSString stringWithFormat: @"var labels = %@;",
|
|
|
|
[self _stringsForFramework: frameworkName]];
|
|
|
|
}
|
|
|
|
|
2006-07-07 23:19:48 +02:00
|
|
|
- (NSString *) pageJavaScriptURL
|
|
|
|
{
|
2006-06-15 21:34:10 +02:00
|
|
|
WOComponent *page;
|
2006-07-29 00:59:11 +02:00
|
|
|
NSString *pageJSFilename;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2007-09-04 17:00:08 +02:00
|
|
|
page = [context page];
|
2006-07-29 00:59:11 +02:00
|
|
|
pageJSFilename = [NSString stringWithFormat: @"%@.js",
|
|
|
|
NSStringFromClass([page class])];
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
return [self urlForResourceFilename: pageJSFilename];
|
|
|
|
}
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (NSString *) productJavaScriptURL
|
|
|
|
{
|
|
|
|
WOComponent *page;
|
|
|
|
NSString *fwJSFilename;
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2007-09-04 17:00:08 +02:00
|
|
|
page = [context page];
|
2006-07-29 00:59:11 +02:00
|
|
|
fwJSFilename = [NSString stringWithFormat: @"%@.js",
|
|
|
|
[page frameworkName]];
|
|
|
|
|
|
|
|
return [self urlForResourceFilename: fwJSFilename];
|
|
|
|
}
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (BOOL) hasPageSpecificJavaScript
|
|
|
|
{
|
|
|
|
return ([[self pageJavaScriptURL] length] > 0);
|
2006-07-07 23:19:48 +02:00
|
|
|
}
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (BOOL) hasProductSpecificJavaScript
|
|
|
|
{
|
|
|
|
return ([[self productJavaScriptURL] length] > 0);
|
|
|
|
}
|
|
|
|
|
2007-11-18 11:16:25 +01:00
|
|
|
- (void) setCssFiles: (NSString *) newCSSFiles
|
|
|
|
{
|
|
|
|
NSEnumerator *cssFiles;
|
|
|
|
NSString *currentFile, *filename;
|
|
|
|
|
|
|
|
[additionalCSSFiles release];
|
|
|
|
additionalCSSFiles = [NSMutableArray new];
|
|
|
|
|
|
|
|
cssFiles
|
|
|
|
= [[newCSSFiles componentsSeparatedByString: @","] objectEnumerator];
|
|
|
|
while ((currentFile = [cssFiles nextObject]))
|
|
|
|
{
|
|
|
|
filename = [self urlForResourceFilename:
|
|
|
|
[currentFile stringByTrimmingSpaces]];
|
|
|
|
[additionalCSSFiles addObject: filename];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) additionalCSSFiles
|
|
|
|
{
|
|
|
|
return additionalCSSFiles;
|
|
|
|
}
|
|
|
|
|
2007-10-18 22:08:35 +02:00
|
|
|
- (void) setJsFiles: (NSString *) newJSFiles
|
|
|
|
{
|
|
|
|
NSEnumerator *jsFiles;
|
|
|
|
NSString *currentFile, *filename;
|
|
|
|
|
|
|
|
[additionalJSFiles release];
|
|
|
|
additionalJSFiles = [NSMutableArray new];
|
|
|
|
|
|
|
|
jsFiles = [[newJSFiles componentsSeparatedByString: @","] objectEnumerator];
|
|
|
|
while ((currentFile = [jsFiles nextObject]))
|
|
|
|
{
|
|
|
|
filename = [self urlForResourceFilename:
|
|
|
|
[currentFile stringByTrimmingSpaces]];
|
|
|
|
[additionalJSFiles addObject: filename];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) additionalJSFiles
|
|
|
|
{
|
|
|
|
return additionalJSFiles;
|
|
|
|
}
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (NSString *) pageCSSURL
|
2006-07-07 23:19:48 +02:00
|
|
|
{
|
|
|
|
WOComponent *page;
|
2006-07-29 00:59:11 +02:00
|
|
|
NSString *pageJSFilename;
|
2007-03-18 16:13:30 +01:00
|
|
|
|
2007-09-04 17:00:08 +02:00
|
|
|
page = [context page];
|
2006-07-29 00:59:11 +02:00
|
|
|
pageJSFilename = [NSString stringWithFormat: @"%@.css",
|
|
|
|
NSStringFromClass([page class])];
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
return [self urlForResourceFilename: pageJSFilename];
|
|
|
|
}
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (NSString *) productCSSURL
|
|
|
|
{
|
|
|
|
WOComponent *page;
|
|
|
|
NSString *fwJSFilename;
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2007-09-04 17:00:08 +02:00
|
|
|
page = [context page];
|
2006-07-29 00:59:11 +02:00
|
|
|
fwJSFilename = [NSString stringWithFormat: @"%@.css",
|
|
|
|
[page frameworkName]];
|
|
|
|
|
|
|
|
return [self urlForResourceFilename: fwJSFilename];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2006-08-25 22:45:16 +02:00
|
|
|
- (NSString *) thisPageURL
|
|
|
|
{
|
2007-09-04 17:00:08 +02:00
|
|
|
return [[context page] uri];
|
2006-08-25 22:45:16 +02:00
|
|
|
}
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (BOOL) hasPageSpecificCSS
|
2006-07-07 23:19:48 +02:00
|
|
|
{
|
2006-07-29 00:59:11 +02:00
|
|
|
return ([[self pageCSSURL] length] > 0);
|
2006-07-07 23:19:48 +02:00
|
|
|
}
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (BOOL) hasProductSpecificCSS
|
2006-07-07 23:19:48 +02:00
|
|
|
{
|
2006-07-29 00:59:11 +02:00
|
|
|
return ([[self productCSSURL] length] > 0);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2007-12-06 23:46:48 +01:00
|
|
|
- (BOOL) _moduleIs: (NSString *) moduleName
|
|
|
|
{
|
|
|
|
NSString *frameworkName;
|
|
|
|
|
|
|
|
frameworkName = [[context page] frameworkName];
|
|
|
|
|
|
|
|
return [frameworkName isEqualToString: moduleName];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) isCalendar
|
|
|
|
{
|
|
|
|
return [self _moduleIs: @"SchedulerUI"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) isContacts
|
|
|
|
{
|
|
|
|
return [self _moduleIs: @"ContactsUI"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) isMail
|
|
|
|
{
|
|
|
|
return [self _moduleIs: @"MailerUI"];
|
|
|
|
}
|
|
|
|
|
2009-08-13 12:40:25 +02:00
|
|
|
- (BOOL) isAdministration
|
|
|
|
{
|
|
|
|
return [self _moduleIs: @"AdministrationUI"];
|
|
|
|
}
|
|
|
|
|
2006-11-07 19:15:16 +01:00
|
|
|
- (void) setToolbar: (NSString *) newToolbar
|
|
|
|
{
|
|
|
|
ASSIGN (toolbar, newToolbar);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) toolbar
|
|
|
|
{
|
|
|
|
return toolbar;
|
|
|
|
}
|
|
|
|
|
2007-11-19 23:34:31 +01:00
|
|
|
- (BOOL) isSuperUser
|
|
|
|
{
|
2007-11-19 23:56:27 +01:00
|
|
|
SOGoUser *user;
|
|
|
|
|
|
|
|
user = [context activeUser];
|
|
|
|
|
|
|
|
return ([user respondsToSelector: @selector (isSuperUser)]
|
|
|
|
&& [user isSuperUser]);
|
2007-11-19 23:34:31 +01:00
|
|
|
}
|
|
|
|
|
2010-02-19 17:45:07 +01:00
|
|
|
- (NSString *) userIdentification
|
2009-11-04 23:13:20 +01:00
|
|
|
{
|
2010-02-19 17:45:07 +01:00
|
|
|
/* The "identification" term is used in the human sense here. */
|
|
|
|
return [[context activeUser] cn];
|
2009-11-04 23:13:20 +01:00
|
|
|
}
|
|
|
|
|
2009-09-11 16:38:43 +02:00
|
|
|
- (BOOL) canLogoff
|
|
|
|
{
|
|
|
|
BOOL canLogoff;
|
|
|
|
id auth;
|
2010-01-28 22:42:03 +01:00
|
|
|
SOGoSystemDefaults *sd;
|
2009-09-11 16:38:43 +02:00
|
|
|
|
|
|
|
auth = [[self clientObject] authenticatorInContext: context];
|
|
|
|
if ([auth respondsToSelector: @selector (cookieNameInContext:)])
|
2010-01-28 22:42:03 +01:00
|
|
|
{
|
|
|
|
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
|
|
|
canLogoff = ([[auth cookieNameInContext: context] length] > 0
|
|
|
|
&& ![[sd authenticationType] isEqualToString: @"cas"]);
|
|
|
|
}
|
2009-09-11 16:38:43 +02:00
|
|
|
else
|
|
|
|
canLogoff = NO;
|
|
|
|
|
|
|
|
return canLogoff;
|
|
|
|
}
|
|
|
|
|
2007-11-26 21:41:59 +01:00
|
|
|
- (BOOL) userHasCalendarAccess
|
|
|
|
{
|
|
|
|
SOGoUser *user;
|
|
|
|
|
|
|
|
user = [context activeUser];
|
|
|
|
|
|
|
|
return [user canAccessModule: @"Calendar"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) userHasMailAccess
|
|
|
|
{
|
|
|
|
SOGoUser *user;
|
|
|
|
|
|
|
|
user = [context activeUser];
|
|
|
|
|
|
|
|
return [user canAccessModule: @"Mail"];
|
|
|
|
}
|
|
|
|
|
2008-10-18 01:41:27 +02:00
|
|
|
- (NSString *) userLanguage
|
|
|
|
{
|
2009-11-29 05:19:32 +01:00
|
|
|
SOGoUserDefaults *ud;
|
2008-10-18 01:41:27 +02:00
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
ud = [[context activeUser] userDefaults];
|
2008-10-18 01:41:27 +02:00
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
return [ud language];
|
2008-10-18 01:41:27 +02:00
|
|
|
}
|
|
|
|
|
2008-12-19 18:23:31 +01:00
|
|
|
- (NSString *) userSettings
|
|
|
|
{
|
2009-11-29 05:19:32 +01:00
|
|
|
SOGoUserSettings *us;
|
2008-12-19 18:23:31 +01:00
|
|
|
NSString *jsonResult;
|
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
us = [[context activeUser] userSettings];
|
|
|
|
jsonResult = [[us source] jsonRepresentation];
|
|
|
|
if (!jsonResult)
|
2008-12-19 18:23:31 +01:00
|
|
|
jsonResult = @"{}";
|
|
|
|
|
|
|
|
return jsonResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) userDefaults
|
|
|
|
{
|
2009-11-29 05:19:32 +01:00
|
|
|
SOGoUserDefaults *ud;
|
2008-12-19 18:23:31 +01:00
|
|
|
NSString *jsonResult;
|
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
ud = [[context activeUser] userDefaults];
|
|
|
|
jsonResult = [[ud source] jsonRepresentation];
|
|
|
|
if (!jsonResult)
|
2008-12-19 18:23:31 +01:00
|
|
|
jsonResult = @"{}";
|
|
|
|
|
|
|
|
return jsonResult;
|
|
|
|
}
|
|
|
|
|
2007-09-18 22:52:32 +02:00
|
|
|
/* browser/os identification */
|
|
|
|
|
|
|
|
- (BOOL) isCompatibleBrowser
|
|
|
|
{
|
|
|
|
WEClientCapabilities *cc;
|
|
|
|
|
|
|
|
cc = [[context request] clientCapabilities];
|
|
|
|
|
|
|
|
//NSLog(@"Browser = %@", [cc description]);
|
2008-08-20 05:21:33 +02:00
|
|
|
// NSLog(@"User agent = %@", [cc userAgent]);
|
2007-09-18 22:52:32 +02:00
|
|
|
//NSLog(@"Browser major version = %i", [cc majorVersion]);
|
|
|
|
|
2007-10-17 00:04:51 +02:00
|
|
|
return (([[cc userAgentType] isEqualToString: @"IE"]
|
|
|
|
&& [cc majorVersion] >= 7)
|
|
|
|
|| ([[cc userAgentType] isEqualToString: @"Mozilla"]
|
|
|
|
&& [cc majorVersion] >= 5)
|
|
|
|
|| ([[cc userAgentType] isEqualToString: @"Safari"]
|
2009-04-07 17:25:59 +02:00
|
|
|
&& [cc majorVersion] >= 3)
|
2009-03-19 02:41:05 +01:00
|
|
|
|| ([[cc userAgentType] isEqualToString: @"Konqueror"]
|
|
|
|
&& [cc majorVersion] >= 4)
|
2007-09-18 22:52:32 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-06-15 21:34:10 +02:00
|
|
|
@end /* UIxPageFrame */
|