controllers, tables, view scripts: remove obsolete

This commit is contained in:
Thomas Gelf 2017-08-17 00:08:08 +02:00
parent 78ab1fa120
commit 93a42c7fc8
14 changed files with 0 additions and 591 deletions

View File

@ -1,42 +0,0 @@
<?php
namespace Icinga\Module\Director\Controllers;
use Icinga\Module\Director\Web\Controller\ActionController;
use Exception;
class ListController extends ActionController
{
public function importsourceAction()
{
$this->setAutoRefreshInterval(10);
$this->view->addLink = $this->view->qlink(
$this->translate('Add import source'),
'director/importsource/add',
null,
array('class' => 'icon-plus')
);
$this->setImportTabs()->activate('importsource');
$this->view->title = $this->translate('Import source');
$this->prepareAndRenderTable('importsource');
}
public function syncruleAction()
{
$this->setAutoRefreshInterval(10);
$this->view->addLink = $this->view->qlink(
$this->translate('Add sync rule'),
'director/syncrule/add',
null,
array('class' => 'icon-plus')
);
$this->setImportTabs()->activate('syncrule');
$this->view->title = $this->translate('Sync rule');
$this->view->table = $this->loadTable('syncrule')->setConnection($this->db());
$this->render('table');
}
}

View File

@ -1,38 +0,0 @@
<?php
namespace Icinga\Module\Director\Controllers;
use Icinga\Exception\NotFoundError;
use Icinga\Web\Controller;
class ScreenshotController extends Controller
{
public function indexAction()
{
$subdir = $this->getParam('subdir');
$file = $this->getParam('file');
$valid = '[A-z0-9][A-z0-9_-]*';
if (!preg_match('/^' . $valid . '$/', $subdir)
|| !preg_match('/^' . $valid . '\.png$/', $file)
) {
throw new NotFoundError('Not found');
}
$filename = sprintf(
'%s/doc/screenshot/director/%s/%s',
$this->Module()->getBaseDir(),
$subdir,
$file
);
if (file_exists($filename)) {
$this->getResponse()->setHeader('Content-Type', 'image/png', true);
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$fh = fopen($filename, 'r');
fpassthru($fh);
} else {
throw new NotFoundError('Not found: ' . $filename);
}
}
}

View File

@ -1,44 +0,0 @@
<?php
namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Web\Table\QuickTable;
class IcingaHostGroupTable extends QuickTable
{
protected $searchColumns = array(
'hostgroup',
'display_name'
);
public function getColumns()
{
return array(
'id' => 'hg.id',
'hostgroup' => 'hg.object_name',
'display_name' => 'hg.display_name'
);
}
protected function getActionUrl($row)
{
return $this->url('director/hostgroup', array('name' => $row->hostgroup));
}
public function getTitles()
{
$view = $this->view();
return array(
'hostgroup' => $view->translate('Hostgroup'),
'display_name' => $view->translate('Display Name'),
);
}
public function getBaseQuery()
{
return $this->db()->select()->from(
array('hg' => 'icinga_hostgroup'),
array()
)->order('hg.object_name');
}
}

View File

@ -1,115 +0,0 @@
<?php
namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Objects\IcingaHost;
use Icinga\Module\Director\Web\Table\QuickTable;
class IcingaHostServiceSetTable extends QuickTable
{
protected $title;
protected $host;
private $lastSetId;
public function getColumns()
{
return array(
'id' => 'pset.id',
'service_set_id' => 'sset.id',
'service_set_name' => 'sset.object_name',
'name' => 's.object_name',
'description' => 'sset.description',
'host_name' => 'h.object_name',
);
}
public function getTitles()
{
$view = $this->view();
return array(
'name' => $view->translate('Service'),
);
}
public function setTitle($title)
{
$this->title = $title;
return $this;
}
protected function beginTableBody()
{
return '';
}
protected function renderRow($row)
{
$html = '';
$view = $this->view();
if ($row->service_set_id !== $this->lastSetId) {
if ($this->lastSetId === null) {
$html .= "</tbody>\n";
}
$html .= parent::renderTitles((object) array(
'name' => sprintf($view->translate('Service set: %s'), $row->service_set_name)
));
$html .= "<tbody>\n";
$this->lastSetId = $row->service_set_id;
}
return $html . parent::renderRow($row);
}
protected function renderTitles($row)
{
return '';
}
public function setHost(IcingaHost $host)
{
$this->host = $host;
return $this;
}
protected function getActionUrl($row)
{
$params = array(
'name' => $row->host_name,
'service' => $row->name,
'serviceSet' => $row->id,
);
return $this->url('director/host/servicesetservice', $params);
}
protected function getUnfilteredQuery()
{
return $this->db()->select()->from(
array('pset' => 'icinga_service_set'),
array()
)->join(
array('sseti' => 'icinga_service_set_inheritance'),
'pset.id = sseti.parent_service_set_id',
array()
)->join(
array('sset' => 'icinga_service_set'),
'sset.id = sseti.service_set_id',
array()
)->join(
array('h' => 'icinga_host'),
'h.id = sset.host_id',
array()
)->join(
array('s' => 'icinga_service'),
'pset.id = s.service_set_id',
array()
)->where('sset.host_id = ?', $this->host->id)->order('sset.object_name');
}
public function getBaseQuery()
{
return $this->getUnfilteredQuery();
}
}

