From 93a42c7fc8adeb2bd04b1286d50ab6b065e2b8d6 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 17 Aug 2017 00:08:08 +0200 Subject: [PATCH] controllers, tables, view scripts: remove obsolete --- application/controllers/ListController.php | 42 ------- .../controllers/ScreenshotController.php | 38 ------ application/tables/IcingaHostGroupTable.php | 44 ------- .../tables/IcingaHostServiceSetTable.php | 115 ------------------ .../tables/IcingaHostTemplateChoiceTable.php | 54 -------- application/tables/IcingaHostVarTable.php | 49 -------- .../tables/IcingaNotificationTable.php | 48 -------- .../tables/IcingaServiceGroupTable.php | 44 ------- application/tables/IcingaUserGroupTable.php | 44 ------- application/views/scripts/list/table.phtml | 18 --- .../views/scripts/object/deploymentLink.phtml | 44 ------- application/views/scripts/object/form.phtml | 16 --- application/views/scripts/objects/form.phtml | 14 --- application/views/scripts/objects/table.phtml | 21 ---- 14 files changed, 591 deletions(-) delete mode 100644 application/controllers/ListController.php delete mode 100644 application/controllers/ScreenshotController.php delete mode 100644 application/tables/IcingaHostGroupTable.php delete mode 100644 application/tables/IcingaHostServiceSetTable.php delete mode 100644 application/tables/IcingaHostTemplateChoiceTable.php delete mode 100644 application/tables/IcingaHostVarTable.php delete mode 100644 application/tables/IcingaNotificationTable.php delete mode 100644 application/tables/IcingaServiceGroupTable.php delete mode 100644 application/tables/IcingaUserGroupTable.php delete mode 100644 application/views/scripts/list/table.phtml delete mode 100644 application/views/scripts/object/deploymentLink.phtml delete mode 100644 application/views/scripts/object/form.phtml delete mode 100644 application/views/scripts/objects/form.phtml delete mode 100644 application/views/scripts/objects/table.phtml diff --git a/application/controllers/ListController.php b/application/controllers/ListController.php deleted file mode 100644 index 4f029894..00000000 --- a/application/controllers/ListController.php +++ /dev/null @@ -1,42 +0,0 @@ -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'); - } -} diff --git a/application/controllers/ScreenshotController.php b/application/controllers/ScreenshotController.php deleted file mode 100644 index 1957d3f5..00000000 --- a/application/controllers/ScreenshotController.php +++ /dev/null @@ -1,38 +0,0 @@ -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); - } - } -} diff --git a/application/tables/IcingaHostGroupTable.php b/application/tables/IcingaHostGroupTable.php deleted file mode 100644 index a2d9b8ce..00000000 --- a/application/tables/IcingaHostGroupTable.php +++ /dev/null @@ -1,44 +0,0 @@ - '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'); - } -} diff --git a/application/tables/IcingaHostServiceSetTable.php b/application/tables/IcingaHostServiceSetTable.php deleted file mode 100644 index 2e478dc0..00000000 --- a/application/tables/IcingaHostServiceSetTable.php +++ /dev/null @@ -1,115 +0,0 @@ - '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 .= "\n"; - } - $html .= parent::renderTitles((object) array( - 'name' => sprintf($view->translate('Service set: %s'), $row->service_set_name) - )); - $html .= "\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(); - } -} diff --git a/application/tables/IcingaHostTemplateChoiceTable.php b/application/tables/IcingaHostTemplateChoiceTable.php deleted file mode 100644 index 8b234fa3..00000000 --- a/application/tables/IcingaHostTemplateChoiceTable.php +++ /dev/null @@ -1,54 +0,0 @@ -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(); - } -} diff --git a/application/tables/IcingaHostVarTable.php b/application/tables/IcingaHostVarTable.php deleted file mode 100644 index 776627e2..00000000 --- a/application/tables/IcingaHostVarTable.php +++ /dev/null @@ -1,49 +0,0 @@ - '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() - ); - } -} diff --git a/application/tables/IcingaNotificationTable.php b/application/tables/IcingaNotificationTable.php deleted file mode 100644 index 6804c6a5..00000000 --- a/application/tables/IcingaNotificationTable.php +++ /dev/null @@ -1,48 +0,0 @@ - '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(); - } -} diff --git a/application/tables/IcingaServiceGroupTable.php b/application/tables/IcingaServiceGroupTable.php deleted file mode 100644 index bef63cfe..00000000 --- a/application/tables/IcingaServiceGroupTable.php +++ /dev/null @@ -1,44 +0,0 @@ - '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() - ); - } -} diff --git a/application/tables/IcingaUserGroupTable.php b/application/tables/IcingaUserGroupTable.php deleted file mode 100644 index d90ffa7a..00000000 --- a/application/tables/IcingaUserGroupTable.php +++ /dev/null @@ -1,44 +0,0 @@ - '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() - ); - } -} diff --git a/application/views/scripts/list/table.phtml b/application/views/scripts/list/table.phtml deleted file mode 100644 index 479a849d..00000000 --- a/application/views/scripts/list/table.phtml +++ /dev/null @@ -1,18 +0,0 @@ -compact): ?> -
-tabs ?> - -

escape($this->title) ?>quickSearch ?>

-stayHere): ?> data-base-target="_next"> -addLink ?> - -table->getPaginator() ?> -
- - -
stayHere): ?> data-base-target="_next"> -form ?> -count()): ?> -table->render() ?> - -
diff --git a/application/views/scripts/object/deploymentLink.phtml b/application/views/scripts/object/deploymentLink.phtml deleted file mode 100644 index 22a58b3b..00000000 --- a/application/views/scripts/object/deploymentLink.phtml +++ /dev/null @@ -1,44 +0,0 @@ -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' - ) -); - diff --git a/application/views/scripts/object/form.phtml b/application/views/scripts/object/form.phtml deleted file mode 100644 index 81e5ed41..00000000 --- a/application/views/scripts/object/form.phtml +++ /dev/null @@ -1,16 +0,0 @@ -
-tabs ?> -

escape($this->title) ?>subtitle) { - echo ' ' . $this->escape($this->subtitle) . ''; -} -?>

- -actionLinks ?> -render('object/deploymentLink.phtml') ?> - -
- -
-form ?> -
diff --git a/application/views/scripts/objects/form.phtml b/application/views/scripts/objects/form.phtml deleted file mode 100644 index ac67c3c1..00000000 --- a/application/views/scripts/objects/form.phtml +++ /dev/null @@ -1,14 +0,0 @@ -
-tabs ?> -

escape($this->title) ?>

- -actionLinks): ?> -actionLinks) ?> - -render('object/deploymentLink.phtml') ?> - -
- -
-form ?> -
diff --git a/application/views/scripts/objects/table.phtml b/application/views/scripts/objects/table.phtml deleted file mode 100644 index 34af2b27..00000000 --- a/application/views/scripts/objects/table.phtml +++ /dev/null @@ -1,21 +0,0 @@ -compact): ?> -
-tabs ?> - -

escape($this->title) ?>quickSearch ?>

-stayHere): ?> data-base-target="_next"> -addLink ?>render('object/deploymentLink.phtml') ?> - -filterEditor): ?> -filterEditor ?> - -table->getPaginator() ?> -
- - -
stayHere): ?> data-base-target="_next"> -form ?> -count()): ?> -table->render() ?> - -