/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { $screen = API::Screen()->get(array('screenids' => $this->screenitem['resourceid'], 'output' => API_OUTPUT_EXTEND, 'selectScreenItems' => API_OUTPUT_EXTEND)); $screen = reset($screen); $screenBuilder = new CScreenBuilder(array('isFlickerfree' => $this->isFlickerfree, 'mode' => $this->mode == SCREEN_MODE_EDIT || $this->mode == SCREEN_MODE_SLIDESHOW ? SCREEN_MODE_SLIDESHOW : SCREEN_MODE_PREVIEW, 'timestamp' => $this->timestamp, 'screen' => $screen, 'period' => $this->timeline['period'], 'stime' => $this->timeline['stimeNow'], 'profileIdx' => $this->profileIdx, 'updateProfile' => false)); return $this->getOutput($screenBuilder->show(), true); }
/** * Insert javascript for standard screens. * * @param array $options * @param array $options['timeline'] * @param string $options['profileIdx'] * * @static */ public static function insertScreenStandardJs(array $options = array()) { CScreenBuilder::insertScreenScrollJs($options); CScreenBuilder::insertScreenRefreshTimeJs(); CScreenBuilder::insertProcessObjectsJs(); }
<?php /* ** Zabbix ** Copyright (C) 2001-2016 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. **/ $this->addJsFile('js/gtlc.js'); $this->addJsFile('js/flickerfreescreen.js'); (new CWidget())->setTitle(_('Web monitoring'))->setControls((new CForm('get'))->setName('slideHeaderForm')->addVar('fullscreen', $data['fullscreen'])->addVar('action', 'web.view')->addItem((new CList())->addItem([_('Group'), SPACE, $data['pageFilter']->getGroupsCB()])->addItem([_('Host'), SPACE, $data['pageFilter']->getHostsCB()])->addItem(get_icon('fullscreen', ['fullscreen' => $data['fullscreen']]))))->addItem(CScreenBuilder::getScreen(['resourcetype' => SCREEN_RESOURCE_HTTPTEST, 'mode' => SCREEN_MODE_JS, 'dataId' => 'httptest', 'groupid' => $data['pageFilter']->groupid, 'hostid' => $data['pageFilter']->hostid, 'page' => $data['page'], 'data' => ['hosts_selected' => $data['pageFilter']->hostsSelected, 'fullscreen' => $data['fullscreen'], 'sort' => $data['sort'], 'sortorder' => $data['sortorder']]])->get())->show();
} /* * Actions */ if ((hasRequest('widgetRefresh') || hasRequest('widgetRefreshRate')) && $data['screen']) { $elementId = getRequest('elementid'); $screen = getSlideshowScreens($elementId, getRequest('upd_counter')); // display screens $dbScreens = API::Screen()->get(['screenids' => $screen['screenid'], 'output' => API_OUTPUT_EXTEND, 'selectScreenItems' => API_OUTPUT_EXTEND]); if (!$dbScreens) { insert_js('alert("' . _('No permissions') . '");'); } else { $dbScreen = reset($dbScreens); // get fresh widget data if (hasRequest('widgetRefresh')) { $screenBuilder = new CScreenBuilder(['screen' => $dbScreen, 'mode' => SCREEN_MODE_PREVIEW, 'profileIdx' => 'web.slides', 'profileIdx2' => $elementId, 'hostid' => getRequest('hostid'), 'period' => getRequest('period'), 'stime' => getRequest('stime')]); CScreenBuilder::insertScreenCleanJs(); echo (new CDiv($screenBuilder->show()))->addClass(ZBX_STYLE_TABLE_FORMS_CONTAINER)->toString(); CScreenBuilder::insertScreenStandardJs(['timeline' => $screenBuilder->timeline, 'profileIdx' => $screenBuilder->profileIdx]); insertPagePostJs(); } // refresh rate if (hasRequest('widgetRefreshRate')) { $widgetRefreshRate = substr(getRequest('widgetRefreshRate'), 1); CProfile::update('web.slides.rf_rate.' . WIDGET_SLIDESHOW, $widgetRefreshRate, PROFILE_TYPE_STR, $elementId); } else { $widgetRefreshRate = CProfile::get('web.slides.rf_rate.' . WIDGET_SLIDESHOW, 1, getRequest('elementid', CProfile::get('web.slides.elementid'))); } $delay = $screen['delay'] > 0 ? $screen['delay'] : $data['screen']['delay']; insert_js('PMasters["slideshows"].dolls["' . WIDGET_SLIDESHOW . '"].frequency(' . CJs::encodeJson($delay * $widgetRefreshRate) . ');' . "\n" . 'PMasters["slideshows"].dolls["' . WIDGET_SLIDESHOW . '"].restartDoll();'); }
// if elementid is used to fetch an element, saving it in profile if (!$this->data['use_screen_name']) { CProfile::update('web.screens.elementid', $screen['screenid'], PROFILE_TYPE_ID); } // page header $screenWidget->addPageHeader(_('SCREENS'), array($headerForm, SPACE, get_icon('favourite', array('fav' => 'web.favorite.screenids', 'elname' => 'screenid', 'elid' => $screen['screenid'])), SPACE, get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen'])))); $screenWidget->addItem(BR()); // append screens combobox to page header $headerForm = new CForm('get'); $headerForm->setName('headerForm'); $headerForm->addVar('fullscreen', $this->data['fullscreen']); $elementsComboBox = new CComboBox('elementid', $screen['screenid'], 'submit()'); foreach ($this->data['screens'] as $dbScreen) { $elementsComboBox->addItem($dbScreen['screenid'], htmlspecialchars(get_node_name_by_elid($dbScreen['screenid'], null, NAME_DELIMITER) . $dbScreen['name'])); } $headerForm->addItem(array(_('Screens') . SPACE, $elementsComboBox)); if (check_dynamic_items($screen['screenid'], 0)) { $pageFilter = new CPageFilter(array('groups' => array('monitored_hosts' => true, 'with_items' => true), 'hosts' => array('monitored_hosts' => true, 'with_items' => true, 'DDFirstLabel' => _('Default')), 'hostid' => get_request('hostid', null), 'groupid' => get_request('groupid', null))); $_REQUEST['groupid'] = $pageFilter->groupid; $_REQUEST['hostid'] = $pageFilter->hostid; $headerForm->addItem(array(SPACE, _('Group'), SPACE, $pageFilter->getGroupsCB(true))); $headerForm->addItem(array(SPACE, _('Host'), SPACE, $pageFilter->getHostsCB(true))); } $screenWidget->addHeader($screen['name'], $headerForm); // append screens to widget $screenBuilder = new CScreenBuilder(array('screenid' => $screen['screenid'], 'mode' => SCREEN_MODE_PREVIEW, 'profileIdx' => 'web.screens', 'profileIdx2' => $screen['screenid'], 'groupid' => get_request('groupid'), 'hostid' => get_request('hostid'), 'period' => $this->data['period'], 'stime' => $this->data['stime'])); $screenWidget->addItem($screenBuilder->show()); CScreenBuilder::insertScreenStandardJs(array('timeline' => $screenBuilder->timeline, 'profileIdx' => $screenBuilder->profileIdx)); $screenWidget->addItem(BR()); } return $screenWidget;
* Graph in */ $graphInScreen = new CScreenBase(array('resourcetype' => SCREEN_RESOURCE_GRAPH, 'mode' => SCREEN_MODE_PREVIEW, 'dataId' => 'graph_in', 'profileIdx' => 'web.httptest', 'profileIdx2' => get_request('httptestid'), 'period' => get_request('period'), 'stime' => get_request('stime'))); $graphInScreen->timeline['starttime'] = date(TIMESTAMP_FORMAT, get_min_itemclock_by_itemid($itemIds)); $src = 'chart3.php?height=150' . '&name=' . $httpTest['name'] . '&http_item_type=' . HTTPSTEP_ITEM_TYPE_IN . '&httptestid=' . $httpTest['httptestid'] . '&graphtype=' . GRAPH_TYPE_STACKED . '&period=' . $graphInScreen->timeline['period'] . '&stime=' . $graphInScreen->timeline['stime'] . '&profileIdx=' . $graphInScreen->profileIdx . '&profileIdx2=' . $graphInScreen->profileIdx2; $graphInContainer = new CDiv(new CLink(null, $src), 'flickerfreescreen', 'flickerfreescreen_graph_in'); $graphInContainer->setAttribute('style', 'position: relative'); $graphInContainer->setAttribute('data-timestamp', time()); $graphTable->addRow(array(bold(_('Speed')), $graphInContainer)); $timeControlData = array('id' => 'graph_in', 'containerid' => 'flickerfreescreen_graph_in', 'src' => $src, 'objDims' => $graphDims, 'loadSBox' => 1, 'loadImage' => 1, 'periodFixed' => CProfile::get('web.httptest.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD); zbx_add_post_js('timeControl.addObject("graph_in", ' . zbx_jsvalue($graphInScreen->timeline) . ', ' . zbx_jsvalue($timeControlData) . ');'); $graphInScreen->insertFlickerfreeJs(); /* * Graph time */ $graphTimeScreen = new CScreenBase(array('resourcetype' => SCREEN_RESOURCE_GRAPH, 'mode' => SCREEN_MODE_PREVIEW, 'dataId' => 'graph_time', 'profileIdx' => 'web.httptest', 'profileIdx2' => get_request('httptestid'), 'period' => get_request('period'), 'stime' => get_request('stime'))); $src = 'chart3.php?height=150' . '&name=' . $httpTest['name'] . '&http_item_type=' . HTTPSTEP_ITEM_TYPE_TIME . '&httptestid=' . $httpTest['httptestid'] . '&graphtype=' . GRAPH_TYPE_STACKED . '&period=' . $graphTimeScreen->timeline['period'] . '&stime=' . $graphTimeScreen->timeline['stime'] . '&profileIdx=' . $graphTimeScreen->profileIdx . '&profileIdx2=' . $graphTimeScreen->profileIdx2; $graphTimeContainer = new CDiv(new CLink(null, $src), 'flickerfreescreen', 'flickerfreescreen_graph_time'); $graphTimeContainer->setAttribute('style', 'position: relative'); $graphTimeContainer->setAttribute('data-timestamp', time()); $graphTable->addRow(array(bold(_('Response time')), $graphTimeContainer)); $timeControlData = array('id' => 'graph_time', 'containerid' => 'flickerfreescreen_graph_time', 'src' => $src, 'objDims' => $graphDims, 'loadSBox' => 1, 'loadImage' => 1, 'periodFixed' => CProfile::get('web.httptest.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD); zbx_add_post_js('timeControl.addObject("graph_time", ' . zbx_jsvalue($graphInScreen->timeline) . ', ' . zbx_jsvalue($timeControlData) . ');'); $graphTimeScreen->insertFlickerfreeJs(); // scroll CScreenBuilder::insertScreenScrollJs(array('timeline' => $graphInScreen->timeline)); CScreenBuilder::insertScreenRefreshTimeJs(); CScreenBuilder::insertProcessObjectsJs(); $graphsWidget->addItem($graphTable); $graphsWidget->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
} } elseif ($_REQUEST['favobj'] == 'hat') { if ($_REQUEST['favref'] == 'hat_slides') { $elementid = get_request('elementid'); if (!is_null($elementid)) { $slideshow = get_slideshow_by_slideshowid($elementid); $screen = get_slideshow($elementid, get_request('upd_counter')); $screens = API::Screen()->get(array('screenids' => $screen['screenid'])); if (empty($screens)) { insert_js('alert("' . _('No permissions') . '");'); } else { $page['type'] = PAGE_TYPE_JS; // display screens $screens = API::Screen()->get(array('screenids' => $screen['screenid'], 'output' => API_OUTPUT_EXTEND, 'selectScreenItems' => API_OUTPUT_EXTEND)); $currentScreen = reset($screens); $screenBuilder = new CScreenBuilder(array('screen' => $currentScreen, 'mode' => SCREEN_MODE_PREVIEW, 'profileIdx' => 'web.slides', 'profileIdx2' => $elementid, 'period' => get_request('period'), 'stime' => get_request('stime'))); CScreenBuilder::insertScreenCleanJs(); echo $screenBuilder->show()->toString(); CScreenBuilder::insertScreenStandardJs(array('timeline' => $screenBuilder->timeline, 'profileIdx' => $screenBuilder->profileIdx)); insertPagePostJs(); // insert slide show refresh js $refresh = $screen['delay'] > 0 ? $screen['delay'] : $slideshow['delay']; $refresh_multipl = CProfile::get('web.slides.rf_rate.hat_slides', 1, $elementid); $script = get_update_doll_script('mainpage', $_REQUEST['favref'], 'frequency', $refresh * $refresh_multipl) . "\n"; $script .= get_update_doll_script('mainpage', $_REQUEST['favref'], 'restartDoll') . "\n"; insert_js($script); } } else { echo SBR . _('No slide shows defined.'); } }
<?php /* ** Zabbix ** Copyright (C) 2001-2016 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. **/ $widget = (new CWidget())->setTitle(_('Screens') . ': ' . $data['screen']['name']); if ($data['screen']['templateid']) { $widget->addItem(get_header_host_table('screens', $data['screen']['templateid'])); } $screenBuilder = new CScreenBuilder(['isFlickerfree' => false, 'screen' => $data['screen'], 'mode' => SCREEN_MODE_EDIT, 'updateProfile' => false]); $widget->addItem((new CDiv($screenBuilder->show()))->addClass(ZBX_STYLE_TABLE_FORMS_CONTAINER)); $screenBuilder->insertInitScreenJs($data['screenid']); $screenBuilder->insertProcessObjectsJs(); return $widget;
$screen = CScreenBuilder::getScreen(array('resourcetype' => SCREEN_RESOURCE_HISTORY, 'action' => $this->data['action'], 'items' => $this->data['items'], 'item' => $this->data['item'], 'itemids' => $this->data['itemids'], 'profileIdx' => 'web.item.graph', 'profileIdx2' => reset($this->data['itemids']), 'period' => $this->data['period'], 'stime' => $this->data['stime'], 'filter' => get_request('filter'), 'filter_task' => get_request('filter_task'), 'mark_color' => get_request('mark_color'), 'plaintext' => $this->data['plaintext'])); // append plaintext to widget if ($this->data['plaintext']) { $plaintextSpan = new CSpan(null, 'textblackwhite'); foreach ($headerPlaintext as $text) { $plaintextSpan->addItem(array(new CJSscript($text), BR())); } $screen = $screen->get(); $pre = new CTag('pre', true); foreach ($screen as $text) { $pre->addItem(new CJSscript($text)); } $plaintextSpan->addItem($pre); $historyWidget->addItem($plaintextSpan); } else { $right = new CTable(); $right->addRow($header['right']); $historyWidget->addPageHeader($header['left'], $right); $historyWidget->addItem(SPACE); if (isset($this->data['iv_string'][$this->data['item']['value_type']])) { $historyWidget->addFlicker($filterForm, CProfile::get('web.history.filter.state', 1)); } $historyTable = new CTable(null, 'maxwidth'); $historyTable->addRow($screen->get()); $historyWidget->addItem($historyTable); if ($this->data['action'] == 'showvalues' || $this->data['action'] == 'showgraph') { $historyWidget->addFlicker(new CDiv(null, null, 'scrollbar_cntr'), CProfile::get('web.history.filter.state', 1)); CScreenBuilder::insertScreenStandardJs(array('timeline' => $screen->timeline, 'profileIdx' => $screen->profileIdx)); } } return $historyWidget;
** 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. **/ $chartsWidget = (new CWidget())->setTitle(_('Graphs')); $controls = (new CList())->addItem([_('Group') . SPACE, $this->data['pageFilter']->getGroupsCB()])->addItem([_('Host') . SPACE, $this->data['pageFilter']->getHostsCB()])->addItem([_('Graph') . SPACE, $this->data['pageFilter']->getGraphsCB()]); if ($this->data['graphid']) { $controls->addItem(get_icon('favourite', ['fav' => 'web.favorite.graphids', 'elname' => 'graphid', 'elid' => $this->data['graphid']])); $controls->addItem(get_icon('reset', ['id' => $this->data['graphid']])); $controls->addItem(get_icon('fullscreen', ['fullscreen' => $this->data['fullscreen']])); } else { $controls->addItem([get_icon('fullscreen', ['fullscreen' => $this->data['fullscreen']])]); } $chartForm = (new CForm('get'))->addVar('fullscreen', $this->data['fullscreen'])->addItem($controls); $chartsWidget->setControls($chartForm); $filterForm = (new CFilter('web.charts.filter.state'))->addNavigator(); $chartsWidget->addItem($filterForm); if (!empty($this->data['graphid'])) { // append chart to widget $screen = CScreenBuilder::getScreen(['resourcetype' => SCREEN_RESOURCE_CHART, 'graphid' => $this->data['graphid'], 'profileIdx' => 'web.screens', 'profileIdx2' => $this->data['graphid']]); $chartTable = (new CTable())->setAttribute('style', 'width: 100%;')->addRow($screen->get()); $chartsWidget->addItem($chartTable); CScreenBuilder::insertScreenStandardJs(['timeline' => $screen->timeline, 'profileIdx' => $screen->profileIdx]); } else { $screen = new CScreenBuilder(); CScreenBuilder::insertScreenStandardJs(['timeline' => $screen->timeline]); $chartsWidget->addItem(new CTableInfo()); } return $chartsWidget;
} $result = array('result' => (bool) $session['serverCheckResult'], 'message' => $session['serverCheckResult'] ? '' : _('Zabbix server is not running: the information displayed may not be current.')); break; case 'screen.get': $options = array('pageFile' => !empty($data['pageFile']) ? $data['pageFile'] : null, 'mode' => !empty($data['mode']) ? $data['mode'] : null, 'timestamp' => !empty($data['timestamp']) ? $data['timestamp'] : time(), 'resourcetype' => !empty($data['resourcetype']) ? $data['resourcetype'] : null, 'screenid' => isset($data['screenid']) && $data['screenid'] != 0 ? $data['screenid'] : null, 'screenitemid' => !empty($data['screenitemid']) ? $data['screenitemid'] : null, 'groupid' => !empty($data['groupid']) ? $data['groupid'] : null, 'hostid' => !empty($data['hostid']) ? $data['hostid'] : null, 'period' => !empty($data['period']) ? $data['period'] : null, 'stime' => !empty($data['stime']) ? $data['stime'] : null, 'profileIdx' => !empty($data['profileIdx']) ? $data['profileIdx'] : null, 'profileIdx2' => !empty($data['profileIdx2']) ? $data['profileIdx2'] : null, 'updateProfile' => isset($data['updateProfile']) ? $data['updateProfile'] : null); if ($options['resourcetype'] == SCREEN_RESOURCE_HISTORY) { $options['itemids'] = !empty($data['itemids']) ? $data['itemids'] : null; $options['action'] = !empty($data['action']) ? $data['action'] : null; $options['filter'] = !empty($data['filter']) ? $data['filter'] : null; $options['filter_task'] = !empty($data['filter_task']) ? $data['filter_task'] : null; $options['mark_color'] = !empty($data['mark_color']) ? $data['mark_color'] : null; } elseif ($options['resourcetype'] == SCREEN_RESOURCE_CHART) { $options['graphid'] = !empty($data['graphid']) ? $data['graphid'] : null; $options['profileIdx2'] = $options['graphid']; } $screenBase = CScreenBuilder::getScreen($options); if (!empty($screenBase)) { $screen = $screenBase->get(); } if (!empty($screen)) { if ($options['mode'] == SCREEN_MODE_JS) { $result = $screen; } else { if (is_object($screen)) { $result = $screen->toString(); } } } else { $result = ''; } break;
** 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. **/ $chartsWidget = new CWidget('hat_charts'); $chartForm = new CForm('get'); $chartForm->addVar('fullscreen', $this->data['fullscreen']); $chartForm->addItem(array(_('Group') . SPACE, $this->data['pageFilter']->getGroupsCB(true))); $chartForm->addItem(array(SPACE . _('Host') . SPACE, $this->data['pageFilter']->getHostsCB(true))); $chartForm->addItem(array(SPACE . _('Graph') . SPACE, $this->data['pageFilter']->getGraphsCB(true))); $chartsWidget->addFlicker(new CDiv(null, null, 'scrollbar_cntr'), CProfile::get('web.charts.filter.state', 1)); if ($this->data['graphid']) { $chartsWidget->addPageHeader(_('GRAPHS'), array(get_icon('favourite', array('fav' => 'web.favorite.graphids', 'elname' => 'graphid', 'elid' => $this->data['graphid'])), SPACE, get_icon('reset', array('id' => $this->data['graphid'])), SPACE, get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen'])))); } else { $chartsWidget->addPageHeader(_('GRAPHS'), array(get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen'])))); } $chartsWidget->addHeader(isset($this->data['pageFilter']->graphs[$this->data['graphid']]['name']) ? $this->data['pageFilter']->graphs[$this->data['graphid']]['name'] : null, $chartForm); $chartsWidget->addItem(BR()); if (!empty($this->data['graphid'])) { // append chart to widget $screen = CScreenBuilder::getScreen(array('resourcetype' => SCREEN_RESOURCE_CHART, 'graphid' => $this->data['graphid'], 'profileIdx' => 'web.screens', 'profileIdx2' => $this->data['graphid'])); $chartTable = new CTable(null, 'maxwidth'); $chartTable->addRow($screen->get()); $chartsWidget->addItem($chartTable); CScreenBuilder::insertScreenStandardJs(array('timeline' => $screen->timeline, 'profileIdx' => $screen->profileIdx)); } else { $screen = new CScreenBuilder(); CScreenBuilder::insertScreenStandardJs(array('timeline' => $screen->timeline)); $chartsWidget->addItem(new CTableInfo(_('No graphs found.'))); } return $chartsWidget;
} $screen = $screen->get(); $pre = new CPre(); foreach ($screen as $text) { $pre->addItem([$text, BR()]); } $historyWidget->addItem($pre); } else { $historyWidget->setTitle($header['left'])->setControls($header['right']); if (isset($this->data['iv_string'][$this->data['value_type']])) { $filterForm->addNavigator(); } if (in_array($this->data['action'], [HISTORY_VALUES, HISTORY_GRAPH, HISTORY_BATCH_GRAPH])) { if (!isset($filterForm)) { $filterForm = new CFilter('web.history.filter.state'); } // display the graph type filter for graphs with multiple items if ($this->data['action'] == HISTORY_BATCH_GRAPH) { $filterForm->addColumn((new CFormList())->addRow(_('Graph type'), (new CRadioButtonList('graphtype', (int) $this->data['graphtype']))->addValue(_('Normal'), GRAPH_TYPE_NORMAL)->addValue(_('Stacked'), GRAPH_TYPE_STACKED)->setModern(true))); $filterForm->removeButtons(); $filterForm->addVar('fullscreen', $this->data['fullscreen']); $filterForm->addVar('action', $this->data['action']); $filterForm->addVar('itemids', $this->data['itemids']); } $filterForm->addNavigator(); $historyWidget->addItem($filterForm); } $historyWidget->addItem($screen->get()); CScreenBuilder::insertScreenStandardJs(['timeline' => $screen->timeline, 'profileIdx' => $screen->profileIdx]); } return $historyWidget;
<?php /* ** Zabbix ** Copyright (C) 2001-2016 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. **/ $this->addJsFile('js/gtlc.js'); $this->addJsFile('js/flickerfreescreen.js'); $widget = (new CWidget())->setTitle(_('Status of discovery')); // create header form $controls = (new CList())->addItem([_('Discovery rule'), SPACE, $data['pageFilter']->getDiscoveryCB()])->addItem(get_icon('fullscreen', ['fullscreen' => $data['fullscreen']])); $widget->setControls((new CForm('get'))->setName('slideHeaderForm')->addVar('action', 'discovery.view')->addVar('fullscreen', $data['fullscreen'])->addItem($controls)); $discovery_table = CScreenBuilder::getScreen(['resourcetype' => SCREEN_RESOURCE_DISCOVERY, 'mode' => SCREEN_MODE_JS, 'dataId' => 'discovery', 'data' => ['druleid' => $data['druleid'], 'sort' => $data['sort'], 'sortorder' => $data['sortorder']]])->get(); $widget->addItem($discovery_table)->show();
<?php /* ** Zabbix ** Copyright (C) 2001-2016 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. **/ $this->addJsFile('js/gtlc.js'); $this->addJsFile('js/flickerfreescreen.js'); (new CWidget())->setTitle(_('Maps'))->setControls((new CForm('get'))->cleanItems()->addVar('action', 'map.view')->addVar('sysmapid', $data['map']['sysmapid'])->addVar('fullscreen', $data['fullscreen'])->addItem((new CList())->addItem([_('Minimum severity'), SPACE, $data['pageFilter']->getSeveritiesMinCB()])->addItem($data['map']['editable'] ? (new CButton('edit', _('Edit map')))->onClick('redirect("sysmap.php?sysmapid=' . $data['map']['sysmapid'] . '")') : null)->addItem(get_icon('favourite', ['fav' => 'web.favorite.sysmapids', 'elname' => 'sysmapid', 'elid' => $data['map']['sysmapid']]))->addItem(get_icon('fullscreen', ['fullscreen' => $data['fullscreen']]))))->addItem(get_header_sysmap_table($data['map']['sysmapid'], $data['map']['name'], $data['fullscreen'], $data['severity_min']))->addItem((new CDiv())->addClass(ZBX_STYLE_TABLE_FORMS_CONTAINER)->addItem(CScreenBuilder::getScreen(['resourcetype' => SCREEN_RESOURCE_MAP, 'mode' => SCREEN_MODE_PREVIEW, 'dataId' => 'mapimg', 'screenitem' => ['screenitemid' => $data['map']['sysmapid'], 'screenid' => null, 'resourceid' => $data['map']['sysmapid'], 'width' => null, 'height' => null, 'severity_min' => $data['severity_min']]])->get()))->show();
/* ** Zabbix ** Copyright (C) 2001-2014 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. **/ $screenWidget = new CWidget(); $screenWidget->addPageHeader(_('CONFIGURATION OF SCREENS')); $screenWidget->addHeader($this->data['screen']['name']); if (!empty($this->data['screen']['templateid'])) { $screenWidget->addItem(get_header_host_table('screens', $this->data['screen']['templateid'])); } $screenWidget->addItem(BR()); $screenBuilder = new CScreenBuilder(array('isFlickerfree' => false, 'screen' => $this->data['screen'], 'mode' => SCREEN_MODE_EDIT, 'updateProfile' => false)); $screenWidget->addItem($screenBuilder->show()); $screenBuilder->insertInitScreenJs($this->data['screenid']); $screenBuilder->insertProcessObjectsJs(); return $screenWidget;
** 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. **/ $widget = (new CWidget())->setTitle(_('Screens'))->addItem((new CList())->addClass(ZBX_STYLE_OBJECT_GROUP)->addItem([(new CSpan())->addItem(new CLink(_('All screens'), 'screenconf.php')), '/', (new CSpan())->addClass(ZBX_STYLE_SELECTED)->addItem(new CLink($data['screen']['name'], 'screens.php?elementid=' . $data['screen']['screenid'] . '&fullscreen=' . $data['fullscreen']))]))->addItem((new CFilter('web.screens.filter.state'))->addNavigator()); $controls = (new CList())->addItem(new CComboBox('config', 'screens.php', 'redirect(this.options[this.selectedIndex].value);', ['screens.php' => _('Screens'), 'slides.php' => _('Slide shows')])); // Append screens combobox to page header. $form = (new CForm())->setName('headerForm')->addVar('fullscreen', $data['fullscreen']); if (check_dynamic_items($data['screen']['screenid'], 0)) { $pageFilter = new CPageFilter(['groups' => ['monitored_hosts' => true, 'with_items' => true], 'hosts' => ['monitored_hosts' => true, 'with_items' => true, 'DDFirstLabel' => _('not selected')], 'hostid' => getRequest('hostid'), 'groupid' => getRequest('groupid')]); $_REQUEST['groupid'] = $pageFilter->groupid; $_REQUEST['hostid'] = $pageFilter->hostid; $controls->addItem([_('Group') . SPACE, $pageFilter->getGroupsCB()])->addItem([_('Host') . SPACE, $pageFilter->getHostsCB()]); } // page header $controls->addItem($data['screen']['editable'] ? (new CButton('edit', _('Edit screen')))->onClick('redirect("screenedit.php?screenid=' . $data['screen']['screenid'] . '")') : null)->addItem(get_icon('favourite', ['fav' => 'web.favorite.screenids', 'elname' => 'screenid', 'elid' => $data['screen']['screenid']]))->addItem(get_icon('fullscreen', ['fullscreen' => $data['fullscreen']])); $form->addItem($controls); $widget->setControls($form); // Append screens to widget. $screenBuilder = new CScreenBuilder(['screenid' => $data['screen']['screenid'], 'mode' => SCREEN_MODE_PREVIEW, 'profileIdx' => 'web.screens', 'profileIdx2' => $data['screen']['screenid'], 'groupid' => getRequest('groupid'), 'hostid' => getRequest('hostid'), 'period' => $data['period'], 'stime' => $data['stime']]); $widget->addItem((new CDiv($screenBuilder->show()))->addClass(ZBX_STYLE_TABLE_FORMS_CONTAINER)); CScreenBuilder::insertScreenStandardJs(['timeline' => $screenBuilder->timeline, 'profileIdx' => $screenBuilder->profileIdx]); return $widget;
updateMessageSettings($msgsettings); break; } break; case 'zabbix.status': CSession::start(); if (!CSession::keyExists('serverCheckResult') || CSession::getValue('serverCheckTime') + SERVER_CHECK_INTERVAL <= time()) { $zabbixServer = new CZabbixServer($ZBX_SERVER, $ZBX_SERVER_PORT, ZBX_SOCKET_TIMEOUT, 0); CSession::setValue('serverCheckResult', $zabbixServer->isRunning()); CSession::setValue('serverCheckTime', time()); } $result = ['result' => (bool) CSession::getValue('serverCheckResult'), 'message' => CSession::getValue('serverCheckResult') ? '' : _('Zabbix server is not running: the information displayed may not be current.')]; break; case 'screen.get': $result = ''; $screenBase = CScreenBuilder::getScreen($data); if ($screenBase !== null) { $screen = $screenBase->get(); if ($data['mode'] == SCREEN_MODE_JS) { $result = $screen; } else { if (is_object($screen)) { $result = $screen->toString(); } } } break; /** * Create multi select data. * Supported objects: "applications", "hosts", "hostGroup", "templates", "triggers" *