function insert_map_form() { $frm_title = 'New system map'; if (isset($_REQUEST['sysmapid'])) { $options = array('sysmapids' => $_REQUEST['sysmapid'], 'output' => API_OUTPUT_EXTEND); $sysmaps = CMap::get($options); $row = reset($sysmaps); $frm_title = 'System map: "' . $row['name'] . '"'; } if (isset($_REQUEST['sysmapid']) && !isset($_REQUEST['form_refresh'])) { $name = $row['name']; $width = $row['width']; $height = $row['height']; $backgroundid = $row['backgroundid']; $label_type = $row['label_type']; $label_location = $row['label_location']; $highlight = $row['highlight']; $markelements = $row['markelements']; $expandproblem = $row['expandproblem']; $show_unack = $row['show_unack']; } else { $name = get_request('name', ''); $width = get_request('width', 800); $height = get_request('height', 600); $backgroundid = get_request('backgroundid', 0); $label_type = get_request('label_type', 0); $label_location = get_request('label_location', 0); $highlight = get_request('highlight', 0); $markelements = get_request('markelements', 0); $expandproblem = get_request('expandproblem', 0); $show_unack = get_request('show_unack', 0); } $frmMap = new CFormTable($frm_title, 'sysmaps.php'); $frmMap->setHelp('web.sysmaps.map.php'); if (isset($_REQUEST['sysmapid'])) { $frmMap->addVar('sysmapid', $_REQUEST['sysmapid']); } $frmMap->addRow(S_NAME, new CTextBox('name', $name, 32)); $frmMap->addRow(S_WIDTH, new CNumericBox('width', $width, 5)); $frmMap->addRow(S_HEIGHT, new CNumericBox('height', $height, 5)); $cmbImg = new CComboBox('backgroundid', $backgroundid); $cmbImg->addItem(0, S_NO_IMAGE . '...'); $result = DBselect('SELECT * FROM images WHERE imagetype=2 AND ' . DBin_node('imageid') . ' order by name'); while ($row = DBfetch($result)) { $cmbImg->addItem($row['imageid'], get_node_name_by_elid($row['imageid'], null, ': ') . $row['name']); } $frmMap->addRow(S_BACKGROUND_IMAGE, $cmbImg); $frmMap->addRow(S_ICON_HIGHLIGHTING, new CCheckBox('highlight', $highlight, null, 1)); $frmMap->addRow(S_MARK_ELEMENTS_ON_TRIGGER_STATUS_CHANGE, new CCheckBox('markelements', $markelements, null, 1)); $frmMap->addRow(S_EXPAND_SINGLE_PROBLEM, new CCheckBox('expandproblem', $expandproblem, null, 1)); $cmbLabel = new CComboBox('label_type', $label_type); $cmbLabel->addItem(0, S_LABEL); $cmbLabel->addItem(1, S_IP_ADDRESS); $cmbLabel->addItem(2, S_ELEMENT_NAME); $cmbLabel->addItem(3, S_STATUS_ONLY); $cmbLabel->addItem(4, S_NOTHING); $frmMap->addRow(S_ICON_LABEL_TYPE, $cmbLabel); $cmbLocation = new CComboBox('label_location', $label_location); $cmbLocation->addItem(0, S_BOTTOM); $cmbLocation->addItem(1, S_LEFT); $cmbLocation->addItem(2, S_RIGHT); $cmbLocation->addItem(3, S_TOP); $frmMap->addRow(S_ICON_LABEL_LOCATION, $cmbLocation); $config = select_config(); $cb = new CComboBox('show_unack', $show_unack); $cb->addItems(array(EXTACK_OPTION_ALL => S_O_ALL, EXTACK_OPTION_BOTH => S_O_SEPARATED, EXTACK_OPTION_UNACK => S_O_UNACKNOWLEDGED_ONLY)); $cb->setEnabled($config['event_ack_enable']); if (!$config['event_ack_enable']) { $cb->setAttribute('title', S_EVENT_ACKNOWLEDGING_DISABLED); } $frmMap->addRow(S_PROBLEM_DISPLAY, $cb); $frmMap->addItemToBottomRow(new CButton('save', S_SAVE)); if (isset($_REQUEST['sysmapid'])) { $frmMap->addItemToBottomRow(SPACE); $frmMap->addItemToBottomRow(new CButtonDelete(S_DELETE_SYSTEM_MAP_Q, url_param('form') . url_param('sysmapid'))); } $frmMap->addItemToBottomRow(SPACE); $frmMap->addItemToBottomRow(new CButtonCancel()); return $frmMap; }
break; case CONDITION_TYPE_TRIGGER_NAME: $condition = new CTextBox('new_condition[value]', '', ZBX_TEXTBOX_STANDARD_SIZE); break; case CONDITION_TYPE_TRIGGER_VALUE: $condition = new CComboBox('new_condition[value]'); foreach (array(TRIGGER_VALUE_FALSE, TRIGGER_VALUE_TRUE) as $trigerValue) { $condition->addItem($trigerValue, trigger_value2str($trigerValue)); } break; case CONDITION_TYPE_TIME_PERIOD: $condition = new CTextBox('new_condition[value]', ZBX_DEFAULT_INTERVAL, ZBX_TEXTBOX_STANDARD_SIZE); break; case CONDITION_TYPE_TRIGGER_SEVERITY: $condition = new CComboBox('new_condition[value]'); $condition->addItems(getSeverityCaption()); break; case CONDITION_TYPE_MAINTENANCE: $condition = new CCol(_('maintenance')); break; case CONDITION_TYPE_NODE: $conditionFormList->addItem(new CVar('new_condition[value]', '0')); $condition = array(new CTextBox('node', '', ZBX_TEXTBOX_STANDARD_SIZE, 'yes'), SPACE, new CButton('btn1', _('Select'), 'return PopUp("popup.php?srctbl=nodes&srcfld1=nodeid&srcfld2=name' . '&dstfrm=' . $actionForm->getName() . '&dstfld1=new_condition_value&dstfld2=node' . '&writeonly=1", 450, 450);', 'link_menu')); break; case CONDITION_TYPE_DRULE: $conditionFormList->addItem(new CVar('new_condition[value]', '0')); $condition = array(new CTextBox('drule', '', ZBX_TEXTBOX_STANDARD_SIZE, 'yes'), SPACE, new CButton('btn1', _('Select'), 'return PopUp("popup.php?srctbl=drules&srcfld1=druleid&srcfld2=name' . '&dstfrm=' . $actionForm->getName() . '&dstfld1=new_condition_value&dstfld2=drule", 450, 450);', 'link_menu')); break; case CONDITION_TYPE_DCHECK: $conditionFormList->addItem(new CVar('new_condition[value]', '0')); $condition = array(new CTextBox('dcheck', '', ZBX_TEXTBOX_STANDARD_SIZE, 'yes'), SPACE, new CButton('btn1', _('Select'), 'return PopUp("popup.php?srctbl=dchecks&srcfld1=dcheckid&srcfld2=name' . '&dstfrm=' . $actionForm->getName() . '&dstfld1=new_condition_value&dstfld2=dcheck&writeonly=1", 450, 450);', 'link_menu'));
require_once dirname(__FILE__) . '/include/config.inc.php'; $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');
} $divTabs->addTab('templateTab', _('Templates'), $tmplList); /* * IPMI */ $ipmiList = new CFormList('ipmilist'); // normal hosts if (!$isDiscovered) { $cmbIPMIAuthtype = new CComboBox('ipmi_authtype', $ipmi_authtype); $cmbIPMIAuthtype->addItems(ipmiAuthTypes()); $cmbIPMIAuthtype->addClass('openView'); $cmbIPMIAuthtype->setAttribute('size', 7); $cmbIPMIAuthtype->addStyle('width: 170px;'); $ipmiList->addRow(_('Authentication algorithm'), $cmbIPMIAuthtype); $cmbIPMIPrivilege = new CComboBox('ipmi_privilege', $ipmi_privilege); $cmbIPMIPrivilege->addItems(ipmiPrivileges()); $cmbIPMIPrivilege->addClass('openView'); $cmbIPMIPrivilege->setAttribute('size', 5); $cmbIPMIPrivilege->addStyle('width: 170px;'); $ipmiList->addRow(_('Privilege level'), $cmbIPMIPrivilege); } else { $cmbIPMIAuthtype = new CTextBox('ipmi_authtype_name', ipmiAuthTypes($dbHost['ipmi_authtype']), ZBX_TEXTBOX_SMALL_SIZE, true); $ipmiList->addRow(_('Authentication algorithm'), $cmbIPMIAuthtype); $cmbIPMIPrivilege = new CTextBox('ipmi_privilege_name', ipmiPrivileges($dbHost['ipmi_privilege']), ZBX_TEXTBOX_SMALL_SIZE, true); $ipmiList->addRow(_('Privilege level'), $cmbIPMIPrivilege); } $ipmiList->addRow(_('Username'), new CTextBox('ipmi_username', $ipmi_username, ZBX_TEXTBOX_SMALL_SIZE, $isDiscovered)); $ipmiList->addRow(_('Password'), new CTextBox('ipmi_password', $ipmi_password, ZBX_TEXTBOX_SMALL_SIZE, $isDiscovered)); $divTabs->addTab('ipmiTab', _('IPMI'), $ipmiList); /* * Macros
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; }
$filterForm->setAttribute('id', 'zbx_filter'); $row = new CRow(array(new CCol(S_USER, 'form_row_l'), new CCol(array(new CTextBox('alias', $_REQUEST['alias'], 32), new CButton('btn1', S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->GetName() . "&dstfld1=alias&srctbl=users&srcfld1=alias&real_hosts=1');", 'T')), 'form_row_r'))); $filterForm->addRow($row); $cmbAction = new CComboBox('action', $_REQUEST['action']); $cmbAction->addItem(-1, S_ALL_S); $cmbAction->addItem(AUDIT_ACTION_LOGIN, S_LOGIN); $cmbAction->addItem(AUDIT_ACTION_LOGOUT, S_LOGOUT); $cmbAction->addItem(AUDIT_ACTION_ADD, S_ADD); $cmbAction->addItem(AUDIT_ACTION_UPDATE, S_UPDATE); $cmbAction->addItem(AUDIT_ACTION_DELETE, S_DELETE); $cmbAction->addItem(AUDIT_ACTION_ENABLE, S_ENABLE); $cmbAction->addItem(AUDIT_ACTION_DISABLE, S_DISABLE); $filterForm->addRow(S_ACTION, $cmbAction); $cmbResource = new CComboBox('resourcetype', $_REQUEST['resourcetype']); $resources = array(-1 => S_ALL_S) + audit_resource2str(); $cmbResource->addItems($resources); $filterForm->addRow(S_RESOURCE, $cmbResource); $reset = new CButton('filter_rst', S_RESET); $reset->setType('button'); $reset->setAction('javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst",1); location.href = uri.getUrl();'); $filterForm->addItemToBottomRow(new CButton('filter_set', S_FILTER)); $filterForm->addItemToBottomRow($reset); $audit_wdgt->addFlicker($filterForm, CProfile::get('web.auditlogs.filter.state', 1)); $scroll_div = new CDiv(); $scroll_div->setAttribute('id', 'scrollbar_cntr'); $audit_wdgt->addFlicker($scroll_div, CProfile::get('web.auditlogs.filter.state', 1)); //------- $effectiveperiod = navigation_bar_calc('web.auditlogs.timeline', 0, true); $bstime = $_REQUEST['stime']; $from = zbxDateToTime($_REQUEST['stime']); $till = $from + $effectiveperiod;
$dchecks[$id]['name'] = discovery_check2str($data['type'], $data['snmp_community'], $data['key'], $data['ports']); } order_result($dchecks, 'name'); foreach ($dchecks as $id => $data) { $label = new CLabel($data['name'], 'selected_checks[' . $id . ']'); $dchecks[$id] = array(new CCheckBox('selected_checks[' . $id . ']', null, null, $id), $label, BR()); if (in_array($data['type'], array(SVC_AGENT, SVC_SNMPv1, SVC_SNMPv2, SVC_SNMPv3))) { $cmbUniquenessCriteria->addItem($id, $data['name']); } } if (count($dchecks)) { $dchecks[] = new CButton('delete_ckecks', S_DELETE_SELECTED); $form->addRow(S_CHECKS, $dchecks); } $cmbChkType = new CComboBox('new_check_type', $new_check_type, "if(add_variable(this, 'type_changed', 1)) submit()"); $cmbChkType->addItems(discovery_check_type2str()); if (isset($_REQUEST['type_changed'])) { $new_check_ports = svc_default_port($new_check_type); } $external_param = new CTable(); if ($new_check_type != SVC_ICMPPING) { $external_param->addRow(array(S_PORTS_SMALL, new CTextBox('new_check_ports', $new_check_ports, 20))); } switch ($new_check_type) { case SVC_SNMPv1: case SVC_SNMPv2: $external_param->addRow(array(S_SNMP_COMMUNITY, new CTextBox('new_check_snmp_community', $new_check_snmp_community))); $external_param->addRow(array(S_SNMP_OID, new CTextBox('new_check_key', $new_check_key))); $form->addVar('new_check_snmpv3_securitylevel', ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV); $form->addVar('new_check_snmpv3_securityname', ''); $form->addVar('new_check_snmpv3_authpassphrase', '');
case CONDITION_TYPE_TRIGGER_NAME: $rowCondition[] = new CTextBox('new_condition[value]', '', ZBX_TEXTBOX_STANDARD_SIZE); break; case CONDITION_TYPE_TRIGGER_VALUE: $conditionValueComboBox = new CComboBox('new_condition[value]'); foreach (array(TRIGGER_VALUE_FALSE, TRIGGER_VALUE_TRUE) as $trigerValue) { $conditionValueComboBox->addItem($trigerValue, trigger_value2str($trigerValue)); } $rowCondition[] = $conditionValueComboBox; break; case CONDITION_TYPE_TIME_PERIOD: $rowCondition[] = new CTextBox('new_condition[value]', ZBX_DEFAULT_INTERVAL, ZBX_TEXTBOX_STANDARD_SIZE); break; case CONDITION_TYPE_TRIGGER_SEVERITY: $conditionValueComboBox = new CComboBox('new_condition[value]'); $conditionValueComboBox->addItems(getSeverityCaption()); $rowCondition[] = $conditionValueComboBox; break; case CONDITION_TYPE_MAINTENANCE: $rowCondition[] = new CCol(_('maintenance')); break; case CONDITION_TYPE_NODE: $conditionFormList->addItem(new CVar('new_condition[value]', '0')); $rowCondition[] = array(new CTextBox('node', '', ZBX_TEXTBOX_STANDARD_SIZE, 'yes'), SPACE, new CButton('btn1', _('Select'), 'return PopUp("popup.php?srctbl=nodes&srcfld1=nodeid&srcfld2=name' . '&dstfrm=' . $actionForm->getName() . '&dstfld1=new_condition_value&dstfld2=node' . '&writeonly=1", 450, 450);', 'link_menu')); break; case CONDITION_TYPE_DRULE: $conditionFormList->addItem(new CVar('new_condition[value]', '0')); $rowCondition[] = array(new CTextBox('drule', '', ZBX_TEXTBOX_STANDARD_SIZE, 'yes'), SPACE, new CButton('btn1', _('Select'), 'return PopUp("popup.php?srctbl=drules&srcfld1=druleid&srcfld2=name' . '&dstfrm=' . $actionForm->getName() . '&dstfld1=new_condition_value&dstfld2=drule", 450, 450);', 'link_menu')); break; case CONDITION_TYPE_DCHECK: $conditionFormList->addItem(new CVar('new_condition[value]', '0'));
if ($config['event_ack_enable']) { $ackStatusComboBox = new CComboBox('ack_status', $ackStatus); $ackStatusComboBox->addItem(ZBX_ACK_STS_ANY, _('Any')); $ackStatusComboBox->additem(ZBX_ACK_STS_WITH_UNACK, _('With unacknowledged events')); $ackStatusComboBox->additem(ZBX_ACK_STS_WITH_LAST_UNACK, _('With last event unacknowledged')); $filterForm->addRow(_('Acknowledge status'), $ackStatusComboBox); } $eventsComboBox = new CComboBox('show_events', $_REQUEST['show_events']); $eventsComboBox->addItem(EVENTS_OPTION_NOEVENT, _('Hide all')); $eventsComboBox->addItem(EVENTS_OPTION_ALL, _('Show all') . ' (' . $config['event_expire'] . ' ' . ($config['event_expire'] > 1 ? _('Days') : _('Day')) . ')'); if ($config['event_ack_enable']) { $eventsComboBox->addItem(EVENTS_OPTION_NOT_ACK, _('Show unacknowledged') . ' (' . $config['event_expire'] . ' ' . ($config['event_expire'] > 1 ? _('Days') : _('Day')) . ')'); } $filterForm->addRow(_('Events'), $eventsComboBox); $severityComboBox = new CComboBox('show_severity', $showSeverity); $severityComboBox->addItems(array(TRIGGER_SEVERITY_NOT_CLASSIFIED => getSeverityCaption(TRIGGER_SEVERITY_NOT_CLASSIFIED), TRIGGER_SEVERITY_INFORMATION => getSeverityCaption(TRIGGER_SEVERITY_INFORMATION), TRIGGER_SEVERITY_WARNING => getSeverityCaption(TRIGGER_SEVERITY_WARNING), TRIGGER_SEVERITY_AVERAGE => getSeverityCaption(TRIGGER_SEVERITY_AVERAGE), TRIGGER_SEVERITY_HIGH => getSeverityCaption(TRIGGER_SEVERITY_HIGH), TRIGGER_SEVERITY_DISASTER => getSeverityCaption(TRIGGER_SEVERITY_DISASTER))); $filterForm->addRow(_('Minimum trigger severity'), $severityComboBox); $statusChangeDays = new CNumericBox('status_change_days', $_REQUEST['status_change_days'], 3, false, false, false); if (!$_REQUEST['status_change']) { $statusChangeDays->setAttribute('disabled', 'disabled'); } $statusChangeDays->addStyle('vertical-align: middle;'); $statusChangeCheckBox = new CCheckBox('status_change', $_REQUEST['status_change'], 'javascript: this.checked ? $("status_change_days").enable() : $("status_change_days").disable()', 1); $statusChangeCheckBox->addStyle('vertical-align: middle;'); $daysSpan = new CSpan(_('days')); $daysSpan->addStyle('vertical-align: middle;'); $filterForm->addRow(_('Age less than'), array($statusChangeCheckBox, $statusChangeDays, SPACE, $daysSpan)); $filterForm->addRow(_('Show details'), new CCheckBox('show_details', $_REQUEST['show_details'], null, 1)); $filterForm->addRow(_('Filter by name'), new CTextBox('txt_select', $_REQUEST['txt_select'], 40)); $filterForm->addRow(_('Show hosts in maintenance'), new CCheckBox('show_maintenance', $_REQUEST['show_maintenance'], null, 1)); $filterForm->addItemToBottomRow(new CSubmit('filter_set', _('Filter'), 'chkbxRange.clearSelectedOnFilterChange();'));
$iconsComboBox->addItems($this->data['iconList']); $iconsComboBox->setAttribute('disabled', 'disabled'); $iconPreviewImage = new CImg('imgstore.php?iconid=' . $firstIconId . '&width=' . ZBX_ICON_PREVIEW_WIDTH . '&height=' . ZBX_ICON_PREVIEW_HEIGHT, _('Preview'), null, null, 'pointer preview'); $iconPreviewImage->setAttribute('data-image-full', 'imgstore.php?iconid=' . $firstIconId); // row template $hiddenRowTemplate = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), $numSpan, $profileLinksComboBox, $expressionTextBox, $iconsComboBox, $iconPreviewImage, new CButton('remove', _('Remove'), '', 'link_menu removeMapping')), 'hidden'); $hiddenRowTemplate->setAttribute('id', 'rowTpl'); $iconMapTable->addRow($hiddenRowTemplate); // add row button $iconMapTable->addRow(new CCol(new CButton('addMapping', _('Add'), '', 'link_menu'), null, 7)); // <default icon row> $numSpan = new CSpan($i++ . ':'); $numSpan->addClass('rowNum'); $iconsComboBox = new CComboBox('iconmap[default_iconid]', $this->data['iconmap']['default_iconid']); $iconsComboBox->addClass('mappingIcon'); $iconsComboBox->addItems($this->data['iconList']); $iconPreviewImage = new CImg('imgstore.php?iconid=' . $this->data['iconmap']['default_iconid'] . '&width=' . ZBX_ICON_PREVIEW_WIDTH . '&height=' . ZBX_ICON_PREVIEW_HEIGHT, _('Preview'), null, null, 'pointer preview'); $iconPreviewImage->setAttribute('data-image-full', 'imgstore.php?iconid=' . $this->data['iconmap']['default_iconid']); $iconMapTable->addRow(array(new CCol(_('Default'), null, 4), $iconsComboBox, $iconPreviewImage)); // </default icon row> $iconMapTab->addRow(_('Mappings'), new CDiv($iconMapTable, 'objectgroup inlineblock border_dotted ui-corner-all')); $iconMapView = new CTabView(); $iconMapView->addTab('iconmap', _('Icon map'), $iconMapTab); $iconMapForm->addItem($iconMapView); // footer $secondaryActions = array(new CButtonCancel()); if (isset($this->data['iconmapid'])) { array_unshift($secondaryActions, new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete icon map?'), url_param('form') . url_param('iconmapid'))); } $iconMapForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), $secondaryActions)); return $iconMapForm;
$frmTRLog->addVar('expressions[' . $id . '][view]', $expr['view']); $maxid = $maxid < $id ? $id : $maxid; } zbx_add_post_js('logexpr_count=' . ($maxid + 1)); $maxid = 0; foreach ($keys as $id => $val) { $del_url = new CLink(_('Delete'), '#', 'action', 'javascript: if(confirm("' . _('Delete keyword?') . '")) remove_keyword("keytr' . $id . '"); return false;'); $row = new CRow(array(htmlspecialchars($val['value']), $val['type'], $del_url)); $row->setAttribute('id', 'keytr' . $id); $keyTable->addRow($row); $frmTRLog->addVar('keys[' . $id . '][value]', $val['value']); $frmTRLog->addVar('keys[' . $id . '][type]', $val['type']); $maxid = $maxid < $id ? $id : $maxid; } zbx_add_post_js('key_count=' . ($maxid + 1)); $frmTRLog->addRow(SPACE, $keyTable); $frmTRLog->addRow(SPACE, $table); $sev_select = new CComboBox('priority', $priority); $sev_select->addItems(getSeverityCaption()); $frmTRLog->addRow(_('Severity'), $sev_select); $frmTRLog->addRow(_('Comments'), new CTextArea('comments', $comments)); $frmTRLog->addRow(_('URL'), new CTextBox('url', $url, 80)); $frmTRLog->addRow(_('Disabled'), new CCheckBox('status', $status == TRIGGER_STATUS_DISABLED ? 'yes' : 'no', null, 1)); $frmTRLog->addItemToBottomRow(new CSubmit('save_trigger', _('Save'), 'javascript: document.forms[0].action += \'?saction=1\';')); $frmTRLog->addItemToBottomRow(SPACE); $frmTRLog->addItemToBottomRow(new CButton('cancel', _('Cancel'), 'javascript: self.close();')); if ($bExprResult) { $frmTRLog->show(); } } require_once dirname(__FILE__) . '/include/page_footer.php';
$itemFormList->addRow(array(_('Privacy protocol'), SPACE, new CVisibilityBox('visible[privprotocol]', isset($this->data['visible']['privprotocol']), 'privprotocol_div', _('Original'))), $privProtocol); // append snmpv3 privpassphrase to form list $itemFormList->addRow(array(_('Privacy passphrase'), SPACE, new CVisibilityBox('visible[privpassphras]', isset($this->data['visible']['privpassphras']), 'snmpv3_privpassphrase', _('Original'))), new CTextBox('snmpv3_privpassphrase', $this->data['snmpv3_privpassphrase'], ZBX_TEXTBOX_STANDARD_SIZE)); // append port to form list $itemFormList->addRow(array(_('Port'), SPACE, new CVisibilityBox('visible[port]', isset($this->data['visible']['port']), 'port', _('Original'))), new CTextBox('port', $this->data['port'], ZBX_TEXTBOX_SMALL_SIZE)); // append value type to form list $valueTypeComboBox = new CComboBox('value_type', $this->data['value_type']); $valueTypeComboBox->addItem(ITEM_VALUE_TYPE_UINT64, _('Numeric (unsigned)')); $valueTypeComboBox->addItem(ITEM_VALUE_TYPE_FLOAT, _('Numeric (float)')); $valueTypeComboBox->addItem(ITEM_VALUE_TYPE_STR, _('Character')); $valueTypeComboBox->addItem(ITEM_VALUE_TYPE_LOG, _('Log')); $valueTypeComboBox->addItem(ITEM_VALUE_TYPE_TEXT, _('Text')); $itemFormList->addRow(array(_('Type of information'), SPACE, new CVisibilityBox('visible[value_type]', isset($this->data['visible']['value_type']), 'value_type', _('Original'))), $valueTypeComboBox); // append data type to form list $dataTypeComboBox = new CComboBox('data_type', $this->data['data_type']); $dataTypeComboBox->addItems(item_data_type2str()); $itemFormList->addRow(array(_('Data type'), SPACE, new CVisibilityBox('visible[data_type]', isset($this->data['visible']['data_type']), 'data_type', _('Original'))), $dataTypeComboBox); // append units to form list $itemFormList->addRow(array(_('Units'), SPACE, new CVisibilityBox('visible[units]', isset($this->data['visible']['units']), 'units', _('Original'))), new CTextBox('units', $this->data['units'], ZBX_TEXTBOX_STANDARD_SIZE)); // append authtype to form list $authTypeComboBox = new CComboBox('authtype', $this->data['authtype']); $authTypeComboBox->addItem(ITEM_AUTHTYPE_PASSWORD, _('Password')); $authTypeComboBox->addItem(ITEM_AUTHTYPE_PUBLICKEY, _('Public key')); $itemFormList->addRow(array(_('Authentication method'), SPACE, new CVisibilityBox('visible[authtype]', isset($this->data['visible']['authtype']), 'authtype', _('Original'))), $authTypeComboBox); // append username to form list $itemFormList->addRow(array(_('User name'), SPACE, new CVisibilityBox('visible[username]', isset($this->data['visible']['username']), 'username', _('Original'))), new CTextBox('username', $this->data['username'], ZBX_TEXTBOX_STANDARD_SIZE)); // append publickey to form list $itemFormList->addRow(array(_('Public key file'), SPACE, new CVisibilityBox('visible[publickey]', isset($this->data['visible']['publickey']), 'publickey', _('Original'))), new CTextBox('publickey', $this->data['publickey'], ZBX_TEXTBOX_STANDARD_SIZE)); // append privatekey to form list $itemFormList->addRow(array(_('Private key file'), SPACE, new CVisibilityBox('visible[privatekey]', isset($this->data['visible']['privatekey']), 'privatekey', _('Original'))), new CTextBox('privatekey', $this->data['privatekey'], ZBX_TEXTBOX_STANDARD_SIZE)); // append password
} // create form list $itemFormList = new CFormList('itemFormList'); if (!empty($this->data['templates'])) { $itemFormList->addRow(_('Parent discovery rules'), $this->data['templates']); } $nameTextBox = new CTextBox('name', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE, $this->data['limited']); $nameTextBox->attr('autofocus', 'autofocus'); $itemFormList->addRow(_('Name'), $nameTextBox); // append type to form list if ($this->data['limited']) { $itemForm->addVar('type', $this->data['type']); $itemFormList->addRow(_('Type'), new CTextBox('typename', item_type2str($this->data['type']), ZBX_TEXTBOX_STANDARD_SIZE, true)); } else { $typeComboBox = new CComboBox('type', $this->data['type']); $typeComboBox->addItems($this->data['types']); $itemFormList->addRow(_('Type'), $typeComboBox); } // append key to form list $itemFormList->addRow(_('Key'), array(new CTextBox('key', $this->data['key'], ZBX_TEXTBOX_STANDARD_SIZE, $this->data['limited']))); // append interfaces to form list if (!empty($this->data['interfaces'])) { $interfacesComboBox = new CComboBox('interfaceid', $this->data['interfaceid']); // set up interface groups $interfaceGroups = array(); foreach (zbx_objectValues($this->data['interfaces'], 'type') as $interfaceType) { $interfaceGroups[$interfaceType] = new COptGroup(interfaceType2str($interfaceType)); } // add interfaces to groups foreach ($this->data['interfaces'] as $interface) { $option = new CComboItem($interface['interfaceid'], $interface['useip'] ? $interface['ip'] . ' : ' . $interface['port'] : $interface['dns'] . ' : ' . $interface['port'], $interface['interfaceid'] == $this->data['interfaceid'] ? 'yes' : 'no');
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 CFilter('web.items.filter.state'))->addVar('subfilter_hosts', $subfilter_hosts)->addVar('subfilter_apps', $subfilter_apps)->addVar('subfilter_types', $subfilter_types)->addVar('subfilter_value_types', $subfilter_value_types)->addVar('subfilter_status', $subfilter_status)->addVar('subfilter_state', $subfilter_state)->addVar('subfilter_templated_items', $subfilter_templated_items)->addVar('subfilter_with_triggers', $subfilter_with_triggers)->addVar('subfilter_history', $subfilter_history)->addVar('subfilter_trends', $subfilter_trends)->addVar('subfilter_interval', $subfilter_interval); $filterColumn1 = new CFormList(); $filterColumn2 = new CFormList(); $filterColumn3 = new CFormList(); $filterColumn4 = new CFormList(); // type select $fTypeVisibility = []; $cmbType = new CComboBox('filter_type', $filter_type, null, [-1 => _('all')]); zbx_subarray_push($fTypeVisibility, -1, 'filter_delay_row'); $item_types = item_type2str(); unset($item_types[ITEM_TYPE_HTTPTEST]); // httptest items are only for internal zabbix logic $cmbType->addItems($item_types); foreach ($item_types as $type => $name) { if ($type != ITEM_TYPE_TRAPPER && $type != ITEM_TYPE_SNMPTRAP) { zbx_subarray_push($fTypeVisibility, $type, 'filter_delay_row'); } switch ($type) { case ITEM_TYPE_SNMPV1: case ITEM_TYPE_SNMPV2C: zbx_subarray_push($fTypeVisibility, $type, 'filter_snmp_community_row'); zbx_subarray_push($fTypeVisibility, $type, 'filter_snmp_oid_row'); zbx_subarray_push($fTypeVisibility, $type, 'filter_port_row'); break; case ITEM_TYPE_SNMPV3: zbx_subarray_push($fTypeVisibility, $type, 'filter_snmpv3_securityname_row'); zbx_subarray_push($fTypeVisibility, $type, 'filter_snmp_oid_row'); zbx_subarray_push($fTypeVisibility, $type, 'filter_port_row'); break; } } zbx_add_post_js("var filterTypeSwitcher = new CViewSwitcher('filter_type', 'change', " . zbx_jsvalue($fTypeVisibility, true) . ');'); // type of information select $fVTypeVisibility = []; zbx_subarray_push($fVTypeVisibility, ITEM_VALUE_TYPE_UINT64, 'filter_data_type_row'); zbx_add_post_js("var filterValueTypeSwitcher = new CViewSwitcher('filter_value_type', 'change', " . zbx_jsvalue($fVTypeVisibility, true) . ');'); // row 1 $groupFilter = null; if (!empty($filter_groupId)) { $getHostInfo = API::HostGroup()->get(['groupids' => $filter_groupId, 'output' => ['name']]); $getHostInfo = reset($getHostInfo); if (!empty($getHostInfo)) { $groupFilter[] = ['id' => $getHostInfo['groupid'], 'name' => $getHostInfo['name']]; } } $filterColumn1->addRow(_('Host group'), (new CMultiSelect(['name' => 'filter_groupid', 'selectedLimit' => 1, 'objectName' => 'hostGroup', 'objectOptions' => ['editable' => true], 'data' => $groupFilter, 'popup' => ['parameters' => 'srctbl=host_groups&dstfrm=' . $form->getName() . '&dstfld1=filter_groupid' . '&srcfld1=groupid&writeonly=1']]))->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH)); $filterColumn2->addRow(_('Type'), $cmbType); $filterColumn3->addRow(_('Type of information'), new CComboBox('filter_value_type', $filter_value_type, null, [-1 => _('all'), ITEM_VALUE_TYPE_UINT64 => _('Numeric (unsigned)'), ITEM_VALUE_TYPE_FLOAT => _('Numeric (float)'), ITEM_VALUE_TYPE_STR => _('Character'), ITEM_VALUE_TYPE_LOG => _('Log'), ITEM_VALUE_TYPE_TEXT => _('Text')])); $filterColumn4->addRow(_('State'), new CComboBox('filter_state', $filter_state, null, [-1 => _('all'), ITEM_STATE_NORMAL => itemState(ITEM_STATE_NORMAL), ITEM_STATE_NOTSUPPORTED => itemState(ITEM_STATE_NOTSUPPORTED)])); // row 2 $hostFilterData = null; if (!empty($filter_hostId)) { $getHostInfo = API::Host()->get(['hostids' => $filter_hostId, 'templated_hosts' => true, 'output' => ['name']]); $getHostInfo = reset($getHostInfo); if (!empty($getHostInfo)) { $hostFilterData[] = ['id' => $getHostInfo['hostid'], 'name' => $getHostInfo['name']]; } } $filterColumn1->addRow(_('Host'), (new CMultiSelect(['name' => 'filter_hostid', 'selectedLimit' => 1, 'objectName' => 'hosts', 'objectOptions' => ['editable' => true, 'templated_hosts' => true], 'data' => $hostFilterData, 'popup' => ['parameters' => 'srctbl=host_templates&dstfrm=' . $form->getName() . '&dstfld1=filter_hostid' . '&srcfld1=hostid&writeonly=1']]))->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH)); $filterColumn2->addRow(_('Update interval (in sec)'), (new CNumericBox('filter_delay', $filter_delay, 5, false, true))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH), 'filter_delay_row'); $filterColumn3->addRow(_('Data type'), (new CComboBox('filter_data_type', $filter_data_type))->addItem(-1, _('all'))->addItems(item_data_type2str()), 'filter_data_type_row'); $filterColumn4->addRow(_('Status'), new CComboBox('filter_status', $filter_status, null, [-1 => _('all'), ITEM_STATUS_ACTIVE => item_status2str(ITEM_STATUS_ACTIVE), ITEM_STATUS_DISABLED => item_status2str(ITEM_STATUS_DISABLED)])); // row 3 $filterColumn1->addRow(_('Application'), [(new CTextBox('filter_application', $filter_application))->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH), (new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN), (new CButton(null, _('Select')))->addClass(ZBX_STYLE_BTN_GREY)->onClick('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() : "")' . ', 0, 0, "application");')]); $filterColumn2->addRow(_('SNMP community'), (new CTextBox('filter_snmp_community', $filter_snmp_community))->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH), 'filter_snmp_community_row'); $filterColumn2->addRow(_('Security name'), (new CTextBox('filter_snmpv3_securityname', $filter_snmpv3_securityname))->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH), 'filter_snmpv3_securityname_row'); $filterColumn3->addRow(_('History (in days)'), (new CNumericBox('filter_history', $filter_history, 8, false, true))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)); $filterColumn4->addRow(_('Triggers'), new CComboBox('filter_with_triggers', $filter_with_triggers, null, [-1 => _('all'), 1 => _('With triggers'), 0 => _('Without triggers')])); // row 4 $filterColumn1->addRow(_('Name like'), (new CTextBox('filter_name', $filter_name))->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH)); $filterColumn2->addRow(_('SNMP OID'), (new CTextBox('filter_snmp_oid', $filter_snmp_oid))->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH), 'filter_snmp_oid_row'); $filterColumn3->addRow(_('Trends (in days)'), (new CNumericBox('filter_trends', $filter_trends, 8, false, true))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)); $filterColumn4->addRow(_('Template'), new CComboBox('filter_templated_items', $filter_templated_items, null, [-1 => _('all'), 1 => _('Templated items'), 0 => _('Not Templated items')])); // row 5 $filterColumn1->addRow(_('Key like'), (new CTextBox('filter_key', $filter_key))->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH)); $filterColumn2->addRow(_('Port'), (new CNumericBox('filter_port', $filter_port, 5, false, true))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH), 'filter_port_row'); $form->addColumn($filterColumn1); $form->addColumn($filterColumn2); $form->addColumn($filterColumn3); $form->addColumn($filterColumn4); // subfilters $table_subfilter = (new CTableInfo())->addRow([new CTag('h4', true, [_('Subfilter'), SPACE, (new CSpan(_('affects only filtered data')))->addClass(ZBX_STYLE_GREY)])]); // array contains subfilters and number of items in each $item_params = ['hosts' => [], 'applications' => [], 'types' => [], 'value_types' => [], 'status' => [], 'state' => [], 'templated_items' => [], 'with_triggers' => [], 'history' => [], 'trends' => [], 'interval' => []]; // 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']] = ['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']] = ['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']] = ['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']] = ['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']] = ['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']] = ['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] = ['name' => _('Not Templated items'), 'count' => 0]; } elseif ($item['templateid'] > 0 && !isset($item_params['templated_items'][1])) { $item_params['templated_items'][1] = ['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] = ['name' => _('Without triggers'), 'count' => 0]; } elseif (count($item['triggers']) > 0 && !isset($item_params['with_triggers'][1])) { $item_params['with_triggers'][1] = ['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['trends'] !== '') { $item_params['trends'][$item['trends']] = ['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['trends'] !== '') { $item_params['trends'][$item['trends']]['count']++; } } // history if (zbx_empty($filter_history)) { if (!isset($item_params['history'][$item['history']])) { $item_params['history'][$item['history']] = ['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['delay'] !== '') { $item_params['interval'][$item['delay']] = ['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['delay'] !== '') { $item_params['interval'][$item['delay']]['count']++; } } } // output if (zbx_empty($filter_hostId) && count($item_params['hosts']) > 1) { $hosts_output = prepareSubfilterOutput(_('Hosts'), $item_params['hosts'], $subfilter_hosts, 'subfilter_hosts'); $table_subfilter->addRow($hosts_output); } if (!empty($item_params['applications']) && count($item_params['applications']) > 1) { $application_output = prepareSubfilterOutput(_('Applications'), $item_params['applications'], $subfilter_apps, 'subfilter_apps'); $table_subfilter->addRow([$application_output]); } if ($filter_type == -1 && count($item_params['types']) > 1) { $type_output = prepareSubfilterOutput(_('Types'), $item_params['types'], $subfilter_types, 'subfilter_types'); $table_subfilter->addRow([$type_output]); } if ($filter_value_type == -1 && count($item_params['value_types']) > 1) { $value_types_output = prepareSubfilterOutput(_('Type of information'), $item_params['value_types'], $subfilter_value_types, 'subfilter_value_types'); $table_subfilter->addRow([$value_types_output]); } if ($filter_status == -1 && count($item_params['status']) > 1) { $status_output = prepareSubfilterOutput(_('Status'), $item_params['status'], $subfilter_status, 'subfilter_status'); $table_subfilter->addRow([$status_output]); } if ($filter_state == -1 && count($item_params['state']) > 1) { $state_output = prepareSubfilterOutput(_('State'), $item_params['state'], $subfilter_state, 'subfilter_state'); $table_subfilter->addRow([$state_output]); } if ($filter_templated_items == -1 && count($item_params['templated_items']) > 1) { $templated_items_output = prepareSubfilterOutput(_('Template'), $item_params['templated_items'], $subfilter_templated_items, 'subfilter_templated_items'); $table_subfilter->addRow([$templated_items_output]); } if ($filter_with_triggers == -1 && count($item_params['with_triggers']) > 1) { $with_triggers_output = prepareSubfilterOutput(_('With triggers'), $item_params['with_triggers'], $subfilter_with_triggers, 'subfilter_with_triggers'); $table_subfilter->addRow([$with_triggers_output]); } if (zbx_empty($filter_history) && count($item_params['history']) > 1) { $history_output = prepareSubfilterOutput(_('History'), $item_params['history'], $subfilter_history, 'subfilter_history'); $table_subfilter->addRow([$history_output]); } if (zbx_empty($filter_trends) && count($item_params['trends']) > 1) { $trends_output = prepareSubfilterOutput(_('Trends'), $item_params['trends'], $subfilter_trends, 'subfilter_trends'); $table_subfilter->addRow([$trends_output]); } if (zbx_empty($filter_delay) && $filter_type != ITEM_TYPE_TRAPPER && count($item_params['interval']) > 1) { $interval_output = prepareSubfilterOutput(_('Interval'), $item_params['interval'], $subfilter_interval, 'subfilter_interval'); $table_subfilter->addRow([$interval_output]); } $form->setFooter($table_subfilter); return $form; }
if (!$this->data['templated']) { $nameTextBox->attr('autofocus', 'autofocus'); } $httpFormList->addRow(_('Name'), $nameTextBox); // Application if ($this->data['application_list']) { $applications = zbx_array_merge(array(''), $this->data['application_list']); $httpFormList->addRow(_('Application'), new CComboBox('applicationid', $this->data['applicationid'], null, $applications)); } else { $httpFormList->addRow(_('Application'), new CSpan(_('No applications found.'))); } // New application $httpFormList->addRow(_('New application'), new CTextBox('new_application', $this->data['new_application'], ZBX_TEXTBOX_STANDARD_SIZE), false, null, 'new'); // Authentication $authenticationComboBox = new CComboBox('authentication', $this->data['authentication'], 'submit();'); $authenticationComboBox->addItems(httptest_authentications()); $httpFormList->addRow(_('Authentication'), $authenticationComboBox); if (in_array($this->data['authentication'], array(HTTPTEST_AUTH_BASIC, HTTPTEST_AUTH_NTLM))) { $httpFormList->addRow(_('User'), new CTextBox('http_user', $this->data['http_user'], ZBX_TEXTBOX_STANDARD_SIZE, 'no', 64)); $httpFormList->addRow(_('Password'), new CTextBox('http_password', $this->data['http_password'], ZBX_TEXTBOX_STANDARD_SIZE, 'no', 64)); } // update interval $httpFormList->addRow(_('Update interval (in sec)'), new CNumericBox('delay', $this->data['delay'], 5)); // number of retries $httpFormList->addRow(_('Retries'), new CNumericBox('retries', $this->data['retries'], 2)); // append http agents to form list - http://www.useragentstring.com $agentComboBox = new CEditableComboBox('agent', $this->data['agent'], ZBX_TEXTBOX_STANDARD_SIZE); $agentComboBox->addItemsInGroup(_('Internet Explorer'), array('Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)' => 'Internet Explorer 10.0', 'Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)' => 'Internet Explorer 9.0', 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 1.0.3705; .NET CLR 1.1.4322)' => 'Internet Explorer 8.0', 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)' => 'Internet Explorer 7.0', 'Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1)' => 'Internet Explorer 6.0')); $agentComboBox->addItemsInGroup(_('Mozilla Firefox'), array('Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20100101 Firefox/8.0' => 'Mozilla Firefox 8.0', 'Mozilla/5.0 (X11; Linux i686; rv:7.0) Gecko/20100101 Firefox/7.0' => 'Mozilla Firefox 7.0', 'Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20100101 Firefox/6.0' => 'Mozilla Firefox 6.0', 'Mozilla/5.0 (X11; U; Linux i586; de; rv:5.0) Gecko/20100101 Firefox/5.0' => 'Mozilla Firefox 5.0', 'Mozilla/5.0 (X11; U; Linux x86_64; pl-PL; rv:2.0) Gecko/20110307 Firefox/4.0' => 'Mozilla Firefox 4.0', 'Mozilla/6.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:2.0.0.0) Gecko/20061028 Firefox/3.0' => 'Mozilla Firefox 3.0', 'Mozilla/5.0 (X11;U;Linux i686;en-US;rv:1.8.1) Gecko/2006101022 Firefox/2.0' => 'Mozilla Firefox 2.0')); $agentComboBox->addItemsInGroup(_('Opera'), array('Opera/9.80 (Windows NT 6.1; U; es-ES) Presto/2.9.181 Version/12.00' => 'Opera 12.00', 'Opera/9.80 (X11; Linux x86_64; U; pl) Presto/2.7.62 Version/11.00' => 'Opera 11.00', 'Opera/9.80 (X11; Linux x86_64; U; en) Presto/2.2.15 Version/10.00' => 'Opera 10.00', 'Opera/9.00 (X11; Linux i686; U; pl)' => 'Opera 9.00')); $agentComboBox->addItemsInGroup(_('Safari'), array('Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/531.2+' => 'Safari 5.0', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; ru-RU) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16' => 'Safari 4.0', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; sv-SE) AppleWebKit/523.13 (KHTML, like Gecko) Version/3.0 Safari/523.13' => 'Safari 3.0', 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_1 like Mac OS X; fr-fr) AppleWebKit/525.18.1 (KHTML, like Gecko) Mobile/5F136' => 'Safari on iPhone'));
$row = new CRow([htmlspecialchars($val['value']), $val['type'], (new CCol((new CButton(null, _('Remove')))->addClass(ZBX_STYLE_BTN_LINK)->onClick('javascript: remove_keyword("keytr' . $id . '");')))->addClass(ZBX_STYLE_NOWRAP)]); $row->setId('keytr' . $id); $keyTable->addRow($row); $form->addVar('keys[' . $id . '][value]', $val['value']); $form->addVar('keys[' . $id . '][type]', $val['type']); $maxId = max($maxId, $id); } zbx_add_post_js('key_count=' . ($maxId + 1) . ';'); $form_list->addRow(null, (new CDiv($keyTable))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('style', 'min-width: ' . ZBX_TEXTAREA_BIG_WIDTH . 'px;')); $form_list->addRow(null, (new CDiv($table))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('style', 'min-width: ' . ZBX_TEXTAREA_BIG_WIDTH . 'px;')); $sev_select = new CComboBox('priority', $priority); $config = select_config(); $severityNames = []; for ($severity = TRIGGER_SEVERITY_NOT_CLASSIFIED; $severity < TRIGGER_SEVERITY_COUNT; $severity++) { $severityNames[] = getSeverityName($severity, $config); } $sev_select->addItems($severityNames); $form_list->addRow(_('Severity'), $sev_select); $form_list->addRow(_('Comments'), (new CTextArea('comments', $comments))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)); $form_list->addRow(_('URL'), (new CTextBox('url', $url))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)); $form_list->addRow(_('Disabled'), (new CCheckBox('status'))->setChecked($status == TRIGGER_STATUS_DISABLED)); $tab = (new CTabView())->addTab('trigger_tab', null, $form_list); if (hasRequest('triggerid')) { $tab->setFooter(makeFormFooter(new CSubmit('update', _('Update')), [(new CButton('cancel', _('Cancel')))->onClick('javascript: self.close();')])); } else { $tab->setFooter(makeFormFooter(new CSubmit('add', _('Add')), [(new CButton('cancel', _('Cancel')))->onClick('javascript: self.close();')])); } $form->addItem($tab); $widget->addItem($form)->show(); } require_once dirname(__FILE__) . '/include/page_footer.php';
// create filter $filterForm = new CForm('get'); $filterForm->setAttribute('name', 'zbx_filter'); $filterForm->setAttribute('id', 'zbx_filter'); $filterTable = new CTable('', 'filter'); $actionComboBox = new CComboBox('action', $this->data['action']); $actionComboBox->addItem(-1, _('All')); $actionComboBox->addItem(AUDIT_ACTION_LOGIN, _('Login')); $actionComboBox->addItem(AUDIT_ACTION_LOGOUT, _('Logout')); $actionComboBox->addItem(AUDIT_ACTION_ADD, _('Add')); $actionComboBox->addItem(AUDIT_ACTION_UPDATE, _('Update')); $actionComboBox->addItem(AUDIT_ACTION_DELETE, _('Delete')); $actionComboBox->addItem(AUDIT_ACTION_ENABLE, _('Enable')); $actionComboBox->addItem(AUDIT_ACTION_DISABLE, _('Disable')); $resourceComboBox = new CComboBox('resourcetype', $this->data['resourcetype']); $resourceComboBox->addItems(array(-1 => _('All')) + audit_resource2str()); $filterTable->addRow(array(array(bold(_('User')), SPACE, new CTextBox('alias', $this->data['alias'], 20), new CButton('btn1', _('Select'), 'return PopUp("popup.php?dstfrm=' . $filterForm->getName() . '&dstfld1=alias&srctbl=users&srcfld1=alias&real_hosts=1");', 'filter-select-button')), array(bold(_('Action')), SPACE, $actionComboBox), array(bold(_('Resource')), SPACE, $resourceComboBox))); $filterButton = new CButton('filter', _('Filter'), "javascript: create_var('zbx_filter', 'filter_set', '1', true);"); $filterButton->useJQueryStyle('main'); $resetButton = new CButton('filter_rst', _('Reset'), 'javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst", 1); location.href = uri.getUrl();'); $resetButton->useJQueryStyle(); $buttonsDiv = new CDiv(array($filterButton, SPACE, $resetButton)); $buttonsDiv->setAttribute('style', 'padding: 4px 0;'); $filterTable->addRow(new CCol($buttonsDiv, 'controls', 3)); $filterForm->addItem($filterTable); $auditWidget->addFlicker($filterForm, CProfile::get('web.auditlogs.filter.state', 1)); $auditWidget->addFlicker(new CDiv(null, null, 'scrollbar_cntr'), CProfile::get('web.auditlogs.filter.state', 1)); // create form $auditForm = new CForm('get'); $auditForm->setName('auditForm'); // create table
$el_rmv = new CIcon(_('Remove element'), 'iconminus'); $el_rmv->setAttribute('id', 'selementRemove'); // connectors $cn_add = new CIcon(_('Add link'), 'iconplus'); $cn_add->setAttribute('id', 'linkAdd'); $cn_rmv = new CIcon(_('Remove link'), 'iconminus'); $cn_rmv->setAttribute('id', 'linkRemove'); $expandMacros = new CSpan($sysmap['expand_macros'] == SYSMAP_EXPAND_MACROS_ON ? _('On') : _('Off'), 'whitelink'); $expandMacros->setAttribute('id', 'expand_macros'); $gridShow = new CSpan($sysmap['grid_show'] == SYSMAP_GRID_SHOW_ON ? _('Shown') : _('Hidden'), 'whitelink'); $gridShow->setAttribute('id', 'gridshow'); $gridAutoAlign = new CSpan($sysmap['grid_align'] == SYSMAP_GRID_ALIGN_ON ? _('On') : _('Off'), 'whitelink'); $gridAutoAlign->setAttribute('id', 'gridautoalign'); $possibleGridSizes = array(20 => '20x20', 40 => '40x40', 50 => '50x50', 75 => '75x75', 100 => '100x100'); $gridSize = new CComboBox('gridsize', $sysmap['grid_size']); $gridSize->addItems($possibleGridSizes); $gridAlignAll = new CSubmit('gridalignall', _('Align icons')); $gridAlignAll->setAttribute('id', 'gridalignall'); $gridForm = new CDiv(array($gridSize, $gridAlignAll)); $gridForm->setAttribute('id', 'gridalignblock'); $saveButton = new CSubmit('save', _('Save')); $saveButton->setAttribute('id', 'sysmap_save'); $menuRow = array(_s('Map "%s"', $sysmap['name']), SPACE . SPACE, _('Icon'), SPACE, $el_add, SPACE, $el_rmv, SPACE . SPACE, _('Link'), SPACE, $cn_add, SPACE, $cn_rmv, SPACE . SPACE, _('Expand macros') . ' [ ', $expandMacros, ' ]', SPACE . SPACE, _('Grid') . SPACE . '[', $gridShow, '|', $gridAutoAlign, ']', SPACE, $gridForm, SPACE . '|' . SPACE, $saveButton); $elcn_tab = new CTable(null, 'textwhite'); $elcn_tab->addRow($menuRow); show_table_header($elcn_tab); $sysmap_img = new CImg('images/general/tree/zero.gif', 'Sysmap'); $sysmap_img->setAttribute('id', 'sysmap_img', $sysmap['width'], $sysmap['height']); $table = new CTable(); $table->addRow($sysmap_img); $table->Show();
// append host in maintenance checkbox to form list $maintenanceCheckBox = new CCheckBox('maintenance', $this->data['maintenance'], null, '1'); if (!$this->data['isFilterEnable']) { $maintenanceCheckBox->setAttribute('disabled', 'disabled'); } $dashconfFormList->addRow(_('Hosts'), array($maintenanceCheckBox, _('Show hosts in maintenance'))); // append trigger severities to form list $severities = array(); foreach ($this->data['severities'] as $severity) { $serverityCheckBox = new CCheckBox('trgSeverity[' . $severity . ']', isset($this->data['severity'][$severity]), '', 1); $serverityCheckBox->setEnabled($this->data['isFilterEnable']); $severities[] = array($serverityCheckBox, getSeverityCaption($severity)); $severities[] = BR(); } array_pop($severities); $dashconfFormList->addRow(_('Triggers with severity'), $severities); // append problem display to form list $extAckComboBox = new CComboBox('extAck', $this->data['extAck']); $extAckComboBox->addItems(array(EXTACK_OPTION_ALL => _('All'), EXTACK_OPTION_BOTH => _('Separated'), EXTACK_OPTION_UNACK => _('Unacknowledged only'))); $extAckComboBox->setEnabled($this->data['isFilterEnable'] && $this->data['config']['event_ack_enable']); if (!$this->data['config']['event_ack_enable']) { $extAckComboBox->setAttribute('title', _('Event acknowledging disabled')); } $dashconfFormList->addRow(_('Problem display'), $extAckComboBox); // create tab $dashconfTab = new CTabView(); $dashconfTab->addTab('dashconfTab', _('Filter'), $dashconfFormList); $dashconfForm->addItem($dashconfTab); $dashconfForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), new CButtonCancel())); $dashconfWidget->addItem($dashconfForm); return $dashconfWidget;
$urlEtype->addItems(sysmap_element_types()); $removeButton = new CSpan(_('Remove'), 'link_menu'); $removeButton->addAction('onclick', '$("urlEntry_' . $i . '").remove();'); $urlRow = new CRow(array($urlLabel, $urlLink, $urlEtype, $removeButton)); $urlRow->setAttribute('id', 'urlEntry_' . $i); $urlTable->addRow($urlRow); $i++; } // append empty template row to url table $templateUrlLabel = new CTextBox('urls[#{id}][name]', '', 32); $templateUrlLabel->setAttribute('disabled', 'disabled'); $templateUrlLink = new CTextBox('urls[#{id}][url]', '', 32); $templateUrlLink->setAttribute('disabled', 'disabled'); $templateUrlEtype = new CComboBox('urls[#{id}][elementtype]'); $templateUrlEtype->setAttribute('disabled', 'disabled'); $templateUrlEtype->addItems(sysmap_element_types()); $templateRemoveButton = new CSpan(_('Remove'), 'link_menu'); $templateRemoveButton->addAction('onclick', '$("entry_#{id}").remove();'); $templateUrlRow = new CRow(array($templateUrlLabel, $templateUrlLink, $templateUrlEtype, $templateRemoveButton)); $templateUrlRow->addStyle('display: none'); $templateUrlRow->setAttribute('id', 'urlEntryTpl'); $urlTable->addRow($templateUrlRow); // append "add" button to url table $addButton = new CSpan(_('Add'), 'link_menu'); $addButton->addAction('onclick', 'cloneRow("urlEntryTpl", ' . $i . ')'); $addButtonColumn = new CCol($addButton); $addButtonColumn->setColSpan(4); $urlTable->addRow($addButtonColumn); // append url table to form list $sysmapList->addRow(_('URLs'), new CDiv($urlTable, 'objectgroup inlineblock border_dotted ui-corner-all')); // append sysmap to form
$elements = get_request('elements', 25); $valign = get_request('valign', VALIGN_DEFAULT); $halign = get_request('halign', HALIGN_DEFAULT); $style = get_request('style', 0); $url = get_request('url', ''); $dynamic = get_request('dynamic', SCREEN_SIMPLE_ITEM); $sortTriggers = get_request('sort_triggers', SCREEN_SORT_TRIGGERS_DATE_DESC); $application = get_request('application', ''); } // append resource types to form list $resourceTypeComboBox = new CComboBox('resourcetype', $resourceType, 'submit()'); $screenResources = screen_resources(); if ($this->data['screen']['templateid']) { unset($screenResources[SCREEN_RESOURCE_DATA_OVERVIEW], $screenResources[SCREEN_RESOURCE_ACTIONS], $screenResources[SCREEN_RESOURCE_EVENTS], $screenResources[SCREEN_RESOURCE_HOSTS_INFO], $screenResources[SCREEN_RESOURCE_MAP], $screenResources[SCREEN_RESOURCE_SCREEN], $screenResources[SCREEN_RESOURCE_SERVER_INFO], $screenResources[SCREEN_RESOURCE_HOSTGROUP_TRIGGERS], $screenResources[SCREEN_RESOURCE_HOST_TRIGGERS], $screenResources[SCREEN_RESOURCE_SYSTEM_STATUS], $screenResources[SCREEN_RESOURCE_TRIGGERS_INFO], $screenResources[SCREEN_RESOURCE_TRIGGERS_OVERVIEW]); } $resourceTypeComboBox->addItems($screenResources); $screenFormList->addRow(_('Resource'), $resourceTypeComboBox); /* * Screen item: Graph */ if ($resourceType == SCREEN_RESOURCE_GRAPH) { $caption = ''; $id = 0; $graphs = API::Graph()->get(array('graphids' => $resourceId, 'selectHosts' => array('hostid', 'name', 'status'), 'output' => API_OUTPUT_EXTEND)); if (!empty($graphs)) { $id = $resourceId; $graph = reset($graphs); order_result($graph['hosts'], 'name'); $graph['host'] = reset($graph['hosts']); $caption = $graph['host']['name'] . NAME_DELIMITER . $graph['name']; $nodeName = get_node_name_by_elid($graph['host']['hostid']);
$graphForm->addVar('graphid', $this->data['graphid']); } $graphForm->addVar('ymin_itemid', $this->data['ymin_itemid']); $graphForm->addVar('ymax_itemid', $this->data['ymax_itemid']); // create form list $graphFormList = new CFormList('graphFormList'); if (!empty($this->data['templates'])) { $graphFormList->addRow(_('Parent graphs'), $this->data['templates']); } $nameTextBox = new CTextBox('name', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE); $nameTextBox->attr('autofocus', 'autofocus'); $graphFormList->addRow(_('Name'), $nameTextBox); $graphFormList->addRow(_('Width'), new CNumericBox('width', $this->data['width'], 5)); $graphFormList->addRow(_('Height'), new CNumericBox('height', $this->data['height'], 5)); $graphTypeComboBox = new CComboBox('graphtype', $this->data['graphtype'], 'submit()'); $graphTypeComboBox->addItems(graphType()); $graphFormList->addRow(_('Graph type'), $graphTypeComboBox); // append legend to form list $graphFormList->addRow(_('Show legend'), new CCheckBox('show_legend', $this->data['show_legend'], null, 1)); // append graph types to form list if ($this->data['graphtype'] == GRAPH_TYPE_NORMAL || $this->data['graphtype'] == GRAPH_TYPE_STACKED) { $graphFormList->addRow(_('Show working time'), new CCheckBox('show_work_period', $this->data['show_work_period'], null, 1)); $graphFormList->addRow(_('Show triggers'), new CCheckBox('show_triggers', $this->data['show_triggers'], null, 1)); if ($this->data['graphtype'] == GRAPH_TYPE_NORMAL) { // percent left $percentLeftTextBox = new CTextBox('percent_left', $this->data['percent_left'], 6, false, 7); $percentLeftCheckbox = new CCheckBox('visible[percent_left]', 1, 'javascript: showHideVisible("percent_left");', 1); if (isset($this->data['visible']) && isset($this->data['visible']['percent_left'])) { $percentLeftTextBox->attr('style', ''); $percentLeftCheckbox->setChecked(1); } elseif ($this->data['percent_left'] == 0) {
$keepTrend[] = SPACE; $keepTrend[] = new CSpan('(' . _n('%1$s day', '%1$s days', $dataConfig['hk_trends']) . ')'); } else { $keepTrend[] = new CSpan(_('Overriden by global housekeeping settings') . '(' . _n('%1$s day', '%1$s days', $dataConfig['hk_trends']) . ')'); } } $itemFormList->addRow(_('Trend storage period (in days)'), $keepTrend, false, 'row_trends'); $itemFormList->addRow(_('Log time format'), new CTextBox('logtimefmt', $this->data['logtimefmt'], ZBX_TEXTBOX_SMALL_SIZE, $this->data['limited'], 64), false, 'row_logtimefmt'); // append delta to form list $deltaOptions = array(0 => _('As is'), 1 => _('Delta (speed per second)'), 2 => _('Delta (simple change)')); if ($this->data['limited']) { $itemForm->addVar('delta', $this->data['delta']); $deltaComboBox = new CTextBox('delta_name', $deltaOptions[$this->data['delta']], null, 'yes'); } else { $deltaComboBox = new CComboBox('delta', $this->data['delta']); $deltaComboBox->addItems($deltaOptions); } $itemFormList->addRow(_('Store value'), $deltaComboBox, false, 'row_delta'); // append valuemap to form list if ($this->data['limited']) { $itemForm->addVar('valuemapid', $this->data['valuemapid']); $valuemapComboBox = new CTextBox('valuemap_name', !empty($this->data['valuemaps']) ? $this->data['valuemaps'] : _('As is'), ZBX_TEXTBOX_SMALL_SIZE, 'yes'); } else { $valuemapComboBox = new CComboBox('valuemapid', $this->data['valuemapid']); $valuemapComboBox->addItem(0, _('As is')); foreach ($this->data['valuemaps'] as $valuemap) { $valuemapComboBox->addItem($valuemap['valuemapid'], get_node_name_by_elid($valuemap['valuemapid'], null, NAME_DELIMITER) . CHtml::encode($valuemap['name'])); } } $link = new CLink(_('show value mappings'), 'adm.valuemapping.php'); $link->setAttribute('target', '_blank');
$servicesForm->addVar('parentid', $this->data['parentid']); $servicesForm->addVar('parentname', $this->data['parentname']); $servicesForm->addVar('triggerid', $this->data['triggerid']); if (isset($this->data['service'])) { $servicesForm->addVar('serviceid', $this->data['service']['serviceid']); } // create form list $servicesFormList = new CFormList('servicesFormList'); $nameTextBox = new CTextBox('name', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE, false, 128); $nameTextBox->attr('autofocus', 'autofocus'); $servicesFormList->addRow(_('Name'), $nameTextBox); // append parent link to form list $servicesFormList->addRow(_('Parent service'), array(new CTextBox('parent_name', $this->data['parentname'], ZBX_TEXTBOX_STANDARD_SIZE, true, 128), new CButton('select_parent', _('Change'), "javascript: openWinCentered('services.php?pservices=1" . url_param('serviceid') . "', 'ZBX_Services_List', 740, 420, 'scrollbars=1, toolbar=0, menubar=0, resizable=1, dialog=0');", 'formlist'))); // append algorithm to form list $algorithmComboBox = new CComboBox('algorithm', $this->data['algorithm']); $algorithmComboBox->addItems(serviceAlgorythm()); $servicesFormList->addRow(_('Status calculation algorithm'), $algorithmComboBox); // append SLA to form list $showslaCheckbox = new CCheckBox('showsla', $this->data['showsla'] == 0 ? 'no' : 'yes', null, 1); $goodslaTextBox = new CTextBox('goodsla', $this->data['goodsla'], 6, false, 8); if (!$this->data['showsla']) { $goodslaTextBox->setAttribute('disabled', 'disabled'); } $servicesFormList->addRow(_('Calculate SLA, acceptable SLA (in %)'), array($showslaCheckbox, $goodslaTextBox)); // append trigger to form list $servicesFormList->addRow(_('Trigger'), array(new CTextBox('trigger', $this->data['trigger'], ZBX_TEXTBOX_STANDARD_SIZE, true), new CButton('btn1', _('Select'), 'return PopUp("popup.php?' . 'dstfrm=' . $servicesForm->getName() . '&dstfld1=triggerid' . '&dstfld2=trigger' . '&srctbl=triggers' . '&srcfld1=triggerid' . '&srcfld2=description' . '&real_hosts=1' . '&with_triggers=1");', 'formlist'))); $servicesFormList->addRow(_('Sort order (0->999)'), new CTextBox('sortorder', $this->data['sortorder'], 3, false, 3)); /* * Dependencies tab */ $servicesChildTable = new CTable(_('No dependencies defined.'), 'formElementTable');
**/ $mediaTypeWidget = new CWidget(); $mediaTypeWidget->addPageHeader(_('CONFIGURATION OF MEDIA TYPES')); // create form $mediaTypeForm = new CForm(); $mediaTypeForm->setName('mediaTypeForm'); $mediaTypeForm->addVar('form', $this->data['form']); $mediaTypeForm->addVar('mediatypeid', $this->data['mediatypeid']); // create form list $mediaTypeFormList = new CFormList('mediaTypeFormList'); $nameTextBox = new CTextBox('description', $this->data['description'], ZBX_TEXTBOX_STANDARD_SIZE, false, 100); $nameTextBox->attr('autofocus', 'autofocus'); $mediaTypeFormList->addRow(_('Name'), $nameTextBox); // append type to form list $cmbType = new CComboBox('type', $this->data['type'], 'submit()'); $cmbType->addItems(array(MEDIA_TYPE_EMAIL => _('Email'), MEDIA_TYPE_EXEC => _('Script'), MEDIA_TYPE_SMS => _('SMS'), MEDIA_TYPE_JABBER => _('Jabber'))); $cmbType->addItemsInGroup(_('Commercial'), array(MEDIA_TYPE_EZ_TEXTING => _('Ez Texting'))); $cmbTypeRow = array($cmbType); if ($this->data['type'] == MEDIA_TYPE_EZ_TEXTING) { $ez_texting_link = new CLink('https://app.eztexting.com', 'https://app.eztexting.com/', null, null, 'nosid'); $ez_texting_link->setTarget('_blank'); $cmbTypeRow[] = $ez_texting_link; } $mediaTypeFormList->addRow(_('Type'), $cmbTypeRow); // append others fields to form list if ($this->data['type'] == MEDIA_TYPE_EMAIL) { $mediaTypeFormList->addRow(_('SMTP server'), new CTextBox('smtp_server', $this->data['smtp_server'], ZBX_TEXTBOX_STANDARD_SIZE)); $mediaTypeFormList->addRow(_('SMTP helo'), new CTextBox('smtp_helo', $this->data['smtp_helo'], ZBX_TEXTBOX_STANDARD_SIZE)); $mediaTypeFormList->addRow(_('SMTP email'), new CTextBox('smtp_email', $this->data['smtp_email'], ZBX_TEXTBOX_STANDARD_SIZE)); } elseif ($this->data['type'] == MEDIA_TYPE_SMS) { $mediaTypeFormList->addRow(_('GSM modem'), new CTextBox('gsm_modem', $this->data['gsm_modem'], ZBX_TEXTBOX_STANDARD_SIZE));
$templatesTable->setHeader(array(_('Name'), _('Action'))); foreach ($this->data['templates'] as $templateid => $templateName) { $hostForm->addVar('templates[' . $templateid . ']', $templateName); $row = new CRow(array($templateName, new CButton('remove', _('Remove'), 'javascript: removeTemplate("' . $templateid . '");', 'link_menu'))); $row->setAttribute('id', 'template_row_' . $templateid); $templatesTable->addRow($row); } $templatesDiv = new CDiv(array($templatesTable, new CButton('btn1', _('Add'), 'return PopUp("popup.php?srctbl=templates&srcfld1=hostid&srcfld2=host' . '&dstfrm=' . $hostForm->getName() . '&dstfld1=new_template&templated_hosts=1' . url_param($this->data['templates'], false, 'existed_templates') . '", 450, 450)', 'link_menu'), BR(), BR(), new CCheckBox('mass_replace_tpls', $this->data['mass_replace_tpls']), SPACE, _('Replace'), BR(), new CCheckBox('mass_clear_tpls', $this->data['mass_clear_tpls']), SPACE, _('Clear when unlinking')), 'objectgroup inlineblock border_dotted ui-corner-all'); $templatesDiv->setAttribute('id', 'templates_div'); $hostFormList->addRow(array(_('Link templates'), SPACE, new CVisibilityBox('visible[template_table]', !empty($this->data['visible']['template_table']) ? 'yes' : 'no', 'templates_div', _('Original'))), $templatesDiv); // append ipmi to form list $ipmiAuthtypeComboBox = new CComboBox('ipmi_authtype', $this->data['ipmi_authtype']); $ipmiAuthtypeComboBox->addItems(ipmiAuthTypes()); $hostFormList->addRow(array(_('IPMI authentication algorithm'), SPACE, new CVisibilityBox('visible[ipmi_authtype]', isset($this->data['visible']['ipmi_authtype']), 'ipmi_authtype', _('Original'))), $ipmiAuthtypeComboBox); $ipmiPrivilegeComboBox = new CComboBox('ipmi_privilege', $this->data['ipmi_privilege']); $ipmiPrivilegeComboBox->addItems(ipmiPrivileges()); $hostFormList->addRow(array(_('IPMI privilege level'), SPACE, new CVisibilityBox('visible[ipmi_privilege]', isset($this->data['visible']['ipmi_privilege']), 'ipmi_privilege', _('Original'))), $ipmiPrivilegeComboBox); $hostFormList->addRow(array(_('IPMI username'), SPACE, new CVisibilityBox('visible[ipmi_username]', isset($this->data['visible']['ipmi_username']), 'ipmi_username', _('Original'))), new CTextBox('ipmi_username', $this->data['ipmi_username'], ZBX_TEXTBOX_SMALL_SIZE)); $hostFormList->addRow(array(_('IPMI password'), SPACE, new CVisibilityBox('visible[ipmi_password]', isset($this->data['visible']['ipmi_password']), 'ipmi_password', _('Original'))), new CTextBox('ipmi_password', $this->data['ipmi_password'], ZBX_TEXTBOX_SMALL_SIZE)); // append inventories to form list $inventoryModesComboBox = new CComboBox('inventory_mode', $this->data['inventory_mode'], 'submit()'); $inventoryModesComboBox->addItem(HOST_INVENTORY_DISABLED, _('Disabled')); $inventoryModesComboBox->addItem(HOST_INVENTORY_MANUAL, _('Manual')); $inventoryModesComboBox->addItem(HOST_INVENTORY_AUTOMATIC, _('Automatic')); $hostFormList->addRow(array(_('Inventory mode'), SPACE, new CVisibilityBox('visible[inventory_mode]', isset($this->data['visible']['inventory_mode']), 'inventory_mode', _('Original'))), $inventoryModesComboBox); $hostInventoryTable = DB::getSchema('host_inventory'); if ($this->data['inventory_mode'] != HOST_INVENTORY_DISABLED) { foreach ($this->data['inventories'] as $field => $fieldInfo) { if (!isset($this->data['host_inventory'][$field])) { $this->data['host_inventory'][$field] = ''; }
$cb_ack_status = new CComboBox('ack_status', $ack_status); $cb_ack_status->addItem(ZBX_ACK_STS_ANY, S_ANY); $cb_ack_status->additem(ZBX_ACK_STS_WITH_UNACK, S_WITH_UNACKNOWLEDGED_EVENTS); $cb_ack_status->additem(ZBX_ACK_STS_WITH_LAST_UNACK, S_WITH_LAST_EVENT_UNACKNOWLEDGED); $filterForm->addRow(S_ACKNOWLEDGE_STATUS, $cb_ack_status); } $ev_select = new CComboBox('show_events', $_REQUEST['show_events']); $ev_select->addItem(EVENTS_OPTION_NOEVENT, S_HIDE_ALL); $ev_select->addItem(EVENTS_OPTION_ALL, S_SHOW_ALL . SPACE . '(' . $config['event_expire'] . SPACE . ($config['event_expire'] > 1 ? S_DAYS : S_DAY) . ')'); if ($config['event_ack_enable']) { $ev_select->addItem(EVENTS_OPTION_NOT_ACK, S_SHOW_UNACKNOWLEDGED . SPACE . '(' . $config['event_expire'] . SPACE . ($config['event_expire'] > 1 ? S_DAYS : S_DAY) . ')'); } $filterForm->addRow(S_EVENTS, $ev_select); $severity_select = new CComboBox('show_severity', $show_severity); $cb_items = array(-1 => S_ALL_S, TRIGGER_SEVERITY_NOT_CLASSIFIED => S_NOT_CLASSIFIED, TRIGGER_SEVERITY_INFORMATION => S_INFORMATION, TRIGGER_SEVERITY_WARNING => S_WARNING, TRIGGER_SEVERITY_AVERAGE => S_AVERAGE, TRIGGER_SEVERITY_HIGH => S_HIGH, TRIGGER_SEVERITY_DISASTER => S_DISASTER); $severity_select->addItems($cb_items); $filterForm->addRow(S_MIN_SEVERITY, $severity_select); $action = 'javascrip: this.checked ? $("status_change_days").enable() : $("status_change_days").disable()'; $sts_change_days_cb = new CNumericBox('status_change_days', $_REQUEST['status_change_days'], 4); if (!$_REQUEST['status_change']) { $sts_change_days_cb->setAttribute('disabled', 'disabled'); } $sts_change_days_cb->addStyle('vertical-align: middle;'); $cbd = new CCheckBox('status_change', $_REQUEST['status_change'], $action, 1); $cbd->addStyle('vertical-align: middle;'); $spand = new CSpan(S_DAYS_SMALL); $spand->addStyle('vertical-align: middle;'); $filterForm->addRow(S_AGE_LESS_THAN, array($cbd, $sts_change_days_cb, $spand)); $filterForm->addRow(S_SHOW_DETAILS, new CCheckBox('show_details', $_REQUEST['show_details'], null, 1)); $filterForm->addRow(S_FILTER_BY_NAME, new CTextBox('txt_select', $_REQUEST['txt_select'], 40)); $filterForm->addItemToBottomRow(new CButton('filter_set', S_FILTER));
$addIcon = new CIcon(_('Add element'), 'iconplus'); $addIcon->setAttribute('id', 'selementAdd'); $removeIcon = new CIcon(_('Remove element'), 'iconminus'); $removeIcon->setAttribute('id', 'selementRemove'); $addLinkIcon = new CIcon(_('Add link'), 'iconplus'); $addLinkIcon->setAttribute('id', 'linkAdd'); $removeLinkIcon = new CIcon(_('Remove link'), 'iconminus'); $removeLinkIcon->setAttribute('id', 'linkRemove'); $expandMacros = new CSpan($this->data['sysmap']['expand_macros'] == SYSMAP_EXPAND_MACROS_ON ? _('On') : _('Off'), 'whitelink'); $expandMacros->setAttribute('id', 'expand_macros'); $gridShow = new CSpan($this->data['sysmap']['grid_show'] == SYSMAP_GRID_SHOW_ON ? _('Shown') : _('Hidden'), 'whitelink'); $gridShow->setAttribute('id', 'gridshow'); $gridAutoAlign = new CSpan($this->data['sysmap']['grid_align'] == SYSMAP_GRID_ALIGN_ON ? _('On') : _('Off'), 'whitelink'); $gridAutoAlign->setAttribute('id', 'gridautoalign'); $gridSize = new CComboBox('gridsize', $this->data['sysmap']['grid_size']); $gridSize->addItems(array(20 => '20x20', 40 => '40x40', 50 => '50x50', 75 => '75x75', 100 => '100x100')); $gridAlignAll = new CSubmit('gridalignall', _('Align icons')); $gridAlignAll->setAttribute('id', 'gridalignall'); $gridForm = new CDiv(array($gridSize, $gridAlignAll)); $gridForm->setAttribute('id', 'gridalignblock'); $saveButton = new CSubmit('update', _('Update')); $saveButton->setAttribute('id', 'sysmap_update'); $menuTable = new CTable(null, 'textwhite'); $menuTable->addRow(array(_s('Map "%s"', $this->data['sysmap']['name']), SPACE . SPACE, _('Icon'), SPACE, $addIcon, SPACE, $removeIcon, SPACE . SPACE, _('Link'), SPACE, $addLinkIcon, SPACE, $removeLinkIcon, SPACE . SPACE, _('Expand macros') . ' [ ', $expandMacros, ' ]', SPACE . SPACE, _('Grid') . SPACE . '[', $gridShow, '|', $gridAutoAlign, ']', SPACE, $gridForm, SPACE . '|' . SPACE, $saveButton)); $sysmapWidget->addPageHeader($menuTable); // create map $backgroundImage = new CImg('images/general/tree/zero.gif', 'Sysmap'); $backgroundImage->setAttribute('id', 'sysmap_img', $this->data['sysmap']['width'], $this->data['sysmap']['height']); $backgroundImageTable = new CTable(); $backgroundImageTable->addRow($backgroundImage); $sysmapWidget->addItem($backgroundImageTable);
// SPACE added to extend CB width in Chrome $cbMain = new CCheckBox('maintenance', $maintenance, null, '1'); if (!$filterEnable) { $cbMain->setAttribute('disabled', 'disabled'); } $dashForm->addRow(S_HOSTS, array($cbMain, S_SHOW_HOSTS_IN_MAINTENANCE)); // Trigger $severity = zbx_toHash($severity); $trgSeverities = array(); $severities = array(TRIGGER_SEVERITY_NOT_CLASSIFIED, TRIGGER_SEVERITY_INFORMATION, TRIGGER_SEVERITY_WARNING, TRIGGER_SEVERITY_AVERAGE, TRIGGER_SEVERITY_HIGH, TRIGGER_SEVERITY_DISASTER); foreach ($severities as $snum => $sever) { $cb = new CCheckBox('trgSeverity[' . $sever . ']', isset($severity[$sever]), '', 1); $cb->setEnabled($filterEnable); $trgSeverities[] = array($cb, getSeverityCaption($sever)); $trgSeverities[] = BR(); } array_pop($trgSeverities); $dashForm->addRow(S_TRIGGERS_WITH_SEVERITY, $trgSeverities); $config = select_config(); $cb = new CComboBox('extAck', $extAck); $cb->addItems(array(EXTACK_OPTION_ALL => S_O_ALL, EXTACK_OPTION_BOTH => S_O_SEPARATED, EXTACK_OPTION_UNACK => S_O_UNACKNOWLEDGED_ONLY)); $cb->setEnabled($filterEnable && $config['event_ack_enable']); if (!$config['event_ack_enable']) { $cb->setAttribute('title', S_EVENT_ACKNOWLEDGING_DISABLED); } $dashForm->addRow(S_PROBLEM_DISPLAY, $cb); //----- $dashForm->addItemToBottomRow(new CButton('save', S_SAVE)); $dashboard_wdgt->addItem($dashForm); $dashboard_wdgt->show(); include_once 'include/page_footer.php';
} } if ($output != 'block') { /* * Display */ //$displayNodes = (is_show_all_nodes() && $pageFilter->groupid == 0 && $pageFilter->hostid == 0); // $showTriggers = $_REQUEST['show_triggers']; // $showEvents = $_REQUEST['show_events']; // $ackStatus = $_REQUEST['ack_status']; $triggerWidget = new CWidget(); $rightForm = new CForm('get'); $rightForm->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true))); $rightForm->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB(true))); $severityComboBox = new CComboBox('severity_min', $showSeverity, 'javascript: submit();'); $severityComboBox->addItems($pageFilter->severitiesMin); $rightForm->addItem(array(SPACE . _('Minimum trigger severity') . SPACE, $severityComboBox)); textdomain("imap"); $rightForm->addItem(array(SPACE . SPACE . _('With triggers only') . SPACE, new CCheckBox('with_triggers_only', $with_triggers_only, 'javascript: submit();', 1))); textdomain("frontend"); $rightForm->addVar('fullscreen', $_REQUEST['fullscreen']); $triggerWidget->addHeader(SPACE, $rightForm); $triggerWidget->addPageHeader(_('Interactive map'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen']))); $triggerWidget->show(); } $version = trim(file_get_contents('imap/version')); textdomain("imap"); //проверяем наличие таблиц в БД $check_links = true; if (!DBselect('SELECT 1 FROM hosts_links')) { $check_links = false;