if (get_request('groupid') && !API::HostGroup()->isReadable(array($_REQUEST['groupid']))) { access_deny(); } if (get_request('hostid') && !API::Host()->isReadable(array($_REQUEST['hostid']))) { access_deny(); } validate_sort_and_sortorder('name', ZBX_SORT_DOWN); $options = array('groups' => array('real_hosts' => true, 'with_httptests' => true), 'hosts' => array('with_monitored_items' => true, 'with_httptests' => true), 'hostid' => get_request('hostid', null), 'groupid' => get_request('groupid', null)); $pageFilter = new CPageFilter($options); $_REQUEST['groupid'] = $pageFilter->groupid; $_REQUEST['hostid'] = $pageFilter->hostid; $displayNodes = is_array(get_current_nodeid()) && $pageFilter->groupid == 0 && $pageFilter->hostid == 0; $r_form = new CForm('get'); $r_form->addVar('fullscreen', $_REQUEST['fullscreen']); $r_form->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true))); $r_form->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB(true))); $httpmon_wdgt = new CWidget(); $httpmon_wdgt->addPageHeader(_('STATUS OF WEB MONITORING'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen']))); $httpmon_wdgt->addHeader(_('Web scenarios'), $r_form); $httpmon_wdgt->addHeaderRowNumber(); // TABLE $table = new CTableInfo(_('No web scenarios found.')); $table->SetHeader(array($displayNodes ? _('Node') : null, $_REQUEST['hostid'] == 0 ? make_sorting_header(_('Host'), 'hostname') : null, make_sorting_header(_('Name'), 'name'), _('Number of steps'), _('Last check'), _('Status'))); $paging = null; if ($pageFilter->hostsSelected) { $options = array('output' => array('httptestid'), 'templated' => false, 'filter' => array('status' => HTTPTEST_STATUS_ACTIVE), 'limit' => $config['search_limit'] + 1); if ($pageFilter->hostid > 0) { $options['hostids'] = $pageFilter->hostid; } elseif ($pageFilter->groupid > 0) { $options['groupids'] = $pageFilter->groupid; }
// 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;
CProfile::update('web.tr_status.filter.status_change_days', $_REQUEST['status_change_days'], PROFILE_TYPE_INT); } $show_triggers = $_REQUEST['show_triggers']; $show_events = $_REQUEST['show_events']; $show_severity = $_REQUEST['show_severity']; $ack_status = $_REQUEST['ack_status']; // -------------- validate_sort_and_sortorder('lastchange', ZBX_SORT_DOWN); $mute = CProfile::get('web.tr_status.mute', 0); if (isset($audio) && !$mute) { play_sound($audio); } $trigg_wdgt = new CWidget(); $r_form = new CForm(null, 'get'); $r_form->addItem(array(S_GROUP . SPACE, $pageFilter->getGroupsCB(true))); $r_form->addItem(array(SPACE . S_HOST . SPACE, $pageFilter->getHostsCB(true))); $r_form->addVar('fullscreen', $_REQUEST['fullscreen']); $fs_icon = get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])); $trigg_wdgt->addPageHeader(S_STATUS_OF_TRIGGERS_BIG . ' [' . date(S_DATE_FORMAT_YMDHMS) . ']', array($fs_icon)); $numrows = new CDiv(); $numrows->setAttribute('name', 'numrows'); $trigg_wdgt->addHeader(S_TRIGGERS_BIG, $r_form); $trigg_wdgt->addHeader($numrows); /************************* FILTER **************************/ /***********************************************************/ $filterForm = new CFormTable(null, null, 'get'); //,'tr_status.php?filter_set=1','POST',null,'sform'); $filterForm->setAttribute('name', 'zbx_filter'); $filterForm->setAttribute('id', 'zbx_filter'); $filterForm->addVar('fullscreen', $_REQUEST['fullscreen']); $filterForm->addVar('groupid', $_REQUEST['groupid']);
$page['scripts'] = array('class.calendar.js', 'scriptaculous.js?load=effects'); $page['type'] = detect_page_type(PAGE_TYPE_HTML); include_once 'include/page_header.php'; // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = array('groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'applicationid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'itemid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'timeshiftsource' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'timeshiftprojection' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'agregation' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'num_projection' => array(T_ZBX_STR, O_OPT, P_SYS, DB_ID, null), 'formato' => array(T_ZBX_STR, O_OPT, P_SYS, DB_ID, null), 'report_timesince' => array(T_ZBX_STR, O_OPT, null, null, 'isset({filter})'), 'report_timetill' => array(T_ZBX_STR, O_OPT, null, null, 'isset({filter})')); check_fields($fields); // --------------------------- Filtro --------------------------------------------------------------------- $options = array('groups' => array('monitored_hosts' => 1), 'hosts' => array('monitored_hosts' => 1), 'groupid' => get_request('groupid', null), 'hostid' => get_request('hostid', null)); $hostid = $_REQUEST['hostid'] = get_request('hostid', 0); $groupid = $_REQUEST['groupid'] = get_request('groupid', 0); $pageFilter = new CPageFilter($options); $filter_table = new CTable('', 'filter_config'); $filter_table->setAttribute('border', 0); $filter_table->setAttribute('width', '100%'); $cmbGroups = $pageFilter->getGroupsCB(true); $cmbHosts = $pageFilter->getHostsCB(true); $filter_table->addRow(array(array(bold(_('Group')), ': ', $cmbGroups), array(bold(_('Host')), ': ', $cmbHosts), array())); $groupids = checkAccessGroup('groupid'); $hostids = checkAccessHost('hostid'); // --------------------------- Fim Filtro --------------------------------------------------------------------- $options = array(); $options['templated_hosts'] = 1; $hosts = API::Host()->get($options); $filtroSegHosts = " hos.status <> 1 AND " . dbConditionInt('hos.hostid', zbx_objectValues($hosts, 'hostid')); $rep2_wdgt = new CWidget(); $rep2_wdgt->addPageHeader(_zeT('Not Supported Items Report')); $filter_form = new CForm(); $filter_form->setMethod('get'); $filter_form->setAttribute('name', 'zbx_filter'); $filter_form->setAttribute('id', 'zbx_filter'); $filter = new CButton('filter', _("Filter"));
** 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;
$frmForm->addVar('hostid', $pageFilter->hostid, 'hostid_csv'); if ($triggerId) { $frmForm->addVar('triggerid', $triggerId, 'triggerid_csv'); } } $frmForm->addVar('fullscreen', getRequest('fullscreen')); $frmForm->addVar('stime', $stime); $frmForm->addVar('period', $period); $controls = new CList(); // add host and group filters to the form if ($source == EVENT_SOURCE_TRIGGERS) { if (getRequest('triggerid') != 0) { $frmForm->addVar('triggerid', getRequest('triggerid'), 'triggerid_filter'); } $controls->addItem([_('Group'), SPACE, $pageFilter->getGroupsCB()]); $controls->addItem([_('Host'), SPACE, $pageFilter->getHostsCB()]); } if ($allow_discovery) { $controls->addItem([_('Source'), SPACE, new CComboBox('source', $source, 'submit()', [EVENT_SOURCE_TRIGGERS => _('Trigger'), EVENT_SOURCE_DISCOVERY => _('Discovery')])]); } $controls->addItem(new CSubmit('csv_export', _('Export to CSV'))); $controls->addItem(get_icon('fullscreen', ['fullscreen' => getRequest('fullscreen')])); $frmForm->addItem($controls); $eventsWidget->setControls($frmForm); $filterForm = (new CFilter('web.events.filter.state'))->addVar('fullscreen', getRequest('fullscreen')); if ($source == EVENT_SOURCE_TRIGGERS) { $filterForm->addVar('triggerid', $triggerId)->addVar('stime', $stime)->addVar('period', $period); $filterForm->addVar('groupid', $pageFilter->groupid); $filterForm->addVar('hostid', $pageFilter->hostid); if ($triggerId > 0) { $dbTrigger = API::Trigger()->get(['triggerids' => $triggerId, 'output' => ['description', 'expression'], 'selectHosts' => ['name'], 'preservekeys' => true, 'expandDescription' => true]);
$cmbHosts->setAttribute('title', _('You can not switch hosts for current selection.')); $frmTitle->addItem(array(SPACE, _('Host'), SPACE, $cmbHosts)); } else { if (str_in_array($srctbl, array('triggers', 'items', 'applications', 'graphs', 'templates', 'hosts', 'host_templates'))) { $frmTitle->addItem(array(_('Group'), SPACE, $pageFilter->getGroupsCB())); } if (str_in_array($srctbl, array('help_items'))) { $itemtype = get_request('itemtype', 0); $cmbTypes = new CComboBox('itemtype', $itemtype, 'javascript: submit();'); foreach ($allowed_item_types as $type) { $cmbTypes->addItem($type, item_type2str($type)); } $frmTitle->addItem(array(_('Type'), SPACE, $cmbTypes)); } if (str_in_array($srctbl, array('triggers', 'items', 'applications', 'graphs'))) { $frmTitle->addItem(array(SPACE, _('Host'), SPACE, $pageFilter->getHostsCB())); } } if (str_in_array($srctbl, array('applications', 'triggers'))) { if (zbx_empty($noempty)) { $value1 = isset($_REQUEST['dstfld1']) && zbx_strpos($_REQUEST['dstfld1'], 'id') !== false ? 0 : ''; $value2 = isset($_REQUEST['dstfld2']) && zbx_strpos($_REQUEST['dstfld2'], 'id') !== false ? 0 : ''; $value3 = isset($_REQUEST['dstfld3']) && zbx_strpos($_REQUEST['dstfld3'], 'id') !== false ? 0 : ''; $epmtyScript = get_window_opener($dstfrm, $dstfld1, $value1); $epmtyScript .= get_window_opener($dstfrm, $dstfld2, $value2); $epmtyScript .= get_window_opener($dstfrm, $dstfld3, $value3); $epmtyScript .= ' close_window(); return false;'; $frmTitle->addItem(array(SPACE, new CButton('empty', _('Empty'), $epmtyScript))); } } show_table_header($page['title'], $frmTitle);
$nodeid = get_current_nodeid(); } unset($ok); if (str_in_array($srctbl, array('hosts_and_templates', 'hosts', 'templates', 'triggers', 'items', 'applications', 'host_templates', 'graphs', 'simple_graph', 'plain_text'))) { $frmTitle->addItem(array(S_GROUP, SPACE, $pageFilter->getGroupsCB(true))); } if (str_in_array($srctbl, array('help_items'))) { $itemtype = get_request('itemtype', CProfile::get('web.popup.itemtype', 0)); $cmbTypes = new CComboBox('itemtype', $itemtype, 'javascript: submit();'); foreach ($allowed_item_types as $type) { $cmbTypes->addItem($type, item_type2str($type)); } $frmTitle->addItem(array(S_TYPE, SPACE, $cmbTypes)); } if (str_in_array($srctbl, array('triggers', 'items', 'applications', 'graphs', 'simple_graph', 'plain_text'))) { $frmTitle->addItem(array(SPACE, S_HOST, SPACE, $pageFilter->getHostsCB(true))); } if (str_in_array($srctbl, array('triggers', 'hosts', 'host_group', 'hosts_and_templates'))) { $value1 = isset($_REQUEST['dstfld1']) && zbx_strpos($_REQUEST['dstfld1'], 'id') !== false ? 0 : ''; $value2 = isset($_REQUEST['dstfld2']) && zbx_strpos($_REQUEST['dstfld2'], 'id') !== false ? 0 : ''; $epmtyScript = get_window_opener($dstfrm, $dstfld1, $value1); $epmtyScript .= get_window_opener($dstfrm, $dstfld2, $value2); $epmtyScript .= ' close_window(); return false;'; $frmTitle->addItem(array(SPACE, new CButton('empty', S_EMPTY, $epmtyScript))); } } show_table_header($page['title'], $frmTitle); if ($srctbl == 'hosts') { $table = new CTableInfo(S_NO_HOSTS_DEFINED); $table->setHeader(array(S_HOST, S_DNS, S_IP, S_PORT, S_STATUS, S_AVAILABILITY)); $options = array('nodeids' => $nodeid, 'groupids' => $groupid, 'output' => API_OUTPUT_EXTEND, 'sortfield' => 'host');
$frmForm->addVar('hostid', getRequest('hostid'), 'hostid_csv'); } } $frmForm->addItem(new CSubmit('csv_export', _('Export to CSV'))); $eventsWidget->addPageHeader(_('HISTORY OF EVENTS') . SPACE . '[' . zbx_date2str(DATE_TIME_FORMAT_SECONDS) . ']', array($frmForm, SPACE, get_icon('fullscreen', array('fullscreen' => getRequest('fullscreen'))))); $headerForm = new CForm('get'); $headerForm->addVar('fullscreen', getRequest('fullscreen')); $headerForm->addVar('stime', $stime); $headerForm->addVar('period', $period); // add host and group filters to the form if ($source == EVENT_SOURCE_TRIGGERS) { if (getRequest('triggerid') != 0) { $headerForm->addVar('triggerid', getRequest('triggerid'), 'triggerid_filter'); } $headerForm->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB())); $headerForm->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB())); } if ($allow_discovery) { $cmbSource = new CComboBox('source', $source, 'submit()'); $cmbSource->addItem(EVENT_SOURCE_TRIGGERS, _('Trigger')); $cmbSource->addItem(EVENT_SOURCE_DISCOVERY, _('Discovery')); $headerForm->addItem(array(SPACE . _('Source') . SPACE, $cmbSource)); } $eventsWidget->addHeader(_('Events'), $headerForm); $eventsWidget->addHeaderRowNumber(); $filterForm = null; if ($source == EVENT_SOURCE_TRIGGERS) { $filterForm = new CFormTable(null, null, 'get'); $filterForm->setTableClass('formtable old-filter'); $filterForm->setAttribute('name', 'zbx_filter'); $filterForm->setAttribute('id', 'zbx_filter');
if (str_in_array($srctbl, $showGroupCmbBox) && ($srctbl !== 'item_prototypes' || !$parentDiscoveryId)) { $controls[] = [_('Group'), SPACE, $pageFilter->getGroupsCB()]; } // show Type dropdown in header for help items if ($srctbl === 'help_items') { $itemType = getRequest('itemtype', 0); $cmbTypes = new CComboBox('itemtype', $itemType, 'javascript: submit();'); foreach ($allowedItemTypes as $type) { $cmbTypes->addItem($type, item_type2str($type)); } $controls[] = [_('Type'), SPACE, $cmbTypes]; } // show Host dropdown in header for these specified sources $showHostCmbBox = ['triggers', 'items', 'applications', 'graphs', 'graph_prototypes', 'item_prototypes']; if (str_in_array($srctbl, $showHostCmbBox) && ($srctbl !== 'item_prototypes' || !$parentDiscoveryId)) { $controls[] = [SPACE, _('Host'), SPACE, $pageFilter->getHostsCB()]; } } if (str_in_array($srctbl, ['applications', 'triggers'])) { if (zbx_empty($noempty)) { $value1 = isset($_REQUEST['dstfld1']) && strpos($_REQUEST['dstfld1'], 'id') !== false ? 0 : ''; $value2 = isset($_REQUEST['dstfld2']) && strpos($_REQUEST['dstfld2'], 'id') !== false ? 0 : ''; $value3 = isset($_REQUEST['dstfld3']) && strpos($_REQUEST['dstfld3'], 'id') !== false ? 0 : ''; $epmtyScript = get_window_opener($dstfrm, $dstfld1, $value1); $epmtyScript .= get_window_opener($dstfrm, $dstfld2, $value2); $epmtyScript .= get_window_opener($dstfrm, $dstfld3, $value3); $epmtyScript .= ' close_window(); return false;'; $controls[] = [SPACE, (new CButton('empty', _('Empty')))->onClick($epmtyScript)]; } } if ($controls) {