From 815139bb211085e5882dfcc01aade8dd2d6034a1 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 29 Jun 2015 11:31:35 +0200 Subject: [PATCH] List: add remaining tabs Temporarily keeping endpoint and command args, will become subitems later on --- application/controllers/ListController.php | 18 ++++------ configuration.php | 41 ++++------------------ library/Director/ActionController.php | 35 ++++++++++++++---- 3 files changed, 42 insertions(+), 52 deletions(-) diff --git a/application/controllers/ListController.php b/application/controllers/ListController.php index f0a159a7..8aa6567b 100644 --- a/application/controllers/ListController.php +++ b/application/controllers/ListController.php @@ -30,6 +30,7 @@ class Director_ListController extends ActionController public function timeperiodsAction() { + $this->setGlobalTabs()->activate('timeperiods'); $this->view->addLink = $this->view->qlink( $this->translate('Add Timeperiod'), 'director/object/timeperiod' @@ -65,6 +66,7 @@ class Director_ListController extends ActionController public function commandsAction() { + $this->setGlobalTabs()->activate('commands'); $this->view->addLink = $this->view->qlink( $this->translate('Add Command'), 'director/object/command' @@ -76,6 +78,7 @@ class Director_ListController extends ActionController public function commandargumentsAction() { + $this->setGlobalTabs()->activate('commandarguments'); $this->view->addLink = $this->view->qlink( $this->translate('Add Command Argument'), 'director/object/commandargument' @@ -87,6 +90,7 @@ class Director_ListController extends ActionController public function usersAction() { + $this->setUserTabs()->activate('users'); $this->view->addLink = $this->view->qlink( $this->translate('Add User'), 'director/object/user' @@ -98,6 +102,7 @@ class Director_ListController extends ActionController public function usergroupsAction() { + $this->setUserTabs()->activate('usergroups'); $this->view->addLink = $this->view->qlink( $this->translate('Add Usergroup'), 'director/object/usergroup' @@ -107,19 +112,9 @@ class Director_ListController extends ActionController $this->render('table'); } - public function usergroupmembersAction() - { - $this->view->addLink = $this->view->qlink( - $this->translate('Add Usergroup Member'), - 'director/object/usergroupmember' - ); - $this->view->title = $this->translate('Icinga Usergroup Members'); - $this->view->table = $this->loadTable('icingaUserGroupMember')->setConnection($this->db()); - $this->render('table'); - } - public function endpointsAction() { + $this->setGlobalTabs()->activate('endpoints'); $this->view->addLink = $this->view->qlink( $this->translate('Add Endpoint'), 'director/object/endpoint' @@ -131,6 +126,7 @@ class Director_ListController extends ActionController public function zonesAction() { + $this->setGlobalTabs()->activate('zones'); $this->view->addLink = $this->view->qlink( $this->translate('Add Zone'), 'director/object/zone' diff --git a/configuration.php b/configuration.php index 6c32a297..ec9bc8c7 100644 --- a/configuration.php +++ b/configuration.php @@ -3,41 +3,14 @@ // Sample permission: $this->providePermission('director/templates', 'Allow to modify templates'); -$section = $this->menuSection($this->translate('Icinga Director')); +$section = $this->menuSection( + $this->translate('Icinga Director') +)->setIcon('cubes'); -$section->setIcon('cubes'); - -// COMMAND -$section->add($this->translate('Commands')) - ->setUrl('director/list/commands'); -$section->add($this->translate('Command Arguments')) - ->setUrl('director/list/commandarguments'); - -// KA -$section->add($this->translate('Timeperiods')) - ->setUrl('director/list/timeperiods'); - -// HOST -$section->add($this->translate('Hosts')) - ->setUrl('director/list/hosts'); - -// SERVICE -$section->add($this->translate('Services')) - ->setUrl('director/list/services'); - -// USER -$section->add($this->translate('Users')) - ->setUrl('director/list/users'); -$section->add($this->translate('Usergroups')) - ->setUrl('director/list/usergroups'); - -// HA -$section->add($this->translate('Zones')) - ->setUrl('director/list/zones'); -$section->add($this->translate('Endpoints')) - ->setUrl('director/list/endpoints'); - -// INTERNAL +$section->add($this->translate('Global'))->setUrl('director/list/commands'); +$section->add($this->translate('Hosts'))->setUrl('director/list/hosts'); +$section->add($this->translate('Services'))->setUrl('director/list/services'); +$section->add($this->translate('Users'))->setUrl('director/list/users'); $section->add($this->translate('Config')) ->setUrl('director/list/generatedconfig') ->setPriority(902); diff --git a/library/Director/ActionController.php b/library/Director/ActionController.php index 95fa443b..e49cafb0 100644 --- a/library/Director/ActionController.php +++ b/library/Director/ActionController.php @@ -45,6 +45,27 @@ abstract class ActionController extends Controller return $this->view->tabs; } + protected function setGlobalTabs() + { + $this->view->tabs = Widget::create('tabs')->add('commands', array( + 'label' => $this->translate('Commands'), + 'url' => 'director/list/commands') + )->add('commandarguments', array( + 'label' => $this->translate('(args)'), + 'url' => 'director/list/commandarguments') + )->add('timeperiods', array( + 'label' => $this->translate('Timeperiods'), + 'url' => 'director/list/timeperiods') + )->add('zones', array( + 'label' => $this->translate('Zones'), + 'url' => 'director/list/zones') + )->add('endpoints', array( + 'label' => $this->translate('(ep)'), + 'url' => 'director/list/endpoints') + ); + return $this->view->tabs; + } + protected function setHostTabs() { $this->view->tabs = Widget::create('tabs')->add('hosts', array( @@ -69,14 +90,14 @@ abstract class ActionController extends Controller return $this->view->tabs; } - protected function setIcingaTabs() + protected function setUserTabs() { - $this->view->tabs = Widget::create('tabs')->add('services', array( - 'label' => $this->translate('Services'), - 'url' => 'director/list/services') - )->add('hosts', array( - 'label' => $this->translate('Hosts'), - 'url' => 'director/list/hosts') + $this->view->tabs = Widget::create('tabs')->add('users', array( + 'label' => $this->translate('Users'), + 'url' => 'director/list/users') + )->add('usergroups', array( + 'label' => $this->translate('Usergroups'), + 'url' => 'director/list/usergroups') ); return $this->view->tabs; }