Fix codestyle, change wrong 'dashboard' parameter to pane causing pane switching to fail
- Fixed concatenation - Added license header where missing - Fixed the index controller fetching the wrong parameter ('dashboard' instead of 'pane') refs #4192
This commit is contained in:
parent
237f7f1e60
commit
886da7d0cb
|
@ -1,4 +1,31 @@
|
|||
<?php
|
||||
// @codingStandardsIgnoreStart
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
use Icinga\Web\ActionController;
|
||||
use Icinga\Web\Url;
|
||||
|
@ -94,9 +121,9 @@ class DashboardController extends ActionController
|
|||
{
|
||||
$dashboard = $this->getDashboard();
|
||||
|
||||
if ($this->_getParam('dashboard')) {
|
||||
$dashboardName = $this->_getParam('dashboard');
|
||||
$dashboard->activate($dashboardName);
|
||||
if ($this->_getParam('pane')) {
|
||||
$pane = $this->_getParam('pane');
|
||||
$dashboard->activate($pane);
|
||||
}
|
||||
$this->view->tabs = $dashboard->getTabs();
|
||||
$this->view->tabs->add(
|
||||
|
@ -110,3 +137,5 @@ class DashboardController extends ActionController
|
|||
$this->view->dashboard = $dashboard;
|
||||
}
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreEnd
|
|
@ -1,2 +1,3 @@
|
|||
<h3>Add dashboard URL</h3>
|
||||
<?= $this->form->render($this) ?>
|
||||
|
||||
<?= $this->form->render($this); ?>
|
|
@ -1,3 +1,3 @@
|
|||
<?= $this->tabs->render($this) ?>
|
||||
<?= $this->tabs->render($this); ?>
|
||||
|
||||
<?= $this->dashboard->render($this) ?>
|
||||
<?= $this->dashboard->render($this); ?>
|
|
@ -3,7 +3,7 @@
|
|||
<h4><i class="icon-warning-sign"> </i>Saving dashboard failed</h4>
|
||||
<br/>
|
||||
<p>
|
||||
Your dashboard couldn't be stored (error: "<?= $this->exceptionMessage ?>"). This could have one or more
|
||||
Your dashboard couldn't be stored (error: "<?= $this->exceptionMessage; ?>"). This could have one or more
|
||||
of the following reasons:
|
||||
</p>
|
||||
<ul>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<p>
|
||||
<pre>
|
||||
<code>
|
||||
<?= $this->escape($this->iniConfigurationString) ?>
|
||||
<?= $this->escape($this->iniConfigurationString); ?>
|
||||
</code>
|
||||
</pre>
|
||||
</p>
|
|
@ -127,4 +127,4 @@ class Dimension
|
|||
}
|
||||
return new Dimension(intval($matches[1][0]), $matches[2][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,30 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Web\Widget;
|
||||
|
||||
|
@ -112,7 +138,7 @@ class Dashboard implements Widget
|
|||
// make sure empty dashboards don't cause errors
|
||||
$iniString = trim($this->toIni());
|
||||
if (!$iniString) {
|
||||
$iniString = " ";
|
||||
$iniString = ' ';
|
||||
}
|
||||
if (!@file_put_contents($file, $iniString)) {
|
||||
$error = error_get_last();
|
||||
|
@ -146,13 +172,17 @@ class Dashboard implements Widget
|
|||
/**
|
||||
* Creates a new empty pane with the given title
|
||||
*
|
||||
* @param $title
|
||||
* @param string $title
|
||||
*
|
||||
* @return Dashboard $this
|
||||
*/
|
||||
public function createPane($title)
|
||||
{
|
||||
$pane = new Pane($title);
|
||||
$pane->setTitle($title);
|
||||
$this->addPane($pane);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,30 @@
|
|||
<?php
|
||||
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
namespace Icinga\Web\Widget\Dashboard;
|
||||
|
||||
use Icinga\Util\Dimension;
|
||||
|
@ -149,15 +174,15 @@ EOD;
|
|||
*/
|
||||
public function toIni()
|
||||
{
|
||||
$ini = 'url = "'.$this->url->getRelativeUrl().'"'.PHP_EOL;
|
||||
$ini = 'url = "' . $this->url->getRelativeUrl() . '"' . PHP_EOL;
|
||||
foreach ($this->url->getParams() as $key => $val) {
|
||||
$ini .= $key.' = "'.$val.'"'.PHP_EOL;
|
||||
$ini .= $key.' = "' . $val . '"' . PHP_EOL;
|
||||
}
|
||||
if ($this->height !== null) {
|
||||
$ini .= 'height = "'.((string) $this->height).'"'.PHP_EOL;
|
||||
$ini .= 'height = "' . ((string) $this->height) . '"' . PHP_EOL;
|
||||
}
|
||||
if ($this->width !== null) {
|
||||
$ini .= 'width = "'.((string) $this->width).'"'.PHP_EOL;
|
||||
$ini .= 'width = "' . ((string) $this->width) . '"' . PHP_EOL;
|
||||
}
|
||||
return $ini;
|
||||
}
|
||||
|
@ -194,10 +219,10 @@ EOD;
|
|||
{
|
||||
$style = '';
|
||||
if ($this->height) {
|
||||
$style .= 'height:'.(string) $this->height.';';
|
||||
$style .= 'height:' . (string) $this->height . ';';
|
||||
}
|
||||
if ($this->width) {
|
||||
$style .= 'width:'.(string) $this->width.';';
|
||||
$style .= 'width:' . (string) $this->width . ';';
|
||||
}
|
||||
return $style;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,34 @@
|
|||
<?php
|
||||
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
namespace Icinga\Web\Widget\Dashboard;
|
||||
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use Icinga\Web\Widget\Widget;
|
||||
use Zend_Config;
|
||||
use Zend_View_Abstract;
|
||||
|
@ -70,6 +96,7 @@ class Pane implements Widget
|
|||
* Overwrite the title of this pane
|
||||
*
|
||||
* @param string $title The new title to use for this pane
|
||||
*
|
||||
* @return Pane $this
|
||||
*/
|
||||
public function setTitle($title)
|
||||
|
@ -159,7 +186,7 @@ class Pane implements Widget
|
|||
} elseif (is_string($component) && $url !== null) {
|
||||
$this->components[$component] = new Component($component, $url, $this);
|
||||
} else {
|
||||
throw new ConfigurationError('Invalid component added: '.$component);
|
||||
throw new ConfigurationError('Invalid component added: ' . $component);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -174,14 +201,14 @@ class Pane implements Widget
|
|||
if (empty($this->components)) {
|
||||
return '';
|
||||
}
|
||||
$ini = '['.$this->getName().']'.PHP_EOL.
|
||||
'title = "'.$this->getTitle().'"'.PHP_EOL;
|
||||
$ini = '[' . $this->getName() . ']' . PHP_EOL.
|
||||
'title = "' . $this->getTitle() . '"' . PHP_EOL;
|
||||
|
||||
foreach ($this->components as $title => $component) {
|
||||
// component header
|
||||
$ini .= '['.$this->getName().'.'.$title.']'.PHP_EOL;
|
||||
$ini .= '[' . $this->getName() . '.' . $title . ']' . PHP_EOL;
|
||||
// component content
|
||||
$ini .= $component->toIni().PHP_EOL;
|
||||
$ini .= $component->toIni() . PHP_EOL;
|
||||
}
|
||||
return $ini;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,30 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Web\Widget;
|
||||
|
||||
|
@ -150,7 +176,7 @@ class Tab implements Widget
|
|||
public function __construct(array $properties = array())
|
||||
{
|
||||
foreach ($properties as $name => $value) {
|
||||
$setter = 'set'.ucfirst($name);
|
||||
$setter = 'set' . ucfirst($name);
|
||||
if (method_exists($this, $setter)) {
|
||||
$this->$setter($value);
|
||||
}
|
||||
|
@ -193,7 +219,7 @@ class Tab implements Widget
|
|||
)
|
||||
) . ' ' . $caption;
|
||||
} elseif ($this->iconCls !== null) {
|
||||
$caption = '<i class="icon-'.$this->iconCls.'"></i> ' . $caption;
|
||||
$caption = '<i class="icon-' . $this->iconCls . '"></i> ' . $caption;
|
||||
}
|
||||
if ($this->url !== null) {
|
||||
$tab = $view->qlink(
|
||||
|
@ -206,6 +232,6 @@ class Tab implements Widget
|
|||
$tab = $caption;
|
||||
}
|
||||
|
||||
return '<li '.$class.'>'.$tab.'</li>'.PHP_EOL;
|
||||
return '<li ' . $class . '>' . $tab . '</li>' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,30 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Web\Widget;
|
||||
|
||||
|
|
|
@ -1,4 +1,30 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Web\Widget;
|
||||
|
||||
|
|
Loading…
Reference in New Issue