public function __construct($name, $value) { parent::__construct(); $lbl = new CColorCell('lbl_' . $name, $value, "show_color_picker('" . $name . "')"); $txt = new CTextBox($name, $value, 7); $txt->setAttribute('maxlength', 6); $txt->setAttribute('id', $name); $txt->addAction('onchange', "set_color_by_name('" . $name . "',this.value)"); $txt->setAttribute('style', 'margin-top: 0px; margin-bottom: 0px'); $this->addItem(array($txt, $lbl)); insert_show_color_picker_javascript(); }
public function __construct($name = 'number', $value = '0', $size = 20, $readonly = 'no', $allowempty = false) { parent::__construct($name, $value, $size, $readonly); $this->addOption('maxlength', $size); $this->addOption('style', 'text-align: right;'); $this->addAction('onkeypress', ' var c = (window.event) ? event.keyCode : event.which;' . ' if(event.ctrlKey || c <= 31 || (c >= 48 && c <= 57)) return true; else return false; '); $this->addAction('onchange', ($allowempty ? ' if(this.value.length==0 || this.value==null) this.value = \'\'; else ' : '') . ' if(isNaN(parseInt(this.value,10))) this.value = 0; ' . ' else this.value = parseInt(this.value,10);'); }
public function __construct($name, $value) { parent::__construct(); $txt = new CTextBox($name, $value); $txt->addStyle('width: 6em;'); $txt->attr('maxlength', 6); $txt->attr('id', zbx_formatDomId($name)); $txt->addAction('onchange', 'set_color_by_name("' . $name . '", this.value)'); $txt->addStyle('style', 'margin-top: 0px; margin-bottom: 0px;'); $lbl = new CColorCell('lbl_' . $name, $value, 'javascript: show_color_picker("' . $name . '")'); $this->addItem(array($txt, $lbl)); insert_show_color_picker_javascript(); }
$host_groups = new CCombobox('groupid', $this->get('groupid')); $host_groups->addItem(0, _('All')); $groups = $this->getArray('groups'); foreach ($groups as $gnum => $group) { $host_groups->addItem($group['groupid'], $group['name']); } $scriptTab->addRow(_('Host groups'), $host_groups); // permissions $select_acc = new CCombobox('access', $this->get('access')); $select_acc->addItem(PERM_READ_ONLY, _('Read')); $select_acc->addItem(PERM_READ_WRITE, _('Write')); $scriptTab->addRow(_('Required host permissions'), $select_acc); // confirmation $enableQuestCB = new CCheckBox('enableConfirmation', $this->get('enableConfirmation')); $scriptTab->addRow(new CLabel(_('Enable confirmation'), 'enableConfirmation'), array($enableQuestCB, SPACE)); $confirmationTB = new CTextBox('confirmation', $this->get('confirmation')); $confirmationTB->addStyle('width: 50em;'); $confirmationTB->setAttribute('maxlength', 255); $testLink = new CButton('testConfirmation', _('Test confirmation'), null, 'link_menu'); $confirmationLabel = new CLabel(_('Confirmation text'), 'confirmation'); $confirmationLabel->setAttribute('id', 'confirmationLabel'); $scriptTab->addRow($confirmationLabel, array($confirmationTB, SPACE, $testLink)); $scriptView = new CTabView(); $scriptView->addTab('scripts', _('Script'), $scriptTab); $frmScr->addItem($scriptView); // footer $main = array(new CSubmit('save', _('Save'))); $others = array(); if (isset($_REQUEST['scriptid'])) { $others[] = new CButton('clone', _('Clone')); $others[] = new CButtonDelete(_('Delete script?'), url_param('form') . url_param('scriptid'));
** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ include 'include/views/js/administration.script.edit.js.php'; $scriptsWidget = new CWidget(); $scriptsWidget->addPageHeader(_('CONFIGURATION OF SCRIPTS')); $scriptForm = new CForm(); $scriptForm->setName('scripts'); $scriptForm->addVar('form', $this->get('form')); $scriptForm->addVar('form_refresh', $this->get('form_refresh') + 1); if ($this->get('scriptid')) { $scriptForm->addVar('scriptid', $this->get('scriptid')); } $scriptFormList = new CFormList('scriptsTab'); // name $nameTextBox = new CTextBox('name', $this->get('name'), ZBX_TEXTBOX_STANDARD_SIZE); $nameTextBox->attr('autofocus', 'autofocus'); $nameTextBox->attr('placeholder', _('<Sub-menu/Sub-menu.../>Script')); $scriptFormList->addRow(_('Name'), $nameTextBox); // type $typeComboBox = new CComboBox('type', $this->get('type')); $typeComboBox->addItem(ZBX_SCRIPT_TYPE_IPMI, _('IPMI')); $typeComboBox->addItem(ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT, _('Script')); $scriptFormList->addRow(_('Type'), $typeComboBox); // execute on $typeRadioButton = new CRadioButtonList('execute_on', $this->get('execute_on')); $typeRadioButton->makeVertical(); $typeRadioButton->addValue(_('Zabbix agent'), ZBX_SCRIPT_EXECUTE_ON_AGENT); $typeRadioButton->addValue(_('Zabbix server'), ZBX_SCRIPT_EXECUTE_ON_SERVER); $scriptFormList->addRow(_('Execute on'), new CDiv($typeRadioButton, 'objectgroup inlineblock border_dotted ui-corner-all'), $this->get('type') == ZBX_SCRIPT_TYPE_IPMI); $scriptFormList->addRow(_('Commands'), new CTextArea('command', $this->get('command')), $this->get('type') == ZBX_SCRIPT_TYPE_IPMI);
function stage3() { $table = new CTable(null, 'requirements'); $table->setAlign('center'); $DB['TYPE'] = $this->getConfig('DB_TYPE'); $cmbType = new CComboBox('type', $DB['TYPE'], 'this.form.submit();'); $frontendSetup = new FrontendSetup(); $databases = $frontendSetup->getSupportedDatabases(); foreach ($databases as $id => $name) { $cmbType->addItem($id, $name); } $table->addRow(array(new CCol(_('Database type'), 'header'), $cmbType)); switch ($DB['TYPE']) { case ZBX_DB_SQLITE3: $database = new CTextBox('database', $this->getConfig('DB_DATABASE', 'zabbix')); $database->attr('onchange', "disableSetupStepButton('#next_2')"); $table->addRow(array(new CCol(_('Database file'), 'header'), $database)); break; default: $server = new CTextBox('server', $this->getConfig('DB_SERVER', 'localhost')); $server->attr('onchange', "disableSetupStepButton('#next_2')"); $table->addRow(array(new CCol(_('Database host'), 'header'), $server)); $port = new CNumericBox('port', $this->getConfig('DB_PORT', '0'), 5, 'no', false, false); $port->attr('style', ''); $port->attr('onchange', "disableSetupStepButton('#next_2'); validateNumericBox(this, 'false', 'false');"); $table->addRow(array(new CCol(_('Database port'), 'header'), array($port, ' 0 - use default port'))); $database = new CTextBox('database', $this->getConfig('DB_DATABASE', 'zabbix')); $database->attr('onchange', "disableSetupStepButton('#next_2')"); $table->addRow(array(new CCol(_('Database name'), 'header'), $database)); if ($DB['TYPE'] == ZBX_DB_DB2) { $schema = new CTextBox('schema', $this->getConfig('DB_SCHEMA', '')); $schema->attr('onchange', "disableSetupStepButton('#next_2')"); $table->addRow(array(new CCol(_('Database schema'), 'header'), $schema)); } $user = new CTextBox('user', $this->getConfig('DB_USER', 'root')); $user->attr('onchange', "disableSetupStepButton('#next_2')"); $table->addRow(array(new CCol(_('User'), 'header'), $user)); $password = new CPassBox('password', $this->getConfig('DB_PASSWORD', '')); $password->attr('onchange', "disableSetupStepButton('#next_2')"); $table->addRow(array(new CCol(_('Password'), 'header'), $password)); break; } global $ZBX_MESSAGES; if (!empty($ZBX_MESSAGES)) { $lst_error = new CList(null, 'messages'); foreach ($ZBX_MESSAGES as $msg) { $lst_error->addItem($msg['message'], $msg['type']); } $table = array($table, $lst_error); } return array(new CDiv(new CDiv(array('Please create database manually, and set the configuration parameters for connection to this database.', BR(), BR(), 'Press "Test connection" button when done.', BR(), $table), 'vertical_center'), 'table_wraper'), new CDiv(array(isset($_REQUEST['retry']) ? !$this->DISABLE_NEXT_BUTTON ? new CSpan(array(_('OK'), BR()), 'ok') : new CSpan(array(_('Fail'), BR()), 'fail') : null, new CSubmit('retry', 'Test connection')), 'info_bar')); }
$rplcts = array(); $allowedTesting = true; $expressionData = new CTriggerExpression(); if ($expressionData->parse($expression)) { $macrosData = array(); $expressions = array_merge($expressionData->expressions, $expressionData->macros, $expressionData->usermacros); foreach ($expressions as $exprPart) { if (isset($macrosData[$exprPart['expression']])) { continue; } $fname = 'test_data_' . md5($exprPart['expression']); $macrosData[$exprPart['expression']] = get_request($fname, ''); $info = get_item_function_info($exprPart['expression']); if (!is_array($info) && isset($definedErrorPhrases[$info])) { $allowedTesting = false; $control = new CTextBox($fname, $macrosData[$exprPart['expression']], 30); $control->setAttribute('disabled', 'disabled'); } else { $octet = $info['value_type'] == 'HHMMSS'; $validation = $info['validation']; if (substr($validation, 0, COMBO_PATTERN_LENGTH) == COMBO_PATTERN) { $vals = explode(',', substr($validation, COMBO_PATTERN_LENGTH, zbx_strlen($validation) - COMBO_PATTERN_LENGTH - 4)); $control = new CComboBox($fname, $macrosData[$exprPart['expression']]); foreach ($vals as $v) { $control->addItem($v, $v); } } else { $control = new CTextBox($fname, $macrosData[$exprPart['expression']], 30); } $fields[$fname] = array($info['type'], O_OPT, null, $validation, 'isset({test_expression})', $exprPart['expression']); }
** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $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) {
$authTypeComboBox->addItem(ITEM_AUTHTYPE_PUBLICKEY, _('Public key')); $newOperationsTable->addRow(array(_('Authentication method'), $authTypeComboBox), 'class_authentication_method hidden'); $newOperationsTable->addRow(array(_('User name'), new CTextBox('new_operation[opcommand][username]', $this->data['new_operation']['opcommand']['username'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_authentication_username hidden indent_both'); $newOperationsTable->addRow(array(_('Public key file'), new CTextBox('new_operation[opcommand][publickey]', $this->data['new_operation']['opcommand']['publickey'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_authentication_publickey hidden indent_both'); $newOperationsTable->addRow(array(_('Private key file'), new CTextBox('new_operation[opcommand][privatekey]', $this->data['new_operation']['opcommand']['privatekey'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_authentication_privatekey hidden indent_both'); $newOperationsTable->addRow(array(_('Password'), new CTextBox('new_operation[opcommand][password]', $this->data['new_operation']['opcommand']['password'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_authentication_password hidden indent_both'); // set custom id because otherwise they are set based on name (sick!) and produce duplicate ids $passphraseCB = new CTextBox('new_operation[opcommand][password]', $this->data['new_operation']['opcommand']['password'], ZBX_TEXTBOX_SMALL_SIZE); $passphraseCB->attr('id', 'new_operation_opcommand_passphrase'); $newOperationsTable->addRow(array(_('Key passphrase'), $passphraseCB), 'class_authentication_passphrase hidden'); // ssh && telnet $newOperationsTable->addRow(array(_('Port'), new CTextBox('new_operation[opcommand][port]', $this->data['new_operation']['opcommand']['port'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_opcommand_port hidden indent_both'); // command $commandTextArea = new CTextArea('new_operation[opcommand][command]', $this->data['new_operation']['opcommand']['command']); $newOperationsTable->addRow(array(_('Commands'), $commandTextArea), 'class_opcommand_command hidden indent_both'); $commandIpmiTextBox = new CTextBox('new_operation[opcommand][command]', $this->data['new_operation']['opcommand']['command'], ZBX_TEXTBOX_STANDARD_SIZE); $commandIpmiTextBox->attr('id', 'opcommand_command_ipmi'); $newOperationsTable->addRow(array(_('Commands'), $commandIpmiTextBox), 'class_opcommand_command_ipmi hidden indent_both'); break; case OPERATION_TYPE_HOST_ADD: case OPERATION_TYPE_HOST_REMOVE: case OPERATION_TYPE_HOST_ENABLE: case OPERATION_TYPE_HOST_DISABLE: $newOperationsTable->addItem(new CVar('new_operation[object]', 0)); $newOperationsTable->addItem(new CVar('new_operation[objectid]', 0)); $newOperationsTable->addItem(new CVar('new_operation[shortdata]', '')); $newOperationsTable->addItem(new CVar('new_operation[longdata]', '')); break; case OPERATION_TYPE_GROUP_ADD: case OPERATION_TYPE_GROUP_REMOVE: if (!isset($this->data['new_operation']['opgroup'])) {
** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ include 'include/views/js/administration.general.valuemapping.edit.js.php'; $valueMappingForm = new CForm(); $valueMappingForm->setName('valueMappingForm'); $valueMappingForm->addVar('form', $this->data['form']); $valueMappingForm->addVar('form_refresh', $this->data['form_refresh'] + 1); $valueMappingForm->addVar('valuemapid', $this->data['valuemapid']); // create form list $valueMappingFormList = new CFormList('valueMappingFormList'); // name $nameTextBox = new CTextBox('mapname', $this->data['mapname'], 40, null, 64); $nameTextBox->attr('autofocus', 'autofocus'); $valueMappingFormList->addRow(_('Name'), $nameTextBox); // mappings $mappingsTable = new CTable(SPACE, 'formElementTable'); $mappingsTable->setAttribute('id', 'mappingsTable'); $mappingsTable->addRow(array(_('Value'), SPACE, _('Mapped to'), SPACE)); $mappingsTable->addRow(new CCol(new CButton('addMapping', _('Add'), '', 'link_menu'), null, 4)); $valueMappingFormList->addRow(_('Mappings'), new CDiv($mappingsTable, 'border_dotted inlineblock objectgroup')); // add mappings to form by js if (empty($this->data['mappings'])) { zbx_add_post_js('mappingsManager.addNew();'); } else { zbx_add_post_js('mappingsManager.addExisting(' . zbx_jsvalue($this->data['mappings']) . ');'); } // append tab
**/ $userGroupWidget = new CWidget(); $userGroupWidget->addPageHeader(_('CONFIGURATION OF USER GROUPS')); // create form $userGroupForm = new CForm(); $userGroupForm->setName('userGroupsForm'); $userGroupForm->addVar('form', $this->data['form']); $userGroupForm->addVar('group_rights', $this->data['group_rights']); if (isset($this->data['usrgrpid'])) { $userGroupForm->addVar('usrgrpid', $this->data['usrgrpid']); } /* * User group tab */ $userGroupFormList = new CFormList('userGroupFormList'); $nameTextBox = new CTextBox('gname', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE); $nameTextBox->attr('autofocus', 'autofocus'); $userGroupFormList->addRow(_('Group name'), $nameTextBox); // append groups to form list $groupsComboBox = new CComboBox('selusrgrp', $this->data['selected_usrgrp'], 'submit()'); $groupsComboBox->addItem(0, _('All')); foreach ($this->data['usergroups'] as $group) { $groupsComboBox->addItem($group['usrgrpid'], $group['name']); } // append user tweenbox to form list $usersTweenBox = new CTweenBox($userGroupForm, 'group_users', $this->data['group_users'], 10); foreach ($this->data['users'] as $user) { $usersTweenBox->addItem($user['userid'], getUserFullname($user)); } $userGroupFormList->addRow(_('Users'), $usersTweenBox->get(_('In group'), array(_('Other groups'), SPACE, $groupsComboBox))); // append frontend and user status to from list
** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ require_once dirname(__FILE__) . '/js/adm.regexprs.edit.js.php'; zbx_add_post_js('zabbixRegExp.addExpressions(' . CJs::encodeJson(array_values($this->get('expressions'))) . ');'); $form = new CForm(); $form->attr('id', 'zabbixRegExpForm'); $form->addVar('form', 1); $form->addVar('regexpid', $this->data['regexpid']); /* * Expressions tab */ $exprTab = new CFormList('exprTab'); $nameTextBox = new CTextBox('name', $this->get('name'), ZBX_TEXTBOX_STANDARD_SIZE, false, 128); $nameTextBox->attr('autofocus', 'autofocus'); $exprTab->addRow(_('Name'), $nameTextBox); $exprTable = new CTable(null, 'formElementTable formWideTable'); $exprTable->attr('id', 'exprTable'); $exprTable->setHeader(array(_('Expression'), new CCol(_('Expression type'), 'nowrap'), new CCol(_('Case sensitive'), 'nowrap'), SPACE)); $exprTable->setFooter(new CButton('add', _('Add'), null, 'link_menu exprAdd')); $exprTab->addRow(_('Expressions'), new CDiv($exprTable, 'inlineblock border_dotted objectgroup')); $exprForm = new CTable(null, 'formElementTable'); $exprForm->addRow(array(_('Expression'), new CTextBox('expressionNew', null, ZBX_TEXTBOX_STANDARD_SIZE))); $exprForm->addRow(array(_('Expression type'), new CComboBox('typeNew', null, null, expression_type2str()))); $exprForm->addRow(array(_('Delimiter'), new CComboBox('delimiterNew', null, null, expressionDelimiters())), null, 'delimiterNewRow'); $exprForm->addRow(array(_('Case sensitive'), new CCheckBox('case_sensitiveNew'))); $exprFormFooter = array(new CButton('saveExpression', _('Add'), null, 'link_menu'), SPACE, new CButton('cancelExpression', _('Cancel'), null, 'link_menu')); $exprTab->addRow(null, new CDiv(array($exprForm, $exprFormFooter), 'objectgroup inlineblock border_dotted'), true, 'exprForm'); /*
$applicationWidget = new CWidget(); $applicationWidget->addPageHeader(_('CONFIGURATION OF APPLICATIONS')); // append host summary to widget header $applicationWidget->addItem(get_header_host_table('applications', $this->data['hostid'])); // create form $applicationForm = new CForm(); $applicationForm->setName('applicationForm'); $applicationForm->addVar('form', $this->data['form']); $applicationForm->addVar('groupid', $this->data['groupid']); $applicationForm->addVar('hostid', $this->data['hostid']); if (!empty($this->data['applicationid'])) { $applicationForm->addVar('applicationid', $this->data['applicationid']); } // create form list $applicationFormList = new CFormList('applicationFormList'); $nameTextBox = new CTextBox('appname', $this->data['appname'], ZBX_TEXTBOX_STANDARD_SIZE); $nameTextBox->attr('autofocus', 'autofocus'); $applicationFormList->addRow(_('Name'), $nameTextBox); // append tabs to form $applicationTab = new CTabView(); $applicationTab->addTab('applicationTab', _('Application'), $applicationFormList); $applicationForm->addItem($applicationTab); // append buttons to form if (!empty($this->data['applicationid'])) { $applicationForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), array(new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete application?'), url_params(array('config', 'hostid', 'groupid', 'form', 'applicationid'))), new CButtonCancel(url_param('config') . url_param('hostid') . url_param('groupid'))))); } else { $applicationForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), new CButtonCancel(url_param('config') . url_param('hostid') . url_param('groupid')))); } // append form to widget $applicationWidget->addItem($applicationForm); return $applicationWidget;
<?php /* ** Zabbix ** Copyright (C) 2001-2013 Zabbix SIA ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $searchForm = new CForm('get', 'search.php'); $searchBox = new CTextBox('search', get_request('search')); $searchBox->setAttribute('autocomplete', 'off'); $searchBox->addClass('search'); $searchForm->addItem($searchBox); $searchBtn = new CSubmit('searchbttn', _('Search'), null, 'input button ui-button ui-widget ui-state-default ui-corner-all'); $searchForm->addItem($searchBtn); return new CDiv($searchForm, 'zbx_search', 'zbx_search');
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ require_once dirname(__FILE__) . '/js/configuration.discovery.edit.js.php'; $discoveryWidget = new CWidget(); $discoveryWidget->addPageHeader(_('CONFIGURATION OF DISCOVERY RULES')); // create form $discoveryForm = new CForm(); $discoveryForm->setName('discoveryForm'); $discoveryForm->addVar('form', $this->data['form']); $discoveryForm->addVar('form_refresh', $this->data['form_refresh'] + 1); if (!empty($this->data['druleid'])) { $discoveryForm->addVar('druleid', $this->data['druleid']); } // create form list $discoveryFormList = new CFormList('discoveryFormList'); $nameTextBox = new CTextBox('name', $this->data['drule']['name'], ZBX_TEXTBOX_STANDARD_SIZE); $nameTextBox->attr('autofocus', 'autofocus'); $discoveryFormList->addRow(_('Name'), $nameTextBox); // append proxy to form list $proxyComboBox = new CComboBox('proxy_hostid', $this->data['drule']['proxy_hostid']); $proxyComboBox->addItem(0, _('No proxy')); foreach ($this->data['proxies'] as $proxy) { $proxyComboBox->addItem($proxy['proxyid'], $proxy['host']); } $discoveryFormList->addRow(_('Discovery by proxy'), $proxyComboBox); $discoveryFormList->addRow(_('IP range'), new CTextBox('iprange', $this->data['drule']['iprange'], ZBX_TEXTBOX_SMALL_SIZE)); $discoveryFormList->addRow(_('Delay (in sec)'), new CNumericBox('delay', $this->data['drule']['delay'], 8)); // append checks to form list $checkTable = new CTable(null, 'formElementTable'); $checkTable->addRow(new CRow(new CCol(new CButton('newCheck', _('New'), null, 'link_menu'), null, 2), null, 'dcheckListFooter')); $discoveryFormList->addRow(_('Checks'), new CDiv($checkTable, 'objectgroup inlineblock border_dotted ui-corner-all', 'dcheckList'));
} // 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')); $agentComboBox->addItemsInGroup(_('Google Chrome'), array('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.8 (KHTML, like Gecko) Chrome/17.0.940.0 Safari/535.8' => 'Google Chrome 17', 'Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.36 Safari/535.7' => 'Google Chrome 16', 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.872.0 Safari/535.2' => 'Google Chrome 15', 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Ubuntu/11.04 Chromium/14.0.825.0 Chrome/14.0.825.0 Safari/535.1' => 'Google Chrome 14', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_3) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.32 Safari/535.1' => 'Google Chrome 13', 'Mozilla/5.0 (Windows NT 6.1; en-US) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.750.0 Safari/534.30' => 'Google Chrome 12')); $agentComboBox->addItemsInGroup(_('Others'), array('Mozilla/5.0 (X11; Linux 3.1.0-rc9+; en_US) KHTML/4.7.2 (like Gecko) Konqueror/4.7' => 'Konqueror 4.7', 'Mozilla/5.0 (compatible; Konqueror/4.6; Linux) KHTML/4.6.0 (like Gecko)' => 'Konqueror 4.6', 'Lynx/2.8.7rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.8r' => 'Lynx 2.8.7rel.1', 'Lynx/2.8.4rel.1 libwww-FM/2.14' => 'Lynx 2.8.4rel.1', 'Links (2.3pre1; Linux 2.6.35.10 i686; 225x51)' => 'Links 2.3pre1', 'Links (2.2; Linux 2.6.37.6-0.7-desktop i686; 225x51)' => 'Links 2.2', 'Googlebot/2.1 (+http://www.google.com/bot.html)' => 'Googlebot')); $httpFormList->addRow(_('Agent'), $agentComboBox); // append HTTP proxy to form list $httpProxyTextBox = new CTextBox('http_proxy', $this->data['http_proxy'], ZBX_TEXTBOX_STANDARD_SIZE, 'no', 255); $httpProxyTextBox->setAttribute('placeholder', 'http://[username[:password]@]proxy.example.com[:port]'); $httpFormList->addRow(_('HTTP proxy'), $httpProxyTextBox); // append status to form list $httpFormList->addRow(_('Variables'), new CTextArea('variables', $this->data['variables'])); $httpFormList->addRow(_('Enabled'), new CCheckBox('status', !$this->data['status'])); /* * Step tab */ $httpStepFormList = new CFormList('httpFormList'); $stepsTable = new CTable(null, 'formElementTable'); $stepsTable->setAttributes(array('style' => 'min-width: 500px;', 'id' => 'httpStepTable')); $stepsTable->setHeader(array(new CCol(SPACE, null, null, '15'), new CCol(SPACE, null, null, '15'), new CCol(_('Name'), null, null, '150'), new CCol(_('Timeout'), null, null, '50'), new CCol(_('URL'), null, null, '200'), new CCol(_('Required'), null, null, '50'), new CCol(_('Status codes'), 'nowrap', null, '90'), new CCol('', null, null, '50'))); $i = 1; foreach ($this->data['steps'] as $stepid => $step) { if (!isset($step['name'])) {
$inventoryAutomaticBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_AUTOMATIC, null, 'host_inventory_radio_' . HOST_INVENTORY_AUTOMATIC, $inventoryMode == HOST_INVENTORY_AUTOMATIC); $inventoryAutomaticBtn->setEnabled(!$isDiscovered); $inventoryTypeRadioButton = array($inventoryDisabledBtn, new CLabel(_('Disabled'), 'host_inventory_radio_' . HOST_INVENTORY_DISABLED), $inventoryManualBtn, new CLabel(_('Manual'), 'host_inventory_radio_' . HOST_INVENTORY_MANUAL), $inventoryAutomaticBtn, new CLabel(_('Automatic'), 'host_inventory_radio_' . HOST_INVENTORY_AUTOMATIC)); $inventoryFormList->addRow(SPACE, new CDiv($inventoryTypeRadioButton, 'jqueryinputset')); $hostInventoryTable = DB::getSchema('host_inventory'); $hostInventoryFields = getHostInventories(); foreach ($hostInventoryFields as $inventoryNo => $inventoryInfo) { if (!isset($host_inventory[$inventoryInfo['db_field']])) { $host_inventory[$inventoryInfo['db_field']] = ''; } if ($hostInventoryTable['fields'][$inventoryInfo['db_field']]['type'] == DB::FIELD_TYPE_TEXT) { $input = new CTextArea('host_inventory[' . $inventoryInfo['db_field'] . ']', $host_inventory[$inventoryInfo['db_field']]); $input->addStyle('width: 64em;'); } else { $fieldLength = $hostInventoryTable['fields'][$inventoryInfo['db_field']]['length']; $input = new CTextBox('host_inventory[' . $inventoryInfo['db_field'] . ']', $host_inventory[$inventoryInfo['db_field']]); $input->setAttribute('maxlength', $fieldLength); $input->addStyle('width: ' . ($fieldLength > 64 ? 64 : $fieldLength) . 'em;'); } if ($inventory_mode == HOST_INVENTORY_DISABLED) { $input->setAttribute('disabled', 'disabled'); } // link to populating item at the right side (if any) if (isset($hostItemsToInventory[$inventoryNo])) { $itemName = itemName($hostItemsToInventory[$inventoryNo]); $populatingLink = new CLink($itemName, 'items.php?form=update&itemid=' . $hostItemsToInventory[$inventoryNo]['itemid']); $populatingLink->setAttribute('title', _s('This field is automatically populated by item "%s".', $itemName)); $populatingItemCell = array(' ← ', $populatingLink); $input->addClass('linked_to_item'); // this will be used for disabling fields via jquery if ($inventory_mode == HOST_INVENTORY_AUTOMATIC) {
$userWidget->addPageHeader(_('CONFIGURATION OF USERS')); } // create form $userForm = new CForm(); $userForm->setName('userForm'); $userForm->addVar('config', getRequest('config', 0)); $userForm->addVar('form', $this->data['form']); if (isset($_REQUEST['userid'])) { $userForm->addVar('userid', $this->data['userid']); } /* * User tab */ $userFormList = new CFormList('userFormList'); if (!$data['is_profile']) { $nameTextBox = new CTextBox('alias', $this->data['alias'], ZBX_TEXTBOX_STANDARD_SIZE); $nameTextBox->attr('autofocus', 'autofocus'); $userFormList->addRow(_('Alias'), $nameTextBox); $userFormList->addRow(_x('Name', 'user first name'), new CTextBox('name', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE)); $userFormList->addRow(_('Surname'), new CTextBox('surname', $this->data['surname'], ZBX_TEXTBOX_STANDARD_SIZE)); } // append user groups to form list if (!$this->data['is_profile']) { $userForm->addVar('user_groups', $this->data['user_groups']); $lstGroups = new CListBox('user_groups_to_del[]', null, 10); $lstGroups->attributes['style'] = 'width: 320px'; foreach ($this->data['groups'] as $group) { $lstGroups->addItem($group['usrgrpid'], $group['name']); } $userFormList->addRow(_('Groups'), array($lstGroups, new CButton('add_group', _('Add'), 'return PopUp("popup_usrgrp.php?dstfrm=' . $userForm->getName() . '&list_name=user_groups_to_del[]&var_name=user_groups", 450, 450);', 'formlist'), BR(), count($this->data['user_groups']) > 0 ? new CSubmit('del_user_group', _('Delete selected'), null, 'formlist') : null)); }
// append multiplier to form list $multiplier = array(); if ($this->data['limited']) { $itemForm->addVar('multiplier', $this->data['multiplier']); $multiplierCheckBox = new CCheckBox('multiplier', $this->data['multiplier'] == 1 ? 'yes' : 'no'); $multiplierCheckBox->setAttribute('disabled', 'disabled'); $multiplier[] = $multiplierCheckBox; $multiplier[] = SPACE; $formulaTextBox = new CTextBox('formula', $this->data['formula'], ZBX_TEXTBOX_SMALL_SIZE, 1); $formulaTextBox->setAttribute('style', 'text-align: right;'); $multiplier[] = $formulaTextBox; } else { $multiplierCheckBox = new CCheckBox('multiplier', $this->data['multiplier'] == 1 ? 'yes' : 'no', 'var editbx = document.getElementById(\'formula\'); if (editbx) { editbx.disabled = !this.checked; }', 1); $multiplier[] = $multiplierCheckBox; $multiplier[] = SPACE; $formulaTextBox = new CTextBox('formula', $this->data['formula'], ZBX_TEXTBOX_SMALL_SIZE); $formulaTextBox->setAttribute('style', 'text-align: right;'); $multiplier[] = $formulaTextBox; } $itemFormList->addRow(_('Use custom multiplier'), $multiplier, false, 'row_multiplier'); } $itemFormList->addRow(_('Update interval (in sec)'), new CNumericBox('delay', $this->data['delay'], 5), false, 'row_delay'); // append delay flex to form list $delayFlexTable = new CTable(_('No flexible intervals defined.'), 'formElementTable'); $delayFlexTable->setAttribute('style', 'min-width: 310px;'); $delayFlexTable->setAttribute('id', 'delayFlexTable'); $delayFlexTable->setHeader(array(_('Interval'), _('Period'), _('Action'))); $i = 0; $this->data['maxReached'] = false; foreach ($this->data['delay_flex'] as $delayFlex) { if (!isset($delayFlex['delay']) && !isset($delayFlex['period'])) {
insert_js('MMenu.def_label = ' . zbx_jsvalue($label)); } else { $sub_menu_div->setAttribute('style', 'display: none;'); } $menu_divs[] = $sub_menu_div; } $sub_menu_div = new CDiv(SPACE); $sub_menu_div->setAttribute('id', 'sub_empty'); $sub_menu_div->setAttribute('style', 'display: ' . ($menu_selected ? 'none;' : 'block;')); $menu_divs[] = $sub_menu_div; $search_div = null; if ($page['file'] != 'index.php' && $USER_DETAILS['userid'] > 0) { $search_form = new CForm('search.php'); $search_form->setMethod('get'); $search_form->setAttribute('class', 'thin'); $searchBox = new CTextBox('search', get_request('search', '')); $searchBox->setAttribute('autocomplete', 'off'); $searchBox->setAttribute('style', 'width: 160px;'); $search_form->addItem(new CDiv(array(S_SEARCH_BIG . ': ', $searchBox))); $search_div = new CDiv($search_form); $search_div->setAttribute('id', 'zbx_search'); $search_div->setAttribute('class', 'zbx_search'); zbx_add_post_js("var sid = createSuggest('search');"); } $sub_menu_table->addRow(array($menu_divs, $search_div)); $page_menu->addItem($sub_menu_table); //--- $page_menu->show(); } //------------------------------------- <HISTORY> --------------------------------------- if (isset($page['hist_arg']) && $USER_DETAILS['alias'] != ZBX_GUEST_USER && $page['type'] == PAGE_TYPE_HTML && !defined('ZBX_PAGE_NO_MENU')) {
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; }
foreach (array_reverse($data['parents']) as $parent) { $parents[] = new CLink($parent['parentHost']['name'], '?form=update&hostid=' . $parent['hostid'] . '&parent_discoveryid=' . $parent['discoveryRule']['itemid'], 'highlight underline weight_normal'); $parents[] = SPACE . RARR . SPACE; } array_pop($parents); $hostList->addRow(_('Parent discovery rules'), $parents); } if ($hostPrototype['hostid']) { $frmHost->addVar('hostid', $hostPrototype['hostid']); } $hostTB = new CTextBox('host', $hostPrototype['host'], ZBX_TEXTBOX_STANDARD_SIZE, (bool) $hostPrototype['templateid']); $hostTB->setAttribute('maxlength', 64); $hostTB->setAttribute('autofocus', 'autofocus'); $hostList->addRow(_('Host name'), $hostTB); $name = $hostPrototype['name'] != $hostPrototype['host'] ? $hostPrototype['name'] : ''; $visiblenameTB = new CTextBox('name', $name, ZBX_TEXTBOX_STANDARD_SIZE, (bool) $hostPrototype['templateid']); $visiblenameTB->setAttribute('maxlength', 64); $hostList->addRow(_('Visible name'), $visiblenameTB); // display inherited parameters only for hosts prototypes on hosts if ($parentHost['status'] != HOST_STATUS_TEMPLATE) { $interfaces = array(); $existingInterfaceTypes = array(); foreach ($parentHost['interfaces'] as $interface) { $interface['locked'] = true; $existingInterfaceTypes[$interface['type']] = true; $interfaces[$interface['interfaceid']] = $interface; } zbx_add_post_js('hostInterfacesManager.add(' . CJs::encodeJson($interfaces) . ');'); zbx_add_post_js('hostInterfacesManager.disable()'); // table for agent interfaces with footer $ifTab = new CTable(null, 'formElementTable');
$severityTab->addRow(_('Information'), array($severityNameTB1, SPACE, $severityColorTB1)); $severityNameTB2 = new CTextBox('severity_name_2', $this->data['config']['severity_name_2']); $severityNameTB2->addStyle('width: 15em;'); $severityNameTB2->setAttribute('maxlength', 32); $severityColorTB2 = new CColor('severity_color_2', $this->data['config']['severity_color_2']); $severityTab->addRow(_('Warning'), array($severityNameTB2, SPACE, $severityColorTB2)); $severityNameTB3 = new CTextBox('severity_name_3', $this->data['config']['severity_name_3']); $severityNameTB3->addStyle('width: 15em;'); $severityNameTB3->setAttribute('maxlength', 32); $severityColorTB3 = new CColor('severity_color_3', $this->data['config']['severity_color_3']); $severityTab->addRow(_('Average'), array($severityNameTB3, SPACE, $severityColorTB3)); $severityNameTB4 = new CTextBox('severity_name_4', $this->data['config']['severity_name_4']); $severityNameTB4->addStyle('width: 15em;'); $severityNameTB4->setAttribute('maxlength', 32); $severityColorTB4 = new CColor('severity_color_4', $this->data['config']['severity_color_4']); $severityTab->addRow(_('High'), array($severityNameTB4, SPACE, $severityColorTB4)); $severityNameTB5 = new CTextBox('severity_name_5', $this->data['config']['severity_name_5']); $severityNameTB5->addStyle('width: 15em;'); $severityNameTB5->setAttribute('maxlength', 32); $severityColorTB5 = new CColor('severity_color_5', $this->data['config']['severity_color_5']); $severityTab->addRow(_('Disaster'), array($severityNameTB5, SPACE, $severityColorTB5)); $severityTab->addRow(SPACE); $severityTab->addInfo(_('Custom severity names affect all locales and require manual translation!')); $severityView = new CTabView(); $severityView->addTab('severities', _('Trigger severities'), $severityTab); $severityForm = new CForm(); $severityForm->setName('triggerSeverity'); $severityForm->addVar('form_refresh', $this->data['form_refresh'] + 1); $severityForm->addItem($severityView); $severityForm->addItem(makeFormFooter(array(new CSubmit('save', _('Save'))), new CButton('resetDefaults', _('Reset defaults')))); return $severityForm;
if (!in_array($group['groupid'], $groupsInList)) { $group_tb->addItem($group['groupid'], $group['name']); } } } else { /* * When cloning a template or creating a new one, don't show read-only host groups in left box * show empty or posted groups in case of an error. */ foreach ($groupsAllowed as $group) { $group_tb->addItem($group['groupid'], $group['name']); } } $templateList->addRow(_('Groups'), $group_tb->get(_('In groups'), _('Other groups'))); // FORM ITEM : new group text box [ ] $newgroupTB = new CTextBox('newgroup', $newgroup); $newgroupTB->setAttribute('maxlength', 64); $tmp_label = _('New group'); if (CWebUser::$data['type'] != USER_TYPE_SUPER_ADMIN) { $tmp_label .= SPACE . _('(Only super admins can create groups)'); $newgroupTB->setReadonly(true); } $templateList->addRow(SPACE, array($tmp_label, BR(), $newgroupTB), null, null, 'new'); // FORM ITEM : linked Hosts tween box [ ] [ ] $twb_groupid = get_request('twb_groupid', 0); if ($twb_groupid == 0) { $gr = reset($groupsAllowed); $twb_groupid = $gr['groupid']; } $cmbGroups = new CComboBox('twb_groupid', $twb_groupid, 'submit()'); foreach ($groupsAllowed as $group) {
** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $imageForm = new CForm('post', null, 'multipart/form-data'); $imageForm->setName('imageForm'); $imageForm->addVar('form', $this->data['form']); if (isset($this->data['imageid'])) { $imageForm->addVar('imageid', $this->data['imageid']); } $imageForm->addVar('imagetype', $this->data['imagetype']); // append form list $imageFormList = new CFormList('imageFormList'); $nameTextBox = new CTextBox('name', $this->data['imagename'], 64, false, 64); $nameTextBox->attr('autofocus', 'autofocus'); $imageFormList->addRow(_('Name'), $nameTextBox); $imageFormList->addRow(_('Upload'), new CFile('image')); if (isset($this->data['imageid'])) { if ($this->data['imagetype'] == IMAGE_TYPE_BACKGROUND) { $imageFormList->addRow(_('Image'), new CLink(new CImg('imgstore.php?width=200&height=200&iconid=' . $this->data['imageid'], 'no image'), 'image.php?imageid=' . $this->data['imageid'])); } else { $imageFormList->addRow(_('Image'), new CImg('imgstore.php?iconid=' . $this->data['imageid'], 'no image', null)); } } // append tab $imageTab = new CTabView(); $imageTab->addTab('imageTab', $this->data['imagetype'] == IMAGE_TYPE_ICON ? _('Icon') : _('Background'), $imageFormList); $imageForm->addItem($imageTab); // append buttons
// 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] = ''; } if ($hostInventoryTable['fields'][$field]['type'] == DB::FIELD_TYPE_TEXT) { $fieldInput = new CTextArea('host_inventory[' . $field . ']', $this->data['host_inventory'][$field]); $fieldInput->addStyle('width: 64em;'); } else { $fieldLength = $hostInventoryTable['fields'][$field]['length']; $fieldInput = new CTextBox('host_inventory[' . $field . ']', $this->data['host_inventory'][$field]); $fieldInput->setAttribute('maxlength', $fieldLength); $fieldInput->addStyle('width: ' . ($fieldLength > 64 ? 64 : $fieldLength) . 'em;'); } $hostFormList->addRow(array($fieldInfo['title'], SPACE, new CVisibilityBox('visible[' . $field . ']', isset($this->data['visible'][$field]), 'host_inventory[' . $field . ']', _('Original'))), $fieldInput); } } // append tabs to form $hostTab = new CTabView(); $hostTab->addTab('hostTab', _('Mass update'), $hostFormList); $hostForm->addItem($hostTab); // append buttons to form $hostForm->addItem(makeFormFooter(new CSubmit('masssave', _('Update')), new CButtonCancel(url_param('groupid')))); return $hostForm;
** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $proxyWidget = new CWidget(); $proxyWidget->addPageHeader(_('CONFIGURATION OF PROXIES')); // create form $proxyForm = new CForm(); $proxyForm->setName('proxyForm'); $proxyForm->addVar('form', $this->data['form']); $proxyForm->addVar('form_refresh', $this->data['form_refresh']); if (!empty($this->data['proxyid'])) { $proxyForm->addVar('proxyid', $this->data['proxyid']); } // create form list $proxyFormList = new CFormList('proxyFormList'); $nameTextBox = new CTextBox('host', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE, 'no', 64); $nameTextBox->attr('autofocus', 'autofocus'); $proxyFormList->addRow(_('Proxy name'), $nameTextBox); // append status to form list $statusBox = new CComboBox('status', $this->data['status'], 'submit()'); $statusBox->addItem(HOST_STATUS_PROXY_ACTIVE, _('Active')); $statusBox->addItem(HOST_STATUS_PROXY_PASSIVE, _('Passive')); $proxyFormList->addRow(_('Proxy mode'), $statusBox); if ($this->data['status'] == HOST_STATUS_PROXY_PASSIVE) { if (isset($this->data['interface']['interfaceid'])) { $proxyForm->addVar('interface[interfaceid]', $this->data['interface']['interfaceid']); $proxyForm->addVar('interface[hostid]', $this->data['interface']['hostid']); } $interfaceTable = new CTable(null, 'formElementTable'); $interfaceTable->addRow(array(_('IP address'), _('DNS name'), _('Connect to'), _('Port'))); $connectByComboBox = new CRadioButtonList('interface[useip]', $this->data['interface']['useip']);
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $maintenanceWidget = new CWidget(); $maintenanceWidget->addPageHeader(_('CONFIGURATION OF MAINTENANCE PERIODS')); // create form $maintenanceForm = new CForm(); $maintenanceForm->setName('maintenanceForm'); $maintenanceForm->addVar('form', $this->data['form']); if (isset($this->data['maintenanceid'])) { $maintenanceForm->addVar('maintenanceid', $this->data['maintenanceid']); } /* * Maintenance tab */ $maintenanceFormList = new CFormList('maintenanceFormList'); $nameTextBox = new CTextBox('mname', $this->data['mname'], ZBX_TEXTBOX_STANDARD_SIZE); $nameTextBox->attr('autofocus', 'autofocus'); $maintenanceFormList->addRow(_('Name'), $nameTextBox); $typeComboBox = new CComboBox('maintenance_type', $this->data['maintenance_type']); $typeComboBox->addItem(MAINTENANCE_TYPE_NORMAL, _('With data collection')); $typeComboBox->addItem(MAINTENANCE_TYPE_NODATA, _('No data collection')); $maintenanceFormList->addRow(_('Maintenance type'), $typeComboBox); // active since if (isset($_REQUEST['active_since'])) { $fromYear = get_request('active_since_year'); $fromMonth = get_request('active_since_month'); $fromDay = get_request('active_since_day'); $fromHours = get_request('active_since_hour'); $fromMinutes = get_request('active_since_minute'); $fromDate = array('y' => $fromYear, 'm' => $fromMonth, 'd' => $fromDay, 'h' => $fromHours, 'i' => $fromMinutes); $activeSince = $fromYear . $fromMonth . $fromDay . $fromHours . $fromMinutes;
$macrosFormList = new CFormList('macrosFormList'); $macrosFormList->addRow(_('No macros found.')); return $macrosFormList; } if (!$readonly) { include dirname(__FILE__) . '/js/common.macros.js.php'; } $macrosTable = new CTable(SPACE, 'formElementTable'); $macrosTable->setAttribute('id', 'tbl_macros'); $macrosTable->addRow(array(_('Macro'), SPACE, _('Value'), SPACE)); // fields foreach ($macros as $i => $macro) { $text1 = new CTextBox('macros[' . $i . '][macro]', $macro['macro'], 30, $readonly, 64); $text1->addClass('macro'); $text1->setAttribute('placeholder', '{$MACRO}'); $text2 = new CTextBox('macros[' . $i . '][value]', $macro['value'], 40, $readonly, 255); $text2->setAttribute('placeholder', _('value')); $span = new CSpan('⇒'); $span->addStyle('vertical-align:top;'); $deleteButtonCell = null; if (!$readonly) { $deleteButtonCell = array(new CButton('macros_' . $i . '_remove', _('Remove'), null, 'link_menu element-table-remove')); if (isset($macro['globalmacroid'])) { $deleteButtonCell[] = new CVar('macros[' . $i . '][globalmacroid]', $macro['globalmacroid'], 'macros_' . $i . '_id'); } if (isset($macro['hostmacroid'])) { $deleteButtonCell[] = new CVar('macros[' . $i . '][hostmacroid]', $macro['hostmacroid'], 'macros_' . $i . '_id'); } } $row = array($text1, $span, $text2, $deleteButtonCell); $macrosTable->addRow($row, 'form_row');
$headerDiv = new CDiv(_('Colour'), 'inlineblock trigger_displaying_form_col'); $headerDiv->addStyle('margin-left: 2px;'); $triggerDOFormList->addRow(SPACE, array($headerDiv, _('Blinking'))); // Unacknowledged problem events $triggerDOFormList->addRow(_('Unacknowledged PROBLEM events'), array(new CDiv(new CColor('problem_unack_color', $this->data['problem_unack_color']), 'inlineblock trigger_displaying_form_col'), new CCheckBox('problem_unack_style', $this->data['problem_unack_style'] == 1, null, 1))); // Acknowledged problem events $triggerDOFormList->addRow(_('Acknowledged PROBLEM events'), array(new CDiv(new CColor('problem_ack_color', $this->data['problem_ack_color']), 'inlineblock trigger_displaying_form_col'), new CCheckBox('problem_ack_style', $this->data['problem_ack_style'] == 1, null, 1))); // Unacknowledged recovery events $triggerDOFormList->addRow(_('Unacknowledged OK events'), array(new CDiv(new CColor('ok_unack_color', $this->data['ok_unack_color']), 'inlineblock trigger_displaying_form_col'), new CCheckBox('ok_unack_style', $this->data['ok_unack_style'] == 1, null, 1))); // Acknowledged recovery events $triggerDOFormList->addRow(_('Acknowledged OK events'), array(new CDiv(new CColor('ok_ack_color', $this->data['ok_ack_color']), 'inlineblock trigger_displaying_form_col'), new CCheckBox('ok_ack_style', $this->data['ok_ack_style'] == 1, null, 1))); // some air between the sections $triggerDOFormList->addRow(BR()); // Display OK triggers $okPeriodTextBox = new CTextBox('ok_period', $this->data['ok_period']); $okPeriodTextBox->addStyle('width: 4em;'); $okPeriodTextBox->setAttribute('maxlength', '6'); $triggerDOFormList->addRow(_('Display OK triggers for'), array($okPeriodTextBox, SPACE, _('seconds'))); // Triggers blink on status change $okPeriodTextBox = new CTextBox('blink_period', $this->data['blink_period']); $okPeriodTextBox->addStyle('width: 4em;'); $okPeriodTextBox->setAttribute('maxlength', '6'); $triggerDOFormList->addRow(_('On status change triggers blink for'), array($okPeriodTextBox, SPACE, _('seconds'))); $severityView = new CTabView(); $severityView->addTab('triggerdo', _('Trigger displaying options'), $triggerDOFormList); $severityForm = new CForm(); $severityForm->setName('triggerDisplayOptions'); $severityForm->addVar('form_refresh', $this->data['form_refresh'] + 1); $severityForm->addItem($severityView); $severityForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), new CButton('resetDefaults', _('Reset defaults')))); return $severityForm;