From a78d11345b277b6e5764b974e30d94c2d5f29101 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 25 Jul 2014 15:58:44 +0200 Subject: [PATCH] Adjust createbackend-action to suit the new backend form interface refs #5525 --- .../controllers/ConfigController.php | 19 +++++++++---------- .../views/scripts/config/createbackend.phtml | 2 ++ 2 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 modules/monitoring/application/views/scripts/config/createbackend.phtml diff --git a/modules/monitoring/application/controllers/ConfigController.php b/modules/monitoring/application/controllers/ConfigController.php index 2e01709e6..c8f2780bc 100644 --- a/modules/monitoring/application/controllers/ConfigController.php +++ b/modules/monitoring/application/controllers/ConfigController.php @@ -84,22 +84,21 @@ class Monitoring_ConfigController extends ModuleActionController */ public function createbackendAction() { - $form = new CreateBackendForm(); - $form->setRequest($this->getRequest()); - if ($form->isSubmittedAndValid()) { - $configArray = $this->Config('backends')->toArray(); - $configArray[$form->getBackendName()] = $form->getConfig(); - - if ($this->writeConfiguration(new Zend_Config($configArray), 'backends')) { - Notification::success('Backend Creation Succeeded'); + $form = new BackendForm(); + $request = $this->getRequest(); + if ($request->isPost() && $form->isValid($request->getPost())) { + list($name, $config) = $form->getBackendConfig(); + $backendsConfig = $this->Config('backends')->toArray(); + $backendsConfig[$name] = $config; + if ($this->writeConfiguration($backendsConfig, 'backends')) { + Notification::success(sprintf($this->translate('Backend "%s" created successfully.'), $name)); $this->redirectNow('monitoring/config'); } else { $this->render('show-configuration'); } - return; } + $this->view->form = $form; - $this->render('editbackend'); } /** diff --git a/modules/monitoring/application/views/scripts/config/createbackend.phtml b/modules/monitoring/application/views/scripts/config/createbackend.phtml new file mode 100644 index 000000000..0ef51cd6a --- /dev/null +++ b/modules/monitoring/application/views/scripts/config/createbackend.phtml @@ -0,0 +1,2 @@ +

translate('Add New Backend'); ?>

+ \ No newline at end of file