This commit is contained in:
RainLoop Team 2014-05-05 00:36:48 +04:00
parent e5ded48d14
commit 3328bcd9eb
14 changed files with 88 additions and 30 deletions

View file

@ -18,6 +18,7 @@ function AdminGeneral()
this.allowLanguagesOnSettings = oData.allowLanguagesOnSettings;
this.allowAdditionalAccounts = oData.allowAdditionalAccounts;
this.allowIdentities = oData.allowIdentities;
this.allowGravatar = oData.allowGravatar;
this.themesOptions = ko.computed(function () {
return _.map(oData.themes(), function (sTheme) {
@ -80,6 +81,12 @@ AdminGeneral.prototype.onBuild = function ()
});
});
self.allowGravatar.subscribe(function (bValue) {
RL.remote().saveAdminConfig(null, {
'AllowGravatar': bValue ? '1' : '0'
});
});
self.allowThemes.subscribe(function (bValue) {
RL.remote().saveAdminConfig(null, {
'AllowThemes': bValue ? '1' : '0'

View file

@ -937,6 +937,7 @@ Utils.initDataConstructorBySettings = function (oData)
oData.allowCustomTheme = ko.observable(false);
oData.allowAdditionalAccounts = ko.observable(false);
oData.allowIdentities = ko.observable(false);
oData.allowGravatar = ko.observable(false);
oData.determineUserLanguage = ko.observable(false);
oData.messagesPerPage = ko.observable(Consts.Defaults.MessagesPerPage);//.extend({'throttle': 200});

View file

@ -7,6 +7,7 @@ function AbstractCacheStorage()
{
this.oEmailsPicsHashes = {};
this.oServices = {};
this.bAllowGravatar = !!RL.settingsGet('AllowGravatar');
}
/**
@ -19,6 +20,11 @@ AbstractCacheStorage.prototype.oEmailsPicsHashes = {};
*/
AbstractCacheStorage.prototype.oServices = {};
/**
* @type {boolean}
*/
AbstractCacheStorage.prototype.bAllowGravatar = false;
AbstractCacheStorage.prototype.clear = function ()
{
this.oServices = {};
@ -51,14 +57,14 @@ AbstractCacheStorage.prototype.getUserPic = function (sEmail, fCallback)
}
// if ('' === sUrl) // Gravatar // TODO
// {
// fCallback('//secure.gravatar.com/avatar/' + Utils.md5(sEmailLower) + '.jpg?s=80&d=mm', sEmail);
// }
// else
// {
if (this.bAllowGravatar && '' === sUrl)
{
fCallback('//secure.gravatar.com/avatar/' + Utils.md5(sEmailLower) + '.jpg?s=80&d=mm', sEmail);
}
else
{
fCallback(sUrl, sEmail);
// }
}
};
/**

View file

@ -87,6 +87,7 @@ AbstractData.prototype.populateDataOnStart = function()
this.allowCustomTheme(!!RL.settingsGet('AllowCustomTheme'));
this.allowAdditionalAccounts(!!RL.settingsGet('AllowAdditionalAccounts'));
this.allowIdentities(!!RL.settingsGet('AllowIdentities'));
this.allowGravatar(!!RL.settingsGet('AllowGravatar'));
this.determineUserLanguage(!!RL.settingsGet('DetermineUserLanguage'));
this.allowThemes(!!RL.settingsGet('AllowThemes'));

View file

@ -7,6 +7,10 @@ label {
cursor: pointer;
}
label.inline {
display: inline-block;
}
.legend {
display: block;
width: 100%;

View file

@ -985,6 +985,7 @@ class Actions
'AllowAdditionalAccounts' => (bool) $oConfig->Get('webmail', 'allow_additional_accounts', true),
'AllowIdentities' => (bool) $oConfig->Get('webmail', 'allow_identities', true),
'AllowPrefetch' => (bool) $oConfig->Get('labs', 'allow_prefetch', true),
'AllowGravatar' => (bool) $oConfig->Get('labs', 'allow_gravatar', true),
'AllowCustomLogin' => (bool) $oConfig->Get('login', 'allow_custom_login', false),
'LoginDefaultDomain' => $oConfig->Get('login', 'default_domain', ''),
'DetermineUserLanguage' => (bool) $oConfig->Get('login', 'determine_user_language', true),
@ -2097,6 +2098,8 @@ class Actions
$this->setConfigFromParams($oConfig, 'AllowAdditionalAccounts', 'webmail', 'allow_additional_accounts', 'bool');
$this->setConfigFromParams($oConfig, 'AllowIdentities', 'webmail', 'allow_identities', 'bool');
$this->setConfigFromParams($oConfig, 'AllowGravatar', 'labs', 'allow_gravatar', 'bool');
$this->setConfigFromParams($oConfig, 'DetermineUserLanguage', 'login', 'determine_user_language', 'bool');

View file

@ -212,6 +212,7 @@ Enables caching in the system'),
'Experimental settings. Handle with care.
'),
'check_new_password_strength' => array(true),
'allow_gravatar' => array(true),
'allow_prefetch' => array(true),
'allow_smart_html_links' => array(true),
'cache_system_data' => array(true),

View file

@ -64,5 +64,14 @@
</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="inline" data-bind="click: function () { allowGravatar(!allowGravatar()); }">
<i data-bind="css: allowGravatar() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
Allow Gravatar
</label>
(<a class="g-ui-link" href="http://en.gravatar.com/" target="_blank">http://en.gravatar.com/</a>)
</div>
</div>
</div>
</div>

View file

@ -6243,6 +6243,9 @@ body {
label {
cursor: pointer;
}
label.inline {
display: inline-block;
}
.legend {
display: block;
width: 100%;

File diff suppressed because one or more lines are too long

View file

@ -1661,6 +1661,7 @@ Utils.initDataConstructorBySettings = function (oData)
oData.allowCustomTheme = ko.observable(false);
oData.allowAdditionalAccounts = ko.observable(false);
oData.allowIdentities = ko.observable(false);
oData.allowGravatar = ko.observable(false);
oData.determineUserLanguage = ko.observable(false);
oData.messagesPerPage = ko.observable(Consts.Defaults.MessagesPerPage);//.extend({'throttle': 200});
@ -5769,6 +5770,7 @@ function AdminGeneral()
this.allowLanguagesOnSettings = oData.allowLanguagesOnSettings;
this.allowAdditionalAccounts = oData.allowAdditionalAccounts;
this.allowIdentities = oData.allowIdentities;
this.allowGravatar = oData.allowGravatar;
this.themesOptions = ko.computed(function () {
return _.map(oData.themes(), function (sTheme) {
@ -5831,6 +5833,12 @@ AdminGeneral.prototype.onBuild = function ()
});
});
self.allowGravatar.subscribe(function (bValue) {
RL.remote().saveAdminConfig(null, {
'AllowGravatar': bValue ? '1' : '0'
});
});
self.allowThemes.subscribe(function (bValue) {
RL.remote().saveAdminConfig(null, {
'AllowThemes': bValue ? '1' : '0'
@ -6842,6 +6850,7 @@ AbstractData.prototype.populateDataOnStart = function()
this.allowCustomTheme(!!RL.settingsGet('AllowCustomTheme'));
this.allowAdditionalAccounts(!!RL.settingsGet('AllowAdditionalAccounts'));
this.allowIdentities(!!RL.settingsGet('AllowIdentities'));
this.allowGravatar(!!RL.settingsGet('AllowGravatar'));
this.determineUserLanguage(!!RL.settingsGet('DetermineUserLanguage'));
this.allowThemes(!!RL.settingsGet('AllowThemes'));
@ -7453,6 +7462,7 @@ function AbstractCacheStorage()
{
this.oEmailsPicsHashes = {};
this.oServices = {};
this.bAllowGravatar = !!RL.settingsGet('AllowGravatar');
}
/**
@ -7465,6 +7475,11 @@ AbstractCacheStorage.prototype.oEmailsPicsHashes = {};
*/
AbstractCacheStorage.prototype.oServices = {};
/**
* @type {boolean}
*/
AbstractCacheStorage.prototype.bAllowGravatar = false;
AbstractCacheStorage.prototype.clear = function ()
{
this.oServices = {};
@ -7497,14 +7512,14 @@ AbstractCacheStorage.prototype.getUserPic = function (sEmail, fCallback)
}
// if ('' === sUrl) // Gravatar // TODO
// {
// fCallback('//secure.gravatar.com/avatar/' + Utils.md5(sEmailLower) + '.jpg?s=80&d=mm', sEmail);
// }
// else
// {
if (this.bAllowGravatar && '' === sUrl)
{
fCallback('//secure.gravatar.com/avatar/' + Utils.md5(sEmailLower) + '.jpg?s=80&d=mm', sEmail);
}
else
{
fCallback(sUrl, sEmail);
// }
}
};
/**

File diff suppressed because one or more lines are too long

View file

@ -1665,6 +1665,7 @@ Utils.initDataConstructorBySettings = function (oData)
oData.allowCustomTheme = ko.observable(false);
oData.allowAdditionalAccounts = ko.observable(false);
oData.allowIdentities = ko.observable(false);
oData.allowGravatar = ko.observable(false);
oData.determineUserLanguage = ko.observable(false);
oData.messagesPerPage = ko.observable(Consts.Defaults.MessagesPerPage);//.extend({'throttle': 200});
@ -15188,6 +15189,7 @@ AbstractData.prototype.populateDataOnStart = function()
this.allowCustomTheme(!!RL.settingsGet('AllowCustomTheme'));
this.allowAdditionalAccounts(!!RL.settingsGet('AllowAdditionalAccounts'));
this.allowIdentities(!!RL.settingsGet('AllowIdentities'));
this.allowGravatar(!!RL.settingsGet('AllowGravatar'));
this.determineUserLanguage(!!RL.settingsGet('DetermineUserLanguage'));
this.allowThemes(!!RL.settingsGet('AllowThemes'));
@ -17557,6 +17559,7 @@ function AbstractCacheStorage()
{
this.oEmailsPicsHashes = {};
this.oServices = {};
this.bAllowGravatar = !!RL.settingsGet('AllowGravatar');
}
/**
@ -17569,6 +17572,11 @@ AbstractCacheStorage.prototype.oEmailsPicsHashes = {};
*/
AbstractCacheStorage.prototype.oServices = {};
/**
* @type {boolean}
*/
AbstractCacheStorage.prototype.bAllowGravatar = false;
AbstractCacheStorage.prototype.clear = function ()
{
this.oServices = {};
@ -17601,14 +17609,14 @@ AbstractCacheStorage.prototype.getUserPic = function (sEmail, fCallback)
}
// if ('' === sUrl) // Gravatar // TODO
// {
// fCallback('//secure.gravatar.com/avatar/' + Utils.md5(sEmailLower) + '.jpg?s=80&d=mm', sEmail);
// }
// else
// {
if (this.bAllowGravatar && '' === sUrl)
{
fCallback('//secure.gravatar.com/avatar/' + Utils.md5(sEmailLower) + '.jpg?s=80&d=mm', sEmail);
}
else
{
fCallback(sUrl, sEmail);
// }
}
};
/**

File diff suppressed because one or more lines are too long