mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 16:24:04 +02:00
parent
0b479e3796
commit
aff2398c81
@ -4,21 +4,21 @@
|
|||||||
/**
|
/**
|
||||||
* Icinga 2 Web - Head for multiple monitoring frontends
|
* Icinga 2 Web - Head for multiple monitoring frontends
|
||||||
* Copyright (C) 2013 Icinga Development Team
|
* Copyright (C) 2013 Icinga Development Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||||
* @author Icinga Development Team <info@icinga.org>
|
* @author Icinga Development Team <info@icinga.org>
|
||||||
*/
|
*/
|
||||||
@ -26,32 +26,36 @@
|
|||||||
|
|
||||||
# namespace Icinga\Application\Controllers;
|
# namespace Icinga\Application\Controllers;
|
||||||
|
|
||||||
use Icinga\Web\Controller\ActionController;
|
use \Icinga\Web\Controller\ActionController;
|
||||||
use Icinga\Authentication\Credentials;
|
use \Icinga\Authentication\Credentials;
|
||||||
use Icinga\Authentication\Manager as AuthManager;
|
use \Icinga\Authentication\Manager as AuthManager;
|
||||||
use Icinga\Form\Authentication\LoginForm;
|
use \Icinga\Form\Authentication\LoginForm;
|
||||||
|
use \Icinga\Exception\ConfigurationError;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AuthenticationController
|
* Application wide controller for authentication
|
||||||
* @package Icinga\Application\Controllers
|
|
||||||
*/
|
*/
|
||||||
class AuthenticationController extends ActionController
|
class AuthenticationController extends ActionController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Flag indicates authentication handling
|
* This controller handles authentication
|
||||||
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $handlesAuthentication = true;
|
protected $handlesAuthentication = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag indicates session modification
|
* This controller modifies the session
|
||||||
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
|
*
|
||||||
|
* @see \Icinga\Web\Controller\ActionController::$modifiesSession
|
||||||
*/
|
*/
|
||||||
protected $modifiesSession = true;
|
protected $modifiesSession = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to handle login
|
* Log into the application
|
||||||
*/
|
*/
|
||||||
public function loginAction()
|
public function loginAction()
|
||||||
{
|
{
|
||||||
@ -62,7 +66,7 @@ class AuthenticationController extends ActionController
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$auth = AuthManager::getInstance(null, array(
|
$auth = AuthManager::getInstance(null, array(
|
||||||
"writeSession" => true
|
'writeSession' => $this->modifiesSession
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($auth->isAuthenticated()) {
|
if ($auth->isAuthenticated()) {
|
||||||
@ -74,30 +78,28 @@ class AuthenticationController extends ActionController
|
|||||||
$credentials->setPassword($this->view->form->getValue('password'));
|
$credentials->setPassword($this->view->form->getValue('password'));
|
||||||
|
|
||||||
if (!$auth->authenticate($credentials)) {
|
if (!$auth->authenticate($credentials)) {
|
||||||
$this->view->form->getElement('password')->addError(t('Please provide a valid username and password'));
|
$this->view->form->getElement('password')
|
||||||
|
->addError(t('Please provide a valid username and password'));
|
||||||
} else {
|
} else {
|
||||||
$this->redirectNow('index?_render=body');
|
$this->redirectNow('index?_render=body');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Icinga\Exception\ConfigurationError $configError) {
|
} catch (ConfigurationError $configError) {
|
||||||
$this->view->errorInfo = $configError->getMessage();
|
$this->view->errorInfo = $configError->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action handle logout
|
* Log out the current user
|
||||||
*/
|
*/
|
||||||
public function logoutAction()
|
public function logoutAction()
|
||||||
{
|
{
|
||||||
$auth = AuthManager::getInstance(null, array(
|
$auth = AuthManager::getInstance(null, array(
|
||||||
"writeSession" => true
|
'writeSession' => $this->modifiesSession
|
||||||
));
|
));
|
||||||
$this->replaceLayout = true;
|
$this->replaceLayout = true;
|
||||||
$auth->removeAuthorization();
|
$auth->removeAuthorization();
|
||||||
$this->redirect('login');
|
$this->redirect('login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codingStandardsIgnoreEnd
|
// @codingStandardsIgnoreEnd
|
||||||
|
@ -4,67 +4,66 @@
|
|||||||
/**
|
/**
|
||||||
* Icinga 2 Web - Head for multiple monitoring frontends
|
* Icinga 2 Web - Head for multiple monitoring frontends
|
||||||
* Copyright (C) 2013 Icinga Development Team
|
* Copyright (C) 2013 Icinga Development Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||||
* @author Icinga Development Team <info@icinga.org>
|
* @author Icinga Development Team <info@icinga.org>
|
||||||
*/
|
*/
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
use Icinga\Application\Benchmark;
|
use \Icinga\Application\Benchmark;
|
||||||
use Icinga\Authentication\Manager;
|
use \Icinga\Authentication\Manager;
|
||||||
use Icinga\Web\Controller\BaseConfigController;
|
use \Icinga\Web\Controller\BaseConfigController;
|
||||||
use Icinga\Web\Widget\Tab;
|
use \Icinga\Web\Widget\Tab;
|
||||||
use Icinga\Web\Url;
|
use \Icinga\Web\Url;
|
||||||
use Icinga\Web\Hook\Configuration\ConfigurationTabBuilder;
|
use \Icinga\Web\Hook\Configuration\ConfigurationTabBuilder;
|
||||||
use Icinga\Application\Icinga;
|
use \Icinga\Application\Icinga;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application wide controller for application preferences
|
* Application wide controller for application preferences
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class ConfigController extends BaseConfigController
|
class ConfigController extends BaseConfigController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create tabs for this configuration controller
|
* Create tabs for this configuration controller
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @see BaseConfigController::createProvidedTabs
|
*
|
||||||
|
* @see BaseConfigController::createProvidedTabs()
|
||||||
*/
|
*/
|
||||||
public static function createProvidedTabs()
|
public static function createProvidedTabs()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
"index" => new Tab(
|
'index' => new Tab(
|
||||||
array(
|
array(
|
||||||
"name" => "index",
|
'name' => 'index',
|
||||||
"title" => "Configuration",
|
'title' => 'Configuration',
|
||||||
"iconCls" => "wrench",
|
'iconCls' => 'wrench',
|
||||||
"url" => Url::fromPath("/config")
|
'url' => Url::fromPath('/config')
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
"modules" => new Tab(
|
'modules' => new Tab(
|
||||||
array(
|
array(
|
||||||
"name" => "modules",
|
'name' => 'modules',
|
||||||
"title" => "Modules",
|
'title' => 'Modules',
|
||||||
"iconCls" => "puzzle-piece",
|
'iconCls' => 'puzzle-piece',
|
||||||
"url" => Url::fromPath("/config/moduleoverview")
|
'url' => Url::fromPath('/config/moduleoverview')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,7 +94,6 @@ class ConfigController extends BaseConfigController
|
|||||||
$manager = Icinga::app()->getModuleManager();
|
$manager = Icinga::app()->getModuleManager();
|
||||||
$manager->enableModule($this->_getParam('name'));
|
$manager->enableModule($this->_getParam('name'));
|
||||||
$manager->loadModule($this->_getParam('name'));
|
$manager->loadModule($this->_getParam('name'));
|
||||||
|
|
||||||
$this->redirectNow('config/moduleoverview?_render=body');
|
$this->redirectNow('config/moduleoverview?_render=body');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,4 +107,4 @@ class ConfigController extends BaseConfigController
|
|||||||
$this->redirectNow('config/moduleoverview?_render=body');
|
$this->redirectNow('config/moduleoverview?_render=body');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// @codingStandardsIgnoreEnd
|
// @codingStandardsIgnoreEnd
|
||||||
|
@ -27,13 +27,13 @@
|
|||||||
*/
|
*/
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
use Icinga\Web\Controller\ActionController;
|
use \Icinga\Web\Controller\ActionController;
|
||||||
use Icinga\Web\Url;
|
use \Icinga\Web\Url;
|
||||||
use Icinga\Application\Icinga;
|
use \Icinga\Application\Icinga;
|
||||||
use Icinga\Web\Widget\Dashboard;
|
use \Icinga\Web\Widget\Dashboard;
|
||||||
use \Icinga\Application\Config as IcingaConfig;
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
use Icinga\Form\Dashboard\AddUrlForm;
|
use \Icinga\Form\Dashboard\AddUrlForm;
|
||||||
use Icinga\Exception\ConfigurationError;
|
use \Icinga\Exception\ConfigurationError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle creation, removal and displaying of dashboards, panes and components
|
* Handle creation, removal and displaying of dashboards, panes and components
|
||||||
@ -42,13 +42,12 @@ use Icinga\Exception\ConfigurationError;
|
|||||||
*/
|
*/
|
||||||
class DashboardController extends ActionController
|
class DashboardController extends ActionController
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a dashboard from the provided config
|
* Retrieve a dashboard from the provided config
|
||||||
*
|
*
|
||||||
* @param string $config The config to read the dashboard from, or 'dashboard/dashboard' if none is given
|
* @param string $config The config to read the dashboard from, or 'dashboard/dashboard' if none is given
|
||||||
*
|
*
|
||||||
* @return Dashboard
|
* @return \Icinga\Web\Widget\Dashboard
|
||||||
*/
|
*/
|
||||||
private function getDashboard($config = 'dashboard/dashboard')
|
private function getDashboard($config = 'dashboard/dashboard')
|
||||||
{
|
{
|
||||||
@ -59,7 +58,6 @@ class DashboardController extends ActionController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a component from the pane identified by the 'pane' parameter
|
* Remove a component from the pane identified by the 'pane' parameter
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function removecomponentAction()
|
public function removecomponentAction()
|
||||||
{
|
{
|
||||||
@ -72,24 +70,20 @@ class DashboardController extends ActionController
|
|||||||
)->store();
|
)->store();
|
||||||
$this->redirectNow(Url::fromPath('dashboard', array('pane' => $pane)));
|
$this->redirectNow(Url::fromPath('dashboard', array('pane' => $pane)));
|
||||||
} catch (ConfigurationError $exc ) {
|
} catch (ConfigurationError $exc ) {
|
||||||
|
|
||||||
$this->_helper->viewRenderer('show_configuration');
|
$this->_helper->viewRenderer('show_configuration');
|
||||||
$this->view->exceptionMessage = $exc->getMessage();
|
$this->view->exceptionMessage = $exc->getMessage();
|
||||||
$this->view->iniConfigurationString = $dashboard->toIni();
|
$this->view->iniConfigurationString = $dashboard->toIni();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the form for adding new components or add the new component if submitted
|
* Display the form for adding new components or add the new component if submitted
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function addurlAction()
|
public function addurlAction()
|
||||||
{
|
{
|
||||||
$form = new AddUrlForm();
|
$form = new AddUrlForm();
|
||||||
$form->setRequest($this->_request);
|
$form->setRequest($this->_request);
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
|
|
||||||
if ($form->isSubmittedAndValid()) {
|
if ($form->isSubmittedAndValid()) {
|
||||||
$dashboard = $this->getDashboard();
|
$dashboard = $this->getDashboard();
|
||||||
$dashboard->setComponentUrl(
|
$dashboard->setComponentUrl(
|
||||||
@ -115,12 +109,10 @@ class DashboardController extends ActionController
|
|||||||
*
|
*
|
||||||
* If no pane is submitted or the submitted one doesn't exist, the default pane is
|
* If no pane is submitted or the submitted one doesn't exist, the default pane is
|
||||||
* displayed (normally the first one)
|
* displayed (normally the first one)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$dashboard = $this->getDashboard();
|
$dashboard = $this->getDashboard();
|
||||||
|
|
||||||
if ($this->_getParam('pane')) {
|
if ($this->_getParam('pane')) {
|
||||||
$pane = $this->_getParam('pane');
|
$pane = $this->_getParam('pane');
|
||||||
$dashboard->activate($pane);
|
$dashboard->activate($pane);
|
||||||
@ -137,5 +129,4 @@ class DashboardController extends ActionController
|
|||||||
$this->view->dashboard = $dashboard;
|
$this->view->dashboard = $dashboard;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
// @codingStandardsIgnoreEnd
|
|
||||||
|
@ -4,21 +4,21 @@
|
|||||||
/**
|
/**
|
||||||
* Icinga 2 Web - Head for multiple monitoring frontends
|
* Icinga 2 Web - Head for multiple monitoring frontends
|
||||||
* Copyright (C) 2013 Icinga Development Team
|
* Copyright (C) 2013 Icinga Development Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||||
* @author Icinga Development Team <info@icinga.org>
|
* @author Icinga Development Team <info@icinga.org>
|
||||||
*/
|
*/
|
||||||
@ -26,21 +26,19 @@
|
|||||||
|
|
||||||
# namespace Icinga\Application\Controllers;
|
# namespace Icinga\Application\Controllers;
|
||||||
|
|
||||||
use Icinga\Web\Controller\ActionController;
|
use \Icinga\Web\Controller\ActionController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ErrorController
|
* Application wide controller for displaying exceptions
|
||||||
* @package Icinga\Application\Controllers
|
|
||||||
*/
|
*/
|
||||||
class ErrorController extends ActionController
|
class ErrorController extends ActionController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
* Display exception
|
||||||
*/
|
*/
|
||||||
public function errorAction()
|
public function errorAction()
|
||||||
{
|
{
|
||||||
$errors = $this->_getParam('error_handler');
|
$errors = $this->_getParam('error_handler');
|
||||||
|
|
||||||
switch ($errors->type) {
|
switch ($errors->type) {
|
||||||
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
|
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
|
||||||
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
|
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
|
||||||
@ -59,9 +57,7 @@ class ErrorController extends ActionController
|
|||||||
if ($this->getInvokeArg('displayExceptions') == true) {
|
if ($this->getInvokeArg('displayExceptions') == true) {
|
||||||
$this->view->exception = $errors->exception;
|
$this->view->exception = $errors->exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->request = $errors->request;
|
$this->view->request = $errors->request;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codingStandardsIgnoreEnd
|
// @codingStandardsIgnoreEnd
|
||||||
|
@ -29,22 +29,16 @@
|
|||||||
|
|
||||||
# namespace Icinga\Application\Controllers;
|
# namespace Icinga\Application\Controllers;
|
||||||
|
|
||||||
use Icinga\Web\Controller\ActionController;
|
use \Icinga\Web\Controller\ActionController;
|
||||||
use Icinga\Application\Icinga;
|
use \Icinga\Application\Icinga;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class IndexController
|
* Application wide index controller
|
||||||
*/
|
*/
|
||||||
class IndexController extends ActionController
|
class IndexController extends ActionController
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* Always authenticate
|
||||||
*/
|
|
||||||
protected $modifiesSession = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function preDispatch()
|
public function preDispatch()
|
||||||
{
|
{
|
||||||
@ -55,11 +49,10 @@ class IndexController extends ActionController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Application's start page
|
||||||
*/
|
*/
|
||||||
public function welcomeAction()
|
public function welcomeAction()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codingStandardsIgnoreEnd
|
// @codingStandardsIgnoreEnd
|
||||||
|
@ -3,24 +3,24 @@
|
|||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
/**
|
/**
|
||||||
* This file is part of Icinga 2 Web.
|
* This file is part of Icinga 2 Web.
|
||||||
*
|
*
|
||||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||||
* Copyright (C) 2013 Icinga Development Team
|
* Copyright (C) 2013 Icinga Development Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||||
* @author Icinga Development Team <info@icinga.org>
|
* @author Icinga Development Team <info@icinga.org>
|
||||||
@ -33,26 +33,25 @@ use \Icinga\Web\Url;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Application wide preference controller for user preferences
|
* Application wide preference controller for user preferences
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class PreferenceController extends BasePreferenceController
|
class PreferenceController extends BasePreferenceController
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create tabs for this preference controller
|
* Create tabs for this preference controller
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @see BasePreferenceController::createProvidedTabs
|
*
|
||||||
|
* @see BasePreferenceController::createProvidedTabs()
|
||||||
*/
|
*/
|
||||||
public static function createProvidedTabs()
|
public static function createProvidedTabs()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
"preference" => new Tab(
|
'preference' => new Tab(
|
||||||
array(
|
array(
|
||||||
"name" => "preferences",
|
'name' => 'preferences',
|
||||||
"iconCls" => "user",
|
'iconCls' => 'user',
|
||||||
"title" => "Preferences",
|
'title' => 'Preferences',
|
||||||
"url" => Url::fromPath("/preference")
|
'url' => Url::fromPath('/preference')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -60,11 +59,10 @@ class PreferenceController extends BasePreferenceController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @TODO: Implement User preferences (feature #5425)
|
* @TODO: Implement User preferences (feature #5425)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// @codingStandardsIgnoreEnd
|
// @codingStandardsIgnoreEnd
|
||||||
|
@ -27,13 +27,15 @@
|
|||||||
*/
|
*/
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
use Icinga\Web\Controller\ActionController;
|
use \Zend_Controller_Action_Exception as ActionException;
|
||||||
use Icinga\Application\Icinga,
|
use \Icinga\Web\Controller\ActionController;
|
||||||
Zend_Controller_Action_Exception as ActionException;
|
use \Icinga\Application\Icinga;
|
||||||
|
|
||||||
class StaticController extends ActionController
|
class StaticController extends ActionController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @TODO: Bug #4572
|
||||||
|
*/
|
||||||
protected $handlesAuthentication = true;
|
protected $handlesAuthentication = true;
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
@ -45,11 +47,10 @@ class StaticController extends ActionController
|
|||||||
private function getModuleList()
|
private function getModuleList()
|
||||||
{
|
{
|
||||||
$modules = Icinga::app()->getModuleManager()->getLoadedModules();
|
$modules = Icinga::app()->getModuleManager()->getLoadedModules();
|
||||||
|
|
||||||
// preliminary static definition
|
// preliminary static definition
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach ($modules as $name => $module) {
|
foreach ($modules as $name => $module) {
|
||||||
$hasJs = file_exists($module->getBasedir() . "/public/js/$name.js");
|
$hasJs = file_exists($module->getBasedir() . '/public/js/' . $name . '.js');
|
||||||
$result[] = array(
|
$result[] = array(
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'active' => true,
|
'active' => true,
|
||||||
@ -62,11 +63,10 @@ class StaticController extends ActionController
|
|||||||
|
|
||||||
public function modulelistAction()
|
public function modulelistAction()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->_helper->viewRenderer->setNoRender(true);
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
$this->_helper->layout()->disableLayout();
|
$this->_helper->layout()->disableLayout();
|
||||||
$this->getResponse()->setHeader("Content-Type","application/json");
|
$this->getResponse()->setHeader('Content-Type', 'application/json');
|
||||||
echo "define(function() { return ".json_encode($this->getModuleList(),true)."; })";
|
echo 'define(function() { return ' . json_encode($this->getModuleList(), true) . '; })';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ class StaticController extends ActionController
|
|||||||
{
|
{
|
||||||
$module = $this->_getParam('module_name');
|
$module = $this->_getParam('module_name');
|
||||||
$file = $this->_getParam('file');
|
$file = $this->_getParam('file');
|
||||||
|
|
||||||
$basedir = Icinga::app()->getModuleManager()->getModule($module)->getBaseDir();
|
$basedir = Icinga::app()->getModuleManager()->getModule($module)->getBaseDir();
|
||||||
|
|
||||||
$filePath = $basedir . '/public/img/' . $file;
|
$filePath = $basedir . '/public/img/' . $file;
|
||||||
@ -112,14 +112,14 @@ class StaticController extends ActionController
|
|||||||
$file = $this->_getParam('file');
|
$file = $this->_getParam('file');
|
||||||
|
|
||||||
if (!Icinga::app()->getModuleManager()->hasEnabled($module)) {
|
if (!Icinga::app()->getModuleManager()->hasEnabled($module)) {
|
||||||
echo "/** Module not enabled **/";
|
echo '/** Module not enabled **/';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$basedir = Icinga::app()->getModuleManager()->getModule($module)->getBaseDir();
|
$basedir = Icinga::app()->getModuleManager()->getModule($module)->getBaseDir();
|
||||||
|
|
||||||
$filePath = $basedir . '/public/js/' . $file;
|
$filePath = $basedir . '/public/js/' . $file;
|
||||||
if (!file_exists($filePath)) {
|
if (!file_exists($filePath)) {
|
||||||
echo "/** Module has no js files **/";
|
echo '/** Module has no js files **/';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$hash = md5_file($filePath);
|
$hash = md5_file($filePath);
|
||||||
@ -143,10 +143,7 @@ class StaticController extends ActionController
|
|||||||
} else {
|
} else {
|
||||||
readfile($filePath);
|
readfile($filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codingStandardsIgnoreEnd
|
// @codingStandardsIgnoreEnd
|
||||||
|
Loading…
x
Reference in New Issue
Block a user