Admin panel forms improvement

Domain system  improvement
This commit is contained in:
RainLoop Team 2014-04-26 03:41:47 +04:00
parent 79721f60df
commit de0648a392
17 changed files with 265 additions and 179 deletions

View file

@ -203,11 +203,12 @@ AdminAjaxRemoteStorage.prototype.createOrUpdateDomain = function (fCallback,
}); });
}; };
AdminAjaxRemoteStorage.prototype.testConnectionForDomain = function (fCallback, AdminAjaxRemoteStorage.prototype.testConnectionForDomain = function (fCallback, sName,
sIncHost, iIncPort, sIncSecure, sIncHost, iIncPort, sIncSecure,
sOutHost, iOutPort, sOutSecure, bOutAuth) sOutHost, iOutPort, sOutSecure, bOutAuth)
{ {
this.defaultRequest(fCallback, 'AdminDomainTest', { this.defaultRequest(fCallback, 'AdminDomainTest', {
'Name': sName,
'IncHost': sIncHost, 'IncHost': sIncHost,
'IncPort': iIncPort, 'IncPort': iIncPort,
'IncSecure': sIncSecure, 'IncSecure': sIncSecure,

View file

@ -26,6 +26,14 @@ function AdminDataStorage()
this.licenseError = ko.observable(''); this.licenseError = ko.observable('');
this.licenseTrigger = ko.observable(false); this.licenseTrigger = ko.observable(false);
this.adminManLoading = ko.computed(function () {
return '000' !== [this.domainsLoading() ? '1' : '0', this.pluginsLoading() ? '1' : '0', this.packagesLoading() ? '1' : '0'].join('');
}, this);
this.adminManLoadingVisibility = ko.computed(function () {
return this.adminManLoading() ? 'visible' : 'hidden';
}, this).extend({'rateLimit': 300});
} }
_.extend(AdminDataStorage.prototype, AbstractData.prototype); _.extend(AdminDataStorage.prototype, AbstractData.prototype);

View file

@ -11,6 +11,8 @@ function AdminPaneViewModel()
this.adminDomain = ko.observable(RL.settingsGet('AdminDomain')); this.adminDomain = ko.observable(RL.settingsGet('AdminDomain'));
this.version = ko.observable(RL.settingsGet('Version')); this.version = ko.observable(RL.settingsGet('Version'));
this.adminManLoadingVisibility = RL.data().adminManLoadingVisibility;
Knoin.constructorEnd(this); Knoin.constructorEnd(this);
} }

View file

@ -35,20 +35,6 @@ function PopupsDomainViewModel()
this.smtpAuth = ko.observable(true); this.smtpAuth = ko.observable(true);
this.whiteList = ko.observable(''); 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 () { this.headerText = ko.computed(function () {
var sName = this.name(); var sName = this.name();
return this.edit() ? 'Edit Domain "' + sName + '"' : return this.edit() ? 'Edit Domain "' + sName + '"' :
@ -98,6 +84,7 @@ function PopupsDomainViewModel()
this.testing(true); this.testing(true);
RL.remote().testConnectionForDomain( RL.remote().testConnectionForDomain(
_.bind(this.onTestConnectionResponse, this), _.bind(this.onTestConnectionResponse, this),
this.name(),
this.imapServer(), this.imapServer(),
this.imapPort(), this.imapPort(),
this.imapSecure(), this.imapSecure(),
@ -112,6 +99,67 @@ function PopupsDomainViewModel()
this.whiteListPage(!this.whiteListPage()); 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); Knoin.constructorEnd(this);
} }

View file

@ -166,8 +166,9 @@ class Account
*/ */
public function Hash() public function Hash()
{ {
return md5(APP_SALT.$this->Email().APP_SALT.$this->oDomain->IncHost().APP_SALT.$this->oDomain->IncPort().
APP_SALT.$this->Password().APP_SALT.'0'.APP_SALT.$this->ParentEmail().APP_SALT); return md5(APP_SALT.$this->Email().APP_SALT.$this->oDomain->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($this->Email())).
APP_SALT.$this->oDomain->IncPort().APP_SALT.$this->Password().APP_SALT.'0'.APP_SALT.$this->ParentEmail().APP_SALT);
} }
/** /**

View file

@ -231,10 +231,8 @@ class Actions
$oResult = new \RainLoop\Providers\Login\DefaultLogin(); $oResult = new \RainLoop\Providers\Login\DefaultLogin();
break; break;
case 'domain': case 'domain':
// \RainLoop\Providers\Domain\DomainSimpleInterface
// \RainLoop\Providers\Domain\DomainAdminInterface // \RainLoop\Providers\Domain\DomainAdminInterface
$oResult = new \RainLoop\Providers\Domain\DefaultDomain(APP_PRIVATE_DATA.'domains', $oResult = new \RainLoop\Providers\Domain\DefaultDomain(APP_PRIVATE_DATA.'domains', $this->Cacher());
$this->Cacher());
break; break;
case 'address-book': case 'address-book':
// \RainLoop\Providers\AddressBook\AddressBookInterface // \RainLoop\Providers\AddressBook\AddressBookInterface
@ -849,7 +847,7 @@ class Actions
if (0 < \strlen($sEmail) && 0 < \strlen($sLogin) && 0 < \strlen($sPassword)) if (0 < \strlen($sEmail) && 0 < \strlen($sLogin) && 0 < \strlen($sPassword))
{ {
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true); $oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true);
if ($oDomain instanceof \RainLoop\Domain && !$oDomain->Disabled() && $oDomain->ValidateWhiteList($sEmail, $sLogin)) if ($oDomain instanceof \RainLoop\Domain && $oDomain->ValidateWhiteList($sEmail, $sLogin))
{ {
$oResult = \RainLoop\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken); $oResult = \RainLoop\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken);
} }
@ -892,7 +890,7 @@ class Actions
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($aAccountHash[1]), true); $oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($aAccountHash[1]), true);
if ($bThrowExceptionOnFalse) if ($bThrowExceptionOnFalse)
{ {
if (!($oDomain instanceof \RainLoop\Domain) || $oDomain->Disabled()) if (!($oDomain instanceof \RainLoop\Domain))
{ {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainNotAllowed); throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainNotAllowed);
} }
@ -1374,7 +1372,7 @@ class Actions
$this->loginErrorDelay(); $this->loginErrorDelay();
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true); $oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true);
if (!($oDomain instanceof \RainLoop\Domain) || $oDomain->Disabled()) if (!($oDomain instanceof \RainLoop\Domain))
{ {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainNotAllowed); throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainNotAllowed);
} }
@ -1439,7 +1437,8 @@ class Actions
try try
{ {
$this->MailClient() $this->MailClient()
->Connect($oAccount->Domain()->IncHost(), $oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure()) ->Connect($oAccount->Domain()->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email())),
$oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure())
->Login($oAccount->IncLogin(), $oAccount->Password()) ->Login($oAccount->IncLogin(), $oAccount->Password())
; ;
} }
@ -2458,9 +2457,9 @@ class Actions
$oImapClient = \MailSo\Imap\ImapClient::NewInstance()->SetLogger($this->Logger()); $oImapClient = \MailSo\Imap\ImapClient::NewInstance()->SetLogger($this->Logger());
$oImapClient->SetTimeOuts(5); $oImapClient->SetTimeOuts(5);
$iTime = microtime(true); $iTime = \microtime(true);
$oImapClient->Connect($oDomain->IncHost(), $oDomain->IncPort(), $oDomain->IncSecure()); $oImapClient->Connect($oDomain->IncHost($oDomain->Name()), $oDomain->IncPort(), $oDomain->IncSecure());
$iImapTime = microtime(true) - $iTime; $iImapTime = \microtime(true) - $iTime;
$oImapClient->Disconnect(); $oImapClient->Disconnect();
$bImapResult = true; $bImapResult = true;
} }
@ -2474,9 +2473,9 @@ class Actions
$oSmtpClient = \MailSo\Smtp\SmtpClient::NewInstance()->SetLogger($this->Logger()); $oSmtpClient = \MailSo\Smtp\SmtpClient::NewInstance()->SetLogger($this->Logger());
$oSmtpClient->SetTimeOuts(5); $oSmtpClient->SetTimeOuts(5);
$iTime = microtime(true); $iTime = \microtime(true);
$oSmtpClient->Connect($oDomain->OutHost(), $oDomain->OutPort(), '127.0.0.1', $oDomain->OutSecure()); $oSmtpClient->Connect($oDomain->OutHost($oDomain->Name()), $oDomain->OutPort(), '127.0.0.1', $oDomain->OutSecure());
$iSmtpTime = microtime(true) - $iTime; $iSmtpTime = \microtime(true) - $iTime;
$oSmtpClient->Disconnect(); $oSmtpClient->Disconnect();
$bSmtpResult = true; $bSmtpResult = true;
} }
@ -4249,7 +4248,7 @@ class Actions
$aSmtpCredentials = array( $aSmtpCredentials = array(
'Ehlo' => \MailSo\Smtp\SmtpClient::EhloHelper(), 'Ehlo' => \MailSo\Smtp\SmtpClient::EhloHelper(),
'Host' => $oAccount->Domain()->OutHost(), 'Host' => $oAccount->Domain()->OutHost(\MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email())),
'Port' => $oAccount->Domain()->OutPort(), 'Port' => $oAccount->Domain()->OutPort(),
'Secure' => $oAccount->Domain()->OutSecure(), 'Secure' => $oAccount->Domain()->OutSecure(),
'UseAuth' => $oAccount->Domain()->OutAuth(), 'UseAuth' => $oAccount->Domain()->OutAuth(),
@ -6160,7 +6159,8 @@ class Actions
try try
{ {
$this->MailClient() $this->MailClient()
->Connect($oAccount->Domain()->IncHost(), $oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure()) ->Connect($oAccount->Domain()->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email())),
$oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure())
->Login($oAccount->IncLogin(), $oAccount->Password(), !!$this->Config()->Get('labs', 'use_imap_auth_plain')) ->Login($oAccount->IncLogin(), $oAccount->Password(), !!$this->Config()->Get('labs', 'use_imap_auth_plain'))
; ;
} }

View file

@ -63,11 +63,6 @@ class Domain
*/ */
private $sWhiteList; private $sWhiteList;
/**
* @var bool
*/
private $bDisabled;
/** /**
* @param string $sName * @param string $sName
* @param string $sIncHost * @param string $sIncHost
@ -95,7 +90,6 @@ class Domain
$this->bOutShortLogin = $bOutShortLogin; $this->bOutShortLogin = $bOutShortLogin;
$this->bOutAuth = $bOutAuth; $this->bOutAuth = $bOutAuth;
$this->sWhiteList = \trim($sWhiteList); $this->sWhiteList = \trim($sWhiteList);
$this->bDisabled = false;
} }
/** /**
@ -125,6 +119,7 @@ class Domain
} }
/** /**
* @param string $sName
* @param array $aDomain * @param array $aDomain
* *
* @return \RainLoop\Domain|null * @return \RainLoop\Domain|null
@ -171,14 +166,6 @@ class Domain
return str_replace('"', '\\"', $sStr); return str_replace('"', '\\"', $sStr);
} }
/**
* @param bool0 $bDisabled
*/
public function SetDisabled($bDisabled)
{
$this->bDisabled = (bool) $bDisabled;
}
public function Normalize() public function Normalize()
{ {
$this->sIncHost = \trim($this->sIncHost); $this->sIncHost = \trim($this->sIncHost);
@ -299,11 +286,13 @@ class Domain
} }
/** /**
* @param string $sRealDomainName = ''
*
* @return string * @return string
*/ */
public function IncHost() public function IncHost($sRealDomainName = '')
{ {
return $this->sIncHost; return 0 < \strlen($sRealDomainName) ? \str_replace('{domain:name}', $sRealDomainName, $this->sIncHost) : $this->sIncHost;
} }
/** /**
@ -331,11 +320,12 @@ class Domain
} }
/** /**
* @param string $sRealDomainName = ''
* @return string * @return string
*/ */
public function OutHost() public function OutHost($sRealDomainName = '')
{ {
return $this->sOutHost; return 0 < \strlen($sRealDomainName) ? \str_replace('{domain:name}', $sRealDomainName, $this->sOutHost) : $this->sOutHost;
} }
/** /**
@ -378,14 +368,6 @@ class Domain
return $this->sWhiteList; return $this->sWhiteList;
} }
/**
* @return bool
*/
public function Disabled()
{
return $this->bDisabled;
}
/** /**
* @param string $sEmail * @param string $sEmail
* @param string $sLogin = '' * @param string $sLogin = ''

View file

@ -35,13 +35,13 @@ class Domain extends \RainLoop\Providers\AbstractProvider
/** /**
* @param string $sName * @param string $sName
* @param bool $bDefaultOnNull = false * @param bool $bFindWithWildCard = false
* *
* @return \RainLoop\Domain|null * @return \RainLoop\Domain|null
*/ */
public function Load($sName, $bDefaultOnNull = false) public function Load($sName, $bFindWithWildCard = false)
{ {
return $this->oDriver->Load($sName, $bDefaultOnNull); return $this->oDriver->Load($sName, $bFindWithWildCard);
} }
/** /**
@ -122,6 +122,11 @@ class Domain extends \RainLoop\Providers\AbstractProvider
$bOutAuth = '1' === (string) $oActions->GetActionParam('OutAuth', '1'); $bOutAuth = '1' === (string) $oActions->GetActionParam('OutAuth', '1');
$sWhiteList = (string) $oActions->GetActionParam('WhiteList', ''); $sWhiteList = (string) $oActions->GetActionParam('WhiteList', '');
if (0 < \strlen($sName) && 0 < strlen($sNameForTest) && false === \strpos($sName, '*'))
{
$sNameForTest = '';
}
if (0 < strlen($sName) || 0 < strlen($sNameForTest)) if (0 < strlen($sName) || 0 < strlen($sNameForTest))
{ {
$oDomain = 0 < strlen($sNameForTest) ? null : $this->Load($sName); $oDomain = 0 < strlen($sNameForTest) ? null : $this->Load($sName);

View file

@ -141,15 +141,22 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
public function Load($sName, $bFindWithWildCard = false) public function Load($sName, $bFindWithWildCard = false)
{ {
$mResult = null; $mResult = null;
$sDisabled = '';
$sFoundedValue = ''; $sFoundedValue = '';
$sName = \strtolower($sName); $sName = \strtolower($sName);
$sRealFileName = $this->codeFileName($sName); $sRealFileName = $this->codeFileName($sName);
if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini')) if (\file_exists($this->sDomainPath.'/disabled'))
{ {
$aDomain = @\parse_ini_file($this->sDomainPath.'/'.$sRealFileName.'.ini'); $sDisabled = @\file_get_contents($this->sDomainPath.'/disabled');
}
if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini') &&
(0 === \strlen($sDisabled) || false === \strpos(\strtolower(','.$sDisabled.','), \strtolower(','.$sName.','))))
{
$aDomain = @\parse_ini_file($this->sDomainPath.'/'.$sRealFileName.'.ini');
// fix misspellings (#119) // fix misspellings (#119)
if (\is_array($aDomain)) if (\is_array($aDomain))
{ {
@ -184,20 +191,10 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
{ {
if (\RainLoop\Plugins\Helper::ValidateWildcardValues($sName, $sNames, $sFoundedValue) && 0 < \strlen($sFoundedValue)) if (\RainLoop\Plugins\Helper::ValidateWildcardValues($sName, $sNames, $sFoundedValue) && 0 < \strlen($sFoundedValue))
{ {
$mResult = $this->Load($sFoundedValue, false); if (0 === \strlen($sDisabled) || false === \strpos(\strtolower(','.$sDisabled.','), \strtolower(','.$sFoundedValue.',')))
} {
} $mResult = $this->Load($sFoundedValue, false);
} }
if ($mResult instanceof \RainLoop\Domain)
{
if (\file_exists($this->sDomainPath.'/disabled'))
{
$sDisabled = @\file_get_contents($this->sDomainPath.'/disabled');
if (false !== $sDisabled && 0 < \strlen($sDisabled))
{
$sDisabledName = 0 < \strlen($sFoundedValue) ? $sFoundedValue : $sName;
$mResult->SetDisabled(false !== \strpos(strtolower(','.$sDisabled.','), \strtolower(','.$sDisabledName.',')));
} }
} }
} }

View file

@ -1,49 +1,50 @@
<?php <?php
namespace RainLoop\Providers\Domain; namespace RainLoop\Providers\Domain;
interface DomainAdminInterface extends DomainInterface interface DomainAdminInterface extends DomainInterface
{ {
/** /**
* @param string $sName * @param string $sName
* @param bool $bDisable * @param bool $bDisable
* *
* @return bool * @return bool
*/ */
public function Disable($sName, $bDisable); public function Disable($sName, $bDisable);
/** /**
* @param string $sName * @param string $sName
* * @param bool $bFindWithWildCard = false
* @return \RainLoop\Domain | null *
*/ * @return \RainLoop\Domain | null
public function Load($sName); */
public function Load($sName, $bFindWithWildCard = false);
/**
* @param \RainLoop\Domain $oDomain /**
* * @param \RainLoop\Domain $oDomain
* @return bool *
*/ * @return bool
public function Save(\RainLoop\Domain $oDomain); */
public function Save(\RainLoop\Domain $oDomain);
/**
* @param string $sName /**
* * @param string $sName
* @return bool *
*/ * @return bool
public function Delete($sName); */
public function Delete($sName);
/**
* @param int $iOffset /**
* @param int $iLimit = 20 * @param int $iOffset
* * @param int $iLimit = 20
* @return array *
*/ * @return array
public function GetList($iOffset, $iLimit = 20); */
public function GetList($iOffset, $iLimit = 20);
/**
* @return int /**
*/ * @return int
public function Count(); */
public function Count();
} }

View file

@ -1,13 +0,0 @@
<?php
namespace RainLoop\Providers\Domain;
interface DomainSimpleInterface extends DomainInterface
{
/**
* @param string $sName
*
* @return \RainLoop\Domain | null
*/
public function Load($sName);
}

View file

@ -2,6 +2,8 @@
<div class="b-toolbar g-ui-user-select-none"> <div class="b-toolbar g-ui-user-select-none">
<div class="btn-toolbar"> <div class="btn-toolbar">
<h4 class="pull-left"> <h4 class="pull-left">
<i class="icon-spinner animated" style="margin-top: 2px" data-bind="style: {'visibility': adminManLoadingVisibility }"></i>
&nbsp;&nbsp;
Admin Panel Admin Panel
&nbsp;&nbsp; &nbsp;&nbsp;
(<span data-bind="text: adminDomain"></span>&nbsp;&ndash;&nbsp;<span data-bind="text: version"></span>) (<span data-bind="text: adminDomain"></span>&nbsp;&ndash;&nbsp;<span data-bind="text: version"></span>)

View file

@ -3,21 +3,20 @@
Domains Domains
</div> </div>
<div> <div>
<blockquote>
<p class="muted">
List of domains webmail is allowed to access.
</p>
</blockquote>
<a class="btn" data-bind="click: createDomain"> <a class="btn" data-bind="click: createDomain">
<i class="icon-plus"></i> <i class="icon-plus"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
Add Domain Add Domain
</a> </a>
<div class="process-place" data-bind="style: {'visibility': visibility }"> <br />
<i class="icon-spinner animated"></i> <br />
&nbsp;&nbsp; <blockquote>
loading... <p class="muted">
</div> List of domains webmail is allowed to access.
<br />
Click on the name to configure the domain.
</p>
</blockquote>
<table class="table table-hover b-admin-domains-list-table" data-bind="i18nUpdate: domains"> <table class="table table-hover b-admin-domains-list-table" data-bind="i18nUpdate: domains">
<colgroup> <colgroup>
<col /> <col />

View file

@ -4,23 +4,17 @@
Cannot access the repository at the moment. Cannot access the repository at the moment.
</div> </div>
<!--
<div class="alert" data-bind="visible: !packagesMainUpdatable() && !packagesLoading()">
Unable to update RainLoop Webmail source!
</div>
-->
<div class="alert" data-bind="visible: '' !== packagesError()"> <div class="alert" data-bind="visible: '' !== packagesError()">
<button type="button" class="close" data-bind="click: function () { packagesError('') }">&times;</button> <button type="button" class="close" data-bind="click: function () { packagesError('') }">&times;</button>
<span data-bind="text: packagesError"></span> <span data-bind="text: packagesError"></span>
</div> </div>
<div class="process-place" data-bind="style: {'visibility': visibility }"> <!-- <div class="process-place" data-bind="style: {'visibility': visibility }">
<i class="icon-spinner animated"></i> <i class="icon-spinner animated"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
loading... loading...
</div> </div>
-->
<div data-bind="visible: 0 < packagesAvailableForUpdate().length"> <div data-bind="visible: 0 < packagesAvailableForUpdate().length">
<div class="legend"> <div class="legend">
Available for Update (<span data-bind="text: packagesAvailableForUpdate().length"></span>) Available for Update (<span data-bind="text: packagesAvailableForUpdate().length"></span>)

View file

@ -7,16 +7,16 @@
</div> </div>
</div> </div>
<div class="process-place" data-bind="style: {'visibility': visibility }"> <!-- <div class="process-place" data-bind="style: {'visibility': visibility }">
<i class="icon-spinner animated"></i> <i class="icon-spinner animated"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
loading... loading...
</div> </div>-->
<div class="legend"> <div class="legend">
Plugins Plugins
</div> </div>
<div> <div>
<label data-bind="click: function () { enabledPlugins(!enabledPlugins()); }"> <label data-bind="click: function () { enabledPlugins(!enabledPlugins()); }">
<i data-bind="css: enabledPlugins() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i> <i data-bind="css: enabledPlugins() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>

View file

@ -4938,20 +4938,6 @@ function PopupsDomainViewModel()
this.smtpAuth = ko.observable(true); this.smtpAuth = ko.observable(true);
this.whiteList = ko.observable(''); 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 () { this.headerText = ko.computed(function () {
var sName = this.name(); var sName = this.name();
return this.edit() ? 'Edit Domain "' + sName + '"' : return this.edit() ? 'Edit Domain "' + sName + '"' :
@ -5001,6 +4987,7 @@ function PopupsDomainViewModel()
this.testing(true); this.testing(true);
RL.remote().testConnectionForDomain( RL.remote().testConnectionForDomain(
_.bind(this.onTestConnectionResponse, this), _.bind(this.onTestConnectionResponse, this),
this.name(),
this.imapServer(), this.imapServer(),
this.imapPort(), this.imapPort(),
this.imapSecure(), this.imapSecure(),
@ -5015,6 +5002,67 @@ function PopupsDomainViewModel()
this.whiteListPage(!this.whiteListPage()); 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); Knoin.constructorEnd(this);
} }
@ -5660,6 +5708,8 @@ function AdminPaneViewModel()
this.adminDomain = ko.observable(RL.settingsGet('AdminDomain')); this.adminDomain = ko.observable(RL.settingsGet('AdminDomain'));
this.version = ko.observable(RL.settingsGet('Version')); this.version = ko.observable(RL.settingsGet('Version'));
this.adminManLoadingVisibility = RL.data().adminManLoadingVisibility;
Knoin.constructorEnd(this); Knoin.constructorEnd(this);
} }
@ -6809,6 +6859,14 @@ function AdminDataStorage()
this.licenseError = ko.observable(''); this.licenseError = ko.observable('');
this.licenseTrigger = ko.observable(false); this.licenseTrigger = ko.observable(false);
this.adminManLoading = ko.computed(function () {
return '000' !== [this.domainsLoading() ? '1' : '0', this.pluginsLoading() ? '1' : '0', this.packagesLoading() ? '1' : '0'].join('');
}, this);
this.adminManLoadingVisibility = ko.computed(function () {
return this.adminManLoading() ? 'visible' : 'hidden';
}, this).extend({'rateLimit': 300});
} }
_.extend(AdminDataStorage.prototype, AbstractData.prototype); _.extend(AdminDataStorage.prototype, AbstractData.prototype);
@ -7294,11 +7352,12 @@ AdminAjaxRemoteStorage.prototype.createOrUpdateDomain = function (fCallback,
}); });
}; };
AdminAjaxRemoteStorage.prototype.testConnectionForDomain = function (fCallback, AdminAjaxRemoteStorage.prototype.testConnectionForDomain = function (fCallback, sName,
sIncHost, iIncPort, sIncSecure, sIncHost, iIncPort, sIncSecure,
sOutHost, iOutPort, sOutSecure, bOutAuth) sOutHost, iOutPort, sOutSecure, bOutAuth)
{ {
this.defaultRequest(fCallback, 'AdminDomainTest', { this.defaultRequest(fCallback, 'AdminDomainTest', {
'Name': sName,
'IncHost': sIncHost, 'IncHost': sIncHost,
'IncPort': iIncPort, 'IncPort': iIncPort,
'IncSecure': sIncSecure, 'IncSecure': sIncSecure,

File diff suppressed because one or more lines are too long