mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
eslint (additional rules)
This commit is contained in:
parent
77a1d3f3df
commit
8e8a041032
150 changed files with 21911 additions and 23106 deletions
|
|
@ -1,214 +1,209 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Globals = require('Common/Globals'),
|
||||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractScreen = require('Knoin/AbstractScreen');
|
||||
|
||||
Globals = require('Common/Globals'),
|
||||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Array} aViewModels
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function AbstractSettingsScreen(aViewModels)
|
||||
{
|
||||
AbstractScreen.call(this, 'settings', aViewModels);
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
this.menu = ko.observableArray([]);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Array} aViewModels
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function AbstractSettingsScreen(aViewModels)
|
||||
this.oCurrentSubScreen = null;
|
||||
this.oViewModelPlace = null;
|
||||
|
||||
this.setupSettings();
|
||||
}
|
||||
|
||||
_.extend(AbstractSettingsScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
AbstractSettingsScreen.prototype.setupSettings = function(fCallback)
|
||||
{
|
||||
if (fCallback)
|
||||
{
|
||||
AbstractScreen.call(this, 'settings', aViewModels);
|
||||
fCallback();
|
||||
}
|
||||
};
|
||||
|
||||
this.menu = ko.observableArray([]);
|
||||
AbstractSettingsScreen.prototype.onRoute = function(sSubName)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
oSettingsScreen = null,
|
||||
RoutedSettingsViewModel = null,
|
||||
oViewModelPlace = null,
|
||||
oViewModelDom = null;
|
||||
|
||||
this.oCurrentSubScreen = null;
|
||||
this.oViewModelPlace = null;
|
||||
RoutedSettingsViewModel = _.find(Globals.aViewModels.settings, function(SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
sSubName === SettingsViewModel.__rlSettingsData.Route;
|
||||
});
|
||||
|
||||
this.setupSettings();
|
||||
if (RoutedSettingsViewModel)
|
||||
{
|
||||
if (_.find(Globals.aViewModels['settings-removed'], function(DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
|
||||
if (RoutedSettingsViewModel && _.find(Globals.aViewModels['settings-disabled'], function(DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(AbstractSettingsScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
AbstractSettingsScreen.prototype.setupSettings = function (fCallback)
|
||||
if (RoutedSettingsViewModel)
|
||||
{
|
||||
if (fCallback)
|
||||
if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm)
|
||||
{
|
||||
fCallback();
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.onRoute = function (sSubName)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
oSettingsScreen = null,
|
||||
RoutedSettingsViewModel = null,
|
||||
oViewModelPlace = null,
|
||||
oViewModelDom = null
|
||||
;
|
||||
|
||||
RoutedSettingsViewModel = _.find(Globals.aViewModels.settings, function (SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
sSubName === SettingsViewModel.__rlSettingsData.Route;
|
||||
});
|
||||
|
||||
if (RoutedSettingsViewModel)
|
||||
{
|
||||
if (_.find(Globals.aViewModels['settings-removed'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
|
||||
if (RoutedSettingsViewModel && _.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (RoutedSettingsViewModel)
|
||||
{
|
||||
if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm)
|
||||
{
|
||||
oSettingsScreen = RoutedSettingsViewModel.__vm;
|
||||
}
|
||||
else
|
||||
{
|
||||
oViewModelPlace = this.oViewModelPlace;
|
||||
if (oViewModelPlace && 1 === oViewModelPlace.length)
|
||||
{
|
||||
oSettingsScreen = new RoutedSettingsViewModel();
|
||||
|
||||
oViewModelDom = $('<div></div>').addClass('rl-settings-view-model').hide();
|
||||
oViewModelDom.appendTo(oViewModelPlace);
|
||||
|
||||
oSettingsScreen.viewModelDom = oViewModelDom;
|
||||
|
||||
oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
|
||||
|
||||
RoutedSettingsViewModel.__dom = oViewModelDom;
|
||||
RoutedSettingsViewModel.__builded = true;
|
||||
RoutedSettingsViewModel.__vm = oSettingsScreen;
|
||||
|
||||
ko.applyBindingAccessorsToNode(oViewModelDom[0], {
|
||||
'translatorInit': true,
|
||||
'template': function () { return {'name': RoutedSettingsViewModel.__rlSettingsData.Template}; }
|
||||
}, oSettingsScreen);
|
||||
|
||||
Utils.delegateRun(oSettingsScreen, 'onBuild', [oViewModelDom]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.log('Cannot find sub settings view model position: SettingsSubScreen');
|
||||
}
|
||||
}
|
||||
|
||||
if (oSettingsScreen)
|
||||
{
|
||||
_.defer(function () {
|
||||
// hide
|
||||
if (self.oCurrentSubScreen)
|
||||
{
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onHide');
|
||||
self.oCurrentSubScreen.viewModelDom.hide();
|
||||
}
|
||||
// --
|
||||
|
||||
self.oCurrentSubScreen = oSettingsScreen;
|
||||
|
||||
// show
|
||||
if (self.oCurrentSubScreen)
|
||||
{
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onBeforeShow');
|
||||
self.oCurrentSubScreen.viewModelDom.show();
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onShow');
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onShowWithDelay', [], 200);
|
||||
|
||||
_.each(self.menu(), function (oItem) {
|
||||
oItem.selected(oSettingsScreen && oSettingsScreen.__rlSettingsData && oItem.route === oSettingsScreen.__rlSettingsData.Route);
|
||||
});
|
||||
|
||||
$('#rl-content .b-settings .b-content .content').scrollTop(0);
|
||||
}
|
||||
// --
|
||||
|
||||
Utils.windowResize();
|
||||
});
|
||||
}
|
||||
oSettingsScreen = RoutedSettingsViewModel.__vm;
|
||||
}
|
||||
else
|
||||
{
|
||||
kn.setHash(Links.settings(), false, true);
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.onHide = function ()
|
||||
{
|
||||
if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
|
||||
{
|
||||
Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
|
||||
this.oCurrentSubScreen.viewModelDom.hide();
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.onBuild = function ()
|
||||
{
|
||||
_.each(Globals.aViewModels.settings, function (SettingsViewModel) {
|
||||
if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
!_.find(Globals.aViewModels['settings-removed'], function (RemoveSettingsViewModel) {
|
||||
return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
|
||||
}))
|
||||
oViewModelPlace = this.oViewModelPlace;
|
||||
if (oViewModelPlace && 1 === oViewModelPlace.length)
|
||||
{
|
||||
this.menu.push({
|
||||
route: SettingsViewModel.__rlSettingsData.Route,
|
||||
label: SettingsViewModel.__rlSettingsData.Label,
|
||||
selected: ko.observable(false),
|
||||
disabled: !!_.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel;
|
||||
})
|
||||
});
|
||||
oSettingsScreen = new RoutedSettingsViewModel();
|
||||
|
||||
oViewModelDom = $('<div></div>').addClass('rl-settings-view-model').hide();
|
||||
oViewModelDom.appendTo(oViewModelPlace);
|
||||
|
||||
oSettingsScreen.viewModelDom = oViewModelDom;
|
||||
|
||||
oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
|
||||
|
||||
RoutedSettingsViewModel.__dom = oViewModelDom;
|
||||
RoutedSettingsViewModel.__builded = true;
|
||||
RoutedSettingsViewModel.__vm = oSettingsScreen;
|
||||
|
||||
ko.applyBindingAccessorsToNode(oViewModelDom[0], {
|
||||
translatorInit: true,
|
||||
template: function() {
|
||||
return {
|
||||
name: RoutedSettingsViewModel.__rlSettingsData.Template
|
||||
};
|
||||
}
|
||||
}, oSettingsScreen);
|
||||
|
||||
Utils.delegateRun(oSettingsScreen, 'onBuild', [oViewModelDom]);
|
||||
}
|
||||
}, this);
|
||||
else
|
||||
{
|
||||
Utils.log('Cannot find sub settings view model position: SettingsSubScreen');
|
||||
}
|
||||
}
|
||||
|
||||
this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.routes = function ()
|
||||
{
|
||||
var
|
||||
DefaultViewModel = _.find(Globals.aViewModels.settings, function (SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData.IsDefault;
|
||||
}),
|
||||
sDefaultRoute = DefaultViewModel && DefaultViewModel.__rlSettingsData ?
|
||||
DefaultViewModel.__rlSettingsData.Route : 'general',
|
||||
oRules = {
|
||||
subname: /^(.*)$/,
|
||||
normalize_: function (oRequest, oVals) {
|
||||
oVals.subname = Utils.isUnd(oVals.subname) ? sDefaultRoute : Utils.pString(oVals.subname);
|
||||
return [oVals.subname];
|
||||
if (oSettingsScreen)
|
||||
{
|
||||
_.defer(function() {
|
||||
// hide
|
||||
if (self.oCurrentSubScreen)
|
||||
{
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onHide');
|
||||
self.oCurrentSubScreen.viewModelDom.hide();
|
||||
}
|
||||
// --
|
||||
|
||||
self.oCurrentSubScreen = oSettingsScreen;
|
||||
|
||||
// show
|
||||
if (self.oCurrentSubScreen)
|
||||
{
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onBeforeShow');
|
||||
self.oCurrentSubScreen.viewModelDom.show();
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onShow');
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onShowWithDelay', [], 200);
|
||||
|
||||
_.each(self.menu(), function(oItem) {
|
||||
oItem.selected(oSettingsScreen && oSettingsScreen.__rlSettingsData && oItem.route === oSettingsScreen.__rlSettingsData.Route);
|
||||
});
|
||||
|
||||
$('#rl-content .b-settings .b-content .content').scrollTop(0);
|
||||
}
|
||||
// --
|
||||
|
||||
Utils.windowResize();
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
kn.setHash(Links.settings(), false, true);
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.onHide = function()
|
||||
{
|
||||
if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
|
||||
{
|
||||
Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
|
||||
this.oCurrentSubScreen.viewModelDom.hide();
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.onBuild = function()
|
||||
{
|
||||
_.each(Globals.aViewModels.settings, function(SettingsViewModel) {
|
||||
if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
!_.find(Globals.aViewModels['settings-removed'], function(RemoveSettingsViewModel) {
|
||||
return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
|
||||
}))
|
||||
{
|
||||
this.menu.push({
|
||||
route: SettingsViewModel.__rlSettingsData.Route,
|
||||
label: SettingsViewModel.__rlSettingsData.Label,
|
||||
selected: ko.observable(false),
|
||||
disabled: !!_.find(Globals.aViewModels['settings-disabled'], function(DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel;
|
||||
})
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.routes = function()
|
||||
{
|
||||
var
|
||||
DefaultViewModel = _.find(Globals.aViewModels.settings, function(SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData.IsDefault;
|
||||
}),
|
||||
sDefaultRoute = DefaultViewModel && DefaultViewModel.__rlSettingsData ?
|
||||
DefaultViewModel.__rlSettingsData.Route : 'general',
|
||||
oRules = {
|
||||
subname: /^(.*)$/,
|
||||
normalize_: function(oRequest, oVals) {
|
||||
oVals.subname = Utils.isUnd(oVals.subname) ? sDefaultRoute : Utils.pString(oVals.subname);
|
||||
return [oVals.subname];
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
return [
|
||||
['{subname}/', oRules],
|
||||
['{subname}', oRules],
|
||||
['', oRules]
|
||||
];
|
||||
};
|
||||
return [
|
||||
['{subname}/', oRules],
|
||||
['{subname}', oRules],
|
||||
['', oRules]
|
||||
];
|
||||
};
|
||||
|
||||
module.exports = AbstractSettingsScreen;
|
||||
|
||||
}());
|
||||
module.exports = AbstractSettingsScreen;
|
||||
|
|
|
|||
|
|
@ -1,32 +1,25 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
'use strict';
|
||||
AbstractScreen = require('Knoin/AbstractScreen');
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function LoginAdminScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'login', [
|
||||
require('View/Admin/Login')
|
||||
]);
|
||||
}
|
||||
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
_.extend(LoginAdminScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function LoginAdminScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'login', [
|
||||
require('View/Admin/Login')
|
||||
]);
|
||||
}
|
||||
LoginAdminScreen.prototype.onShow = function()
|
||||
{
|
||||
require('App/Admin').default.setWindowTitle('');
|
||||
};
|
||||
|
||||
_.extend(LoginAdminScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
LoginAdminScreen.prototype.onShow = function ()
|
||||
{
|
||||
require('App/Admin').default.setWindowTitle('');
|
||||
};
|
||||
|
||||
module.exports = LoginAdminScreen;
|
||||
|
||||
}());
|
||||
module.exports = LoginAdminScreen;
|
||||
|
|
|
|||
|
|
@ -1,96 +1,89 @@
|
|||
|
||||
/* global RL_COMMUNITY */
|
||||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
'use strict';
|
||||
kn = require('Knoin/Knoin'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
Plugins = require('Common/Plugins'),
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractSettings = require('Screen/AbstractSettings');
|
||||
|
||||
Plugins = require('Common/Plugins'),
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettings
|
||||
*/
|
||||
function SettingsAdminScreen()
|
||||
{
|
||||
AbstractSettings.call(this, [
|
||||
require('View/Admin/Settings/Menu'),
|
||||
require('View/Admin/Settings/Pane')
|
||||
]);
|
||||
}
|
||||
|
||||
AbstractSettings = require('Screen/AbstractSettings')
|
||||
;
|
||||
_.extend(SettingsAdminScreen.prototype, AbstractSettings.prototype);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettings
|
||||
*/
|
||||
function SettingsAdminScreen()
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
SettingsAdminScreen.prototype.setupSettings = function(fCallback)
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/Admin/General'),
|
||||
'AdminSettingsGeneral', 'TABS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Login'),
|
||||
'AdminSettingsLogin', 'TABS_LABELS/LABEL_LOGIN_NAME', 'login');
|
||||
|
||||
if (RL_COMMUNITY)
|
||||
{
|
||||
AbstractSettings.call(this, [
|
||||
require('View/Admin/Settings/Menu'),
|
||||
require('View/Admin/Settings/Pane')
|
||||
]);
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Branding'),
|
||||
'AdminSettingsBranding', 'TABS_LABELS/LABEL_BRANDING_NAME', 'branding');
|
||||
}
|
||||
else
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Prem/Branding'),
|
||||
'AdminSettingsBranding', 'TABS_LABELS/LABEL_BRANDING_NAME', 'branding');
|
||||
}
|
||||
|
||||
_.extend(SettingsAdminScreen.prototype, AbstractSettings.prototype);
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Contacts'),
|
||||
'AdminSettingsContacts', 'TABS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
SettingsAdminScreen.prototype.setupSettings = function (fCallback)
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Domains'),
|
||||
'AdminSettingsDomains', 'TABS_LABELS/LABEL_DOMAINS_NAME', 'domains');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Security'),
|
||||
'AdminSettingsSecurity', 'TABS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Social'),
|
||||
'AdminSettingsSocial', 'TABS_LABELS/LABEL_INTEGRATION_NAME', 'integrations');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Plugins'),
|
||||
'AdminSettingsPlugins', 'TABS_LABELS/LABEL_PLUGINS_NAME', 'plugins');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Packages'),
|
||||
'AdminSettingsPackages', 'TABS_LABELS/LABEL_PACKAGES_NAME', 'packages');
|
||||
|
||||
if (!RL_COMMUNITY)
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/Admin/General'),
|
||||
'AdminSettingsGeneral', 'TABS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Prem/Licensing'),
|
||||
'AdminSettingsLicensing', 'TABS_LABELS/LABEL_LICENSING_NAME', 'licensing');
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Login'),
|
||||
'AdminSettingsLogin', 'TABS_LABELS/LABEL_LOGIN_NAME', 'login');
|
||||
kn.addSettingsViewModel(require('Settings/Admin/About'),
|
||||
'AdminSettingsAbout', 'TABS_LABELS/LABEL_ABOUT_NAME', 'about');
|
||||
|
||||
if (RL_COMMUNITY)
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Branding'),
|
||||
'AdminSettingsBranding', 'TABS_LABELS/LABEL_BRANDING_NAME', 'branding');
|
||||
}
|
||||
else
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Prem/Branding'),
|
||||
'AdminSettingsBranding', 'TABS_LABELS/LABEL_BRANDING_NAME', 'branding');
|
||||
}
|
||||
Plugins.runSettingsViewModelHooks(true);
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Contacts'),
|
||||
'AdminSettingsContacts', 'TABS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Domains'),
|
||||
'AdminSettingsDomains', 'TABS_LABELS/LABEL_DOMAINS_NAME', 'domains');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Security'),
|
||||
'AdminSettingsSecurity', 'TABS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Social'),
|
||||
'AdminSettingsSocial', 'TABS_LABELS/LABEL_INTEGRATION_NAME', 'integrations');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Plugins'),
|
||||
'AdminSettingsPlugins', 'TABS_LABELS/LABEL_PLUGINS_NAME', 'plugins');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Packages'),
|
||||
'AdminSettingsPackages', 'TABS_LABELS/LABEL_PACKAGES_NAME', 'packages');
|
||||
|
||||
if (!RL_COMMUNITY)
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Prem/Licensing'),
|
||||
'AdminSettingsLicensing', 'TABS_LABELS/LABEL_LICENSING_NAME', 'licensing');
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/About'),
|
||||
'AdminSettingsAbout', 'TABS_LABELS/LABEL_ABOUT_NAME', 'about');
|
||||
|
||||
Plugins.runSettingsViewModelHooks(true);
|
||||
|
||||
if (fCallback)
|
||||
{
|
||||
fCallback();
|
||||
}
|
||||
};
|
||||
|
||||
SettingsAdminScreen.prototype.onShow = function ()
|
||||
if (fCallback)
|
||||
{
|
||||
require('App/Admin').default.setWindowTitle('');
|
||||
};
|
||||
fCallback();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = SettingsAdminScreen;
|
||||
SettingsAdminScreen.prototype.onShow = function()
|
||||
{
|
||||
require('App/Admin').default.setWindowTitle('');
|
||||
};
|
||||
|
||||
}());
|
||||
module.exports = SettingsAdminScreen;
|
||||
|
|
|
|||
|
|
@ -1,32 +1,25 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
'use strict';
|
||||
AbstractScreen = require('Knoin/AbstractScreen');
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function AboutUserScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'about', [
|
||||
require('View/User/About')
|
||||
]);
|
||||
}
|
||||
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
_.extend(AboutUserScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function AboutUserScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'about', [
|
||||
require('View/User/About')
|
||||
]);
|
||||
}
|
||||
AboutUserScreen.prototype.onShow = function()
|
||||
{
|
||||
require('App/User').default.setWindowTitle('RainLoop');
|
||||
};
|
||||
|
||||
_.extend(AboutUserScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
AboutUserScreen.prototype.onShow = function ()
|
||||
{
|
||||
require('App/User').default.setWindowTitle('RainLoop');
|
||||
};
|
||||
|
||||
module.exports = AboutUserScreen;
|
||||
|
||||
}());
|
||||
module.exports = AboutUserScreen;
|
||||
|
|
|
|||
|
|
@ -1,32 +1,25 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
'use strict';
|
||||
AbstractScreen = require('Knoin/AbstractScreen');
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function LoginUserScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'login', [
|
||||
require('View/User/Login')
|
||||
]);
|
||||
}
|
||||
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
_.extend(LoginUserScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function LoginUserScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'login', [
|
||||
require('View/User/Login')
|
||||
]);
|
||||
}
|
||||
LoginUserScreen.prototype.onShow = function()
|
||||
{
|
||||
require('App/User').default.setWindowTitle('');
|
||||
};
|
||||
|
||||
_.extend(LoginUserScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
LoginUserScreen.prototype.onShow = function ()
|
||||
{
|
||||
require('App/User').default.setWindowTitle('');
|
||||
};
|
||||
|
||||
module.exports = LoginUserScreen;
|
||||
|
||||
}());
|
||||
module.exports = LoginUserScreen;
|
||||
|
|
|
|||
|
|
@ -1,204 +1,194 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Globals = require('Common/Globals'),
|
||||
Utils = require('Common/Utils'),
|
||||
Events = require('Common/Events'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
Cache = require('Common/Cache'),
|
||||
|
||||
AppStore = require('Stores/User/App'),
|
||||
AccountStore = require('Stores/User/Account'),
|
||||
SettingsStore = require('Stores/User/Settings'),
|
||||
FolderStore = require('Stores/User/Folder'),
|
||||
MessageStore = require('Stores/User/Message'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
AbstractScreen = require('Knoin/AbstractScreen');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function MailBoxUserScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'mailbox', [
|
||||
require('View/User/MailBox/SystemDropDown'),
|
||||
require('View/User/MailBox/FolderList'),
|
||||
require('View/User/MailBox/MessageList'),
|
||||
require('View/User/MailBox/MessageView')
|
||||
]);
|
||||
|
||||
this.oLastRoute = {};
|
||||
}
|
||||
|
||||
_.extend(MailBoxUserScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
MailBoxUserScreen.prototype.oLastRoute = {};
|
||||
|
||||
MailBoxUserScreen.prototype.updateWindowTitle = function()
|
||||
{
|
||||
var
|
||||
_ = require('_'),
|
||||
sEmail = AccountStore.email(),
|
||||
nFoldersInboxUnreadCount = FolderStore.foldersInboxUnreadCount();
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Globals = require('Common/Globals'),
|
||||
Utils = require('Common/Utils'),
|
||||
Events = require('Common/Events'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
Cache = require('Common/Cache'),
|
||||
|
||||
AppStore = require('Stores/User/App'),
|
||||
AccountStore = require('Stores/User/Account'),
|
||||
SettingsStore = require('Stores/User/Settings'),
|
||||
FolderStore = require('Stores/User/Folder'),
|
||||
MessageStore = require('Stores/User/Message'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function MailBoxUserScreen()
|
||||
if (Settings.appSettingsGet('listPermanentFiltered'))
|
||||
{
|
||||
AbstractScreen.call(this, 'mailbox', [
|
||||
require('View/User/MailBox/SystemDropDown'),
|
||||
require('View/User/MailBox/FolderList'),
|
||||
require('View/User/MailBox/MessageList'),
|
||||
require('View/User/MailBox/MessageView')
|
||||
]);
|
||||
|
||||
this.oLastRoute = {};
|
||||
nFoldersInboxUnreadCount = 0;
|
||||
}
|
||||
|
||||
_.extend(MailBoxUserScreen.prototype, AbstractScreen.prototype);
|
||||
require('App/User').default.setWindowTitle(('' === sEmail ? '' : '' +
|
||||
(0 < nFoldersInboxUnreadCount ? '(' + nFoldersInboxUnreadCount + ') ' : ' ') +
|
||||
sEmail + ' - ') + Translator.i18n('TITLES/MAILBOX'));
|
||||
};
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
MailBoxUserScreen.prototype.oLastRoute = {};
|
||||
MailBoxUserScreen.prototype.onShow = function()
|
||||
{
|
||||
this.updateWindowTitle();
|
||||
|
||||
MailBoxUserScreen.prototype.updateWindowTitle = function ()
|
||||
AppStore.focusedState(Enums.Focused.None);
|
||||
AppStore.focusedState(Enums.Focused.MessageList);
|
||||
|
||||
if (Settings.appSettingsGet('mobile'))
|
||||
{
|
||||
var
|
||||
sEmail = AccountStore.email(),
|
||||
nFoldersInboxUnreadCount = FolderStore.foldersInboxUnreadCount()
|
||||
;
|
||||
Globals.leftPanelDisabled(true);
|
||||
}
|
||||
|
||||
if (Settings.appSettingsGet('listPermanentFiltered'))
|
||||
if (!Settings.capa(Enums.Capa.Folders))
|
||||
{
|
||||
Globals.leftPanelType(
|
||||
Settings.capa(Enums.Capa.Composer) || Settings.capa(Enums.Capa.Contacts) ? 'short' : 'none');
|
||||
}
|
||||
else
|
||||
{
|
||||
Globals.leftPanelType('');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sFolderHash
|
||||
* @param {number} iPage
|
||||
* @param {string} sSearch
|
||||
*/
|
||||
MailBoxUserScreen.prototype.onRoute = function(sFolderHash, iPage, sSearch)
|
||||
{
|
||||
var
|
||||
sThreadUid = sFolderHash.replace(/^(.+)~([\d]+)$/, '$2'),
|
||||
oFolder = Cache.getFolderFromCacheList(Cache.getFolderFullNameRaw(
|
||||
sFolderHash.replace(/~([\d]+)$/, '')));
|
||||
|
||||
if (oFolder)
|
||||
{
|
||||
if (sFolderHash === sThreadUid)
|
||||
{
|
||||
nFoldersInboxUnreadCount = 0;
|
||||
sThreadUid = '';
|
||||
}
|
||||
|
||||
require('App/User').default.setWindowTitle(('' === sEmail ? '' : '' +
|
||||
(0 < nFoldersInboxUnreadCount ? '(' + nFoldersInboxUnreadCount + ') ' : ' ') +
|
||||
sEmail + ' - ') + Translator.i18n('TITLES/MAILBOX'));
|
||||
};
|
||||
FolderStore.currentFolder(oFolder);
|
||||
|
||||
MessageStore.messageListPage(iPage);
|
||||
MessageStore.messageListSearch(sSearch);
|
||||
MessageStore.messageListThreadUid(sThreadUid);
|
||||
|
||||
require('App/User').default.reloadMessageList();
|
||||
}
|
||||
};
|
||||
|
||||
MailBoxUserScreen.prototype.onStart = function()
|
||||
{
|
||||
FolderStore.folderList.subscribe(Utils.windowResizeCallback);
|
||||
|
||||
MessageStore.messageList.subscribe(Utils.windowResizeCallback);
|
||||
MessageStore.message.subscribe(Utils.windowResizeCallback);
|
||||
|
||||
_.delay(function() {
|
||||
SettingsStore.layout.valueHasMutated();
|
||||
}, 50);
|
||||
|
||||
Events.sub('mailbox.inbox-unread-count', _.bind(function(iCount) {
|
||||
|
||||
FolderStore.foldersInboxUnreadCount(iCount);
|
||||
|
||||
var sEmail = AccountStore.email();
|
||||
|
||||
_.each(AccountStore.accounts(), function(oItem) {
|
||||
if (oItem && sEmail === oItem.email)
|
||||
{
|
||||
oItem.count(iCount);
|
||||
}
|
||||
});
|
||||
|
||||
MailBoxUserScreen.prototype.onShow = function ()
|
||||
{
|
||||
this.updateWindowTitle();
|
||||
|
||||
AppStore.focusedState(Enums.Focused.None);
|
||||
AppStore.focusedState(Enums.Focused.MessageList);
|
||||
}, this));
|
||||
};
|
||||
|
||||
if (Settings.appSettingsGet('mobile'))
|
||||
{
|
||||
Globals.leftPanelDisabled(true);
|
||||
}
|
||||
|
||||
if (!Settings.capa(Enums.Capa.Folders))
|
||||
{
|
||||
Globals.leftPanelType(
|
||||
Settings.capa(Enums.Capa.Composer) || Settings.capa(Enums.Capa.Contacts) ? 'short' : 'none');
|
||||
}
|
||||
else
|
||||
{
|
||||
Globals.leftPanelType('');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sFolderHash
|
||||
* @param {number} iPage
|
||||
* @param {string} sSearch
|
||||
*/
|
||||
MailBoxUserScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch)
|
||||
MailBoxUserScreen.prototype.onBuild = function()
|
||||
{
|
||||
if (!Globals.bMobileDevice && !Settings.appSettingsGet('mobile'))
|
||||
{
|
||||
var
|
||||
sThreadUid = sFolderHash.replace(/^(.+)~([\d]+)$/, '$2'),
|
||||
oFolder = Cache.getFolderFromCacheList(Cache.getFolderFullNameRaw(
|
||||
sFolderHash.replace(/~([\d]+)$/, '')))
|
||||
;
|
||||
_.defer(function() {
|
||||
require('App/User').default.initHorizontalLayoutResizer(Enums.ClientSideKeyName.MessageListSize);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (oFolder)
|
||||
{
|
||||
if (sFolderHash === sThreadUid)
|
||||
/**
|
||||
* @returns {Array}
|
||||
*/
|
||||
MailBoxUserScreen.prototype.routes = function()
|
||||
{
|
||||
var
|
||||
sInboxFolderName = Cache.getFolderInboxName(),
|
||||
fNormS = function(oRequest, oVals) {
|
||||
oVals[0] = Utils.pString(oVals[0]);
|
||||
oVals[1] = Utils.pInt(oVals[1]);
|
||||
oVals[1] = 0 >= oVals[1] ? 1 : oVals[1];
|
||||
oVals[2] = Utils.pString(oVals[2]);
|
||||
|
||||
if ('' === oRequest)
|
||||
{
|
||||
sThreadUid = '';
|
||||
oVals[0] = sInboxFolderName;
|
||||
oVals[1] = 1;
|
||||
}
|
||||
|
||||
FolderStore.currentFolder(oFolder);
|
||||
return [decodeURI(oVals[0]), oVals[1], decodeURI(oVals[2])];
|
||||
},
|
||||
fNormD = function(oRequest, oVals) {
|
||||
oVals[0] = Utils.pString(oVals[0]);
|
||||
oVals[1] = Utils.pString(oVals[1]);
|
||||
|
||||
MessageStore.messageListPage(iPage);
|
||||
MessageStore.messageListSearch(sSearch);
|
||||
MessageStore.messageListThreadUid(sThreadUid);
|
||||
|
||||
require('App/User').default.reloadMessageList();
|
||||
}
|
||||
};
|
||||
|
||||
MailBoxUserScreen.prototype.onStart = function ()
|
||||
{
|
||||
FolderStore.folderList.subscribe(Utils.windowResizeCallback);
|
||||
|
||||
MessageStore.messageList.subscribe(Utils.windowResizeCallback);
|
||||
MessageStore.message.subscribe(Utils.windowResizeCallback);
|
||||
|
||||
_.delay(function () {
|
||||
SettingsStore.layout.valueHasMutated();
|
||||
}, 50);
|
||||
|
||||
Events.sub('mailbox.inbox-unread-count', _.bind(function (iCount) {
|
||||
|
||||
FolderStore.foldersInboxUnreadCount(iCount);
|
||||
|
||||
var sEmail = AccountStore.email();
|
||||
|
||||
_.each(AccountStore.accounts(), function (oItem) {
|
||||
if (oItem && sEmail === oItem.email)
|
||||
{
|
||||
oItem.count(iCount);
|
||||
}
|
||||
});
|
||||
|
||||
this.updateWindowTitle();
|
||||
|
||||
}, this));
|
||||
};
|
||||
|
||||
MailBoxUserScreen.prototype.onBuild = function ()
|
||||
{
|
||||
if (!Globals.bMobileDevice && !Settings.appSettingsGet('mobile'))
|
||||
{
|
||||
_.defer(function () {
|
||||
require('App/User').default.initHorizontalLayoutResizer(Enums.ClientSideKeyName.MessageListSize);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {Array}
|
||||
*/
|
||||
MailBoxUserScreen.prototype.routes = function ()
|
||||
{
|
||||
var
|
||||
sInboxFolderName = Cache.getFolderInboxName(),
|
||||
fNormS = function (oRequest, oVals) {
|
||||
oVals[0] = Utils.pString(oVals[0]);
|
||||
oVals[1] = Utils.pInt(oVals[1]);
|
||||
oVals[1] = 0 >= oVals[1] ? 1 : oVals[1];
|
||||
oVals[2] = Utils.pString(oVals[2]);
|
||||
|
||||
if ('' === oRequest)
|
||||
{
|
||||
oVals[0] = sInboxFolderName;
|
||||
oVals[1] = 1;
|
||||
}
|
||||
|
||||
return [decodeURI(oVals[0]), oVals[1], decodeURI(oVals[2])];
|
||||
},
|
||||
fNormD = function (oRequest, oVals) {
|
||||
oVals[0] = Utils.pString(oVals[0]);
|
||||
oVals[1] = Utils.pString(oVals[1]);
|
||||
|
||||
if ('' === oRequest)
|
||||
{
|
||||
oVals[0] = sInboxFolderName;
|
||||
}
|
||||
|
||||
return [decodeURI(oVals[0]), 1, decodeURI(oVals[1])];
|
||||
if ('' === oRequest)
|
||||
{
|
||||
oVals[0] = sInboxFolderName;
|
||||
}
|
||||
;
|
||||
|
||||
return [
|
||||
[/^([a-zA-Z0-9~]+)\/p([1-9][0-9]*)\/(.+)\/?$/, {'normalize_': fNormS}],
|
||||
[/^([a-zA-Z0-9~]+)\/p([1-9][0-9]*)$/, {'normalize_': fNormS}],
|
||||
[/^([a-zA-Z0-9~]+)\/(.+)\/?$/, {'normalize_': fNormD}],
|
||||
[/^([^\/]*)$/, {'normalize_': fNormS}]
|
||||
];
|
||||
};
|
||||
return [decodeURI(oVals[0]), 1, decodeURI(oVals[1])];
|
||||
};
|
||||
|
||||
module.exports = MailBoxUserScreen;
|
||||
return [
|
||||
[/^([a-zA-Z0-9~]+)\/p([1-9][0-9]*)\/(.+)\/?$/, {'normalize_': fNormS}],
|
||||
[/^([a-zA-Z0-9~]+)\/p([1-9][0-9]*)$/, {'normalize_': fNormS}],
|
||||
[/^([a-zA-Z0-9~]+)\/(.+)\/?$/, {'normalize_': fNormD}],
|
||||
[/^([^\/]*)$/, {'normalize_': fNormS}]
|
||||
];
|
||||
};
|
||||
|
||||
}());
|
||||
module.exports = MailBoxUserScreen;
|
||||
|
|
|
|||
|
|
@ -1,157 +1,150 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Globals = require('Common/Globals'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
Plugins = require('Common/Plugins'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Globals = require('Common/Globals'),
|
||||
Translator = require('Common/Translator'),
|
||||
AppStore = require('Stores/User/App'),
|
||||
AccountStore = require('Stores/User/Account'),
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
Plugins = require('Common/Plugins'),
|
||||
kn = require('Knoin/Knoin'),
|
||||
|
||||
AppStore = require('Stores/User/App'),
|
||||
AccountStore = require('Stores/User/Account'),
|
||||
Settings = require('Storage/Settings'),
|
||||
AbstractSettingsScreen = require('Screen/AbstractSettings');
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettingsScreen
|
||||
*/
|
||||
function SettingsUserScreen()
|
||||
{
|
||||
AbstractSettingsScreen.call(this, [
|
||||
require('View/User/Settings/SystemDropDown'),
|
||||
require('View/User/Settings/Menu'),
|
||||
require('View/User/Settings/Pane')
|
||||
]);
|
||||
|
||||
AbstractSettingsScreen = require('Screen/AbstractSettings')
|
||||
;
|
||||
Translator.initOnStartOrLangChange(function() {
|
||||
this.sSettingsTitle = Translator.i18n('TITLES/SETTINGS');
|
||||
}, this, function() {
|
||||
this.setSettingsTitle();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettingsScreen
|
||||
*/
|
||||
function SettingsUserScreen()
|
||||
_.extend(SettingsUserScreen.prototype, AbstractSettingsScreen.prototype);
|
||||
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
SettingsUserScreen.prototype.setupSettings = function(fCallback)
|
||||
{
|
||||
if (!Settings.capa(Enums.Capa.Settings))
|
||||
{
|
||||
AbstractSettingsScreen.call(this, [
|
||||
require('View/User/Settings/SystemDropDown'),
|
||||
require('View/User/Settings/Menu'),
|
||||
require('View/User/Settings/Pane')
|
||||
]);
|
||||
|
||||
Translator.initOnStartOrLangChange(function () {
|
||||
this.sSettingsTitle = Translator.i18n('TITLES/SETTINGS');
|
||||
}, this, function () {
|
||||
this.setSettingsTitle();
|
||||
});
|
||||
}
|
||||
|
||||
_.extend(SettingsUserScreen.prototype, AbstractSettingsScreen.prototype);
|
||||
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
SettingsUserScreen.prototype.setupSettings = function (fCallback)
|
||||
{
|
||||
if (!Settings.capa(Enums.Capa.Settings))
|
||||
{
|
||||
if (fCallback)
|
||||
{
|
||||
fCallback();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/User/General'),
|
||||
'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
||||
|
||||
if (AppStore.contactsIsAllowed())
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Contacts'),
|
||||
'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.AdditionalAccounts) || Settings.capa(Enums.Capa.Identities))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Accounts'), 'SettingsAccounts',
|
||||
Settings.capa(Enums.Capa.AdditionalAccounts) ?
|
||||
'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME' : 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'accounts');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.Sieve))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Filters'),
|
||||
'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.AutoLogout) || Settings.capa(Enums.Capa.TwoFactor))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Security'),
|
||||
'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
}
|
||||
|
||||
if (AccountStore.isRootAccount() && (
|
||||
(Settings.settingsGet('AllowGoogleSocial') && Settings.settingsGet('AllowGoogleSocialAuth')) ||
|
||||
Settings.settingsGet('AllowFacebookSocial') ||
|
||||
Settings.settingsGet('AllowTwitterSocial')))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Social'),
|
||||
'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
|
||||
}
|
||||
|
||||
if (Settings.settingsGet('ChangePasswordIsAllowed'))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/ChangePassword'),
|
||||
'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.Templates))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Templates'),
|
||||
'SettingsTemplates', 'SETTINGS_LABELS/LABEL_TEMPLATES_NAME', 'templates');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.Folders))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Folders'),
|
||||
'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.Themes))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Themes'),
|
||||
'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.OpenPGP))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/OpenPgp'),
|
||||
'SettingsOpenPGP', 'SETTINGS_LABELS/LABEL_OPEN_PGP_NAME', 'openpgp');
|
||||
}
|
||||
|
||||
Plugins.runSettingsViewModelHooks(false);
|
||||
|
||||
if (fCallback)
|
||||
{
|
||||
fCallback();
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
return false;
|
||||
}
|
||||
|
||||
SettingsUserScreen.prototype.onShow = function ()
|
||||
kn.addSettingsViewModel(require('Settings/User/General'),
|
||||
'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
||||
|
||||
if (AppStore.contactsIsAllowed())
|
||||
{
|
||||
this.setSettingsTitle();
|
||||
Globals.keyScope(Enums.KeyState.Settings);
|
||||
Globals.leftPanelType('');
|
||||
kn.addSettingsViewModel(require('Settings/User/Contacts'),
|
||||
'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||
}
|
||||
|
||||
if (Settings.appSettingsGet('mobile'))
|
||||
{
|
||||
Globals.leftPanelDisabled(true);
|
||||
}
|
||||
};
|
||||
|
||||
SettingsUserScreen.prototype.setSettingsTitle = function ()
|
||||
if (Settings.capa(Enums.Capa.AdditionalAccounts) || Settings.capa(Enums.Capa.Identities))
|
||||
{
|
||||
var sEmail = AccountStore.email();
|
||||
require('App/User').default.setWindowTitle(('' === sEmail ? '' : sEmail + ' - ') + this.sSettingsTitle);
|
||||
};
|
||||
kn.addSettingsViewModel(require('Settings/User/Accounts'), 'SettingsAccounts',
|
||||
Settings.capa(Enums.Capa.AdditionalAccounts) ?
|
||||
'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME' : 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'accounts');
|
||||
}
|
||||
|
||||
module.exports = SettingsUserScreen;
|
||||
if (Settings.capa(Enums.Capa.Sieve))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Filters'),
|
||||
'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||
}
|
||||
|
||||
}());
|
||||
if (Settings.capa(Enums.Capa.AutoLogout) || Settings.capa(Enums.Capa.TwoFactor))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Security'),
|
||||
'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
}
|
||||
|
||||
if (AccountStore.isRootAccount() && (
|
||||
(Settings.settingsGet('AllowGoogleSocial') && Settings.settingsGet('AllowGoogleSocialAuth')) ||
|
||||
Settings.settingsGet('AllowFacebookSocial') ||
|
||||
Settings.settingsGet('AllowTwitterSocial')))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Social'),
|
||||
'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
|
||||
}
|
||||
|
||||
if (Settings.settingsGet('ChangePasswordIsAllowed'))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/ChangePassword'),
|
||||
'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.Templates))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Templates'),
|
||||
'SettingsTemplates', 'SETTINGS_LABELS/LABEL_TEMPLATES_NAME', 'templates');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.Folders))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Folders'),
|
||||
'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.Themes))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/Themes'),
|
||||
'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.OpenPGP))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/User/OpenPgp'),
|
||||
'SettingsOpenPGP', 'SETTINGS_LABELS/LABEL_OPEN_PGP_NAME', 'openpgp');
|
||||
}
|
||||
|
||||
Plugins.runSettingsViewModelHooks(false);
|
||||
|
||||
if (fCallback)
|
||||
{
|
||||
fCallback();
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
SettingsUserScreen.prototype.onShow = function()
|
||||
{
|
||||
this.setSettingsTitle();
|
||||
Globals.keyScope(Enums.KeyState.Settings);
|
||||
Globals.leftPanelType('');
|
||||
|
||||
if (Settings.appSettingsGet('mobile'))
|
||||
{
|
||||
Globals.leftPanelDisabled(true);
|
||||
}
|
||||
};
|
||||
|
||||
SettingsUserScreen.prototype.setSettingsTitle = function()
|
||||
{
|
||||
var sEmail = AccountStore.email();
|
||||
require('App/User').default.setWindowTitle(('' === sEmail ? '' : sEmail + ' - ') + this.sSettingsTitle);
|
||||
};
|
||||
|
||||
module.exports = SettingsUserScreen;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue