Make ConfigController and PreferenceController extensible by convention

- Rename ConfigurationController to ConfigController
- ConfigController and PreferenceController are now subclasses of
  BaseConfigController and BasePreferenceController
- Module and Application Config/Preference Tabs are detected via
  the ControllerTabCollector
- Moved Controller classes to Icinga/Web/Controller (this is why
  so many files are modified)

refs #4530
This commit is contained in:
Jannis Moßhammer 2013-08-12 15:58:26 +02:00 committed by Eric Lippmann
parent f8567058b4
commit be29b8ff8f
33 changed files with 624 additions and 203 deletions

View File

@ -26,7 +26,7 @@
# namespace Icinga\Application\Controllers;
use Icinga\Web\ActionController;
use Icinga\Web\Controller\ActionController;
use Icinga\Authentication\Credentials;
use Icinga\Authentication\Manager as AuthManager;
use Icinga\Form\Authentication\LoginForm;

View File

@ -0,0 +1,104 @@
<?php
// @codingStandardsIgnoreStart
// {{{ICINGA_LICENSE_HEADER}}}
/**
* Icinga 2 Web - Head for multiple monitoring frontends
* 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>
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
use Icinga\Application\Benchmark;
use Icinga\Authentication\Manager;
use Icinga\Web\Controller\BaseConfigController;
use Icinga\Web\Widget\Tab;
use Icinga\Web\Url;
use Icinga\Web\Hook\Configuration\ConfigurationTabBuilder;
use Icinga\Application\Icinga;
/**
* Class ConfigController
*/
class ConfigController extends BaseConfigController
{
public static function createProvidedTabs()
{
return array(
"index" => new Tab(
array(
"name" => "index",
"title" => "Configuration",
"iconCls" => "wrench",
"url" => Url::fromPath("/config")
)
),
"modules" => new Tab(
array(
"name" => "modules",
"title" => "Modules",
"iconCls" => "puzzle-piece",
"url" => Url::fromPath("/config/moduleoverview")
)
)
);
}
/**
* Index action
*/
public function indexAction()
{
}
public function moduleoverviewAction()
{
$this->view->modules = Icinga::app()->getModuleManager()->select()
->from('modules')
->order('name');
$this->render('module/overview');
}
/**
* Enable a module
*/
public function moduleenableAction()
{
$manager = Icinga::app()->getModuleManager();
$manager->enableModule($this->_getParam('name'));
$manager->loadModule($this->_getParam('name'));
$this->redirectNow('config/moduleoverview?_render=body');
}
/**
* Disable a module
*/
public function moduledisableAction()
{
$manager = Icinga::app()->getModuleManager();
$manager->disableModule($this->_getParam('name'));
$this->redirectNow('config/moduleoverview?_render=body');
}
}
// @codingStandardsIgnoreEnd

View File

@ -27,7 +27,7 @@
*/
// {{{ICINGA_LICENSE_HEADER}}}
use Icinga\Web\ActionController;
use Icinga\Web\Controller\ActionController;
use Icinga\Web\Url;
use Icinga\Application\Icinga;
use Icinga\Web\Widget\Dashboard;

View File

@ -26,7 +26,7 @@
# namespace Icinga\Application\Controllers;
use Icinga\Web\ActionController;
use Icinga\Web\Controller\ActionController;
/**
* Class ErrorController

View File

@ -29,7 +29,7 @@
# namespace Icinga\Application\Controllers;
use Icinga\Web\ActionController;
use Icinga\Web\Controller\ActionController;
use Icinga\Application\Icinga;
/**
@ -38,6 +38,7 @@ use Icinga\Application\Icinga;
*/
class IndexController extends ActionController
{
/**
* @var bool
*/

View File

@ -1,107 +0,0 @@
<?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}}}
# namespace Icinga\Application\Controllers;
use Icinga\Web\ActionController;
use Icinga\Application\Icinga;
use Icinga\Web\Hook\Configuration\ConfigurationTabBuilder;
use Icinga\Web\Widget\Tabs;
/**
* Handle module depending frontend actions
*/
class ModulesController extends ActionController
{
/**
* @var ModuleManager
*/
protected $manager;
/**
* Setup this controller
* @see ZfActionController::init
*/
public function init()
{
$this->manager = Icinga::app()->getModuleManager();
}
/**
* Display a list of all modules
*/
public function indexAction()
{
$tabBuilder = new ConfigurationTabBuilder(new Tabs());
$tabBuilder->build();
$this->view->tabs = $tabBuilder->getTabs();
$this->view->modules = $this->manager->select()
->from('modules')
->order('name');
$this->render('overview');
}
/**
* Alias for index
*
* @see self::indexAction
*/
public function overviewAction()
{
$this->indexAction();
}
/**
* Enable a module
*/
public function enableAction()
{
$this->manager->enableModule($this->_getParam('name'));
$this->manager->loadModule($this->_getParam('name'));
$this->getResponse()->setHeader('X-Icinga-Enable-Module', $this->_getParam('name'));
$this->redirectNow('modules/overview?_render=body');
}
/**
* Disable a module
*/
public function disableAction()
{
$this->manager->disableModule($this->_getParam('name'));
$this->redirectNow('modules/overview?_render=body');
}
}
// @codingStandardsIgnoreEnd

