diff options
author | Mārtiņš Tālbergs <martins.talbergs@zabbix.com> | 2021-02-26 14:13:04 +0300 |
---|---|---|
committer | Mārtiņš Tālbergs <martins.talbergs@zabbix.com> | 2021-02-26 14:13:04 +0300 |
commit | fe7036bc3a73f5be076aebbc63bd7f40468313b8 (patch) | |
tree | 3a22348587e67b229611015d8bbbe65063a28190 | |
parent | b308be265cb3fa176d39c8e52e3fcf16b0c1d088 (diff) |
..F....... [ZBXNEXT-6288] removed "favscreens" widget
Profile key "web.favorite.screenids" will be deleted in migration patch
related branch: "feature/ZBXNEXT-6289-5.3"
-rw-r--r-- | ui/app/controllers/CControllerFavouriteDelete.php | 6 | ||||
-rw-r--r-- | ui/app/controllers/CControllerWidgetFavScreensView.php | 88 | ||||
-rw-r--r-- | ui/app/views/monitoring.widget.favscreens.view.php | 62 | ||||
-rw-r--r-- | ui/include/classes/mvc/CRouter.php | 1 | ||||
-rw-r--r-- | ui/include/classes/widgets/CWidgetConfig.php | 3 | ||||
-rw-r--r-- | ui/include/defines.inc.php | 1 |
6 files changed, 1 insertions, 160 deletions
diff --git a/ui/app/controllers/CControllerFavouriteDelete.php b/ui/app/controllers/CControllerFavouriteDelete.php index ba4767c85c9..84c0820df29 100644 --- a/ui/app/controllers/CControllerFavouriteDelete.php +++ b/ui/app/controllers/CControllerFavouriteDelete.php @@ -23,7 +23,7 @@ class CControllerFavouriteDelete extends CController { protected function checkInput() { $fields = [ - 'object' => 'fatal|required|in graphid,itemid,screenid,slideshowid,sysmapid', + 'object' => 'fatal|required|in graphid,itemid,sysmapid', 'objectid' => 'fatal|required|id' ]; @@ -44,16 +44,12 @@ class CControllerFavouriteDelete extends CController { $profile = [ 'graphid' => 'web.favorite.graphids', 'itemid' => 'web.favorite.graphids', - 'screenid' => 'web.favorite.screenids', - 'slideshowid' => 'web.favorite.screenids', 'sysmapid' => 'web.favorite.sysmapids' ]; $widgetids = [ 'graphid' => WIDGET_FAV_GRAPHS, 'itemid' => WIDGET_FAV_GRAPHS, - 'screenid' => WIDGET_FAV_SCREENS, - 'slideshowid' => WIDGET_FAV_SCREENS, 'sysmapid' => WIDGET_FAV_MAPS ]; diff --git a/ui/app/controllers/CControllerWidgetFavScreensView.php b/ui/app/controllers/CControllerWidgetFavScreensView.php deleted file mode 100644 index 43c83bd8ba1..00000000000 --- a/ui/app/controllers/CControllerWidgetFavScreensView.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -/* -** Zabbix -** Copyright (C) 2001-2021 Zabbix SIA -** -** 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. -**/ - - -require_once dirname(__FILE__).'/../../include/blocks.inc.php'; - -class CControllerWidgetFavScreensView extends CControllerWidget { - - public function __construct() { - parent::__construct(); - - $this->setType(WIDGET_FAV_SCREENS); - $this->setValidationRules([ - 'name' => 'string', - 'fields' => 'json' - ]); - } - - protected function doAction() { - $screens = []; - $ids = ['screenid' => [], 'slideshowid' => []]; - - foreach (CFavorite::get('web.favorite.screenids') as $favourite) { - $ids[$favourite['source']][$favourite['value']] = true; - } - - if ($ids['screenid']) { - $db_screens = API::Screen()->get([ - 'output' => ['screenid', 'name'], - 'screenids' => array_keys($ids['screenid']) - ]); - - foreach ($db_screens as $db_screen) { - $screens[] = [ - 'screenid' => $db_screen['screenid'], - 'label' => $db_screen['name'], - 'slideshow' => false - ]; - } - } - - if ($ids['slideshowid']) { - foreach ($ids['slideshowid'] as $slideshowid) { - if (slideshow_accessible($slideshowid, PERM_READ)) { - $db_slideshow = get_slideshow_by_slideshowid($slideshowid, PERM_READ); - - if ($db_slideshow) { - $screens[] = [ - 'slideshowid' => $db_slideshow['slideshowid'], - 'label' => $db_slideshow['name'], - 'slideshow' => true - ]; - } - } - } - } - - CArrayHelper::sort($screens, ['label']); - - $this->setResponse(new CControllerResponseData([ - 'name' => $this->getInput('name', - CWidgetConfig::getKnownWidgetTypes($this->getContext())[WIDGET_FAV_SCREENS] - ), - 'screens' => $screens, - 'user' => [ - 'debug_mode' => $this->getDebugMode() - ], - 'allowed_ui_screens' => $this->checkAccess(CRoleHelper::UI_MONITORING_SCREENS) - ])); - } -} diff --git a/ui/app/views/monitoring.widget.favscreens.view.php b/ui/app/views/monitoring.widget.favscreens.view.php deleted file mode 100644 index 39ff21ff589..00000000000 --- a/ui/app/views/monitoring.widget.favscreens.view.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/* -** Zabbix -** Copyright (C) 2001-2021 Zabbix SIA -** -** 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. -**/ - - -/** - * @var CView $this - */ - -$table = (new CTableInfo())->setNoDataMessage(_('No screens added.')); - -foreach ($data['screens'] as $screen) { - $url = $screen['slideshow'] - ? (new CUrl('slides.php'))->setArgument('elementid', $screen['slideshowid']) - : (new CUrl('screens.php'))->setArgument('elementid', $screen['screenid']); - $on_click = $screen['slideshow'] - ? "rm4favorites('slideshowid','".$screen['slideshowid']."')" - : "rm4favorites('screenid','".$screen['screenid']."')"; - - $table->addRow([ - $data['allowed_ui_screens'] - ? new CLink($screen['label'], $url) - : $screen['label'], - (new CButton()) - ->onClick($on_click) - ->addClass(ZBX_STYLE_REMOVE_BTN) - ->setAttribute('aria-label', _xs('Remove, %1$s', 'screen reader', $screen['label'])) - ->removeId() - ]); -} - -$output = [ - 'header' => $data['name'], - 'body' => $table->toString() -]; - -if (($messages = getMessages()) !== null) { - $output['messages'] = $messages->toString(); -} - -if ($data['user']['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) { - CProfiler::getInstance()->stop(); - $output['debug'] = CProfiler::getInstance()->make()->toString(); -} - -echo json_encode($output); diff --git a/ui/include/classes/mvc/CRouter.php b/ui/include/classes/mvc/CRouter.php index 6b4c19dac24..183a85b60ee 100644 --- a/ui/include/classes/mvc/CRouter.php +++ b/ui/include/classes/mvc/CRouter.php @@ -265,7 +265,6 @@ class CRouter { 'widget.discovery.view' => ['CControllerWidgetDiscoveryView', 'layout.widget', 'monitoring.widget.discovery.view'], 'widget.favgraphs.view' => ['CControllerWidgetFavGraphsView', 'layout.widget', 'monitoring.widget.favgraphs.view'], 'widget.favmaps.view' => ['CControllerWidgetFavMapsView', 'layout.widget', 'monitoring.widget.favmaps.view'], - 'widget.favscreens.view' => ['CControllerWidgetFavScreensView', 'layout.widget', 'monitoring.widget.favscreens.view'], 'widget.graph.view' => ['CControllerWidgetGraphView', 'layout.widget', 'monitoring.widget.graph.view'], 'widget.graphprototype.view' => ['CControllerWidgetIteratorGraphPrototypeView', 'layout.json', null], 'widget.hostavail.view' => ['CControllerWidgetHostAvailView', 'layout.widget', 'monitoring.widget.hostavail.view'], diff --git a/ui/include/classes/widgets/CWidgetConfig.php b/ui/include/classes/widgets/CWidgetConfig.php index 974f7696313..a9a5dae9286 100644 --- a/ui/include/classes/widgets/CWidgetConfig.php +++ b/ui/include/classes/widgets/CWidgetConfig.php @@ -48,7 +48,6 @@ class CWidgetConfig { WIDGET_DISCOVERY => _('Discovery status'), WIDGET_FAV_GRAPHS => _('Favourite graphs'), WIDGET_FAV_MAPS => _('Favourite maps'), - WIDGET_FAV_SCREENS => _('Favourite screens'), WIDGET_GRAPH => _('Graph (classic)'), WIDGET_GRAPH_PROTOTYPE => _('Graph prototype'), WIDGET_HOST_AVAIL => _('Host availability'), @@ -90,7 +89,6 @@ class CWidgetConfig { WIDGET_DISCOVERY => ['width' => 6, 'height' => 3], WIDGET_FAV_GRAPHS => ['width' => 4, 'height' => 3], WIDGET_FAV_MAPS => ['width' => 4, 'height' => 3], - WIDGET_FAV_SCREENS => ['width' => 4, 'height' => 3], WIDGET_GRAPH => ['width' => 12, 'height' => 5], WIDGET_GRAPH_PROTOTYPE => ['width' => 16, 'height' => 5], WIDGET_HOST_AVAIL => ['width' => 6, 'height' => 3], @@ -190,7 +188,6 @@ class CWidgetConfig { case WIDGET_CLOCK: case WIDGET_FAV_GRAPHS: case WIDGET_FAV_MAPS: - case WIDGET_FAV_SCREENS: case WIDGET_HOST_AVAIL: case WIDGET_MAP: case WIDGET_NAV_TREE: diff --git a/ui/include/defines.inc.php b/ui/include/defines.inc.php index 0eb78bead8b..23c1c9fc089 100644 --- a/ui/include/defines.inc.php +++ b/ui/include/defines.inc.php @@ -1450,7 +1450,6 @@ define('WIDGET_DATA_OVER', 'dataover'); define('WIDGET_DISCOVERY', 'discovery'); define('WIDGET_FAV_GRAPHS', 'favgraphs'); define('WIDGET_FAV_MAPS', 'favmaps'); -define('WIDGET_FAV_SCREENS', 'favscreens'); define('WIDGET_SVG_GRAPH', 'svggraph'); define('WIDGET_GRAPH', 'graph'); define('WIDGET_GRAPH_PROTOTYPE', 'graphprototype'); |