View File

@ -1,54 +0,0 @@
<?php
namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Web\Table\QuickTable;
class IcingaHostTemplateChoiceTable extends QuickTable
{
protected $searchColumns = [
'name',
];
public function getTitles()
{
$view = $this->view();
return [
'name' => $view->translate('Name'),
'templates' => $view->translate('Choices'),
];
}
public function getColumns()
{
return [
'id' => 'hc.id',
'name' => 'hc.object_name',
'templates' => 'GROUP_CONCAT(t.object_name)'
];
}
protected function getActionUrl($row)
{
return $this->url('director/hosttemplatechoice', array('name' => $row->name));
}
protected function getUnfilteredQuery()
{
$query = $this->db()->select()->from(
['hc' => 'icinga_host_template_choice'],
[]
)->joinLeft(
['t' => 'icinga_host'],
't.template_choice_id = hc.id',
[]
)->order('hc.object_name')->group('hc.id');
return $query;
}
public function getBaseQuery()
{
return $this->getUnfilteredQuery();
}
}

View File

@ -1,49 +0,0 @@
<?php
namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Web\Table\QuickTable;
class IcingaHostVarTable extends QuickTable
{
public function getColumns()
{
return array(
'host_id' => 'hv.host_id',
'host' => 'h.object_name',
'varname' => 'hv.varname',
'varvalue' => 'hv.varvalue',
'format' => 'hv.format',
);
}
protected function getActionUrl($row)
{
return $this->url('director/object/hostvar', array(
'host_id' => $row->host_id,
'varname' => $row->varname,
));
}
public function getTitles()
{
$view = $this->view();
return array(
'host' => $view->translate('Host'),
'varname' => $view->translate('Name'),
'varvalue' => $view->translate('Value'),
);
}
public function getBaseQuery()
{
return $this->db()->select()->from(
array('hv' => 'icinga_host_var'),
array()
)->join(
array('h' => 'icinga_host'),
'hv.host_id = h.id',
array()
);
}
}

View File

@ -1,48 +0,0 @@
<?php
namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Web\Table\QuickTable;
class IcingaNotificationTable extends QuickTable
{
protected $searchColumns = array(
'notification',
);
public function getColumns()
{
return array(
'id' => 'n.id',
'object_type' => 'n.object_type',
'notification' => 'n.object_name',
);
}
protected function getActionUrl($row)
{
return $this->url('director/notification', array('id' => $row->id));
}
public function getTitles()
{
$view = $this->view();
return array(
'notification' => $view->translate('Notification'),
);
}
public function getUnfilteredQuery()
{
return $this->db()->select()->from(
array('n' => 'icinga_notification'),
array()
);
}
public function getBaseQuery()
{
return $this->getUnfilteredQuery();
}
}

View File

@ -1,44 +0,0 @@
<?php
namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Web\Table\QuickTable;
class IcingaServiceGroupTable extends QuickTable
{
protected $searchColumns = array(
'servicegroup',
'display_name'
);
public function getColumns()
{
return array(
'id' => 'sg.id',
'servicegroup' => 'sg.object_name',
'display_name' => 'sg.display_name'
);
}
protected function getActionUrl($row)
{
return $this->url('director/servicegroup', array('name' => $row->servicegroup));
}
public function getTitles()
{
$view = $this->view();
return array(
'servicegroup' => $view->translate('Servicegroup'),
'display_name' => $view->translate('Display Name'),
);
}
public function getBaseQuery()
{
return $this->db()->select()->from(
array('sg' => 'icinga_servicegroup'),
array()
);
}
}

