From 663a0b60dd0d2f85df4fcbf259891c1ce48b2c8f Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 25 Apr 2017 16:35:39 -0400 Subject: [PATCH] (feat) Configurable Web animation level --- SoObjects/SOGo/SOGoDefaults.plist | 1 + SoObjects/SOGo/SOGoUserDefaults.h | 5 +++- SoObjects/SOGo/SOGoUserDefaults.m | 17 ++++++++++++-- UI/Common/UIxPageFrame.m | 23 +++++++++++++++---- .../English.lproj/Localizable.strings | 8 +++++++ UI/PreferencesUI/UIxJSONPreferences.m | 5 +++- UI/Templates/PreferencesUI/UIxPreferences.wox | 10 ++++++++ 7 files changed, 60 insertions(+), 9 deletions(-) diff --git a/SoObjects/SOGo/SOGoDefaults.plist b/SoObjects/SOGo/SOGoDefaults.plist index 6812057a9..5f7ba4ba3 100644 --- a/SoObjects/SOGo/SOGoDefaults.plist +++ b/SoObjects/SOGo/SOGoDefaults.plist @@ -87,6 +87,7 @@ SOGoExternalAvatarsEnabled = YES; SOGoGravatarEnabled = NO; SOGoAlternateAvatar = "none"; + SOGoAnimationMode = "normal"; SOGoIMAPServer = "localhost"; SOGoMailDomain = "localhost"; diff --git a/SoObjects/SOGo/SOGoUserDefaults.h b/SoObjects/SOGo/SOGoUserDefaults.h index 828fbaf89..ff7baf84d 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.h +++ b/SoObjects/SOGo/SOGoUserDefaults.h @@ -1,6 +1,6 @@ /* SOGoUserDefaults.h - this file is part of SOGo * - * Copyright (C) 2011-2016 Inverse inc. + * Copyright (C) 2011-2017 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -130,6 +130,9 @@ extern NSString *SOGoWeekStartFirstFullWeek; - (void) setAlternateAvatar: (NSString *) newValue; - (NSString *) alternateAvatar; +- (void) setAnimationMode: (NSString *) newValue; +- (NSString *) animationMode; + - (void) setMailComposeMessageType: (NSString *) newValue; - (NSString *) mailComposeMessageType; diff --git a/SoObjects/SOGo/SOGoUserDefaults.m b/SoObjects/SOGo/SOGoUserDefaults.m index e895f2cf7..f32a1b8cd 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.m +++ b/SoObjects/SOGo/SOGoUserDefaults.m @@ -1,6 +1,6 @@ /* SOGoUserDefaults.m - this file is part of SOGo * - * Copyright (C) 2009-2016 Inverse inc. + * Copyright (C) 2009-2017 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -494,7 +494,7 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; return [self stringArrayForKey: @"SOGoMailListViewColumnsOrder"]; } -- (void) setSelectedAddressBook:(NSString *) newValue +- (void) setSelectedAddressBook: (NSString *) newValue { [self setObject: newValue forKey: @"SOGoSelectedAddressBook"]; } @@ -529,6 +529,19 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; return [self stringForKey: @"SOGoAlternateAvatar"]; } +- (void) setAnimationMode: (NSString *) newValue +{ + if ([newValue isEqualToString: @"normal"] || + [newValue isEqualToString: @"limited"] || + [newValue isEqualToString: @"none"]) + [self setObject: newValue forKey: @"SOGoAnimationMode"]; +} + +- (NSString *) animationMode +{ + return [self stringForKey: @"SOGoAnimationMode"]; +} + - (void) setMailComposeMessageType: (NSString *) newValue { [self setObject: newValue forKey: @"SOGoMailComposeMessageType"]; diff --git a/UI/Common/UIxPageFrame.m b/UI/Common/UIxPageFrame.m index b1526b935..cbfbd1dbe 100644 --- a/UI/Common/UIxPageFrame.m +++ b/UI/Common/UIxPageFrame.m @@ -39,16 +39,27 @@ - (id) init { + if ((self = [super init])) { + NSString *filename; + SOGoUserDefaults *ud; + item = nil; title = nil; toolbar = nil; udKeys = nil; usKeys = nil; additionalJSFiles = nil; - additionalCSSFiles = nil; + additionalCSSFiles = [NSMutableArray new]; systemAdditionalJSFiles = nil; + + ud = [[context activeUser] userDefaults]; + if ([[ud animationMode] isEqualToString: @"none"]) + { + filename = [self urlForResourceFilename: @"css/no-animation.css"]; + [additionalCSSFiles addObject: filename]; + } } return self; @@ -335,9 +346,6 @@ NSEnumerator *cssFiles; NSString *currentFile, *filename; - [additionalCSSFiles release]; - additionalCSSFiles = [NSMutableArray new]; - cssFiles = [[newCSSFiles componentsSeparatedByString: @","] objectEnumerator]; while ((currentFile = [cssFiles nextObject])) { @@ -587,15 +595,20 @@ return [self _dictionaryWithKeys: usKeys fromSource: us]; } + /* browser/os identification */ - (BOOL) disableInk { + SOGoUserDefaults *ud; WEClientCapabilities *cc; + ud = [[context activeUser] userDefaults]; cc = [[context request] clientCapabilities]; - return [[cc userAgentType] isEqualToString: @"IE"]; + return [[cc userAgentType] isEqualToString: @"IE"] || + [[ud animationMode] isEqualToString: @"limited"] || + [[ud animationMode] isEqualToString: @"none"]; } - (BOOL) isCompatibleBrowser diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings index ca4638831..109fa44e1 100644 --- a/UI/PreferencesUI/English.lproj/Localizable.strings +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -400,3 +400,11 @@ "monsterid" = "Monster"; "wavatar" = "Wavatar"; "retro" = "Retro"; + +/* Animation Level */ +"Animation Level" = "Animation Level"; +/* Normal Animation Mode */ +"animation_NORMAL" = "Normal"; +/* Limited Animation Mode */ +"animation_LIMITED" = "Limited"; +"animation_NONE" = "None"; \ No newline at end of file diff --git a/UI/PreferencesUI/UIxJSONPreferences.m b/UI/PreferencesUI/UIxJSONPreferences.m index fa3f75ac3..5dfd7939e 100644 --- a/UI/PreferencesUI/UIxJSONPreferences.m +++ b/UI/PreferencesUI/UIxJSONPreferences.m @@ -1,6 +1,6 @@ /* UIxJSONPreferences.m - this file is part of SOGo * - * Copyright (C) 2007-2016 Inverse inc. + * Copyright (C) 2007-2017 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -126,6 +126,9 @@ static SoProduct *preferencesProduct = nil; [[defaults source] removeObjectForKey: @"SOGoAlternateAvatar"]; } + if (![[defaults source] objectForKey: @"SOGoAnimationMode"]) + [[defaults source] setObject: [defaults animationMode] forKey: @"SOGoAnimationMode"]; + // // Default Calendar preferences // diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 1e6783c98..6b23ad7ae 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -219,6 +219,16 @@ + + + + + + + + + +