mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-01 08:16:03 +00:00
75 lines
1.8 KiB
JavaScript
75 lines
1.8 KiB
JavaScript
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
|
|
(function (module) {
|
|
|
|
'use strict';
|
|
|
|
var
|
|
ko = require('../External/ko.js'),
|
|
moment = require('../External/moment.js'),
|
|
|
|
Data = require('../Storages/AdminDataStorage.js'),
|
|
|
|
kn = require('../Knoin/Knoin.js'),
|
|
PopupsActivateViewModel = require('../ViewModels/Popups/PopupsActivateViewModel.js')
|
|
;
|
|
|
|
/**
|
|
* @constructor
|
|
*/
|
|
function AdminSettingsLicensing()
|
|
{
|
|
this.licensing = Data.licensing;
|
|
this.licensingProcess = Data.licensingProcess;
|
|
this.licenseValid = Data.licenseValid;
|
|
this.licenseExpired = Data.licenseExpired;
|
|
this.licenseError = Data.licenseError;
|
|
this.licenseTrigger = Data.licenseTrigger;
|
|
|
|
this.adminDomain = ko.observable('');
|
|
this.subscriptionEnabled = ko.observable(!!RL.settingsGet('SubscriptionEnabled'));
|
|
|
|
this.licenseTrigger.subscribe(function () {
|
|
if (this.subscriptionEnabled())
|
|
{
|
|
RL.reloadLicensing(true);
|
|
}
|
|
}, this);
|
|
}
|
|
|
|
kn.addSettingsViewModel(AdminSettingsLicensing, 'AdminSettingsLicensing', 'Licensing', 'licensing');
|
|
|
|
AdminSettingsLicensing.prototype.onBuild = function ()
|
|
{
|
|
if (this.subscriptionEnabled())
|
|
{
|
|
RL.reloadLicensing(false);
|
|
}
|
|
};
|
|
|
|
AdminSettingsLicensing.prototype.onShow = function ()
|
|
{
|
|
this.adminDomain(RL.settingsGet('AdminDomain'));
|
|
};
|
|
|
|
AdminSettingsLicensing.prototype.showActivationForm = function ()
|
|
{
|
|
kn.showScreenPopup(PopupsActivateViewModel);
|
|
};
|
|
|
|
/**
|
|
* @returns {string}
|
|
*/
|
|
AdminSettingsLicensing.prototype.licenseExpiredMomentValue = function ()
|
|
{
|
|
var
|
|
iTime = this.licenseExpired(),
|
|
oDate = moment.unix(iTime)
|
|
;
|
|
|
|
return iTime && 1898625600 === iTime ? 'Never' : (oDate.format('LL') + ' (' + oDate.from(moment()) + ')');
|
|
};
|
|
|
|
module.exports = AdminSettingsLicensing;
|
|
|
|
}(module)); |