Skip to content

Commit

Permalink
优化一下后台,见鬼
Browse files Browse the repository at this point in the history
  • Loading branch information
yidashi committed Jul 26, 2016
1 parent 8d71f77 commit e3d016e
Show file tree
Hide file tree
Showing 182 changed files with 2,279 additions and 751 deletions.
2 changes: 1 addition & 1 deletion Yii.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static function getVersion()
}
public static function powered()
{
return 'Powered by ' . '<a href="http:https://cms.51siyuan.cn/" rel="external">Yuan CMS</a>';
return 'Powered by ' . '<a href="http:https://www.51siyuan.cn/" rel="external">Yuan CMS</a>';
}
}

Expand Down
Empty file modified backend/behaviors/AdminLogBehavior.php
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions backend/config/main-local.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
'enablePrettyUrl' => env('BACKEND_PRETTY_URL', false),
'showScriptName' => false,
'rules' => [
'user/<action:\S+>' => 'user/admin/<action>',
],
],
],
Expand Down
22 changes: 16 additions & 6 deletions backend/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
],
'components' => [
'user' => [
'identityClass' => 'common\models\User',
'identityClass' => 'common\modules\user\models\User',
'loginUrl' => '/user/security/login',
'enableAutoLogin' => true,
'idParam' => '__idBackend',
'identityCookie' => ['name' => '_identityBackend', 'httpOnly' => true]
Expand All @@ -47,7 +48,7 @@
],
],
'authManager' => [
'class' => 'yii\rbac\DbManager',
'class' => 'rbac\components\DbManager',
],
'errorHandler' => [
'errorAction' => 'site/error',
Expand All @@ -57,10 +58,16 @@
],
'i18n' => [
'translations' => [
'app*' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath'=>'@common/messages',
'fileMap' => ['app' => 'backend.php'],
'on missingTranslation' => ['\backend\modules\i18n\Module', 'missingTranslation']
],
'yii2tech-admin' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@yii2tech/admin/messages',
],
]
],
],
'themeManager' => [
Expand All @@ -72,22 +79,25 @@
],
'modules' => [
'rbac' => [
'class' => 'mdm\admin\Module',
'class' => 'rbac\Module',
],
'backup' => [
'class' => 'backup\Module',
],
'i18n' => [
'class' => 'backend\modules\i18n\Module',
'defaultRoute'=>'i18n-message/index'
],
'user' => [
'defaultRoute' => 'admin'
]
],
'aliases' => [
'@mdm/admin' => '@backend/modules/rbac',
'@rbac' => '@backend/modules/rbac',
'@backup' => '@backend/modules/backup',
],
'as access' => [
'class' => 'mdm\admin\components\AccessControl',
'class' => 'rbac\components\AccessControl',
'allowActions' => [
'site/logout',
],
Expand Down
Empty file modified backend/controllers/ThemeController.php
100644 → 100755
Empty file.
141 changes: 0 additions & 141 deletions backend/controllers/UserController.php

This file was deleted.

Empty file modified backend/models/ThemezipForm.php
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion backend/models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Signup form
*/
class User extends \common\models\User
class User extends \common\modules\user\models\User
{
public function attributes()
{
Expand Down
Empty file modified backend/models/search/SearchModelTrait.php
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions backend/modules/rbac/AdminAsset.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace mdm\admin;
namespace rbac;

/**
* AdminAsset.
Expand All @@ -14,7 +14,7 @@ class AdminAsset extends \yii\web\AssetBundle
/**
* {@inheritdoc}
*/
public $sourcePath = '@mdm/admin/assets';
public $sourcePath = '@rbac/assets';

/**
* {@inheritdoc}
Expand Down
4 changes: 2 additions & 2 deletions backend/modules/rbac/AutocompleteAsset.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace mdm\admin;
namespace rbac;

/**
* AutocompleteAsset.
Expand All @@ -14,7 +14,7 @@ class AutocompleteAsset extends \yii\web\AssetBundle
/**
* {@inheritdoc}
*/
public $sourcePath = '@mdm/admin/assets';
public $sourcePath = '@rbac/assets';

/**
* {@inheritdoc}
Expand Down
19 changes: 10 additions & 9 deletions backend/modules/rbac/Module.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace mdm\admin;
namespace rbac;

use Yii;
use yii\helpers\Inflector;
Expand All @@ -15,7 +15,7 @@
* 'layout' => 'left-menu', // default to null mean use application layout.
* 'controllerMap' => [
* 'assignment' => [
* 'class' => 'mdm\admin\controllers\AssignmentController',
* 'class' => 'rbac\controllers\AssignmentController',
* 'userClassName' => 'app\models\User',
* 'idField' => 'id'
* ]
Expand Down Expand Up @@ -91,18 +91,19 @@ class Module extends \yii\base\Module
public function init()
{
parent::init();
if (!isset(Yii::$app->i18n->translations['rbac-admin'])) {
Yii::$app->i18n->translations['rbac-admin'] = [
if (!isset(Yii::$app->i18n->translations['rbac'])) {
Yii::$app->i18n->translations['rbac'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en',
'basePath' => '@mdm/admin/messages',
'basePath' => '@rbac/messages',
'fileMap' => ['rbac' => 'rbac-admin.php']
];
}
//user did not define the Navbar?
if ($this->navbar === null) {
$this->navbar = [
['label' => Yii::t('rbac-admin', 'Help'), 'url' => 'https://github.com/mdmsoft/yii2-admin/blob/master/docs/guide/basic-usage.md'],
['label' => Yii::t('rbac-admin', 'Application'), 'url' => Yii::$app->homeUrl],
['label' => Yii::t('rbac', 'Help'), 'url' => 'https://github.com/mdmsoft/yii2-admin/blob/master/docs/guide/basic-usage.md'],
['label' => Yii::t('rbac', 'Application'), 'url' => Yii::$app->homeUrl],
];
}
}
Expand All @@ -121,11 +122,11 @@ public function getMenus()
$config = components\Configs::instance();
foreach ($this->_coreItems as $id => $lable) {
if ($id !== 'menu' || ($config->db !== null && $config->db->schema->getTableSchema($config->menuTable) !== null)) {
$this->_normalizeMenus[$id] = ['label' => Yii::t('rbac-admin', $lable), 'url' => [$mid.$id]];
$this->_normalizeMenus[$id] = ['label' => Yii::t('rbac', $lable), 'url' => [$mid.$id]];
}
}
foreach (array_keys($this->controllerMap) as $id) {
$this->_normalizeMenus[$id] = ['label' => Yii::t('rbac-admin', Inflector::humanize($id)), 'url' => [$mid.$id]];
$this->_normalizeMenus[$id] = ['label' => Yii::t('rbac', Inflector::humanize($id)), 'url' => [$mid.$id]];
}

// user configure menus
Expand Down
6 changes: 3 additions & 3 deletions backend/modules/rbac/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Once the extension is installed, simply modify your application configuration as
return [
'modules' => [
'admin' => [
'class' => 'mdm\admin\Module',
'class' => 'rbac\Module',
...
]
...
Expand All @@ -77,7 +77,7 @@ return [
]
],
'as access' => [
'class' => 'mdm\admin\components\AccessControl',
'class' => 'rbac\components\AccessControl',
'allowActions' => [
'site/*',
'admin/*',
Expand Down Expand Up @@ -125,7 +125,7 @@ To do that, change them via `controllerMap` property. For example:
...
'controllerMap' => [
'assignment' => [
'class' => 'mdm\admin\controllers\AssignmentController',
'class' => 'rbac\controllers\AssignmentController',
/* 'userClassName' => 'app\models\User', */ // fully qualified class name of your User model
// Usually you don't need to specify it explicitly, since the module will detect it automatically
'idField' => 'user_id', // id field of your User model that corresponds to Yii::$app->user->id
Expand Down
4 changes: 2 additions & 2 deletions backend/modules/rbac/components/AccessControl.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace mdm\admin\components;
namespace rbac\components;

use yii\web\ForbiddenHttpException;
use yii\base\Module;
Expand All @@ -18,7 +18,7 @@
*
* ~~~
* 'as access' => [
* 'class' => 'mdm\admin\components\AccessControl',
* 'class' => 'rbac\components\AccessControl',
* 'allowActions' => ['site/login', 'site/error']
* ]
* ~~~
Expand Down
4 changes: 2 additions & 2 deletions backend/modules/rbac/components/Configs.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace mdm\admin\components;
namespace rbac\components;

use Yii;
use yii\db\Connection;
Expand All @@ -24,7 +24,7 @@
* or use [[\Yii::$container]]
*
* ~~~
* Yii::$container->set('mdm\admin\components\Configs',[
* Yii::$container->set('rbac\components\Configs',[
* 'db' => 'customDb',
* 'menuTable' => 'admin_menu',
* ]);
Expand Down
Loading

0 comments on commit e3d016e

Please sign in to comment.