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

@ -141,15 +141,22 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
public function Load($sName, $bFindWithWildCard = false)
{
$mResult = null;
$sDisabled = '';
$sFoundedValue = '';
$sName = \strtolower($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)
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))
{
$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.',')));
if (0 === \strlen($sDisabled) || false === \strpos(\strtolower(','.$sDisabled.','), \strtolower(','.$sFoundedValue.',')))
{
$mResult = $this->Load($sFoundedValue, false);
}
}
}
}

View file

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