View File

@ -0,0 +1,67 @@
<?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}}}
use \Icinga\Web\Controller\BasePreferenceController;
use \Icinga\Web\Widget\Tab;
use \Icinga\Web\Url;
/**
* Application wide preference controller for user preferences
*
*/
class PreferenceController extends BasePreferenceController
{
/**
* @see BasePreferenceController::createProvidedTabs
*
* @return array
*/
public static function createProvidedTabs()
{
return array(
"preference" => new Tab(
array(
"name" => "preferences",
"iconCls" => "user",
"title" => "Preferences",
"url" => Url::fromPath("/preference")
)
)
);
}
/**
* @TODO: Implement User preferences (feature #5425)
*
*/
public function indexAction()
{
}
}

View File

@ -27,7 +27,7 @@
*/
// {{{ICINGA_LICENSE_HEADER}}}
use Icinga\Web\ActionController;
use Icinga\Web\Controller\ActionController;
use Icinga\Application\Icinga,
Zend_Controller_Action_Exception as ActionException;

View File

@ -17,7 +17,7 @@
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><?= $this->qlink($this->translate('Settings'), 'settings') ?></li>
<li><?= $this->qlink($this->translate('Preferences'), 'preference') ?></li>
<li><?= $this->qlink($this->translate('Logout'), 'authentication/logout') ?></li>
</ul>
</li>

View File

@ -0,0 +1,12 @@
<?= $this->tabs->render($this); ?>
<h3>Configuration</h3>
<div class="alert-block alert">
<h4>Dear developer</h4>
<br/>
<p>
Add shortcuts for often used configuration options so users can quickly change settings without having to
search in the tab overview
</p>
</div>

View File

