diff --git a/Config/Migration/1418196036_bbses.php b/Config/Migration/1418196036_bbses.php index cfa3be9..a969426 100644 --- a/Config/Migration/1418196036_bbses.php +++ b/Config/Migration/1418196036_bbses.php @@ -130,6 +130,8 @@ class Bbses extends CakeMigration { 'namespace' => 'netcommons/bbses', 'name' => '掲示板', 'type' => 1, + 'default_action' => 'bbs_articles/index', + 'default_setting_action' => 'bbs_blocks/index', ), ), 'plugins_roles' => array( @@ -193,4 +195,4 @@ public function updateRecords($model, $records, $scope = null) { } return true; } -} \ No newline at end of file +} diff --git a/Controller/BlockRolePermissionsController.php b/Controller/BbsBlockRolePermissionsController.php similarity index 91% rename from Controller/BlockRolePermissionsController.php rename to Controller/BbsBlockRolePermissionsController.php index ddd2782..2b33a5b 100644 --- a/Controller/BlockRolePermissionsController.php +++ b/Controller/BbsBlockRolePermissionsController.php @@ -17,7 +17,7 @@ * @author Kotaro Hokada * @package NetCommons\Bbses\Controller */ -class BlockRolePermissionsController extends BbsesAppController { +class BbsBlockRolePermissionsController extends BbsesAppController { /** * layout @@ -73,9 +73,6 @@ class BlockRolePermissionsController extends BbsesAppController { public function beforeFilter() { parent::beforeFilter(); - $results = $this->camelizeKeyRecursive($this->NetCommonsFrame->data); - $this->set($results); - //タブの設定 $this->initTabs('block_index', 'role_permissions'); } @@ -116,7 +113,7 @@ public function edit() { $this->BbsSetting->saveBbsSetting($data); if ($this->handleValidationError($this->BbsSetting->validationErrors)) { if (! $this->request->is('ajax')) { - $this->redirect('/bbses/blocks/index/' . $this->viewVars['frameId']); + $this->redirect('/bbses/bbs_blocks/index/' . $this->viewVars['frameId']); } return; } diff --git a/Controller/BlocksController.php b/Controller/BbsBlocksController.php similarity index 85% rename from Controller/BlocksController.php rename to Controller/BbsBlocksController.php index 88c541c..67a0afb 100644 --- a/Controller/BlocksController.php +++ b/Controller/BbsBlocksController.php @@ -17,7 +17,7 @@ * @author Kotaro Hokada * @package NetCommons\Bbses\Controller */ -class BlocksController extends BbsesAppController { +class BbsBlocksController extends BbsesAppController { /** * layout @@ -70,9 +70,6 @@ public function beforeFilter() { parent::beforeFilter(); $this->Auth->deny('index'); - $results = $this->camelizeKeyRecursive($this->NetCommonsFrame->data); - $this->set($results); - //タブの設定 $this->initTabs('block_index', 'block_settings'); } @@ -81,7 +78,6 @@ public function beforeFilter() { * index * * @return void - * @throws Exception */ public function index() { $this->Paginator->settings = array( @@ -95,19 +91,9 @@ public function index() { ) ); - try { - $bbses = $this->Paginator->paginate('Bbs'); - } catch (Exception $ex) { - if (isset($this->request['paging']) && $this->params['named']) { - $this->redirect('/bbses/blocks/index/' . $this->viewVars['frameId']); - return; - } - CakeLog::error($ex); - throw $ex; - } - + $bbses = $this->Paginator->paginate('Bbs'); if (! $bbses) { - $this->view = 'Blocks/not_found'; + $this->view = 'not_found'; return; } @@ -124,7 +110,7 @@ public function index() { * @return void */ public function add() { - $this->view = 'Blocks/edit'; + $this->view = 'edit'; $this->set('blockId', null); $bbs = $this->Bbs->create( @@ -158,7 +144,7 @@ public function add() { $this->Bbs->saveBbs($data); if ($this->handleValidationError($this->Bbs->validationErrors)) { if (! $this->request->is('ajax')) { - $this->redirect('/bbses/blocks/index/' . $this->viewVars['frameId']); + $this->redirect('/bbses/bbs_blocks/index/' . $this->viewVars['frameId']); } return; } @@ -192,7 +178,7 @@ public function edit() { $this->Bbs->saveBbs($data); if ($this->handleValidationError($this->Bbs->validationErrors)) { if (! $this->request->is('ajax')) { - $this->redirect('/bbses/blocks/index/' . $this->viewVars['frameId']); + $this->redirect('/bbses/bbs_blocks/index/' . $this->viewVars['frameId']); } return; } @@ -219,7 +205,7 @@ public function delete() { if ($this->request->isDelete()) { if ($this->Bbs->deleteBbs($this->data)) { if (! $this->request->is('ajax')) { - $this->redirect('/bbses/blocks/index/' . $this->viewVars['frameId']); + $this->redirect('/bbses/bbs_blocks/index/' . $this->viewVars['frameId']); } return; } diff --git a/Controller/BbsFrameSettingsController.php b/Controller/BbsFrameSettingsController.php index 1e45998..56d134d 100644 --- a/Controller/BbsFrameSettingsController.php +++ b/Controller/BbsFrameSettingsController.php @@ -24,7 +24,7 @@ class BbsFrameSettingsController extends BbsesAppController { * * @var array */ - public $layout = 'NetCommons.setting'; + public $layout = 'Frames.setting'; /** * use models @@ -57,9 +57,6 @@ class BbsFrameSettingsController extends BbsesAppController { public function beforeFilter() { parent::beforeFilter(); - $results = $this->camelizeKeyRecursive($this->NetCommonsFrame->data); - $this->set($results); - //タブの設定 $this->initTabs('frame_settings', ''); } diff --git a/Controller/BbsesAppController.php b/Controller/BbsesAppController.php index c711b1f..18dcd81 100644 --- a/Controller/BbsesAppController.php +++ b/Controller/BbsesAppController.php @@ -26,6 +26,7 @@ class BbsesAppController extends AppController { */ public $components = array( 'NetCommons.NetCommonsFrame', + 'Pages.PageLayout', 'Security' ); @@ -48,17 +49,6 @@ class BbsesAppController extends AppController { 'NetCommons.Date', ); -/** - * beforeFilter - * - * @return void - */ - public function beforeFilter() { - parent::beforeFilter(); - $results = $this->camelizeKeyRecursive(['current' => $this->current]); - $this->set($results); - } - /** * initBbs * @@ -115,7 +105,7 @@ public function initTabs($mainActiveTab, $blockActiveTab) { 'block_index' => array( 'url' => array( 'plugin' => $this->params['plugin'], - 'controller' => 'blocks', + 'controller' => 'bbs_blocks', 'action' => 'index', $this->viewVars['frameId'], ) @@ -138,7 +128,7 @@ public function initTabs($mainActiveTab, $blockActiveTab) { 'block_settings' => array( 'url' => array( 'plugin' => $this->params['plugin'], - 'controller' => 'blocks', + 'controller' => 'bbs_blocks', 'action' => $this->params['action'], $this->viewVars['frameId'], $blockId @@ -147,7 +137,7 @@ public function initTabs($mainActiveTab, $blockActiveTab) { 'role_permissions' => array( 'url' => array( 'plugin' => $this->params['plugin'], - 'controller' => 'block_role_permissions', + 'controller' => 'bbs_block_role_permissions', 'action' => 'edit', $this->viewVars['frameId'], $blockId diff --git a/Controller/BbsesController.php b/Controller/BbsesController.php index 84f65e5..6d7e862 100644 --- a/Controller/BbsesController.php +++ b/Controller/BbsesController.php @@ -19,22 +19,4 @@ */ class BbsesController extends BbsesAppController { -/** - * index - * - * @return void - */ - public function index() { - if (! $this->viewVars['blockId']) { - $this->autoRender = false; - return; - } - $html = $this->requestAction( - array('controller' => 'bbs_articles', 'action' => 'index', $this->viewVars['frameId']), - //array('controller' => 'bbs_posts', 'action' => 'index', $this->viewVars['frameId']), - array('return') - ); - - $this->set('html', $html); - } } diff --git a/Model/BbsArticle.php b/Model/BbsArticle.php index d4efd82..b34818f 100644 --- a/Model/BbsArticle.php +++ b/Model/BbsArticle.php @@ -111,8 +111,7 @@ public function beforeValidate($options = array()) { 'notEmpty' => array( 'rule' => array('notEmpty'), 'message' => sprintf(__d('net_commons', 'Please input %s.'), __d('bbses', 'Title')), - 'required' - => true + 'required' => true ), ), 'content' => array( diff --git a/Test/Case/Controller/BbsesAppTest.php b/Test/Case/Controller/BbsesAppTest.php index 72ca4a0..7b220c0 100644 --- a/Test/Case/Controller/BbsesAppTest.php +++ b/Test/Case/Controller/BbsesAppTest.php @@ -45,7 +45,7 @@ class BbsesAppTest extends YAControllerTestCase { 'plugin.containers.container', 'plugin.containers.containers_page', 'plugin.m17n.language', - 'plugin.m17n.languages_page', + 'plugin.pages.languages_page', 'plugin.pages.page', 'plugin.rooms.room', 'plugin.rooms.roles_rooms_user', diff --git a/View/BlockRolePermissions/edit.ctp b/View/BbsBlockRolePermissions/edit.ctp similarity index 82% rename from View/BlockRolePermissions/edit.ctp rename to View/BbsBlockRolePermissions/edit.ctp index f420bc1..d842063 100644 --- a/View/BlockRolePermissions/edit.ctp +++ b/View/BbsBlockRolePermissions/edit.ctp @@ -19,10 +19,10 @@ element('Blocks.setting_tabs', $blockSettingTabs); ?> element('Blocks.edit_form', array( - 'controller' => 'BlockRolePermission', + 'controller' => 'BbsBlockRolePermissions', 'action' => 'edit' . '/' . $frameId . '/' . $blockId, - 'callback' => 'Bbses.BlockRolePermissions/edit_form', - 'cancelUrl' => '/bbses/blocks/index/' . $frameId, + 'callback' => 'Bbses.BbsBlockRolePermissions/edit_form', + 'cancelUrl' => '/bbses/bbs_blocks/index/' . $frameId, 'options' => array('ng-controller' => 'Bbses'), )); ?> diff --git a/View/Blocks/edit.ctp b/View/BbsBlocks/edit.ctp similarity index 81% rename from View/Blocks/edit.ctp rename to View/BbsBlocks/edit.ctp index ec6da3a..45d6966 100644 --- a/View/Blocks/edit.ctp +++ b/View/BbsBlocks/edit.ctp @@ -19,17 +19,17 @@ element('Blocks.setting_tabs', $blockSettingTabs); ?> element('Blocks.edit_form', array( - 'controller' => 'Blocks', + 'controller' => 'BbsBlocks', 'action' => h($this->request->params['action']) . '/' . $frameId . '/' . $blockId, - 'callback' => 'Bbses.Blocks/edit_form', - 'cancelUrl' => '/bbses/blocks/index/' . $frameId + 'callback' => 'Bbses.BbsBlocks/edit_form', + 'cancelUrl' => '/bbses/bbs_blocks/index/' . $frameId )); ?> request->params['action'] === 'edit') : ?> element('Blocks.delete_form', array( - 'controller' => 'Blocks', + 'controller' => 'BbsBlocks', 'action' => 'delete/' . $frameId . '/' . $blockId, - 'callback' => 'Bbses.Blocks/delete_form' + 'callback' => 'Bbses.BbsBlocks/delete_form' )); ?> diff --git a/View/Blocks/index.ctp b/View/BbsBlocks/index.ctp similarity index 91% rename from View/Blocks/index.ctp rename to View/BbsBlocks/index.ctp index b5a20a2..ff9650f 100644 --- a/View/Blocks/index.ctp +++ b/View/BbsBlocks/index.ctp @@ -15,7 +15,7 @@
@@ -62,7 +62,7 @@ )); ?> - + @@ -81,7 +81,7 @@
element('NetCommons.paginator', array( 'url' => Hash::merge( - array('controller' => 'blocks', 'action' => 'index', $frameId), + array('controller' => 'bbs_blocks', 'action' => 'index', $frameId), $this->Paginator->params['named'] ) )); ?> diff --git a/View/Blocks/not_found.ctp b/View/BbsBlocks/not_found.ctp similarity index 94% rename from View/Blocks/not_found.ctp rename to View/BbsBlocks/not_found.ctp index 7a4373f..37e35fb 100644 --- a/View/Blocks/not_found.ctp +++ b/View/BbsBlocks/not_found.ctp @@ -15,7 +15,7 @@
diff --git a/View/BbsFrameSettings/edit.ctp b/View/BbsFrameSettings/edit.ctp index dce2348..a745342 100644 --- a/View/BbsFrameSettings/edit.ctp +++ b/View/BbsFrameSettings/edit.ctp @@ -20,7 +20,7 @@ )); ?> element('Blocks.edit_form', array( - 'controller' => 'Blocks', + 'controller' => 'BbsBlocks', 'action' => 'edit' . '/' . $frameId, 'callback' => 'Bbses.BbsFrameSettings/edit_form', 'cancelUrl' => $this->Html->url(isset($current['page']) ? '/' . $current['page']['permalink'] : null) diff --git a/View/Elements/BlockRolePermissions/edit_form.ctp b/View/Elements/BbsBlockRolePermissions/edit_form.ctp similarity index 100% rename from View/Elements/BlockRolePermissions/edit_form.ctp rename to View/Elements/BbsBlockRolePermissions/edit_form.ctp diff --git a/View/Elements/Blocks/delete_form.ctp b/View/Elements/BbsBlocks/delete_form.ctp similarity index 100% rename from View/Elements/Blocks/delete_form.ctp rename to View/Elements/BbsBlocks/delete_form.ctp diff --git a/View/Elements/Blocks/edit_form.ctp b/View/Elements/BbsBlocks/edit_form.ctp similarity index 100% rename from View/Elements/Blocks/edit_form.ctp rename to View/Elements/BbsBlocks/edit_form.ctp diff --git a/composer.json b/composer.json index 9cfcae2..db3ae52 100644 --- a/composer.json +++ b/composer.json @@ -21,8 +21,8 @@ "satooshi/php-coveralls": "dev-master", "netcommons/auth": "dev-master", "netcommons/auth-general": "dev-master", - "netcommons/boxes": "dev-master", "netcommons/blocks": "dev-master", + "netcommons/boxes": "dev-master", "netcommons/comments": "dev-master", "netcommons/containers": "dev-master", "netcommons/frames": "dev-master", @@ -30,9 +30,10 @@ "netcommons/likes": "dev-master", "netcommons/m17n": "dev-master", "netcommons/net-commons": "dev-master", + "netcommons/pages": "dev-master", + "netcommons/plugin-manager": "dev-master", "netcommons/roles": "dev-master", "netcommons/rooms": "dev-master", - "netcommons/pages": "dev-master", "netcommons/users": "dev-master" }, "license": "NetCommons License",