Small improvements

This commit is contained in:
RainLoop Team 2014-02-09 21:09:10 +04:00
parent 012bea8938
commit 17f6204d2a
14 changed files with 137 additions and 153 deletions

View file

@ -88,6 +88,17 @@ function WebMailDataStorage()
this.foldersDeleting = ko.observable(false);
this.foldersRenaming = ko.observable(false);
this.foldersChanging = ko.computed(function () {
var
bLoading = this.foldersLoading(),
bCreating = this.foldersCreating(),
bDeleting = this.foldersDeleting(),
bRenaming = this.foldersRenaming()
;
return bLoading || bCreating || bDeleting || bRenaming;
}, this);
this.foldersInboxUnreadCount = ko.observable(0);
this.currentFolder = ko.observable(null).extend({'toggleSubscribe': [null,

View file

@ -10,6 +10,7 @@ function MailBoxFolderListViewModel()
this.folderList = RL.data().folderList;
this.folderListSystem = RL.data().folderListSystem;
this.foldersChanging = RL.data().foldersChanging;
this.iDropOverTimer = 0;

View file

@ -45,7 +45,7 @@ function PopupsDomainViewModel()
this.smtpServerFocus.subscribe(function (bValue) {
if (bValue && '' !== this.imapServer() && '' === this.smtpServer())
{
this.smtpServer(this.imapServer());
this.smtpServer(this.imapServer().replace(/imap/ig, 'smtp'));
}
}, this);

View file

@ -1,8 +1,8 @@
{
"name": "RainLoop",
"title": "RainLoop Webmail",
"version": "1.6.2",
"release": "672",
"version": "1.6.3",
"release": "701",
"description": "Simple, modern & fast web-based email client",
"homepage": "http://rainloop.net",
"main": "Gruntfile.js",

View file

@ -71,11 +71,6 @@ class Actions
*/
private $oSettingsProvider;
/**
* @var \RainLoop\Providers\Login
*/
private $oLoginProvider;
/**
* @var \RainLoop\Providers\PersonalAddressBook
*/
@ -120,7 +115,6 @@ class Actions
$this->oFilesProvider = null;
$this->oSettingsProvider = null;
$this->oDomainProvider = null;
$this->oLoginProvider = null;
$this->oPersonalAddressBookProvider = null;
$this->oSuggestionsProvider = null;
$this->oChangePasswordProvider = null;
@ -224,7 +218,8 @@ class Actions
case 'domain':
// \RainLoop\Providers\Domain\DomainSimpleInterface
// \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());
break;
case 'personal-address-book':
// \RainLoop\Providers\PersonalAddressBook\PersonalAddressBookInterface
@ -577,20 +572,6 @@ class Actions
return $this->oPersonalAddressBookProvider;
}
/**
* @return \RainLoop\Providers\Login
*/
public function LoginProvider()
{
if (null === $this->oLoginProvider)
{
$this->oLoginProvider = new \RainLoop\Providers\Login(
$this->fabrica('login'), $this->DomainProvider());
}
return $this->oLoginProvider;
}
/**
* @return \OAuth2\Client|null
*/
@ -805,6 +786,29 @@ class Actions
return $bResult;
}
/**
* @param string $sEmail
* @param string $sLogin
* @param string $sPassword
* @param bool $sSignMeToken = ''
*
* @return \RainLoop\Account|null
*/
public function LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken = '')
{
$oResult = null;
if (0 < \strlen($sEmail) && 0 < \strlen($sLogin) && 0 < \strlen($sPassword))
{
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true);
if ($oDomain instanceof \RainLoop\Domain && !$oDomain->Disabled() && $oDomain->ValidateWhiteList($sEmail, $sLogin))
{
$oResult = \RainLoop\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken);
}
}
return $oResult;
}
/**
* @param string $sToken
@ -823,8 +827,8 @@ class Actions
if (!empty($aAccountHash[0]) && 'token' === $aAccountHash[0] && 8 === \count($aAccountHash) && !empty($aAccountHash[7]) &&
(!$bValidateShortToken || \RainLoop\Utils::GetShortToken() === $aAccountHash[7]))
{
$oAccount = $this->LoginProvider()->Provide(
$aAccountHash[1], $aAccountHash[2], $aAccountHash[3], empty($aAccountHash[5]) ? '' : $aAccountHash[5]);
$oAccount = $this->LoginProvide($aAccountHash[1], $aAccountHash[2], $aAccountHash[3],
empty($aAccountHash[5]) ? '' : $aAccountHash[5]);
if ($oAccount instanceof \RainLoop\Account)
{
@ -1301,7 +1305,7 @@ class Actions
$this->Plugins()->RunHook('filter.login-credentials', array(&$sEmail, &$sLogin, &$sPassword));
$oAccount = $this->LoginProvider()->Provide($sEmail, $sLogin, $sPassword, $sSignMeToken);
$oAccount = $this->LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken);
if (!($oAccount instanceof \RainLoop\Account))
{
$this->loginErrorDelay();

View file

@ -9,14 +9,21 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
*/
protected $sDomainPath;
/**
* @var \MailSo\Cache\CacheClient
*/
protected $oCacher;
/**
* @param string $sDomainPath
* @param \MailSo\Cache\CacheClient $oCacher = null
*
* @return void
*/
public function __construct($sDomainPath)
public function __construct($sDomainPath, $oCacher = null)
{
$this->sDomainPath = \rtrim(\trim($sDomainPath), '\\/');
$this->oCacher = $oCacher;
}
/**
@ -76,6 +83,55 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
return false !== \file_put_contents($this->sDomainPath.'/disabled', \trim(\implode(',', $aResult), ', '));
}
/**
* @return string
*/
private function wildcardDomainsCacheKey()
{
return '/WildCard/DomainCache/'.\md5(APP_VERSION.APP_PRIVATE_DATA_NAME).'/';
}
/**
* @return string
*/
private function getWildcardDomainsLine()
{
if ($this->oCacher)
{
$sResult = $this->oCacher->Get($this->wildcardDomainsCacheKey());
if (0 < \strlen($sResult))
{
return $sResult;
}
}
$sResult = '';
$aNames = array();
$aList = \glob($this->sDomainPath.'/*.ini');
foreach ($aList as $sFile)
{
$sName = \strtolower(\substr(\basename($sFile), 0, -4));
if ('default' === $sName || false !== strpos($sName, '_wildcard_'))
{
$aNames[] = $this->codeFileName($sName, true);
}
}
if (0 < \count($aNames))
{
\rsort($aNames, SORT_STRING);
$sResult = \implode(' ', $aNames);
}
if ($this->oCacher)
{
$this->oCacher->Set($this->wildcardDomainsCacheKey(), $sResult);
}
return $sResult;
}
/**
* @param string $sName
* @param bool $bFindWithWildCard = false
@ -86,7 +142,9 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
{
$mResult = null;
$sFoundedValue = '';
$sName = \strtolower($sName);
$sRealFileName = $this->codeFileName($sName);
if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini'))
@ -96,28 +154,9 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
}
else if ($bFindWithWildCard)
{
$sNames = '';
$aNames = array();
$aList = \glob($this->sDomainPath.'/*.ini');
foreach ($aList as $sFile)
{
$sName = \strtolower(\substr(\basename($sFile), 0, -4));
if ('default' === $sName || false !== strpos($sName, '_wildcard_'))
{
$aNames[] = $this->codeFileName($sName, true);
}
}
if (0 < \count($aNames))
{
\rsort($aNames, SORT_STRING);
$sNames = \implode(' ', $aNames);
}
$sNames = $this->getWildcardDomainsLine();
if (0 < \strlen($sNames))
{
$sFoundedValue = '';
if (\RainLoop\Plugins\Helper::ValidateWildcardValues($sName, $sNames, $sFoundedValue) && 0 < \strlen($sFoundedValue))
{
$mResult = $this->Load($sFoundedValue, false);
@ -132,7 +171,8 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
$sDisabled = @\file_get_contents($this->sDomainPath.'/disabled');
if (false !== $sDisabled && 0 < \strlen($sDisabled))
{
$mResult->SetDisabled(false !== \strpos(strtolower(','.$sDisabled.','), \strtolower(','.$sName.',')));
$sDisabledName = 0 < \strlen($sFoundedValue) ? $sFoundedValue : $sName;
$mResult->SetDisabled(false !== \strpos(strtolower(','.$sDisabled.','), \strtolower(','.$sDisabledName.',')));
}
}
}
@ -150,6 +190,11 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
$sName = \strtolower($oDomain->Name());
$sRealFileName = $this->codeFileName($sName);
if ($this->oCacher)
{
$this->oCacher->Delete($this->wildcardDomainsCacheKey());
}
$mResult = \file_put_contents($this->sDomainPath.'/'.$sRealFileName.'.ini', $oDomain->ToIniString());
return \is_int($mResult) && 0 < $mResult;
}
@ -175,6 +220,11 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
$this->Disable($sName, false);
}
if ($this->oCacher)
{
$this->oCacher->Delete($this->wildcardDomainsCacheKey());
}
return $bResult;
}

View file

@ -1,61 +0,0 @@
<?php
namespace RainLoop\Providers;
class Login extends \RainLoop\Providers\AbstractProvider
{
/**
* @var \RainLoop\Providers\Login\LoginInterface
*/
private $oDriver;
/**
* @var \RainLoop\Providers\Domain
*/
private $oDomainProvider;
/**
* @param \RainLoop\Providers\Login\LoginInterface $oDriver
* @param \RainLoop\Providers\Domain $oDomainProvider
*
* @return void
*/
public function __construct(\RainLoop\Providers\Login\LoginInterface $oDriver,
\RainLoop\Providers\Domain $oDomainProvider)
{
$this->oDriver = $oDriver;
$this->oDomainProvider = $oDomainProvider;
}
/**
* @param string $sEmail
* @param string $sLogin
* @param string $sPassword
* @param bool $sSignMeToken = ''
*
* @return \RainLoop\Account|null
*/
public function Provide($sEmail, $sLogin, $sPassword, $sSignMeToken = '')
{
$oResult = null;
if ($this->oDriver->ProvideParameters($sEmail, $sLogin, $sPassword))
{
$oDomain = $this->oDomainProvider->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true);
if ($oDomain instanceof \RainLoop\Domain && !$oDomain->Disabled() && $oDomain->ValidateWhiteList($sEmail, $sLogin))
{
$oResult = \RainLoop\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken);
}
}
return $oResult;
}
/**
* @return bool
*/
public function IsActive()
{
return $this->oDriver instanceof \RainLoop\Providers\Login\LoginInterface;
}
}

