From f1e1296f0b7802d8fd791e06eeeee5098b391acb Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Jul 2011 21:31:54 +0100 Subject: [PATCH 1/7] update routing for cake 1.3 --- controllers/components/menu.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/components/menu.php b/controllers/components/menu.php index 0093498..4cf0dc4 100755 --- a/controllers/components/menu.php +++ b/controllers/components/menu.php @@ -239,7 +239,7 @@ public function constructMenu($aro) { */ public function generateRawMenus() { $Controllers = $this->getControllers(); - $cakeAdmin = Configure::read('Routing.admin'); + $cakeAdmin = Configure::read('Routing.prefixes.0'); $this->createExclusions(); //go through the controllers folder and make an array of every menu that could be used. @@ -353,7 +353,7 @@ public function filterMethods($methods, $remove = array()) { * @return mixed. Array of options or false on total exclusion **/ public function setOptions($controllerVars) { - $cakeAdmin = Configure::read('Routing.admin'); + $cakeAdmin = Configure::read('Routing.prefixes.0'); $menuOptions = isset($controllerVars['menuOptions']) ? $controllerVars['menuOptions'] : array(); $exclude = array('view', 'edit', 'delete', $cakeAdmin . '_edit', From aa92da50278f2bb063155e6c0c265d4d09c7aa21 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Jul 2011 21:46:20 +0100 Subject: [PATCH 2/7] camelize the controller for aco --- controllers/components/menu.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/components/menu.php b/controllers/components/menu.php index 4cf0dc4..f02f739 100755 --- a/controllers/components/menu.php +++ b/controllers/components/menu.php @@ -208,7 +208,7 @@ public function constructMenu($aro) { $size = count($this->rawMenus); for ($i = 0; $i < $size; $i++) { $item = $this->rawMenus[$i]; - $aco = Inflector::underscore($item['url']['controller']); + $aco = Inflector::camelize($item['url']['controller']); if (isset($item['url']['action'])) { $aco = $this->aclPath . $aco . $this->aclSeparator . $item['url']['action']; } @@ -416,8 +416,8 @@ public function addMenu($menu) { * BeforeRender Callback. * */ - public function beforeRender() { - $this->Controller->set('menu', $this->menu); + public function beforeRender($controller) { + $controller->set('menu', $this->menu); } /** From 7900f4966fc0c292512d59dc6efc4be3dcf73ee7 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Jul 2011 21:47:55 +0100 Subject: [PATCH 3/7] update tests --- tests/cases/components/menu.test.php | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/cases/components/menu.test.php b/tests/cases/components/menu.test.php index 7f14c43..b4a35ff 100755 --- a/tests/cases/components/menu.test.php +++ b/tests/cases/components/menu.test.php @@ -13,7 +13,7 @@ * @author Mark Story * @license http://www.opensource.org/licenses/mit-license.php The MIT License */ -App::import('Component', array('AclMenu.Menu', 'Acl', 'Auth')); +App::import('Component', array('AclMenu.Menu', 'Acl', 'Auth', 'Session')); App::import('Controller', 'AppController'); class TestMenuComponent extends MenuComponent { @@ -58,6 +58,19 @@ function admin_action(){} } Mock::generate('AclComponent', 'MenuTestMockAclComponent'); + + + + Cache::config('my_test_key', array( + 'engine' => 'File', + 'duration'=> '+1 day', + 'probability'=> 100, + 'path' => CACHE . 'menu', + 'prefix' => 'cake_', + 'lock' => false, + 'serialize' => true) + ); + /** * Menu Component Test Case * @@ -76,8 +89,10 @@ function startTest() { $this->Controller = new TestMenuController(); $this->Menu->Acl = new MenuTestMockAclComponent(); $this->Menu->Auth = new AuthComponent(); - $this->_admin = Configure::read('Routing.admin'); - Configure::write('Routing.admin', 'admin'); + $this->Menu->Auth->Session = new SessionComponent(); + $this->_admin = Configure::read('Routing.prefixes.0'); + Configure::write('Routing.prefixes.0', 'admin'); + $this->Menu->startup($this->Controller); } /** @@ -428,7 +443,7 @@ function testWeightSorting() { function endTest() { ClassRegistry::flush(); $this->Menu->clearCache(); - Configure::write('Routing.admin', $this->_admin); + Configure::write('Routing.prefixes.0', $this->_admin); unset($this->Menu, $this->Controller); } } From b10bbf26decc8688a6ada0ae8acc4a4a94b96efa Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Jul 2011 21:49:16 +0100 Subject: [PATCH 4/7] update readme --- README.textile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.textile b/README.textile index 4586cf7..1b42904 100644 --- a/README.textile +++ b/README.textile @@ -7,3 +7,5 @@ To use the menu once in a @acl_menu@ dir on your pluginPaths. var $components = array('AclMenu.Menu'); When checking out this repo place it into an @acl_menu@ directory in one of your plugin paths. + +updated for cake 1.3 \ No newline at end of file From c50366d3ff4a8e4c9af8eb4f20bf00c3f7e19cc6 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Jul 2011 21:58:14 +0100 Subject: [PATCH 5/7] update version in readme --- README.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.textile b/README.textile index 1b42904..30c880c 100644 --- a/README.textile +++ b/README.textile @@ -1,4 +1,4 @@ -h2. Acl Menu Plugin +h2. Acl Menu Plugin 0.2 This plugin provides a component for generating menus based off of the current user session and integrates well with the "AcoExtras Plugin":http://github.com/markstory/acl_extras/tree/master I also maintain. See "mark-story.com for additional info and usage":http://mark-story.com/posts/view/acl-menu-component From 7fd104ed4beb891208a40928867dc9212b79c568 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Jul 2011 23:14:40 +0100 Subject: [PATCH 6/7] beforeRender controller arg is passed by ref --- controllers/components/menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/components/menu.php b/controllers/components/menu.php index f02f739..f475c3b 100755 --- a/controllers/components/menu.php +++ b/controllers/components/menu.php @@ -416,7 +416,7 @@ public function addMenu($menu) { * BeforeRender Callback. * */ - public function beforeRender($controller) { + public function beforeRender(&$controller) { $controller->set('menu', $this->menu); } From 4df7a8fdb92aa2593d69989f6496ce779e64440c Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 24 Jul 2011 22:46:35 +0100 Subject: [PATCH 7/7] remove amps and use ->Controller again, thx DereuroMark --- controllers/components/menu.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/controllers/components/menu.php b/controllers/components/menu.php index f475c3b..97d4000 100755 --- a/controllers/components/menu.php +++ b/controllers/components/menu.php @@ -117,7 +117,7 @@ class MenuComponent extends Object { * * @return bool **/ - public function initialize(&$Controller, $settings) { + public function initialize($Controller, $settings) { if (!empty($settings)) { $this->_set($settings); } @@ -133,8 +133,8 @@ public function initialize(&$Controller, $settings) { * * @param Object $Controller */ - public function startup(&$Controller) { - $this->Controller =& $Controller; + public function startup($Controller) { + $this->Controller = $Controller; Cache::config($this->cacheConfig, array('engine' => 'File', 'duration' => $this->cacheTime, 'prefix' => $this->cacheKey)); @@ -416,8 +416,8 @@ public function addMenu($menu) { * BeforeRender Callback. * */ - public function beforeRender(&$controller) { - $controller->set('menu', $this->menu); + public function beforeRender() { + $this->Controller->set('menu', $this->menu); } /**