From cb1d43dcb278e7db2d02239676b4556f37e1ed35 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sat, 17 Dec 2016 19:20:54 +0100 Subject: [PATCH] AddNodeForm: main title, skip a step when new --- application/forms/AddNodeForm.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/application/forms/AddNodeForm.php b/application/forms/AddNodeForm.php index 2610b23..726a38a 100644 --- a/application/forms/AddNodeForm.php +++ b/application/forms/AddNodeForm.php @@ -29,6 +29,19 @@ class AddNodeForm extends QuickForm public function setup() { + $view = $this->getView(); + if ($this->hasParentNode()) { + $this->addHtml( + '

' . $view->escape( + sprintf($this->translate('Add a node to %s'), $this->parent->getAlias()) + ) . '

' + ); + } else { + $this->addHtml( + '

' . $this->translate('Add a new root node') . '

' + ); + } + $type = $this->selectNodeType(); switch ($type) { case 'host': @@ -51,8 +64,6 @@ class AddNodeForm extends QuickForm protected function addNewProcess() { - $this->addHtml('

Add a new node

'); - $this->addElement('text', 'name', array( 'label' => $this->translate('Name'), 'required' => true, @@ -119,6 +130,14 @@ class AddNodeForm extends QuickForm if ($this->hasParentNode()) { $types['host'] = $this->translate('Host'); $types['service'] = $this->translate('Service'); + } elseif (! $this->hasProcesses()) { + $this->addElement('hidden', 'node_type', array( + 'ignore' => true, + 'decorators' => array('ViewHelper'), + 'value' => 'new-process' + )); + + return 'new-process'; } if ($this->hasProcesses()) {