Datafield: provide better explainations

This commit is contained in:
Thomas Gelf 2016-10-17 17:48:04 +00:00
parent 8c2d5ec7f9
commit 927d59a3b3
3 changed files with 29 additions and 22 deletions

View File

@ -10,7 +10,7 @@ class DataController extends ActionController
public function listsAction()
{
$this->view->addLink = $this->view->qlink(
$this->translate('Add list'),
$this->translate('Add'),
'director/data/list',
null,
array('class' => 'icon-plus')
@ -62,7 +62,7 @@ class DataController extends ActionController
))->activate('editlist');
} else {
$this->view->title = $this->translate('Add data list');
$this->view->title = $this->translate('Add');
$this->getTabs()->add('addlist', array(
'url' => 'director/data/list',
@ -116,7 +116,7 @@ class DataController extends ActionController
public function fieldsAction()
{
$this->view->addLink = $this->view->qlink(
$this->translate('Add field'),
$this->translate('Add'),
'director/datafield/add',
null,
array('class' => 'icon-plus')

View File

@ -24,30 +24,23 @@ class DatafieldController extends ActionController
$edit = true;
}
if ($edit) {
$this->view->title = $this->translate('Edit field');
$this->getTabs()->add('editfield', array(
'url' => 'director/datafield/edit' . '?id=' . $id,
'label' => $this->view->title,
))->activate('editfield');
} else {
$this->view->title = $this->translate('Add field');
$this->getTabs()->add('addfield', array(
'url' => 'director/datafield/add',
'label' => $this->view->title,
))->activate('addfield');
}
$form = $this->view->form = $this->loadForm('directorDatafield')
->setSuccessUrl('director/data/fields')
->setDb($this->db());
if ($edit) {
$form->loadObject($id);
$this->view->title = sprintf(
$this->translate('Modify %s'),
$form->getObject()->varname
);
$this->singleTab($this->translate('Edit a field'));
} else {
$this->view->title = $this->translate('Add a new Data Field');
$this->singleTab($this->translate('New field'));
}
$form->handleRequest();
$this->render('object/form', null, true);
}
}

View File

@ -74,24 +74,38 @@ class DirectorDatafieldForm extends DirectorObjectForm
public function setup()
{
$this->addHtmlHint(
$this->translate('Data fields allow you to customize input controls your custom variables.')
$this->translate(
'Data fields allow you to customize input controls for Icinga custom'
. ' variables. Once you defined them here, you can provide them through'
. ' your defined templates. This gives you a granular control over what'
. ' properties your users should be allowed to configure in which way.'
)
);
$this->addElement('text', 'varname', array(
'label' => $this->translate('Field name'),
'description' => $this->translate('The unique name of the field'),
'description' => $this->translate(
'The unique name of the field. This will be the name of the custom'
. ' variable in the rendered Icinga configuration.'
),
'required' => true,
));
$this->addElement('text', 'caption', array(
'label' => $this->translate('Caption'),
'required' => true,
'description' => $this->translate('The caption which should be displayed')
'description' => $this->translate(
'The caption which should be displayed to your users when this field'
. ' is shown'
)
));
$this->addElement('textarea', 'description', array(
'label' => $this->translate('Description'),
'description' => $this->translate('A description about the field'),
'description' => $this->translate(
'An extended description for this field. Will be shown as soon as a'
. ' user puts the focus on this field'
),
'rows' => '3',
));