Skip to content

Commit

Permalink
Merge pull request #98 from skeeks-cms/fixed-admin-tree-type
Browse files Browse the repository at this point in the history
Fixed admin tree type
  • Loading branch information
skeeks-semenov committed Mar 30, 2018
2 parents 175a093 + f51ee9a commit 69b55e1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 36 deletions.
59 changes: 24 additions & 35 deletions src/components/storage/ClusterLocal.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
<?php
/**
* Storage
*
* @link https://cms.skeeks.com/
* @copyright Copyright (c) 2010 SkeekS
* @license https://cms.skeeks.com/license/
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 17.10.2014
* @since 1.0.0
*/

namespace skeeks\cms\components\storage;

use Yii;

use \skeeks\sx\File;
use \skeeks\sx\Dir;
use skeeks\sx\Dir;
use skeeks\sx\File;

/**
* Class Storage
* @package common\components\Storage
* @author Semenov Alexander <semenov@skeeks.com>
*/
class ClusterLocal extends Cluster
{
/**
* @var bool
*/
public $publicBaseUrlIsAbsolute = false;
public function init()
{
if (!$this->name) {
Expand All @@ -42,12 +40,6 @@ public function init()

parent::init();
}

/**
* @var bool
*/
public $publicBaseUrlIsAbsolute = false;

/**
* Добавление файла в кластер
*
Expand All @@ -65,11 +57,11 @@ public function upload(File $tmpFile)
$clusterFileSrc = $clusterFileName;

if ($localPath) {
$clusterFileSrc = $localPath . DIRECTORY_SEPARATOR . $clusterFileSrc;
$clusterFileSrc = $localPath.DIRECTORY_SEPARATOR.$clusterFileSrc;
}

try {
$dir = new Dir($dir . DIRECTORY_SEPARATOR . $localPath);
$dir = new Dir($dir.DIRECTORY_SEPARATOR.$localPath);
$resultFile = $dir->newFile($clusterFileName);
$tmpFile->move($resultFile);

Expand Down Expand Up @@ -127,10 +119,21 @@ public function getAbsoluteUrl($clusterFileUniqSrc)
if ($this->publicBaseUrlIsAbsolute) {
return $this->getPublicSrc($clusterFileUniqSrc);
} else {
return \Yii::$app->urlManager->hostInfo . $this->getPublicSrc($clusterFileUniqSrc);
return \Yii::$app->urlManager->hostInfo.$this->getPublicSrc($clusterFileUniqSrc);
}
}
/**
* Свободное место на сервере
* @return float
*/
public function getFreeSpace()
{
if ($this->existsRootPath()) {
return (float)disk_free_space($this->rootBasePath);
}

return (float)0;
}
/**
* @return bool
*/
Expand All @@ -148,20 +151,6 @@ public function existsRootPath()

return false;
}

/**
* Свободное место на сервере
* @return float
*/
public function getFreeSpace()
{
if ($this->existsRootPath()) {
return (float)disk_free_space($this->rootBasePath);
}

return (float)0;
}

/**
* Всего столько места.
* @return float
Expand Down
18 changes: 17 additions & 1 deletion src/relatedProperties/propertyTypes/PropertyTypeList.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace skeeks\cms\relatedProperties\propertyTypes;

use skeeks\cms\backend\widgets\ModalPermissionWidget;
use skeeks\cms\backend\widgets\SelectModelDialogContentElementWidget;
use skeeks\cms\components\Cms;
use skeeks\cms\relatedProperties\models\RelatedPropertiesModel;
Expand Down Expand Up @@ -127,12 +128,15 @@ public function renderConfigForm(ActiveForm $activeForm)
if ($actionIndex) {
$pjax = \yii\widgets\Pjax::begin();

echo "<div class='row'><div class='col-md-6'> ";

if ($actionCreate) {
$actionCreate->url = \yii\helpers\ArrayHelper::merge($actionCreate->urlData, [
'property_id' => $this->property->id
]);

echo \skeeks\cms\backend\widgets\ControllerActionsWidget::widget([

echo \skeeks\cms\backend\widgets\DropdownControllerActionsWidget::widget([
'actions' => ['create' => $actionCreate],
'clientOptions' => ['pjax-id' => $pjax->id],
'isOpenNewWindow' => true,
Expand All @@ -142,7 +146,19 @@ public function renderConfigForm(ActiveForm $activeForm)
'itemOptions' => ['class' => 'btn btn-default'],
'options' => ['class' => 'sx-controll-actions'],
]);

}

echo '</div><div class="col-md-6"><div class="pull-right">';
if (\Yii::$app->user->can('rbac/admin-permission') && $controllerProperty instanceof \skeeks\cms\IHasPermissions)
{
echo ModalPermissionWidget::widget([
'controller' => $controllerProperty
]);
}
echo '</div>';
echo '</div>';
echo '</div>';

$query = \skeeks\cms\models\CmsContentPropertyEnum::find()->orderBy(['priority' => SORT_ASC]);
$query->andWhere(['property_id' => $this->property->id]);
Expand Down

0 comments on commit 69b55e1

Please sign in to comment.