diff --git a/dev/Screen/Admin/Settings.js b/dev/Screen/Admin/Settings.js index ed5899c3d..83d30dcec 100644 --- a/dev/Screen/Admin/Settings.js +++ b/dev/Screen/Admin/Settings.js @@ -26,15 +26,7 @@ class SettingsAdminScreen extends AbstractSettingsScreen { * @param {Function=} fCallback = null */ setupSettings(fCallback = null) { - let branding = null, - licensing = null; - - if (RL_COMMUNITY) { - branding = require('Settings/Admin/Branding').default; - } else { - branding = require('Settings/Admin/Prem/Branding').default; - licensing = require('Settings/Admin/Prem/Licensing').default; - } + let branding = require('Settings/Admin/Branding').default; addSettingsViewModel( GeneralAdminSettings, @@ -48,9 +40,7 @@ class SettingsAdminScreen extends AbstractSettingsScreen { addSettingsViewModel(LoginAdminSettings, 'AdminSettingsLogin', 'TABS_LABELS/LABEL_LOGIN_NAME', 'login'); - if (branding) { - addSettingsViewModel(branding, 'AdminSettingsBranding', 'TABS_LABELS/LABEL_BRANDING_NAME', 'branding'); - } + addSettingsViewModel(branding, 'AdminSettingsBranding', 'TABS_LABELS/LABEL_BRANDING_NAME', 'branding'); addSettingsViewModel(ContactsAdminSettings, 'AdminSettingsContacts', 'TABS_LABELS/LABEL_CONTACTS_NAME', 'contacts'); @@ -60,10 +50,6 @@ class SettingsAdminScreen extends AbstractSettingsScreen { addSettingsViewModel(PackagesAdminSettings, 'AdminSettingsPackages', 'TABS_LABELS/LABEL_PACKAGES_NAME', 'packages'); - if (licensing) { - addSettingsViewModel(licensing, 'AdminSettingsLicensing', 'TABS_LABELS/LABEL_LICENSING_NAME', 'licensing'); - } - addSettingsViewModel(AboutAdminSettings, 'AdminSettingsAbout', 'TABS_LABELS/LABEL_ABOUT_NAME', 'about'); runSettingsViewModelHooks(true); diff --git a/dev/Settings/Admin/Prem/Branding.js b/dev/Settings/Admin/Prem/Branding.js deleted file mode 100644 index 5516cc33d..000000000 --- a/dev/Settings/Admin/Prem/Branding.js +++ /dev/null @@ -1,96 +0,0 @@ -import { settingsSaveHelperSimpleFunction, trim } from 'Common/Utils'; -import { Magics } from 'Common/Enums'; - -import Remote from 'Remote/Admin/Ajax'; - -import { BrandingAdminSettings } from 'Settings/Admin/Branding'; - -class BrandingPremAdminSettings extends BrandingAdminSettings { - onBuild(dom) { - super.onBuild(dom); - - if (this.capa && this.capa() && !this.community) { - setTimeout(() => { - const f1 = settingsSaveHelperSimpleFunction(this.loginLogo.trigger, this), - f2 = settingsSaveHelperSimpleFunction(this.loginDescription.trigger, this), - f3 = settingsSaveHelperSimpleFunction(this.loginCss.trigger, this), - f4 = settingsSaveHelperSimpleFunction(this.userLogo.trigger, this), - f5 = settingsSaveHelperSimpleFunction(this.userLogoTitle.trigger, this), - f6 = settingsSaveHelperSimpleFunction(this.loginBackground.trigger, this), - f7 = settingsSaveHelperSimpleFunction(this.userCss.trigger, this), - f8 = settingsSaveHelperSimpleFunction(this.welcomePageUrl.trigger, this), - f9 = settingsSaveHelperSimpleFunction(this.welcomePageDisplay.trigger, this), - f10 = settingsSaveHelperSimpleFunction(this.userLogoMessage.trigger, this), - f11 = settingsSaveHelperSimpleFunction(this.userIframeMessage.trigger, this); - - this.loginLogo.subscribe((value) => { - Remote.saveAdminConfig(f1, { - 'LoginLogo': trim(value) - }); - }); - - this.loginDescription.subscribe((value) => { - Remote.saveAdminConfig(f2, { - 'LoginDescription': trim(value) - }); - }); - - this.loginCss.subscribe((value) => { - Remote.saveAdminConfig(f3, { - 'LoginCss': trim(value) - }); - }); - - this.userLogo.subscribe((value) => { - Remote.saveAdminConfig(f4, { - 'UserLogo': trim(value) - }); - }); - - this.userLogoTitle.subscribe((value) => { - Remote.saveAdminConfig(f5, { - 'UserLogoTitle': trim(value) - }); - }); - - this.userLogoMessage.subscribe((value) => { - Remote.saveAdminConfig(f10, { - 'UserLogoMessage': trim(value) - }); - }); - - this.userIframeMessage.subscribe((value) => { - Remote.saveAdminConfig(f11, { - 'UserIframeMessage': trim(value) - }); - }); - - this.loginBackground.subscribe((value) => { - Remote.saveAdminConfig(f6, { - 'LoginBackground': trim(value) - }); - }); - - this.userCss.subscribe((value) => { - Remote.saveAdminConfig(f7, { - 'UserCss': trim(value) - }); - }); - - this.welcomePageUrl.subscribe((value) => { - Remote.saveAdminConfig(f8, { - 'WelcomePageUrl': trim(value) - }); - }); - - this.welcomePageDisplay.subscribe((value) => { - Remote.saveAdminConfig(f9, { - 'WelcomePageDisplay': trim(value) - }); - }); - }, Magics.Time50ms); - } - } -} - -export { BrandingPremAdminSettings, BrandingPremAdminSettings as default }; diff --git a/dev/Settings/Admin/Prem/Licensing.js b/dev/Settings/Admin/Prem/Licensing.js deleted file mode 100644 index b1224baa6..000000000 --- a/dev/Settings/Admin/Prem/Licensing.js +++ /dev/null @@ -1,66 +0,0 @@ -import ko from 'ko'; -import moment from 'moment'; - -import { settingsGet } from 'Storage/Settings'; -import { showScreenPopup } from 'Knoin/Knoin'; - -import LicenseStore from 'Stores/Admin/License'; - -import { getApp } from 'Helper/Apps/Admin'; - -class LicensingPremAdminSettings { - constructor() { - this.licensing = LicenseStore.licensing; - this.licensingProcess = LicenseStore.licensingProcess; - this.licenseValid = LicenseStore.licenseValid; - this.licenseExpired = LicenseStore.licenseExpired; - this.licenseError = LicenseStore.licenseError; - this.licenseTrigger = LicenseStore.licenseTrigger; - - this.adminDomain = ko.observable(''); - this.subscriptionEnabled = ko.observable(!!settingsGet('SubscriptionEnabled')); - - this.licenseTrigger.subscribe(() => { - if (this.subscriptionEnabled()) { - getApp().reloadLicensing(true); - } - }); - } - - onBuild() { - if (this.subscriptionEnabled()) { - getApp().reloadLicensing(false); - } - } - - onShow() { - this.adminDomain(settingsGet('AdminDomain')); - } - - showActivationForm() { - showScreenPopup(require('View/Popup/Activate')); - } - - showTrialForm() { - showScreenPopup(require('View/Popup/Activate'), [true]); - } - - /** - * @returns {boolean} - */ - licenseIsUnlim() { - return 1898625600 === this.licenseExpired() || 1898625700 === this.licenseExpired(); // eslint-disable-line no-magic-numbers - } - - /** - * @returns {string} - */ - licenseExpiredMomentValue() { - const time = this.licenseExpired(), - momentUnix = moment.unix(time); - - return this.licenseIsUnlim() ? 'Never' : time && momentUnix.format('LL') + ' (' + momentUnix.from(moment()) + ')'; - } -} - -export { LicensingPremAdminSettings, LicensingPremAdminSettings as default };