<?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();
/** * Process screen with particular screen objects. * * @return CTable */ public function show() { if (empty($this->screen)) { return new CTableInfo(_('No screens defined.')); } $skipedFields = array(); $screenitems = array(); $emptyScreenColumns = array(); // calculate table columns and rows foreach ($this->screen['screenitems'] as $screenitem) { $screenitems[] = $screenitem; for ($i = 0; $i < $screenitem['rowspan'] || $i == 0; $i++) { for ($j = 0; $j < $screenitem['colspan'] || $j == 0; $j++) { if ($i != 0 || $j != 0) { if (!isset($skipedFields[$screenitem['y'] + $i])) { $skipedFields[$screenitem['y'] + $i] = array(); } $skipedFields[$screenitem['y'] + $i][$screenitem['x'] + $j] = 1; } } } } // create screen table $screenTable = new CTable(); $screenTable->setAttribute('class', in_array($this->mode, array(SCREEN_MODE_PREVIEW, SCREEN_MODE_SLIDESHOW)) ? 'screen_view' : 'screen_edit'); $screenTable->setAttribute('id', 'iframe'); // action top row if ($this->mode == SCREEN_MODE_EDIT) { $newColumns = array(new CCol(new CImg('images/general/zero.png', 'zero', 1, 1))); for ($i = 0, $size = $this->screen['hsize'] + 1; $i < $size; $i++) { $icon = new CImg('images/general/plus.png', null, null, null, 'pointer'); $icon->addAction('onclick', 'javascript: location.href = "screenedit.php?config=1&screenid=' . $this->screen['screenid'] . '&add_col=' . $i . '";'); array_push($newColumns, new CCol($icon)); } $screenTable->addRow($newColumns); } for ($r = 0; $r < $this->screen['vsize']; $r++) { $newColumns = array(); $emptyScreenRow = true; // action left cell if ($this->mode == SCREEN_MODE_EDIT) { $icon = new CImg('images/general/plus.png', null, null, null, 'pointer'); $icon->addAction('onclick', 'javascript: location.href = "screenedit.php?config=1&screenid=' . $this->screen['screenid'] . '&add_row=' . $r . '";'); array_push($newColumns, new CCol($icon)); } for ($c = 0; $c < $this->screen['hsize']; $c++) { if (isset($skipedFields[$r][$c])) { continue; } // screen item $isEditForm = false; $screenitem = array(); foreach ($screenitems as $tmprow) { if ($tmprow['x'] == $c && $tmprow['y'] == $r) { $screenitem = $tmprow; break; } } if (empty($screenitem)) { $screenitem = array('screenitemid' => 0, 'resourcetype' => 0, 'resourceid' => 0, 'width' => 0, 'height' => 0, 'colspan' => 1, 'rowspan' => 1, 'elements' => 0, 'valign' => VALIGN_DEFAULT, 'halign' => HALIGN_DEFAULT, 'style' => 0, 'url' => '', 'dynamic' => 0, 'sort_triggers' => SCREEN_SORT_TRIGGERS_DATE_DESC); } if (!empty($screenitem['screenitemid'])) { $emptyScreenRow = false; $emptyScreenColumns[$c] = 1; } // action if ($this->mode == SCREEN_MODE_EDIT && $screenitem['screenitemid'] != 0) { $action = 'screenedit.php?form=update' . url_param('screenid') . '&screenitemid=' . $screenitem['screenitemid']; } elseif ($this->mode == SCREEN_MODE_EDIT && $screenitem['screenitemid'] == 0) { $action = 'screenedit.php?form=update' . url_param('screenid') . '&x=' . $c . '&y=' . $r; } else { $action = null; } // edit form cell if ($this->mode == SCREEN_MODE_EDIT && (isset($_REQUEST['form']) && $_REQUEST['form'] == 'update') && (isset($_REQUEST['x']) && $_REQUEST['x'] == $c && isset($_REQUEST['y']) && $_REQUEST['y'] == $r || isset($_REQUEST['screenitemid']) && bccomp($_REQUEST['screenitemid'], $screenitem['screenitemid']) == 0)) { $screenView = new CView('configuration.screen.constructor.edit', array('screen' => $this->screen)); $item = $screenView->render(); $isEditForm = true; } elseif (!empty($screenitem['screenitemid']) && isset($screenitem['resourcetype'])) { $screenBase = CScreenBuilder::getScreen(array('isFlickerfree' => $this->isFlickerfree, 'pageFile' => $this->pageFile, 'mode' => $this->mode, 'timestamp' => $this->timestamp, 'hostid' => $this->hostid, 'profileIdx' => $this->profileIdx, 'profileIdx2' => $this->profileIdx2, 'updateProfile' => $this->updateProfile, 'timeline' => $this->timeline, 'resourcetype' => $screenitem['resourcetype'], 'screenitem' => $screenitem)); if (!empty($screenBase)) { if ($this->mode == SCREEN_MODE_EDIT && !empty($screenitem['screenitemid'])) { $screenBase->action = 'screenedit.php?form=update' . url_param('screenid') . '&screenitemid=' . $screenitem['screenitemid']; } elseif ($this->mode == SCREEN_MODE_EDIT && empty($screenitem['screenitemid'])) { $screenBase->action = 'screenedit.php?form=update' . url_param('screenid') . '&x=' . $c . '&y=' . $r; } $item = $screenBase->get(); } else { $item = null; } } else { $item = array(SPACE); if ($this->mode == SCREEN_MODE_EDIT) { array_push($item, BR(), new CLink(_('Change'), $action, 'empty_change_link')); } } // align $halign = 'def'; if ($screenitem['halign'] == HALIGN_CENTER) { $halign = 'cntr'; } if ($screenitem['halign'] == HALIGN_LEFT) { $halign = 'left'; } if ($screenitem['halign'] == HALIGN_RIGHT) { $halign = 'right'; } $valign = 'def'; if ($screenitem['valign'] == VALIGN_MIDDLE) { $valign = 'mdl'; } if ($screenitem['valign'] == VALIGN_TOP) { $valign = 'top'; } if ($screenitem['valign'] == VALIGN_BOTTOM) { $valign = 'bttm'; } if ($this->mode == SCREEN_MODE_EDIT && !$isEditForm) { $item = new CDiv($item, 'draggable'); $item->setAttribute('id', 'position_' . $r . '_' . $c); $item->setAttribute('data-xcoord', $c); $item->setAttribute('data-ycoord', $r); } // colspan/rowspan $newColumn = new CCol($item, $halign . '_' . $valign . ' screenitem'); if (!empty($screenitem['colspan'])) { $newColumn->setColSpan($screenitem['colspan']); } if (!empty($screenitem['rowspan'])) { $newColumn->setRowSpan($screenitem['rowspan']); } array_push($newColumns, $newColumn); } // action right cell if ($this->mode == SCREEN_MODE_EDIT) { $icon = new CImg('images/general/minus.png', null, null, null, 'pointer'); if ($emptyScreenRow) { $removeRowLink = 'javascript: location.href = "screenedit.php?screenid=' . $this->screen['screenid'] . '&rmv_row=' . $r . '";'; } else { $removeRowLink = 'javascript: if (Confirm("' . _('This screen-row is not empty. Delete it?') . '")) {' . ' location.href = "screenedit.php?screenid=' . $this->screen['screenid'] . '&rmv_row=' . $r . '"; }'; } $icon->addAction('onclick', $removeRowLink); array_push($newColumns, new CCol($icon)); } $screenTable->addRow(new CRow($newColumns)); } // action bottom row if ($this->mode == SCREEN_MODE_EDIT) { $icon = new CImg('images/general/plus.png', null, null, null, 'pointer'); $icon->addAction('onclick', 'javascript: location.href = "screenedit.php?screenid=' . $this->screen['screenid'] . '&add_row=' . $this->screen['vsize'] . '";'); $newColumns = array(new CCol($icon)); for ($i = 0; $i < $this->screen['hsize']; $i++) { $icon = new CImg('images/general/minus.png', null, null, null, 'pointer'); if (isset($emptyScreenColumns[$i])) { $removeColumnLink = 'javascript: if (Confirm("' . _('This screen-column is not empty. Delete it?') . '")) {' . ' location.href = "screenedit.php?screenid=' . $this->screen['screenid'] . '&rmv_col=' . $i . '"; }'; } else { $removeColumnLink = 'javascript: location.href = "screenedit.php?config=1&screenid=' . $this->screen['screenid'] . '&rmv_col=' . $i . '";'; } $icon->addAction('onclick', $removeColumnLink); array_push($newColumns, new CCol($icon)); } array_push($newColumns, new CCol(new CImg('images/general/zero.png', 'zero', 1, 1))); $screenTable->addRow($newColumns); } return $screenTable; }
** 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;
$taskComboBox->addItem(FILTER_TASK_INVERT_MARK, _('Mark others')); $tasks = array($taskComboBox); if (str_in_array($filterTask, array(FILTER_TASK_MARK, FILTER_TASK_INVERT_MARK))) { $colorComboBox = new CComboBox('mark_color', get_request('mark_color', 0)); $colorComboBox->addItem(MARK_COLOR_RED, _('as Red')); $colorComboBox->addItem(MARK_COLOR_GREEN, _('as Green')); $colorComboBox->addItem(MARK_COLOR_BLUE, _('as Blue')); $tasks[] = SPACE; $tasks[] = $colorComboBox; } $filterForm->addRow(_('Selected'), $tasks); $filterForm->addItemToBottomRow(new CSubmit('select', _('Filter'))); } } // create history screen $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();
/** * Process screen with particular screen objects. * * @return CTable */ public function show() { if (empty($this->screen)) { return new CTableInfo(); } $skipedFields = []; $screenitems = []; $emptyScreenColumns = []; // calculate table columns and rows foreach ($this->screen['screenitems'] as $screenitem) { $screenitems[] = $screenitem; for ($i = 0; $i < $screenitem['rowspan'] || $i == 0; $i++) { for ($j = 0; $j < $screenitem['colspan'] || $j == 0; $j++) { if ($i != 0 || $j != 0) { if (!isset($skipedFields[$screenitem['y'] + $i])) { $skipedFields[$screenitem['y'] + $i] = []; } $skipedFields[$screenitem['y'] + $i][$screenitem['x'] + $j] = 1; } } } } // create screen table $screenTable = (new CTable())->setId(self::makeScreenTableId($this->screen['screenid']))->addClass(ZBX_STYLE_SCREEN_TABLE); if ($this->mode == SCREEN_MODE_EDIT) { $screenTable->addClass(ZBX_STYLE_DASHED_BORDER); } // action top row if ($this->mode == SCREEN_MODE_EDIT) { $newColumns = [(new CCol())->addClass(ZBX_STYLE_CELL_WIDTH)]; for ($i = 0, $size = $this->screen['hsize']; $i < $size; $i++) { if ($this->screen['hsize'] >= SCREEN_MAX_SIZE) { $link = (new CDiv('+'))->addClass(ZBX_STYLE_TREEVIEW_PLUS)->addClass(ZBX_STYLE_DISABLED); } else { $link = (new CLink('+', 'screenedit.php?screenid=' . $this->screen['screenid'] . url_param('templateid') . '&add_col=' . $i))->addClass(ZBX_STYLE_TREEVIEW_PLUS)->addSID(); } $newColumns[] = (new CCol($link))->addClass(ZBX_STYLE_CENTER)->addClass(ZBX_STYLE_MIDDLE); } if ($this->screen['hsize'] >= SCREEN_MAX_SIZE) { $link = (new CDiv('+'))->addClass(ZBX_STYLE_TREEVIEW_PLUS)->addClass(ZBX_STYLE_DISABLED); } else { $link = (new CLink('+', 'screenedit.php?screenid=' . $this->screen['screenid'] . url_param('templateid') . '&add_col=' . $this->screen['hsize']))->addClass(ZBX_STYLE_TREEVIEW_PLUS)->addSID(); } $newColumns[] = (new CCol($link))->addClass(ZBX_STYLE_CENTER)->addClass(ZBX_STYLE_MIDDLE)->addClass(ZBX_STYLE_CELL_WIDTH); $screenTable->addRow($newColumns); } for ($r = 0; $r < $this->screen['vsize']; $r++) { $newColumns = []; $emptyScreenRow = true; // action left cell if ($this->mode == SCREEN_MODE_EDIT) { if ($this->screen['vsize'] >= SCREEN_MAX_SIZE) { $link = (new CDiv('+'))->addClass(ZBX_STYLE_TREEVIEW_PLUS)->addClass(ZBX_STYLE_DISABLED); } else { $link = (new CLink('+', 'screenedit.php?screenid=' . $this->screen['screenid'] . url_param('templateid') . '&add_row=' . $r))->addClass(ZBX_STYLE_TREEVIEW_PLUS)->addSID(); } $newColumns[] = (new CCol($link))->addClass(ZBX_STYLE_CENTER)->addClass(ZBX_STYLE_MIDDLE); } for ($c = 0; $c < $this->screen['hsize']; $c++) { if (isset($skipedFields[$r][$c])) { continue; } // screen item $isEditForm = false; $screenitem = []; foreach ($screenitems as $tmprow) { if ($tmprow['x'] == $c && $tmprow['y'] == $r) { $screenitem = $tmprow; break; } } if (empty($screenitem)) { $screenitem = ['screenitemid' => 0, 'resourcetype' => 0, 'resourceid' => 0, 'width' => 0, 'height' => 0, 'colspan' => 1, 'rowspan' => 1, 'elements' => 0, 'valign' => VALIGN_DEFAULT, 'halign' => HALIGN_DEFAULT, 'style' => 0, 'url' => '', 'dynamic' => 0, 'sort_triggers' => SCREEN_SORT_TRIGGERS_DATE_DESC]; } if (!empty($screenitem['screenitemid'])) { $emptyScreenRow = false; $emptyScreenColumns[$c] = true; } // action if ($this->mode == SCREEN_MODE_EDIT) { if ($screenitem['screenitemid'] != 0) { $action = 'screenedit.php?form=update' . url_params(['screenid', 'templateid']) . '&screenitemid=' . $screenitem['screenitemid']; } else { $action = 'screenedit.php?form=update' . url_params(['screenid', 'templateid']) . '&x=' . $c . '&y=' . $r; } } else { $action = null; } // edit form cell if ($this->mode == SCREEN_MODE_EDIT && (isset($_REQUEST['form']) && $_REQUEST['form'] == 'update') && (isset($_REQUEST['x']) && $_REQUEST['x'] == $c && isset($_REQUEST['y']) && $_REQUEST['y'] == $r || isset($_REQUEST['screenitemid']) && bccomp($_REQUEST['screenitemid'], $screenitem['screenitemid']) == 0)) { $screenView = new CView('monitoring.screen.constructor.edit', ['screen' => $this->screen]); $item = $screenView->render(); $isEditForm = true; } elseif (!empty($screenitem['screenitemid']) && isset($screenitem['resourcetype'])) { $screenBase = CScreenBuilder::getScreen(['screen' => $this->screen, 'screenid' => $this->screen['screenid'], 'isFlickerfree' => $this->isFlickerfree, 'pageFile' => $this->pageFile, 'mode' => $this->mode, 'timestamp' => $this->timestamp, 'hostid' => $this->hostid, 'profileIdx' => $this->profileIdx, 'profileIdx2' => $this->profileIdx2, 'updateProfile' => $this->updateProfile, 'timeline' => $this->timeline, 'resourcetype' => $screenitem['resourcetype'], 'screenitem' => $screenitem]); if (!empty($screenBase)) { $screenBase->action = $action; $item = $screenBase->get(); } else { $item = null; } } elseif ($this->mode == SCREEN_MODE_EDIT) { $item = [(new CDiv((new CLink(_('Change'), $action))->addClass('empty_change_link')))->addClass(ZBX_STYLE_CENTER)]; } else { $item = null; } if ($this->mode == SCREEN_MODE_EDIT && !$isEditForm) { $item = (new CDiv($item))->addClass('draggable')->setId('position_' . $r . '_' . $c)->setAttribute('data-xcoord', $c)->setAttribute('data-ycoord', $r); } // colspan/rowspan $newColumn = (new CCol($item))->addClass('screenitem'); if ($screenitem['halign'] == HALIGN_CENTER || $isEditForm) { $newColumn->addClass(ZBX_STYLE_CENTER); } elseif ($screenitem['halign'] == HALIGN_LEFT) { $newColumn->addClass(ZBX_STYLE_LEFT); } elseif ($screenitem['halign'] == HALIGN_RIGHT) { $newColumn->addClass(ZBX_STYLE_RIGHT); } if ($screenitem['valign'] == VALIGN_MIDDLE || $isEditForm) { $newColumn->addClass(ZBX_STYLE_MIDDLE); } elseif ($screenitem['valign'] == VALIGN_TOP) { $newColumn->addClass(ZBX_STYLE_TOP); } elseif ($screenitem['valign'] == VALIGN_BOTTOM) { $newColumn->addClass(ZBX_STYLE_BOTTOM); } if ($screenitem['colspan'] > 1) { $newColumn->setColSpan($screenitem['colspan']); } if ($screenitem['rowspan'] > 1) { $newColumn->setRowSpan($screenitem['rowspan']); } $newColumns[] = $newColumn; } // action right cell if ($this->mode == SCREEN_MODE_EDIT) { if ($this->screen['vsize'] == SCREEN_MIN_SIZE) { $link = (new CDiv('−'))->addClass(ZBX_STYLE_TREEVIEW_PLUS)->addClass(ZBX_STYLE_DISABLED); } else { $link = (new CLink('−', 'screenedit.php?screenid=' . $this->screen['screenid'] . url_param('templateid') . '&rmv_row=' . $r))->addClass(ZBX_STYLE_TREEVIEW_PLUS)->addSID(); if (!$emptyScreenRow) { $link->addConfirmation(CJs::encodeJson(_('This screen-row is not empty. Delete it?'))); } } $newColumns[] = (new CCol($link))->addClass(ZBX_STYLE_CENTER)->addClass(ZBX_STYLE_MIDDLE); } $screenTable->addRow(new CRow($newColumns)); } // action bottom row if ($this->mode == SCREEN_MODE_EDIT) { if ($this->screen['vsize'] >= SCREEN_MAX_SIZE) { $link = (new CDiv('+'))->addClass(ZBX_STYLE_TREEVIEW_PLUS)->addClass(ZBX_STYLE_DISABLED); } else { $link = (new CLink('+', 'screenedit.php?screenid=' . $this->screen['screenid'] . url_param('templateid') . '&add_row=' . $this->screen['vsize']))->addClass(ZBX_STYLE_TREEVIEW_PLUS)->addSID(); } $newColumns = [(new CCol($link))->addClass(ZBX_STYLE_CENTER)->addClass(ZBX_STYLE_MIDDLE)]; for ($i = 0; $i < $this->screen['hsize']; $i++) { if ($this->screen['hsize'] == SCREEN_MIN_SIZE) { $link = (new CDiv('−'))->addClass(ZBX_STYLE_TREEVIEW_PLUS)->addClass(ZBX_STYLE_DISABLED); } else { $link = (new CLink('−', 'screenedit.php?screenid=' . $this->screen['screenid'] . url_param('templateid') . '&rmv_col=' . $i))->addClass(ZBX_STYLE_TREEVIEW_PLUS)->addSID(); if (array_key_exists($i, $emptyScreenColumns)) { $link->addConfirmation(CJs::encodeJson(_('This screen-column is not empty. Delete it?'))); } } $newColumns[] = (new CCol($link))->addClass(ZBX_STYLE_CENTER)->addClass(ZBX_STYLE_MIDDLE); } $newColumns[] = ''; $screenTable->addRow($newColumns); } return $screenTable; }
} $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;
$filterColumn1->addRow(_('Selected'), $tasks); $filterForm->addColumn($filterColumn1); } } // for batch graphs don't remember the time selection in the profiles if ($this->data['action'] == HISTORY_BATCH_GRAPH) { $profileIdx = false; $profileIdx2 = false; $updateProfile = false; } else { $profileIdx = 'web.item.graph'; $profileIdx2 = reset($this->data['itemids']); $updateProfile = $this->data['action'] != HISTORY_BATCH_GRAPH; } // create history screen $screen = CScreenBuilder::getScreen(['resourcetype' => SCREEN_RESOURCE_HISTORY, 'action' => $this->data['action'], 'itemids' => $data['itemids'], 'profileIdx' => $profileIdx, 'profileIdx2' => $profileIdx2, 'updateProfile' => $updateProfile, 'period' => $this->data['period'], 'stime' => $this->data['stime'], 'filter' => getRequest('filter'), 'filter_task' => getRequest('filter_task'), 'mark_color' => getRequest('mark_color'), 'plaintext' => $this->data['plaintext'], 'graphtype' => $this->data['graphtype']]); // append plaintext to widget if ($this->data['plaintext']) { foreach ($headerPlaintext as $text) { $historyWidget->addItem([new CSpan($text), BR()]); } $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 ($page['type'] == PAGE_TYPE_JS || $page['type'] == PAGE_TYPE_HTML_BLOCK) { require_once dirname(__FILE__) . '/include/page_footer.php'; exit; } /* * Collect data */ $httptest = API::HttpTest()->get(['output' => ['httptestid', 'name', 'hostid'], 'httptestids' => getRequest('httptestid'), 'preservekeys' => true]); $httptest = reset($httptest); if (!$httptest) { access_deny(); } $http_test_name = CMacrosResolverHelper::resolveHttpTestName($httptest['hostid'], $httptest['name']); // Create details widget. $details_screen = CScreenBuilder::getScreen(['resourcetype' => SCREEN_RESOURCE_HTTPTEST_DETAILS, 'mode' => SCREEN_MODE_JS, 'dataId' => 'httptest_details', 'profileIdx2' => $httptest['httptestid']]); (new CWidget())->setTitle(_('Details of web scenario') . ': ' . $http_test_name)->setControls((new CForm())->cleanItems()->addItem((new CList())->addItem(get_icon('reset', ['id' => getRequest('httptestid')]))->addItem(get_icon('fullscreen', ['fullscreen' => $_REQUEST['fullscreen']]))))->addItem($details_screen->get())->show(); echo BR(); $graphs = []; // dims $graph_dims = getGraphDims(); $graph_dims['width'] = -50; $graph_dims['graphHeight'] = 150; /* * Graph in */ $graph_in = new CScreenBase(['resourcetype' => SCREEN_RESOURCE_GRAPH, 'mode' => SCREEN_MODE_PREVIEW, 'dataId' => 'graph_in', 'profileIdx' => 'web.httptest', 'profileIdx2' => getRequest('httptestid'), 'period' => getRequest('period'), 'stime' => getRequest('stime')]); $httptest_manager = new CHttpTestManager(); $itemids = $httptest_manager->getHttpStepItems($httptest['httptestid']); $itemids = zbx_objectValues($itemids, 'itemid'); $graph_in->timeline['starttime'] = date(TIMESTAMP_FORMAT, get_min_itemclock_by_itemid($itemids));
<?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();
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" *