mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-15 12:15:20 +08:00
71 lines
No EOL
1.6 KiB
JavaScript
71 lines
No EOL
1.6 KiB
JavaScript
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
|
|
(function (module, require) {
|
|
|
|
'use strict';
|
|
|
|
var
|
|
ko = require('ko'),
|
|
moment = require('moment'),
|
|
|
|
Settings = require('Storage:Settings'),
|
|
Data = require('Storage:Admin:Data')
|
|
;
|
|
|
|
/**
|
|
* @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(!!Settings.settingsGet('SubscriptionEnabled'));
|
|
|
|
this.licenseTrigger.subscribe(function () {
|
|
if (this.subscriptionEnabled())
|
|
{
|
|
require('App:Admin').reloadLicensing(true);
|
|
}
|
|
}, this);
|
|
}
|
|
|
|
AdminSettingsLicensing.prototype.onBuild = function ()
|
|
{
|
|
if (this.subscriptionEnabled())
|
|
{
|
|
require('App:Admin').reloadLicensing(false);
|
|
}
|
|
};
|
|
|
|
AdminSettingsLicensing.prototype.onShow = function ()
|
|
{
|
|
this.adminDomain(Settings.settingsGet('AdminDomain'));
|
|
};
|
|
|
|
AdminSettingsLicensing.prototype.showActivationForm = function ()
|
|
{
|
|
require('App:Knoin').showScreenPopup(require('View:Popup:Activate'));
|
|
};
|
|
|
|
/**
|
|
* @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, require)); |