View file

@ -1,18 +0,0 @@
<?php
namespace RainLoop\Providers\Login;
class DefaultLogin implements \RainLoop\Providers\Login\LoginInterface
{
/**
* @param string $sEmail
* @param string $sLogin
* @param string $sPassword
*
* @return bool
*/
public function ProvideParameters(&$sEmail, &$sLogin, &$sPassword)
{
return 0 < strlen($sEmail) && 0 < strlen($sLogin) && 0 < strlen($sPassword);
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace RainLoop\Providers\Login;
interface LoginInterface
{
/**
* @param string $sEmail
* @param string $sLogin
* @param string $sPassword
*
* @return bool
*/
public function ProvideParameters(&$sEmail, &$sLogin, &$sPassword);
}

View file

@ -19,7 +19,7 @@
<div class="b-footer btn-toolbar">
<div class="btn-group pull-right">
<a class="btn" data-bind="click: createFolder">
<i class="icon-folder-add"></i>
<i data-bind="css: {'icon-folder-add': !foldersChanging(), 'icon-spinner animated': foldersChanging()}"></i>
</a>
<a class="btn" data-bind="click: configureFolders">
<i class="icon-cog"></i>

View file

@ -4521,7 +4521,7 @@ function PopupsDomainViewModel()
this.smtpServerFocus.subscribe(function (bValue) {
if (bValue && '' !== this.imapServer() && '' === this.smtpServer())
{
this.smtpServer(this.imapServer());
this.smtpServer(this.imapServer().replace(/imap/ig, 'smtp'));
}
}, this);

File diff suppressed because one or more lines are too long

View file

@ -10754,6 +10754,7 @@ function MailBoxFolderListViewModel()
this.folderList = RL.data().folderList;
this.folderListSystem = RL.data().folderListSystem;
this.foldersChanging = RL.data().foldersChanging;
this.iDropOverTimer = 0;
@ -13480,6 +13481,17 @@ function WebMailDataStorage()
this.foldersDeleting = ko.observable(false);
this.foldersRenaming = ko.observable(false);
this.foldersChanging = ko.computed(function () {
var
bLoading = this.foldersLoading(),
bCreating = this.foldersCreating(),
bDeleting = this.foldersDeleting(),
bRenaming = this.foldersRenaming()
;
return bLoading || bCreating || bDeleting || bRenaming;
}, this);
this.foldersInboxUnreadCount = ko.observable(0);
this.currentFolder = ko.observable(null).extend({'toggleSubscribe': [null,

File diff suppressed because one or more lines are too long