diff --git a/.gitignore b/.gitignore index a243728f3..a7b2c6b1c 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,7 @@ config/preferences/*.ini # Application logfiles var/log/*.log + +/debian + + diff --git a/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf b/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf index 16dd5e9cb..0b45bea1f 100644 --- a/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf +++ b/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf @@ -1,10 +1,23 @@ - - Options -Indexes - - AllowOverride All +Alias /icingaweb /vagrant/public + + Options FollowSymLinks + AllowOverride None Order allow,deny Allow from all + # SetEnv ICINGAWEB_CONFIGDIR /etc/icingaweb + EnableSendfile Off + + RewriteEngine on + RewriteBase /icingaweb/ + RewriteCond %{REQUEST_FILENAME} -s [OR] + RewriteCond %{REQUEST_FILENAME} -l [OR] + RewriteCond %{REQUEST_FILENAME} -d + RewriteRule ^.*$ - [NC,L] + RewriteRule ^.*$ index.php [NC,L] + + php_value xdebug.idekey PHPSTORM + diff --git a/.vagrant-puppet/files/etc/icinga2/constants.conf b/.vagrant-puppet/files/etc/icinga2/constants.conf new file mode 100644 index 000000000..9e6ed51af --- /dev/null +++ b/.vagrant-puppet/files/etc/icinga2/constants.conf @@ -0,0 +1,15 @@ +/** + * This file defines global constants which can be used in + * the other configuration files. + */ + +/* The directory which contains the plugins from the Monitoring Plugins project. */ +const PluginDir = "/usr/lib64/nagios/plugins" + +/* Our local instance name. By default this is the server's hostname as returned by `hostname --fqdn`. + * This should be the common name from the API certificate. +*/ +const NodeName = "localhost" + +/* Our local zone name. */ +const ZoneName = NodeName diff --git a/.vagrant-puppet/files/etc/icingaweb/authentication.ini b/.vagrant-puppet/files/etc/icingaweb/authentication.ini index 551cee143..3da806df1 100644 --- a/.vagrant-puppet/files/etc/icingaweb/authentication.ini +++ b/.vagrant-puppet/files/etc/icingaweb/authentication.ini @@ -1,3 +1,9 @@ +[autologin] +backend = autologin +; +; If you want to strip the domain +; strip_username_regexp = /\@[^$]+$/ + [internal_ldap_authentication] backend = ldap resource = internal_ldap diff --git a/.vagrant-puppet/files/var/www/html/icingaweb/.htaccess b/.vagrant-puppet/files/var/www/html/icingaweb/.htaccess deleted file mode 100644 index f5ea66435..000000000 --- a/.vagrant-puppet/files/var/www/html/icingaweb/.htaccess +++ /dev/null @@ -1,11 +0,0 @@ -RewriteEngine on -RewriteBase /icingaweb -RewriteCond %{REQUEST_FILENAME} -s [OR] -RewriteCond %{REQUEST_FILENAME} -l [OR] -RewriteCond %{REQUEST_FILENAME} -d -RewriteRule ^.*$ - [NC,L] -RewriteRule ^.*$ index.php [NC,L] - -php_flag short_open_tag on - -php_value xdebug.idekey PHPSTORM diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 64f829fd2..4358b2898 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -6,7 +6,7 @@ include openldap Exec { path => '/bin:/usr/bin:/sbin' } $icingaVersion = '1.11.2' -$icinga2Version = '0.0.11' +$icinga2Version = '2.0.0' exec { 'create-mysql-icinga-db': unless => 'mysql -uicinga -picinga icinga', @@ -50,7 +50,7 @@ group { 'icinga-cmd': group { 'icingacmd': ensure => present, - require => Exec['install icinga2'] + require => Package['icinga2'] } user { 'icinga': @@ -343,50 +343,95 @@ package { ['cmake', 'boost-devel', 'bison', 'flex']: ensure => installed } +# icinga 2 +define icinga2::feature ($feature = $title) { + exec { "icinga2-feature-${feature}": + path => '/bin:/usr/bin:/sbin:/usr/sbin', + unless => "readlink /etc/icinga2/features-enabled/${feature}.conf", + command => "icinga2-enable-feature ${feature}", + require => [ Package['icinga2'] ], + notify => Service['icinga2'] + } +} + yumrepo { 'icinga2-repo': baseurl => "http://packages.icinga.org/epel/6/snapshot/", - enabled => '0', + enabled => '1', gpgcheck => '1', gpgkey => 'http://packages.icinga.org/icinga.key', descr => "Icinga Repository - ${::architecture}" } -exec { 'install icinga2': - command => 'yum -d 0 -e 0 -y --enablerepo=icinga2-repo install icinga2', - unless => 'rpm -qa | grep icinga2', - require => Yumrepo['icinga2-repo'] -} - -exec { 'install icinga2-classicui-config': - command => 'yum -d 0 -e 0 -y --enablerepo=icinga2-repo install icinga2-classicui-config', - unless => 'rpm -qa | grep icinga2-classicui-config', - require => [ Yumrepo['icinga2-repo'], Exec['install icinga2'], Exec['install icinga2-ido-mysql'] ] -} - -exec { 'install icinga2-ido-mysql': - command => 'yum -d 0 -e 0 -y --enablerepo=icinga2-repo install icinga2-ido-mysql', - unless => 'rpm -qa | grep icinga2-ido-mysql', - require => [ Yumrepo['icinga2-repo'], Exec['install icinga2'] ], -} - exec { 'install nagios-plugins-all': command => 'yum -d 0 -e 0 -y --enablerepo=epel install nagios-plugins-all', unless => 'rpm -qa | grep nagios-plugins-all', - require => [ Class['epel'], Exec['install icinga2'] ], + require => [ Class['epel'], Package['icinga2'] ], } -file { '/etc/icinga2/features-enabled/': - ensure => directory, - owner => icinga, - group => icinga, - require => Exec['install icinga2-ido-mysql'] +package { 'icinga2': + ensure => latest, + require => Yumrepo['icinga2-repo'], + alias => 'icinga2' } +package { 'icinga2-bin': + ensure => latest, + require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], + alias => 'icinga2-bin' +} + +package { 'icinga2-doc': + ensure => latest, + require => Yumrepo['icinga2-repo'], + alias => 'icinga2-doc' +} + +# icinga 2 classic ui +package { 'icinga2-classicui-config': + ensure => latest, + before => Package["icinga-gui"], + require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], + notify => Service['apache'] +} + +package { 'icinga-gui': + ensure => latest, + require => Yumrepo['icinga2-repo'], + alias => 'icinga-gui' +} + +icinga2::feature { 'statusdata': + require => Package['icinga2-classicui-config'] +} + +icinga2::feature { 'command': + require => Package['icinga2-classicui-config'] +} + +icinga2::feature { 'compatlog': + require => Package['icinga2-classicui-config'] +} + +# icinga 2 ido mysql +package { 'icinga2-ido-mysql': + ensure => latest, + require => Yumrepo['icinga2-repo'], + alias => 'icinga2-ido-mysql' +} + +exec { 'populate-icinga2-mysql-db': + unless => 'mysql -uicinga2 -picinga2 icinga2 -e "SELECT * FROM icinga_dbversion;" &> /dev/null', + command => "mysql -uroot icinga2 < /usr/share/doc/icinga2-ido-mysql-$icinga2Version/schema/mysql.sql", + require => [ Exec['create-mysql-icinga2-db'], Package['icinga2-ido-mysql'] ] +} + + file { '/etc/icinga2/features-available/ido-mysql.conf': source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf', owner => 'icinga', group => 'icinga', - require => Exec['install icinga2-ido-mysql'] + require => Package['icinga2'], + notify => Service['icinga2'] } file { '/etc/icinga2/features-enabled/ido-mysql.conf': @@ -394,69 +439,46 @@ file { '/etc/icinga2/features-enabled/ido-mysql.conf': target => '/etc/icinga2/features-available/ido-mysql.conf', owner => 'root', group => 'root', - require => Exec['install icinga2-ido-mysql'] + require => Package['icinga2-ido-mysql'] } +icinga2::feature { 'ido-mysql': + require => Exec['populate-icinga2-mysql-db'] +} + + +# icinga 2 test config file { '/etc/icinga2/conf.d/test-config.conf': source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf', owner => 'icinga', group => 'icinga', - require => [ Exec['install icinga2'], Exec['create_monitoring_test_config'] ] + require => [ Package['icinga2'], Exec['create_monitoring_test_config'] ] } file { '/etc/icinga2/conf.d/commands.conf': source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/commands.conf', owner => 'icinga', group => 'icinga', - require => Exec['install icinga2'] + require => Package['icinga2'] +} + +file { '/etc/icinga2/constants.conf': + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/constants.conf', + owner => 'icinga', + group => 'icinga', + require => Package['icinga2'] } service { 'icinga2': ensure => running, require => [ - Exec['install icinga2'], + Package['icinga2'], File['/etc/icinga2/features-enabled/ido-mysql.conf'], File['/etc/icinga2/conf.d/test-config.conf'], File['/etc/icinga2/conf.d/commands.conf'] ] } -exec { 'populate-icinga2-mysql-db': - unless => 'mysql -uicinga2 -picinga2 icinga2 -e "SELECT * FROM icinga_dbversion;" &> /dev/null', - command => "mysql -uroot icinga2 < /usr/share/doc/icinga2-ido-mysql-$icinga2Version/schema/mysql.sql", - require => [ Exec['create-mysql-icinga2-db'], Exec['install icinga2-ido-mysql'] ] -} - -# cmmi { 'icinga2': -# url => "https://github.com/Icinga/icinga2/releases/download/v${icinga2Version}/icinga2-${icinga2Version}.tar.gz", -# output => "icinga2-${icinga2Version}.tar.gz", -# configure_command => 'mkdir build &> /dev/null || true && cd build && sudo cmake ..', -# creates => '/usr/local/sbin/icinga2', -# make => 'true && cd build/ && make && make install', -# require => Package[ ['cmake', 'boost-devel', 'bison', 'flex'] ], -# make_timeout => 900 -# } - -#configure { 'icingaweb': -# path => '/vagrant', -# flags => '--prefix=/vagrant \ -# --with-icinga-commandpipe="/usr/local/icinga-mysql/var/rw/icinga.cmd" \ -# --with-statusdat-file="/usr/local/icinga-mysql/var/status.dat" \ -# --with-objects-cache-file=/usr/local/icinga-mysql/var/objects.cache \ -# --with-icinga-backend=ido \ -# --with-httpd-config-path="/etc/httpd/conf.d" \ -# --with-ldap-authentication \ -# --with-internal-authentication \ -# --with-livestatus-socket="/usr/local/icinga-mysql/var/rw/live"', -# require => Exec['install php-ZendFramework'] -#} - -#file { 'icingaweb-public': -# ensure => '/vagrant/public', -# path => '/var/www/html/icingaweb', -# require => Class['apache'] -#} - exec { 'install php-ZendFramework-Db-Adapter-Pdo-Mysql': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework-Db-Adapter-Pdo-Mysql', unless => 'rpm -qa | grep php-ZendFramework-Db-Adapter-Pdo-Mysql', @@ -664,63 +686,10 @@ exec { 'populate-icinga_web-mysql-db': require => [ Exec['create-mysql-icinga_web-db'], Cmmi['icinga-web'] ] } -# -# Development environment (Feature #5554) -# file { '/var/www/html/icingaweb': - ensure => 'directory', - owner => 'apache', - group => 'apache' -} - -file { '/var/www/html/icingaweb/css': - ensure => 'link', - target => '/vagrant/public/css', - owner => 'apache', - group => 'apache', -} - -file { '/var/www/html/icingaweb/svg': - ensure => 'link', - target => '/vagrant/public/svg', - owner => 'apache', - group => 'apache', -} - -file { '/var/www/html/icingaweb/img': - ensure => 'link', - target => '/vagrant/public/img', - owner => 'apache', - group => 'apache', -} - -file { '/var/www/html/icingaweb/js': - ensure => 'link', - target => '/vagrant/public/js', - owner => 'apache', - group => 'apache', -} - -file { '/var/www/html/icingaweb/index.php': - source => 'puppet:////vagrant/.vagrant-puppet/files/var/www/html/icingaweb/index.php', - owner => 'apache', - group => 'apache', -} - -file { '/var/www/html/icingaweb/js.php': ensure => absent, } -file { '/var/www/html/icingaweb/css.php': - ensure => absent, -} - -file { '/var/www/html/icingaweb/.htaccess': - source => 'puppet:////vagrant/.vagrant-puppet/files/var/www/html/icingaweb/.htaccess', - owner => 'apache', - group => 'apache', -} - file { '/etc/httpd/conf.d/icingaweb.conf': source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf', require => Package['apache'], diff --git a/.vagrant-puppet/manifests/finalize.sh b/.vagrant-puppet/manifests/finalize.sh index cd04ebb7a..3b1418575 100644 --- a/.vagrant-puppet/manifests/finalize.sh +++ b/.vagrant-puppet/manifests/finalize.sh @@ -10,11 +10,6 @@ installJquery () { fi } -mountIcinga2webConfd () { - # Remount /vagrant/config/ with appropriate permissions since the group apache is missing initially - mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g apache`,dmode=775,fmode=775 /vagrant/config/ /vagrant/config/ -} - startServicesWithNonLSBCompliantExitStatusCodes () { # Unfortunately the ido2db init script is not LSB compliant and hence not started via puppet service ido2db-mysql start || true @@ -22,12 +17,16 @@ startServicesWithNonLSBCompliantExitStatusCodes () { } mountIcinga2webVarLog () { - # Remount /vagrant/var/log/ with appropriate permissions since the group apache is missing initially - mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g apache`,dmode=775,fmode=775 /vagrant/var/log/ /vagrant/var/log/ + if ! $(/bin/mount | /bin/grep -q "/vagrant/var/log"); then + # Remount /vagrant/var/log/ with appropriate permissions since the group apache is missing initially + /bin/mount -t vboxsf -o \ + uid=`id -u vagrant`,gid=`id -g apache`,dmode=775,fmode=664 \ + /vagrant/var/log/ \ + /vagrant/var/log/ + fi } installJquery -mountIcinga2webConfd startServicesWithNonLSBCompliantExitStatusCodes mountIcinga2webVarLog diff --git a/Makefile.in b/Makefile.in index 78a97cf74..a8fc908cc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -51,7 +51,6 @@ clean: # Installs/copies all static files (executables, scripts, html, etc) # install-static-files: install-application copy-web-files-public copy-web-files-modules - $(INSTALL) -m 644 $(INSTALL_OPTS) "./public/.htaccess" $(DESTDIR)$(prefix)/public/.htaccess; # # Installs all configuration files diff --git a/Vagrantfile b/Vagrantfile index c8c279647..8668795f1 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,7 +1,20 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -Vagrant.configure("2") do |config| +VAGRANTFILE_API_VERSION = "2" +VAGRANT_REQUIRED_VERSION = "1.2.0" + +# Require 1.2.x at least +if ! defined? Vagrant.require_version + if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new(VAGRANT_REQUIRED_VERSION) + puts "Vagrant >= " + VAGRANT_REQUIRED_VERSION + " required. Your version is " + Vagrant::VERSION + exit 1 + end +else + Vagrant.require_version ">= " + VAGRANT_REQUIRED_VERSION +end + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # All Vagrant configuration is done here. The most common configuration # options are documented and commented below. For a complete reference, # please see the online documentation at vagrantup.com. diff --git a/application/clicommands/ModuleCommand.php b/application/clicommands/ModuleCommand.php index 6a6f981ed..8bbc1cad0 100644 --- a/application/clicommands/ModuleCommand.php +++ b/application/clicommands/ModuleCommand.php @@ -54,7 +54,7 @@ class ModuleCommand extends Command $modules = $this->modules->listInstalledModules(); } if (empty($modules)) { - echo "There are no modules installed\n"; + echo "There are no $type modules\n"; return; } if ($this->isVerbose) { @@ -67,7 +67,7 @@ class ModuleCommand extends Command if ($this->isVerbose) { $dir = ' ' . $this->modules->getModuleDir($module); } else { - $dir = $mod->getShortDescription(); + $dir = $mod->getTitle(); } printf( "%-14s %-9s %-9s %s\n", diff --git a/application/clicommands/WebCommand.php b/application/clicommands/WebCommand.php index 12d140f43..54141e0c7 100644 --- a/application/clicommands/WebCommand.php +++ b/application/clicommands/WebCommand.php @@ -29,7 +29,7 @@ class WebCommand extends Command // throw new Exception('Socket is required'); } if ($basedir === null) { - $basedir = dirname(ICINGA_APPDIR) . '/public'; + $basedir = dirname(ICINGAWEB_APPDIR) . '/public'; if (! file_exists($basedir) || ! is_dir($basedir)) { throw new Exception('Basedir is required'); } diff --git a/application/controllers/AuthenticationController.php b/application/controllers/AuthenticationController.php index 1066a5802..f50987de7 100644 --- a/application/controllers/AuthenticationController.php +++ b/application/controllers/AuthenticationController.php @@ -30,12 +30,14 @@ # namespace Icinga\Application\Controllers; +use Icinga\Authentication\Backend\AutoLoginBackend; use Icinga\Web\Controller\ActionController; use Icinga\Authentication\Manager as AuthManager; use Icinga\Form\Authentication\LoginForm; use Icinga\Authentication\AuthChain; use Icinga\Application\Config; use Icinga\Logger\Logger; +use Icinga\Exception\AuthenticationException; use Icinga\Exception\NotReadableError; use Icinga\Exception\ConfigurationError; use Icinga\User; @@ -60,7 +62,9 @@ class AuthenticationController extends ActionController { $this->view->form = new LoginForm(); $this->view->form->setRequest($this->_request); - $this->view->title = 'Icinga Web Login'; + $this->view->title = $this->translate('Icingaweb Login'); + $user = new User(''); + $password = ''; try { $redirectUrl = Url::fromPath($this->_request->getParam('redirect', 'dashboard')); @@ -70,52 +74,76 @@ class AuthenticationController extends ActionController } $auth = AuthManager::getInstance(); + if ($auth->isAuthenticated()) { $this->redirectNow($redirectUrl); } - if ($this->view->form->isSubmittedAndValid()) { - $user = new User($this->view->form->getValue('username')); + try { + $config = Config::app('authentication'); + } catch (NotReadableError $e) { + Logger::error( + new Exception('Cannot load authentication configuration. An exception was thrown:', 0, $e) + ); + throw new ConfigurationError( + 'No authentication methods available. It seems that none authentication method has been set' + . ' up. Please check the system log or Icinga Web 2 log for more information' + ); + } - try { - $config = Config::app('authentication'); - } catch (NotReadableError $e) { - Logger::error( - new Exception('Cannot load authentication configuration. An exception was thrown:', 0, $e) - ); - throw new ConfigurationError( - 'No authentication methods available. It seems that none authentication method has been set' - . ' up. Please contact your Icinga Web administrator' - ); + $chain = new AuthChain($config); + + + if ($this->getRequest()->isGet()) { + foreach ($chain as $backend) { + if ($backend instanceof AutoLoginBackend) { + $authenticated = $backend->authenticate($user, $password); + if ($authenticated === true) { + $auth->setAuthenticated($user); + $this->redirectNow($redirectUrl); + } + } } - - // TODO(el): Currently the user is only notified about authentication backend problems when all backends - // have errors. It may be the case that the authentication backend which provides the user has errors - // but other authentication backends work. In that scenario the user is presented an error message - // saying "Incorrect username or password". We must inform the user that not all authentication methods - // are available. + } elseif ($this->view->form->isSubmittedAndValid()) { + $user = new User($this->view->form->getValue('username')); + $password = $this->view->form->getValue('password'); $backendsTried = 0; $backendsWithError = 0; - $chain = new AuthChain($config); + foreach ($chain as $backend) { - $authenticated = $backend->authenticate($user, $this->view->form->getValue('password')); + if ($backend instanceof AutoLoginBackend) { + continue; + } + ++$backendsTried; + try { + $authenticated = $backend->authenticate($user, $password); + } catch (AuthenticationException $e) { + Logger::error($e); + ++$backendsWithError; + continue; + } if ($authenticated === true) { $auth->setAuthenticated($user); $this->redirectNow($redirectUrl); - } elseif ($authenticated === null) { - $backendsWithError += 1; } - $backendsTried += 1; } - if ($backendsWithError === $backendsTried) { throw new ConfigurationError( - 'No authentication methods available. It seems that all set up authentication methods have' - . ' errors. Please contact your Icinga Web administrator' + $this->translate( + 'No authentication methods available. It seems that all set up authentication methods have' + . ' errors. Please check the system log or Icinga Web 2 log for more information' + ) ); } - - $this->view->form->getElement('password')->addError(t('Incorrect username or password')); + if ($backendsWithError) { + $this->view->form->addNote( + $this->translate( + 'Note that not all authentication backends are available for authentication because they' + . ' have errors. Please check the system log or Icinga Web 2 log for more information' + ) + ); + } + $this->view->form->getElement('password')->addError($this->translate('Incorrect username or password')); } } catch (Exception $e) { $this->view->errorInfo = $e->getMessage(); diff --git a/application/controllers/DashboardController.php b/application/controllers/DashboardController.php index 7b917e2e7..a38a02561 100644 --- a/application/controllers/DashboardController.php +++ b/application/controllers/DashboardController.php @@ -46,6 +46,11 @@ use Icinga\Web\Controller\ActionController; */ class DashboardController extends ActionController { + /** + * Default configuration + */ + const DEFAULT_CONFIG = 'dashboard/dashboard'; + /** * Retrieve a dashboard from the provided config * @@ -53,14 +58,18 @@ class DashboardController extends ActionController * * @return \Icinga\Web\Widget\Dashboard */ - private function getDashboard($config = 'dashboard/dashboard') + private function getDashboard($config = self::DEFAULT_CONFIG) { $dashboard = new Dashboard(); try { $dashboardConfig = IcingaConfig::app($config); + if (count($dashboardConfig) === 0) { + return null; + } $dashboard->readConfig($dashboardConfig); } catch (NotReadableError $e) { Logger::error(new Exception('Cannot load dashboard configuration. An exception was thrown:', 0, $e)); + return null; } return $dashboard; } @@ -133,18 +142,28 @@ class DashboardController extends ActionController $pane = $this->_getParam('pane'); $dashboard->activate($pane); } - $this->view->title = $dashboard->getActivePane()->getTitle() . ' :: Dashboard'; - $this->view->tabs = $dashboard->getTabs(); - /* Temporarily removed - $this->view->tabs->add( - 'Add', - array( - 'title' => '+', - 'url' => Url::fromPath('dashboard/addurl') - ) - ); - */ - $this->view->dashboard = $dashboard; + + $this->view->configPath = IcingaConfig::resolvePath(self::DEFAULT_CONFIG); + + if ($dashboard === null) { + $this->view->title = 'Dashboard'; + } else { + $this->view->title = $dashboard->getActivePane()->getTitle() . ' :: Dashboard'; + $this->view->tabs = $dashboard->getTabs(); + + /* Temporarily removed + $this->view->tabs->add( + 'Add', + array( + 'title' => '+', + 'url' => Url::fromPath('dashboard/addurl') + ) + ); + */ + + $this->view->dashboard = $dashboard; + + } } /** diff --git a/application/controllers/SearchController.php b/application/controllers/SearchController.php index 5760803da..f14e1b544 100644 --- a/application/controllers/SearchController.php +++ b/application/controllers/SearchController.php @@ -16,22 +16,35 @@ class SearchController extends ActionController $this->setAutorefreshInterval(10); $search = $this->_request->getParam('q'); if (! $search) { - $this->view->hint = $this->translate('Ready to search, waiting for your input'); + $this->view->tabs = Widget::create('tabs')->add( + 'search', + array( + 'title' => $this->translate('Search'), + 'url' => '/search', + ) + )->activate('search'); + $this->render('hint'); return; } - $dashboard = Widget::create('dashboard')->createPane('Search'); - $pane = $dashboard->getPane('Search'); + $dashboard = Widget::create('dashboard')->createPane($this->translate('Search')); + $pane = $dashboard->getPane($this->translate('Search')); $suffix = strlen($search) ? ': ' . rtrim($search, '*') . '*' : ''; - $pane->addComponent('Hosts' . $suffix, Url::fromPath('monitoring/list/hosts', array( - 'host_name' => $search . '*', - 'sort' => 'host_severity', - 'limit' => 10, - ))); - $pane->addComponent('Services' . $suffix, Url::fromPath('monitoring/list/services', array( - 'service_description' => $search . '*', - 'sort' => 'service_severity', - 'limit' => 10, - ))); + $pane->addComponent( + $this->translate('Hosts') . $suffix, + Url::fromPath('monitoring/list/hosts', array( + 'host_name' => $search . '*', + 'sort' => 'host_severity', + 'limit' => 10, + ) + )); + $pane->addComponent( + $this->translate('Services') . $suffix, + Url::fromPath('monitoring/list/services', array( + 'service_description' => $search . '*', + 'sort' => 'service_severity', + 'limit' => 10, + ) + )); $pane->addComponent('Hostgroups' . $suffix, Url::fromPath('monitoring/list/hostgroups', array( 'hostgroup' => $search . '*', 'limit' => 10, @@ -40,7 +53,7 @@ class SearchController extends ActionController 'servicegroup' => $search . '*', 'limit' => 10, ))); - $dashboard->activate('Search'); + $dashboard->activate($this->translate('Search')); $this->view->dashboard = $dashboard; $this->view->tabs = $dashboard->getTabs(); } diff --git a/application/forms/Config/GeneralForm.php b/application/forms/Config/GeneralForm.php index 484bda497..346dcaf87 100644 --- a/application/forms/Config/GeneralForm.php +++ b/application/forms/Config/GeneralForm.php @@ -248,7 +248,7 @@ class GeneralForm extends Form 'helptext' => 'Contains the directories that will be searched for available modules, separated by ' . ' colons. Modules that don\'t exist in these directories can still be symlinked in the module ' . ' folder, but won\'t show up in the list of disabled modules.', - 'value' => $cfg->get('modulePath', realpath(ICINGA_APPDIR . '/../modules')) + 'value' => $cfg->get('modulePath', realpath(ICINGAWEB_APPDIR . '/../modules')) ) ); } @@ -330,7 +330,7 @@ class GeneralForm extends Form 'label' => 'User Preference Filepath', 'required' => $backend === 'ini', 'condition' => $backend === 'ini', - 'value' => $cfg->get('configPath') + 'value' => $cfg->get('config_path') ) ); @@ -432,7 +432,7 @@ class GeneralForm extends Form $cfg->preferences->type = $values['preferences_type']; if ($cfg->preferences->type === 'ini') { - $cfg->preferences->configPath = $values['preferences_ini_path']; + $cfg->preferences->config_path = $values['preferences_ini_path']; } elseif ($cfg->preferences->type === 'db') { $cfg->preferences->resource = $values['preferences_db_resource']; } diff --git a/application/forms/Preference/GeneralForm.php b/application/forms/Preference/GeneralForm.php index 512b54689..4ed214945 100644 --- a/application/forms/Preference/GeneralForm.php +++ b/application/forms/Preference/GeneralForm.php @@ -261,10 +261,10 @@ class GeneralForm extends Form $this->addElement( 'checkbox', - 'showBenchmark', + 'show_benchmark', array( 'label' => 'Use benchmark', - 'value' => $this->getUserPreferences()->get('app.showBenchmark') + 'value' => $this->getUserPreferences()->get('app.show_benchmark') ) ); } @@ -278,11 +278,11 @@ class GeneralForm extends Form { $values = $this->getValues(); return array( - 'app.language' => $values['default_language'] ? null : $values['language'], - 'app.timezone' => $values['default_timezone'] ? null : $values['timezone'], - 'app.dateFormat' => $values['default_date_format'] ? null : $values['date_format'], - 'app.timeFormat' => $values['default_time_format'] ? null : $values['time_format'], - 'app.showBenchmark' => $values['showBenchmark'] === '1' ? true : false + 'app.language' => $values['default_language'] ? null : $values['language'], + 'app.timezone' => $values['default_timezone'] ? null : $values['timezone'], + 'app.dateFormat' => $values['default_date_format'] ? null : $values['date_format'], + 'app.timeFormat' => $values['default_time_format'] ? null : $values['time_format'], + 'app.show_benchmark' => $values['show_benchmark'] === '1' ? true : false ); } } diff --git a/application/layouts/scripts/layout.phtml b/application/layouts/scripts/layout.phtml index c527edbd5..16a245a15 100644 --- a/application/layouts/scripts/layout.phtml +++ b/application/layouts/scripts/layout.phtml @@ -30,6 +30,12 @@ $isIframe = isset($_GET['_render']) && $_GET['_render'] === 'iframe'; + @@ -47,7 +53,7 @@ $isIframe = isset($_GET['_render']) && $_GET['_render'] === 'iframe'; diff --git a/application/layouts/scripts/parts/navigation.phtml b/application/layouts/scripts/parts/navigation.phtml index 391b4d1dd..0e47d5358 100644 --- a/application/layouts/scripts/parts/navigation.phtml +++ b/application/layouts/scripts/parts/navigation.phtml @@ -14,7 +14,7 @@ $menu = Menu::fromConfig(); ?>
-

Icinga Users Login

+

translate('Icingaweb Login') ?>

errorInfo)): ?> diff --git a/application/views/scripts/config/module.phtml b/application/views/scripts/config/module.phtml new file mode 100644 index 000000000..ceb14feb2 --- /dev/null +++ b/application/views/scripts/config/module.phtml @@ -0,0 +1,56 @@ +
+tabs ?> +
+
+ +translate('There is no such module installed.') ?> + +getDependencies(); +$restrictions = $module->getProvidedRestrictions(); +$permissions = $module->getProvidedPermissions(); + +?> +

escape($module->getTitle()) ?>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
escape('Name') ?>escape($module->getName()) ?>
escape('Version') ?>escape($module->getVersion()) ?>
escape('Description') ?>escape($module->getDescription())) ?>
escape('Dependencies') ?>translate('This module has no dependencies'); + +else: foreach ($dependencies as $name => $versionString): ?> +escape($name) ?>: escape($versionString) ?>
+
escape('Permissions') ?> +escape($permission->name) ?>: escape($permission->description) ?>
+
escape('Restrictions') ?> +escape($restriction->name) ?>: escape($restriction->description) ?>
+
+ +
diff --git a/application/views/scripts/config/module/show.phtml b/application/views/scripts/config/module/show.phtml deleted file mode 100644 index 51d6ecae3..000000000 --- a/application/views/scripts/config/module/show.phtml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - modules as $module): ?> - - - - - - - -
ModuleTypeActive
diff --git a/application/views/scripts/config/modules.phtml b/application/views/scripts/config/modules.phtml new file mode 100644 index 000000000..b4210d4d4 --- /dev/null +++ b/application/views/scripts/config/modules.phtml @@ -0,0 +1,41 @@ +modules->limit(10); +$modules = $this->modules->paginate(); + +?> +
+tabs->render($this); ?> +
+ +
+

