Adjust createbackend-action to suit the new backend form interface
refs #5525
This commit is contained in:
parent
02c3223a82
commit
a78d11345b
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<h4><?= $this->translate('Add New Backend'); ?></h4>
|
||||
<?= $form; ?>
|
Loading…
Reference in New Issue