Installation: Use native form title and description support where appropriate

refs #7947
refs #7976
This commit is contained in:
Johannes Meyer 2015-03-02 18:36:04 +01:00
parent d3f9bd633c
commit 2af83e7d72
18 changed files with 95 additions and 379 deletions

View File

@ -11,31 +11,14 @@ class BackendPage extends Form
public function init()
{
$this->setName('setup_monitoring_backend');
$this->setTitle($this->translate('Monitoring Backend', 'setup.page.title'));
$this->addDescription($this->translate(
'Please configure below how Icinga Web 2 should retrieve monitoring information.'
));
}
public function createElements(array $formData)
{
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('Monitoring Backend', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
$this->addElement(
'note',
'description',
array(
'value' => $this->translate(
'Please configure below how Icinga Web 2 should retrieve monitoring information.'
)
)
);
$this->addElement(
'text',
'name',

View File

@ -11,6 +11,10 @@ class IdoResourcePage extends Form
public function init()
{
$this->setName('setup_monitoring_ido');
$this->setTitle($this->translate('Monitoring IDO Resource', 'setup.page.title'));
$this->addDescription($this->translate(
'Please fill out the connection details below to access the IDO database of your monitoring environment.'
));
}
public function createElements(array $formData)
@ -23,27 +27,6 @@ class IdoResourcePage extends Form
'value' => 'db'
)
);
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('Monitoring IDO Resource', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
$this->addElement(
'note',
'description',
array(
'value' => $this->translate(
'Please fill out the connection details below to access'
. ' the IDO database of your monitoring environment.'
)
)
);
if (isset($formData['skip_validation']) && $formData['skip_validation']) {
$this->addSkipValidationCheckbox();

View File

@ -11,31 +11,14 @@ class InstancePage extends Form
public function init()
{
$this->setName('setup_monitoring_instance');
$this->setTitle($this->translate('Monitoring Instance', 'setup.page.title'));
$this->addDescription($this->translate(
'Please define the settings specific to your monitoring instance below.'
));
}
public function createElements(array $formData)
{
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('Monitoring Instance', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
$this->addElement(
'note',
'description',
array(
'value' => $this->translate(
'Please define the settings specific to your monitoring instance below.'
)
)
);
if (isset($formData['host'])) {
$formData['type'] = 'remote'; // This is necessary as the type element gets ignored by Form::getValues()
}

View File

@ -11,6 +11,11 @@ class LivestatusResourcePage extends Form
public function init()
{
$this->setName('setup_monitoring_livestatus');
$this->setTitle($this->translate('Monitoring Livestatus Resource', 'setup.page.title'));
$this->addDescription($this->translate(
'Please fill out the connection details below to access the Livestatus'
. ' socket interface for your monitoring environment.'
));
}
public function createElements(array $formData)
@ -23,27 +28,6 @@ class LivestatusResourcePage extends Form
'value' => 'livestatus'
)
);
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('Monitoring Livestatus Resource', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
$this->addElement(
'note',
'description',
array(
'value' => $this->translate(
'Please fill out the connection details below to access the Livestatus'
. ' socket interface for your monitoring environment.'
)
)
);
if (isset($formData['skip_validation']) && $formData['skip_validation']) {
$this->addSkipValidationCheckbox();

View File

@ -11,31 +11,14 @@ class SecurityPage extends Form
public function init()
{
$this->setName('setup_monitoring_security');
$this->setTitle($this->translate('Monitoring Security', 'setup.page.title'));
$this->addDescription($this->translate(
'To protect your monitoring environment against prying eyes please fill out the settings below.'
));
}
public function createElements(array $formData)
{
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('Monitoring Security', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
$this->addElement(
'note',
'description',
array(
'value' => $this->translate(
'To protect your monitoring environment against prying eyes please fill out the settings below.'
)
)
);
$securityConfigForm = new SecurityConfigForm();
$securityConfigForm->createElements($formData);
$this->addElements($securityConfigForm->getElements());

View File

@ -192,31 +192,6 @@ class AdminAccountPage extends Form
)
);
}
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('Administration', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
$this->addElement(
'note',
'description',
array(
'value' => tp(
'Now it\'s time to configure your first administrative account for Icinga Web 2.'
. ' Please follow the instructions below:',
'Now it\'s time to configure your first administrative account for Icinga Web 2.'
. ' Below are several options you can choose from. Select one and follow its instructions:',
count($choices)
)
)
);
}
/**

View File

@ -27,6 +27,7 @@ class AuthBackendPage extends Form
public function init()
{
$this->setName('setup_authentication_backend');
$this->setTitle($this->translate('Authentication Backend', 'setup.page.title'));
}
/**
@ -57,54 +58,33 @@ class AuthBackendPage extends Form
*/
public function createElements(array $formData)
{
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('Authentication Backend', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
if ($this->config['type'] === 'db') {
$note = $this->translate(
'As you\'ve chosen to use a database for authentication all you need '
. 'to do now is defining a name for your first authentication backend.'
);
} elseif ($this->config['type'] === 'ldap') {
$note = $this->translate(
'Before you are able to authenticate using the LDAP connection defined earlier you need to'
. ' provide some more information so that Icinga Web 2 is able to locate account details.'
);
} else { // if ($this->config['type'] === 'external'
$note = $this->translate(
'You\'ve chosen to authenticate using a web server\'s mechanism so it may be necessary'
. ' to adjust usernames before any permissions, restrictions, etc. are being applied.'
);
}
$this->addElement(
'note',
'description',
array('value' => $note)
);
if (isset($formData['skip_validation']) && $formData['skip_validation']) {
$this->addSkipValidationCheckbox();
}
if ($this->config['type'] === 'db') {
$this->setRequiredCue(null);
$backendForm = new DbBackendForm();
$backendForm->setRequiredCue(null);
$backendForm->createElements($formData)->removeElement('resource');
$this->addDescription($this->translate(
'As you\'ve chosen to use a database for authentication all you need '
. 'to do now is defining a name for your first authentication backend.'
));
} elseif ($this->config['type'] === 'ldap') {
$backendForm = new LdapBackendForm();
$backendForm->createElements($formData)->removeElement('resource');
$this->addDescription($this->translate(
'Before you are able to authenticate using the LDAP connection defined earlier you need to'
. ' provide some more information so that Icinga Web 2 is able to locate account details.'
));
} else { // $this->config['type'] === 'external'
$backendForm = new ExternalBackendForm();
$backendForm->createElements($formData);
$this->addDescription($this->translate(
'You\'ve chosen to authenticate using a web server\'s mechanism so it may be necessary'
. ' to adjust usernames before any permissions, restrictions, etc. are being applied.'
));
}
$this->addElements($backendForm->getElements());
@ -143,7 +123,7 @@ class AuthBackendPage extends Form
'checkbox',
'skip_validation',
array(
'order' => 2,
'order' => 0,
'ignore' => true,
'required' => true,
'label' => $this->translate('Skip Validation'),

View File

@ -16,7 +16,13 @@ class AuthenticationPage extends Form
*/
public function init()
{
$this->setRequiredCue(null);
$this->setName('setup_authentication_type');
$this->setTitle($this->translate('Authentication', 'setup.page.title'));
$this->addDescription($this->translate(
'Please choose how you want to authenticate when accessing Icinga Web 2.'
. ' Configuring backend specific details follows in a later step.'
));
}
/**
@ -24,50 +30,14 @@ class AuthenticationPage extends Form
*/
public function createElements(array $formData)
{
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('Authentication', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
if (isset($formData['type']) && $formData['type'] === 'external' && !isset($_SERVER['REMOTE_USER'])) {
$this->addElement(
'note',
'external_note',
array(
'value' => '<i aria-hidden="true" class="icon-info"></i>' . $this->translate(
'You\'re currently not authenticated using any of the web server\'s authentication '
. 'mechanisms. Make sure you\'ll configure such, otherwise you\'ll not be able to '
. 'log into Icinga Web 2.'
),
'decorators' => array(
'ViewHelper',
array(
'HtmlTag',
array('tag' => 'p', 'class' => 'info-box')
)
)
)
);
$this->addDescription($this->translate(
'You\'re currently not authenticated using any of the web server\'s authentication '
. 'mechanisms. Make sure you\'ll configure such, otherwise you\'ll not be able to '
. 'log into Icinga Web 2.'
));
}
$this->addElement(
'note',
'description',
array(
'value' => $this->translate(
'Please choose how you want to authenticate when accessing Icinga Web 2.'
. ' Configuring backend specific details follows in a later step.'
)
)
);
$backendTypes = array();
if (Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) {
$backendTypes['db'] = $this->translate('Database');

View File

@ -39,6 +39,13 @@ class DatabaseCreationPage extends Form
public function init()
{
$this->setName('setup_database_creation');
$this->setTitle($this->translate('Database Setup', 'setup.page.title'));
$this->addDescription($this->translate(
'It seems that either the database you defined earlier does not yet exist and cannot be created'
. ' using the provided access credentials, the database does not have the required schema to be'
. ' operated by Icinga Web 2 or the provided access credentials do not have the sufficient '
. 'permissions to access the database. Please provide appropriate access credentials to solve this.'
));
}
/**
@ -85,30 +92,6 @@ class DatabaseCreationPage extends Form
*/
public function createElements(array $formData)
{
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('Database Setup', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
$this->addElement(
'note',
'description',
array(
'value' => $this->translate(
'It seems that either the database you defined earlier does not yet exist and cannot be created'
. ' using the provided access credentials, the database does not have the required schema to be'
. ' operated by Icinga Web 2 or the provided access credentials do not have the sufficient '
. 'permissions to access the database. Please provide appropriate access credentials to solve this.'
)
)
);
$skipValidation = isset($formData['skip_validation']) && $formData['skip_validation'];
$this->addElement(
'text',
@ -213,7 +196,7 @@ class DatabaseCreationPage extends Form
'checkbox',
'skip_validation',
array(
'order' => 2,
'order' => 0,
'required' => true,
'label' => $this->translate('Skip Validation'),
'description' => $this->translate(

View File

@ -19,6 +19,11 @@ class DbResourcePage extends Form
public function init()
{
$this->setName('setup_db_resource');
$this->setTitle($this->translate('Database Resource', 'setup.page.title'));
$this->addDescription($this->translate(
'Now please configure your database resource. Note that the database itself does not need to'
. ' exist at this time as it is going to be created once the wizard is about to be finished.'
));
}
/**
@ -34,27 +39,6 @@ class DbResourcePage extends Form
'value' => 'db'
)
);
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('Database Resource', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
$this->addElement(
'note',
'description',
array(
'value' => $this->translate(
'Now please configure your database resource. Note that the database itself does not need to'
. ' exist at this time as it is going to be created once the wizard is about to be finished.'
)
)
);
if (isset($formData['skip_validation']) && $formData['skip_validation']) {
$this->addSkipValidationCheckbox();

View File

@ -17,6 +17,10 @@ class GeneralConfigPage extends Form
public function init()
{
$this->setName('setup_general_config');
$this->setTitle($this->translate('Application Configuration', 'setup.page.title'));
$this->addDescription($this->translate(
'Now please adjust all application and logging related configuration options to fit your needs.'
));
}
/**
@ -24,27 +28,6 @@ class GeneralConfigPage extends Form
*/
public function createElements(array $formData)
{
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('Application Configuration', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
$this->addElement(
'note',
'description',
array(
'value' => $this->translate(
'Now please adjust all application and logging related configuration options to fit your needs.'
)
)
);
$loggingForm = new LoggingConfigForm();
$this->addElements($loggingForm->createElements($formData)->getElements());
}

View File

@ -37,6 +37,7 @@ EOT;
public function init()
{
$this->setName('setup_ldap_discovery_confirm');
$this->setTitle($this->translate('LDAP Discovery Results', 'setup.page.title'));
}
/**
@ -77,27 +78,10 @@ EOT;
$html = str_replace('{user_attribute}', $backend['user_name_attribute'], $html);
$html = str_replace('{user_class}', $backend['user_class'], $html);
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('LDAP Discovery Results', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
$this->addElement(
'note',
'description',
array(
'value' => sprintf(
$this->translate('The following directory service has been found on domain "%s":'),
$this->config['domain']
)
)
);
$this->addDescription(sprintf(
$this->translate('The following directory service has been found on domain "%s".'),
$this->config['domain']
));
$this->addElement(
'note',

View File

@ -26,6 +26,11 @@ class LdapDiscoveryPage extends Form
public function init()
{
$this->setName('setup_ldap_discovery');
$this->setTitle($this->translate('LDAP Discovery', 'setup.page.title'));
$this->addDescription($this->translate(
'You can use this page to discover LDAP or ActiveDirectory servers ' .
' for authentication. If you don\' want to execute a discovery, just skip this step.'
));
}
/**
@ -33,28 +38,6 @@ class LdapDiscoveryPage extends Form
*/
public function createElements(array $formData)
{
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('LDAP Discovery', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
$this->addElement(
'note',
'description',
array(
'value' => $this->translate(
'You can use this page to discover LDAP or ActiveDirectory servers ' .
' for authentication. If you don\' want to execute a discovery, just skip this step.'
)
)
);
$discoveryForm = new LdapDiscoveryForm();
$this->addElements($discoveryForm->createElements($formData)->getElements());

View File

@ -17,6 +17,11 @@ class LdapResourcePage extends Form
public function init()
{
$this->setName('setup_ldap_resource');
$this->setTitle($this->translate('LDAP Resource', 'setup.page.title'));
$this->addDescription($this->translate(
'Now please configure your AD/LDAP resource. This will later '
. 'be used to authenticate users logging in to Icinga Web 2.'
));
}
/**
@ -32,27 +37,6 @@ class LdapResourcePage extends Form
'value' => 'ldap'
)
);
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('LDAP Resource', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
$this->addElement(
'note',
'description',
array(
'value' => $this->translate(
'Now please configure your AD/LDAP resource. This will later '
. 'be used to authenticate users logging in to Icinga Web 2.'
)
)
);
if (isset($formData['skip_validation']) && $formData['skip_validation']) {
$this->addSkipValidationCheckbox();

View File

@ -18,23 +18,8 @@ class PreferencesPage extends Form
{
$this->setRequiredCue(null);
$this->setName('setup_preferences_type');
}
/**
* Pre-select "db" as preference backend and add a hint to the select element
*
* @return self
*/
public function showDatabaseNote()
{
$this->getElement('store')
->setValue('db')
->setDescription(
$this->translate(
'Note that choosing "Database" causes Icinga Web 2 to use the same database as for authentication.'
)
);
return $this;
$this->setTitle($this->translate('Preferences', 'setup.page.title'));
$this->addDescription($this->translate('Please choose how Icinga Web 2 should store user preferences.'));
}
/**
@ -42,25 +27,6 @@ class PreferencesPage extends Form
*/
public function createElements(array $formData)
{
$this->addElement(
'note',
'title',
array(
'value' => $this->translate('Preferences', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
)
)
);
$this->addElement(
'note',
'description',
array(
'value' => $this->translate('Please choose how Icinga Web 2 should store user preferences.')
)
);
$storageTypes = array();
$storageTypes['ini'] = $this->translate('File System (INI Files)');
if (Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) {

View File

@ -6,7 +6,15 @@ $radioElem = $form->getElement('user_type');
$showRadioBoxes = strpos(strtolower(get_class($radioElem)), 'radio') !== false;
?>
<h1 class="form-title"><?= $this->translate('Administration', 'setup.page.title'); ?></h1>
<form id="<?= $form->getName(); ?>" name="<?= $form->getName(); ?>" enctype="<?= $form->getEncType(); ?>" method="<?= $form->getMethod(); ?>" action="<?= $form->getAction(); ?>">
<ul class="descriptions">
<li><?= $this->translatePlural(
'Now it\'s time to configure your first administrative account for Icinga Web 2. Please follow the instructions below:',
'Now it\'s time to configure your first administrative account for Icinga Web 2. Below are several options you can choose from. Select one and follow its instructions:',
$showRadioBoxes ? count($radioElem->getMultiOptions()) : 1
); ?></li>
</ul>
<?= $form->getElement('title'); ?>
<?= $form->getElement('description'); ?>
<?php if (($byNameElem = $form->getElement('by_name')) !== null): ?>

View File

@ -115,7 +115,11 @@ class WebWizard extends Wizard implements SetupWizard
} elseif ($page->getName() === 'setup_preferences_type') {
$authData = $this->getPageData('setup_authentication_type');
if ($authData['type'] === 'db') {
$page->create()->showDatabaseNote();
$page->create()->getElement('store')->setValue('db');
$page->addDescription(mt(
'setup',
'Note that choosing "Database" causes Icinga Web 2 to use the same database as for authentication.'
));
}
} elseif ($page->getName() === 'setup_authentication_backend') {
$authData = $this->getPageData('setup_authentication_type');

View File

@ -222,10 +222,6 @@
}
}
#setup_authentication_type p.info-box em {
text-decoration: underline;
}
#setup_ldap_discovery_confirm table {
margin: 1em 0;
border-collapse: separate;