-
data-icinga-module="" data-icinga-url="" style="display: block"> +
data-icinga-module="" data-icinga-url="without('renderLayout') ?>" style="display: block"> render('inline.phtml') ?>
From 17b64f9dd5098c1f7d73b1134970d4e8bb813104 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Aug 2014 10:13:19 +0200 Subject: [PATCH 106/131] layout: add favicon fixes #6956 --- application/layouts/scripts/layout.phtml | 1 + public/img/favicon.png | Bin 0 -> 451 bytes 2 files changed, 1 insertion(+) create mode 100644 public/img/favicon.png diff --git a/application/layouts/scripts/layout.phtml b/application/layouts/scripts/layout.phtml index b4fd504ed..765873c02 100644 --- a/application/layouts/scripts/layout.phtml +++ b/application/layouts/scripts/layout.phtml @@ -44,6 +44,7 @@ $iframeClass = $isIframe ? ' iframe' : ''; + diff --git a/public/img/favicon.png b/public/img/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..6d6f713986903f1ab05631fdeba40bd5aa433d27 GIT binary patch literal 451 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XECYN(Tvg;1{{R1Pq^mcne}b>4*T;_^qr)SvUA<~=Z8NdI zzooJ1#PQ=#9zV`VP20V5XIXK{+SRM)&z%d@a^;b83(yeZk|4ieAQufVY^uG(!N9=C z=;`7ZQgN$iGAG|*1s;}-XL)!2`hWb|l*JtmQQjVmY@2g(KK>GHYIio|Es>mXc-OVJ z!DBE1_kBYs!znukC5cxl;Rk|kQyjlnFh)dbXs3$^ zD`*~`^x%h7lC*-dM)QmBwl%^V6ryVx#|1*4HKL{#+L2&`L>w3hB3ij zIa_Tn>mj)XTuaW*4CJ*?Kkri*azLM9V(UYK&9 zwcsv;%}&1TsVdFx3Mz%mbaGqF6;4mzeD4M0UIvSY$CXTT*WIx&3jJi#sJ*s5%Kvxp gzw3L>e-uk#C{W~+XO_F201PVzPgg&ebxsLQ0Ka>@YXATM literal 0 HcmV?d00001 From f67d273bbdca6a77fc2ee66e936a6b90869b3a66 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Aug 2014 10:14:46 +0200 Subject: [PATCH 107/131] AuthenticationController: handle redirect parameter This is a form field instead of a get parameter right now. fixes #6584 --- .../controllers/AuthenticationController.php | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/application/controllers/AuthenticationController.php b/application/controllers/AuthenticationController.php index 7d4864d5a..a6a5345ed 100644 --- a/application/controllers/AuthenticationController.php +++ b/application/controllers/AuthenticationController.php @@ -35,12 +35,17 @@ class AuthenticationController extends ActionController public function loginAction() { $auth = $this->Auth(); - $this->view->form = new LoginForm(); - $this->view->form->setRequest($this->_request); + $this->view->form = $form = new LoginForm(); + $form->setRequest($this->_request); $this->view->title = $this->translate('Icingaweb Login'); try { - $redirectUrl = Url::fromPath($this->params->get('redirect', 'dashboard')); + $redirectUrl = $this->view->form->getValue('redirect'); + if ($redirectUrl) { + $redirectUrl = Url::fromPath($redirectUrl); + } else { + $redirectUrl = Url::fromPath('dashboard'); + } if ($auth->isAuthenticated()) { $this->rerenderLayout()->redirectNow($redirectUrl); @@ -72,12 +77,20 @@ class AuthenticationController extends ActionController } } } - } elseif ($this->view->form->isSubmittedAndValid()) { - $user = new User($this->view->form->getValue('username')); - $password = $this->view->form->getValue('password'); + } elseif ($form->isSubmittedAndValid()) { + $user = new User($form->getValue('username')); + $password = $form->getValue('password'); $backendsTried = 0; $backendsWithError = 0; + $redirectUrl = $form->getValue('redirect'); + + if ($redirectUrl) { + $redirectUrl = Url::fromPath($redirectUrl); + } else { + $redirectUrl = Url::fromPath('dashboard'); + } + foreach ($chain as $backend) { if ($backend instanceof AutoLoginBackend) { continue; @@ -112,14 +125,14 @@ class AuthenticationController extends ActionController ); } if ($backendsWithError) { - $this->view->form->addNote( + $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')); + $form->getElement('password')->addError($this->translate('Incorrect username or password')); } } catch (Exception $e) { $this->view->errorInfo = $e->getMessage(); From 5c52e447f5d01df93c8e101848193384a9373e2f Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 19 Aug 2014 10:26:38 +0200 Subject: [PATCH 108/131] doc: upper case first character of a documentation's title refs #4820 --- modules/doc/application/views/scripts/toc.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/doc/application/views/scripts/toc.phtml b/modules/doc/application/views/scripts/toc.phtml index 8ffe2820d..7e92a6b26 100644 --- a/modules/doc/application/views/scripts/toc.phtml +++ b/modules/doc/application/views/scripts/toc.phtml @@ -1,5 +1,5 @@
-

translate('Documentation'); ?>

+

translate(sprintf('%s Documentation', ucfirst($docName))); ?>

