snappymail/dev/Screen/Admin/Settings.js

90 lines
2.9 KiB
JavaScript
Raw Normal View History

2019-07-05 03:19:24 +08:00
import { addSettingsViewModel } from 'Knoin/Knoin';
import { runSettingsViewModelHooks } from 'Common/Plugins';
2016-07-07 07:11:13 +08:00
2019-07-05 03:19:24 +08:00
import { AbstractSettingsScreen } from 'Screen/AbstractSettings';
2016-07-07 07:11:13 +08:00
2019-07-05 03:19:24 +08:00
import { GeneralAdminSettings } from 'Settings/Admin/General';
import { DomainsAdminSettings } from 'Settings/Admin/Domains';
import { LoginAdminSettings } from 'Settings/Admin/Login';
import { ContactsAdminSettings } from 'Settings/Admin/Contacts';
import { SecurityAdminSettings } from 'Settings/Admin/Security';
import { SocialAdminSettings } from 'Settings/Admin/Social';
import { PluginsAdminSettings } from 'Settings/Admin/Plugins';
import { PackagesAdminSettings } from 'Settings/Admin/Packages';
import { AboutAdminSettings } from 'Settings/Admin/About';
2016-07-16 03:54:37 +08:00
2019-07-05 03:19:24 +08:00
import { getApp } from 'Helper/Apps/Admin';
2019-07-05 03:19:24 +08:00
import { MenuSettingsAdminView } from 'View/Admin/Settings/Menu';
import { PaneSettingsAdminView } from 'View/Admin/Settings/Pane';
2019-07-05 03:19:24 +08:00
class SettingsAdminScreen extends AbstractSettingsScreen {
2016-07-16 05:29:42 +08:00
constructor() {
2019-07-05 03:19:24 +08:00
super([MenuSettingsAdminView, PaneSettingsAdminView]);
2016-07-07 07:11:13 +08:00
}
/**
* @param {Function=} fCallback = null
*/
setupSettings(fCallback = null) {
2017-07-11 20:40:31 +08:00
let branding = null,
licensing = null;
2016-07-07 07:11:13 +08:00
2019-07-05 03:19:24 +08:00
if (RL_COMMUNITY) {
2017-07-11 20:40:31 +08:00
branding = require('Settings/Admin/Branding').default;
2019-07-05 03:19:24 +08:00
} else {
2017-07-11 20:40:31 +08:00
branding = require('Settings/Admin/Prem/Branding').default;
licensing = require('Settings/Admin/Prem/Licensing').default;
2016-07-07 07:11:13 +08:00
}
2019-07-05 03:19:24 +08:00
addSettingsViewModel(
GeneralAdminSettings,
'AdminSettingsGeneral',
'TABS_LABELS/LABEL_GENERAL_NAME',
'general',
true
);
2016-07-07 07:11:13 +08:00
2019-07-05 03:19:24 +08:00
addSettingsViewModel(DomainsAdminSettings, 'AdminSettingsDomains', 'TABS_LABELS/LABEL_DOMAINS_NAME', 'domains');
2016-07-07 07:11:13 +08:00
2019-07-05 03:19:24 +08:00
addSettingsViewModel(LoginAdminSettings, 'AdminSettingsLogin', 'TABS_LABELS/LABEL_LOGIN_NAME', 'login');
2017-07-11 20:40:31 +08:00
2019-07-05 03:19:24 +08:00
if (branding) {
addSettingsViewModel(branding, 'AdminSettingsBranding', 'TABS_LABELS/LABEL_BRANDING_NAME', 'branding');
2017-07-11 20:40:31 +08:00
}
2019-07-05 03:19:24 +08:00
addSettingsViewModel(ContactsAdminSettings, 'AdminSettingsContacts', 'TABS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
2017-07-11 20:40:31 +08:00
2019-07-05 03:19:24 +08:00
addSettingsViewModel(SecurityAdminSettings, 'AdminSettingsSecurity', 'TABS_LABELS/LABEL_SECURITY_NAME', 'security');
2016-07-07 07:11:13 +08:00
2019-07-05 03:19:24 +08:00
addSettingsViewModel(
SocialAdminSettings,
'AdminSettingsSocial',
'TABS_LABELS/LABEL_INTEGRATION_NAME',
'integrations'
);
2016-07-07 07:11:13 +08:00
2019-07-05 03:19:24 +08:00
addSettingsViewModel(PluginsAdminSettings, 'AdminSettingsPlugins', 'TABS_LABELS/LABEL_PLUGINS_NAME', 'plugins');
2016-07-07 07:11:13 +08:00
2019-07-05 03:19:24 +08:00
addSettingsViewModel(PackagesAdminSettings, 'AdminSettingsPackages', 'TABS_LABELS/LABEL_PACKAGES_NAME', 'packages');
2016-07-07 07:11:13 +08:00
2019-07-05 03:19:24 +08:00
if (licensing) {
addSettingsViewModel(licensing, 'AdminSettingsLicensing', 'TABS_LABELS/LABEL_LICENSING_NAME', 'licensing');
2016-07-07 07:11:13 +08:00
}
2019-07-05 03:19:24 +08:00
addSettingsViewModel(AboutAdminSettings, 'AdminSettingsAbout', 'TABS_LABELS/LABEL_ABOUT_NAME', 'about');
2016-07-07 07:11:13 +08:00
runSettingsViewModelHooks(true);
2019-07-05 03:19:24 +08:00
if (fCallback) {
2016-07-07 07:11:13 +08:00
fCallback();
}
}
onShow() {
getApp().setWindowTitle('');
2016-07-07 07:11:13 +08:00
}
}
2019-07-05 03:19:24 +08:00
export { SettingsAdminScreen, SettingsAdminScreen as default };