diff --git a/application/views/scripts/form/setup-summary.phtml b/application/views/scripts/form/setup-summary.phtml index b7d5a9ac7..77fb50783 100644 --- a/application/views/scripts/form/setup-summary.phtml +++ b/application/views/scripts/form/setup-summary.phtml @@ -1,6 +1,14 @@ getSummary(); +$prefType = $summary['setup_preferences_type']['type']; +$authType = $summary['setup_authentication_type']['type']; +$adminType = $summary['setup_admin_account']['user_type']; +$loggingType = $summary['setup_general_config']['logging_type']; +$loggingLevel = $summary['setup_general_config']['logging_level']; ?>

- getSummary() as $pageTitle => $pageContent): ?> -
-

- - $paragraphContent): ?> -
- -

- - - -
    - -
  • - -
- - $topicContent): ?> -
-

- -
    - -
  • - -
- -

- -
- - - -

- -
- - -

- + +
+

+ +
+

+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- + + +
+

+

LDAP

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+

+
+

+

+ + + + + + + + + + + + + + + + + + + + + + +
+
+
+

+

+

+
+
+

+
+

+
    +
  • +
  • +
+
+
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+

+

+
+
getElement($form->getTokenElementName()); ?> getElement($form->getUidElementName()); ?> diff --git a/library/Icinga/Application/WebInstaller.php b/library/Icinga/Application/WebInstaller.php index c4969daf5..f44450154 100644 --- a/library/Icinga/Application/WebInstaller.php +++ b/library/Icinga/Application/WebInstaller.php @@ -391,210 +391,64 @@ class WebInstaller implements Installer */ public function getSummary() { - $summary = array(); - - $prefType = $this->pageData['setup_preferences_type']['type']; - $authType = $this->pageData['setup_authentication_type']['type']; - if ($authType !== 'autologin' || $prefType === 'db') { - $resourceInfo = array(); - - if ($authType === 'db' || $prefType === 'db') { - if ($authType === 'db' && $prefType === 'db') { - $resourceInfo[] = t( - 'The following database will be used to authenticate users and to store preferences.' - ); - } elseif ($authType === 'db') { - $resourceInfo[] = t('The following database will be used to authenticate users.'); - } else { // $prefType === 'db' - $resourceInfo[] = t('The following database will be used to store preferences.'); - } - - $resourceInfo[t('Database')] = array( - sprintf(t('Resource Name: %s'), $this->pageData['setup_db_resource']['name']), - sprintf(t('Database Type: %s'), $this->pageData['setup_db_resource']['db']), - sprintf(t('Host: %s'), $this->pageData['setup_db_resource']['host']), - sprintf(t('Port: %s'), $this->pageData['setup_db_resource']['port']), - sprintf(t('Database Name: %s'), $this->pageData['setup_db_resource']['dbname']), - sprintf(t('Username: %s'), $this->pageData['setup_db_resource']['username']), - sprintf( - t('Password: %s'), - str_repeat('*', strlen($this->pageData['setup_db_resource']['password'])) - ) - ); - } - - if ($authType === 'ldap') { - $resourceInfo[] = t('The following LDAP connection will be used to authenticate users.'); - $resourceInfo['LDAP'] = array( - sprintf(t('Resource Name: %s'), $this->pageData['setup_ldap_resource']['name']), - sprintf(t('Host: %s'), $this->pageData['setup_ldap_resource']['hostname']), - sprintf(t('Port: %s'), $this->pageData['setup_ldap_resource']['port']), - sprintf(t('Root DN: %s'), $this->pageData['setup_ldap_resource']['root_dn']), - sprintf(t('Bind DN: %s'), $this->pageData['setup_ldap_resource']['bind_dn']), - sprintf( - t('Bind Password: %s'), - str_repeat('*', strlen($this->pageData['setup_ldap_resource']['bind_pw'])) - ) - ); - } - - $summary[tp('Resource', 'Resources', count($resourceInfo) / 2)] = $resourceInfo; - } - - $adminType = $this->pageData['setup_admin_account']['user_type']; - $summary[t('Authentication')] = array( - sprintf( - t('Users will authenticate using %s.', 'setup.summary.auth'), - $authType === 'db' ? t('a database', 'setup.summary.auth.type') : ( - $authType === 'ldap' ? 'LDAP' : t('webserver authentication', 'setup.summary.auth.type') - ) - ), - t('Backend Configuration') => $authType === 'db' ? array( - sprintf(t('Backend Name: %s'), $this->pageData['setup_authentication_backend']['name']) - ) : ($authType === 'ldap' ? array( - sprintf(t('Backend Name: %s'), $this->pageData['setup_authentication_backend']['name']), - sprintf( - t('LDAP User Object Class: %s'), - $this->pageData['setup_authentication_backend']['user_class'] - ), - sprintf( - t('LDAP User Name Attribute: %s'), - $this->pageData['setup_authentication_backend']['user_name_attribute'] - ) - ) : array( - sprintf(t('Backend Name: %s'), $this->pageData['setup_authentication_backend']['name']), - sprintf( - t('Backend Domain Pattern: %s'), - $this->pageData['setup_authentication_backend']['strip_username_regexp'] - ) - ) - ), - t('Initial Administrative Account') => $adminType === 'by_name' || $adminType === 'existing_user' - ? sprintf( - t('Administrative rights will initially be granted to an existing account called "%s".'), - $this->pageData['setup_admin_account'][$adminType] - ) : sprintf( - t('Administrative rights will initially be granted to a new account called "%s".'), - $this->pageData['setup_admin_account'][$adminType] - ) - ); - - $loggingLevel = $this->pageData['setup_general_config']['logging_level']; - $loggingType = $this->pageData['setup_general_config']['logging_type']; - $summary[t('Application Configuration')] = array( - t('General', 'app.config') => array( - sprintf( - t('Icinga Web 2 will look for modules at: %s'), - $this->pageData['setup_general_config']['global_modulePath'] - ), - sprintf( - $prefType === 'ini' ? sprintf( - t('Preferences will be stored per user account in INI files at: %s'), - Config::$configDir . '/preferences' - ) : ( - $prefType === 'db' ? t('Preferences will be stored using a database.') : ( - t('Preferences will not be persisted across browser sessions.') - ) - ) - ) - ), - t('Logging', 'app.config') => array_merge( - array( - sprintf( - t('Level: %s', 'app.config.logging'), - $loggingLevel === 0 ? t('None', 'app.config.logging.level') : ( - $loggingLevel === 1 ? t('Error', 'app.config.logging.level') : ( - $loggingLevel === 2 ? t('Warning', 'app.config.logging.level') : ( - $loggingLevel === 3 ? t('Information', 'app.config.logging.level') : ( - t('Debug', 'app.config.logging.level') - ) - ) - ) - ) - ), - sprintf( - t('Type: %s', 'app.config.logging'), - $loggingType === 'syslog' ? 'Syslog' : t('File', 'app.config.logging.type') - ) - ), - $this->pageData['setup_general_config']['logging_type'] === 'syslog' ? array( - sprintf( - t('Application Prefix: %s'), - $this->pageData['setup_general_config']['logging_application'] - ), - sprintf( - t('Facility: %s'), - $this->pageData['setup_general_config']['logging_facility'] - ) - ) : array( - sprintf( - t('Filepath: %s'), - $this->pageData['setup_general_config']['logging_target'] - ) - ) - ) - ); - + $summary = $this->pageData; if (isset($this->pageData['setup_db_resource'])) { - $setupDatabase = true; $resourceConfig = $this->pageData['setup_db_resource']; if (isset($this->pageData['setup_database_creation'])) { $resourceConfig['username'] = $this->pageData['setup_database_creation']['username']; $resourceConfig['password'] = $this->pageData['setup_database_creation']['password']; } - if ($setupDatabase) { - $db = new DbTool($resourceConfig); + $db = new DbTool($resourceConfig); + try { + $db->connectToDb(); + if (array_search('account', $db->listTables()) === false) { + $message = sprintf( + t( + 'The database user "%s" will be used to setup the missing' + . ' schema required by Icinga Web 2 in database "%s".' + ), + $resourceConfig['username'], + $resourceConfig['dbname'] + ); + } else { + $message = sprintf( + t('The database "%s" already seems to be fully set up. No action required.'), + $resourceConfig['dbname'] + ); + } + } catch (PDOException $e) { try { - $db->connectToDb(); - if (array_search('account', $db->listTables()) === false) { + $db->connectToHost(); + if ($db->hasLogin($this->pageData['setup_db_resource']['username'])) { $message = sprintf( t( - 'The database user "%s" will be used to setup the missing' - . ' schema required by Icinga Web 2 in database "%s".' + 'The database user "%s" will be used to create the missing ' + . 'database "%s" with the schema required by Icinga Web 2.' ), $resourceConfig['username'], $resourceConfig['dbname'] ); } else { $message = sprintf( - t('The database "%s" already seems to be fully set up. No action required.'), - $resourceConfig['dbname'] + t( + 'The database user "%s" will be used to create the missing database "%s" ' + . 'with the schema required by Icinga Web 2 and a new login called "%s".' + ), + $resourceConfig['username'], + $resourceConfig['dbname'], + $this->pageData['setup_db_resource']['username'] ); } } catch (PDOException $e) { - try { - $db->connectToHost(); - if ($db->hasLogin($this->pageData['setup_db_resource']['username'])) { - $message = sprintf( - t( - 'The database user "%s" will be used to create the missing ' - . 'database "%s" with the schema required by Icinga Web 2.' - ), - $resourceConfig['username'], - $resourceConfig['dbname'] - ); - } else { - $message = sprintf( - t( - 'The database user "%s" will be used to create the missing database "%s" ' - . 'with the schema required by Icinga Web 2 and a new login called "%s".' - ), - $resourceConfig['username'], - $resourceConfig['dbname'], - $this->pageData['setup_db_resource']['username'] - ); - } - } catch (PDOException $e) { - $message = t( - 'No connection to database host possible. You\'ll need to setup the' - . ' database with the schema required by Icinga Web 2 manually.' - ); - } + $message = t( + 'No connection to database host possible. You\'ll need to setup the' + . ' database with the schema required by Icinga Web 2 manually.' + ); } - - $summary[t('Database Setup')] = $message; } + + $summary['database_info'] = $message; } return $summary; diff --git a/public/css/icinga/setup.less b/public/css/icinga/setup.less index 69549da51..a27bece9f 100644 --- a/public/css/icinga/setup.less +++ b/public/css/icinga/setup.less @@ -198,28 +198,40 @@ #setup div.summary { div.page { + float: left; + width: 30em; + padding: 0 1em 1em; + margin: 1em 2em 2em; + border-radius: 0.5em; + border: 1px dashed lightgrey; + h2 { font-size: 1.2em; } - .paragraph { + div.topic { margin-left: 2em; h3 { font-size: 1em; } - .topic { - h4 { - font-size: 0.8em; - } + ul { + list-style-type: circle; } - div.topic { + table { + border-spacing: 0.5em; + border-collapse: separate; + font-size: 0.9em; margin-left: 2em; } } } + + form { + clear: left; + } } #setup div.report {