View File

@ -1,44 +0,0 @@
<?php
namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Web\Table\QuickTable;
class IcingaUserGroupTable extends QuickTable
{
protected $searchColumns = array(
'usergroup',
'display_name'
);
public function getColumns()
{
return array(
'id' => 'ug.id',
'usergroup' => 'ug.object_name',
'display_name' => 'ug.display_name',
);
}
protected function getActionUrl($row)
{
return $this->url('director/usergroup', array('name' => $row->usergroup));
}
public function getTitles()
{
$view = $this->view();
return array(
'usergroup' => $view->translate('Usergroup'),
'display_name' => $view->translate('Display Name'),
);
}
public function getBaseQuery()
{
return $this->db()->select()->from(
array('ug' => 'icinga_usergroup'),
array()
);
}
}

View File

@ -1,18 +0,0 @@
<?php if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
<h1><?= $this->escape($this->title) ?><?= $this->quickSearch ?></h1>
<span class="action-links"<?php if (! $this->stayHere): ?> data-base-target="_next"<?php endif ?>>
<?= $this->addLink ?>
</span>
<?= $this->table->getPaginator() ?>
</div>
<?php endif ?>
<div class="content<?php if ($this->compact): ?> compact<?php endif ?>"<?php if (! $this->stayHere): ?> data-base-target="_next"<?php endif ?>>
<?= $this->form ?>
<?php if ($table->count()): ?>
<?= $this->table->render() ?>
<?php endif ?>
</div>

View File

@ -1,44 +0,0 @@
<?php
if (! $this->undeployedChanges && ! $this->totalUndeployedChanges) {
return;
}
if (! $this->hasPermission('director/deploy')) {
return;
}
if ($this->undeployedChanges === 0) {
if ($this->totalUndeployedChanges) {
$msg = $this->translate('There is a single pending change');
} else {
$msg = sprintf(
$this->translate('There are %d pending changes'),
$this->totalUndeployedChanges
);
}
} elseif ($this->totalUndeployedChanges === 1) {
$msg = $this->translate('There has been a single change to this object, nothing else has been modified');
} elseif ($this->totalUndeployedChanges === $this->undeployedChanges) {
$msg = sprintf(
$this->translate('There have been %d changes to this object, nothing else has been modified'),
$this->undeployedChanges
);
} else {
$msg = sprintf(
$this->translate('There are %d pending changes, %d of them applied to this object'),
$this->totalUndeployedChanges,
$this->undeployedChanges
);
}
echo ' ' . $this->qlink(
$this->translate('Deploy'),
'director/config/deploy',
null,
array(
'title' => $msg,
'class' => 'icon-wrench state-critical'
)
);

View File

@ -1,16 +0,0 @@
<div class="controls">
<?= $this->tabs ?>
<h1><?= $this->escape($this->title) ?><?php
if ($this->subtitle) {
echo ' <small>' . $this->escape($this->subtitle) . '</small>';
}
?></h1>
<span class="action-links">
<?= $this->actionLinks ?>
<?= $this->render('object/deploymentLink.phtml') ?>
</span>
</div>
<div class="content">
<?= $this->form ?>
</div>

View File

@ -1,14 +0,0 @@
<div class="controls">
<?= $this->tabs ?>
<h1><?= $this->escape($this->title) ?></h1>
<span class="action-links">
<?php if ($this->actionLinks): ?>
<?= implode(' ', $this->actionLinks) ?>
<?php endif ?>
<?= $this->render('object/deploymentLink.phtml') ?>
</span>
</div>
<div class="content">
<?= $this->form ?>
</div>

View File

@ -1,21 +0,0 @@
<?php if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
<h1><?= $this->escape($this->title) ?><?= $this->quickSearch ?></h1>
<span class="action-links"<?php if (! $this->stayHere): ?> data-base-target="_next"<?php endif ?>>
<?= $this->addLink ?><?= $this->render('object/deploymentLink.phtml') ?>
</span>
<?php if ($this->filterEditor): ?>
<?= $this->filterEditor ?>
<?php endif ?>
<?= $this->table->getPaginator() ?>
</div>
<?php endif ?>
<div class="content<?php if ($this->compact): ?> compact<?php endif ?>"<?php if (! $this->stayHere): ?> data-base-target="_next"<?php endif ?>>
<?= $this->form ?>
<?php if ($table->count()): ?>
<?= $this->table->render() ?>
<?php endif ?>
</div>