Installed Modules

+ +messageBox)): ?> + messageBox->render() ?> + + +paginationControl($modules, null, null, array( + 'preserve' => $this->preserve +)); +?> + + + + + + + + +
+ enabled): ?> + icon('success.png', 'Module is enabled') ?> + + icon('remove.png', 'Module is disabled') ?> + + escape($module->name); ?> + (enabled ? ($module->loaded ? 'enabled' : 'failed') : 'disabled' ?>) +
+
diff --git a/application/views/scripts/dashboard/index.phtml b/application/views/scripts/dashboard/index.phtml index 8ec851e11..3e721dc68 100644 --- a/application/views/scripts/dashboard/index.phtml +++ b/application/views/scripts/dashboard/index.phtml @@ -1,6 +1,22 @@
tabs ?>
-
-dashboard ?> -
+dashboard): ?> +
+ dashboard ?> +
+ +
+

No dashboard configuration found!

+

+ translate('We tried to load a dashboard configuration with no success.' + . ' Please have look that the configuration does exist:'); + ?> + + + escape($this->configPath) ?>.ini + +

+
+ \ No newline at end of file diff --git a/application/views/scripts/mixedPagination.phtml b/application/views/scripts/mixedPagination.phtml index f6b542855..61055f35d 100644 --- a/application/views/scripts/mixedPagination.phtml +++ b/application/views/scripts/mixedPagination.phtml @@ -12,7 +12,7 @@ if ($this->pageCount <= 1) return; ?>