Config: Use native form title and description support where appropriate
refs #7947 refs #7976
This commit is contained in:
parent
2af83e7d72
commit
4ba281e7e8
|
@ -216,6 +216,11 @@ class ConfigController extends ActionController
|
|||
{
|
||||
$this->assertPermission('system/config/authentication');
|
||||
$form = new AuthenticationBackendConfigForm();
|
||||
$form->setTitle($this->translate('Create New Authentication Backend'));
|
||||
$form->addDescription($this->translate(
|
||||
'Create a new backend for authenticating your users. This backend'
|
||||
. ' will be added at the end of your authentication order.'
|
||||
));
|
||||
$form->setIniConfig(Config::app('authentication'));
|
||||
$form->setResourceConfig(ResourceFactory::getResourceConfigs());
|
||||
$form->setRedirectUrl('config/authentication');
|
||||
|
@ -233,6 +238,7 @@ class ConfigController extends ActionController
|
|||
{
|
||||
$this->assertPermission('system/config/authentication');
|
||||
$form = new AuthenticationBackendConfigForm();
|
||||
$form->setTitle($this->translate('Edit Backend'));
|
||||
$form->setIniConfig(Config::app('authentication'));
|
||||
$form->setResourceConfig(ResourceFactory::getResourceConfigs());
|
||||
$form->setRedirectUrl('config/authentication');
|
||||
|
@ -272,6 +278,7 @@ class ConfigController extends ActionController
|
|||
}
|
||||
}
|
||||
));
|
||||
$form->setTitle($this->translate('Remove Backend'));
|
||||
$form->setRedirectUrl('config/authentication');
|
||||
$form->handleRequest();
|
||||
|
||||
|
@ -297,6 +304,8 @@ class ConfigController extends ActionController
|
|||
{
|
||||
$this->assertPermission('system/config/resources');
|
||||
$form = new ResourceConfigForm();
|
||||
$form->setTitle($this->translate('Create A New Resource'));
|
||||
$form->addDescription($this->translate('Resources are entities that provide data to Icinga Web 2.'));
|
||||
$form->setIniConfig(Config::app('resources'));
|
||||
$form->setRedirectUrl('config/resource');
|
||||
$form->handleRequest();
|
||||
|
@ -312,6 +321,7 @@ class ConfigController extends ActionController
|
|||
{
|
||||
$this->assertPermission('system/config/resources');
|
||||
$form = new ResourceConfigForm();
|
||||
$form->setTitle($this->translate('Edit Existing Resource'));
|
||||
$form->setIniConfig(Config::app('resources'));
|
||||
$form->setRedirectUrl('config/resource');
|
||||
$form->handleRequest();
|
||||
|
@ -346,6 +356,7 @@ class ConfigController extends ActionController
|
|||
}
|
||||
}
|
||||
));
|
||||
$form->setTitle($this->translate('Remove Existing Resource'));
|
||||
$form->setRedirectUrl('config/resource');
|
||||
$form->handleRequest();
|
||||
|
||||
|
@ -354,7 +365,7 @@ class ConfigController extends ActionController
|
|||
$authConfig = Config::app('authentication');
|
||||
foreach ($authConfig as $backendName => $config) {
|
||||
if ($config->get('resource') === $resource) {
|
||||
$form->addError(sprintf(
|
||||
$form->addDescription(sprintf(
|
||||
$this->translate(
|
||||
'The resource "%s" is currently in use by the authentication backend "%s". ' .
|
||||
'Removing the resource can result in noone being able to log in any longer.'
|
||||
|
|
|
@ -66,6 +66,7 @@ class DashboardController extends ActionController
|
|||
Notification::success(t('Dashlet created'));
|
||||
return true;
|
||||
});
|
||||
$form->setTitle($this->translate('Add Dashlet To Dashboard'));
|
||||
$form->setRedirectUrl('dashboard');
|
||||
$form->handleRequest();
|
||||
$this->view->form = $form;
|
||||
|
@ -128,6 +129,7 @@ class DashboardController extends ActionController
|
|||
Notification::success(t('Dashlet updated'));
|
||||
return true;
|
||||
});
|
||||
$form->setTitle($this->translate('Edit Dashlet'));
|
||||
$form->setRedirectUrl('dashboard/settings');
|
||||
$form->handleRequest();
|
||||
$pane = $dashboard->getPane($this->getParam('pane'));
|
||||
|
@ -176,6 +178,7 @@ class DashboardController extends ActionController
|
|||
}
|
||||
return false;
|
||||
});
|
||||
$form->setTitle($this->translate('Remove Dashlet From Dashboard'));
|
||||
$form->setRedirectUrl('dashboard/settings');
|
||||
$form->handleRequest();
|
||||
$this->view->pane = $pane;
|
||||
|
@ -215,6 +218,7 @@ class DashboardController extends ActionController
|
|||
}
|
||||
return false;
|
||||
});
|
||||
$form->setTitle($this->translate('Remove Dashboard'));
|
||||
$form->setRedirectUrl('dashboard/settings');
|
||||
$form->handleRequest();
|
||||
$this->view->pane = $pane;
|
||||
|
|
|
@ -86,6 +86,7 @@ class RolesController extends ActionController
|
|||
}
|
||||
));
|
||||
$role
|
||||
->setTitle($this->translate('New Role'))
|
||||
->setSubmitLabel($this->translate('Create Role'))
|
||||
->setIniConfig(Config::app('roles', true))
|
||||
->setRedirectUrl('roles')
|
||||
|
@ -108,6 +109,7 @@ class RolesController extends ActionController
|
|||
);
|
||||
}
|
||||
$role = new RoleForm();
|
||||
$role->setTitle(sprintf($this->translate('Update Role %s'), $name));
|
||||
$role->setSubmitLabel($this->translate('Update Role'));
|
||||
try {
|
||||
$role
|
||||
|
@ -138,7 +140,6 @@ class RolesController extends ActionController
|
|||
})
|
||||
->setRedirectUrl('roles')
|
||||
->handleRequest();
|
||||
$this->view->name = $name;
|
||||
$this->view->form = $role;
|
||||
}
|
||||
|
||||
|
@ -183,10 +184,10 @@ class RolesController extends ActionController
|
|||
}
|
||||
));
|
||||
$confirmation
|
||||
->setTitle(sprintf($this->translate('Remove Role %s'), $name))
|
||||
->setSubmitLabel($this->translate('Remove Role'))
|
||||
->setRedirectUrl('roles')
|
||||
->handleRequest();
|
||||
$this->view->name = $name;
|
||||
$this->view->form = $confirmation;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ class GeneralConfigForm extends ConfigForm
|
|||
{
|
||||
$this->setName('form_config_general');
|
||||
$this->setSubmitLabel($this->translate('Save Changes'));
|
||||
$this->setTitle($this->translate('General Configuration'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,6 +40,7 @@ class PreferenceForm extends Form
|
|||
public function init()
|
||||
{
|
||||
$this->setName('form_config_preferences');
|
||||
$this->setTitle($this->translate('Preferences'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
<?= $this->tabs->render($this); ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1 tabindex="-1" id="application-configuration">
|
||||
<?= $this->translate('General Configuration'); ?>
|
||||
</h1>
|
||||
<?php if (isset($this->messageBox)): ?>
|
||||
<?= $this->messageBox->render() ?>
|
||||
<?php endif ?>
|
||||
|
|
|
@ -2,15 +2,5 @@
|
|||
<?= $this->tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1 tabindex="-1" id="authentication-create">
|
||||
<?= $this->translate('Create New Authentication Backend'); ?>
|
||||
</h1>
|
||||
<p>
|
||||
<?= $this->translate(
|
||||
'Create a new backend for authenticating your users. This backend will be added at the end of your authentication order.'
|
||||
); ?>
|
||||
</p>
|
||||
<div>
|
||||
<?= $form; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?= $form; ?>
|
||||
</div>
|
|
@ -2,10 +2,5 @@
|
|||
<?= $this->tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1 tabindex="-1" id="authentication-modify">
|
||||
<?= $this->translate('Edit Backend'); ?>
|
||||
</h1>
|
||||
<div>
|
||||
<?= $form; ?>
|
||||
</div>
|
||||
<?= $form; ?>
|
||||
</div>
|
||||
|
|
|
@ -2,10 +2,5 @@
|
|||
<?= $this->tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1 tabindex="-1" id="authentication-remove">
|
||||
<?= $this->translate('Remove Backend'); ?>
|
||||
</h1>
|
||||
<div>
|
||||
<?= $form; ?>
|
||||
</div>
|
||||
<?= $form; ?>
|
||||
</div>
|
|
@ -2,11 +2,5 @@
|
|||
<?= $this->tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1 tabindex="-1" id="resource-create">
|
||||
<?= $this->translate('Create A New Resource'); ?>
|
||||
</h1>
|
||||
<p><?= $this->translate('Resources are entities that provide data to Icinga Web 2.'); ?></p>
|
||||
<div>
|
||||
<?= $form; ?>
|
||||
</div>
|
||||
<?= $form; ?>
|
||||
</div>
|
|
@ -2,10 +2,5 @@
|
|||
<?= $this->tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1 tabindex="-1" id="resource-edit">
|
||||
<?= $this->translate('Edit Existing Resource'); ?>
|
||||
</h1>
|
||||
<div>
|
||||
<?= $form; ?>
|
||||
</div>
|
||||
<?= $form; ?>
|
||||
</div>
|
|
@ -2,10 +2,5 @@
|
|||
<?= $this->tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1 tabindex="-1" id="resource-remove">
|
||||
<?= $this->translate('Remove Existing Resource'); ?>
|
||||
</h1>
|
||||
<div>
|
||||
<?= $form; ?>
|
||||
</div>
|
||||
<?= $form; ?>
|
||||
</div>
|
|
@ -2,6 +2,5 @@
|
|||
<?= $this->tabs ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1><?= t('Add Dashlet To Dashboard'); ?></h1>
|
||||
<?= $this->form; ?>
|
||||
</div>
|
|
@ -1,14 +1,6 @@
|
|||
<div class="controls">
|
||||
<?= $this->tabs ?>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<h1><?= t('Remove Dashlet From Dashboard'); ?></h1>
|
||||
|
||||
<p>
|
||||
<?= $this->translate('Please confirm the removal'); ?>:
|
||||
<?= $this->pane; ?>/<?= $this->dashlet; ?>
|
||||
</p>
|
||||
|
||||
<?= $this->form; ?>
|
||||
</div>
|
|
@ -1,14 +1,6 @@
|
|||
<div class="controls">
|
||||
<?= $this->tabs ?>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<h1><?= t('Remove Dashboard'); ?></h1>
|
||||
|
||||
<p>
|
||||
<?= $this->translate('Please confirm the removal of'); ?>:
|
||||
<?= $this->pane; ?>
|
||||
</p>
|
||||
|
||||
<?= $this->form; ?>
|
||||
</div>
|
|
@ -1,8 +1,6 @@
|
|||
<div class="controls">
|
||||
<?= $this->tabs ?>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<h1><?= t('Edit Dashlet'); ?></h1>
|
||||
<?= $this->form; ?>
|
||||
</div>
|
|
@ -2,6 +2,5 @@
|
|||
<?= $tabs; ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1 tabindex="-1" id="preferences"><?= $this->translate('Preferences'); ?></h1>
|
||||
<?= $form; ?>
|
||||
</div>
|
|
@ -2,8 +2,5 @@
|
|||
<?= $tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1 tabindex="-1" id="roles-new">
|
||||
<?= $this->translate('New Role') ?>
|
||||
</h1>
|
||||
<?= $form ?>
|
||||
</div>
|
||||
</div>
|
|
@ -2,8 +2,5 @@
|
|||
<?= $tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1 tabindex="-1" id="roles-remove">
|
||||
<?= sprintf($this->translate('Remove Role %s'), $name) ?>
|
||||
</h1>
|
||||
<?= $form ?>
|
||||
</div>
|
||||
</div>
|
|
@ -2,8 +2,5 @@
|
|||
<?= $tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1 tabindex="-1" id="roles-update">
|
||||
<?= sprintf($this->translate('Update Role %s'), $name) ?>
|
||||
</h1>
|
||||
<?= $form ?>
|
||||
</div>
|
||||
</div>
|
|
@ -30,6 +30,7 @@ class Monitoring_ConfigController extends ModuleActionController
|
|||
public function editbackendAction()
|
||||
{
|
||||
$form = new BackendConfigForm();
|
||||
$form->setTitle($this->translate('Edit Existing Backend'));
|
||||
$form->setIniConfig($this->Config('backends'));
|
||||
$form->setResourceConfig(ResourceFactory::getResourceConfigs());
|
||||
$form->setRedirectUrl('monitoring/config');
|
||||
|
@ -44,6 +45,7 @@ class Monitoring_ConfigController extends ModuleActionController
|
|||
public function createbackendAction()
|
||||
{
|
||||
$form = new BackendConfigForm();
|
||||
$form->setTitle($this->translate('Add New Backend'));
|
||||
$form->setIniConfig($this->Config('backends'));
|
||||
$form->setResourceConfig(ResourceFactory::getResourceConfigs());
|
||||
$form->setRedirectUrl('monitoring/config');
|
||||
|
@ -72,12 +74,16 @@ class Monitoring_ConfigController extends ModuleActionController
|
|||
}
|
||||
|
||||
if ($configForm->save()) {
|
||||
Notification::success(sprintf(mt('monitoring', 'Backend "%s" successfully removed.'), $backendName));
|
||||
Notification::success(sprintf(
|
||||
$this->translate('Backend "%s" successfully removed.'),
|
||||
$backendName
|
||||
));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
));
|
||||
$form->setTitle($this->translate('Remove Existing Backend'));
|
||||
$form->setRedirectUrl('monitoring/config');
|
||||
$form->handleRequest();
|
||||
|
||||
|
@ -104,12 +110,31 @@ class Monitoring_ConfigController extends ModuleActionController
|
|||
}
|
||||
|
||||
if ($configForm->save()) {
|
||||
Notification::success(sprintf(mt('monitoring', 'Instance "%s" successfully removed.'), $instanceName));
|
||||
Notification::success(sprintf(
|
||||
$this->translate('Instance "%s" successfully removed.'),
|
||||
$instanceName
|
||||
));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
));
|
||||
$form->setTitle($this->translate('Remove Existing Instance'));
|
||||
$form->addDescription($this->translate(
|
||||
'If you have still any environments or views referring to this instance, '
|
||||
. 'you won\'t be able to send commands anymore after deletion.'
|
||||
));
|
||||
$form->addElement(
|
||||
'note',
|
||||
'question',
|
||||
array(
|
||||
'value' => $this->translate('Are you sure you want to remove this instance?'),
|
||||
'decorators' => array(
|
||||
'ViewHelper',
|
||||
array('HtmlTag', array('tag' => 'p'))
|
||||
)
|
||||
)
|
||||
);
|
||||
$form->setRedirectUrl('monitoring/config');
|
||||
$form->handleRequest();
|
||||
|
||||
|
@ -122,6 +147,7 @@ class Monitoring_ConfigController extends ModuleActionController
|
|||
public function editinstanceAction()
|
||||
{
|
||||
$form = new InstanceConfigForm();
|
||||
$form->setTitle($this->translate('Edit Existing Instance'));
|
||||
$form->setIniConfig($this->Config('instances'));
|
||||
$form->setRedirectUrl('monitoring/config');
|
||||
$form->handleRequest();
|
||||
|
@ -135,6 +161,7 @@ class Monitoring_ConfigController extends ModuleActionController
|
|||
public function createinstanceAction()
|
||||
{
|
||||
$form = new InstanceConfigForm();
|
||||
$form->setTitle($this->translate('Add New Instance'));
|
||||
$form->setIniConfig($this->Config('instances'));
|
||||
$form->setRedirectUrl('monitoring/config');
|
||||
$form->handleRequest();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<div class="controls">
|
||||
<?= $tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<h4><?= $this->translate('Add New Backend'); ?></h4>
|
||||
<?= $form; ?>
|
||||
<div class="content">
|
||||
<?= $form; ?>
|
||||
</div>
|
|
@ -1,5 +1,6 @@
|
|||
<div class="controls">
|
||||
<?= $tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<h4><?= $this->translate('Add New Instance') ?></h4>
|
||||
<?= $form; ?>
|
||||
<div class="content">
|
||||
<?= $form; ?>
|
||||
</div>
|
|
@ -1,5 +1,6 @@
|
|||
<div class="controls">
|
||||
<?= $tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<h4><?= $this->translate('Edit Existing Backend') ?></h4>
|
||||
<?= $form; ?>
|
||||
<div class="content">
|
||||
<?= $form; ?>
|
||||
</div>
|
|
@ -1,5 +1,6 @@
|
|||
<div class="controls">
|
||||
<?= $tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<h4><?= $this->translate('Edit Existing Instance'); ?></h4>
|
||||
<?= $form; ?>
|
||||
<div class="content">
|
||||
<?= $form; ?>
|
||||
</div>
|
|
@ -1,5 +1,6 @@
|
|||
<div class="controls">
|
||||
<?= $tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<h4><?= $this->translate('Remove Existing Backend') ?></h4>
|
||||
<?= $form; ?>
|
||||
<div class="content">
|
||||
<?= $form; ?>
|
||||
</div>
|
|
@ -1,7 +1,6 @@
|
|||
<div class="controls">
|
||||
<?= $tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<h4><?= $this->translate('Remove Existing Instance'); ?></h4>
|
||||
<p><?= $this->translate('Are you sure you want to remove this instance?'); ?></p>
|
||||
<p><?= $this->translate('If you have still any environments or views referring to this instance, you won\'t be able to send commands anymore after deletion.'); ?></p>
|
||||
<?= $form; ?>
|
||||
<div class="content">
|
||||
<?= $form; ?>
|
||||
</div>
|
Loading…
Reference in New Issue