Backend/Config: Add shortlink to resource

fixes #7493
This commit is contained in:
Marius Hein 2014-11-07 14:20:47 +01:00
parent a460286597
commit cb09c8acdc
1 changed files with 18 additions and 2 deletions

View File

@ -225,15 +225,31 @@ class BackendConfigForm extends ConfigForm
'value' => $resourceType
)
);
$this->addElement(
$resourceElement = $this->createElement(
'select',
'resource',
array(
'required' => true,
'label' => mt('monitoring', 'Resource'),
'description' => mt('monitoring', 'The resource to use'),
'multiOptions' => $this->resources[$resourceType]
'multiOptions' => $this->resources[$resourceType],
'autosubmit' => true
)
);
$resourceName = (isset($formData['resource'])) ? $formData['resource'] : $this->getValue('resource');
if ($resourceElement) {
$resourceElement->getDecorator('Description')->setEscape(false);
$link = sprintf(
'<a href="%s" data-base-target="_main">%s</a>',
$this->getView()->href('/icingaweb/config/editresource', array('resource' => $resourceName)),
mt('monitoring', 'Show resource configuration')
);
$resourceElement->setDescription($resourceElement->getDescription() . ' (' . $link . ')');
}
$this->addElement($resourceElement);
}
}