From 91bbeb9ad5c0845a0778823bd462fe88238a2255 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 19 Aug 2018 18:21:45 +0900 Subject: [PATCH 01/33] =?UTF-8?q?NetCommonsTreeBehavior=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/MenuFramesPage.php | 10 +++++++--- Model/MenuFramesRoom.php | 3 ++- View/Helper/MenuFormHelper.php | 3 ++- View/Helper/MenuHelper.php | 3 ++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Model/MenuFramesPage.php b/Model/MenuFramesPage.php index 2611a53..f3f79f7 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 b3ed3ef..780e798 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/View/Helper/MenuFormHelper.php b/View/Helper/MenuFormHelper.php index 2dac540..98e2bab 100644 --- a/View/Helper/MenuFormHelper.php +++ b/View/Helper/MenuFormHelper.php @@ -144,7 +144,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), diff --git a/View/Helper/MenuHelper.php b/View/Helper/MenuHelper.php index b6de0d6..d19fb4e 100644 --- a/View/Helper/MenuHelper.php +++ b/View/Helper/MenuHelper.php @@ -82,7 +82,8 @@ public function renderParent($displayType = null) { $html = ''; $parentPageIds = Hash::extract($this->_View->viewVars, 'parentPages.{n}.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(array(Hash::get($childPages, '0.id')), $parentPageIds); $parentPageIds = array_unique($parentPageIds); From 86c8f98d97a522b1e7e3ebdb0d5424cee3801a9d Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Mon, 3 Sep 2018 22:15:36 +0900 Subject: [PATCH 02/33] =?UTF-8?q?phpunit=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Fixture/Page4menuFixture.php | 81 ++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 12 deletions(-) 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', ), ); From e64a39f9feb89f68af1af57438278ae5d75911af Mon Sep 17 00:00:00 2001 From: A11creATor- Date: Fri, 12 Oct 2018 11:31:02 +0000 Subject: [PATCH 03/33] =?UTF-8?q?refs=20#1353=20#1354=20=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E3=81=A7=E3=82=AF=E3=83=AA=E3=83=83=E3=82=AF?= =?UTF-8?q?=E6=99=82=E3=81=AE=E8=A1=A8=E7=A4=BA=E3=83=9C=E3=82=BF=E3=83=B3?= =?UTF-8?q?=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E9=A0=85=E7=9B=AE?= =?UTF-8?q?=E3=81=8C=E9=96=93=E9=81=95=E3=81=A3=E3=81=A6=E3=81=84=E3=82=8B?= =?UTF-8?q?=E3=80=81=E3=83=97=E3=83=AB=E3=83=80=E3=82=A6=E3=83=B3=E3=83=A1?= =?UTF-8?q?=E3=83=8B=E3=83=A5=E3=83=BC=E3=82=92=E9=96=8B=E3=81=8F=E3=81=A8?= =?UTF-8?q?=E3=81=8D=E3=83=9A=E3=83=BC=E3=82=B8=E5=85=88=E9=A0=AD=E3=81=B8?= =?UTF-8?q?=E7=A7=BB=E5=8B=95=E3=81=99=E3=82=8B=E3=81=93=E3=81=A8=E3=81=AB?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- View/Elements/Menus/header/list_start.ctp | 4 ++-- View/Helper/MenuFormHelper.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 = '
  • '; } } else { if ($hasChild) { - $listTagStart = '
  • '; } diff --git a/View/Helper/MenuFormHelper.php b/View/Helper/MenuFormHelper.php index e1b6b89..38d0198 100644 --- a/View/Helper/MenuFormHelper.php +++ b/View/Helper/MenuFormHelper.php @@ -143,7 +143,7 @@ public function checkboxMenuFramesPage($roomId, $room, $pageId, $menu, $rootRoom 'pageId' => $pageId, 'nest' => $nest, //'displayWhenClicking' => $menu['Page']['lft'] + 1 !== (int)$menu['Page']['rght'], - 'displayWhenClicking' => !(bool)$menu['Page']['child_count'], + 'displayWhenClicking' => (bool)$menu['Page']['child_count'], 'domChildPageIds' => $domChildPageIds, 'roomDisabled' => $roomDisabled, 'pageNameCss' => $this->_getPageNameCss($room, $pageId), From a8ca1c2fa704b0a7236b94543042031466ffa4ab Mon Sep 17 00:00:00 2001 From: A11creATor- Date: Fri, 12 Oct 2018 11:56:41 +0000 Subject: [PATCH 04/33] =?UTF-8?q?refs=20#1353=20#1354=20TestCode=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Case/View/Elements/Menus/header/IndexTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/Case/View/Elements/Menus/header/IndexTest.php b/Test/Case/View/Elements/Menus/header/IndexTest.php index bb91eff..a388fb1 100644 --- a/Test/Case/View/Elements/Menus/header/IndexTest.php +++ b/Test/Case/View/Elements/Menus/header/IndexTest.php @@ -108,7 +108,7 @@ private function __assertLink($frameId, $pageId, $permalink, $active, $name, $ha '<\/li>'; } elseif ($hasDropMark) { $pattern = - '