mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-15 20:24:51 +08:00
4cc2207513
Original unminified source code (dev folder - js, css, less) (fixes #6) Grunt build system Multiple identities correction (fixes #9) Compose html editor (fixes #12) New general settings - Loading Description New warning about default admin password Split general and login screen settings
90 lines
2.1 KiB
JavaScript
90 lines
2.1 KiB
JavaScript
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
|
|
/**
|
|
* @constructor
|
|
*/
|
|
function AdminDomains()
|
|
{
|
|
var oData = RL.data();
|
|
|
|
this.domains = oData.domains;
|
|
this.domainsLoading = oData.domainsLoading;
|
|
|
|
this.iDomainForDeletionTimeout = 0;
|
|
|
|
this.visibility = ko.computed(function () {
|
|
return oData.domainsLoading() ? 'visible' : 'hidden';
|
|
}, this);
|
|
|
|
this.domainForDeletion = ko.observable(null).extend({'toggleSubscribe': [this,
|
|
function (oPrev) {
|
|
if (oPrev)
|
|
{
|
|
oPrev.deleteAccess(false);
|
|
}
|
|
}, function (oNext) {
|
|
if (oNext)
|
|
{
|
|
oNext.deleteAccess(true);
|
|
this.startDomainForDeletionTimeout();
|
|
}
|
|
}
|
|
]});
|
|
}
|
|
|
|
Utils.addSettingsViewModel(AdminDomains, 'AdminSettingsDomains', 'Domains', 'domains');
|
|
|
|
AdminDomains.prototype.startDomainForDeletionTimeout = function ()
|
|
{
|
|
var self = this;
|
|
window.clearInterval(this.iDomainForDeletionTimeout);
|
|
this.iDomainForDeletionTimeout = window.setTimeout(function () {
|
|
self.domainForDeletion(null);
|
|
}, 1000 * 3);
|
|
};
|
|
|
|
AdminDomains.prototype.createDomain = function ()
|
|
{
|
|
kn.showScreenPopup(PopupsDomainViewModel);
|
|
};
|
|
|
|
AdminDomains.prototype.deleteDomain = function (oDomain)
|
|
{
|
|
this.domains.remove(oDomain);
|
|
RL.remote().domainDelete(_.bind(this.onDomainListChangeRequest, this), oDomain.name);
|
|
};
|
|
|
|
AdminDomains.prototype.disableDomain = function (oDomain)
|
|
{
|
|
oDomain.disabled(!oDomain.disabled());
|
|
RL.remote().domainDisable(_.bind(this.onDomainListChangeRequest, this), oDomain.name, oDomain.disabled());
|
|
};
|
|
|
|
AdminDomains.prototype.onBuild = function (oDom)
|
|
{
|
|
var self = this;
|
|
oDom
|
|
.on('click', '.b-admin-domains-list-table .e-item .e-action', function () {
|
|
var oDomainItem = ko.dataFor(this);
|
|
if (oDomainItem)
|
|
{
|
|
RL.remote().domain(_.bind(self.onDomainLoadRequest, self), oDomainItem.name);
|
|
}
|
|
})
|
|
;
|
|
|
|
RL.reloadDomainList();
|
|
};
|
|
|
|
AdminDomains.prototype.onDomainLoadRequest = function (sResult, oData)
|
|
{
|
|
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
|
{
|
|
kn.showScreenPopup(PopupsDomainViewModel, [oData.Result]);
|
|
}
|
|
};
|
|
|
|
AdminDomains.prototype.onDomainListChangeRequest = function ()
|
|
{
|
|
RL.reloadDomainList();
|
|
};
|