From b90c93ebdca2ad430b7478a1317d9f5e3a628ca4 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 3 Aug 2015 13:42:19 +0200 Subject: [PATCH] Command templates and more --- application/controllers/CommandController.php | 34 +++++++++++++++++++ .../CommandtemplatesController.php | 7 ++++ .../views/scripts/command/arguments.phtml | 11 ++++++ .../Web/Controller/ObjectsController.php | 3 -- 4 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 application/controllers/CommandtemplatesController.php create mode 100644 application/views/scripts/command/arguments.phtml diff --git a/application/controllers/CommandController.php b/application/controllers/CommandController.php index 5295fea9..7ee45f1d 100644 --- a/application/controllers/CommandController.php +++ b/application/controllers/CommandController.php @@ -2,6 +2,40 @@ use Icinga\Module\Director\Web\Controller\ObjectController; +use Icinga\Data\Filter\Filter; + class Director_CommandController extends ObjectController { + public function init() + { + parent::init(); + if ($this->object) { + $this->getTabs()->add('arguments', array( + 'url' => 'director/command/arguments', + 'urlParams' => array('name' => $this->object->object_name), + 'label' => 'Arguments' + )); + } + } + + public function argumentsAction() + { + $this->getTabs()->activate('arguments'); + $this->view->title = $this->translate('Command arguments'); + + $this->view->table = $this + ->loadTable('icingaCommandArgument') + ->setCommandObject($this->object) + ->setFilter(Filter::where('command', $this->params->get('name'))); + + $form = $this->view->form = $this + ->loadForm('icingaCommandArgument') + ->setCommandObject($this->object); + + if ($id = $this->params->shift('argument_id')) { + $form->loadObject($id); + } + + $form->handleRequest(); + } } diff --git a/application/controllers/CommandtemplatesController.php b/application/controllers/CommandtemplatesController.php new file mode 100644 index 00000000..d3982346 --- /dev/null +++ b/application/controllers/CommandtemplatesController.php @@ -0,0 +1,7 @@ + +tabs ?> +

escape($this->title) ?>

+ +addLink ?> + + +
+form ?> +table->render() ?> +
diff --git a/library/Director/Web/Controller/ObjectsController.php b/library/Director/Web/Controller/ObjectsController.php index 7b3e364e..df42b8c9 100644 --- a/library/Director/Web/Controller/ObjectsController.php +++ b/library/Director/Web/Controller/ObjectsController.php @@ -7,8 +7,6 @@ abstract class ObjectsController extends ActionController protected $dummy; protected $globalTypes = array( - 'Command', - 'CommandArgument', 'TimePeriod', 'Zone', 'Endpoint' @@ -34,7 +32,6 @@ abstract class ObjectsController extends ActionController return; } - $object = $this->dummyObject(); if ($object->isGroup()) { $type = substr($type, 0, -5);