render($this, $this->getHelper('Url')); ?> From a38d71f17c652720f5887fc8cfe843edd7e305c3 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Aug 2014 10:27:26 +0200 Subject: [PATCH 109/131] Cli\Command: provide Config() This makes it feel more like action controllers fixes #6954 --- library/Icinga/Cli/Command.php | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/library/Icinga/Cli/Command.php b/library/Icinga/Cli/Command.php index 081be318c..acb2462e4 100644 --- a/library/Icinga/Cli/Command.php +++ b/library/Icinga/Cli/Command.php @@ -7,6 +7,7 @@ namespace Icinga\Cli; use Icinga\Cli\Screen; use Icinga\Util\Translator; use Icinga\Cli\Params; +use Icinga\Application\Config; use Icinga\Application\ApplicationBootstrap as App; use Exception; @@ -23,6 +24,10 @@ abstract class Command protected $commandName; protected $actionName; + private $config; + + private $configs; + protected $defaultActionName = 'default'; public function __construct(App $app, $moduleName, $commandName, $actionName, $initialize = true) @@ -41,6 +46,51 @@ abstract class Command } } + public function Config($file = null) + { + if ($this->isModule()) { + return $this->getModuleConfig($file); + } else { + return $this->getMainConfig($file); + } + } + + private function getModuleConfig($file = null) + { + if ($file === null) { + if ($this->config === null) { + $this->config = Config::module($this->moduleName); + } + return $this->config; + } else { + if (! array_key_exists($file, $this->configs)) { + $this->configs[$file] = Config::module($this->moduleName, $file); + } + return $this->configs[$file]; + } + } + + private function getMainConfig($file = null) + { + if ($file === null) { + if ($this->config === null) { + $this->config = Config::app(); + } + return $this->config; + } else { + if (! array_key_exists($file, $this->configs)) { + $this->configs[$file] = Config::module($module, $file); + } + return $this->configs[$file]; + } + return $this->config; + } + + public function isModule() + { + return substr(get_class($this), 0, 14) === 'Icinga\\Module\\'; + } + public function setParams(Params $params) { $this->params = $params; From c69af6c5d2f72e6c3d93bc94703935ce7426dbf1 Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Tue, 19 Aug 2014 11:10:01 +0200 Subject: [PATCH 110/131] Move "modules" to "System" menu resolves #6934 --- .vagrant-puppet/files/etc/icingaweb/menu.ini | 7 ++++++- application/controllers/ConfigController.php | 3 --- config/menu.ini | 7 ++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.vagrant-puppet/files/etc/icingaweb/menu.ini b/.vagrant-puppet/files/etc/icingaweb/menu.ini index f01ebaecc..d6f342655 100644 --- a/.vagrant-puppet/files/etc/icingaweb/menu.ini +++ b/.vagrant-puppet/files/etc/icingaweb/menu.ini @@ -18,10 +18,15 @@ title = "Configuration" url = "config" priority = 300 +[System.Modules] +title = "Modules" +url = "config/modules" +priority = 400 + [System.ApplicationLog] title = "Application log" url = "list/applicationlog" -priority = 400 +priority = 500 [Logout] url = "authentication/logout" diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php index 31739c30e..df189f47f 100644 --- a/application/controllers/ConfigController.php +++ b/application/controllers/ConfigController.php @@ -48,9 +48,6 @@ class ConfigController extends BaseConfigController ))->add('logging', array( 'title' => 'Logging', 'url' => 'config/logging' - ))->add('modules', array( - 'title' => 'Modules', - 'url' => 'config/modules' )); } diff --git a/config/menu.ini b/config/menu.ini index 65959c93a..075f4230e 100644 --- a/config/menu.ini +++ b/config/menu.ini @@ -18,10 +18,15 @@ title = "Configuration" url = "config" priority = 300 +[System.Modules] +title = "Modules" +url = "config/modules" +priority = 400 + [System.ApplicationLog] title = "Application log" url = "list/applicationlog" -priority = 400 +priority = 500 [Logout] url = "authentication/logout" From 127e4f444f7536f1bba601c46e2a097bfa03f42c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 19 Aug 2014 11:30:56 +0200 Subject: [PATCH 111/131] doc: show prev chapter, index and next chapter links refs #4820 --- .../controllers/IcingawebController.php | 7 +- .../controllers/ModuleController.php | 1 + .../doc/application/views/scripts/toc.phtml | 2 +- modules/doc/library/Doc/DocController.php | 5 +- modules/doc/library/Doc/SectionRenderer.php | 79 ++++++++++++++++++- modules/doc/library/Doc/TocRenderer.php | 2 +- modules/doc/public/css/module.less | 19 +++++ 7 files changed, 108 insertions(+), 7 deletions(-) diff --git a/modules/doc/application/controllers/IcingawebController.php b/modules/doc/application/controllers/IcingawebController.php index 117d6eb0e..967a2b768 100644 --- a/modules/doc/application/controllers/IcingawebController.php +++ b/modules/doc/application/controllers/IcingawebController.php @@ -30,7 +30,12 @@ class Doc_IcingawebController extends DocController 404 ); } - $this->renderChapter(Icinga::app()->getApplicationDir('/../doc'), $chapterId, 'doc/icingaweb/chapter'); + $this->renderChapter( + Icinga::app()->getApplicationDir('/../doc'), + $chapterId, + 'doc/icingaweb/toc', + 'doc/icingaweb/chapter' + ); } /** diff --git a/modules/doc/application/controllers/ModuleController.php b/modules/doc/application/controllers/ModuleController.php index 7429dbdf2..19418a800 100644 --- a/modules/doc/application/controllers/ModuleController.php +++ b/modules/doc/application/controllers/ModuleController.php @@ -102,6 +102,7 @@ class Doc_ModuleController extends DocController $this->renderChapter( $moduleManager->getModuleDir($moduleName, '/doc'), $chapterId, + $this->_helper->url->url(array('moduleName' => $moduleName), 'doc/module/toc'), 'doc/module/chapter', array('moduleName' => $moduleName) ); diff --git a/modules/doc/application/views/scripts/toc.phtml b/modules/doc/application/views/scripts/toc.phtml index 7e92a6b26..3f6c6b37c 100644 --- a/modules/doc/application/views/scripts/toc.phtml +++ b/modules/doc/application/views/scripts/toc.phtml @@ -1,6 +1,6 @@

translate(sprintf('%s Documentation', ucfirst($docName))); ?>

