From c253b7c4bd20cd35da065ce9bb7ee6cb2d703c8c Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Tue, 3 Feb 2015 14:42:06 +0400 Subject: [PATCH] Trial key --- dev/App/Admin.js | 3 +++ dev/Common/Consts.js | 6 ++++++ dev/Settings/Admin/Branding.js | 5 +++-- dev/Settings/Admin/Licensing.js | 7 ++++++- dev/Stores/App.js | 4 ++++ dev/View/Popup/Activate.js | 12 +++++++++--- .../templates/Views/Admin/AdminSettingsBranding.html | 4 ++-- .../Views/Admin/AdminSettingsLicensing.html | 9 +++++++-- 8 files changed, 40 insertions(+), 10 deletions(-) diff --git a/dev/App/Admin.js b/dev/App/Admin.js index 952bc5987..e039ca6ff 100644 --- a/dev/App/Admin.js +++ b/dev/App/Admin.js @@ -15,6 +15,7 @@ Translator = require('Common/Translator'), Settings = require('Storage/Settings'), + AppStore = require('Stores/Admin/App'), DomainStore = require('Stores/Admin/Domain'), PluginStore = require('Stores/Admin/Plugin'), LicenseStore = require('Stores/Admin/License'), @@ -208,6 +209,8 @@ LicenseStore.licenseError(''); LicenseStore.licensing(true); + + AppStore.prem(true); } else { diff --git a/dev/Common/Consts.js b/dev/Common/Consts.js index 77c13df02..dab47f3cf 100644 --- a/dev/Common/Consts.js +++ b/dev/Common/Consts.js @@ -117,6 +117,12 @@ */ Consts.Values.TokenErrorLimit = 10; + /** + * @const + * @type {string} + */ + Consts.Values.RainLoopTrialKey = 'RAINLOOP-TRIAL-KEY'; + /** * @const * @type {string} diff --git a/dev/Settings/Admin/Branding.js b/dev/Settings/Admin/Branding.js index 32e92da42..68f8d3d77 100644 --- a/dev/Settings/Admin/Branding.js +++ b/dev/Settings/Admin/Branding.js @@ -17,10 +17,11 @@ { var Enums = require('Common/Enums'), - Settings = require('Storage/Settings') + Settings = require('Storage/Settings'), + AppStore = require('Stores/Admin/App') ; - this.capa = !!Settings.settingsGet('PremType'); + this.capa = AppStore.prem; this.title = ko.observable(Settings.settingsGet('Title')); this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle); diff --git a/dev/Settings/Admin/Licensing.js b/dev/Settings/Admin/Licensing.js index 1ba99a409..1e8cb5d9b 100644 --- a/dev/Settings/Admin/Licensing.js +++ b/dev/Settings/Admin/Licensing.js @@ -52,12 +52,17 @@ require('Knoin/Knoin').showScreenPopup(require('View/Popup/Activate')); }; + LicensingAdminSettings.prototype.showTrialForm = function () + { + require('Knoin/Knoin').showScreenPopup(require('View/Popup/Activate'), [true]); + }; + /** * @returns {boolean} */ LicensingAdminSettings.prototype.licenseIsUnlim = function () { - return 1898625600 === this.licenseExpired(); + return 1898625600 === this.licenseExpired() || 1898625700 === this.licenseExpired(); }; /** diff --git a/dev/Stores/App.js b/dev/Stores/App.js index 04ec64bab..45b560689 100644 --- a/dev/Stores/App.js +++ b/dev/Stores/App.js @@ -27,6 +27,8 @@ }); this.interfaceAnimation.valueHasMutated(); + + this.prem = ko.observable(false); } AppStore.prototype.populate = function() @@ -35,6 +37,8 @@ this.allowLanguagesOnSettings(!!Settings.settingsGet('AllowLanguagesOnSettings')); this.interfaceAnimation(!!Settings.settingsGet('InterfaceAnimation')); + + this.prem(!!Settings.settingsGet('PremType')); }; module.exports = AppStore; diff --git a/dev/View/Popup/Activate.js b/dev/View/Popup/Activate.js index aa0e9fe37..49e71dbc6 100644 --- a/dev/View/Popup/Activate.js +++ b/dev/View/Popup/Activate.js @@ -9,10 +9,13 @@ Enums = require('Common/Enums'), Utils = require('Common/Utils'), + Consts = require('Common/Consts'), Translator = require('Common/Translator'), Settings = require('Storage/Settings'), Remote = require('Storage/Admin/Remote'), + + AppStore = require('Stores/Admin/App'), LicenseStore = require('Stores/Admin/License'), kn = require('Knoin/Knoin'), @@ -108,12 +111,14 @@ kn.extendAsViewModel(['View/Popup/Activate', 'PopupsActivateViewModel'], ActivatePopupView); _.extend(ActivatePopupView.prototype, AbstractView.prototype); - ActivatePopupView.prototype.onShow = function () + ActivatePopupView.prototype.onShow = function (bTrial) { this.domain(Settings.settingsGet('AdminDomain')); if (!this.activateProcess()) { - this.key(''); + bTrial = Utils.isUnd(bTrial) ? false : !!bTrial; + + this.key(bTrial ? Consts.Values.RainLoopTrialKey : ''); this.activateText(''); this.activateText.isError(false); this.activationSuccessed(false); @@ -134,7 +139,8 @@ ActivatePopupView.prototype.validateSubscriptionKey = function () { var sValue = this.key(); - return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue)); + return '' === sValue || Consts.Values.RainLoopTrialKey === sValue || + !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue)); }; module.exports = ActivatePopupView; diff --git a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsBranding.html b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsBranding.html index a645652f4..c3989f576 100644 --- a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsBranding.html +++ b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsBranding.html @@ -1,10 +1,10 @@
-
+
This functionality is available for Premium subscribers.
-
+
Branding
diff --git a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsLicensing.html b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsLicensing.html index 2b8b21ed4..35ae569f2 100644 --- a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsLicensing.html +++ b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsLicensing.html @@ -86,13 +86,18 @@    Activate Subscription Key for this domain -   -   +       Purchase +    + + +    + Trial +