@ -1,4 +1,6 @@
<?php
use Icinga\Web\Url;
$this->modules->limit(10);
$modules = $this->modules->paginate();
@ -11,22 +13,19 @@ $modules = $this->modules->paginate();
<table >
<tbody>
<? foreach ($modules as $module): ?>
<?php
$enableUrl = Url::fromPath('config/moduleenable/',array('name' => $module->name))->getAbsoluteUrl();
$disableUrl = Url::fromPath('config/moduledisable/',array('name' => $module->name))->getAbsoluteUrl();
?>
<tr>
<td>
<? if ($module->enabled): ?>
<i class="icon-ok-sign"></i> <?= $this->qlink(
$module->name,
'modules/disable',
array('name' => $module->name),
array('target'=>'body')
) ?>
<i class="icon-ok-sign"></i>
<a href="<?= $disableUrl ?>"><?= $this->escape($module->name); ?></a>
<? else: ?>
<i class="icon-remove-sign"></i> <?= $this->qlink(
$module->name,
'modules/enable',
array('name' => $module->name),
array('target'=>'body')
) ?>
<i class="icon-remove-sign"></i>
<a href="<?= $enableUrl ?>"><?= $this->escape($module->name); ?></a>
<? endif ?>
(<?=
$module->enabled

View File

@ -1,12 +0,0 @@
<?= $this->tabs->render($this); ?>
<h3>Configuration</h3>
<p>
This is the configuration over page. Modules can register their handler to
provide own controllers for configuration.
</p>
<p>
Many thanks for your attention!
</p>

View File

@ -0,0 +1,3 @@
<?= $this->tabs->render($this); ?>
<h3>Preferences </h3>

View File

@ -1,4 +1,4 @@
[menu]
Dashboard = "/dashboard/index"
Configuration = "/configuration/index"
Configuration = "/config/index"

View File

@ -0,0 +1,57 @@
# Module Development: Configuration and Preferences Dialogs
When developing modules, you might want your module's configuration and preferences dialogs to appear in the Icinga Web
Configuration/Preferences interface. This is rather easy to accomplish and should be the preferred way to allow user's
to customize your module.
## Terminology
When talking about 'Configuration' and 'Preference', we have a clear distinction between those words:
- **Configurations** are application/module wide settings that affect every user when being changed. This could be
the data backend of your module or other 'global' settings that affect everyone when being changed
- **Preferences** are settings a user can set for *his* account only, like the page size of pagination, entry points, etc.
## Usage
The two base classes for preferences and configurations are \Icinga\Web\Controller\BasePreferenceController for preferences and
\Icinga\Web\Controller\BaseConfigController for configurations.
If you want to create a preference or configuration panel you have to create a ConfigController and/or PreferenceController
in your Module's a controller directory and make it a subclass of BaseConfigController or BasePreferenceController.
Those controllers can be used like normal controllers, with two exceptions:
- If you want your module to appear as a tab in the applications configuration/preference interface you have to implement
the static createProvidedTabs function that returns an array of tabs to be displayed
- The init() method of the base class must be called in order to make sure tabs are collected and the view's tabs variable
is populated
## Example
We'll just provide an example for ConfigControllers here, as PreferenceController are the same with a different name
use \Icinga\Web\Controller\BaseConfigController;
use \Icinga\Web\Widget\Tab;
use \Icinga\Web\Url;
class My_ConfigController extends BaseConfigController {
static public function createProvidedTabs()
{
return array(
"myModuleTab" => new Tab(array(
"name" => "myModuleTab", // the internal name of the tab
"iconCls" => "myicon", // the icon to be displayed
"title" => "The tab title", // The title of the configuration's tab
"url" => Url::fromPath("/myModule/config") // The Url that will ne called (can also be just a path)
))
);
}
public function indexAction()
{
// create the form here
}
}

View File

@ -2,24 +2,70 @@
namespace Icinga\Application\Modules;
use Icinga\Application\Icinga;
use Icinga\Exception\ConfigurationError;
use Icinga\Exception\SystemPermissionException;
use Icinga\Exception\ProgrammingError;
// TODO: show whether enabling/disabling modules is allowed by checking enableDir
// perms
/**
* Module manager that handles detecting, enabling and disabling of modules
*
* Modules can have 3 states:
* - installed Means that the module exists, but could be deactivated (see enabled and loaded)
* - enabled Means that the module is marked as being enabled and should be used
* - loaded Means that the module has been registered in the autoloader and is being used
*
*/
class Manager
{
protected $installedBaseDirs = null;
protected $enabledDirs = array();
protected $loadedModules = array();
protected $index;
protected $app;
protected $enableDir;
protected $modulePaths = array();
/**
* @param $app : The applicaiton bootstrap. This one needs a properly defined interface
* Array of all installed module's base directories
*
* null if modules haven't been scanned yet
*
* @var array|null
*/
protected $installedBaseDirs = null;
/**
* Array of all enabled modules base dirs
*
* @var array
*/
protected $enabledDirs = array();
/**
* Array of all module names that have been loaded
*
* @var array
*/
protected $loadedModules = array();
/**
* Reference to Icinga::app
*
* @var Icinga
*/
protected $app;
/**
* The directory that is used to detect enabled modules
*
* @var string
*/
protected $enableDir;
/**
* All paths to look for installed modules that can be enabled
*
* @var array
*/
protected $modulePaths = array();
/**
* Creates a new instance of the module manager to
*
* @param $app : The applicaiton bootstrap. This one needs a properly defined interface
* In order to test it correctly, the application now only requires a stdClass
* @param $dir :
**/
@ -294,4 +340,5 @@ class Manager
}
}
}
}

View File

@ -207,6 +207,11 @@ class Module
return $this->basedir;
}
public function getControllerDir()
{
return $this->controllerdir;
}
/**
* Getter for library directory
*
@ -385,4 +390,5 @@ class Module
Hook::register($name, $key, $class);
return $this;
}
}

View File

@ -25,19 +25,18 @@
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Web\Controller;
namespace Icinga\Web;
use Icinga\Authentication\Manager as AuthManager;
use Icinga\Application\Benchmark;
use Icinga\Exception;
use \Icinga\Authentication\Manager as AuthManager;
use \Icinga\Application\Benchmark;
use \Icinga\Exception;
use \Icinga\Application\Config;
use Icinga\Web\Notification;
use Zend_Layout as ZfLayout;
use Zend_Controller_Action as ZfController;
use Zend_Controller_Request_Abstract as ZfRequest;
use Zend_Controller_Response_Abstract as ZfResponse;
use Zend_Controller_Action_HelperBroker as ZfActionHelper;
use \Icinga\Web\Notification;
use \Zend_Layout as ZfLayout;
use \Zend_Controller_Action as ZfController;
use \Zend_Controller_Request_Abstract as ZfRequest;
use \Zend_Controller_Response_Abstract as ZfResponse;
use \Zend_Controller_Action_HelperBroker as ZfActionHelper;
/*
* @TODO(el): There was a note from tg that the following line is temporary. Ask him why.

View File

@ -0,0 +1,65 @@
<?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\Controller;
use \Icinga\Application\Icinga;
/**
* Base class for Configuration Controllers
*
* Module preferences use this class to make sure they are automatically
* added to the application's configuration dialog. If you create a subclass of
* BasePreferenceController and overwrite @see init(), make sure you call
* parent::init(), otherwise you won't have the $tabs property in your view.
*
*/
class BaseConfigController extends ActionController
{
/*
* Return an array of tabs provided by this configuration controller.
*
* Those tabs will automatically be added to the application's configuration dialog
*
* @return array
*/
public static function createProvidedTabs()
{
return array();
}
/**
* @see ActionController::init
*/
public function init()
{
parent::init();
$this->view->tabs = ControllerTabCollector::collectControllerTabs('ConfigController');
}
}

