mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-31 03:52:01 +08:00
Code refactoring (4) (es5 -> es2015)
This commit is contained in:
parent
e8df1cdb57
commit
d7ab67a460
30 changed files with 164 additions and 173 deletions
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
/* global RL_COMMUNITY */
|
|
||||||
import window from 'window';
|
import window from 'window';
|
||||||
import _ from '_';
|
import _ from '_';
|
||||||
import $ from '$';
|
import $ from '$';
|
||||||
|
|
|
@ -85,6 +85,15 @@ export function pBool(value)
|
||||||
return !!value;
|
return !!value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {*} value
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function boolToAjax(value)
|
||||||
|
{
|
||||||
|
return value ? '1' : '0';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {*} values
|
* @param {*} values
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
|
|
7
dev/External/ko.js
vendored
7
dev/External/ko.js
vendored
|
@ -1201,6 +1201,13 @@ ko.extenders.specialThrottle = function(oTarget, iOption)
|
||||||
return oTarget;
|
return oTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ko.extenders.idleTrigger = function(oTarget)
|
||||||
|
{
|
||||||
|
var Enums = require('Common/Enums');
|
||||||
|
oTarget.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||||
|
return oTarget;
|
||||||
|
};
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
|
|
||||||
ko.observable.fn.validateNone = function()
|
ko.observable.fn.validateNone = function()
|
||||||
|
|
|
@ -1,12 +1,20 @@
|
||||||
|
|
||||||
/* global RL_COMMUNITY */
|
|
||||||
|
|
||||||
import {addSettingsViewModel} from 'Knoin/Knoin';
|
import {addSettingsViewModel} from 'Knoin/Knoin';
|
||||||
import {runSettingsViewModelHooks} from 'Common/Plugins';
|
import {runSettingsViewModelHooks} from 'Common/Plugins';
|
||||||
|
|
||||||
import {AbstractSettingsScreen} from 'Screen/AbstractSettings';
|
import {AbstractSettingsScreen} from 'Screen/AbstractSettings';
|
||||||
import App from 'App/Admin';
|
import App from 'App/Admin';
|
||||||
|
|
||||||
|
import {GeneralAdminSettings} from 'Settings/Admin/General';
|
||||||
|
import {LoginAdminSettings} from 'Settings/Admin/Login';
|
||||||
|
import {ContactsAdminSettings} from 'Settings/Admin/Contacts';
|
||||||
|
import {DomainsAdminSettings} from 'Settings/Admin/Domains';
|
||||||
|
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';
|
||||||
|
|
||||||
class SettingsAdminScreen extends AbstractSettingsScreen
|
class SettingsAdminScreen extends AbstractSettingsScreen
|
||||||
{
|
{
|
||||||
constructor()
|
constructor()
|
||||||
|
@ -21,49 +29,49 @@ class SettingsAdminScreen extends AbstractSettingsScreen
|
||||||
* @param {Function=} fCallback = null
|
* @param {Function=} fCallback = null
|
||||||
*/
|
*/
|
||||||
setupSettings(fCallback = null) {
|
setupSettings(fCallback = null) {
|
||||||
addSettingsViewModel(require('Settings/Admin/General'),
|
addSettingsViewModel(GeneralAdminSettings,
|
||||||
'AdminSettingsGeneral', 'TABS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
'AdminSettingsGeneral', 'TABS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
||||||
|
|
||||||
addSettingsViewModel(require('Settings/Admin/Login'),
|
addSettingsViewModel(LoginAdminSettings,
|
||||||
'AdminSettingsLogin', 'TABS_LABELS/LABEL_LOGIN_NAME', 'login');
|
'AdminSettingsLogin', 'TABS_LABELS/LABEL_LOGIN_NAME', 'login');
|
||||||
|
|
||||||
if (RL_COMMUNITY)
|
if (RL_COMMUNITY)
|
||||||
{
|
{
|
||||||
addSettingsViewModel(require('Settings/Admin/Branding'),
|
addSettingsViewModel(require('Settings/Admin/Branding').default,
|
||||||
'AdminSettingsBranding', 'TABS_LABELS/LABEL_BRANDING_NAME', 'branding');
|
'AdminSettingsBranding', 'TABS_LABELS/LABEL_BRANDING_NAME', 'branding');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addSettingsViewModel(require('Settings/Admin/Prem/Branding'),
|
addSettingsViewModel(require('Settings/Admin/Prem/Branding').default,
|
||||||
'AdminSettingsBranding', 'TABS_LABELS/LABEL_BRANDING_NAME', 'branding');
|
'AdminSettingsBranding', 'TABS_LABELS/LABEL_BRANDING_NAME', 'branding');
|
||||||
}
|
}
|
||||||
|
|
||||||
addSettingsViewModel(require('Settings/Admin/Contacts'),
|
addSettingsViewModel(ContactsAdminSettings,
|
||||||
'AdminSettingsContacts', 'TABS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
'AdminSettingsContacts', 'TABS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||||
|
|
||||||
addSettingsViewModel(require('Settings/Admin/Domains'),
|
addSettingsViewModel(DomainsAdminSettings,
|
||||||
'AdminSettingsDomains', 'TABS_LABELS/LABEL_DOMAINS_NAME', 'domains');
|
'AdminSettingsDomains', 'TABS_LABELS/LABEL_DOMAINS_NAME', 'domains');
|
||||||
|
|
||||||
addSettingsViewModel(require('Settings/Admin/Security'),
|
addSettingsViewModel(SecurityAdminSettings,
|
||||||
'AdminSettingsSecurity', 'TABS_LABELS/LABEL_SECURITY_NAME', 'security');
|
'AdminSettingsSecurity', 'TABS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||||
|
|
||||||
addSettingsViewModel(require('Settings/Admin/Social'),
|
addSettingsViewModel(SocialAdminSettings,
|
||||||
'AdminSettingsSocial', 'TABS_LABELS/LABEL_INTEGRATION_NAME', 'integrations');
|
'AdminSettingsSocial', 'TABS_LABELS/LABEL_INTEGRATION_NAME', 'integrations');
|
||||||
|
|
||||||
addSettingsViewModel(require('Settings/Admin/Plugins'),
|
addSettingsViewModel(PluginsAdminSettings,
|
||||||
'AdminSettingsPlugins', 'TABS_LABELS/LABEL_PLUGINS_NAME', 'plugins');
|
'AdminSettingsPlugins', 'TABS_LABELS/LABEL_PLUGINS_NAME', 'plugins');
|
||||||
|
|
||||||
addSettingsViewModel(require('Settings/Admin/Packages'),
|
addSettingsViewModel(PackagesAdminSettings,
|
||||||
'AdminSettingsPackages', 'TABS_LABELS/LABEL_PACKAGES_NAME', 'packages');
|
'AdminSettingsPackages', 'TABS_LABELS/LABEL_PACKAGES_NAME', 'packages');
|
||||||
|
|
||||||
if (!RL_COMMUNITY)
|
if (!RL_COMMUNITY)
|
||||||
{
|
{
|
||||||
addSettingsViewModel(require('Settings/Admin/Prem/Licensing'),
|
addSettingsViewModel(require('Settings/Admin/Prem/Licensing').default,
|
||||||
'AdminSettingsLicensing', 'TABS_LABELS/LABEL_LICENSING_NAME', 'licensing');
|
'AdminSettingsLicensing', 'TABS_LABELS/LABEL_LICENSING_NAME', 'licensing');
|
||||||
}
|
}
|
||||||
|
|
||||||
addSettingsViewModel(require('Settings/Admin/About'),
|
// addSettingsViewModel(AboutAdminSettings,
|
||||||
'AdminSettingsAbout', 'TABS_LABELS/LABEL_ABOUT_NAME', 'about');
|
// 'AdminSettingsAbout', 'TABS_LABELS/LABEL_ABOUT_NAME', 'about');
|
||||||
|
|
||||||
runSettingsViewModelHooks(true);
|
runSettingsViewModelHooks(true);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,18 @@ import {addSettingsViewModel} from 'Knoin/Knoin';
|
||||||
import {AbstractSettingsScreen} from 'Screen/AbstractSettings';
|
import {AbstractSettingsScreen} from 'Screen/AbstractSettings';
|
||||||
import App from 'App/User';
|
import App from 'App/User';
|
||||||
|
|
||||||
|
import {GeneralUserSettings} from 'Settings/User/General';
|
||||||
|
import {ContactsUserSettings} from 'Settings/User/Contacts';
|
||||||
|
import {AccountsUserSettings} from 'Settings/User/Accounts';
|
||||||
|
import {FiltersUserSettings} from 'Settings/User/Filters';
|
||||||
|
import {SecurityUserSettings} from 'Settings/User/Security';
|
||||||
|
import {SocialUserSettings} from 'Settings/User/Social';
|
||||||
|
import {ChangePasswordUserSettings} from 'Settings/User/ChangePassword';
|
||||||
|
import {TemplatesUserSettings} from 'Settings/User/Templates';
|
||||||
|
import {FoldersUserSettings} from 'Settings/User/Folders';
|
||||||
|
import {ThemesUserSettings} from 'Settings/User/Themes';
|
||||||
|
import {OpenPgpUserSettings} from 'Settings/User/OpenPgp';
|
||||||
|
|
||||||
class SettingsUserScreen extends AbstractSettingsScreen
|
class SettingsUserScreen extends AbstractSettingsScreen
|
||||||
{
|
{
|
||||||
constructor()
|
constructor()
|
||||||
|
@ -44,30 +56,30 @@ class SettingsUserScreen extends AbstractSettingsScreen
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
addSettingsViewModel(require('Settings/User/General'),
|
addSettingsViewModel(GeneralUserSettings,
|
||||||
'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
||||||
|
|
||||||
if (AppStore.contactsIsAllowed())
|
if (AppStore.contactsIsAllowed())
|
||||||
{
|
{
|
||||||
addSettingsViewModel(require('Settings/User/Contacts'),
|
addSettingsViewModel(ContactsUserSettings,
|
||||||
'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.capa(Capa.AdditionalAccounts) || Settings.capa(Capa.Identities))
|
if (Settings.capa(Capa.AdditionalAccounts) || Settings.capa(Capa.Identities))
|
||||||
{
|
{
|
||||||
addSettingsViewModel(require('Settings/User/Accounts'), 'SettingsAccounts',
|
addSettingsViewModel(AccountsUserSettings, 'SettingsAccounts',
|
||||||
Settings.capa(Capa.AdditionalAccounts) ? 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME' : 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'accounts');
|
Settings.capa(Capa.AdditionalAccounts) ? 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME' : 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'accounts');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.capa(Capa.Sieve))
|
if (Settings.capa(Capa.Sieve))
|
||||||
{
|
{
|
||||||
addSettingsViewModel(require('Settings/User/Filters'),
|
addSettingsViewModel(FiltersUserSettings,
|
||||||
'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.capa(Capa.AutoLogout) || Settings.capa(Capa.TwoFactor))
|
if (Settings.capa(Capa.AutoLogout) || Settings.capa(Capa.TwoFactor))
|
||||||
{
|
{
|
||||||
addSettingsViewModel(require('Settings/User/Security'),
|
addSettingsViewModel(SecurityUserSettings,
|
||||||
'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
|
'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,37 +88,37 @@ class SettingsUserScreen extends AbstractSettingsScreen
|
||||||
Settings.settingsGet('AllowFacebookSocial') ||
|
Settings.settingsGet('AllowFacebookSocial') ||
|
||||||
Settings.settingsGet('AllowTwitterSocial')))
|
Settings.settingsGet('AllowTwitterSocial')))
|
||||||
{
|
{
|
||||||
addSettingsViewModel(require('Settings/User/Social'),
|
addSettingsViewModel(SocialUserSettings,
|
||||||
'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
|
'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.settingsGet('ChangePasswordIsAllowed'))
|
if (Settings.settingsGet('ChangePasswordIsAllowed'))
|
||||||
{
|
{
|
||||||
addSettingsViewModel(require('Settings/User/ChangePassword'),
|
addSettingsViewModel(ChangePasswordUserSettings,
|
||||||
'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
|
'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.capa(Capa.Templates))
|
if (Settings.capa(Capa.Templates))
|
||||||
{
|
{
|
||||||
addSettingsViewModel(require('Settings/User/Templates'),
|
addSettingsViewModel(TemplatesUserSettings,
|
||||||
'SettingsTemplates', 'SETTINGS_LABELS/LABEL_TEMPLATES_NAME', 'templates');
|
'SettingsTemplates', 'SETTINGS_LABELS/LABEL_TEMPLATES_NAME', 'templates');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.capa(Capa.Folders))
|
if (Settings.capa(Capa.Folders))
|
||||||
{
|
{
|
||||||
addSettingsViewModel(require('Settings/User/Folders'),
|
addSettingsViewModel(FoldersUserSettings,
|
||||||
'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
|
'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.capa(Capa.Themes))
|
if (Settings.capa(Capa.Themes))
|
||||||
{
|
{
|
||||||
addSettingsViewModel(require('Settings/User/Themes'),
|
addSettingsViewModel(ThemesUserSettings,
|
||||||
'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
|
'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.capa(Capa.OpenPGP))
|
if (Settings.capa(Capa.OpenPGP))
|
||||||
{
|
{
|
||||||
addSettingsViewModel(require('Settings/User/OpenPgp'),
|
addSettingsViewModel(OpenPgpUserSettings,
|
||||||
'SettingsOpenPGP', 'SETTINGS_LABELS/LABEL_OPEN_PGP_NAME', 'openpgp');
|
'SettingsOpenPGP', 'SETTINGS_LABELS/LABEL_OPEN_PGP_NAME', 'openpgp');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
/* global RL_COMMUNITY */
|
|
||||||
|
|
||||||
var
|
var
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
|
|
||||||
|
@ -91,4 +89,4 @@ AboutAdminSettings.prototype.updateCoreData = function()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = AboutAdminSettings;
|
export {AboutAdminSettings, AboutAdminSettings as default};
|
|
@ -1,113 +0,0 @@
|
||||||
|
|
||||||
/* global RL_COMMUNITY */
|
|
||||||
|
|
||||||
var
|
|
||||||
_ = require('_'),
|
|
||||||
ko = require('ko'),
|
|
||||||
|
|
||||||
Utils = require('Common/Utils'),
|
|
||||||
Translator = require('Common/Translator');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
function BrandingAdminSettings()
|
|
||||||
{
|
|
||||||
var
|
|
||||||
Enums = require('Common/Enums'),
|
|
||||||
Settings = require('Storage/Settings'),
|
|
||||||
AppStore = require('Stores/Admin/App');
|
|
||||||
|
|
||||||
this.capa = AppStore.prem;
|
|
||||||
|
|
||||||
this.title = ko.observable(Settings.settingsGet('Title'));
|
|
||||||
this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.loadingDesc = ko.observable(Settings.settingsGet('LoadingDescription'));
|
|
||||||
this.loadingDesc.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.faviconUrl = ko.observable(Settings.settingsGet('FaviconUrl'));
|
|
||||||
this.faviconUrl.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.loginLogo = ko.observable(Settings.settingsGet('LoginLogo') || '');
|
|
||||||
this.loginLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.loginBackground = ko.observable(Settings.settingsGet('LoginBackground') || '');
|
|
||||||
this.loginBackground.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.userLogo = ko.observable(Settings.settingsGet('UserLogo') || '');
|
|
||||||
this.userLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.userLogoMessage = ko.observable(Settings.settingsGet('UserLogoMessage') || '');
|
|
||||||
this.userLogoMessage.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.userIframeMessage = ko.observable(Settings.settingsGet('UserIframeMessage') || '');
|
|
||||||
this.userIframeMessage.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.userLogoTitle = ko.observable(Settings.settingsGet('UserLogoTitle') || '');
|
|
||||||
this.userLogoTitle.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.loginDescription = ko.observable(Settings.settingsGet('LoginDescription'));
|
|
||||||
this.loginDescription.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.loginCss = ko.observable(Settings.settingsGet('LoginCss'));
|
|
||||||
this.loginCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.userCss = ko.observable(Settings.settingsGet('UserCss'));
|
|
||||||
this.userCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.welcomePageUrl = ko.observable(Settings.settingsGet('WelcomePageUrl'));
|
|
||||||
this.welcomePageUrl.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.welcomePageDisplay = ko.observable(Settings.settingsGet('WelcomePageDisplay'));
|
|
||||||
this.welcomePageDisplay.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.welcomePageDisplay.options = ko.computed(function() {
|
|
||||||
Translator.trigger();
|
|
||||||
return [
|
|
||||||
{'optValue': 'none', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_NONE')},
|
|
||||||
{'optValue': 'once', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ONCE')},
|
|
||||||
{'optValue': 'always', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ALWAYS')}
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
this.loginPowered = ko.observable(!!Settings.settingsGet('LoginPowered'));
|
|
||||||
|
|
||||||
this.community = RL_COMMUNITY || AppStore.community();
|
|
||||||
}
|
|
||||||
|
|
||||||
BrandingAdminSettings.prototype.onBuild = function()
|
|
||||||
{
|
|
||||||
var
|
|
||||||
self = this,
|
|
||||||
Remote = require('Remote/Admin/Ajax');
|
|
||||||
|
|
||||||
_.delay(function() {
|
|
||||||
|
|
||||||
var
|
|
||||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.title.trigger, self),
|
|
||||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.loadingDesc.trigger, self),
|
|
||||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.faviconUrl.trigger, self);
|
|
||||||
|
|
||||||
self.title.subscribe(function(sValue) {
|
|
||||||
Remote.saveAdminConfig(f1, {
|
|
||||||
'Title': Utils.trim(sValue)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
self.loadingDesc.subscribe(function(sValue) {
|
|
||||||
Remote.saveAdminConfig(f2, {
|
|
||||||
'LoadingDescription': Utils.trim(sValue)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
self.faviconUrl.subscribe(function(sValue) {
|
|
||||||
Remote.saveAdminConfig(f3, {
|
|
||||||
'FaviconUrl': Utils.trim(sValue)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
}, 50);
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = BrandingAdminSettings;
|
|
74
dev/Settings/Admin/Branding.jsx
Normal file
74
dev/Settings/Admin/Branding.jsx
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
|
||||||
|
import _ from '_';
|
||||||
|
import ko from 'ko';
|
||||||
|
|
||||||
|
import {settingsSaveHelperSimpleFunction, trim} from 'Common/Utils';
|
||||||
|
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
|
||||||
|
|
||||||
|
import {settingsGet} from 'Storage/Settings';
|
||||||
|
|
||||||
|
class BrandingAdminSettings
|
||||||
|
{
|
||||||
|
constructor()
|
||||||
|
{
|
||||||
|
const AppStore = require('Stores/Admin/App');
|
||||||
|
|
||||||
|
this.capa = AppStore.prem;
|
||||||
|
|
||||||
|
this.title = ko.observable(settingsGet('Title')).extend({idleTrigger: true});
|
||||||
|
this.loadingDesc = ko.observable(settingsGet('LoadingDescription')).extend({idleTrigger: true});
|
||||||
|
this.faviconUrl = ko.observable(settingsGet('FaviconUrl')).extend({idleTrigger: true});
|
||||||
|
this.loginLogo = ko.observable(settingsGet('LoginLogo') || '').extend({idleTrigger: true});
|
||||||
|
this.loginBackground = ko.observable(settingsGet('LoginBackground') || '').extend({idleTrigger: true});
|
||||||
|
this.userLogo = ko.observable(settingsGet('UserLogo') || '').extend({idleTrigger: true});
|
||||||
|
this.userLogoMessage = ko.observable(settingsGet('UserLogoMessage') || '').extend({idleTrigger: true});
|
||||||
|
this.userIframeMessage = ko.observable(settingsGet('UserIframeMessage') || '').extend({idleTrigger: true});
|
||||||
|
this.userLogoTitle = ko.observable(settingsGet('UserLogoTitle') || '').extend({idleTrigger: true});
|
||||||
|
this.loginDescription = ko.observable(settingsGet('LoginDescription')).extend({idleTrigger: true});
|
||||||
|
this.loginCss = ko.observable(settingsGet('LoginCss')).extend({idleTrigger: true});
|
||||||
|
this.userCss = ko.observable(settingsGet('UserCss')).extend({idleTrigger: true});
|
||||||
|
this.welcomePageUrl = ko.observable(settingsGet('WelcomePageUrl')).extend({idleTrigger: true});
|
||||||
|
this.welcomePageDisplay = ko.observable(settingsGet('WelcomePageDisplay')).extend({idleTrigger: true});
|
||||||
|
this.welcomePageDisplay.options = ko.computed(() => {
|
||||||
|
translatorTrigger();
|
||||||
|
return [
|
||||||
|
{'optValue': 'none', 'optText': i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_NONE')},
|
||||||
|
{'optValue': 'once', 'optText': i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ONCE')},
|
||||||
|
{'optValue': 'always', 'optText': i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ALWAYS')}
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
this.loginPowered = ko.observable(!!settingsGet('LoginPowered'));
|
||||||
|
this.community = RL_COMMUNITY || AppStore.community();
|
||||||
|
}
|
||||||
|
|
||||||
|
onBuild() {
|
||||||
|
_.delay(() => {
|
||||||
|
const
|
||||||
|
Remote = require('Remote/Admin/Ajax'),
|
||||||
|
f1 = settingsSaveHelperSimpleFunction(this.title.trigger, this),
|
||||||
|
f2 = settingsSaveHelperSimpleFunction(this.loadingDesc.trigger, this),
|
||||||
|
f3 = settingsSaveHelperSimpleFunction(this.faviconUrl.trigger, this);
|
||||||
|
|
||||||
|
this.title.subscribe((value) => {
|
||||||
|
Remote.saveAdminConfig(f1, {
|
||||||
|
'Title': trim(value)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
this.loadingDesc.subscribe((value) => {
|
||||||
|
Remote.saveAdminConfig(f2, {
|
||||||
|
'LoadingDescription': trim(value)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
this.faviconUrl.subscribe((value) => {
|
||||||
|
Remote.saveAdminConfig(f3, {
|
||||||
|
'FaviconUrl': trim(value)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {BrandingAdminSettings, BrandingAdminSettings as default};
|
|
@ -231,4 +231,4 @@ ContactsAdminSettings.prototype.onBuild = function()
|
||||||
}, 50);
|
}, 50);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = ContactsAdminSettings;
|
export {ContactsAdminSettings, ContactsAdminSettings as default};
|
|
@ -75,4 +75,4 @@ DomainsAdminSettings.prototype.onDomainListChangeRequest = function()
|
||||||
require('App/Admin').default.reloadDomainList();
|
require('App/Admin').default.reloadDomainList();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = DomainsAdminSettings;
|
export {DomainsAdminSettings, DomainsAdminSettings as default};
|
|
@ -199,4 +199,4 @@ GeneralAdminSettings.prototype.phpInfoLink = function()
|
||||||
return Links.phpInfo();
|
return Links.phpInfo();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = GeneralAdminSettings;
|
export {GeneralAdminSettings, GeneralAdminSettings as default};
|
|
@ -63,4 +63,4 @@ LoginAdminSettings.prototype.onBuild = function()
|
||||||
}, 50);
|
}, 50);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = LoginAdminSettings;
|
export {LoginAdminSettings, LoginAdminSettings as default};
|
|
@ -103,4 +103,4 @@ PackagesAdminSettings.prototype.installPackage = function(oPackage)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = PackagesAdminSettings;
|
export {PackagesAdminSettings, PackagesAdminSettings as default};
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
/* global RL_COMMUNITY */
|
|
||||||
|
|
||||||
var
|
var
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
|
@ -108,4 +106,4 @@ PluginsAdminSettings.prototype.onPluginDisableRequest = function(sResult, oData)
|
||||||
require('App/Admin').default.reloadPluginList();
|
require('App/Admin').default.reloadPluginList();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = PluginsAdminSettings;
|
export {PluginsAdminSettings, PluginsAdminSettings as default};
|
|
@ -179,4 +179,4 @@ SecurityAdminSettings.prototype.phpInfoLink = function()
|
||||||
return Links.phpInfo();
|
return Links.phpInfo();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = SecurityAdminSettings;
|
export {SecurityAdminSettings, SecurityAdminSettings as default};
|
|
@ -171,4 +171,4 @@ SocialAdminSettings.prototype.onBuild = function()
|
||||||
}, 50);
|
}, 50);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = SocialAdminSettings;
|
export {SocialAdminSettings, SocialAdminSettings as default};
|
|
@ -151,4 +151,4 @@ AccountsUserSettings.prototype.onBuild = function(oDom)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = AccountsUserSettings;
|
export {AccountsUserSettings, AccountsUserSettings as default};
|
|
@ -114,4 +114,4 @@ ChangePasswordUserSettings.prototype.onChangePasswordResponse = function(sResult
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = ChangePasswordUserSettings;
|
export {ChangePasswordUserSettings, ChangePasswordUserSettings as default};
|
|
@ -48,4 +48,4 @@ ContactsUserSettings.prototype.onBuild = function()
|
||||||
}, this);
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = ContactsUserSettings;
|
export {ContactsUserSettings, ContactsUserSettings as default};
|
|
@ -231,4 +231,4 @@ FiltersUserSettings.prototype.onShow = function()
|
||||||
this.updateList();
|
this.updateList();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = FiltersUserSettings;
|
export {FiltersUserSettings, FiltersUserSettings as default};
|
|
@ -189,4 +189,4 @@ FoldersUserSettings.prototype.checkableFalseFolder = function(oFolder)
|
||||||
oFolder.checkable(false);
|
oFolder.checkable(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = FoldersUserSettings;
|
export {FoldersUserSettings, FoldersUserSettings as default};
|
|
@ -221,4 +221,4 @@ GeneralUserSettings.prototype.selectLanguage = function()
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = GeneralUserSettings;
|
export {GeneralUserSettings, GeneralUserSettings as default};
|
|
@ -73,4 +73,4 @@ OpenPgpUserSettings.prototype.deleteOpenPgpKey = function(oOpenPgpKeyToRemove)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = OpenPgpUserSettings;
|
export {OpenPgpUserSettings, OpenPgpUserSettings as default};
|
|
@ -65,4 +65,4 @@ SecurityUserSettings.prototype.onBuild = function()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = SecurityUserSettings;
|
export {SecurityUserSettings, SecurityUserSettings as default};
|
|
@ -70,4 +70,4 @@ function SocialUserSettings()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = SocialUserSettings;
|
export {SocialUserSettings, SocialUserSettings as default};
|
|
@ -95,4 +95,4 @@ TemplatesUserSettings.prototype.onBuild = function(oDom)
|
||||||
this.reloadTemplates();
|
this.reloadTemplates();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = TemplatesUserSettings;
|
export {TemplatesUserSettings, TemplatesUserSettings as default};
|
|
@ -174,4 +174,4 @@ ThemesUserSettings.prototype.initUploader = function()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = ThemesUserSettings;
|
export {ThemesUserSettings, ThemesUserSettings as default};
|
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import * as Settings from 'Storage/Settings';
|
import {settingsGet} from 'Storage/Settings';
|
||||||
|
|
||||||
import {AbstractAppStore} from 'Stores/AbstractApp';
|
import {AbstractAppStore} from 'Stores/AbstractApp';
|
||||||
|
|
||||||
class AppAdminStore extends AbstractAppStore
|
class AppAdminStore extends AbstractAppStore
|
||||||
|
@ -18,14 +17,13 @@ class AppAdminStore extends AbstractAppStore
|
||||||
}
|
}
|
||||||
|
|
||||||
populate() {
|
populate() {
|
||||||
|
|
||||||
super.populate();
|
super.populate();
|
||||||
|
|
||||||
this.determineUserLanguage(!!Settings.settingsGet('DetermineUserLanguage'));
|
this.determineUserLanguage(!!settingsGet('DetermineUserLanguage'));
|
||||||
this.determineUserDomain(!!Settings.settingsGet('DetermineUserDomain'));
|
this.determineUserDomain(!!settingsGet('DetermineUserDomain'));
|
||||||
|
|
||||||
this.weakPassword(!!Settings.settingsGet('WeakPassword'));
|
this.weakPassword(!!settingsGet('WeakPassword'));
|
||||||
this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages'));
|
this.useLocalProxyForExternalImages(!!settingsGet('UseLocalProxyForExternalImages'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
/* global RL_COMMUNITY */
|
|
||||||
|
|
||||||
var
|
var
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
|
|
|
@ -665,6 +665,7 @@ gulp.task('rainloop:owncloud:shortname', ['rainloop:owncloud:md5'], function(cal
|
||||||
gulp.task('js:pgp', ['js:openpgp', 'js:openpgpworker']);
|
gulp.task('js:pgp', ['js:openpgp', 'js:openpgpworker']);
|
||||||
|
|
||||||
gulp.task('default', ['js:libs', 'js:pgp', 'js:min', 'css:min', 'ckeditor', 'fontastic']);
|
gulp.task('default', ['js:libs', 'js:pgp', 'js:min', 'css:min', 'ckeditor', 'fontastic']);
|
||||||
|
gulp.task('default+', ['package:community-off', 'default']);
|
||||||
gulp.task('fast-', ['js:app', 'js:admin', 'css:main']);
|
gulp.task('fast-', ['js:app', 'js:admin', 'css:main']);
|
||||||
|
|
||||||
gulp.task('fast', ['package:community-on', 'fast-']);
|
gulp.task('fast', ['package:community-on', 'fast-']);
|
||||||
|
@ -708,6 +709,8 @@ gulp.task('build+', ['rainloop+']);
|
||||||
gulp.task('js:v', ['js:validate']);
|
gulp.task('js:v', ['js:validate']);
|
||||||
gulp.task('v', ['js:v']);
|
gulp.task('v', ['js:v']);
|
||||||
|
|
||||||
|
gulp.task('d', ['default']);
|
||||||
|
gulp.task('d+', ['default+']);
|
||||||
gulp.task('w', ['watch']);
|
gulp.task('w', ['watch']);
|
||||||
gulp.task('w+', ['watch+']);
|
gulp.task('w+', ['watch+']);
|
||||||
gulp.task('f', ['fast']);
|
gulp.task('f', ['fast']);
|
||||||
|
|
Loading…
Reference in a new issue