Fix the add link to the resource configuration

refs #7493
This commit is contained in:
Alexander Fuhr 2014-11-18 18:06:36 +01:00
parent 6269f6695b
commit 268dc7e4b1
1 changed files with 19 additions and 9 deletions

View File

@ -237,18 +237,28 @@ class BackendConfigForm extends ConfigForm
)
);
if (empty($formData)) {
$options = $resourceElement->options;
$resourceName = array_shift($options);
} else {
$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);
if ($resourceElement) {
$this->addElement(
'note',
'resource_note',
array(
'value' => sprintf(
'<a href="%s" data-base-target="_main">%s</a>',
$this->getView()->href('/icingaweb/config/editresource', array('resource' => $resourceName)),
mt('monitoring', 'Show resource configuration')
),
'escape' => false
)
);
}
}
}