View File

@ -0,0 +1,62 @@
<?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\Controller;
/**
* Base class for Preference Controllers
*
* Module preferences use this class to make sure they are automatically
* added to the general preferences dialog. If you create a subclass of
* BasePreferenceController and overwrite @see init(), make sure you call
* parent::init(), otherwise you won't have the $tabs property in your view.
*
*/
class BasePreferenceController extends ActionController
{
/**
* Return an array of tabs provided by this preference controller.
*
* Those tabs will automatically be added to the application's preference dialog
*
* @return array
*/
public static function createProvidedTabs()
{
return array();
}
/**
* @see ActionController::init()
*/
public function init()
{
parent::init();
$this->view->tabs = ControllerTabCollector::collectControllerTabs('PreferenceController');
}
}

View File

@ -0,0 +1,125 @@
<?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\Controller;
use \Icinga\Application\Modules\Module;
use \Icinga\Application\Icinga;
use \Icinga\Web\Widget\Tabs;
/**
* Static helper class that collects tabs provided by the 'createProvidedTabs' method
* of controllers.
*
*/
class ControllerTabCollector
{
/**
* Scan all controllers with the provided name
* in the application and (loaded) module folders and collects their provided tabs
*
* @param string $controller The name of the controllers to use for tab collection
*
* @return Tabs A @see Tabs instance containing the application tabs first
* followed by the tabs provided from the modules
*/
public static function collectControllerTabs($controller)
{
require_once(Icinga::app()->getApplicationDir('/controllers/'.$controller.'.php'));
$applicationTabs = $controller::createProvidedTabs();
$moduleTabs = self::collectModuleTabs($controller);
$tabs = new Tabs();
foreach ($applicationTabs as $name => $tab) {
$tabs->add($name, $tab);
}
foreach ($moduleTabs as $name => $tab) {
// don't overwrite application tabs if the module wants to
if ($tabs->has($name)) {
continue;
}
$tabs->add($name, $tab);
}
return $tabs;
}
/**
* Collect module tabs for all modules containing the given controller
*
* @param string $controller The controller name to use for tab collection
*
* @return array An array of Tabs objects or arrays containing Tab descriptions
*/
private static function collectModuleTabs($controller)
{
$moduleManager = Icinga::app()->getModuleManager();
$modules = $moduleManager->listEnabledModules();
$tabs = array();
foreach ($modules as $module) {
$tabs += self::createModuleConfigurationTabs($controller, $moduleManager->getModule($module));
}
return $tabs;
}
/**
* Collects the tabs from the createProvidedTabs() method in the configuration controller
*
* If the module doesn't have the given controller or createProvidedTabs method in the controller
* an empty array will be returned
*
* @param string $controller The name of the controller that provides tabs via createProvidedTabs
* @param Module $module The module instance that provides the controller
*
* @return array
*/
private static function createModuleConfigurationTabs($controller, Module $module)
{
$controllerDir = $module->getControllerDir();
$name = $module->getName();
$controllerDir = $controllerDir . '/' . $controller . '.php';
$controllerName = ucfirst($name) . '_' . $controller;
if (is_readable($controllerDir)) {
require_once(realpath($controllerDir));
if (!method_exists($controllerName, "createProvidedTabs")) {
return array();
}
$tab = $controllerName::createProvidedTabs();
if (!is_array($tab)) {
$tab = array($name => $tab);
}
return $tab;
}
return array();
}
}

View File

@ -26,7 +26,7 @@
/**
* Module action controller
*/
namespace Icinga\Web;
namespace Icinga\Web\Controller;
use \Icinga\Application\Config as IcingaConfig;
use Icinga\Application\Icinga;

