2009-11-29 05:19:32 +01:00
|
|
|
|
2006-06-15 21:34:10 +02:00
|
|
|
/*
|
|
|
|
Copyright (C) 2004-2005 SKYRIX Software AG
|
2016-01-05 20:00:43 +01:00
|
|
|
Copyright (C) 2005-2015 Inverse inc.
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2012-06-22 01:32:18 +02:00
|
|
|
This file is part of SOGo.
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2012-06-22 01:32:18 +02:00
|
|
|
SOGo is free software; you can redistribute it and/or modify it under
|
2006-06-15 21:34:10 +02:00
|
|
|
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.
|
|
|
|
|
2012-06-22 01:32:18 +02:00
|
|
|
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
2006-06-15 21:34:10 +02:00
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2010-08-11 15:31:59 +02:00
|
|
|
#import <Foundation/NSNull.h>
|
2012-09-22 03:48:39 +02:00
|
|
|
#import <Foundation/NSUserDefaults.h> /* for locale strings */
|
2008-08-20 05:21:33 +02:00
|
|
|
|
|
|
|
#import <NGObjWeb/WOResourceManager.h>
|
2007-03-18 16:13:30 +01:00
|
|
|
|
2010-08-09 16:17:22 +02:00
|
|
|
#import <SOGo/NSArray+Utilities.h>
|
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>
|
2009-11-29 05:19:32 +01:00
|
|
|
#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
|
|
|
|
{
|
2017-04-25 22:35:39 +02:00
|
|
|
|
2006-11-07 19:15:16 +01:00
|
|
|
if ((self = [super init]))
|
|
|
|
{
|
2017-04-25 22:35:39 +02:00
|
|
|
NSString *filename;
|
|
|
|
SOGoUserDefaults *ud;
|
|
|
|
|
2007-10-18 22:08:35 +02:00
|
|
|
item = nil;
|
|
|
|
title = nil;
|
2006-11-07 19:15:16 +01:00
|
|
|
toolbar = nil;
|
2010-08-09 16:17:22 +02:00
|
|
|
udKeys = nil;
|
|
|
|
usKeys = nil;
|
2007-10-18 22:08:35 +02:00
|
|
|
additionalJSFiles = nil;
|
2017-04-25 22:35:39 +02:00
|
|
|
additionalCSSFiles = [NSMutableArray new];
|
2010-09-14 16:06:20 +02:00
|
|
|
systemAdditionalJSFiles = nil;
|
2017-04-25 22:35:39 +02:00
|
|
|
|
|
|
|
ud = [[context activeUser] userDefaults];
|
|
|
|
if ([[ud animationMode] isEqualToString: @"none"])
|
|
|
|
{
|
|
|
|
filename = [self urlForResourceFilename: @"css/no-animation.css"];
|
|
|
|
[additionalCSSFiles addObject: filename];
|
|
|
|
}
|
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];
|
2010-08-09 16:17:22 +02:00
|
|
|
[udKeys release];
|
|
|
|
[usKeys release];
|
2007-10-18 22:08:35 +02:00
|
|
|
[additionalJSFiles release];
|
2009-10-13 16:04:02 +02:00
|
|
|
[additionalCSSFiles release];
|
2010-09-14 16:06:20 +02:00
|
|
|
[systemAdditionalJSFiles 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
|
|
|
|
{
|
2011-03-30 17:21:27 +02:00
|
|
|
NSString *pageTitle;
|
|
|
|
SOGoSystemDefaults *sd;
|
|
|
|
|
2006-06-15 21:34:10 +02:00
|
|
|
if ([self isUIxDebugEnabled])
|
2011-03-30 17:21:27 +02:00
|
|
|
pageTitle = title;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
|
|
|
pageTitle = [sd pageTitle];
|
|
|
|
if (pageTitle == nil || ![pageTitle length])
|
2016-01-05 20:00:43 +01:00
|
|
|
pageTitle = (@"SOGo");
|
2011-03-30 17:21:27 +02:00
|
|
|
}
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2011-03-30 17:21:27 +02:00
|
|
|
return pageTitle;
|
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
|
|
|
|
{
|
2015-04-02 02:20:22 +02:00
|
|
|
return (@"<!DOCTYPE html>");
|
2006-09-26 20:40:04 +02:00
|
|
|
}
|
|
|
|
|
2016-03-22 19:25:55 +01:00
|
|
|
/* Help URL */
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) helpURL
|
2006-07-29 00:59:11 +02:00
|
|
|
{
|
2016-03-22 19:25:55 +01:00
|
|
|
SOGoSystemDefaults *sd;
|
|
|
|
NSString *s;
|
2006-07-29 00:59:11 +02:00
|
|
|
|
2016-03-22 19:25:55 +01:00
|
|
|
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
|
|
|
|
|
|
|
if ((s = [sd helpURL]))
|
|
|
|
return s;
|
|
|
|
|
|
|
|
return @"";
|
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
|
|
|
|
{
|
2015-02-25 23:21:07 +01:00
|
|
|
return [self relativePathToUserFolderSubPath: @"Preferences/"];
|
2007-06-19 20:05:22 +02:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2010-06-10 23:57:14 +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
|
2014-06-19 21:54:12 +02:00
|
|
|
: [self urlForResourceFilename: @"img/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;
|
2012-09-22 03:48:39 +02:00
|
|
|
NSMutableDictionary* strings;
|
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
|
|
|
|
2012-09-22 03:48:39 +02:00
|
|
|
// When no framework is specified, we load the strings from UI/Common
|
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]];
|
|
|
|
|
2012-09-22 03:48:39 +02:00
|
|
|
strings = [NSMutableDictionary dictionaryWithDictionary: table];
|
|
|
|
|
|
|
|
if (!framework)
|
|
|
|
{
|
|
|
|
// Add strings from Locale
|
|
|
|
NSDictionary *moreStrings;
|
|
|
|
|
2016-02-02 02:54:37 +01:00
|
|
|
// AM/PM
|
|
|
|
moreStrings = [NSDictionary dictionaryWithObjects: [locale objectForKey: NSAMPMDesignation]
|
|
|
|
forKeys: [UIxComponent amPmLabelKeys]];
|
|
|
|
[strings addEntriesFromDictionary: moreStrings];
|
|
|
|
|
2012-09-22 03:48:39 +02:00
|
|
|
// Month names
|
|
|
|
moreStrings = [NSDictionary dictionaryWithObjects: [locale objectForKey: NSMonthNameArray]
|
|
|
|
forKeys: [UIxComponent monthLabelKeys]];
|
|
|
|
[strings addEntriesFromDictionary: moreStrings];
|
|
|
|
|
|
|
|
// Short month names
|
|
|
|
moreStrings = [NSDictionary dictionaryWithObjects: [locale objectForKey: NSShortMonthNameArray]
|
|
|
|
forKeys: [UIxComponent abbrMonthLabelKeys]];
|
|
|
|
[strings addEntriesFromDictionary: moreStrings];
|
|
|
|
}
|
|
|
|
|
2007-10-18 22:08:35 +02:00
|
|
|
/* table is not really an NSDictionary but a hackish variation thereof */
|
2012-09-22 03:48:39 +02:00
|
|
|
return [strings jsonRepresentation];
|
2007-10-18 16:44:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) commonLocalizableStrings
|
|
|
|
{
|
2015-09-04 23:31:16 +02:00
|
|
|
return [NSString stringWithFormat: @"var clabels = %@;", [self _stringsForFramework: nil]];
|
2007-10-18 16:44:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) productLocalizableStrings
|
|
|
|
{
|
|
|
|
NSString *frameworkName;
|
|
|
|
|
|
|
|
frameworkName = [[context page] frameworkName];
|
|
|
|
|
2014-06-19 21:54:12 +02:00
|
|
|
return [NSString stringWithFormat: @"var labels = %@;", [self _stringsForFramework: frameworkName]];
|
2007-10-18 16:44:58 +02:00
|
|
|
}
|
|
|
|
|
2014-09-03 20:25:45 +02:00
|
|
|
- (NSString *) angularModule
|
|
|
|
{
|
|
|
|
NSString *frameworkName;
|
|
|
|
|
|
|
|
frameworkName = [[context page] frameworkName];
|
|
|
|
|
|
|
|
return [NSString stringWithFormat: @"SOGo.%@", frameworkName];
|
|
|
|
}
|
|
|
|
|
2006-07-07 23:19:48 +02:00
|
|
|
- (NSString *) pageJavaScriptURL
|
|
|
|
{
|
2006-06-15 21:34:10 +02:00
|
|
|
WOComponent *page;
|
2014-08-13 22:11:28 +02:00
|
|
|
NSString *theme, *filename, *url;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2014-08-13 22:11:28 +02:00
|
|
|
url = nil;
|
2014-06-19 21:54:12 +02:00
|
|
|
page = [context page];
|
2014-08-06 22:01:05 +02:00
|
|
|
theme = [context objectForKey: @"theme"];
|
|
|
|
if ([theme length])
|
|
|
|
{
|
|
|
|
filename = [NSString stringWithFormat: @"js/%@/%@.js", theme, NSStringFromClass([page class])];
|
2014-08-13 22:11:28 +02:00
|
|
|
url = [self urlForResourceFilename: filename];
|
2014-08-06 22:01:05 +02:00
|
|
|
}
|
2014-08-13 22:11:28 +02:00
|
|
|
if ([url length] == 0)
|
2014-08-06 22:01:05 +02:00
|
|
|
{
|
2014-08-13 22:11:28 +02:00
|
|
|
// No theme defined or no specific JavaScript for the theme; rollback to default JavaScript
|
2014-08-06 22:01:05 +02:00
|
|
|
filename = [NSString stringWithFormat: @"js/%@.js", NSStringFromClass([page class])];
|
2014-08-13 22:11:28 +02:00
|
|
|
url = [self urlForResourceFilename: filename];
|
2014-08-06 22:01:05 +02:00
|
|
|
}
|
2015-07-03 16:22:48 +02:00
|
|
|
//NSLog(@"pageJavaScript => %@", filename);
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2014-08-13 22:11:28 +02:00
|
|
|
return url;
|
2006-07-29 00:59:11 +02:00
|
|
|
}
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (NSString *) productJavaScriptURL
|
|
|
|
{
|
|
|
|
WOComponent *page;
|
2014-08-13 22:11:28 +02:00
|
|
|
NSString *theme, *filename, *url;
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2014-08-13 22:11:28 +02:00
|
|
|
url = nil;
|
2007-09-04 17:00:08 +02:00
|
|
|
page = [context page];
|
2014-08-06 22:01:05 +02:00
|
|
|
[context resourceLookupLanguages];
|
|
|
|
theme = [context objectForKey: @"theme"];
|
|
|
|
if ([theme length])
|
|
|
|
{
|
|
|
|
filename = [NSString stringWithFormat: @"js/%@/%@.js", theme, [page frameworkName]];
|
2014-08-13 22:11:28 +02:00
|
|
|
url = [self urlForResourceFilename: filename];
|
2014-08-06 22:01:05 +02:00
|
|
|
}
|
2014-08-13 22:11:28 +02:00
|
|
|
if ([url length] == 0)
|
2014-08-06 22:01:05 +02:00
|
|
|
{
|
|
|
|
filename = [NSString stringWithFormat: @"js/%@.js", [page frameworkName]];
|
2014-08-13 22:11:28 +02:00
|
|
|
url = [self urlForResourceFilename: filename];
|
2014-08-06 22:01:05 +02:00
|
|
|
}
|
2015-07-03 16:22:48 +02:00
|
|
|
//NSLog(@"productJavaScript => %@", filename);
|
2006-07-29 00:59:11 +02:00
|
|
|
|
2014-08-13 22:11:28 +02:00
|
|
|
return url;
|
2006-07-29 00:59:11 +02:00
|
|
|
}
|
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;
|
|
|
|
|
2014-06-19 21:54:12 +02:00
|
|
|
cssFiles = [[newCSSFiles componentsSeparatedByString: @","] objectEnumerator];
|
2007-11-18 11:16:25 +01:00
|
|
|
while ((currentFile = [cssFiles nextObject]))
|
|
|
|
{
|
2014-06-19 21:54:12 +02:00
|
|
|
filename = [self urlForResourceFilename: [NSString stringWithFormat: @"css/%@", [currentFile stringByTrimmingSpaces]]];
|
2007-11-18 11:16:25 +01:00
|
|
|
[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]))
|
|
|
|
{
|
2014-06-19 21:54:12 +02:00
|
|
|
filename = [self urlForResourceFilename: [NSString stringWithFormat: @"js/%@", [currentFile stringByTrimmingSpaces]]];
|
2007-10-18 22:08:35 +02:00
|
|
|
[additionalJSFiles addObject: filename];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) additionalJSFiles
|
|
|
|
{
|
|
|
|
return additionalJSFiles;
|
|
|
|
}
|
|
|
|
|
2010-09-14 16:06:20 +02:00
|
|
|
- (NSArray *) systemAdditionalJSFiles
|
|
|
|
{
|
|
|
|
NSArray *prefsJSFiles;
|
|
|
|
SOGoDomainDefaults *dd;
|
|
|
|
int count, max;
|
|
|
|
NSString *currentFile, *filename;
|
|
|
|
|
|
|
|
if (!systemAdditionalJSFiles)
|
|
|
|
{
|
|
|
|
systemAdditionalJSFiles = [NSMutableArray new];
|
|
|
|
dd = [[context activeUser] domainDefaults];
|
|
|
|
prefsJSFiles = [dd additionalJSFiles];
|
|
|
|
max = [prefsJSFiles count];
|
|
|
|
for (count = 0; count < max; count++)
|
|
|
|
{
|
|
|
|
currentFile = [prefsJSFiles objectAtIndex: count];
|
2014-06-19 21:54:12 +02:00
|
|
|
filename = [self urlForResourceFilename: [currentFile stringByTrimmingSpaces]];
|
2010-09-14 16:06:20 +02:00
|
|
|
[systemAdditionalJSFiles addObject: filename];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return systemAdditionalJSFiles;
|
|
|
|
}
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (NSString *) pageCSSURL
|
2006-07-07 23:19:48 +02:00
|
|
|
{
|
|
|
|
WOComponent *page;
|
2014-06-19 21:54:12 +02:00
|
|
|
NSString *filename;
|
2007-03-18 16:13:30 +01:00
|
|
|
|
2007-09-04 17:00:08 +02:00
|
|
|
page = [context page];
|
2014-06-19 21:54:12 +02:00
|
|
|
filename = [NSString stringWithFormat: @"css/%@.css",
|
|
|
|
NSStringFromClass([page class])];
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2014-06-19 21:54:12 +02:00
|
|
|
return [self urlForResourceFilename: filename];
|
2006-07-29 00:59:11 +02:00
|
|
|
}
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (NSString *) productCSSURL
|
|
|
|
{
|
|
|
|
WOComponent *page;
|
2014-06-19 21:54:12 +02:00
|
|
|
NSString *filename;
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2007-09-04 17:00:08 +02:00
|
|
|
page = [context page];
|
2014-06-19 21:54:12 +02:00
|
|
|
filename = [NSString stringWithFormat: @"css/%@.css",
|
|
|
|
[page frameworkName]];
|
2006-07-29 00:59:11 +02:00
|
|
|
|
2014-06-19 21:54:12 +02:00
|
|
|
return [self urlForResourceFilename: filename];
|
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
|
|
|
}
|
|
|
|
|
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-08-12 19:34:32 +02:00
|
|
|
- (BOOL) usesCASAuthentication
|
|
|
|
{
|
|
|
|
SOGoSystemDefaults *sd;
|
|
|
|
|
|
|
|
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
|
|
|
|
|
|
|
return [[sd authenticationType] isEqualToString: @"cas"];
|
|
|
|
}
|
|
|
|
|
2018-04-17 21:14:48 +02:00
|
|
|
- (BOOL) usesSAML2Authentication
|
|
|
|
{
|
|
|
|
SOGoSystemDefaults *sd;
|
|
|
|
|
|
|
|
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
|
|
|
|
|
|
|
return [[sd authenticationType] isEqualToString: @"saml2"];
|
|
|
|
}
|
|
|
|
|
2010-02-19 17:45:07 +01:00
|
|
|
- (NSString *) userIdentification
|
2009-11-04 23:13:20 +01:00
|
|
|
{
|
2016-04-11 20:53:17 +02:00
|
|
|
NSString *v;
|
|
|
|
|
2010-02-19 17:45:07 +01:00
|
|
|
/* The "identification" term is used in the human sense here. */
|
2016-04-11 20:53:17 +02:00
|
|
|
v = [[context activeUser] cn];
|
|
|
|
|
|
|
|
return (v ? v : @"");
|
2009-11-04 23:13:20 +01:00
|
|
|
}
|
|
|
|
|
2015-08-14 18:14:15 +02:00
|
|
|
- (NSString *) userEmail
|
|
|
|
{
|
2016-02-01 16:41:22 +01:00
|
|
|
NSDictionary *identity;
|
|
|
|
|
|
|
|
identity = [[context activeUser] defaultIdentity];
|
|
|
|
|
|
|
|
return [identity objectForKey: @"email"];
|
2015-08-14 18:14:15 +02: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;
|
2012-11-02 20:31:49 +01:00
|
|
|
NSString *authType;
|
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];
|
2012-11-02 20:31:49 +01:00
|
|
|
authType = [sd authenticationType];
|
|
|
|
if ([authType isEqualToString: @"cas"])
|
2010-12-09 20:15:02 +01:00
|
|
|
canLogoff = [sd CASLogoutEnabled];
|
2012-11-02 20:31:49 +01:00
|
|
|
else if ([authType isEqualToString: @"saml2"])
|
|
|
|
canLogoff = [sd SAML2LogoutEnabled];
|
2010-12-09 20:15:02 +01:00
|
|
|
else
|
|
|
|
canLogoff = [[auth cookieNameInContext: context] length] > 0;
|
2010-01-28 22:42:03 +01:00
|
|
|
}
|
2009-09-11 16:38:43 +02:00
|
|
|
else
|
|
|
|
canLogoff = NO;
|
|
|
|
|
|
|
|
return canLogoff;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2010-08-09 16:17:22 +02:00
|
|
|
/* UserDefaults, UserSettings */
|
|
|
|
- (NSString *) _dictionaryWithKeys: (NSArray *) keys
|
|
|
|
fromSource: (SOGoDefaultsSource *) source
|
2008-12-19 18:23:31 +01:00
|
|
|
{
|
2010-08-09 16:17:22 +02:00
|
|
|
NSString *key;
|
|
|
|
int count, max;
|
|
|
|
NSMutableDictionary *dict;
|
2010-08-11 15:31:59 +02:00
|
|
|
NSNull *nsNull;
|
|
|
|
id value;
|
|
|
|
|
|
|
|
nsNull = [NSNull null];
|
2008-12-19 18:23:31 +01:00
|
|
|
|
2010-08-09 16:17:22 +02:00
|
|
|
max = [keys count];
|
2008-12-19 18:23:31 +01:00
|
|
|
|
2010-08-09 16:17:22 +02:00
|
|
|
dict = [NSMutableDictionary dictionaryWithCapacity: max];
|
|
|
|
for (count = 0; count < max; count++)
|
|
|
|
{
|
|
|
|
key = [keys objectAtIndex: count];
|
2010-08-11 15:31:59 +02:00
|
|
|
value = [source objectForKey: key];
|
|
|
|
if (!value)
|
|
|
|
value = nsNull;
|
|
|
|
[dict setObject: value forKey: key];
|
2010-08-09 16:17:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return [dict jsonRepresentation];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setUserDefaultsKeys: (NSString *) newKeys
|
|
|
|
{
|
|
|
|
[udKeys release];
|
|
|
|
udKeys = [[newKeys componentsSeparatedByString: @","] trimmedComponents];
|
|
|
|
[udKeys retain];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) hasUserDefaultsKeys
|
|
|
|
{
|
|
|
|
return ([udKeys count] > 0);
|
2008-12-19 18:23:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) userDefaults
|
|
|
|
{
|
2009-11-29 05:19:32 +01:00
|
|
|
SOGoUserDefaults *ud;
|
2008-12-19 18:23:31 +01:00
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
ud = [[context activeUser] userDefaults];
|
2008-12-19 18:23:31 +01:00
|
|
|
|
2010-08-09 16:17:22 +02:00
|
|
|
return [self _dictionaryWithKeys: udKeys fromSource: ud];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setUserSettingsKeys: (NSString *) newKeys
|
|
|
|
{
|
|
|
|
[usKeys release];
|
|
|
|
usKeys = [[newKeys componentsSeparatedByString: @","] trimmedComponents];
|
|
|
|
[usKeys retain];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) hasUserSettingsKeys
|
|
|
|
{
|
|
|
|
return ([usKeys count] > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) userSettings
|
|
|
|
{
|
|
|
|
SOGoUserSettings *us;
|
|
|
|
|
|
|
|
us = [[context activeUser] userSettings];
|
|
|
|
|
|
|
|
return [self _dictionaryWithKeys: usKeys fromSource: us];
|
2008-12-19 18:23:31 +01:00
|
|
|
}
|
|
|
|
|
2017-04-25 22:35:39 +02:00
|
|
|
|
2007-09-18 22:52:32 +02:00
|
|
|
/* browser/os identification */
|
|
|
|
|
2017-03-09 18:16:51 +01:00
|
|
|
- (BOOL) disableInk
|
|
|
|
{
|
2017-04-25 22:35:39 +02:00
|
|
|
SOGoUserDefaults *ud;
|
2017-03-09 18:16:51 +01:00
|
|
|
WEClientCapabilities *cc;
|
|
|
|
|
2017-04-25 22:35:39 +02:00
|
|
|
ud = [[context activeUser] userDefaults];
|
2017-03-09 18:16:51 +01:00
|
|
|
cc = [[context request] clientCapabilities];
|
|
|
|
|
2017-04-25 22:35:39 +02:00
|
|
|
return [[cc userAgentType] isEqualToString: @"IE"] ||
|
|
|
|
[[ud animationMode] isEqualToString: @"limited"] ||
|
|
|
|
[[ud animationMode] isEqualToString: @"none"];
|
2017-03-09 18:16:51 +01:00
|
|
|
}
|
|
|
|
|
2007-09-18 22:52:32 +02:00
|
|
|
- (BOOL) isCompatibleBrowser
|
|
|
|
{
|
|
|
|
WEClientCapabilities *cc;
|
|
|
|
|
|
|
|
cc = [[context request] clientCapabilities];
|
|
|
|
|
|
|
|
//NSLog(@"Browser = %@", [cc description]);
|
2010-09-03 21:20:02 +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)
|
2010-09-03 21:20:02 +02:00
|
|
|
|| [[cc userAgentType] isEqualToString: @"Opera"]
|
2007-09-18 22:52:32 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-03-31 16:55:13 +02:00
|
|
|
@end /* UIxPageFrame */
|
2014-06-19 21:54:12 +02:00
|
|
|
|
2015-03-31 16:55:13 +02:00
|
|
|
@interface UIxSidenavToolbarTemplate : UIxComponent
|
|
|
|
@end
|
2014-06-19 21:54:12 +02:00
|
|
|
|
2015-03-31 16:55:13 +02:00
|
|
|
@implementation UIxSidenavToolbarTemplate
|
|
|
|
@end
|