mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
Admin panel forms improvement
Domain system improvement
This commit is contained in:
parent
79721f60df
commit
de0648a392
17 changed files with 265 additions and 179 deletions
|
|
@ -11,6 +11,8 @@ function AdminPaneViewModel()
|
|||
this.adminDomain = ko.observable(RL.settingsGet('AdminDomain'));
|
||||
this.version = ko.observable(RL.settingsGet('Version'));
|
||||
|
||||
this.adminManLoadingVisibility = RL.data().adminManLoadingVisibility;
|
||||
|
||||
Knoin.constructorEnd(this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,20 +35,6 @@ function PopupsDomainViewModel()
|
|||
this.smtpAuth = ko.observable(true);
|
||||
this.whiteList = ko.observable('');
|
||||
|
||||
this.imapServerFocus.subscribe(function (bValue) {
|
||||
if (bValue && '' !== this.name() && '' === this.imapServer())
|
||||
{
|
||||
this.imapServer(this.name().replace(/[.]?[*][.]?/g, ''));
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.smtpServerFocus.subscribe(function (bValue) {
|
||||
if (bValue && '' !== this.imapServer() && '' === this.smtpServer())
|
||||
{
|
||||
this.smtpServer(this.imapServer().replace(/imap/ig, 'smtp'));
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.headerText = ko.computed(function () {
|
||||
var sName = this.name();
|
||||
return this.edit() ? 'Edit Domain "' + sName + '"' :
|
||||
|
|
@ -98,6 +84,7 @@ function PopupsDomainViewModel()
|
|||
this.testing(true);
|
||||
RL.remote().testConnectionForDomain(
|
||||
_.bind(this.onTestConnectionResponse, this),
|
||||
this.name(),
|
||||
this.imapServer(),
|
||||
this.imapPort(),
|
||||
this.imapSecure(),
|
||||
|
|
@ -112,6 +99,67 @@ function PopupsDomainViewModel()
|
|||
this.whiteListPage(!this.whiteListPage());
|
||||
});
|
||||
|
||||
// smart form improvements
|
||||
this.imapServerFocus.subscribe(function (bValue) {
|
||||
if (bValue && '' !== this.name() && '' === this.imapServer())
|
||||
{
|
||||
this.imapServer(this.name().replace(/[.]?[*][.]?/g, ''));
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.smtpServerFocus.subscribe(function (bValue) {
|
||||
if (bValue && '' !== this.imapServer() && '' === this.smtpServer())
|
||||
{
|
||||
this.smtpServer(this.imapServer().replace(/imap/ig, 'smtp'));
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.imapSecure.subscribe(function (sValue) {
|
||||
var iPort = Utils.pInt(this.imapPort());
|
||||
sValue = Utils.pString(sValue);
|
||||
switch (sValue)
|
||||
{
|
||||
case '0':
|
||||
if (993 === iPort)
|
||||
{
|
||||
this.imapPort(143);
|
||||
}
|
||||
break;
|
||||
case '1':
|
||||
if (143 === iPort)
|
||||
{
|
||||
this.imapPort(993);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.smtpSecure.subscribe(function (sValue) {
|
||||
var iPort = Utils.pInt(this.smtpPort());
|
||||
sValue = Utils.pString(sValue);
|
||||
switch (sValue)
|
||||
{
|
||||
case '0':
|
||||
if (465 === iPort || 587 === iPort)
|
||||
{
|
||||
this.smtpPort(25);
|
||||
}
|
||||
break;
|
||||
case '1':
|
||||
if (25 === iPort || 587 === iPort)
|
||||
{
|
||||
this.smtpPort(465);
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
if (25 === iPort || 465 === iPort)
|
||||
{
|
||||
this.smtpPort(587);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}, this);
|
||||
|
||||
Knoin.constructorEnd(this);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue