function show_report2_header($config, &$PAGE_GROUPS, &$PAGE_HOSTS) { global $USER_DETAILS; $available_groups = $PAGE_GROUPS['groupids']; $available_hosts = $PAGE_HOSTS['hostids']; // $available_groups = $PAGE_GROUPS['groupids']; // $available_hosts = $PAGE_HOSTS['hostids']; $r_form = new CForm(); $r_form->setMethod('get'); $cmbConf = new CComboBox('config', $config, 'submit()'); $cmbConf->addItem(0, S_BY_HOST); $cmbConf->addItem(1, S_BY_TRIGGER_TEMPLATE); $r_form->addItem(array(S_MODE . SPACE, $cmbConf, SPACE)); $cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();'); $cmbHosts = new CComboBox('hostid', $PAGE_HOSTS['selected'], 'javascript: submit();'); foreach ($PAGE_GROUPS['groups'] as $groupid => $name) { $cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name); } foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) { $cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name); } $r_form->addItem(array(S_GROUP . SPACE, $cmbGroups)); $r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts)); if (1 == $config) { $cmbTrigs = new CComboBox('tpl_triggerid', get_request('tpl_triggerid', 0), 'submit()'); $cmbHGrps = new CComboBox('hostgroupid', get_request('hostgroupid', 0), 'submit()'); $cmbTrigs->addItem(0, S_ALL_SMALL); $cmbHGrps->addItem(0, S_ALL_SMALL); } if (0 == $config) { show_table_header(S_AVAILABILITY_REPORT_BIG, $r_form); } else { $sql_cond = ' AND h.hostid=ht.hostid '; if ($_REQUEST['hostid'] > 0) { $sql_cond .= ' AND ht.templateid=' . $_REQUEST['hostid']; } if (isset($_REQUEST['tpl_triggerid']) && $_REQUEST['tpl_triggerid'] > 0) { $sql_cond .= ' AND t.templateid=' . $_REQUEST['tpl_triggerid']; } $result = DBselect('SELECT DISTINCT g.groupid,g.name ' . ' FROM triggers t,hosts h,items i,functions f, hosts_templates ht, groups g, hosts_groups hg ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid' . ' AND g.groupid=hg.groupid ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND t.triggerid=f.triggerid ' . ' AND ' . DBin_node('t.triggerid') . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND h.status=' . HOST_STATUS_MONITORED . $sql_cond . ' ORDER BY g.name'); while ($row = DBfetch($result)) { $cmbHGrps->addItem($row['groupid'], get_node_name_by_elid($row['groupid']) . $row['name']); } $sql_cond = $_REQUEST['hostid'] > 0 ? ' AND h.hostid=' . $_REQUEST['hostid'] : ' AND ' . DBcondition('h.hostid', $available_hosts); $sql = 'SELECT DISTINCT t.triggerid,t.description ' . ' FROM triggers t,hosts h,items i,functions f ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND t.triggerid=f.triggerid ' . ' AND h.status=' . HOST_STATUS_TEMPLATE . ' AND ' . DBin_node('t.triggerid') . ' AND i.status=' . ITEM_STATUS_ACTIVE . $sql_cond . ' ORDER BY t.description'; $result = DBselect($sql); while ($row = DBfetch($result)) { $cmbTrigs->addItem($row['triggerid'], get_node_name_by_elid($row['triggerid']) . expand_trigger_description($row['triggerid'])); } $rr_form = new CForm(); $rr_form->setMethod('get'); $rr_form->addVar('config', $config); $rr_form->addVar('groupid', $_REQUEST['groupid']); $rr_form->addVar('hostid', $_REQUEST['hostid']); $rr_form->addItem(array(S_TRIGGER . SPACE, $cmbTrigs, BR(), S_FILTER, SPACE, S_HOST_GROUP . SPACE, $cmbHGrps)); show_table_header(S_AVAILABILITY_REPORT_BIG, array($r_form, $rr_form)); } }
** 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__) . '/js/monitoring.triggerComment.js.php'; $commentWidget = new CWidget('triggerComment'); $commentWidget->addPageHeader(_('TRIGGER DESCRIPTION')); // create form $commentForm = new CForm(); $commentForm->setName('commentForm'); $commentForm->addVar('triggerid', $this->data['triggerid']); // create form list $commentFormList = new CFormList('commentFormList'); $commentTextArea = new CTextArea('comments', CMacrosResolverHelper::resolveTriggerDescription($this->data['trigger']), array('rows' => 25, 'width' => ZBX_TEXTAREA_BIG_WIDTH, 'readonly' => $this->data['isCommentExist'])); $commentTextArea->attr('autofocus', 'autofocus'); $commentFormList->addRow(_('Description'), $commentTextArea); // append tabs to form $commentTab = new CTabView(); $commentTab->addTab('commentTab', _s('Description for "%s".', $this->data['trigger']['description']), $commentFormList); $commentForm->addItem($commentTab); // append buttons to form $updateButton = new CSubmit('update', _('Update')); $updateButton->setEnabled(!$this->data['isCommentExist']); if ($this->data['isCommentExist']) { $editButton = new CButton('edit', _('Edit')); $editButton->setEnabled($this->data['isTriggerEditable']); } else { $editButton = null; } $commentForm->addItem(makeFormFooter($updateButton, array($editButton, new CButtonCancel('&triggerid=' . $this->data['triggerid'])))); $commentWidget->addItem($commentForm); return $commentWidget;
*/ 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;
$problemTrigger['description'] = $triggers[$problemTrigger['triggerid']]['description']; } unset($problemTrigger); } unset($serviceSla); $treeData = array(); createServiceMonitoringTree($services, $slaData, $period, $treeData); $tree = new CServiceTree('service_status_tree', $treeData, array('caption' => _('Service'), 'status' => _('Status'), 'reason' => _('Reason'), 'sla' => _('Problem time'), 'sla2' => nbsp(_('SLA') . ' / ' . _('Acceptable SLA')))); if ($tree) { // creates form for choosing a preset interval $r_form = new CForm(); $r_form->setAttribute('class', 'nowrap'); $r_form->setMethod('get'); $r_form->setAttribute('name', 'period_choice'); $r_form->addVar('fullscreen', $_REQUEST['fullscreen']); $period_combo = new CComboBox('period', $period, 'javascript: submit();'); foreach ($periods as $key => $val) { $period_combo->addItem($key, $val); } $r_form->addItem(array(_('Period') . SPACE, $period_combo)); $srv_wdgt = new CWidget('hat_services', 'service-list service-mon'); $srv_wdgt->addPageHeader(_('IT SERVICES'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen']))); $srv_wdgt->addHeader(_('IT services'), $r_form); $srv_wdgt->addItem(BR()); $srv_wdgt->addItem($tree->getHTML()); $srv_wdgt->show(); } else { error(_('Cannot format Tree. Check logic structure in service links.')); } } require_once dirname(__FILE__) . '/include/page_footer.php';
} array_pop($actionLinks); } else { $actionLinks = '-'; } $actionColumn = new CCol($actionLinks); $actionColumn->setAttribute('style', 'white-space: normal;'); $statusLink = 'media_types.php?go=' . ($mediaType['status'] == MEDIA_TYPE_STATUS_DISABLED ? 'activate' : 'disable') . '&mediatypeids' . SQUAREBRACKETS . '=' . $mediaType['mediatypeid']; $status = MEDIA_TYPE_STATUS_ACTIVE == $mediaType['status'] ? new CLink(_('Enabled'), $statusLink, 'enabled') : new CLink(_('Disabled'), $statusLink, 'disabled'); // append row $mediaTypeTable->addRow(array(new CCheckBox('mediatypeids[' . $mediaType['mediatypeid'] . ']', null, null, $mediaType['mediatypeid']), $this->data['displayNodes'] ? $mediaType['nodename'] : null, new CLink($mediaType['description'], '?form=edit&mediatypeid=' . $mediaType['mediatypeid']), media_type2str($mediaType['typeid']), $status, $actionColumn, $details)); } // create go button $goComboBox = new CComboBox('go'); $goOption = new CComboItem('activate', _('Enable selected')); $goOption->setAttribute('confirm', _('Enable selected media types?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('disable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected media types?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('delete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected media types?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "mediatypeids";'); // append table to form $mediaTypeForm->addItem(array($this->data['paging'], $mediaTypeTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton)))); // append form to widget $mediaTypeWidget->addItem($mediaTypeForm); return $mediaTypeWidget;
$year = getRequest('year', date('Y')); define('YEAR_LEFT_SHIFT', 5); $service = API::Service()->get(array('output' => array('serviceid', 'name', 'showsla', 'goodsla'), 'serviceids' => $_REQUEST['serviceid'])); $service = reset($service); if (!$service) { access_deny(); } $form = new CForm(); $form->setMethod('get'); $form->addVar('serviceid', $_REQUEST['serviceid']); $cmbPeriod = new CComboBox('period', $period, 'submit();'); $cmbPeriod->addItem('daily', _('Daily')); $cmbPeriod->addItem('weekly', _('Weekly')); $cmbPeriod->addItem('monthly', _('Monthly')); $cmbPeriod->addItem('yearly', _('Yearly')); $form->addItem(array(SPACE . _('Period') . SPACE, $cmbPeriod)); if ($period != 'yearly') { $cmbYear = new CComboBox('year', $year, 'submit();'); for ($y = date('Y') - YEAR_LEFT_SHIFT; $y <= date('Y'); $y++) { $cmbYear->addItem($y, $y); } $form->addItem(array(SPACE . _('Year') . SPACE, $cmbYear)); } show_table_header(array(_('IT SERVICES AVAILABILITY REPORT'), SPACE . '"', new CLink($service['name'], 'srv_status.php?showgraph=1&serviceid=' . $service['serviceid']), '"'), $form); $table = new CTableInfo(); $header = array(_('Ok'), _('Problems'), _('Downtime'), _('SLA'), _('Acceptable SLA')); switch ($period) { case 'yearly': $from = date('Y') - YEAR_LEFT_SHIFT; $to = date('Y'); array_unshift($header, new CCol(_('Year'), 'center'));
$exactComboBox = new CComboBox('filter_exact', $this->data['filterExact']); $exactComboBox->addItem('0', _('like')); $exactComboBox->addItem('1', _('exactly')); $filterTable->addRow(array(array(array(bold(_('Field')), SPACE, $inventoryFieldsComboBox), array($exactComboBox, new CTextBox('filter_field_value', $this->data['filterFieldValue'], 20)))), 'host-inventories'); $filter = new CSubmit('filter_set', _('Filter')); $filter->useJQueryStyle('main'); $reset = new CSubmit('filter_rst', _('Reset')); $reset->useJQueryStyle(); $divButtons = new CDiv(array($filter, SPACE, $reset)); $divButtons->setAttribute('style', 'padding: 4px 0px;'); $footerCol = new CCol($divButtons, 'controls'); $filterTable->addRow($footerCol); $filterForm = new CForm('get'); $filterForm->setAttribute('name', 'zbx_filter'); $filterForm->setAttribute('id', 'zbx_filter'); $filterForm->addItem($filterTable); $hostInventoryWidget->addFlicker($filterForm, CProfile::get('web.hostinventories.filter.state', 0)); $hostInventoryWidget->addHeaderRowNumber(); $table = new CTableInfo(_('No hosts found.')); $table->setHeader(array(make_sorting_header(_('Host'), 'name', $this->data['sort'], $this->data['sortorder']), _('Group'), make_sorting_header(_('Name'), 'pr_name', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'pr_type', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('OS'), 'pr_os', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Serial number A'), 'pr_serialno_a', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Tag'), 'pr_tag', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('MAC address A'), 'pr_macaddress_a', $this->data['sort'], $this->data['sortorder']))); foreach ($this->data['hosts'] as $host) { $hostGroups = array(); foreach ($host['groups'] as $group) { $hostGroups[] = $group['name']; } natsort($hostGroups); $hostGroups = implode(', ', $hostGroups); $row = array(new CLink($host['name'], '?hostid=' . $host['hostid'] . url_param('groupid'), $host['status'] == HOST_STATUS_NOT_MONITORED ? 'not-monitored' : ''), $hostGroups, zbx_str2links($host['inventory']['name']), zbx_str2links($host['inventory']['type']), zbx_str2links($host['inventory']['os']), zbx_str2links($host['inventory']['serialno_a']), zbx_str2links($host['inventory']['tag']), zbx_str2links($host['inventory']['macaddress_a'])); $table->addRow($row); } $table = array($this->data['paging'], $table, $this->data['paging']);
$page['title'] = _('Configuration of trigger displaying options'); $page['file'] = 'adm.triggerdisplayoptions.php'; $page['hist_arg'] = array(); require_once dirname(__FILE__) . '/include/page_header.php'; $fields = array('problem_unack_color' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'problem_ack_color' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'ok_unack_color' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'ok_ack_color' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'problem_unack_style' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'problem_ack_style' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'ok_unack_style' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'ok_ack_style' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'ok_period' => array(T_ZBX_INT, O_OPT, null, null, 'isset({save})'), 'blink_period' => array(T_ZBX_INT, O_OPT, null, null, 'isset({save})'), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null)); check_fields($fields); if (isset($_REQUEST['save'])) { $configs = array('ok_period' => get_request('ok_period'), 'blink_period' => get_request('blink_period'), 'problem_unack_color' => get_request('problem_unack_color'), 'problem_ack_color' => get_request('problem_ack_color'), 'ok_unack_color' => get_request('ok_unack_color'), 'ok_ack_color' => get_request('ok_ack_color'), 'problem_unack_style' => get_request('problem_unack_style', 0), 'problem_ack_style' => get_request('problem_ack_style', 0), 'ok_unack_style' => get_request('ok_unack_style', 0), 'ok_ack_style' => get_request('ok_ack_style', 0)); $result = update_config($configs); show_messages($result, _('Configuration updated'), _('Cannot update configuration')); } $form = new CForm(); $form->cleanItems(); $cmbConf = new CComboBox('configDropDown', 'adm.triggerdisplayoptions.php', 'redirect(this.options[this.selectedIndex].value);'); $cmbConf->addItems(array('adm.gui.php' => _('GUI'), 'adm.housekeeper.php' => _('Housekeeping'), 'adm.images.php' => _('Images'), 'adm.iconmapping.php' => _('Icon mapping'), 'adm.regexps.php' => _('Regular expressions'), 'adm.macros.php' => _('Macros'), 'adm.valuemapping.php' => _('Value mapping'), 'adm.workingtime.php' => _('Working time'), 'adm.triggerseverities.php' => _('Trigger severities'), 'adm.triggerdisplayoptions.php' => _('Trigger displaying options'), 'adm.other.php' => _('Other'))); $form->addItem($cmbConf); $cnf_wdgt = new CWidget(); $cnf_wdgt->addPageHeader(_('CONFIGURATION OF ZABBIX'), $form); $data = array(); $data['form_refresh'] = get_request('form_refresh', 0); // form has been submitted if ($data['form_refresh']) { $data['ok_period'] = get_request('ok_period'); $data['blink_period'] = get_request('blink_period'); $data['problem_unack_color'] = get_request('problem_unack_color'); $data['problem_ack_color'] = get_request('problem_ack_color'); $data['ok_unack_color'] = get_request('ok_unack_color'); $data['ok_ack_color'] = get_request('ok_ack_color'); $data['problem_unack_style'] = get_request('problem_unack_style'); $data['problem_ack_style'] = get_request('problem_ack_style'); $data['ok_unack_style'] = get_request('ok_unack_style');
foreach ($this->data['slides'] as $step => $slides) { $name = ''; if (!empty($slides['screenid'])) { $screen = get_screen_by_screenid($slides['screenid']); if (!empty($screen['name'])) { $name = $screen['name']; } } $delay = new CNumericBox('slides[' . $step . '][delay]', !empty($slides['delay']) ? $slides['delay'] : '', 5, 'no', true, false); $delay->setAttribute('placeholder', _('default')); $removeButton = new CButton('remove_' . $step, _('Remove'), 'javascript: removeSlide(this);', 'link_menu'); $removeButton->setAttribute('remove_slide', $step); $row = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), new CSpan($i++ . ':', 'rowNum', 'current_slide_' . $step), $name, $delay, $removeButton), 'sortable', 'slides_' . $step); $slideTable->addRow($row); } $addButtonColumn = new CCol(empty($this->data['work_slide']) ? new CButton('add', _('Add'), 'return PopUp("popup.php?srctbl=screens&srcfld1=screenid&dstfrm=' . $slideForm->getName() . '&multiselect=1", 450, 450)', 'link_menu') : null, null, 5); $addButtonColumn->setAttribute('style', 'vertical-align: middle;'); $slideTable->addRow(new CRow($addButtonColumn, null, 'screenListFooter')); $slideFormList->addRow(_('Slides'), new CDiv($slideTable, 'objectgroup inlineblock border_dotted ui-corner-all')); // append tabs to form $slideTab = new CTabView(); $slideTab->addTab('slideTab', _('Slide'), $slideFormList); $slideForm->addItem($slideTab); // append buttons to form if (empty($this->data['slideshowid'])) { $slideForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), new CButtonCancel())); } else { $slideForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), array(new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete slide show?'), url_param('form') . url_param('slideshowid') . url_param('config')), new CButtonCancel()))); } $slideWidget->addItem($slideForm); return $slideWidget;
$passwordField = array($passwordButton, $passwordBox); } else { $passwordField = new CPassBox('password', '', ZBX_TEXTBOX_SMALL_SIZE); } // append password field to form list if ($this->data['type'] == MEDIA_TYPE_JABBER) { $mediaTypeFormList->addRow(_('Jabber identifier'), new CTextBox('username', $this->data['username'], ZBX_TEXTBOX_STANDARD_SIZE)); $mediaTypeFormList->addRow(_('Password'), $passwordField); } else { $mediaTypeFormList->addRow(_('Username'), new CTextBox('username', $this->data['username'], ZBX_TEXTBOX_STANDARD_SIZE)); $mediaTypeFormList->addRow(_('Password'), $passwordField); $limitCb = new CComboBox('exec_path', $this->data['exec_path']); $limitCb->addItems(array(EZ_TEXTING_LIMIT_USA => _('USA (160 characters)'), EZ_TEXTING_LIMIT_CANADA => _('Canada (136 characters)'))); $mediaTypeFormList->addRow(_('Message text limit'), $limitCb); } } $mediaTypeFormList->addRow(_('Enabled'), new CCheckBox('status', MEDIA_TYPE_STATUS_ACTIVE == $this->data['status'], null, MEDIA_TYPE_STATUS_ACTIVE)); // append form list to tab $mediaTypeTab = new CTabView(); $mediaTypeTab->addTab('mediaTypeTab', _('Media type'), $mediaTypeFormList); // append tab to form $mediaTypeForm->addItem($mediaTypeTab); // append buttons to form if (!empty($this->data['mediatypeid'])) { $mediaTypeForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), array(new CButtonDelete(_('Delete selected media type?'), url_param('form') . url_param('mediatypeid') . url_param('config')), new CButtonCancel(url_param('config'))))); } else { $mediaTypeForm->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel(url_param('config')))); } // append form to widget $mediaTypeWidget->addItem($mediaTypeForm); return $mediaTypeWidget;
// Header $r_form = new CForm(); $r_form->SetMethod('get'); // $cmbGroup = new CComboBox('groupid',$_REQUEST['groupid'],"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."',this.form);"); // $cmbHosts = new CComboBox('hostid',$_REQUEST['hostid'],"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."',this.form);"); $available_groups = $PAGE_GROUPS['groupids']; $available_hosts = $PAGE_HOSTS['hostids']; $cmbGroup = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();'); $cmbHosts = new CComboBox('hostid', $PAGE_HOSTS['selected'], 'javascript: submit();'); foreach ($PAGE_GROUPS['groups'] as $groupid => $name) { $cmbGroup->addItem($groupid, get_node_name_by_elid($groupid) . $name); } foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) { $cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name); } $r_form->addItem(array(S_GROUP . SPACE, $cmbGroup)); $r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts)); $sql_from = ''; $sql_where = ''; if ($_REQUEST['groupid'] > 0) { $sql_from .= ',hosts_groups hg '; $sql_where .= ' AND hg.hostid=h.hostid AND hg.groupid=' . $_REQUEST['groupid']; } //--- $l_form = new CForm(); $l_form->SetMethod('get'); $l_form->addVar('groupid', $_REQUEST['groupid']); $l_form->addVar('hostid', $_REQUEST['hostid']); $l_form->AddItem(array(S_SHOW_ITEMS_WITH_DESCRIPTION_LIKE, new CTextBox('select', $_REQUEST['select'], 20))); $l_form->AddItem(array(SPACE, new CButton('show', S_SHOW, 'javascript: submit();'))); // $l_form->AddItem(array(SPACE, new CButton('show',S_SHOW,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."',this.form);")));
if (!isset($_REQUEST['stepid'])) { insert_js('add_httpstep(' . zbx_jsvalue($_REQUEST['dstfrm']) . ',' . zbx_jsvalue($_REQUEST['name']) . ',' . zbx_jsvalue($_REQUEST['timeout']) . ',' . zbx_jsvalue($_REQUEST['url']) . ',' . zbx_jsvalue($_REQUEST['posts']) . ',' . zbx_jsvalue($_REQUEST['variables']) . ',' . zbx_jsvalue($_REQUEST['required']) . ',' . zbx_jsvalue($_REQUEST['status_codes']) . ");\n"); } else { insert_js('update_httpstep(' . zbx_jsvalue($_REQUEST['dstfrm']) . ',' . zbx_jsvalue($_REQUEST['list_name']) . ',' . zbx_jsvalue($_REQUEST['stepid']) . ',' . zbx_jsvalue($_REQUEST['name']) . ',' . zbx_jsvalue($_REQUEST['timeout']) . ',' . zbx_jsvalue($_REQUEST['url']) . ',' . zbx_jsvalue($_REQUEST['posts']) . ',' . zbx_jsvalue($_REQUEST['variables']) . ',' . zbx_jsvalue($_REQUEST['required']) . ',' . zbx_jsvalue($_REQUEST['status_codes']) . ");\n"); } } else { $httpPopupForm = new CForm(); $httpPopupForm->addVar('dstfrm', get_request('dstfrm', null)); $httpPopupForm->addVar('stepid', get_request('stepid', null)); $httpPopupForm->addVar('list_name', get_request('list_name', null)); $httpPopupForm->addVar('templated', get_request('templated', null)); $httpPopupForm->addVar('old_name', get_request('old_name', null)); $httpPopupForm->addVar('steps_names', get_request('steps_names', null)); $httpPopupFormList = new CFormList('httpPopupFormList'); $httpPopupFormList->addRow(_('Name'), new CTextBox('name', get_request('name', ''), ZBX_TEXTBOX_STANDARD_SIZE, get_request('templated', null), 64)); $httpPopupFormList->addRow(_('URL'), new CTextBox('url', get_request('url', ''), ZBX_TEXTBOX_STANDARD_SIZE)); $httpPopupFormList->addRow(_('Post'), new CTextArea('posts', get_request('posts', ''))); $httpPopupFormList->addRow(_('Variables'), new CTextArea('variables', get_request('variables', ''))); $httpPopupFormList->addRow(_('Timeout'), new CNumericBox('timeout', get_request('timeout', 15), 5)); $httpPopupFormList->addRow(_('Required string'), new CTextBox('required', get_request('required', ''), ZBX_TEXTBOX_STANDARD_SIZE)); $httpPopupFormList->addRow(_('Required status codes'), new CTextBox('status_codes', get_request('status_codes', ''), ZBX_TEXTBOX_STANDARD_SIZE)); // append tabs to form $httpPopupTab = new CTabView(); $httpPopupTab->addTab('scenarioStepTab', _('Step of scenario'), $httpPopupFormList); $httpPopupForm->addItem($httpPopupTab); // append buttons to form $stepid = get_request('stepid', null); $httpPopupForm->addItem(makeFormFooter(new CSubmit('save', isset($stepid) ? _('Update') : _('Add')), new CButtonCancel(null, 'close_window();'))); $httpPopupWidget->addItem($httpPopupForm); } return $httpPopupWidget;
// }}}PAGE HEADER // HEADER {{{ $r_form = new CForm(null, 'get'); $r_form->addVar('fullscreen', $_REQUEST['fullscreen']); $r_form->addVar('triggerid', get_request('triggerid')); $r_form->addVar('stime', get_request('stime')); $r_form->addVar('period', get_request('period')); if (EVENT_SOURCE_TRIGGERS == $source) { $options = array('groups' => array('monitored_hosts' => 1, 'with_items' => 1), 'hosts' => array('monitored_hosts' => 1, 'with_items' => 1), 'triggers' => array(), 'hostid' => get_request('hostid', null), 'groupid' => get_request('groupid', null), 'triggerid' => get_request('triggerid', null)); $pageFilter = new CPageFilter($options); $_REQUEST['groupid'] = $pageFilter->groupid; $_REQUEST['hostid'] = $pageFilter->hostid; if ($pageFilter->triggerid > 0) { $_REQUEST['triggerid'] = $pageFilter->triggerid; } $r_form->addItem(array(S_GROUP . SPACE, $pageFilter->getGroupsCB(true))); $r_form->addItem(array(SPACE . S_HOST . SPACE, $pageFilter->getHostsCB(true))); } if ($allow_discovery) { $cmbSource = new CComboBox('source', $source, 'submit()'); $cmbSource->addItem(EVENT_SOURCE_TRIGGERS, S_TRIGGER); $cmbSource->addItem(EVENT_SOURCE_DISCOVERY, S_DISCOVERY); $r_form->addItem(array(SPACE . S_SOURCE . SPACE, $cmbSource)); } $events_wdgt->addHeader(S_EVENTS_BIG, $r_form); $numrows = new CDiv(); $numrows->setAttribute('name', 'numrows'); $events_wdgt->addHeader($numrows); // }}} HEADER // FILTER {{{ $filterForm = null;
$exactComboBox = new CComboBox('filter_exact', $_REQUEST['filter_exact']); $exactComboBox->addItem('0', _('like')); $exactComboBox->addItem('1', _('exactly')); $filter_table->addRow(array(array(array(bold(_('Field:')), $inventoryFieldsComboBox), array($exactComboBox, new CTextBox('filter_field_value', $_REQUEST['filter_field_value'], 20))))); $filter = new CButton('filter', _('Filter'), "javascript: create_var('zbx_filter', 'filter_set', '1', true);"); $filter->useJQueryStyle('main'); $reset = new CButton('reset', _('Reset'), "javascript: clearAllForm('zbx_filter');"); $reset->useJQueryStyle(); $div_buttons = new CDiv(array($filter, SPACE, $reset)); $div_buttons->setAttribute('style', 'padding: 4px 0px;'); $footer_col = new CCol($div_buttons, 'controls'); $filter_table->addRow($footer_col); $filter_form = new CForm('get'); $filter_form->setAttribute('name', 'zbx_filter'); $filter_form->setAttribute('id', 'zbx_filter'); $filter_form->addItem($filter_table); $hostinvent_wdgt->addFlicker($filter_form, CProfile::get('web.hostinventories.filter.state', 0)); $hostinvent_wdgt->addHeaderRowNumber(); $table = new CTableInfo(_('No hosts defined.')); $table->setHeader(array(is_show_all_nodes() ? make_sorting_header(_('Node'), 'hostid') : null, make_sorting_header(_('Host'), 'name'), _('Group'), make_sorting_header(_('Name'), 'pr_name'), make_sorting_header(_('Type'), 'pr_type'), make_sorting_header(_('OS'), 'pr_os'), make_sorting_header(_('Serial number A'), 'pr_serialno_a'), make_sorting_header(_('Tag'), 'pr_tag'), make_sorting_header(_('MAC address A'), 'pr_macaddress_a'))); $hosts = array(); $paging = getPagingLine($hosts); if ($pageFilter->groupsSelected) { // which inventory fields we will need for displaying $requiredInventoryFields = array('name', 'type', 'os', 'serialno_a', 'tag', 'macaddress_a'); // checking if correct inventory field is specified for filter $possibleInventoryFields = getHostInventories(); $possibleInventoryFields = zbx_toHash($possibleInventoryFields, 'db_field'); if (!empty($_REQUEST['filter_field']) && !empty($_REQUEST['filter_field_value']) && !isset($possibleInventoryFields[$_REQUEST['filter_field']])) { error(_s('Impossible to filter by inventory field "%s", which does not exist.', $_REQUEST['filter_field'])); } else {
function getItemFilterForm(&$items) { $filter_groupId = $_REQUEST['filter_groupid']; $filter_hostId = $_REQUEST['filter_hostid']; $filter_application = $_REQUEST['filter_application']; $filter_name = $_REQUEST['filter_name']; $filter_type = $_REQUEST['filter_type']; $filter_key = $_REQUEST['filter_key']; $filter_snmp_community = $_REQUEST['filter_snmp_community']; $filter_snmpv3_securityname = $_REQUEST['filter_snmpv3_securityname']; $filter_snmp_oid = $_REQUEST['filter_snmp_oid']; $filter_port = $_REQUEST['filter_port']; $filter_value_type = $_REQUEST['filter_value_type']; $filter_data_type = $_REQUEST['filter_data_type']; $filter_delay = $_REQUEST['filter_delay']; $filter_history = $_REQUEST['filter_history']; $filter_trends = $_REQUEST['filter_trends']; $filter_status = $_REQUEST['filter_status']; $filter_state = $_REQUEST['filter_state']; $filter_templated_items = $_REQUEST['filter_templated_items']; $filter_with_triggers = $_REQUEST['filter_with_triggers']; $subfilter_hosts = $_REQUEST['subfilter_hosts']; $subfilter_apps = $_REQUEST['subfilter_apps']; $subfilter_types = $_REQUEST['subfilter_types']; $subfilter_value_types = $_REQUEST['subfilter_value_types']; $subfilter_status = $_REQUEST['subfilter_status']; $subfilter_state = $_REQUEST['subfilter_state']; $subfilter_templated_items = $_REQUEST['subfilter_templated_items']; $subfilter_with_triggers = $_REQUEST['subfilter_with_triggers']; $subfilter_history = $_REQUEST['subfilter_history']; $subfilter_trends = $_REQUEST['subfilter_trends']; $subfilter_interval = $_REQUEST['subfilter_interval']; $form = new CForm('get'); $form->setAttribute('name', 'zbx_filter'); $form->setAttribute('id', 'zbx_filter'); $form->addVar('subfilter_hosts', $subfilter_hosts); $form->addVar('subfilter_apps', $subfilter_apps); $form->addVar('subfilter_types', $subfilter_types); $form->addVar('subfilter_value_types', $subfilter_value_types); $form->addVar('subfilter_status', $subfilter_status); $form->addVar('subfilter_state', $subfilter_state); $form->addVar('subfilter_templated_items', $subfilter_templated_items); $form->addVar('subfilter_with_triggers', $subfilter_with_triggers); $form->addVar('subfilter_history', $subfilter_history); $form->addVar('subfilter_trends', $subfilter_trends); $form->addVar('subfilter_interval', $subfilter_interval); // type select $fTypeVisibility = array(); $cmbType = new CComboBox('filter_type', $filter_type); $cmbType->setAttribute('id', 'filter_type'); $cmbType->addItem(-1, _('all')); foreach (array('filter_delay_label', 'filter_delay') as $vItem) { zbx_subarray_push($fTypeVisibility, -1, $vItem); } $itemTypes = item_type2str(); unset($itemTypes[ITEM_TYPE_HTTPTEST]); // httptest items are only for internal zabbix logic $cmbType->addItems($itemTypes); foreach ($itemTypes as $typeNum => $typeLabel) { if ($typeNum != ITEM_TYPE_TRAPPER) { zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay_label'); zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay'); } switch ($typeNum) { case ITEM_TYPE_SNMPV1: case ITEM_TYPE_SNMPV2C: $snmp_types = array('filter_snmp_community_label', 'filter_snmp_community', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_port_label', 'filter_port'); foreach ($snmp_types as $vItem) { zbx_subarray_push($fTypeVisibility, $typeNum, $vItem); } break; case ITEM_TYPE_SNMPV3: foreach (array('filter_snmpv3_securityname_label', 'filter_snmpv3_securityname', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_port_label', 'filter_port') as $vItem) { zbx_subarray_push($fTypeVisibility, $typeNum, $vItem); } break; } } zbx_add_post_js("var filterTypeSwitcher = new CViewSwitcher('filter_type', 'change', " . zbx_jsvalue($fTypeVisibility, true) . ');'); // type of information select $fVTypeVisibility = array(); $cmbValType = new CComboBox('filter_value_type', $filter_value_type); $cmbValType->addItem(-1, _('all')); $cmbValType->addItem(ITEM_VALUE_TYPE_UINT64, _('Numeric (unsigned)')); $cmbValType->addItem(ITEM_VALUE_TYPE_FLOAT, _('Numeric (float)')); $cmbValType->addItem(ITEM_VALUE_TYPE_STR, _('Character')); $cmbValType->addItem(ITEM_VALUE_TYPE_LOG, _('Log')); $cmbValType->addItem(ITEM_VALUE_TYPE_TEXT, _('Text')); foreach (array('filter_data_type_label', 'filter_data_type') as $vItem) { zbx_subarray_push($fVTypeVisibility, ITEM_VALUE_TYPE_UINT64, $vItem); } zbx_add_post_js("var filterValueTypeSwitcher = new CViewSwitcher('filter_value_type', 'change', " . zbx_jsvalue($fVTypeVisibility, true) . ');'); // status select $cmbStatus = new CComboBox('filter_status', $filter_status); $cmbStatus->addItem(-1, _('all')); foreach (array(ITEM_STATUS_ACTIVE, ITEM_STATUS_DISABLED) as $status) { $cmbStatus->addItem($status, item_status2str($status)); } // state select $cmbState = new CComboBox('filter_state', $filter_state); $cmbState->addItem(-1, _('all')); foreach (array(ITEM_STATE_NORMAL, ITEM_STATE_NOTSUPPORTED) as $state) { $cmbState->addItem($state, itemState($state)); } // update interval $updateIntervalLabel = new CSpan(array(bold(_('Update interval')), SPACE . _('(in sec)') . NAME_DELIMITER)); $updateIntervalLabel->setAttribute('id', 'filter_delay_label'); $updateIntervalInput = new CNumericBox('filter_delay', $filter_delay, 5, false, true); $updateIntervalInput->setEnabled('no'); // data type $dataTypeLabel = new CSpan(bold(_('Data type') . NAME_DELIMITER)); $dataTypeLabel->setAttribute('id', 'filter_data_type_label'); $dataTypeInput = new CComboBox('filter_data_type', $filter_data_type); $dataTypeInput->addItem(-1, _('all')); $dataTypeInput->addItems(item_data_type2str()); $dataTypeInput->setEnabled('no'); // filter table $table = new CTable('', 'filter'); $table->setCellPadding(0); $table->setCellSpacing(0); // SNMP community $snmpCommunityLabel = new CSpan(array(bold(_('SNMP community')), SPACE . _('like') . NAME_DELIMITER)); $snmpCommunityLabel->setAttribute('id', 'filter_snmp_community_label'); $snmpCommunityField = new CTextBox('filter_snmp_community', $filter_snmp_community, ZBX_TEXTBOX_FILTER_SIZE); $snmpCommunityField->setEnabled('no'); // SNMPv3 security name $snmpSecurityLabel = new CSpan(array(bold(_('Security name')), SPACE . _('like') . NAME_DELIMITER)); $snmpSecurityLabel->setAttribute('id', 'filter_snmpv3_securityname_label'); $snmpSecurityField = new CTextBox('filter_snmpv3_securityname', $filter_snmpv3_securityname, ZBX_TEXTBOX_FILTER_SIZE); $snmpSecurityField->setEnabled('no'); // SNMP OID $snmpOidLabel = new CSpan(array(bold(_('SNMP OID')), SPACE . _('like') . NAME_DELIMITER)); $snmpOidLabel->setAttribute('id', 'filter_snmp_oid_label'); $snmpOidField = new CTextBox('filter_snmp_oid', $filter_snmp_oid, ZBX_TEXTBOX_FILTER_SIZE); $snmpOidField->setEnabled('no'); // port $portLabel = new CSpan(array(bold(_('Port')), SPACE . _('like') . NAME_DELIMITER)); $portLabel->setAttribute('id', 'filter_port_label'); $portField = new CNumericBox('filter_port', $filter_port, 5, false, true); $portField->setEnabled('no'); // row 1 $groupFilter = null; if (!empty($filter_groupId)) { $getHostInfo = API::HostGroup()->get(array('groupids' => $filter_groupId, 'output' => array('name'))); $getHostInfo = reset($getHostInfo); if (!empty($getHostInfo)) { $groupFilter[] = array('id' => $getHostInfo['groupid'], 'name' => $getHostInfo['name']); } } $table->addRow(array(new CCol(bold(_('Host group') . NAME_DELIMITER), 'label col1'), new CCol(array(new CMultiSelect(array('name' => 'filter_groupid', 'selectedLimit' => 1, 'objectName' => 'hostGroup', 'objectOptions' => array('editable' => true), 'data' => $groupFilter, 'popup' => array('parameters' => 'srctbl=host_groups&dstfrm=' . $form->getName() . '&dstfld1=filter_groupid' . '&srcfld1=groupid&writeonly=1', 'width' => 450, 'height' => 450, 'buttonClass' => 'input filter-multiselect-select-button')))), 'col1'), new CCol(bold(_('Type') . NAME_DELIMITER), 'label col2'), new CCol($cmbType, 'col2'), new CCol(bold(_('Type of information') . NAME_DELIMITER), 'label col3'), new CCol($cmbValType, 'col3'), new CCol(bold(_('State') . NAME_DELIMITER), 'label'), new CCol($cmbState, 'col4')), 'item-list-row'); // row 2 $hostFilterData = null; if (!empty($filter_hostId)) { $getHostInfo = API::Host()->get(array('hostids' => $filter_hostId, 'templated_hosts' => true, 'output' => array('name'))); $getHostInfo = reset($getHostInfo); if (!empty($getHostInfo)) { $hostFilterData[] = array('id' => $getHostInfo['hostid'], 'name' => $getHostInfo['name']); } } $table->addRow(array(new CCol(bold(_('Host') . NAME_DELIMITER), 'label'), new CCol(array(new CMultiSelect(array('name' => 'filter_hostid', 'selectedLimit' => 1, 'objectName' => 'hosts', 'objectOptions' => array('editable' => true, 'templated_hosts' => true), 'data' => $hostFilterData, 'popup' => array('parameters' => 'srctbl=host_templates&dstfrm=' . $form->getName() . '&dstfld1=filter_hostid' . '&srcfld1=hostid&writeonly=1', 'width' => 450, 'height' => 450, 'buttonClass' => 'input filter-multiselect-select-button')))), 'col1'), new CCol($updateIntervalLabel, 'label'), new CCol($updateIntervalInput), new CCol($dataTypeLabel, 'label'), new CCol($dataTypeInput), new CCol(bold(_('Status') . NAME_DELIMITER), 'label col4'), new CCol($cmbStatus, 'col4')), 'item-list-row'); // row 3 $table->addRow(array(new CCol(bold(_('Application') . NAME_DELIMITER), 'label'), new CCol(array(new CTextBox('filter_application', $filter_application, ZBX_TEXTBOX_FILTER_SIZE), new CButton('btn_app', _('Select'), 'return PopUp("popup.php?srctbl=applications&srcfld1=name' . '&dstfrm=' . $form->getName() . '&dstfld1=filter_application' . '&with_applications=1' . '" + (jQuery("input[name=\'filter_hostid\']").length > 0 ? "&hostid="+jQuery("input[name=\'filter_hostid\']").val() : "")' . ', 550, 450, "application");', 'filter-select-button')), 'col1'), new CCol(array($snmpCommunityLabel, $snmpSecurityLabel), 'label'), new CCol(array($snmpCommunityField, $snmpSecurityField)), new CCol(array(bold(_('History')), SPACE . _('(in days)') . NAME_DELIMITER), 'label'), new CCol(new CNumericBox('filter_history', $filter_history, 8, false, true)), new CCol(bold(_('Triggers') . NAME_DELIMITER), 'label'), new CCol(new CComboBox('filter_with_triggers', $filter_with_triggers, null, array(-1 => _('all'), 1 => _('With triggers'), 0 => _('Without triggers'))))), 'item-list-row'); // row 4 $table->addRow(array(new CCol(array(bold(_('Name')), SPACE . _('like') . NAME_DELIMITER), 'label'), new CCol(new CTextBox('filter_name', $filter_name, ZBX_TEXTBOX_FILTER_SIZE), 'col1'), new CCol($snmpOidLabel, 'label'), new CCol($snmpOidField), new CCol(array(bold(_('Trends')), SPACE . _('(in days)') . NAME_DELIMITER), 'label'), new CCol(new CNumericBox('filter_trends', $filter_trends, 8, false, true)), new CCol(bold(_('Template') . NAME_DELIMITER), 'label'), new CCol(new CComboBox('filter_templated_items', $filter_templated_items, null, array(-1 => _('all'), 1 => _('Templated items'), 0 => _('Not Templated items'))))), 'item-list-row'); // row 5 $table->addRow(array(new CCol(array(bold(_('Key')), SPACE . _('like') . NAME_DELIMITER), 'label'), new CCol(new CTextBox('filter_key', $filter_key, ZBX_TEXTBOX_FILTER_SIZE), 'col1'), new CCol($portLabel, 'label'), new CCol($portField), new CCol(null, 'label'), new CCol(), new CCol(null, 'label'), new CCol()), 'item-list-row'); $filter = new CSubmit('filter_set', _('Filter'), 'chkbxRange.clearSelectedOnFilterChange();'); $filter->useJQueryStyle('main'); $reset = new CSubmit('filter_rst', _('Reset'), 'chkbxRange.clearSelectedOnFilterChange();'); $reset->useJQueryStyle(); $div_buttons = new CDiv(array($filter, SPACE, $reset)); $div_buttons->setAttribute('style', 'padding: 4px 0px;'); $footer = new CCol($div_buttons, 'controls', 8); $table->addRow($footer); $form->addItem($table); // subfilters $table_subfilter = new CTable(null, 'filter sub-filter'); // array contains subfilters and number of items in each $item_params = array('hosts' => array(), 'applications' => array(), 'types' => array(), 'value_types' => array(), 'status' => array(), 'state' => array(), 'templated_items' => array(), 'with_triggers' => array(), 'history' => array(), 'trends' => array(), 'interval' => array()); // generate array with values for subfilters of selected items foreach ($items as $item) { // hosts if (zbx_empty($filter_hostId)) { $host = reset($item['hosts']); if (!isset($item_params['hosts'][$host['hostid']])) { $item_params['hosts'][$host['hostid']] = array('name' => $host['name'], 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_hosts') { continue; } $show_item &= $value; } if ($show_item) { $host = reset($item['hosts']); $item_params['hosts'][$host['hostid']]['count']++; } } // applications if (!empty($item['applications'])) { foreach ($item['applications'] as $application) { if (!isset($item_params['applications'][$application['name']])) { $item_params['applications'][$application['name']] = array('name' => $application['name'], 'count' => 0); } } } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_apps') { continue; } $show_item &= $value; } $sel_app = false; if ($show_item) { // if any of item applications are selected foreach ($item['applications'] as $app) { if (str_in_array($app['name'], $subfilter_apps)) { $sel_app = true; break; } } foreach ($item['applications'] as $app) { if (str_in_array($app['name'], $subfilter_apps) || !$sel_app) { $item_params['applications'][$app['name']]['count']++; } } } // types if ($filter_type == -1) { if (!isset($item_params['types'][$item['type']])) { $item_params['types'][$item['type']] = array('name' => item_type2str($item['type']), 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_types') { continue; } $show_item &= $value; } if ($show_item) { $item_params['types'][$item['type']]['count']++; } } // value types if ($filter_value_type == -1) { if (!isset($item_params['value_types'][$item['value_type']])) { $item_params['value_types'][$item['value_type']] = array('name' => itemValueTypeString($item['value_type']), 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_value_types') { continue; } $show_item &= $value; } if ($show_item) { $item_params['value_types'][$item['value_type']]['count']++; } } // status if ($filter_status == -1) { if (!isset($item_params['status'][$item['status']])) { $item_params['status'][$item['status']] = array('name' => item_status2str($item['status']), 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_status') { continue; } $show_item &= $value; } if ($show_item) { $item_params['status'][$item['status']]['count']++; } } // state if ($filter_state == -1) { if (!isset($item_params['state'][$item['state']])) { $item_params['state'][$item['state']] = array('name' => itemState($item['state']), 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_state') { continue; } $show_item &= $value; } if ($show_item) { $item_params['state'][$item['state']]['count']++; } } // template if ($filter_templated_items == -1) { if ($item['templateid'] == 0 && !isset($item_params['templated_items'][0])) { $item_params['templated_items'][0] = array('name' => _('Not Templated items'), 'count' => 0); } elseif ($item['templateid'] > 0 && !isset($item_params['templated_items'][1])) { $item_params['templated_items'][1] = array('name' => _('Templated items'), 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_templated_items') { continue; } $show_item &= $value; } if ($show_item) { if ($item['templateid'] == 0) { $item_params['templated_items'][0]['count']++; } else { $item_params['templated_items'][1]['count']++; } } } // with triggers if ($filter_with_triggers == -1) { if (count($item['triggers']) == 0 && !isset($item_params['with_triggers'][0])) { $item_params['with_triggers'][0] = array('name' => _('Without triggers'), 'count' => 0); } elseif (count($item['triggers']) > 0 && !isset($item_params['with_triggers'][1])) { $item_params['with_triggers'][1] = array('name' => _('With triggers'), 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_with_triggers') { continue; } $show_item &= $value; } if ($show_item) { if (count($item['triggers']) == 0) { $item_params['with_triggers'][0]['count']++; } else { $item_params['with_triggers'][1]['count']++; } } } // trends if (zbx_empty($filter_trends)) { if (!isset($item_params['trends'][$item['trends']])) { $item_params['trends'][$item['trends']] = array('name' => $item['trends'], 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_trends') { continue; } $show_item &= $value; } if ($show_item) { $item_params['trends'][$item['trends']]['count']++; } } // history if (zbx_empty($filter_history)) { if (!isset($item_params['history'][$item['history']])) { $item_params['history'][$item['history']] = array('name' => $item['history'], 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_history') { continue; } $show_item &= $value; } if ($show_item) { $item_params['history'][$item['history']]['count']++; } } // interval if (zbx_empty($filter_delay) && $filter_type != ITEM_TYPE_TRAPPER) { if (!isset($item_params['interval'][$item['delay']])) { $item_params['interval'][$item['delay']] = array('name' => $item['delay'], 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_interval') { continue; } $show_item &= $value; } if ($show_item) { $item_params['interval'][$item['delay']]['count']++; } } } // output if (zbx_empty($filter_hostId) && count($item_params['hosts']) > 1) { $hosts_output = prepareSubfilterOutput($item_params['hosts'], $subfilter_hosts, 'subfilter_hosts'); $table_subfilter->addRow(array(_('Hosts'), $hosts_output)); } if (!empty($item_params['applications']) && count($item_params['applications']) > 1) { $application_output = prepareSubfilterOutput($item_params['applications'], $subfilter_apps, 'subfilter_apps'); $table_subfilter->addRow(array(_('Applications'), $application_output)); } if ($filter_type == -1 && count($item_params['types']) > 1) { $type_output = prepareSubfilterOutput($item_params['types'], $subfilter_types, 'subfilter_types'); $table_subfilter->addRow(array(_('Types'), $type_output)); } if ($filter_value_type == -1 && count($item_params['value_types']) > 1) { $value_types_output = prepareSubfilterOutput($item_params['value_types'], $subfilter_value_types, 'subfilter_value_types'); $table_subfilter->addRow(array(_('Type of information'), $value_types_output)); } if ($filter_status == -1 && count($item_params['status']) > 1) { $status_output = prepareSubfilterOutput($item_params['status'], $subfilter_status, 'subfilter_status'); $table_subfilter->addRow(array(_('Status'), $status_output)); } if ($filter_state == -1 && count($item_params['state']) > 1) { $state_output = prepareSubfilterOutput($item_params['state'], $subfilter_state, 'subfilter_state'); $table_subfilter->addRow(array(_('State'), $state_output)); } if ($filter_templated_items == -1 && count($item_params['templated_items']) > 1) { $templated_items_output = prepareSubfilterOutput($item_params['templated_items'], $subfilter_templated_items, 'subfilter_templated_items'); $table_subfilter->addRow(array(_('Template'), $templated_items_output)); } if ($filter_with_triggers == -1 && count($item_params['with_triggers']) > 1) { $with_triggers_output = prepareSubfilterOutput($item_params['with_triggers'], $subfilter_with_triggers, 'subfilter_with_triggers'); $table_subfilter->addRow(array(_('With triggers'), $with_triggers_output)); } if (zbx_empty($filter_history) && count($item_params['history']) > 1) { $history_output = prepareSubfilterOutput($item_params['history'], $subfilter_history, 'subfilter_history'); $table_subfilter->addRow(array(_('History'), $history_output)); } if (zbx_empty($filter_trends) && count($item_params['trends']) > 1) { $trends_output = prepareSubfilterOutput($item_params['trends'], $subfilter_trends, 'subfilter_trends'); $table_subfilter->addRow(array(_('Trends'), $trends_output)); } if (zbx_empty($filter_delay) && $filter_type != ITEM_TYPE_TRAPPER && count($item_params['interval']) > 1) { $interval_output = prepareSubfilterOutput($item_params['interval'], $subfilter_interval, 'subfilter_interval'); $table_subfilter->addRow(array(_('Interval'), $interval_output)); } $form->addItem(new CDiv(_('Subfilter [affects only filtered data!]'), 'thin_header')); $form->addItem($table_subfilter); return $form; }
$interfaceTable->addRow(array(_('IP address'), _('DNS name'), _('Connect to'), _('Port'))); $connectByComboBox = new CRadioButtonList('interface[useip]', $this->data['interface']['useip']); $connectByComboBox->addValue(_('IP'), 1); $connectByComboBox->addValue(_('DNS'), 0); $connectByComboBox->useJQueryStyle(); $interfaceTable->addRow(array(new CTextBox('interface[ip]', $this->data['interface']['ip'], ZBX_TEXTBOX_SMALL_SIZE, 'no', 64), new CTextBox('interface[dns]', $this->data['interface']['dns'], ZBX_TEXTBOX_SMALL_SIZE, 'no', 64), $connectByComboBox, new CTextBox('interface[port]', $this->data['interface']['port'], 18, 'no', 64))); $proxyFormList->addRow(_('Interface'), new CDiv($interfaceTable, 'objectgroup inlineblock border_dotted ui-corner-all')); } // append hosts to form list $hostsTweenBox = new CTweenBox($proxyForm, 'hosts', $this->data['hosts']); foreach ($this->data['dbHosts'] as $host) { // show only normal hosts, and discovered hosts monitored by the current proxy // for new proxies display only normal hosts if ($this->data['proxyid'] && idcmp($this->data['proxyid'], $host['proxy_hostid']) || $host['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) { $hostsTweenBox->addItem($host['hostid'], $host['name'], null, empty($host['proxy_hostid']) || !empty($this->data['proxyid']) && bccomp($host['proxy_hostid'], $this->data['proxyid']) == 0 && $host['flags'] == ZBX_FLAG_DISCOVERY_NORMAL); } } $proxyFormList->addRow(_('Hosts'), $hostsTweenBox->get(_('Proxy hosts'), _('Other hosts'))); // append tabs to form $proxyTab = new CTabView(); $proxyTab->addTab('proxyTab', _('Proxy'), $proxyFormList); $proxyForm->addItem($proxyTab); // append buttons to form if (!empty($this->data['proxyid'])) { $proxyForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), array(new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete proxy?'), url_param('form') . url_param('proxyid')), new CButtonCancel()))); } else { $proxyForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), new CButtonCancel())); } // append form to widget $proxyWidget->addItem($proxyForm); return $proxyWidget;
$row = new CRow(array(SPACE, $config['event_ack_enable'] ? $ack_cb_col : null, $status, $clock, zbx_date2age($row_event['clock']), zbx_date2age($next_clock, $row_event['clock']), $config['event_ack_enable'] ? $ack : NULL, is_show_all_nodes() ? SPACE : null, $empty_col), 'odd_row'); $row->setAttribute('data-parentid', $trigger['triggerid']); $row->addStyle('display: none;'); $table->addRow($row); if ($i > $config['event_show_max']) { break; } } } } //----- GO ------ $footer = null; if ($config['event_ack_enable']) { $goBox = new CComboBox('go'); $goBox->addItem('bulkacknowledge', S_BULK_ACKNOWLEDGE); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO . ' (0)'); $goButton->setAttribute('id', 'goButton'); $show_event_col ? zbx_add_post_js('chkbxRange.pageGoName = "events";') : zbx_add_post_js('chkbxRange.pageGoName = "triggers";'); $footer = get_table_header(array($goBox, $goButton)); } //---- $table = array($paging, $table, $paging, $footer); $m_form->addItem($table); $trigg_wdgt->addItem($m_form); $trigg_wdgt->show(); zbx_add_post_js('blink.init();'); zbx_add_post_js("var switcher = new CSwitcher('{$switcherName}');"); $jsmenu = new CPUMenu(null, 170); $jsmenu->InsertJavaScript(); include_once 'include/page_footer.php';
** 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. **/ // header $imageComboBox = new CComboBox('imagetype', $this->data['imagetype'], 'submit();'); $imageComboBox->addItem(IMAGE_TYPE_ICON, _('Icon')); $imageComboBox->addItem(IMAGE_TYPE_BACKGROUND, _('Background')); $imageComboBoxForm = new CForm(); $imageComboBoxForm->addItem(_('Type') . SPACE); $imageComboBoxForm->addItem($imageComboBox); $this->data['widget']->addHeader(_('Images'), $imageComboBoxForm); // form $imageForm = new CForm(); $imageForm->setName('imageForm'); $imageForm->addItem(BR()); $imageTable = new CTable(_('No images found.'), 'header_wide padding_standard'); $count = 0; $imageRow = new CRow(); foreach ($this->data['images'] as $image) { $img = $image['imagetype'] == IMAGE_TYPE_BACKGROUND ? new CLink(new CImg('imgstore.php?width=200&height=200&iconid=' . $image['imageid'], 'no image'), 'image.php?imageid=' . $image['imageid']) : new CImg('imgstore.php?iconid=' . $image['imageid'], 'no image'); $nodeName = $this->data['displayNodes'] ? new CSpan($image['nodename'], 'unknown') : null; $name = new CLink($image['name'], 'adm.images.php?form=update&imageid=' . $image['imageid']); $imgColumn = new CCol(); $imgColumn->setAttribute('align', 'center'); $imgColumn->addItem(array($img, BR(), $nodeName, $name), 'center'); $imageRow->addItem($imgColumn); $count++; if ($count % 4 == 0) { $imageTable->addRow($imageRow); $imageRow = new CRow();
$discoveryWidget->addHeaderRowNumber(); // create form $discoveryForm = new CForm(); $discoveryForm->setName('druleForm'); // create table $discoveryTable = new CTableInfo(_('No discovery rules found.')); $discoveryTable->setHeader(array(new CCheckBox('all_drules', null, "checkAll('" . $discoveryForm->getName() . "', 'all_drules', 'g_druleid');"), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), _('IP range'), _('Delay'), _('Checks'), _('Status'))); foreach ($data['drules'] as $drule) { array_push($drule['description'], new CLink($drule['name'], '?form=update&druleid=' . $drule['druleid'])); $status = new CCol(new CLink(discovery_status2str($drule['status']), '?g_druleid[]=' . $drule['druleid'] . '&action=' . ($drule['status'] == DRULE_STATUS_ACTIVE ? 'drule.massdisable' : 'drule.massenable'), discovery_status2style($drule['status']))); $discoveryTable->addRow(array(new CCheckBox('g_druleid[' . $drule['druleid'] . ']', null, null, $drule['druleid']), $drule['description'], $drule['iprange'], $drule['delay'], !empty($drule['checks']) ? implode(', ', $drule['checks']) : '', $status)); } // create go buttons $goComboBox = new CComboBox('action'); $goOption = new CComboItem('drule.massenable', _('Enable selected')); $goOption->setAttribute('confirm', _('Enable selected discovery rules?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('drule.massdisable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected discovery rules?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('drule.massdelete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected discovery rules?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "g_druleid";'); // append table to form $discoveryForm->addItem(array($this->data['paging'], $discoveryTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton)))); // append form to widget $discoveryWidget->addItem($discoveryForm); return $discoveryWidget;
$severityTab->addRow(_('Information'), array($severityNameTB1, SPACE, $severityColorTB1)); $severityNameTB2 = new CTextBox('severity_name_2', $this->data['config']['severity_name_2']); $severityNameTB2->addStyle('width: 15em;'); $severityNameTB2->setAttribute('maxlength', 32); $severityColorTB2 = new CColor('severity_color_2', $this->data['config']['severity_color_2']); $severityTab->addRow(_('Warning'), array($severityNameTB2, SPACE, $severityColorTB2)); $severityNameTB3 = new CTextBox('severity_name_3', $this->data['config']['severity_name_3']); $severityNameTB3->addStyle('width: 15em;'); $severityNameTB3->setAttribute('maxlength', 32); $severityColorTB3 = new CColor('severity_color_3', $this->data['config']['severity_color_3']); $severityTab->addRow(_('Average'), array($severityNameTB3, SPACE, $severityColorTB3)); $severityNameTB4 = new CTextBox('severity_name_4', $this->data['config']['severity_name_4']); $severityNameTB4->addStyle('width: 15em;'); $severityNameTB4->setAttribute('maxlength', 32); $severityColorTB4 = new CColor('severity_color_4', $this->data['config']['severity_color_4']); $severityTab->addRow(_('High'), array($severityNameTB4, SPACE, $severityColorTB4)); $severityNameTB5 = new CTextBox('severity_name_5', $this->data['config']['severity_name_5']); $severityNameTB5->addStyle('width: 15em;'); $severityNameTB5->setAttribute('maxlength', 32); $severityColorTB5 = new CColor('severity_color_5', $this->data['config']['severity_color_5']); $severityTab->addRow(_('Disaster'), array($severityNameTB5, SPACE, $severityColorTB5)); $severityTab->addRow(SPACE); $severityTab->addInfo(_('Custom severity names affect all locales and require manual translation!')); $severityView = new CTabView(); $severityView->addTab('severities', _('Trigger severities'), $severityTab); $severityForm = new CForm(); $severityForm->setName('triggerSeverity'); $severityForm->addVar('form_refresh', $this->data['form_refresh'] + 1); $severityForm->addItem($severityView); $severityForm->addItem(makeFormFooter(array(new CSubmit('save', _('Save'))), new CButton('resetDefaults', _('Reset defaults')))); return $severityForm;
$page['file'] = 'report5.php'; $page['hist_arg'] = array('period'); require_once dirname(__FILE__) . '/include/page_header.php'; // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = array('period' => array(T_ZBX_STR, O_OPT, P_SYS | P_NZERO, IN('"day","week","month","year"'), NULL)); check_fields($fields); $rprt_wdgt = new CWidget(); $_REQUEST['period'] = getRequest('period', 'day'); $admin_links = CWebUser::$data['type'] == USER_TYPE_ZABBIX_ADMIN || CWebUser::$data['type'] == USER_TYPE_SUPER_ADMIN; $form = new CForm('get'); $cmbPeriod = new CComboBox('period', $_REQUEST['period'], 'submit()'); $cmbPeriod->addItem('day', _('Day')); $cmbPeriod->addItem('week', _('Week')); $cmbPeriod->addItem('month', _('Month')); $cmbPeriod->addItem('year', _('Year')); $form->addItem($cmbPeriod); $rprt_wdgt->addPageHeader(_('MOST BUSY TRIGGERS TOP 100')); $rprt_wdgt->addHeader(_('Report'), $form); $rprt_wdgt->addItem(BR()); $table = new CTableInfo(_('No triggers found.')); $table->setHeader(array(_('Host'), _('Trigger'), _('Severity'), _('Number of status changes'))); switch ($_REQUEST['period']) { case 'week': $time_dif = SEC_PER_WEEK; break; case 'month': $time_dif = SEC_PER_MONTH; break; case 'year': $time_dif = SEC_PER_YEAR; break;
$operationConditionValueComboBox->addItem(0, _('Not Ack')); $operationConditionValueComboBox->addItem(1, _('Ack')); $rowCondition[] = $operationConditionValueComboBox; } $newOperationConditionTable->addRow($rowCondition); $newOperationConditionFooter = array(new CSubmit('add_opcondition', _('Add'), null, 'link_menu'), SPACE . SPACE, new CSubmit('cancel_new_opcondition', _('Cancel'), null, 'link_menu')); $newOperationsTable->addRow(array(_('Operation condition'), new CDiv(array($newOperationConditionTable, $newOperationConditionFooter), 'objectgroup inlineblock border_dotted ui-corner-all'))); } $footer = array(new CSubmit('add_operation', $this->data['new_operation']['action'] == 'update' ? _('Update') : _('Add'), null, 'link_menu'), SPACE . SPACE, new CSubmit('cancel_new_operation', _('Cancel'), null, 'link_menu')); $operationFormList->addRow(_('Operation details'), new CDiv(array($newOperationsTable, $footer), 'objectgroup inlineblock border_dotted ui-corner-all')); } // append tabs to form $actionTabs = new CTabView(); if (!isset($_REQUEST['form_refresh'])) { $actionTabs->setSelected(0); } $actionTabs->addTab('actionTab', _('Action'), $actionFormList); $actionTabs->addTab('conditionTab', _('Conditions'), $conditionFormList); $actionTabs->addTab('operationTab', _('Operations'), $operationFormList); $actionForm->addItem($actionTabs); // append buttons to form $others = array(); if (!empty($this->data['actionid'])) { $others[] = new CButton('clone', _('Clone')); $others[] = new CButtonDelete(_('Delete current action?'), url_param('form') . url_param('eventsource') . url_param('actionid')); } $others[] = new CButtonCancel(url_param('actiontype')); $actionForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), $others)); // append form to widget $actionWidget->addItem($actionForm); return $actionWidget;
$dependenciesTable->setHeader(array(_('Name'), _('Action'))); foreach ($this->data['dependencies'] as $dependency) { $triggersForm->addVar('dependencies[]', $dependency['triggerid'], 'dependencies_' . $dependency['triggerid']); $hostNames = array(); foreach ($dependency['hosts'] as $host) { $hostNames[] = CHtml::encode($host['name']); $hostNames[] = ', '; } array_pop($hostNames); if ($dependency['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) { $description = new CLink(array($hostNames, NAME_DELIMITER, CHtml::encode($dependency['description'])), 'triggers.php?form=update&hostid=' . $dependency['hostid'] . '&triggerid=' . $dependency['triggerid']); $description->setAttribute('target', '_blank'); } else { $description = array($hostNames, NAME_DELIMITER, $dependency['description']); } $row = new CRow(array($description, new CButton('remove', _('Remove'), 'javascript: removeDependency(\'' . $dependency['triggerid'] . '\');', 'link_menu'))); $row->setAttribute('id', 'dependency_' . $dependency['triggerid']); $dependenciesTable->addRow($row); } $dependenciesDiv = new CDiv(array($dependenciesTable, new CButton('btn1', _('Add'), 'return PopUp("popup.php?' . 'dstfrm=massupdate' . '&dstact=add_dependency' . '&reference=deptrigger' . '&dstfld1=new_dependency' . '&srctbl=triggers' . '&objname=triggers' . '&srcfld1=triggerid' . '&multiselect=1' . '&with_triggers=1", 1000, 700);', 'link_menu')), 'objectgroup inlineblock border_dotted ui-corner-all'); $dependenciesDiv->setAttribute('id', 'dependencies_div'); $triggersFormList->addRow(array(_('Replace dependencies'), SPACE, new CVisibilityBox('visible[dependencies]', isset($this->data['visible']['dependencies']), 'dependencies_div', _('Original'))), $dependenciesDiv); } // append tabs to form $triggersTab = new CTabView(); $triggersTab->addTab('triggersTab', _('Mass update'), $triggersFormList); $triggersForm->addItem($triggersTab); // append buttons to form $triggersForm->addItem(makeFormFooter(new CSubmit('massupdate', _('Update')), new CButtonCancel(url_params(array('groupid', 'hostid', 'parent_discoveryid'))))); $triggersWidget->addItem($triggersForm); return $triggersWidget;
$imageForm = new CForm('post', null, 'multipart/form-data'); $imageForm->setName('imageForm'); $imageForm->addVar('form', $this->data['form']); if (isset($this->data['imageid'])) { $imageForm->addVar('imageid', $this->data['imageid']); } $imageForm->addVar('imagetype', $this->data['imagetype']); // append form list $imageFormList = new CFormList('imageFormList'); $nameTextBox = new CTextBox('name', $this->data['imagename'], 64, false, 64); $nameTextBox->attr('autofocus', 'autofocus'); $imageFormList->addRow(_('Name'), $nameTextBox); $imageFormList->addRow(_('Upload'), new CFile('image')); if (isset($this->data['imageid'])) { if ($this->data['imagetype'] == IMAGE_TYPE_BACKGROUND) { $imageFormList->addRow(_('Image'), new CLink(new CImg('imgstore.php?width=200&height=200&iconid=' . $this->data['imageid'], 'no image'), 'image.php?imageid=' . $this->data['imageid'])); } else { $imageFormList->addRow(_('Image'), new CImg('imgstore.php?iconid=' . $this->data['imageid'], 'no image', null)); } } // append tab $imageTab = new CTabView(); $imageTab->addTab('imageTab', $this->data['imagetype'] == IMAGE_TYPE_ICON ? _('Icon') : _('Background'), $imageFormList); $imageForm->addItem($imageTab); // append buttons if (isset($this->data['imageid'])) { $imageForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), array(new CButtonDelete(_('Delete selected image?'), url_param('form') . url_param('imageid')), new CButtonCancel()))); } else { $imageForm->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel())); } return $imageForm;
** 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. **/ zbx_add_post_js('jqBlink.blink();'); $overviewWidget = new CWidget(); $typeComboBox = new CComboBox('type', $this->data['type'], 'submit()'); $typeComboBox->addItem(SHOW_TRIGGERS, _('Triggers')); $typeComboBox->addItem(SHOW_DATA, _('Data')); $headerForm = new CForm('get'); $headerForm->addItem(array(_('Group'), SPACE, $this->data['pageFilter']->getGroupsCB(true))); $headerForm->addItem(array(SPACE, _('Application'), SPACE, $this->data['pageFilter']->getApplicationsCB(true))); $headerForm->addItem(array(SPACE, _('Type'), SPACE, $typeComboBox)); $overviewWidget->addHeader(_('Overview'), $headerForm); $hintTable = new CTableInfo(); $hintTable->setAttribute('style', 'width: 200px'); if ($this->data['type'] == SHOW_TRIGGERS) { $hintTable->addRow(array(new CCol(SPACE, 'normal'), _('OK'))); } for ($i = 0; $i < TRIGGER_SEVERITY_COUNT; $i++) { $hintTable->addRow(array(getSeverityCell($i), _('PROBLEM'))); } $config = select_config(); if ($this->data['type'] == SHOW_TRIGGERS) { // blinking preview in help popup (only if blinking is enabled) if ($config['blink_period'] > 0) {
<?php /* ** Zabbix ** Copyright (C) 2001-2013 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. **/ $scriptWidget = new CWidget(); // create form $scriptForm = new CForm(); $scriptForm->setName('scriptForm'); // append tabs to form $scriptTab = new CTabView(); $scriptTab->addTab('scriptTab', _s('Result of "%s"', $this->data['info']['name']), new CSpan($this->data['message'], 'pre fixedfont')); $scriptForm->addItem($scriptTab); $scriptWidget->addItem($scriptForm); return $scriptWidget;
$hostTemplates[] = ', '; } if ($hostTemplates) { array_pop($hostTemplates); } } // status $status = new CLink(item_status2str($hostPrototype['status']), '?group_hostid=' . $hostPrototype['hostid'] . '&parent_discoveryid=' . $discoveryRule['itemid'] . '&go=' . ($hostPrototype['status'] ? 'activate' : 'disable'), itemIndicatorStyle($hostPrototype['status'])); $hostTable->addRow(array(new CCheckBox('group_hostid[' . $hostPrototype['hostid'] . ']', null, null, $hostPrototype['hostid']), $name, new CCol($hostTemplates, 'wraptext'), $status)); } // create go buttons $goComboBox = new CComboBox('go'); $goOption = new CComboItem('activate', _('Activate selected')); $goOption->setAttribute('confirm', _('Enable selected host prototypes?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('disable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected host prototypes?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('delete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected host prototypes?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "group_hostid";'); zbx_add_post_js('chkbxRange.prefix = "' . $discoveryRule['itemid'] . '";'); zbx_add_post_js('cookie.prefix = "' . $discoveryRule['itemid'] . '";'); // append table to form $itemForm->addItem(array($this->data['paging'], $hostTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton)))); // append form to widget $itemsWidget->addItem($itemForm); return $itemsWidget;
$itemFormList = new CFormList('itemFormList'); // append type to form list $copyTypeComboBox = new CComboBox('copy_type', $this->data['copy_type'], 'submit()'); $copyTypeComboBox->addItem(0, _('Hosts')); $copyTypeComboBox->addItem(1, _('Host groups')); $itemFormList->addRow(_('Target type'), $copyTypeComboBox); // append targets to form list $targetList = array(); if ($this->data['copy_type'] == 0) { $groupComboBox = new CComboBox('copy_groupid', $this->data['copy_groupid'], 'submit()'); foreach ($this->data['groups'] as $group) { $groupComboBox->addItem($group['groupid'], $group['name']); } $itemFormList->addRow(_('Group'), $groupComboBox); foreach ($this->data['hosts'] as $host) { array_push($targetList, array(new CCheckBox('copy_targetid[' . $host['hostid'] . ']', uint_in_array($host['hostid'], $this->data['copy_targetid']), null, $host['hostid']), SPACE, $host['name'], BR())); } } else { foreach ($this->data['groups'] as $group) { array_push($targetList, array(new CCheckBox('copy_targetid[' . $group['groupid'] . ']', uint_in_array($group['groupid'], $this->data['copy_targetid']), null, $group['groupid']), SPACE, $group['name'], BR())); } } $itemFormList->addRow(_('Target'), !empty($targetList) ? $targetList : SPACE); // append tabs to form $itemTab = new CTabView(); $itemTab->addTab('itemTab', count($this->data['group_itemid']) . ' ' . _('elements copy to ...'), $itemFormList); $itemForm->addItem($itemTab); // append buttons to form $itemForm->addItem(makeFormFooter(new CSubmit('copy', _('Copy')), new CButtonCancel(url_param('groupid') . url_param('hostid') . url_param('config')))); $itemWidget->addItem($itemForm); return $itemWidget;
$menu_selected = true; $sub_menu_div->setAttribute('style', 'display: block;'); insert_js('MMenu.def_label = ' . zbx_jsvalue($label)); } else { $sub_menu_div->setAttribute('style', 'display: none;'); } $menu_divs[] = $sub_menu_div; } $sub_menu_div = new CDiv(SPACE); $sub_menu_div->setAttribute('id', 'sub_empty'); $sub_menu_div->setAttribute('style', 'display: ' . ($menu_selected ? 'none;' : 'block;')); $menu_divs[] = $sub_menu_div; $search_form = new CForm('search.php'); $search_form->setMethod('get'); $search_form->setAttribute('class', 'thin'); $search_form->addItem(new CDiv(array(S_SEARCH_BIG . ': ', new CTextBox('search', '', 15)))); $search_div = new CDiv($search_form); $search_div->setAttribute('id', 'zbx_search'); $search_div->setAttribute('class', 'zbx_search'); $sub_menu_table->addRow(array($menu_divs, $search_div)); $page_menu->addItem($sub_menu_table); //--- /* SEARCH form $search_form = new CForm('search.php'); $search_form->addItem(new CDiv(array(S_SEARCH_BIG.': ', new CTextBox('search','',20)))); $search_div = new CDiv($search_form); $search_div->setAttribute('id','zbx_search'); $search_div->setAttribute('class','zbx_search'); $page_menu->addItem($search_div);
$groupFieldTitle = ''; $hostinvent_wdgt = new CWidget(); $hostinvent_wdgt->addPageHeader(_('HOST INVENTORY OVERVIEW')); // getting inventory fields to make a drop down $inventoryFields = getHostInventories(true); // 'true' means list should be ordered by title $inventoryFieldsComboBox = new CComboBox('groupby', $_REQUEST['groupby'], 'submit()'); $inventoryFieldsComboBox->addItem('', _('not selected')); foreach ($inventoryFields as $inventoryField) { $inventoryFieldsComboBox->addItem($inventoryField['db_field'], $inventoryField['title'], $_REQUEST['groupby'] === $inventoryField['db_field'] ? 'yes' : null); if ($_REQUEST['groupby'] === $inventoryField['db_field']) { $groupFieldTitle = $inventoryField['title']; } } $r_form = new CForm('get'); $r_form->addItem(array(_('Group'), SPACE, $pageFilter->getGroupsCB(true), SPACE)); $r_form->addItem(array(_('Grouping by'), SPACE, $inventoryFieldsComboBox)); $hostinvent_wdgt->addHeader(_('Hosts'), $r_form); $hostinvent_wdgt->addItem(BR()); $table = new CTableInfo(_('No hosts defined.')); $table->setHeader(array(make_sorting_header($groupFieldTitle === '' ? _('Field') : $groupFieldTitle, 'inventory_field'), make_sorting_header(_('Host count'), 'host_count'))); // to show a report, we will need a host group and a field to aggregate if ($pageFilter->groupsSelected && $groupFieldTitle !== '') { $options = array('output' => array('hostid', 'name'), 'selectInventory' => array($_REQUEST['groupby']), 'withInventory' => true); if ($pageFilter->groupid > 0) { $options['groupids'] = $pageFilter->groupid; } $hosts = API::Host()->get($options); // aggregating data by chosen field value $report = array(); foreach ($hosts as $host) {