(feat) Configurable Web animation level

This commit is contained in:
Francis Lachapelle 2017-04-25 16:35:39 -04:00
parent 59dbef5ee7
commit 663a0b60dd
7 changed files with 60 additions and 9 deletions

View file

@ -87,6 +87,7 @@
SOGoExternalAvatarsEnabled = YES; SOGoExternalAvatarsEnabled = YES;
SOGoGravatarEnabled = NO; SOGoGravatarEnabled = NO;
SOGoAlternateAvatar = "none"; SOGoAlternateAvatar = "none";
SOGoAnimationMode = "normal";
SOGoIMAPServer = "localhost"; SOGoIMAPServer = "localhost";
SOGoMailDomain = "localhost"; SOGoMailDomain = "localhost";

View file

@ -1,6 +1,6 @@
/* SOGoUserDefaults.h - this file is part of SOGo /* 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 * 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 * it under the terms of the GNU General Public License as published by
@ -130,6 +130,9 @@ extern NSString *SOGoWeekStartFirstFullWeek;
- (void) setAlternateAvatar: (NSString *) newValue; - (void) setAlternateAvatar: (NSString *) newValue;
- (NSString *) alternateAvatar; - (NSString *) alternateAvatar;
- (void) setAnimationMode: (NSString *) newValue;
- (NSString *) animationMode;
- (void) setMailComposeMessageType: (NSString *) newValue; - (void) setMailComposeMessageType: (NSString *) newValue;
- (NSString *) mailComposeMessageType; - (NSString *) mailComposeMessageType;

View file

@ -1,6 +1,6 @@
/* SOGoUserDefaults.m - this file is part of SOGo /* 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 * 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 * it under the terms of the GNU General Public License as published by
@ -494,7 +494,7 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
return [self stringArrayForKey: @"SOGoMailListViewColumnsOrder"]; return [self stringArrayForKey: @"SOGoMailListViewColumnsOrder"];
} }
- (void) setSelectedAddressBook:(NSString *) newValue - (void) setSelectedAddressBook: (NSString *) newValue
{ {
[self setObject: newValue forKey: @"SOGoSelectedAddressBook"]; [self setObject: newValue forKey: @"SOGoSelectedAddressBook"];
} }
@ -529,6 +529,19 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
return [self stringForKey: @"SOGoAlternateAvatar"]; 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 - (void) setMailComposeMessageType: (NSString *) newValue
{ {
[self setObject: newValue forKey: @"SOGoMailComposeMessageType"]; [self setObject: newValue forKey: @"SOGoMailComposeMessageType"];

View file

@ -39,16 +39,27 @@
- (id) init - (id) init
{ {
if ((self = [super init])) if ((self = [super init]))
{ {
NSString *filename;
SOGoUserDefaults *ud;
item = nil; item = nil;
title = nil; title = nil;
toolbar = nil; toolbar = nil;
udKeys = nil; udKeys = nil;
usKeys = nil; usKeys = nil;
additionalJSFiles = nil; additionalJSFiles = nil;
additionalCSSFiles = nil; additionalCSSFiles = [NSMutableArray new];
systemAdditionalJSFiles = nil; systemAdditionalJSFiles = nil;
ud = [[context activeUser] userDefaults];
if ([[ud animationMode] isEqualToString: @"none"])
{
filename = [self urlForResourceFilename: @"css/no-animation.css"];
[additionalCSSFiles addObject: filename];
}
} }
return self; return self;
@ -335,9 +346,6 @@
NSEnumerator *cssFiles; NSEnumerator *cssFiles;
NSString *currentFile, *filename; NSString *currentFile, *filename;
[additionalCSSFiles release];
additionalCSSFiles = [NSMutableArray new];
cssFiles = [[newCSSFiles componentsSeparatedByString: @","] objectEnumerator]; cssFiles = [[newCSSFiles componentsSeparatedByString: @","] objectEnumerator];
while ((currentFile = [cssFiles nextObject])) while ((currentFile = [cssFiles nextObject]))
{ {
@ -587,15 +595,20 @@
return [self _dictionaryWithKeys: usKeys fromSource: us]; return [self _dictionaryWithKeys: usKeys fromSource: us];
} }
/* browser/os identification */ /* browser/os identification */
- (BOOL) disableInk - (BOOL) disableInk
{ {
SOGoUserDefaults *ud;
WEClientCapabilities *cc; WEClientCapabilities *cc;
ud = [[context activeUser] userDefaults];
cc = [[context request] clientCapabilities]; cc = [[context request] clientCapabilities];
return [[cc userAgentType] isEqualToString: @"IE"]; return [[cc userAgentType] isEqualToString: @"IE"] ||
[[ud animationMode] isEqualToString: @"limited"] ||
[[ud animationMode] isEqualToString: @"none"];
} }
- (BOOL) isCompatibleBrowser - (BOOL) isCompatibleBrowser

View file

@ -400,3 +400,11 @@
"monsterid" = "Monster"; "monsterid" = "Monster";
"wavatar" = "Wavatar"; "wavatar" = "Wavatar";
"retro" = "Retro"; "retro" = "Retro";
/* Animation Level */
"Animation Level" = "Animation Level";
/* Normal Animation Mode */
"animation_NORMAL" = "Normal";
/* Limited Animation Mode */
"animation_LIMITED" = "Limited";
"animation_NONE" = "None";

View file

@ -1,6 +1,6 @@
/* UIxJSONPreferences.m - this file is part of SOGo /* 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 * 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 * 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"]; [[defaults source] removeObjectForKey: @"SOGoAlternateAvatar"];
} }
if (![[defaults source] objectForKey: @"SOGoAnimationMode"])
[[defaults source] setObject: [defaults animationMode] forKey: @"SOGoAnimationMode"];
// //
// Default Calendar preferences // Default Calendar preferences
// //

View file

@ -219,6 +219,16 @@
</md-input-container> </md-input-container>
</div> </div>
</var:if> </var:if>
<md-input-container class="md-block md-input-has-value">
<label><var:string label:value="Animation Level"/></label>
<md-radio-group ng-model="app.preferences.defaults.SOGoAnimationMode">
<md-radio-button value="normal"><var:string label:value="animation_NORMAL"/></md-radio-button>
<md-radio-button value="limited"><var:string label:value="animation_LIMITED"/></md-radio-button>
<md-radio-button value="none"><var:string label:value="animation_NONE"/></md-radio-button>
</md-radio-group>
</md-input-container>
</div> </div>
</md-content> </md-content>
</md-tab> </md-tab>