diff --git a/doc/widgets.md b/doc/widgets.md index 8a8710f20..75d7eedac 100644 --- a/doc/widgets.md +++ b/doc/widgets.md @@ -12,7 +12,7 @@ simple interface, only providing a 'render' method that takes a view and returns public function render(Zend_View_Abstract $view); } -When implementing own Widgets you just have to make sure that your provide this render method. +When implementing own Widgets you just have to make sure that you provide this render method. ## Using widgets @@ -24,7 +24,7 @@ Widgets are normally created in the controller and added to the view: $this->view->myWidget = new MyWidget(); } - The HTML is then rendered in the template using the *render()* method described above. As the '$this' scope in a view is your + The HTML is then rendered in the template using the *render()* method described above. As the '$this' scope in a view is a reference to your current view, you can just pass it to the *render()* method: // in your template @@ -41,7 +41,7 @@ Tab bar, you just have to call: $tabbar = new Tabs(); -**Note** : When using an ActionController, there's already an empty tabs object created unter $this->view->tabs. This is +**Note** : When using an ActionController, there's already an empty tabs object created under $this->view->tabs. This is done in the preDispatch function ### Adding tabs diff --git a/library/Icinga/Web/Controller/ModuleActionController.php b/library/Icinga/Web/Controller/ModuleActionController.php index fccf700b9..1063b7821 100644 --- a/library/Icinga/Web/Controller/ModuleActionController.php +++ b/library/Icinga/Web/Controller/ModuleActionController.php @@ -30,6 +30,7 @@ * Module action controller */ namespace Icinga\Web\Controller; + /** * Base class for all module action controllers * diff --git a/library/Icinga/Web/Url.php b/library/Icinga/Web/Url.php index 6c99fbbdb..061726a68 100644 --- a/library/Icinga/Web/Url.php +++ b/library/Icinga/Web/Url.php @@ -201,8 +201,8 @@ class Url /** * Add a set of parameters to the query part if the keys don't exist yet * - * @param array $params The parameters to add - * @return $this + * @param array $params The parameters to add + * @return self */ public function addParams(array $params) { @@ -210,6 +210,18 @@ class Url return $this; } + /** + * Set and overwrite the given params if one if the same key already exists + * + * @param array $params The parameters to set + * @return self + */ + public function overwriteParams(array $params) + { + $this->params = array_merge($this->params, $params); + return $this; + } + /** * Overwrite the parameters used in the query part * @@ -338,7 +350,8 @@ class Url * Alias for @see Url::getAbsoluteUrl() * @return mixed */ - public function __toString() { + public function __toString() + { return $this->getAbsoluteUrl(); } } diff --git a/library/Icinga/Web/Widget/Dashboard.php b/library/Icinga/Web/Widget/Dashboard.php index 7500246aa..724c5ccb0 100644 --- a/library/Icinga/Web/Widget/Dashboard.php +++ b/library/Icinga/Web/Widget/Dashboard.php @@ -28,16 +28,16 @@ namespace Icinga\Web\Widget; -use Icinga\Application\Icinga; +use \Icinga\Application\Icinga; use \Icinga\Application\Config as IcingaConfig; -use Icinga\Application\Logger; -use Icinga\Exception\ConfigurationError; -use Icinga\Web\Widget\Widget; -use Icinga\Web\Widget\Dashboard\Pane; -use Icinga\Web\Widget\Dashboard\Component as DashboardComponent; +use \Icinga\Application\Logger; +use \Icinga\Exception\ConfigurationError; +use \Icinga\Web\Widget\Widget; +use \Icinga\Web\Widget\Dashboard\Pane; +use \Icinga\Web\Widget\Dashboard\Component as DashboardComponent; -use Icinga\Web\Url; -use Zend_View_Abstract; +use \Icinga\Web\Url; +use \Zend_View_Abstract; /** * Dashboards display multiple views on a single page diff --git a/library/Icinga/Web/Widget/Tab.php b/library/Icinga/Web/Widget/Tab.php index fd923ad72..95f972159 100644 --- a/library/Icinga/Web/Widget/Tab.php +++ b/library/Icinga/Web/Widget/Tab.php @@ -28,9 +28,8 @@ namespace Icinga\Web\Widget; -use Icinga\Exception\ProgrammingError; -use Icinga\Web\Url; -use Zend_View_Abstract; +use \Icinga\Web\Url; +use \Zend_View_Abstract; /** * A single tab, usually used through the tabs widget @@ -45,9 +44,6 @@ use Zend_View_Abstract; * base URL * @property string $urlParams Action URL Parameters * - * @copyright Copyright (c) 2013 Icinga-Web Team - * @author Icinga-Web Team - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License */ class Tab implements Widget { @@ -221,7 +217,7 @@ class Tab implements Widget $caption = ' ' . $caption; } if ($this->url !== null) { - $this->url->addParams($this->urlParams); + $this->url->overwriteParams($this->urlParams); $tab = '' . $caption . ''; } else { $tab = $caption; diff --git a/library/Icinga/Web/Widget/Tabextension/BasketAction.php b/library/Icinga/Web/Widget/Tabextension/BasketAction.php index 8e5fdcd9b..0e6a99d82 100644 --- a/library/Icinga/Web/Widget/Tabextension/BasketAction.php +++ b/library/Icinga/Web/Widget/Tabextension/BasketAction.php @@ -28,8 +28,8 @@ namespace Icinga\Web\Widget\Tabextension; -use Icinga\Web\Widget\Tabs; -use Icinga\Web\Url; +use \Icinga\Web\Widget\Tabs; +use \Icinga\Web\Url; /** * Tabextension that adds the basket command @@ -43,13 +43,16 @@ class BasketAction implements Tabextension */ public function apply(Tabs $tabs) { - $tabs->addAsDropdown('basket', array( - 'title' => 'URL Basket', - 'icon' => 'img/classic/basket.png', - 'url' => Url::fromPath('basket/add'), - 'urlParams' => array( - 'url' => Url::fromRequest()->getRelativeUrl() + $tabs->addAsDropdown( + 'basket', + array( + 'title' => 'URL Basket', + 'icon' => 'img/classic/basket.png', + 'url' => Url::fromPath('basket/add'), + 'urlParams' => array( + 'url' => Url::fromRequest()->getRelativeUrl() + ) ) - )); + ); } -} \ No newline at end of file +} diff --git a/library/Icinga/Web/Widget/Tabextension/DashboardAction.php b/library/Icinga/Web/Widget/Tabextension/DashboardAction.php index cd5227628..9b5fe3865 100644 --- a/library/Icinga/Web/Widget/Tabextension/DashboardAction.php +++ b/library/Icinga/Web/Widget/Tabextension/DashboardAction.php @@ -28,10 +28,10 @@ namespace Icinga\Web\Widget\Tabextension; -use Icinga\Web\Url; -use Icinga\Config\Config as IcingaConfig; -use Icinga\Web\Widget\Tabs; -use Icinga\Web\Widget\Dashboard; +use \Icinga\Web\Url; +use \Icinga\Config\Config as IcingaConfig; +use \Icinga\Web\Widget\Tabs; +use \Icinga\Web\Widget\Dashboard; /** * Tabextension that allows to add the current URL to a dashboard @@ -41,6 +41,9 @@ use Icinga\Web\Widget\Dashboard; class DashboardAction implements Tabextension { /** + * Applies the dashboard actions to the provided tabset + * + * @param Tabs The tabs object to extend with * @see Tabextension::apply() */ public function apply(Tabs $tabs) diff --git a/library/Icinga/Web/Widget/Tabextension/OutputFormat.php b/library/Icinga/Web/Widget/Tabextension/OutputFormat.php index d84f0d7e8..cbc2a72e4 100644 --- a/library/Icinga/Web/Widget/Tabextension/OutputFormat.php +++ b/library/Icinga/Web/Widget/Tabextension/OutputFormat.php @@ -117,6 +117,10 @@ class OutputFormat implements Tabextension } /** + * Applies the format selectio to the provided tabset + * + * @param Tabs The tabs object to extend with + * * @see Tabextension::apply() */ public function apply(Tabs $tabs) @@ -125,4 +129,4 @@ class OutputFormat implements Tabextension $tabs->addAsDropdown($tab->getName(), $tab); } } -} \ No newline at end of file +} diff --git a/library/Icinga/Web/Widget/Tabextension/Tabextension.php b/library/Icinga/Web/Widget/Tabextension/Tabextension.php index b301039a8..edf26518d 100644 --- a/library/Icinga/Web/Widget/Tabextension/Tabextension.php +++ b/library/Icinga/Web/Widget/Tabextension/Tabextension.php @@ -28,7 +28,7 @@ namespace Icinga\Web\Widget\Tabextension; -use Icinga\Web\Widget\Tabs; +use \Icinga\Web\Widget\Tabs; /** * Tabextension interface that allows to extend a tabbar with reusable components. diff --git a/library/Icinga/Web/Widget/Tabs.php b/library/Icinga/Web/Widget/Tabs.php index 0ffe3e273..2596cc6e5 100644 --- a/library/Icinga/Web/Widget/Tabs.php +++ b/library/Icinga/Web/Widget/Tabs.php @@ -28,11 +28,11 @@ namespace Icinga\Web\Widget; -use Icinga\Exception\ProgrammingError; -use Icinga\Web\Widget\Tabextension\Tabextension; -use Zend_View_Abstract; +use \Icinga\Exception\ProgrammingError; +use \Icinga\Web\Widget\Tabextension\Tabextension; +use \Zend_View_Abstract; -use Countable; +use \Countable; /** * Navigation tab widget diff --git a/modules/monitoring/application/controllers/SummaryController.php b/modules/monitoring/application/controllers/SummaryController.php index 23c1d6422..5f4699385 100644 --- a/modules/monitoring/application/controllers/SummaryController.php +++ b/modules/monitoring/application/controllers/SummaryController.php @@ -90,6 +90,5 @@ class Monitoring_SummaryController extends ModuleActionController $this->view->summary = $query->paginate(); } - } // @codingStandardsIgnoreEnd diff --git a/public/js/icinga/components/mainDetail.js b/public/js/icinga/components/mainDetail.js index 359f2d925..b6aa160d8 100755 --- a/public/js/icinga/components/mainDetail.js +++ b/public/js/icinga/components/mainDetail.js @@ -87,9 +87,7 @@ var onLinkTagClick = function(ev) { '.layout-main-detail * a' : { 'click' : onLinkTagClick }, -/* 'a' : { - 'click' : onOuterLinkClick - },*/ + '.layout-main-detail .icinga-container#icinga-detail' : { 'focus' : expandDetailView } diff --git a/test/php/library/Icinga/Web/RequestMock.php b/test/php/library/Icinga/Web/RequestMock.php index fca867b13..cc9414712 100644 --- a/test/php/library/Icinga/Web/RequestMock.php +++ b/test/php/library/Icinga/Web/RequestMock.php @@ -86,4 +86,4 @@ class RequestMock { return $this->query; } -} \ No newline at end of file +} diff --git a/test/php/library/Icinga/Web/ViewMock.php b/test/php/library/Icinga/Web/ViewMock.php index 68a413cc3..85061177d 100644 --- a/test/php/library/Icinga/Web/ViewMock.php +++ b/test/php/library/Icinga/Web/ViewMock.php @@ -1,4 +1,5 @@