-
+
render($this, $this->getHelper('Url')); ?>
diff --git a/modules/doc/library/Doc/DocController.php b/modules/doc/library/Doc/DocController.php index 16824ce0c..88beeee96 100644 --- a/modules/doc/library/Doc/DocController.php +++ b/modules/doc/library/Doc/DocController.php @@ -13,15 +13,17 @@ class DocController extends ModuleActionController * * @param string $path Path to the documentation * @param string $chapterId ID of the chapter + * @param string $tocUrl * @param string $url * @param array $urlParams */ - protected function renderChapter($path, $chapterId, $url, array $urlParams = array()) + protected function renderChapter($path, $chapterId, $tocUrl, $url, array $urlParams = array()) { $parser = new DocParser($path); $this->view->sectionRenderer = new SectionRenderer( $parser->getDocTree(), SectionRenderer::decodeUrlParam($chapterId), + $tocUrl, $url, $urlParams ); @@ -60,6 +62,7 @@ class DocController extends ModuleActionController $this->view->sectionRenderer = new SectionRenderer( $docTree, null, + null, $url, $urlParams ); diff --git a/modules/doc/library/Doc/SectionRenderer.php b/modules/doc/library/Doc/SectionRenderer.php index bc7bfb742..0f925bafb 100644 --- a/modules/doc/library/Doc/SectionRenderer.php +++ b/modules/doc/library/Doc/SectionRenderer.php @@ -87,6 +87,8 @@ class SectionRenderer extends Renderer */ protected $docTree; + protected $tocUrl; + /** * The URL to replace links with * @@ -120,12 +122,13 @@ class SectionRenderer extends Renderer * * @param DocTree $docTree The documentation tree * @param string|null $chapterId If not null, the chapter ID to filter for + * @param string $tocUrl * @param string $url The URL to replace links with * @param array $urlParams Additional URL parameters * * @throws ChapterNotFoundException If the chapter to filter for was not found */ - public function __construct(DocTree $docTree, $chapterId, $url, array $urlParams) + public function __construct(DocTree $docTree, $chapterId, $tocUrl, $url, array $urlParams) { if ($chapterId !== null) { $filter = new SectionFilterIterator($docTree, $chapterId); @@ -142,6 +145,7 @@ class SectionRenderer extends Renderer parent::__construct($docTree, RecursiveIteratorIterator::SELF_FIRST); } $this->docTree = $docTree; + $this->tocUrl = $tocUrl; $this->url = $url; $this->urlParams = array_map(array($this, 'encodeUrlParam'), $urlParams); $this->parsedown = Parsedown::instance(); @@ -182,9 +186,11 @@ class SectionRenderer extends Renderer * * @param View $view * @param Zend_View_Helper_Url $zendUrlHelper + * @param bool $renderNavigation + * * @return string */ - public function render(View $view, Zend_View_Helper_Url $zendUrlHelper) + public function render(View $view, Zend_View_Helper_Url $zendUrlHelper, $renderNavigation = true) { $callback = new Callback($this->docTree, $view, $zendUrlHelper, $this->url, $this->urlParams); $content = array(); @@ -192,7 +198,7 @@ class SectionRenderer extends Renderer $section = $node->getValue(); /* @var $section \Icinga\Module\Doc\Section */ $content[] = sprintf( - ' %3$s', + '%3$s', Renderer::encodeAnchor($section->getId()), $section->getLevel(), $view->escape($section->getTitle()) @@ -213,6 +219,73 @@ class SectionRenderer extends Renderer $html ); } + if ($renderNavigation) { + foreach ($this->docTree as $chapter) { + if ($chapter->getValue()->getId() === $section->getChapterId()) { + $content[] = ''; + break; + } + } + } return implode("\n", $content); } } diff --git a/modules/doc/library/Doc/TocRenderer.php b/modules/doc/library/Doc/TocRenderer.php index b4ad4228c..4061e80e3 100644 --- a/modules/doc/library/Doc/TocRenderer.php +++ b/modules/doc/library/Doc/TocRenderer.php @@ -9,7 +9,7 @@ use Zend_View_Helper_Url; use Icinga\Web\View; /** - * toc renderer + * TOC renderer */ class TocRenderer extends Renderer { diff --git a/modules/doc/public/css/module.less b/modules/doc/public/css/module.less index 52fff5c32..2676d0f24 100644 --- a/modules/doc/public/css/module.less +++ b/modules/doc/public/css/module.less @@ -31,3 +31,22 @@ code { pre > code { display: inline-block; } + +div.chapter > ul.navigation { + margin: 0; + padding: 0.4em; + text-align: center; + background-color: #888; + + li { + list-style: none; + display: inline; + margin: 0.2em; + padding: 0; + + a { + color: #fff; + text-decoration: none; + } + } +} From 0d3fb9e7a55e66a4cd381acae0004592237f60e4 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Aug 2014 11:35:51 +0200 Subject: [PATCH 112/131] LoginForm: explicitely remove renderLayout Should prevent against rare race conditions. refs #6584 --- application/forms/Authentication/LoginForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/forms/Authentication/LoginForm.php b/application/forms/Authentication/LoginForm.php index f7fc9f22e..0eff8006c 100644 --- a/application/forms/Authentication/LoginForm.php +++ b/application/forms/Authentication/LoginForm.php @@ -17,7 +17,7 @@ class LoginForm extends Form */ protected function create() { - $url = Url::fromRequest(); + $url = Url::fromRequest()->without('renderLayout'); $this->setName('form_login'); $this->addElement('text', 'username', array( From 9ce99bf2800fc54c3cef55678e91bf0c73689829 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Aug 2014 12:22:36 +0200 Subject: [PATCH 113/131] js/helpers: add $.hasAttr Need this for another fix and there is no such jQuery function. As this seems to also be inconsistant across browsers I thought this would definitively be worth a custom jQuery plugin. --- public/js/helpers.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/js/helpers.js b/public/js/helpers.js index 082689e40..416bf1185 100644 --- a/public/js/helpers.js +++ b/public/js/helpers.js @@ -95,6 +95,13 @@ if (!Function.prototype.bind) { 'use strict'; + /* Whether a HTML tag has a specific attribute */ + $.fn.hasAttr = function(name) { + // We have inconsistent behaviour across browsers (false VS undef) + var val = this.attr(name); + return typeof val !== 'undefined' && val !== false; + }; + /* Get class list */ $.fn.classes = function (callback) { From f40ada6c81ef25e1179e899eea1281fe6b132eba Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Aug 2014 12:23:51 +0200 Subject: [PATCH 114/131] js/ui: check whether a link tag has a type The new favicon didn't have such, resulting in JS error when reloading CSS at runtime. --- public/js/icinga/ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/icinga/ui.js b/public/js/icinga/ui.js index e9f3d741c..8ff3733f0 100644 --- a/public/js/icinga/ui.js +++ b/public/js/icinga/ui.js @@ -100,7 +100,7 @@ icinga.logger.info('Reloading CSS'); $('link').each(function() { var $oldLink = $(this); - if ($oldLink.attr('type').indexOf('css') > -1) { + if ($oldLink.hasAttr('type') && $oldLink.attr('type').indexOf('css') > -1) { var $newLink = $oldLink.clone().attr( 'href', icinga.utils.addUrlParams( From 7334716d156b21047e824a806a1cf84a657c06fb Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Aug 2014 12:25:14 +0200 Subject: [PATCH 115/131] favicon: add link type The favicon link tag was missing a type attribute. --- application/layouts/scripts/layout.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/layouts/scripts/layout.phtml b/application/layouts/scripts/layout.phtml index 765873c02..32c4879b4 100644 --- a/application/layouts/scripts/layout.phtml +++ b/application/layouts/scripts/layout.phtml @@ -44,7 +44,7 @@ $iframeClass = $isIframe ? ' iframe' : ''; - + From db3ef8fbd0c598032e3422ff302007c36e60c42a Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Aug 2014 12:28:24 +0200 Subject: [PATCH 116/131] ActionController: remove redirectToLogin default The redirectOnLogin function now doesn't have any predefined default. This also leads to the behaviour that "Logout" will not redirect you anywhere on a new login while "forcibly being logged out" (e.g. by logging out in another browser tab) will bring you back to where you came from. --- .../Web/Controller/ActionController.php | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index d8e340907..13809e83d 100644 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -254,18 +254,23 @@ class ActionController extends Zend_Controller_Action * * @throws \Exception */ - protected function redirectToLogin($afterLogin = '/dashboard') + protected function redirectToLogin($afterLogin = null) { - if (! $afterLogin instanceof Url) { - $afterLogin = Url::fromPath($afterLogin); - } - if ($this->isXhr()) { - $redir = '__SELF__'; - } else { - // TODO: Ignore /? - $redir = $afterLogin->getRelativeUrl(); + $redir = null; + if ($afterLogin !== null) { + if (! $afterLogin instanceof Url) { + $afterLogin = Url::fromPath($afterLogin); + } + if ($this->isXhr()) { + $redir = '__SELF__'; + } else { + // TODO: Ignore /? + $redir = $afterLogin->getRelativeUrl(); + } } + $url = Url::fromPath('authentication/login'); + if ($redir) { $url->setParam('redirect', $redir); } From 3f65f3447d1255284ffb34f7e91dc961389b42e8 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Aug 2014 12:39:53 +0200 Subject: [PATCH 117/131] Web\UrlTest: test should use %20 instead of + We MUST use rawurlencode everywhere to avoid potential conflicts with URLs created on JS side. refs #6604 --- test/php/library/Icinga/Web/UrlTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/php/library/Icinga/Web/UrlTest.php b/test/php/library/Icinga/Web/UrlTest.php index 0eff54e5c..183f33369 100644 --- a/test/php/library/Icinga/Web/UrlTest.php +++ b/test/php/library/Icinga/Web/UrlTest.php @@ -21,7 +21,7 @@ class UrlTest extends BaseTestCase $url = Url::fromRequest(); $this->assertEquals( '/path/to/my/test/url.html?param1=value1&param2=value2', - $url->getAbsoluteUrl(), + $url->getAbsoluteUrl('&'), 'Url::fromRequest does not reassemble the correct url from the global request' ); } @@ -119,7 +119,7 @@ class UrlTest extends BaseTestCase */ public function testWhetherFromPathProperlyRecognizesAndDecodesQueryParameters() { - $url = Url::fromPath('/my/test/url.html?param1=%25arg1¶m2=arg+2' + $url = Url::fromPath('/my/test/url.html?param1=%25arg1¶m2=arg%202' . '¶m3[]=1¶m3[]=2¶m3[]=3¶m4[key1]=val1¶m4[key2]=val2'); $this->assertEquals( From cd825a4e6b5e2c13cc76f038f22ade6c12f30be7 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Aug 2014 12:45:42 +0200 Subject: [PATCH 118/131] tests/ScrollingStyle: adjust, pagination shortened Pagination has been "shortened" some time ago to waste less space, tests now fit the current implementation. fixes #6594 fixes #6595 --- .../Paginator/ScrollingStyle/SlidingWithBorderTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/php/library/Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorderTest.php b/test/php/library/Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorderTest.php index d9eb0b25b..a77dcb553 100644 --- a/test/php/library/Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorderTest.php +++ b/test/php/library/Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorderTest.php @@ -19,8 +19,8 @@ class SlidingwithborderTest extends BaseTestCase $pages = $scrollingStyle->getPages($paginator); $this->assertInternalType('array', $pages); - $this->assertCount(13, $pages); - $this->assertEquals('...', $pages[11]); + $this->assertCount(10, $pages); + $this->assertEquals('...', $pages[8]); } public function testGetPages3() @@ -31,9 +31,9 @@ class SlidingwithborderTest extends BaseTestCase $pages = $scrollingStyle->getPages($paginator); $this->assertInternalType('array', $pages); - $this->assertCount(16, $pages); + $this->assertCount(10, $pages); $this->assertEquals('...', $pages[3]); - $this->assertEquals('...', $pages[14]); + $this->assertEquals('...', $pages[12]); } protected function getPaginatorAdapter() From 2f54ff4797cc321261288e28658c3ef993f44710 Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Tue, 19 Aug 2014 13:17:31 +0200 Subject: [PATCH 119/131] Fix the unrelated tabs resolves #6934 --- application/controllers/ConfigController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php index df189f47f..45be1d3fd 100644 --- a/application/controllers/ConfigController.php +++ b/application/controllers/ConfigController.php @@ -67,7 +67,7 @@ class ConfigController extends BaseConfigController $form->setConfiguration(IcingaConfig::app()); $form->setRequest($this->_request); if ($form->isSubmittedAndValid()) { - if (!$this->writeConfigFile($form->getConfig(), 'config')) { + if (!$this->writeConfigFile($form->getConfig(), 'config')) { return; } Notification::success('New configuration has successfully been stored'); @@ -104,6 +104,11 @@ class ConfigController extends BaseConfigController */ public function modulesAction() { + $this->view->tabs = Widget::create('tabs')->add('modules', array( + 'title' => 'Modules', + 'url' => 'config/modules' + )); + $this->view->tabs->activate('modules'); $this->view->modules = Icinga::app()->getModuleManager()->select() ->from('modules') From d35e0816c96619f6292bce4e8dd8d36220d970d8 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 19 Aug 2014 13:20:46 +0200 Subject: [PATCH 120/131] doc: use `sprintf' in exceptions refs #4820 --- .../application/controllers/ModuleController.php | 4 ++-- modules/doc/library/Doc/DocParser.php | 13 +++++++++---- modules/doc/library/Doc/DocTree.php | 2 +- modules/doc/library/Doc/SectionRenderer.php | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/modules/doc/application/controllers/ModuleController.php b/modules/doc/application/controllers/ModuleController.php index 19418a800..26dac8626 100644 --- a/modules/doc/application/controllers/ModuleController.php +++ b/modules/doc/application/controllers/ModuleController.php @@ -44,13 +44,13 @@ class Doc_ModuleController extends DocController $moduleManager = Icinga::app()->getModuleManager(); if (! $moduleManager->hasInstalled($moduleName)) { throw new Zend_Controller_Action_Exception( - $this->translate('Module') . ' \'' . $moduleName . '\' ' . $this->translate('is not installed'), + $this->translate(sprintf('Module \'%s\' is not installed', $moduleName)), 404 ); } if (! $moduleManager->hasEnabled($moduleName)) { throw new Zend_Controller_Action_Exception( - $this->translate('Module') . ' \'' . $moduleName . '\' ' . $this->translate('is not enabled'), + $this->translate(sprintf('Module \'%s\' is not enabled', $moduleName)), 404 ); } diff --git a/modules/doc/library/Doc/DocParser.php b/modules/doc/library/Doc/DocParser.php index 8fa34ba77..e0311e6ba 100644 --- a/modules/doc/library/Doc/DocParser.php +++ b/modules/doc/library/Doc/DocParser.php @@ -41,19 +41,24 @@ class DocParser { if (! is_dir($path)) { throw new DocException( - mt('doc', 'Documentation directory') . ' \'' . $path . '\' ' . mt('doc', 'does not exist') + mt('doc', sprintf('Documentation directory \'%s\' does not exist', $path)) ); } if (! is_readable($path)) { throw new DocException( - mt('doc', 'Documentation directory') . ' \'' . $path . '\' ' . mt('doc', 'is not readable') + mt('doc', sprintf('Documentation directory \'%s\' is not readable', $path)) ); } $docIterator = new DocIterator($path); if ($docIterator->count() === 0) { throw new DocEmptyException( - mt('doc', 'Documentation directory') . ' \'' . $path . '\' ' - . mt('doc', 'does not contain any non-empty Markdown file (\'.md\' suffix') + mt( + 'doc', + sprintf( + 'Documentation directory \'%s\' does not contain any non-empty Markdown file (\'.md\' suffix)', + $path + ) + ) ); } $this->path = $path; diff --git a/modules/doc/library/Doc/DocTree.php b/modules/doc/library/Doc/DocTree.php index 07a0c5279..4223d8e99 100644 --- a/modules/doc/library/Doc/DocTree.php +++ b/modules/doc/library/Doc/DocTree.php @@ -57,7 +57,7 @@ class DocTree extends Node } if (! isset($this->nodes[$parentId])) { throw new LogicException( - sprintf('Can\'t add child node: there\'s no parent node having the id \'%s\'', $parentId) + mt('doc', sprintf('Can\'t add child node: there\'s no parent node having the id \'%s\'', $parentId)) ); } $this->nodes[$childId] = $this->nodes[$parentId]->appendChild($child); diff --git a/modules/doc/library/Doc/SectionRenderer.php b/modules/doc/library/Doc/SectionRenderer.php index 0f925bafb..fab6d66c4 100644 --- a/modules/doc/library/Doc/SectionRenderer.php +++ b/modules/doc/library/Doc/SectionRenderer.php @@ -134,7 +134,7 @@ class SectionRenderer extends Renderer $filter = new SectionFilterIterator($docTree, $chapterId); if ($filter->count() === 0) { throw new ChapterNotFoundException( - mt('doc', 'Chapter') . ' \'' . $chapterId . '\' ' . mt('doc', 'not found') + mt('doc', sprintf('Chapter \'%s\' not found', $chapterId)) ); } parent::__construct( From 55b3a5384a5e2ed89a974eadc6b454ac14ea5ab8 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 19 Aug 2014 13:38:18 +0200 Subject: [PATCH 121/131] doc: set page title refs #4820 --- modules/doc/application/views/scripts/toc.phtml | 2 +- modules/doc/library/Doc/DocController.php | 3 +++ modules/doc/library/Doc/SectionRenderer.php | 15 ++++++++------- modules/doc/public/css/module.less | 10 ++++++++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/modules/doc/application/views/scripts/toc.phtml b/modules/doc/application/views/scripts/toc.phtml index 3f6c6b37c..ca6283d67 100644 --- a/modules/doc/application/views/scripts/toc.phtml +++ b/modules/doc/application/views/scripts/toc.phtml @@ -1,5 +1,5 @@
-

translate(sprintf('%s Documentation', ucfirst($docName))); ?>

+

render($this, $this->getHelper('Url')); ?> diff --git a/modules/doc/library/Doc/DocController.php b/modules/doc/library/Doc/DocController.php index 88beeee96..66895bfb4 100644 --- a/modules/doc/library/Doc/DocController.php +++ b/modules/doc/library/Doc/DocController.php @@ -27,6 +27,7 @@ class DocController extends ModuleActionController $url, $urlParams ); + $this->view->title = $chapterId; $this->_helper->viewRenderer('chapter', null, true); } @@ -42,7 +43,9 @@ class DocController extends ModuleActionController { $parser = new DocParser($path); $this->view->tocRenderer = new TocRenderer($parser->getDocTree(), $url, $urlParams); + $name = ucfirst($name); $this->view->docName = $name; + $this->view->title = $this->translate(sprintf('%s Documentation', $name)); $this->_helper->viewRenderer('toc', null, true); } diff --git a/modules/doc/library/Doc/SectionRenderer.php b/modules/doc/library/Doc/SectionRenderer.php index fab6d66c4..6281b6d76 100644 --- a/modules/doc/library/Doc/SectionRenderer.php +++ b/modules/doc/library/Doc/SectionRenderer.php @@ -222,7 +222,7 @@ class SectionRenderer extends Renderer if ($renderNavigation) { foreach ($this->docTree as $chapter) { if ($chapter->getValue()->getId() === $section->getChapterId()) { - $content[] = ''; + $content = array_merge($navigation, $content, $navigation); break; } } diff --git a/modules/doc/public/css/module.less b/modules/doc/public/css/module.less index 2676d0f24..d6d0d2a94 100644 --- a/modules/doc/public/css/module.less +++ b/modules/doc/public/css/module.less @@ -48,5 +48,15 @@ div.chapter > ul.navigation { color: #fff; text-decoration: none; } + + &.prev { + padding-right: 0.6em; + border-right: 2px solid #fff; + } + + &.next { + padding-left: 0.6em; + border-left: 2px solid #fff; + } } } From f52b3f7b8c5757c961db958aad9d361e18b40957 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 19 Aug 2014 13:38:34 +0200 Subject: [PATCH 122/131] doc/config: add menu.ini refs #4820 --- config/modules/doc/menu.ini | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 config/modules/doc/menu.ini diff --git a/config/modules/doc/menu.ini b/config/modules/doc/menu.ini new file mode 100644 index 000000000..86889b239 --- /dev/null +++ b/config/modules/doc/menu.ini @@ -0,0 +1,5 @@ +[Documentation] +title = "Documentation" +icon = "img/icons/comment.png" +url = "doc" +priority = 80 From 703509946886e76c5916bfbdc5bee551bbacad75 Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Tue, 19 Aug 2014 14:42:28 +0200 Subject: [PATCH 123/131] Fix the host_unhandled_service_count error fixes #6833 --- modules/monitoring/application/controllers/ListController.php | 1 - modules/monitoring/application/controllers/MultiController.php | 1 - 2 files changed, 2 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index f0cdb2767..7e96ef459 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -94,7 +94,6 @@ class Monitoring_ListController extends Controller 'host_last_check', 'host_last_state_change' => $stateChangeColumn, 'host_notifications_enabled', - // 'host_unhandled_service_count', 'host_unhandled_services', 'host_action_url', 'host_notes_url', diff --git a/modules/monitoring/application/controllers/MultiController.php b/modules/monitoring/application/controllers/MultiController.php index a623dd88b..6459edd59 100644 --- a/modules/monitoring/application/controllers/MultiController.php +++ b/modules/monitoring/application/controllers/MultiController.php @@ -24,7 +24,6 @@ class Monitoring_MultiController extends Controller array( 'host_name', 'host_in_downtime', - 'host_unhandled_service_count', 'host_passive_checks_enabled', 'host_obsessing', 'host_state', From f49a34625e17a189fe528eb7e963d51defd655a2 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Aug 2014 14:53:56 +0200 Subject: [PATCH 124/131] Url\Params: check for QUERY_STRING before using it fixes #6957 --- library/Icinga/Web/UrlParams.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Icinga/Web/UrlParams.php b/library/Icinga/Web/UrlParams.php index fa1b2a7f3..bdf776401 100644 --- a/library/Icinga/Web/UrlParams.php +++ b/library/Icinga/Web/UrlParams.php @@ -352,7 +352,7 @@ class UrlParams public static function fromQueryString($queryString = null) { if ($queryString === null) { - $queryString = $_SERVER['QUERY_STRING']; + $queryString = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''; } $params = new static(); $params->parseQueryString($queryString); From 8c02f140c3937bba60cc0d6fff2a2270de68a995 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 19 Aug 2014 16:22:22 +0200 Subject: [PATCH 125/131] doc: fix translate calls w/ sprintf --- .../application/controllers/ModuleController.php | 4 ++-- modules/doc/library/Doc/DocController.php | 2 +- modules/doc/library/Doc/DocParser.php | 16 ++++++++-------- modules/doc/library/Doc/DocTree.php | 2 +- modules/doc/library/Doc/SectionRenderer.php | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/doc/application/controllers/ModuleController.php b/modules/doc/application/controllers/ModuleController.php index 26dac8626..40913368c 100644 --- a/modules/doc/application/controllers/ModuleController.php +++ b/modules/doc/application/controllers/ModuleController.php @@ -44,13 +44,13 @@ class Doc_ModuleController extends DocController $moduleManager = Icinga::app()->getModuleManager(); if (! $moduleManager->hasInstalled($moduleName)) { throw new Zend_Controller_Action_Exception( - $this->translate(sprintf('Module \'%s\' is not installed', $moduleName)), + sprintf($this->translate('Module \'%s\' is not installed'), $moduleName), 404 ); } if (! $moduleManager->hasEnabled($moduleName)) { throw new Zend_Controller_Action_Exception( - $this->translate(sprintf('Module \'%s\' is not enabled', $moduleName)), + sprintf($this->translate('Module \'%s\' is not enabled'), $moduleName), 404 ); } diff --git a/modules/doc/library/Doc/DocController.php b/modules/doc/library/Doc/DocController.php index 66895bfb4..42f8dce9b 100644 --- a/modules/doc/library/Doc/DocController.php +++ b/modules/doc/library/Doc/DocController.php @@ -45,7 +45,7 @@ class DocController extends ModuleActionController $this->view->tocRenderer = new TocRenderer($parser->getDocTree(), $url, $urlParams); $name = ucfirst($name); $this->view->docName = $name; - $this->view->title = $this->translate(sprintf('%s Documentation', $name)); + $this->view->title = sprintf($this->translate('%s Documentation'), $name); $this->_helper->viewRenderer('toc', null, true); } diff --git a/modules/doc/library/Doc/DocParser.php b/modules/doc/library/Doc/DocParser.php index e0311e6ba..c63532dc1 100644 --- a/modules/doc/library/Doc/DocParser.php +++ b/modules/doc/library/Doc/DocParser.php @@ -41,23 +41,23 @@ class DocParser { if (! is_dir($path)) { throw new DocException( - mt('doc', sprintf('Documentation directory \'%s\' does not exist', $path)) + sprintf(mt('doc', 'Documentation directory \'%s\' does not exist'), $path) ); } if (! is_readable($path)) { throw new DocException( - mt('doc', sprintf('Documentation directory \'%s\' is not readable', $path)) + sprintf(mt('doc', 'Documentation directory \'%s\' is not readable'), $path) ); } $docIterator = new DocIterator($path); if ($docIterator->count() === 0) { throw new DocEmptyException( - mt( - 'doc', - sprintf( - 'Documentation directory \'%s\' does not contain any non-empty Markdown file (\'.md\' suffix)', - $path - ) + sprintf( + mt( + 'doc', + 'Documentation directory \'%s\' does not contain any non-empty Markdown file (\'.md\' suffix)' + ), + $path ) ); } diff --git a/modules/doc/library/Doc/DocTree.php b/modules/doc/library/Doc/DocTree.php index 4223d8e99..1b112649c 100644 --- a/modules/doc/library/Doc/DocTree.php +++ b/modules/doc/library/Doc/DocTree.php @@ -57,7 +57,7 @@ class DocTree extends Node } if (! isset($this->nodes[$parentId])) { throw new LogicException( - mt('doc', sprintf('Can\'t add child node: there\'s no parent node having the id \'%s\'', $parentId)) + sprintf(mt('doc', 'Can\'t add child node: there\'s no parent node having the id \'%s\''), $parentId) ); } $this->nodes[$childId] = $this->nodes[$parentId]->appendChild($child); diff --git a/modules/doc/library/Doc/SectionRenderer.php b/modules/doc/library/Doc/SectionRenderer.php index 6281b6d76..938e5ed7b 100644 --- a/modules/doc/library/Doc/SectionRenderer.php +++ b/modules/doc/library/Doc/SectionRenderer.php @@ -134,7 +134,7 @@ class SectionRenderer extends Renderer $filter = new SectionFilterIterator($docTree, $chapterId); if ($filter->count() === 0) { throw new ChapterNotFoundException( - mt('doc', sprintf('Chapter \'%s\' not found', $chapterId)) + sprintf(mt('doc', 'Chapter \'%s\' not found'), $chapterId) ); } parent::__construct( From 995355ec30f0879b26bebf82b88636369dfc2685 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 19 Aug 2014 16:29:11 +0200 Subject: [PATCH 126/131] lib/Limiter: fix translate w/ sprintf --- library/Icinga/Web/Widget/Limiter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Icinga/Web/Widget/Limiter.php b/library/Icinga/Web/Widget/Limiter.php index 9c6a726ba..5afa7e4b8 100644 --- a/library/Icinga/Web/Widget/Limiter.php +++ b/library/Icinga/Web/Widget/Limiter.php @@ -81,7 +81,7 @@ class Limiter extends AbstractWidget $this->url->setParam('limit', $limit), null, array( - 'title' => t(sprintf('Show %s rows on one page', $caption)) + 'title' => sprintf(t('Show %s rows on one page'), $caption) ) ); } From 6fe47bf5b0bae7b6654c08e3c74be73adf32f9d8 Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Tue, 19 Aug 2014 17:30:56 +0200 Subject: [PATCH 127/131] Fix rows highlighting after refresh fixes #6705 --- modules/monitoring/application/views/scripts/list/hosts.phtml | 2 +- .../monitoring/application/views/scripts/list/services.phtml | 2 +- public/js/icinga/events.js | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index a6056e149..6af1181e4 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -109,7 +109,7 @@ if ($hosts->count() === 0) { - host_name ?> diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index f2da63dca..9e9e8d725 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -99,7 +99,7 @@ foreach ($services as $service): service_icon_image && ! preg_match('/[\'"]/', $service->service_icon_image)): ?> icon($this->resolveMacros($service->service_icon_image, $service)) ?> -service_display_name ?>showHost): ?> on host_name; ?> +service_display_name ?>showHost): ?> on host_name; ?> host_state != 0): ?> (monitoringState($service, 'host')); ?>) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index 6c6978577..5328d20aa 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -134,6 +134,7 @@ // Select a table row $(document).on('click', 'table.multiselect tr[href]', { self: this }, this.rowSelected); + $(document).on('click', 'table.multiselect .select-click', { self: this }, this.rowSelected); $(document).on('click', 'button', { self: this }, this.submitForm); @@ -400,7 +401,7 @@ rowSelected: function(event) { var self = event.data.self; var icinga = self.icinga; - var $tr = $(this); + var $tr = $(this).closest('tr'); var $table = $tr.closest('table.multiselect'); var data = self.icinga.ui.getSelectionKeys($table); var url = $table.data('icinga-multiselect-url'); From ba748cbc4af084c02ffd719930b9b91f103db58e Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Tue, 19 Aug 2014 18:33:28 +0200 Subject: [PATCH 128/131] Refactor multiSelect and highlight refs #6705 --- .../views/scripts/list/hosts.phtml | 2 +- .../views/scripts/list/services.phtml | 2 +- public/js/icinga/events.js | 26 ++++++++++++++----- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 6af1181e4..a6056e149 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -109,7 +109,7 @@ if ($hosts->count() === 0) { - compact ? $hostLink : $this->href( 'monitoring/show/host', array('host' => $host->host_name) ) ?>">host_name ?> diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 9e9e8d725..f2da63dca 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -99,7 +99,7 @@ foreach ($services as $service): service_icon_image && ! preg_match('/[\'"]/', $service->service_icon_image)): ?> icon($this->resolveMacros($service->service_icon_image, $service)) ?> -service_display_name ?>showHost): ?> on host_name; ?> +service_display_name ?>showHost): ?> on host_name; ?> host_state != 0): ?> (monitoringState($service, 'host')); ?>) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index 5328d20aa..790d245c3 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -134,7 +134,6 @@ // Select a table row $(document).on('click', 'table.multiselect tr[href]', { self: this }, this.rowSelected); - $(document).on('click', 'table.multiselect .select-click', { self: this }, this.rowSelected); $(document).on('click', 'button', { self: this }, this.submitForm); @@ -475,12 +474,20 @@ return true; } - // Ignore clicks on multiselect table inner links while key pressed - if ((event.ctrlKey || event.metaKey || event.shiftKey) && - ! $a.is('tr[href]') && $a.closest('table.multiselect').length > 0 && - $a.closest('tr[href]').length > 0) - { - return self.rowSelected.call($a.closest('tr[href]'), event); + // Special checks for link clicks in multiselect rows + if (! $a.is('tr[href]') && $a.closest('tr[href]').length > 0 && $a.closest('table.multiselect').length > 0) { + + // Forward clicks to ANY link with special key pressed to rowSelected + if (event.ctrlKey || event.metaKey || event.shiftKey) + { + return self.rowSelected.call($a.closest('tr[href]'), event); + } + + // Forward inner links matching the row URL to rowSelected + if ($a.attr('href') === $a.closest('tr[href]').attr('href')) + { + return self.rowSelected.call($a.closest('tr[href]'), event); + } } // Let remote links pass through @@ -494,6 +501,11 @@ return false; } + // ignore multiselect table row clicks + if ($a.closest('tr[href]').length > 0 && $a.closest('table.action').length > 0) { + return; + } + // ignore multiselect table row clicks if ($a.is('tr') && $a.closest('table.multiselect').length > 0) { return; From 736113c80cb78aabd16a05eecb9a6f1a92a805fd Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Aug 2014 18:55:58 +0200 Subject: [PATCH 129/131] AuthenticationController: show friendlier hints... ...while not disclosing sensitive information. More to come once we have our setup wizard. fixes #6534 --- .../controllers/AuthenticationController.php | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/application/controllers/AuthenticationController.php b/application/controllers/AuthenticationController.php index a6a5345ed..4b43ed71b 100644 --- a/application/controllers/AuthenticationController.php +++ b/application/controllers/AuthenticationController.php @@ -54,13 +54,9 @@ class AuthenticationController extends ActionController 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( - t( - 'No authentication methods available. Authentication configuration could not be loaded.' - . ' Please check the system log or Icinga Web 2 log for more information' + $this->translate( + 'Could not read your authentiction.ini, no authentication methods are available.' ) ); } @@ -110,25 +106,25 @@ class AuthenticationController extends ActionController } if ($backendsTried === 0) { throw new ConfigurationError( - t( - 'No authentication methods available. It seems that no authentication method has been set' - . ' up. Please check the system log or Icinga Web 2 log for more information' - ) + $this->translate( + 'No authentication methods available. Did you create' + . ' authentication.ini when installing Icinga Web 2?' + ) ); } if ($backendsTried === $backendsWithError) { throw new ConfigurationError( $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' + 'All configured authentication methods failed.' + . ' Please check the system log or Icinga Web 2 log for more information.' ) ); } if ($backendsWithError) { $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' + 'Please note that not all authentication methods where available.' + . ' Check the system log or Icinga Web 2 log for more information.' ) ); } From 686152abf305bd7e4845abfb9edfb9240327ebd1 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Aug 2014 19:04:29 +0200 Subject: [PATCH 130/131] js/events: fix a small bug introduced right now Links on non-multiselect action tables stopped working. refs #6705 --- public/js/icinga/events.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index 790d245c3..eefca7f47 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -400,7 +400,7 @@ rowSelected: function(event) { var self = event.data.self; var icinga = self.icinga; - var $tr = $(this).closest('tr'); + var $tr = $(this); var $table = $tr.closest('table.multiselect'); var data = self.icinga.ui.getSelectionKeys($table); var url = $table.data('icinga-multiselect-url'); @@ -501,11 +501,6 @@ return false; } - // ignore multiselect table row clicks - if ($a.closest('tr[href]').length > 0 && $a.closest('table.action').length > 0) { - return; - } - // ignore multiselect table row clicks if ($a.is('tr') && $a.closest('table.multiselect').length > 0) { return; From 538c6cf90bad5f471963fca41b8d4d12a233b284 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 20 Aug 2014 09:26:16 +0200 Subject: [PATCH 131/131] js/events: ignore button/submit clicks In case you clicked a (submit) button in an action row this also also triggered that row's click handler. As the event is going to be stopped there, this leads to "unsubmittable forms". Fixed. fixes #6963 --- public/js/icinga/events.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index eefca7f47..d04912d0f 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -501,6 +501,12 @@ return false; } + // Ignore form elements in action rows + if ($(event.target).is('input') || $(event.target).is('button')) { + return; + } + + // ignore multiselect table row clicks if ($a.is('tr') && $a.closest('table.multiselect').length > 0) { return;