diff --git a/modules/monitoring/library/Monitoring/BackendStep.php b/modules/monitoring/library/Monitoring/BackendStep.php index 47264c231..28d5a3db4 100644 --- a/modules/monitoring/library/Monitoring/BackendStep.php +++ b/modules/monitoring/library/Monitoring/BackendStep.php @@ -136,28 +136,35 @@ class BackendStep extends Step public function getReport() { - $report = ''; + $report = array(); + if ($this->backendIniError === false) { - $message = mt('monitoring', 'Monitoring backend configuration has been successfully written to: %s'); - $report .= '

' . sprintf($message, Config::resolvePath('modules/monitoring/backends.ini')) . '

'; - } elseif ($this->backendIniError !== null) { - $message = mt( - 'monitoring', - 'Monitoring backend configuration could not be written to: %s; An error occured:' - ); - $report .= '

' . sprintf( - $message, + $report[] = sprintf( + mt('monitoring', 'Monitoring backend configuration has been successfully written to: %s'), Config::resolvePath('modules/monitoring/backends.ini') - ) . '

' . $this->backendIniError->getMessage() . '

'; + ); + } elseif ($this->backendIniError !== null) { + $report[] = sprintf( + mt( + 'monitoring', + 'Monitoring backend configuration could not be written to: %s. An error occured:' + ), + Config::resolvePath('modules/monitoring/backends.ini') + ); + $report[] = sprintf(mt('setup', 'ERROR: %s'), $this->backendIniError->getMessage()); } if ($this->resourcesIniError === false) { - $message = mt('monitoring', 'Resource configuration has been successfully updated: %s'); - $report .= '

' . sprintf($message, Config::resolvePath('resources.ini')) . '

'; + $report[] = sprintf( + mt('monitoring', 'Resource configuration has been successfully updated: %s'), + Config::resolvePath('resources.ini') + ); } elseif ($this->resourcesIniError !== null) { - $message = mt('monitoring', 'Resource configuration could not be udpated: %s; An error occured:'); - $report .= '

' . sprintf($message, Config::resolvePath('resources.ini')) . '

' - . '

' . $this->resourcesIniError->getMessage() . '

'; + $report[] = sprintf( + mt('monitoring', 'Resource configuration could not be udpated: %s. An error occured:'), + Config::resolvePath('resources.ini') + ); + $report[] = sprintf(mt('setup', 'ERROR: %s'), $this->resourcesIniError->getMessage()); } return $report; diff --git a/modules/monitoring/library/Monitoring/InstanceStep.php b/modules/monitoring/library/Monitoring/InstanceStep.php index cb85d695d..8e39a9bf5 100644 --- a/modules/monitoring/library/Monitoring/InstanceStep.php +++ b/modules/monitoring/library/Monitoring/InstanceStep.php @@ -85,15 +85,21 @@ class InstanceStep extends Step public function getReport() { if ($this->error === false) { - $message = mt('monitoring', 'Monitoring instance configuration has been successfully created: %s'); - return '

' . sprintf($message, Config::resolvePath('modules/monitoring/instances.ini')) . '

'; + return array(sprintf( + mt('monitoring', 'Monitoring instance configuration has been successfully created: %s'), + Config::resolvePath('modules/monitoring/instances.ini') + )); } elseif ($this->error !== null) { - $message = mt( - 'monitoring', - 'Monitoring instance configuration could not be written to: %s; An error occured:' + return array( + sprintf( + mt( + 'monitoring', + 'Monitoring instance configuration could not be written to: %s. An error occured:' + ), + Config::resolvePath('modules/monitoring/instances.ini') + ), + sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage()) ); - return '

' . sprintf($message, Config::resolvePath('modules/monitoring/instances.ini')) - . '

' . $this->error->getMessage() . '

'; } } } diff --git a/modules/monitoring/library/Monitoring/SecurityStep.php b/modules/monitoring/library/Monitoring/SecurityStep.php index b4ba5e19a..16f2dd4d4 100644 --- a/modules/monitoring/library/Monitoring/SecurityStep.php +++ b/modules/monitoring/library/Monitoring/SecurityStep.php @@ -63,15 +63,21 @@ class SecurityStep extends Step public function getReport() { if ($this->error === false) { - $message = mt('monitoring', 'Monitoring security configuration has been successfully created: %s'); - return '

' . sprintf($message, Config::resolvePath('modules/monitoring/config.ini')) . '

'; + return array(sprintf( + mt('monitoring', 'Monitoring security configuration has been successfully created: %s'), + Config::resolvePath('modules/monitoring/config.ini') + )); } elseif ($this->error !== null) { - $message = mt( - 'monitoring', - 'Monitoring security configuration could not be written to: %s; An error occured:' + return array( + sprintf( + mt( + 'monitoring', + 'Monitoring security configuration could not be written to: %s. An error occured:' + ), + Config::resolvePath('modules/monitoring/config.ini') + ), + sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage()) ); - return '

' . sprintf($message, Config::resolvePath('modules/monitoring/config.ini')) - . '

' . $this->error->getMessage() . '

'; } } } diff --git a/modules/setup/application/views/scripts/index/parts/finish.phtml b/modules/setup/application/views/scripts/index/parts/finish.phtml index 0018d0d43..7066f7f2e 100644 --- a/modules/setup/application/views/scripts/index/parts/finish.phtml +++ b/modules/setup/application/views/scripts/index/parts/finish.phtml @@ -1,22 +1,10 @@
-
- - - - -
- - - - - - -

translate('Congratulations! Icinga Web 2 has been successfully set up.'); ?>

- -

translate('Sorry! Failed to set up Icinga Web 2 successfully.'); ?>

- -
-
+ +

translate('Congratulations! Icinga Web 2 has been successfully set up.'); ?>

+ +

translate('Sorry! Failed to set up Icinga Web 2 successfully.'); ?>

+ +
qlink( $this->translate('Login to Icinga Web 2'), @@ -39,4 +27,7 @@ ); ?>
+
\ No newline at end of file diff --git a/modules/setup/library/Setup/Setup.php b/modules/setup/library/Setup/Setup.php index 02da366e8..fa508ed35 100644 --- a/modules/setup/library/Setup/Setup.php +++ b/modules/setup/library/Setup/Setup.php @@ -81,13 +81,16 @@ class Setup implements IteratorAggregate /** * Return a report of all actions that were run * - * @return array An array of HTML strings + * @return array An array of arrays of strings */ public function getReport() { $reports = array(); foreach ($this->steps as $step) { - $reports[] = $step->getReport(); + $report = $step->getReport(); + if (! empty($report)) { + $reports[] = $report; + } } return $reports; diff --git a/modules/setup/library/Setup/Step.php b/modules/setup/library/Setup/Step.php index 82abce751..7b2c947ea 100644 --- a/modules/setup/library/Setup/Step.php +++ b/modules/setup/library/Setup/Step.php @@ -23,9 +23,9 @@ abstract class Step abstract public function getSummary(); /** - * Return a HTML representation of this step's configuration changes that were made + * Return a textual summary of all configuration changes made * - * @return string + * @return array */ abstract public function getReport(); } diff --git a/modules/setup/library/Setup/Steps/AuthenticationStep.php b/modules/setup/library/Setup/Steps/AuthenticationStep.php index 58d9d68d7..0f35e5c51 100644 --- a/modules/setup/library/Setup/Steps/AuthenticationStep.php +++ b/modules/setup/library/Setup/Steps/AuthenticationStep.php @@ -161,32 +161,45 @@ class AuthenticationStep extends Step public function getReport() { - $report = ''; + $report = array(); + if ($this->authIniError === false) { - $message = mt('setup', 'Authentication configuration has been successfully written to: %s'); - $report .= '

' . sprintf($message, Config::resolvePath('authentication.ini')) . '

'; + $report[] = sprintf( + mt('setup', 'Authentication configuration has been successfully written to: %s'), + Config::resolvePath('authentication.ini') + ); } elseif ($this->authIniError !== null) { - $message = mt('setup', 'Authentication configuration could not be written to: %s; An error occured:'); - $report .= '

' . sprintf($message, Config::resolvePath('authentication.ini')) . '

' - . '

' . $this->authIniError->getMessage() . '

'; + $report[] = sprintf( + mt('setup', 'Authentication configuration could not be written to: %s. An error occured:'), + Config::resolvePath('authentication.ini') + ); + $report[] = sprintf(mt('setup', 'ERROR: %s'), $this->authIniError->getMessage()); } if ($this->dbError === false) { - $message = mt('setup', 'Account "%s" has been successfully created.'); - $report .= '

' . sprintf($message, $this->data['adminAccountData']['username']) . '

'; + $report[] = sprintf( + mt('setup', 'Account "%s" has been successfully created.'), + $this->data['adminAccountData']['username'] + ); } elseif ($this->dbError !== null) { - $message = mt('setup', 'Unable to create account "%s". An error occured:'); - $report .= '

' . sprintf($message, $this->data['adminAccountData']['username']) . '

' - . '

' . $this->dbError->getMessage() . '

'; + $report[] = sprintf( + mt('setup', 'Unable to create account "%s". An error occured:'), + $this->data['adminAccountData']['username'] + ); + $report[] = sprintf(mt('setup', 'ERROR: %s'), $this->dbError->getMessage()); } if ($this->permIniError === false) { - $message = mt('setup', 'Account "%s" has been successfully defined as initial administrator.'); - $report .= '

' . sprintf($message, $this->data['adminAccountData']['username']) . '

'; + $report[] = sprintf( + mt('setup', 'Account "%s" has been successfully defined as initial administrator.'), + $this->data['adminAccountData']['username'] + ); } elseif ($this->permIniError !== null) { - $message = mt('setup', 'Unable to define account "%s" as initial administrator. An error occured:'); - $report .= '

' . sprintf($message, $this->data['adminAccountData']['username']) . '

' - . '

' . $this->permIniError->getMessage() . '

'; + $report[] = sprintf( + mt('setup', 'Unable to define account "%s" as initial administrator. An error occured:'), + $this->data['adminAccountData']['username'] + ); + $report[] = sprintf(mt('setup', 'ERROR: %s'), $this->permIniError->getMessage()); } return $report; diff --git a/modules/setup/library/Setup/Steps/DatabaseStep.php b/modules/setup/library/Setup/Steps/DatabaseStep.php index fdbdc41f1..4e8b91fb8 100644 --- a/modules/setup/library/Setup/Steps/DatabaseStep.php +++ b/modules/setup/library/Setup/Steps/DatabaseStep.php @@ -247,12 +247,14 @@ class DatabaseStep extends Step public function getReport() { if ($this->error === false) { - return '

' . join('

', $this->messages) . '

' - . '

' . mt('setup', 'The database has been fully set up!') . '

'; + $report = $this->messages; + $report[] = mt('setup', 'The database has been fully set up!'); + return $report; } elseif ($this->error !== null) { - $message = mt('setup', 'Failed to fully setup the database. An error occured:'); - return '

' . join('

', $this->messages) . '

' - . '

' . $message . '

' . $this->error->getMessage() . '

'; + $report = $this->messages; + $report[] = mt('setup', 'Failed to fully setup the database. An error occured:'); + $report[] = sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage()); + return $report; } } diff --git a/modules/setup/library/Setup/Steps/GeneralConfigStep.php b/modules/setup/library/Setup/Steps/GeneralConfigStep.php index 86462bbb0..994517fd6 100644 --- a/modules/setup/library/Setup/Steps/GeneralConfigStep.php +++ b/modules/setup/library/Setup/Steps/GeneralConfigStep.php @@ -102,12 +102,18 @@ class GeneralConfigStep extends Step public function getReport() { if ($this->error === false) { - $message = mt('setup', 'General configuration has been successfully written to: %s'); - return '

' . sprintf($message, Config::resolvePath('config.ini')) . '

'; + return array(sprintf( + mt('setup', 'General configuration has been successfully written to: %s'), + Config::resolvePath('config.ini') + )); } elseif ($this->error !== null) { - $message = mt('setup', 'General configuration could not be written to: %s; An error occured:'); - return '

' . sprintf($message, Config::resolvePath('config.ini')) . '

' - . '

' . $this->error->getMessage() . '

'; + return array( + sprintf( + mt('setup', 'General configuration could not be written to: %s. An error occured:'), + Config::resolvePath('config.ini') + ), + sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage()) + ); } } } diff --git a/modules/setup/library/Setup/Steps/ResourceStep.php b/modules/setup/library/Setup/Steps/ResourceStep.php index 36f898f5c..f2f20c750 100644 --- a/modules/setup/library/Setup/Steps/ResourceStep.php +++ b/modules/setup/library/Setup/Steps/ResourceStep.php @@ -133,12 +133,18 @@ class ResourceStep extends Step public function getReport() { if ($this->error === false) { - $message = mt('setup', 'Resource configuration has been successfully written to: %s'); - return '

' . sprintf($message, Config::resolvePath('resources.ini')) . '

'; + return array(sprintf( + mt('setup', 'Resource configuration has been successfully written to: %s'), + Config::resolvePath('resources.ini') + )); } elseif ($this->error !== null) { - $message = mt('setup', 'Resource configuration could not be written to: %s; An error occured:'); - return '

' . sprintf($message, Config::resolvePath('resources.ini')) . '

' - . '

' . $this->error->getMessage() . '

'; + return array( + sprintf( + mt('setup', 'Resource configuration could not be written to: %s. An error occured:'), + Config::resolvePath('resources.ini') + ), + sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage()) + ); } } } diff --git a/modules/setup/library/Setup/Utils/EnableModuleStep.php b/modules/setup/library/Setup/Utils/EnableModuleStep.php index 2cb88e2b1..7c29e59f7 100644 --- a/modules/setup/library/Setup/Utils/EnableModuleStep.php +++ b/modules/setup/library/Setup/Utils/EnableModuleStep.php @@ -53,13 +53,13 @@ class EnableModuleStep extends Step $okMessage = mt('setup', 'Module "%s" has been successfully enabled.'); $failMessage = mt('setup', 'Module "%s" could not be enabled. An error occured:'); - $report = ''; + $report = array(); foreach ($this->moduleNames as $moduleName) { if (isset($this->errors[$moduleName])) { - $report .= '

' . sprintf($failMessage, $moduleName) . '

' - . '

' . $this->errors[$moduleName]->getMessage() . '

'; + $report[] = sprintf($failMessage, $moduleName); + $report[] = sprintf(mt('setup', 'ERROR: %s'), $this->errors[$moduleName]->getMessage()); } else { - $report .= '

' . sprintf($okMessage, $moduleName) . '

'; + $report[] = sprintf($okMessage, $moduleName); } } diff --git a/modules/setup/library/Setup/Utils/MakeDirStep.php b/modules/setup/library/Setup/Utils/MakeDirStep.php index 51397ad3d..5e486d561 100644 --- a/modules/setup/library/Setup/Utils/MakeDirStep.php +++ b/modules/setup/library/Setup/Utils/MakeDirStep.php @@ -53,14 +53,14 @@ class MakeDirStep extends Step $okMessage = mt('setup', 'Directory "%s" in "%s" has been successfully created.'); $failMessage = mt('setup', 'Unable to create directory "%s" in "%s". An error occured:'); - $report = ''; + $report = array(); foreach ($this->paths as $path) { if (array_key_exists($path, $this->errors)) { if (is_array($this->errors[$path])) { - $report .= '

' . sprintf($failMessage, basename($path), dirname($path)) . '

' - . '

' . $this->errors[$path]['message'] . '

'; + $report[] = sprintf($failMessage, basename($path), dirname($path)); + $report[] = sprintf(mt('setup', 'ERROR: %s'), $this->errors[$path]['message']); } else { - $report .= '

' . sprintf($okMessage, basename($path), dirname($path)) . '

'; + $report[] = sprintf($okMessage, basename($path), dirname($path)); } } } diff --git a/public/css/icinga/setup.less b/public/css/icinga/setup.less index 0cc291a78..ef4614237 100644 --- a/public/css/icinga/setup.less +++ b/public/css/icinga/setup.less @@ -300,50 +300,35 @@ form#setup_requirements { } } -.conspicuous-state-notification { - width: 66%; - margin: 0 auto; - padding: 0.5em; - color: white; - font-weight: bold; -} - #setup-finish { - div.report { - padding: 1em; - border: 1px solid lightgrey; - border-radius: 0em; + h2 { + padding: 0.5em; + border-bottom: 0; + font-variant: normal; + font-weight: bold; + color: white; - div.line-separator { - width: 50%; - height: 1px; - margin: 0 auto; - background-color: white; + &.success { + background-color: @colorOk; } - p { - margin: 1em; - color: #444; - text-align: center; - - &.error { - color: red; - } - - &.failure { - .conspicuous-state-notification; - background-color: @colorCritical; - } - - &.success { - .conspicuous-state-notification; - background-color: @colorOk; - } + &.failure { + background-color: @colorCritical; } } + textarea.report { + width: 66%; + height: 25em; + } + div.buttons { + margin-top: 0.5em; text-align: center; + + a { + padding: 0.5em; + } } }