diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..592d72f
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,59 @@
+on:
+ push:
+ # Sequence of patterns matched against refs/tags
+ tags:
+ - '3*'
+
+name: create_release
+
+jobs:
+ build:
+ name: create_release
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Slack Notification on Start
+ uses: rtCamp/action-slack-notify@v2.2.0
+ env:
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }}
+ SLACK_CHANNEL: notify-nc3-release
+ SLACK_TITLE: "${{ github.repository }}"
+ SLACK_COLOR: "#f0ad4e"
+ SLACK_MESSAGE: "Start Job"
+
+ - name: Create Release
+ id: create_release
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
+ with:
+ tag_name: ${{ github.ref }}
+ release_name: ${{ github.ref }}
+ body: |
+ NetCommons ${{ github.ref }} released.
+ draft: false
+ prerelease: false
+
+ # テスト成功時はこちらのステップが実行される
+ - name: Slack Notification on Finish
+ uses: rtCamp/action-slack-notify@v2.2.0
+ if: success()
+ env:
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }}
+ SLACK_CHANNEL: notify-nc3-release
+ SLACK_TITLE: "${{ github.repository }}"
+ SLACK_COLOR: good
+ SLACK_MESSAGE: "Job Success"
+
+ # テスト失敗時はこちらのステップが実行される
+ - name: Slack Notification on Failure
+ uses: rtCamp/action-slack-notify@v2.2.0
+ if: failure()
+ env:
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }}
+ SLACK_CHANNEL: notify-nc3-tests
+ SLACK_TITLE: "${{ github.repository }}"
+ SLACK_COLOR: danger
+ SLACK_MESSAGE: "Job Failure"
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..6da4321
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,168 @@
+on:
+ push:
+ branches:
+ - main
+ - master
+ pull_request:
+ branches:
+ - main
+ - master
+
+name: tests
+
+jobs:
+ setup:
+ name: setup
+ runs-on: ubuntu-latest
+ steps:
+ - name: Slack Notification on Start
+ uses: rtCamp/action-slack-notify@v2.2.0
+ if: env.SLACK_WEBHOOK != ''
+ env:
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }}
+ SLACK_CHANNEL: notify-nc3-tests
+ SLACK_TITLE: "${{ github.repository }}"
+ SLACK_COLOR: "#f0ad4e"
+
+ tests:
+ name: tests
+ needs: setup
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ php: [ '7.1', '7.2', '7.3', '7.4' ]
+ mysql: [ '5.7', '8.0' ]
+
+ env:
+ NC3_BUILD_DIR: "/opt/nc3"
+ NC3_DOCKER_DIR: "/opt/docker"
+ NC3_GIT_URL: "git://github.com/NetCommons3/NetCommons3.git"
+ NC3_GIT_BRANCH: "master"
+ PLUGIN_BUILD_DIR: ${{ github.workspace }}
+ PHP_VERSION: ${{ matrix.php }}
+ MYSQL_VERSION: ${{ matrix.mysql }}
+ MYSQL_ROOT_PASSWORD: root
+ MYSQL_DATABASE: cakephp_test
+ COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Fix up git URLs
+ run: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig
+
+ - name: environment
+ run: |
+ echo "GITHUB_WORKSPACE=${GITHUB_WORKSPACE}"
+ echo "PLUGIN_BUILD_DIR=${PLUGIN_BUILD_DIR}"
+ echo "PHP_VERSION=${PHP_VERSION}"
+ echo "MYSQL_VERSION=${MYSQL_VERSION}"
+ ls -al ${PLUGIN_BUILD_DIR}
+
+ - name: docker-compose install
+ run: |
+ curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
+ chmod +x ~/docker-compose
+ sudo mv ~/docker-compose /usr/local/bin/docker-compose
+ docker-compose --version
+
+ - name: git clone nc3
+ run: git clone -b ${NC3_GIT_BRANCH} ${NC3_GIT_URL} ${NC3_BUILD_DIR}
+
+ - name: git clone nc3_docker
+ run: git clone https://github.com/NetCommons3/nc3app-docker.git ${NC3_DOCKER_DIR}
+
+ - name: docker-compose start
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose up -d
+ docker-compose start
+
+ - run: docker ps
+
+ - name: check libraries
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/start-on-docker.sh
+
+ - name: nc3 build
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/app-build.sh
+
+ - name: phpcs (PHP CodeSniffer)
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/phpcs.sh
+
+ - name: phpmd (PHP Mess Detector)
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/phpmd.sh
+
+ - name: phpcpd (PHP Copy/Paste Detector)
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/phpcpd.sh
+
+ - name: gjslint (JavaScript Style Check)
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/gjslint.sh
+
+ - name: phpdoc (PHP Documentor)
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/phpdoc.sh
+
+ - name: phpunit (PHP UnitTest)
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/phpunit.sh
+ sudo -s chmod a+w -R ${NC3_BUILD_DIR}/build
+
+# - name: push coveralls
+# env:
+# COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+# COVERALLS_FLAG_NAME: ${{ matrix.php }}
+# run: |
+# cd ${NC3_BUILD_DIR}
+# ls -la ${NC3_BUILD_DIR}
+# vendors/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v
+
+ - name: docker-compose remove
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose rm -f
+
+ # テスト失敗時はこちらのステップが実行される
+ - name: Slack Notification on Failure
+ uses: rtCamp/action-slack-notify@v2.2.0
+ if: env.SLACK_WEBHOOK != '' && failure()
+ env:
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }}
+ SLACK_CHANNEL: notify-nc3-tests
+ SLACK_TITLE: "${{ github.repository }}(php${{ matrix.php }}, mysql${{ matrix.mysql }})"
+ SLACK_COLOR: danger
+
+ teardown:
+ name: teardown
+ runs-on: ubuntu-latest
+ needs: tests
+ steps:
+ # テスト成功時はこちらのステップが実行される
+ - name: Slack Notification on Success
+ uses: rtCamp/action-slack-notify@v2.2.0
+ if: env.SLACK_WEBHOOK != '' && success()
+ env:
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }}
+ SLACK_CHANNEL: notify-nc3-tests
+ SLACK_TITLE: "${{ github.repository }}"
+ SLACK_COLOR: good
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index cf653bc..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,41 +0,0 @@
-language: php
-
-php:
- - 5.4
- - 5.5
- - 5.6
- - 7.0
- - 7.1
-
-sudo: false
-
-env:
- matrix:
- - NETCOMMONS_VERSION=master DB=mysql
- global:
- - secure: "tRLhQkdKz4sHxMo/HDEl04RWb4/S/7f8OiElsxQEW1PEGqi2QNAhPlUauMCchaSvTJc2rp8bMq+Qmken7NkmkURgC3N/1UbYcOsFlVm2SX8hIztgXBXbLtNNy9vv18xthV9qXqlG1SUaTJqJasHS/YUJHsq3nV9OhQYCybJE0vA="
- - GIT_COMMITTER_NAME=s-nakajima
- - GIT_COMMITTER_EMAIL=nakajimashouhei@gmail.com
- - GIT_AUTHOR_NAME=s-nakajima
- - GIT_AUTHOR_EMAIL=nakajimashouhei@gmail.com
-
-before_script:
- - export NETCOMMONS_BUILD_DIR=`dirname $TRAVIS_BUILD_DIR`/NetCommons3
- - git clone git://github.com/NetCommons3/NetCommons3 $NETCOMMONS_BUILD_DIR
- - cd $NETCOMMONS_BUILD_DIR
- - git checkout $NETCOMMONS_VERSION
- - travis_wait . tools/build/plugins/cakephp/travis/pre.sh
- - . tools/build/plugins/cakephp/travis/environment.sh
-
-script:
- - . tools/build/plugins/cakephp/travis/main.sh
-
-after_script:
- - . tools/build/plugins/cakephp/travis/post.sh
-
-notifications:
- email:
- recipients:
- - netcommons3@googlegroups.com
- on_success: never # default: change
- on_failure: always # default: always
diff --git a/Controller/MenuFrameSettingsController.php b/Controller/MenuFrameSettingsController.php
index 08bf03f..e8ac5ac 100644
--- a/Controller/MenuFrameSettingsController.php
+++ b/Controller/MenuFrameSettingsController.php
@@ -119,6 +119,14 @@ public function edit() {
//不要パラメータ除去
unset($this->request->data['save']);
//登録処理
+ foreach ($this->request->data['MenuRooms'] as $i => $menuRoom) {
+ $roomId = $menuRoom['MenuFramesRoom']['room_id'] ?? null;
+ $pageId = $menuRoom['MenuFramesRoom']['page_id_top'] ?? null;
+ $isHidden =
+ $this->request->data['Menus'][$roomId][$pageId]['MenuFramesPage']['is_hidden'] ?? null;
+ $this->request->data['MenuRooms'][$i]['MenuFramesRoom']['is_hidden'] = $isHidden;
+ }
+
if ($this->MenuFrameSetting->saveMenuFrameSetting($this->request->data)) {
return $this->redirect(NetCommonsUrl::backToPageUrl());
}
diff --git a/Controller/MenusController.php b/Controller/MenusController.php
index 7512473..51b3c74 100644
--- a/Controller/MenusController.php
+++ b/Controller/MenusController.php
@@ -81,7 +81,7 @@ public function index() {
)
));
- if ($count1 && $count2) {
+ if (!$count1 && $count2) {
$options = array(
MenuFrameSetting::DISPLAY_TYPE_HEADER,
MenuFrameSetting::DISPLAY_TYPE_FOOTER,
diff --git a/Model/MenuFrameSetting.php b/Model/MenuFrameSetting.php
old mode 100755
new mode 100644
diff --git a/Model/MenuFramesPage.php b/Model/MenuFramesPage.php
index ef54c41..cf4f6e8 100644
--- a/Model/MenuFramesPage.php
+++ b/Model/MenuFramesPage.php
@@ -92,8 +92,11 @@ public function getMenuData($options = array()) {
$this->Page->alias . '.room_id',
$this->Page->alias . '.root_id',
$this->Page->alias . '.parent_id',
- $this->Page->alias . '.lft',
- $this->Page->alias . '.rght',
+ //$this->Page->alias . '.lft',
+ //$this->Page->alias . '.rght',
+ $this->Page->alias . '.weight',
+ $this->Page->alias . '.sort_key',
+ $this->Page->alias . '.child_count',
$this->Page->alias . '.permalink',
$this->PagesLanguage->alias . '.page_id',
$this->PagesLanguage->alias . '.name',
@@ -155,7 +158,8 @@ public function getMenuData($options = array()) {
),
),
'order' => array(
- $this->Page->alias . '.lft' => 'asc',
+ //$this->Page->alias . '.lft' => 'asc',
+ $this->Page->alias . '.sort_key' => 'asc',
)
), $options, ['conditions' => $pageLangConditions]);
diff --git a/Model/MenuFramesRoom.php b/Model/MenuFramesRoom.php
index f919477..ef9a52b 100644
--- a/Model/MenuFramesRoom.php
+++ b/Model/MenuFramesRoom.php
@@ -186,7 +186,8 @@ private function __getDefaultQueryOptions() {
),
),
'order' => array(
- $this->Room->alias . '.lft' => 'asc',
+ //$this->Room->alias . '.lft' => 'asc',
+ $this->Room->alias . '.sort_key' => 'asc',
)
);
}
diff --git a/README.md b/README.md
index 03e4ea0..02f036e 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,6 @@
-Menus
+Menus
=====
-Menus for NetCommons3
-
-[](https://travis-ci.org/NetCommons3/Menus)
-[](https://coveralls.io/r/NetCommons3/Menus?branch=master)
-
-| dependencies | status |
-| ------------ | ------ |
-| composer.json | [](https://www.versioneye.com/user/projects/53e35a2de0a229603f00006f) |
+[](https://github.com/NetCommons3/Menus/actions/workflows/tests.yml)
+[](https://coveralls.io/r/NetCommons3/Menus?branch=master)
+[](https://packagist.org/packages/netcommons/menus)
diff --git a/Test/Case/Model/MenuFrameSetting/GetMenuFrameSettingTest.php b/Test/Case/Model/MenuFrameSetting/GetMenuFrameSettingTest.php
index 12c3e7c..344b248 100644
--- a/Test/Case/Model/MenuFrameSetting/GetMenuFrameSettingTest.php
+++ b/Test/Case/Model/MenuFrameSetting/GetMenuFrameSettingTest.php
@@ -66,6 +66,7 @@ public function dataProvider() {
'id' => '2',
'frame_key' => 'frame_2',
'display_type' => 'major',
+ 'is_private_room_hidden' => null,
'created_user' => null,
'created' => null,
'modified_user' => null,
@@ -74,6 +75,7 @@ public function dataProvider() {
array('frameKey' => 'frame_8', 'expected' => array(
'frame_key' => 'frame_8',
'display_type' => 'major',
+ 'is_private_room_hidden' => null,
'created_user' => null,
'created' => null,
'modified_user' => null,
diff --git a/Test/Case/Model/MenuFrameSetting/SaveMenuFrameSettingTest.php b/Test/Case/Model/MenuFrameSetting/SaveMenuFrameSettingTest.php
index f45155d..ca34f35 100644
--- a/Test/Case/Model/MenuFrameSetting/SaveMenuFrameSettingTest.php
+++ b/Test/Case/Model/MenuFrameSetting/SaveMenuFrameSettingTest.php
@@ -63,6 +63,7 @@ private function __data() {
'id' => '3',
'frame_key' => 'frame_3',
'display_type' => 'major',
+ 'is_private_room_hidden' => null,
),
);
diff --git a/Test/Case/Model/MenuFrameSetting/SaveTest.php b/Test/Case/Model/MenuFrameSetting/SaveTest.php
index 59f2aab..c93246c 100644
--- a/Test/Case/Model/MenuFrameSetting/SaveTest.php
+++ b/Test/Case/Model/MenuFrameSetting/SaveTest.php
@@ -63,6 +63,7 @@ private function __data() {
'id' => '3',
'frame_key' => 'frame_3',
'display_type' => 'major',
+ 'is_private_room_hidden' => null,
),
'Menus' => array(
1 => array(
diff --git a/Test/Case/View/Elements/Menus/footer/IndexTest.php b/Test/Case/View/Elements/Menus/footer/IndexTest.php
index f52280f..d913b0d 100644
--- a/Test/Case/View/Elements/Menus/footer/IndexTest.php
+++ b/Test/Case/View/Elements/Menus/footer/IndexTest.php
@@ -64,8 +64,6 @@ public function setUp() {
*/
public function testIndex() {
$frameId = '4';
- Current::write('Page.id', '4');
- Current::write('Page.permalink', 'home');
//テスト実行
$this->_testGetAction('/test_menus/test_view_elements_menus_footer_index/index?frame_id=' . $frameId,
diff --git a/Test/Case/View/Elements/Menus/header/IndexTest.php b/Test/Case/View/Elements/Menus/header/IndexTest.php
index bb91eff..6f34703 100644
--- a/Test/Case/View/Elements/Menus/header/IndexTest.php
+++ b/Test/Case/View/Elements/Menus/header/IndexTest.php
@@ -64,8 +64,6 @@ public function setUp() {
*/
public function testIndex() {
$frameId = '1';
- Current::write('Page.id', '4');
- Current::write('Page.permalink', 'home');
//テスト実行
$this->_testGetAction('/test_menus/test_view_elements_menus_header_index/index?frame_id=' . $frameId,
@@ -108,7 +106,7 @@ private function __assertLink($frameId, $pageId, $permalink, $active, $name, $ha
'<\/li>';
} elseif ($hasDropMark) {
$pattern =
- '
' .
+ '' .
'' .
'' . $name . '<\/span> <\/span>' .
'<\/a>' .
diff --git a/Test/Case/View/Elements/Menus/major/IndexTest.php b/Test/Case/View/Elements/Menus/major/IndexTest.php
index 7a5e99d..e1c23d5 100644
--- a/Test/Case/View/Elements/Menus/major/IndexTest.php
+++ b/Test/Case/View/Elements/Menus/major/IndexTest.php
@@ -64,8 +64,6 @@ public function setUp() {
*/
public function testIndex() {
$frameId = '2';
- Current::write('Page.id', '4');
- Current::write('Page.permalink', 'home');
//テスト実行
$this->_testGetAction('/test_menus/test_view_elements_menus_major_index/index?frame_id=' . $frameId,
diff --git a/Test/Case/View/Elements/Menus/minor/IndexTest.php b/Test/Case/View/Elements/Menus/minor/IndexTest.php
index 1c4042b..06c8ebe 100644
--- a/Test/Case/View/Elements/Menus/minor/IndexTest.php
+++ b/Test/Case/View/Elements/Menus/minor/IndexTest.php
@@ -64,8 +64,6 @@ public function setUp() {
*/
public function testIndex() {
$frameId = '3';
- Current::write('Page.id', '9');
- Current::write('Page.permalink', 'page_1');
//テスト実行
$this->_testGetAction('/test_menus/test_view_elements_menus_minor_index/index?frame_id=' . $frameId,
diff --git a/Test/Case/View/Helper/MenuFormHelper/BeforeRenderTest.php b/Test/Case/View/Helper/MenuFormHelper/BeforeRenderTest.php
index fbf380f..516d9f6 100644
--- a/Test/Case/View/Helper/MenuFormHelper/BeforeRenderTest.php
+++ b/Test/Case/View/Helper/MenuFormHelper/BeforeRenderTest.php
@@ -62,12 +62,8 @@ public function testBeforeRender() {
$pattern = '/' . preg_quote('View/Helper/TestMenuFormHelperBeforeRender', '/') . '/';
$this->assertRegExp($pattern, $this->view);
- //cssのURLチェック
- $pattern = '//';
- $this->assertRegExp($pattern, $this->contents);
-
//scriptのURLチェック
- $pattern = '//';
+ $pattern = '//';
$this->assertRegExp($pattern, $this->contents);
}
diff --git a/Test/Case/View/Helper/MenuFormHelper/CheckboxMenuFramesPageTest.php b/Test/Case/View/Helper/MenuFormHelper/CheckboxMenuFramesPageTest.php
index 8cfc2ef..19ee9aa 100644
--- a/Test/Case/View/Helper/MenuFormHelper/CheckboxMenuFramesPageTest.php
+++ b/Test/Case/View/Helper/MenuFormHelper/CheckboxMenuFramesPageTest.php
@@ -188,8 +188,9 @@ public function testCheckboxMenuFramesPage($room, $menu, $pageTreeList, $nest, $
$this->assertInput('input',
'data[Menus][1][' . $pageId . '][MenuFramesPage][is_hidden]', '1', $result);
- $this->assertInput('input',
- 'data[Menus][1][' . $pageId . '][MenuFramesPage][folder_type]', '0', $result);
+ //$this->assertInput('input',
+ // 'data[Menus][1][' . $pageId . '][MenuFramesPage][folder_type]', '0', $result);
+ $this->assertTextNotContains('[folder_type]', $result);
}
}
diff --git a/Test/Case/View/Helper/MenuHelper/LinkTest.php b/Test/Case/View/Helper/MenuHelper/LinkTest.php
index 9d2cb36..ac04b6f 100644
--- a/Test/Case/View/Helper/MenuHelper/LinkTest.php
+++ b/Test/Case/View/Helper/MenuHelper/LinkTest.php
@@ -259,7 +259,7 @@ public function testLinkToggle() {
*/
public function testLinkWithSettingMode() {
//Helperロード
- Current::isSettingMode(true);
+ Current::setSettingMode(true);
$viewVars = $this->__getViewVars('4');
$requestData = array();
$params = array();
@@ -285,7 +285,7 @@ public function testLinkWithSettingMode() {
);
$this->assertEquals($expected, $result);
- Current::isSettingMode(false);
+ Current::setSettingMode(false);
}
}
diff --git a/Test/Fixture/MenuFrameSettingFixture.php b/Test/Fixture/MenuFrameSettingFixture.php
index 6f13ec5..e09e084 100644
--- a/Test/Fixture/MenuFrameSettingFixture.php
+++ b/Test/Fixture/MenuFrameSettingFixture.php
@@ -17,25 +17,6 @@
*/
class MenuFrameSettingFixture extends CakeTestFixture {
-/**
- * Fields
- *
- * @var array
- */
- public $fields = array(
- 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary', 'comment' => 'ID'),
- 'frame_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'フレームKey', 'charset' => 'utf8'),
- 'display_type' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'bootstrap navi type', 'charset' => 'utf8'),
- 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => '作成者'),
- 'created' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '作成日時'),
- 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => '更新者'),
- 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '更新日時'),
- 'indexes' => array(
- 'PRIMARY' => array('column' => 'id', 'unique' => 1)
- ),
- 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
- );
-
/**
* Records
*
@@ -46,27 +27,42 @@ class MenuFrameSettingFixture extends CakeTestFixture {
'id' => '1',
'frame_key' => 'frame_1',
'display_type' => 'header',
+ 'is_private_room_hidden' => null,
),
array(
'id' => '2',
'frame_key' => 'frame_2',
'display_type' => 'major',
+ 'is_private_room_hidden' => null,
),
array(
'id' => '3',
'frame_key' => 'frame_3',
'display_type' => 'major',
+ 'is_private_room_hidden' => null,
),
array(
'id' => '4',
'frame_key' => 'frame_4',
'display_type' => 'minor',
+ 'is_private_room_hidden' => null,
),
array(
'id' => '5',
'frame_key' => 'frame_5',
'display_type' => 'footer',
+ 'is_private_room_hidden' => null,
),
);
+/**
+ * Initialize the fixture.
+ *
+ * @return void
+ */
+ public function init() {
+ require_once App::pluginPath('Menus') . 'Config' . DS . 'Schema' . DS . 'schema.php';
+ $this->fields = (new MenusSchema())->tables[Inflector::tableize($this->name)];
+ parent::init();
+ }
}
diff --git a/Test/Fixture/MenuFramesPageFixture.php b/Test/Fixture/MenuFramesPageFixture.php
index bed6072..c78ae31 100644
--- a/Test/Fixture/MenuFramesPageFixture.php
+++ b/Test/Fixture/MenuFramesPageFixture.php
@@ -17,27 +17,6 @@
*/
class MenuFramesPageFixture extends CakeTestFixture {
-/**
- * Fields
- *
- * @var array
- */
- public $fields = array(
- 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
- 'frame_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- 'page_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
- 'is_hidden' => array('type' => 'boolean', 'null' => true, 'default' => null),
- 'folder_type' => array('type' => 'boolean', 'null' => true, 'default' => null),
- 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => '作成者'),
- 'created' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '作成日時'),
- 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => '更新者'),
- 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '更新日時'),
- 'indexes' => array(
- 'PRIMARY' => array('column' => 'id', 'unique' => 1)
- ),
- 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
- );
-
/**
* Records
*
@@ -53,4 +32,14 @@ class MenuFramesPageFixture extends CakeTestFixture {
),
);
+/**
+ * Initialize the fixture.
+ *
+ * @return void
+ */
+ public function init() {
+ require_once App::pluginPath('Menus') . 'Config' . DS . 'Schema' . DS . 'schema.php';
+ $this->fields = (new MenusSchema())->tables[Inflector::tableize($this->name)];
+ parent::init();
+ }
}
diff --git a/Test/Fixture/MenuFramesRoomFixture.php b/Test/Fixture/MenuFramesRoomFixture.php
index d4da9a3..e8c5437 100644
--- a/Test/Fixture/MenuFramesRoomFixture.php
+++ b/Test/Fixture/MenuFramesRoomFixture.php
@@ -17,26 +17,6 @@
*/
class MenuFramesRoomFixture extends CakeTestFixture {
-/**
- * Fields
- *
- * @var array
- */
- public $fields = array(
- 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
- 'frame_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- 'room_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
- 'is_hidden' => array('type' => 'boolean', 'null' => true, 'default' => null),
- 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => '作成者 | '),
- 'created' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '作成日時'),
- 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => '更新者 | '),
- 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '更新日時'),
- 'indexes' => array(
- 'PRIMARY' => array('column' => 'id', 'unique' => 1)
- ),
- 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
- );
-
/**
* Records
*
@@ -51,4 +31,14 @@ class MenuFramesRoomFixture extends CakeTestFixture {
),
);
+/**
+ * Initialize the fixture.
+ *
+ * @return void
+ */
+ public function init() {
+ require_once App::pluginPath('Menus') . 'Config' . DS . 'Schema' . DS . 'schema.php';
+ $this->fields = (new MenusSchema())->tables[Inflector::tableize($this->name)];
+ parent::init();
+ }
}
diff --git a/Test/Fixture/Page4menuFixture.php b/Test/Fixture/Page4menuFixture.php
index feb7a88..2d00403 100644
--- a/Test/Fixture/Page4menuFixture.php
+++ b/Test/Fixture/Page4menuFixture.php
@@ -40,63 +40,120 @@ class Page4menuFixture extends PageFixture {
public $records = array(
//パブリックスペースのページ(使われることはない)
array(
- 'id' => '1', 'room_id' => '2', 'root_id' => null, 'parent_id' => null, 'lft' => '1', 'rght' => '16',
+ 'id' => '1', 'room_id' => '2', 'root_id' => null,
+ 'parent_id' => null,
+ //'lft' => '1', 'rght' => '16',
+ 'weight' => '1',
+ 'sort_key' => '~00000001',
+ 'child_count' => '7',
'permalink' => '', 'slug' => null,
),
//パブリックスペースのホーム
array(
- 'id' => '4', 'room_id' => '2', 'root_id' => '1', 'parent_id' => '1', 'lft' => '2', 'rght' => '5',
+ 'id' => '4', 'room_id' => '2', 'root_id' => '1',
+ 'parent_id' => '1',
+ //'lft' => '2', 'rght' => '5',
+ 'weight' => '1',
+ 'sort_key' => '~00000001-00000001',
+ 'child_count' => '0',
'permalink' => 'home', 'slug' => 'home',
),
////ホーム/test4
//array(
- // 'id' => '7', 'room_id' => '2', 'root_id' => '1', 'parent_id' => '4', 'lft' => '3', 'rght' => '4',
+ // 'id' => '7', 'room_id' => '2', 'root_id' => '1',
+ // 'parent_id' => '4',
+ // 'lft' => '3', 'rght' => '4',
// 'permalink' => 'test4', 'slug' => 'test4',
//),
//パブリックスペースのtest5
array(
- 'id' => '8', 'room_id' => '2', 'root_id' => '1', 'parent_id' => '1', 'lft' => '6', 'rght' => '7',
+ 'id' => '8', 'room_id' => '2', 'root_id' => '1',
+ 'parent_id' => '1',
+ //'lft' => '6', 'rght' => '7',
+ 'weight' => '2',
+ 'sort_key' => '~00000001-00000002',
+ 'child_count' => '0',
'permalink' => 'test5', 'slug' => 'test5',
),
//page.permalink=page_1
array(
- 'id' => '9', 'room_id' => '2', 'root_id' => '1', 'parent_id' => '1', 'lft' => '8', 'rght' => '13',
+ 'id' => '9', 'room_id' => '2', 'root_id' => '1',
+ 'parent_id' => '1',
+ //'lft' => '8', 'rght' => '13',
+ 'weight' => '3',
+ 'sort_key' => '~00000001-00000003',
+ 'child_count' => '2',
'permalink' => 'page_1', 'slug' => 'page_1',
),
//page.permalink=page_1/page_3
array(
- 'id' => '11', 'room_id' => '2', 'root_id' => '1', 'parent_id' => '9', 'lft' => '9', 'rght' => '12',
+ 'id' => '11', 'room_id' => '2', 'root_id' => '1',
+ 'parent_id' => '9',
+ //'lft' => '9', 'rght' => '12',
+ 'weight' => '1',
+ 'sort_key' => '~00000001-00000003-00000001',
+ 'child_count' => '1',
'permalink' => 'page_3', 'slug' => 'page_3',
),
//page.permalink=page_1/page_3/page_6
array(
- 'id' => '12', 'room_id' => '2', 'root_id' => '1', 'parent_id' => '11', 'lft' => '10', 'rght' => '11',
+ 'id' => '12', 'room_id' => '2', 'root_id' => '1',
+ 'parent_id' => '11',
+ //'lft' => '10', 'rght' => '11',
+ 'weight' => '1',
+ 'sort_key' => '~00000001-00000003-00000001-00000001',
+ 'child_count' => '0',
'permalink' => 'page_6', 'slug' => 'page_6',
),
//page.permalink=page_2
array(
- 'id' => '10', 'room_id' => '2', 'root_id' => '1', 'parent_id' => '1', 'lft' => '14', 'rght' => '15',
+ 'id' => '10', 'room_id' => '2', 'root_id' => '1',
+ 'parent_id' => '1',
+ //'lft' => '14', 'rght' => '15',
+ 'weight' => '4',
+ 'sort_key' => '~00000001-00000004',
+ 'child_count' => '0',
'permalink' => 'page_2', 'slug' => 'page_2',
),
//プライベートスペースのページ(使われることはない)
array(
- 'id' => '2', 'room_id' => '3', 'root_id' => null, 'parent_id' => null, 'lft' => '17', 'rght' => '18',
+ 'id' => '2', 'room_id' => '3', 'root_id' => null,
+ 'parent_id' => null,
+ //'lft' => '17', 'rght' => '18',
+ 'weight' => '2',
+ 'sort_key' => '~00000002',
+ 'child_count' => '0',
'permalink' => '', 'slug' => null,
),
//グループスペースのページ(使われることはない)
array(
- 'id' => '3', 'room_id' => '4', 'root_id' => null, 'parent_id' => null, 'lft' => '19', 'rght' => '24',
+ 'id' => '3', 'room_id' => '4', 'root_id' => null,
+ 'parent_id' => null,
+ //'lft' => '19', 'rght' => '24',
+ 'weight' => '2',
+ 'sort_key' => '~00000003',
+ 'child_count' => '2',
'permalink' => '', 'slug' => null,
),
//別ルーム(room_id=4)
array(
- 'id' => '5', 'room_id' => '5', 'root_id' => '3', 'parent_id' => '3', 'lft' => '20', 'rght' => '21',
+ 'id' => '5', 'room_id' => '5', 'root_id' => '3',
+ 'parent_id' => '3',
+ //'lft' => '20', 'rght' => '21',
+ 'weight' => '1',
+ 'sort_key' => '~00000003-00000001',
+ 'child_count' => '0',
'permalink' => 'test2', 'slug' => 'test2',
),
//別ルーム(room_id=5、ブロックなし)
array(
- 'id' => '6', 'room_id' => '6', 'root_id' => '3', 'parent_id' => '3', 'lft' => '22', 'rght' => '23',
+ 'id' => '6', 'room_id' => '6', 'root_id' => '3',
+ 'parent_id' => '3',
+ //'lft' => '22', 'rght' => '23',
+ 'weight' => '2',
+ 'sort_key' => '~00000003-00000002',
+ 'child_count' => '0',
'permalink' => 'test3', 'slug' => 'test3',
),
);
diff --git a/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusFooterIndexController.php b/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusFooterIndexController.php
index 0b92768..7becbb1 100644
--- a/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusFooterIndexController.php
+++ b/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusFooterIndexController.php
@@ -10,6 +10,7 @@
*/
App::uses('MenusController', 'Menus.Controller');
+App::uses('Container', 'Containers.Model');
/**
* View/Elements/Menus/footer/indexテスト用Controller
@@ -39,6 +40,13 @@ class TestViewElementsMenusFooterIndexController extends MenusController {
*/
public function index() {
$this->autoRender = true;
+
+ Current::write('Frame.id', $this->request->query['frame_id']);
+ Current::write('Frame.header_type', 'default');
+ Current::write('Frame.plugin_key', 'menus');
+ Current::write('Page.id', '4');
+ Current::write('PageContainer.container_type', Container::TYPE_FOOTER);
+
parent::index();
}
diff --git a/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusHeaderIndexController.php b/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusHeaderIndexController.php
index 7994d99..8e25aad 100644
--- a/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusHeaderIndexController.php
+++ b/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusHeaderIndexController.php
@@ -41,6 +41,12 @@ public function index() {
$this->request->params['plugin'] = 'menus';
$this->request->params['controller'] = 'menus';
$this->autoRender = true;
+
+ Current::write('Frame.id', $this->request->query['frame_id']);
+ Current::write('Frame.header_type', 'default');
+ Current::write('Frame.plugin_key', 'menus');
+ Current::write('Page.id', '4');
+
parent::index();
}
diff --git a/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusMajorIndexController.php b/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusMajorIndexController.php
index a2b939e..c6d7183 100644
--- a/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusMajorIndexController.php
+++ b/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusMajorIndexController.php
@@ -39,6 +39,12 @@ class TestViewElementsMenusMajorIndexController extends MenusController {
*/
public function index() {
$this->autoRender = true;
+
+ Current::write('Frame.id', $this->request->query['frame_id']);
+ Current::write('Frame.header_type', 'default');
+ Current::write('Frame.plugin_key', 'menus');
+ Current::write('Page.id', '4');
+
parent::index();
}
diff --git a/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusMinorIndexController.php b/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusMinorIndexController.php
index a53e8a2..9f3329a 100644
--- a/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusMinorIndexController.php
+++ b/Test/test_app/Plugin/TestMenus/Controller/TestViewElementsMenusMinorIndexController.php
@@ -10,6 +10,7 @@
*/
App::uses('MenusController', 'Menus.Controller');
+App::uses('Container', 'Containers.Model');
/**
* View/Elements/Menus/minor/indexテスト用Controller
@@ -41,6 +42,13 @@ public function index() {
$this->request->params['plugin'] = 'menus';
$this->request->params['controller'] = 'menus';
$this->autoRender = true;
+
+ Current::write('Frame.id', $this->request->query['frame_id']);
+ Current::write('Frame.header_type', 'default');
+ Current::write('Frame.plugin_key', 'menus');
+ Current::write('Page.id', '9');
+ Current::write('PageContainer.container_type', Container::TYPE_MINOR);
+
parent::index();
}
diff --git a/VERSION.txt b/VERSION.txt
new file mode 100644
index 0000000..86fb650
--- /dev/null
+++ b/VERSION.txt
@@ -0,0 +1 @@
+3.3.7
diff --git a/View/Elements/Menus/header/list_start.ctp b/View/Elements/Menus/header/list_start.ctp
index 8b799de..d60b46b 100644
--- a/View/Elements/Menus/header/list_start.ctp
+++ b/View/Elements/Menus/header/list_start.ctp
@@ -14,13 +14,13 @@ if ($nest === 0) {
$linkClick = 'linkClick(\'' . $this->Menu->getLinkDomId('header', $pageId) . '\')';
if ($isActive || $isRootActive) {
if ($hasChild) {
- $listTagStart = '';
+ $listTagStart = '';
} else {
$listTagStart = '';
}
} else {
if ($hasChild) {
- $listTagStart = '';
+ $listTagStart = '';
} else {
$listTagStart = '';
}
diff --git a/View/Helper/MenuFormHelper.php b/View/Helper/MenuFormHelper.php
index 6c046a5..285a382 100644
--- a/View/Helper/MenuFormHelper.php
+++ b/View/Helper/MenuFormHelper.php
@@ -76,7 +76,7 @@ public function checkboxMenuFramesRoom($roomId, $room, $pageId) {
'div' => false,
'value' => '0',
'hiddenField' => '1',
- 'checked' => ! isset($this->_View->request->data[$prefixInput][$isHidden]),
+ 'checked' => ! Hash::get($this->_View->request->data, $prefixInput . '.' . $isHidden, false),
'ng-click' => 'disableChildPages($event, ' . json_encode($domChildPageIds) . ')',
));
$name = '';
@@ -117,7 +117,7 @@ public function checkboxMenuFramesPage($roomId, $room, $pageId, $menu, $rootRoom
}
list($roomPrefixInput, $roomIsHidden, ) = $this->_getRoomPrefix($rootRoomId, $rootRoom);
- $roomDisabled = isset($this->_View->request->data[$roomPrefixInput][$roomIsHidden]);
+ $roomDisabled = Hash::get($this->_View->request->data, $roomPrefixInput)[$roomIsHidden] ?? null;
$prefixInput = 'Menus.' . $roomId . '.' . $pageId . '.MenuFramesPage';
@@ -142,7 +142,8 @@ public function checkboxMenuFramesPage($roomId, $room, $pageId, $menu, $rootRoom
'prefixInput' => $prefixInput,
'pageId' => $pageId,
'nest' => $nest,
- 'displayWhenClicking' => $menu['Page']['lft'] + 1 !== (int)$menu['Page']['rght'],
+ //'displayWhenClicking' => $menu['Page']['lft'] + 1 !== (int)$menu['Page']['rght'],
+ 'displayWhenClicking' => (bool)$menu['Page']['child_count'],
'domChildPageIds' => $domChildPageIds,
'roomDisabled' => $roomDisabled,
'pageNameCss' => $this->_getPageNameCss($room, $pageId),
@@ -191,6 +192,17 @@ protected function _getRoomPrefix($roomId, $room) {
$pageIdTop = Space::getPageIdSpace(Space::PUBLIC_SPACE_ID);
}
+ $prefixInput = 'MenuRooms.' . $roomId . '.MenuFramesRoom';
+ $html .= $this->NetCommonsForm->hidden($prefixInput . '.id');
+ $html .= $this->NetCommonsForm->hidden($prefixInput . '.frame_key',
+ array('value' => $this->_View->request->data['Frame']['key']));
+ $html .= $this->NetCommonsForm->hidden(
+ $prefixInput . '.page_id_top', array('value' => $pageIdTop)
+ );
+ $html .= $this->NetCommonsForm->hidden(
+ $prefixInput . '.room_id', array('value' => $roomId)
+ );
+
$prefixInput = 'Menus.' . $roomId . '.' . $pageIdTop . '.MenuFramesPage';
$isFidden = 'is_hidden';
diff --git a/View/Helper/MenuHelper.php b/View/Helper/MenuHelper.php
index 3c1f144..018b53b 100644
--- a/View/Helper/MenuHelper.php
+++ b/View/Helper/MenuHelper.php
@@ -84,7 +84,8 @@ public function renderParent($displayType = null) {
$parentPageIds[] = $parentPage['Page']['id'];
}
$childPages = $this->_View->viewVars['pages'][1]['ChildPage'];
- $childPages = Hash::sort($childPages, '{n}.lft', 'asc');
+ //$childPages = Hash::sort($childPages, '{n}.lft', 'asc');
+ $childPages = Hash::sort($childPages, '{n}.sort_key', 'asc');
$parentPageIds = array_merge([$childPages[0]['id']], $parentPageIds);
$parentPageIds = array_unique($parentPageIds);
@@ -318,7 +319,7 @@ protected function _displayPage($pageId, $menu) {
* @return bool
*/
public function isActive($page) {
- return Current::read('Page.permalink') === (string)$page['Page']['permalink'];
+ return Current::read('Page.id') === (string)$page['Page']['id'];
}
/**
@@ -390,7 +391,6 @@ protected function _getIndent($treePageId, $page) {
if ($page['Page']['root_id'] === Page::PUBLIC_ROOT_PAGE_ID) {
$indent--;
}
-
return $indent;
}
diff --git a/View/MenuFrameSettings/edit.ctp b/View/MenuFrameSettings/edit.ctp
index 0bc8ac8..334dd1d 100644
--- a/View/MenuFrameSettings/edit.ctp
+++ b/View/MenuFrameSettings/edit.ctp
@@ -1,6 +1,6 @@
* @author Shohei Nakajima
@@ -15,7 +15,7 @@
- element('MenuFrameSettings/edit_form'); ?>
+ element('Menus.MenuFrameSettings/edit_form'); ?>
diff --git a/View/Menus/index.ctp b/View/Menus/index.ctp
index 25ec9cf..8146601 100644
--- a/View/Menus/index.ctp
+++ b/View/Menus/index.ctp
@@ -10,8 +10,9 @@
* @copyright Copyright 2014, NetCommons Project
*/
?>
-
-
-
+';
+ echo $this->Menu->renderMain();
+ echo '';
+}
\ No newline at end of file
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 524bb93..6ba8a27 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,5 +1,8 @@
+
+
+
app/Plugin/Menus
@@ -14,6 +17,6 @@
-
+