View File

@ -35,7 +35,7 @@ use \Icinga\Application\Config;
use Icinga\Application\Logger;
use Icinga\Authentication\Manager;
use Icinga\Web\Form;
use Icinga\Web\ModuleActionController;
use Icinga\Web\Controller\ModuleActionController;
use Icinga\Protocol\Commandpipe\Comment;
use Icinga\Protocol\Commandpipe\CommandPipe;
use Icinga\Exception\ConfigurationError;

View File

@ -1,9 +1,9 @@
<?php
// @codingStandardsIgnoreStart
// {{{ICINGA_LICENSE_HEADER}}}
/**
* Icinga 2 Web - Head for multiple monitoring frontends
* 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
@ -21,39 +21,32 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @author 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\Application\Benchmark;
use Icinga\Authentication\Manager;
use Icinga\Web\ActionController;
use Icinga\Web\Widget\Tabs;
use Icinga\Web\Hook\Configuration\ConfigurationTabBuilder;
use \Icinga\Web\Controller\BaseConfigController;
use \Icinga\Web\Widget\Tab;
use \Icinga\Web\Url;
/**
* Class ConfigurationController
*/
class ConfigurationController extends ActionController
{
public function init()
class Monitoring_ConfigController extends BaseConfigController {
static public function createProvidedTabs()
{
parent::init();
}
/**
* Index action
*/
public function indexAction()
{
$tabBuilder = new ConfigurationTabBuilder(
new Tabs()
return array(
"backends" => new Tab(array(
"name" => "backends",
"iconCls" => "hdd",
"title" => "Monitoring Backends",
"url" => Url::fromPath("/monitoring/config/backend")
))
);
$tabBuilder->build();
$this->view->tabs = $tabBuilder->getTabs();
}
}
// @codingStandardsIgnoreEnd
public function backendAction()
{
$this->redirectNow("/config");
}
}

View File

@ -1,6 +1,6 @@
<?php
use Icinga\Web\ModuleActionController;
use Icinga\Web\Controller\ModuleActionController;
use Icinga\Web\Hook;
use Icinga\File\Csv;
use Monitoring\Backend;

View File

@ -28,7 +28,7 @@
// {{{ICINGA_LICENSE_HEADER}}}
use Monitoring\Backend;
use Icinga\Web\ModuleActionController;
use Icinga\Web\Controller\ModuleActionController;
use Icinga\Web\Hook;
use Monitoring\Object\Host;
use Monitoring\Object\Service;

View File

@ -1,6 +1,6 @@
<?php
use Icinga\Web\ModuleActionController;
use Icinga\Web\Controller\ModuleActionController;
use Icinga\Web\Url;
use Monitoring\Backend;
use Zend_Soap_Server as ZfSoapServer;

View File

@ -1,6 +1,6 @@
<?php
use Icinga\Web\ModuleActionController;
use Icinga\Web\Controller\ModuleActionController;
use Icinga\Backend;
use Icinga\Web\Widget\Tabs;

View File

@ -2,7 +2,7 @@
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Web
namespace Icinga\Web\Controller
{
/**
* Mocked controller base class to avoid the complete
@ -82,7 +82,7 @@ namespace Test\Monitoring\Testlib
require_once 'Zend/View.php';
use Icinga\Protocol\Statusdat\Reader;
use Icinga\Web\ActionController;
use Icinga\Web\Controller\ActionController;
use Test\Monitoring\Testlib\DataSource\TestFixture;
use Test\Monitoring\Testlib\DataSource\DataSourceTestSetup;
use Monitoring\Backend\Ido;

View File

@ -87,9 +87,9 @@ var onLinkTagClick = function(ev) {
'.layout-main-detail * a' : {
'click' : onLinkTagClick
},
'a' : {
/* 'a' : {
'click' : onOuterLinkClick
},
},*/
'.layout-main-detail .icinga-container#icinga-detail' : {
'focus' : expandDetailView
}

View File

@ -12,7 +12,7 @@ require '../../library/Icinga/Exception/ProgrammingError.php';
require '../../library/Icinga/Application/Benchmark.php';
require '../../library/Icinga/Application/Config.php';
require '../../library/Icinga/Application/Icinga.php';
require '../../library/Icinga/Web/ActionController.php';
require '../../library/Icinga/Web/Controller/ActionController.php';
require '../../library/Icinga/Web/Notification.php';
require '../../library/Icinga/Application/Platform.php';

View File

@ -1,6 +1,6 @@
<?php
namespace Tests\Icinga\Web\ActionController;
namespace Tests\Icinga\Web\Controller\ActionController;