** 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/configuration.slideconf.edit.js.php'; $slideWidget = new CWidget(); $slideWidget->addPageHeader(_('CONFIGURATION OF SLIDE SHOWS')); // create form $slideForm = new CForm(); $slideForm->setName('slideForm'); $slideForm->addVar('form', $this->data['form']); $slideForm->addVar('slides', $this->data['slides_without_delay']); if (!empty($this->data['slideshowid'])) { $slideForm->addVar('slideshowid', $this->data['slideshowid']); } // create slide form list $slideFormList = new CFormList('slideFormList'); $nameTextBox = new CTextBox('name', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE); $nameTextBox->attr('autofocus', 'autofocus'); $slideFormList->addRow(_('Name'), $nameTextBox); $slideFormList->addRow(_('Default delay (in seconds)'), new CNumericBox('delay', $this->data['delay'], 5, 'no', false, false)); // append slide table $slideTable = new CTableInfo(null, 'formElementTable'); $slideTable->setAttribute('style', 'min-width: 312px;'); $slideTable->setAttribute('id', 'slideTable'); $slideTable->setHeader(array(new CCol(SPACE, null, null, '15'), new CCol(SPACE, null, null, '15'), _('Screen'), new CCol(_('Delay'), null, null, '70'), new CCol(_('Action'), null, null, '50'))); $i = 1; foreach ($this->data['slides'] as $step => $slides) { $name = ''; if (!empty($slides['screenid'])) { $screen = get_screen_by_screenid($slides['screenid']); if (!empty($screen['name'])) {
** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $itemWidget = new CWidget(); if (!empty($this->data['hostid'])) { $itemWidget->addItem(get_header_host_table('items', $this->data['hostid'])); } $itemWidget->addPageHeader(_('CONFIGURATION OF ITEMS')); // create form $itemForm = new CForm(); $itemForm->setName('itemForm'); $itemForm->addVar('group_itemid', $this->data['group_itemid']); $itemForm->addVar('hostid', $this->data['hostid']); $itemForm->addVar('go', 'copy_to'); // create form list $itemFormList = new CFormList('itemFormList'); // append type to form list $copyTypeComboBox = new CComboBox('copy_type', $this->data['copy_type'], 'submit()'); $copyTypeComboBox->addItem(0, _('Hosts')); $copyTypeComboBox->addItem(1, _('Host groups')); $itemFormList->addRow(_('Target type'), $copyTypeComboBox); // append targets to form list $targetList = array(); if ($this->data['copy_type'] == 0) { $groupComboBox = new CComboBox('copy_groupid', $this->data['copy_groupid'], 'submit()'); foreach ($this->data['groups'] as $group) { $groupComboBox->addItem($group['groupid'], $group['name']); } $itemFormList->addRow(_('Group'), $groupComboBox); foreach ($this->data['hosts'] as $host) { array_push($targetList, array(new CCheckBox('copy_targetid[' . $host['hostid'] . ']', uint_in_array($host['hostid'], $this->data['copy_targetid']), null, $host['hostid']), SPACE, $host['name'], BR()));
** 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. **/ $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')));
** 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/configuration.slideconf.edit.js.php'; $slideWidget = new CWidget(); $slideWidget->addPageHeader(_('CONFIGURATION OF SLIDE SHOWS')); // create form $slideForm = new CForm(); $slideForm->setName('slideForm'); $slideForm->addVar('form', $this->data['form']); $slideForm->addVar('slides', $this->data['slides_without_delay']); if (!empty($this->data['slideshowid'])) { $slideForm->addVar('slideshowid', $this->data['slideshowid']); } // create slide form list $slideFormList = new CFormList('slideFormList'); $slideFormList->addRow(_('Name'), new CTextBox('name', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE)); $slideFormList->addRow(_('Default delay (in seconds)'), new CNumericBox('delay', $this->data['delay'], 5, 'no', false, false)); // append slide table $slideTable = new CTableInfo(_('No slides defined.'), 'formElementTable'); $slideTable->setAttribute('style', 'min-width: 500px;'); $slideTable->setAttribute('id', 'slideTable'); $slideTable->setHeader(array(new CCol(SPACE, null, null, '15'), new CCol(SPACE, null, null, '15'), new CCol(_('Screen'), null, null, '140'), new CCol(_('Delay'), null, null, '70'), new CCol(_('Action'), null, null, '50'))); $i = 1; foreach ($this->data['slides'] as $step => $slides) { $name = ''; if (!empty($slides['screenid'])) { $screen = get_screen_by_screenid($slides['screenid']); if (!empty($screen['name'])) { $name = $screen['name']; }
$condition = new CComboBox('new_condition[value]', null, null, eventType()); break; case CONDITION_TYPE_HOST_METADATA: $condition = new CTextBox('new_condition[value]', '', ZBX_TEXTBOX_STANDARD_SIZE); break; default: $condition = null; } $conditionTable = new CTable(null, 'newActionConditionTable'); $conditionTable->addRow(array($conditionTypeComboBox, $conditionOperatorsComboBox, $condition)); $conditionTable->addRow(array(new CSubmit('add_condition', _('Add'), null, 'link_menu'), SPACE, SPACE)); $conditionFormList->addRow(_('New condition'), new CDiv($conditionTable, 'objectgroup inlineblock border_dotted ui-corner-all')); /* * Operation tab */ $operationFormList = new CFormList('operationlist'); if ($this->data['eventsource'] == EVENT_SOURCE_TRIGGERS || $this->data['eventsource'] == EVENT_SOURCE_INTERNAL) { $operationFormList->addRow(_('Default operation step duration'), array(new CNumericBox('esc_period', $this->data['action']['esc_period'], 6, 'no'), ' (' . _('minimum 60 seconds') . ')')); } // create operation table $operationsTable = new CTable(_('No operations defined.'), 'formElementTable'); $operationsTable->attr('style', 'min-width: 600px;'); if ($this->data['action']['eventsource'] == EVENT_SOURCE_TRIGGERS || $this->data['eventsource'] == EVENT_SOURCE_INTERNAL) { $operationsTable->setHeader(array(_('Steps'), _('Details'), _('Start in'), _('Duration (sec)'), _('Action'))); $delay = count_operations_delay($this->data['action']['operations'], $this->data['action']['esc_period']); } else { $operationsTable->setHeader(array(_('Details'), _('Action'))); } foreach ($this->data['action']['operations'] as $operationid => $operation) { if (!str_in_array($operation['operationtype'], $this->data['allowedOperations'])) { continue;
** 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. **/ require_once dirname(__FILE__) . '/js/monitoring.triggerComment.js.php'; $commentWidget = new CWidget('triggerComment'); $commentWidget->addPageHeader(_('TRIGGER DESCRIPTION')); // create form $commentForm = new CForm(); $commentForm->setName('commentForm'); $commentForm->addVar('triggerid', $this->data['triggerid']); // create form list $commentFormList = new CFormList('commentFormList'); $commentTextArea = new CTextArea('comments', CMacrosResolverHelper::resolveTriggerDescription($this->data['trigger']), array('rows' => 25, 'width' => ZBX_TEXTAREA_BIG_WIDTH, 'readonly' => $this->data['isCommentExist'])); $commentTextArea->attr('autofocus', 'autofocus'); $commentFormList->addRow(_('Description'), $commentTextArea); // append tabs to form $commentTab = new CTabView(); $commentTab->addTab('commentTab', _s('Description for "%s".', $this->data['trigger']['description']), $commentFormList); $commentForm->addItem($commentTab); // append buttons to form $updateButton = new CSubmit('update', _('Update')); $updateButton->setEnabled(!$this->data['isCommentExist']); if ($this->data['isCommentExist']) { $editButton = new CButton('edit', _('Edit')); $editButton->setEnabled($this->data['isTriggerEditable']); } else { $editButton = null;
} if (isset($_REQUEST['save']) && $result) { if (!isset($_REQUEST['stepid'])) { insert_js('add_httpstep(' . zbx_jsvalue($_REQUEST['dstfrm']) . ',' . zbx_jsvalue($_REQUEST['name']) . ',' . zbx_jsvalue($_REQUEST['timeout']) . ',' . zbx_jsvalue($_REQUEST['url']) . ',' . zbx_jsvalue($_REQUEST['posts']) . ',' . zbx_jsvalue($_REQUEST['variables']) . ',' . zbx_jsvalue($_REQUEST['required']) . ',' . zbx_jsvalue($_REQUEST['status_codes']) . ");\n"); } else { insert_js('update_httpstep(' . zbx_jsvalue($_REQUEST['dstfrm']) . ',' . zbx_jsvalue($_REQUEST['list_name']) . ',' . zbx_jsvalue($_REQUEST['stepid']) . ',' . zbx_jsvalue($_REQUEST['name']) . ',' . zbx_jsvalue($_REQUEST['timeout']) . ',' . zbx_jsvalue($_REQUEST['url']) . ',' . zbx_jsvalue($_REQUEST['posts']) . ',' . zbx_jsvalue($_REQUEST['variables']) . ',' . zbx_jsvalue($_REQUEST['required']) . ',' . zbx_jsvalue($_REQUEST['status_codes']) . ");\n"); } } else { $httpPopupForm = new CForm(); $httpPopupForm->addVar('dstfrm', get_request('dstfrm', null)); $httpPopupForm->addVar('stepid', get_request('stepid', null)); $httpPopupForm->addVar('list_name', get_request('list_name', null)); $httpPopupForm->addVar('templated', get_request('templated', null)); $httpPopupForm->addVar('old_name', get_request('old_name', null)); $httpPopupForm->addVar('steps_names', get_request('steps_names', null)); $httpPopupFormList = new CFormList('httpPopupFormList'); $httpPopupFormList->addRow(_('Name'), new CTextBox('name', get_request('name', ''), ZBX_TEXTBOX_STANDARD_SIZE, get_request('templated', null), 64)); $httpPopupFormList->addRow(_('URL'), new CTextBox('url', get_request('url', ''), ZBX_TEXTBOX_STANDARD_SIZE)); $httpPopupFormList->addRow(_('Post'), new CTextArea('posts', get_request('posts', ''))); $httpPopupFormList->addRow(_('Variables'), new CTextArea('variables', get_request('variables', ''))); $httpPopupFormList->addRow(_('Timeout'), new CNumericBox('timeout', get_request('timeout', 15), 5)); $httpPopupFormList->addRow(_('Required string'), new CTextBox('required', get_request('required', ''), ZBX_TEXTBOX_STANDARD_SIZE)); $httpPopupFormList->addRow(_('Required status codes'), new CTextBox('status_codes', get_request('status_codes', ''), ZBX_TEXTBOX_STANDARD_SIZE)); // append tabs to form $httpPopupTab = new CTabView(); $httpPopupTab->addTab('scenarioStepTab', _('Step of scenario'), $httpPopupFormList); $httpPopupForm->addItem($httpPopupTab); // append buttons to form $stepid = get_request('stepid', null); $httpPopupForm->addItem(makeFormFooter(new CSubmit('save', isset($stepid) ? _('Update') : _('Add')), new CButtonCancel(null, 'close_window();'))); $httpPopupWidget->addItem($httpPopupForm);
** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $widget = (new CWidget())->setTitle(_('Discovery rules'))->addItem(get_header_host_table('discoveries', $this->data['hostid'], isset($this->data['parent_discoveryid']) ? $this->data['parent_discoveryid'] : 0)); // create form $itemForm = (new CForm())->setName('itemForm')->addVar('form', $this->data['form'])->addVar('hostid', $this->data['hostid']); if (!empty($this->data['parent_discoveryid'])) { $itemForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']); } if (!empty($this->data['itemid'])) { $itemForm->addVar('itemid', $this->data['itemid']); } // create form list $itemFormList = new CFormList('itemFormList'); if (!empty($this->data['templates'])) { $itemFormList->addRow(_('Parent discovery rules'), $this->data['templates']); } $itemFormList->addRow(_('Name'), (new CTextBox('name', $this->data['name'], $this->data['limited']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)->setAttribute('autofocus', 'autofocus')); // 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']), true))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH)); } else { $typeComboBox = (new CComboBox('type', $this->data['type']))->addItems($this->data['types']); $itemFormList->addRow(_('Type'), $typeComboBox); } // append key to form list $itemFormList->addRow(_('Key'), [(new CTextBox('key', $this->data['key'], $this->data['limited']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)]); // append interfaces to form 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. **/ $hostGroupWidget = new CWidget(); $hostGroupWidget->addPageHeader(_('CONFIGURATION OF HOST GROUPS')); // create form $hostGroupForm = new CForm(); $hostGroupForm->setName('hostgroupForm'); $hostGroupForm->addVar('form', $this->data['form']); if (isset($this->data['groupid'])) { $hostGroupForm->addVar('groupid', $this->data['groupid']); } // create hostgroup form list $hostGroupFormList = new CFormList('hostgroupFormList'); $nameTextBox = new CTextBox('name', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE, $this->data['groupid'] && $this->data['group']['flags'] == ZBX_FLAG_DISCOVERY_CREATED, 64); $nameTextBox->attr('autofocus', 'autofocus'); $hostGroupFormList->addRow(_('Group name'), $nameTextBox); // append groups and hosts to form list $groupsComboBox = new CComboBox('twb_groupid', $this->data['twb_groupid'], 'submit()'); $groupsComboBox->addItem('0', _('All')); foreach ($this->data['db_groups'] as $group) { $groupsComboBox->addItem($group['groupid'], $group['name']); } $hostsComboBox = new CTweenBox($hostGroupForm, 'hosts', $this->data['hosts'], 25); foreach ($this->data['db_hosts'] as $host) { if (!isset($this->data['hosts'][$host['hostid']])) { $hostsComboBox->addItem($host['hostid'], $host['name']); } }
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $widget = (new CWidget())->setTitle(_('Web monitoring')); // append host summary to widget header if (!empty($this->data['hostid'])) { $widget->addItem(get_header_host_table('web', $this->data['hostid'])); } // create form $httpForm = (new CForm())->setName('httpForm')->addVar('form', $this->data['form'])->addVar('hostid', $this->data['hostid'])->addVar('steps', $this->data['steps'])->addVar('templated', $this->data['templated']); if (!empty($this->data['httptestid'])) { $httpForm->addVar('httptestid', $this->data['httptestid']); } /* * Scenario tab */ $httpFormList = new CFormList('httpFormList'); // Parent http tests if (!empty($this->data['templates'])) { $httpFormList->addRow(_('Parent web scenarios'), $this->data['templates']); } // Name $nameTextBox = (new CTextBox('name', $this->data['name'], $this->data['templated'], 64))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH); if (!$this->data['templated']) { $nameTextBox->setAttribute('autofocus', 'autofocus'); } $httpFormList->addRow(_('Name'), $nameTextBox); // Application if ($this->data['application_list']) { $applications = zbx_array_merge([''], $this->data['application_list']); $httpFormList->addRow(_('Application'), new CComboBox('applicationid', $this->data['applicationid'], null, $applications)); } else {
** 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. **/ $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'); $proxyFormList->addRow(_('Proxy name'), new CTextBox('host', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE, 'no', 64)); // 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('interfaces[0][interfaceid]', $this->data['interface']['interfaceid']); $proxyForm->addVar('interfaces[0][hostid]', $this->data['interface']['hostid']); } $interfaceTable = new CTable(_('No interfaces defined.'), 'formElementTable'); $interfaceTable->addRow(array(_('IP address'), _('DNS name'), _('Connect to'), _('Port'))); $connectByComboBox = new CRadioButtonList('interfaces[0][useip]', $this->data['interface']['useip']); $connectByComboBox->addValue(_('IP'), 1);
// append host summary to widget header if (!empty($this->data['hostid'])) { $hostTableElement = $this->data['elements_field'] == 'group_graphid' ? 'graphs' : 'trigger'; $triggersWidget->addItem(get_header_host_table($hostTableElement, $this->data['hostid'])); } if (!empty($this->data['title'])) { $triggersWidget->addPageHeader($this->data['title']); } // create form $triggersForm = new CForm(); $triggersForm->setName('triggersForm'); $triggersForm->addVar($this->data['elements_field'], $this->data['elements']); $triggersForm->addVar('hostid', $this->data['hostid']); $triggersForm->addVar('go', 'copy_to'); // create form list $triggersFormList = new CFormList('triggersFormList'); // append copy types to form list $copyTypeComboBox = new CComboBox('copy_type', $this->data['copy_type'], 'submit()'); $copyTypeComboBox->addItem(0, _('Hosts')); $copyTypeComboBox->addItem(1, _('Host groups')); $triggersFormList->addRow(_('Target type'), $copyTypeComboBox); // append groups to form list if ($this->data['copy_type'] == 0) { $groupComboBox = new CComboBox('filter_groupid', $this->data['filter_groupid'], 'submit()'); foreach ($this->data['groups'] as $group) { if (empty($this->data['filter_groupid'])) { $this->data['filter_groupid'] = $group['groupid']; } $groupComboBox->addItem($group['groupid'], $group['name']); } $triggersFormList->addRow(_('Group'), $groupComboBox);
$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'); } // buttons if (!$readonly) { $addButton = new CButton('macro_add', _('Add'), null, 'link_menu element-table-add'); $buttonColumn = new CCol($addButton); $buttonColumn->setAttribute('colspan', 5); $buttonRow = new CRow(); $buttonRow->setAttribute('id', 'row_new_macro'); $buttonRow->addItem($buttonColumn); $macrosTable->addRow($buttonRow); } // form list $macrosFormList = new CFormList('macrosFormList'); $macrosFormList->addRow($macrosTable); return $macrosFormList;
foreach ($titles as $key => $title) { $cbExist = $cbMissed = SPACE; if (isset($rules[$key]['updateExisting'])) { $cbExist = new CCheckBox('rules[' . $key . '][updateExisting]', $rules[$key]['updateExisting'], null, 1); if ($key == 'images') { if (CWebUser::$data['type'] != USER_TYPE_SUPER_ADMIN) { continue; } $cbExist->setAttribute('onclick', 'if (this.checked) return confirm(\'' . _('Images for all maps will be updated!') . '\')'); } } if (isset($rules[$key]['createMissing'])) { $cbMissed = new CCheckBox('rules[' . $key . '][createMissing]', $rules[$key]['createMissing'], null, 1); } $rulesTable->addRow(array($title, new CCol($cbExist, 'center'), new CCol($cbMissed, 'center'))); } // form list $importFormList = new CFormList('proxyFormList'); $importFormList->addRow(_('Import file'), new CFile('import_file')); $importFormList->addRow(_('Rules'), new CDiv($rulesTable, 'border_dotted objectgroup inlineblock')); // tab $importTab = new CTabView(); $importTab->addTab('importTab', _('Import'), $importFormList); // form $importForm = new CForm('post', null, 'multipart/form-data'); $importForm->addItem($importTab); $importForm->addItem(makeFormFooter(new CSubmit('import', _('Import')), new CButtonCancel())); // widget $importWidget = new CWidget(); $importWidget->addItem($importForm); return $importWidget;
** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $widget = (new CWidget())->setTitle(_('Authentication')); // create form $authenticationForm = (new CForm())->setName('authenticationForm'); // create form list $authenticationFormList = new CFormList('authenticationList'); // append config radio buttons to form list $authenticationFormList->addRow(_('Default authentication'), (new CRadioButtonList('config', (int) $this->data['config']['authentication_type']))->addValue(_x('Internal', 'authentication'), ZBX_AUTH_INTERNAL, null, 'submit()')->addValue(_('LDAP'), ZBX_AUTH_LDAP, null, 'submit()')->addValue(_('HTTP'), ZBX_AUTH_HTTP, null, 'submit()')->setModern(true)); // append LDAP fields to form list if ($this->data['config']['authentication_type'] == ZBX_AUTH_LDAP) { if ($this->data['user_list']) { $userComboBox = new CComboBox('user', $this->data['user']); foreach ($this->data['user_list'] as $user) { if (check_perm2login($user['userid']) && check_perm2system($user['userid'])) { $userComboBox->addItem($user['alias'], $user['alias']); } } } else { $userComboBox = (new CTextBox('user', $this->data['user'], true))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH); } $authenticationFormList->addRow(_('LDAP host'), (new CTextBox('ldap_host', $this->data['config']['ldap_host']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH));
$periodsDiv->addItem(new CSubmit('new_timeperiod', _('New'), null, 'link_menu')); } $maintenancePeriodFormList->addRow(_('Periods'), $periodsDiv); if (isset($_REQUEST['new_timeperiod'])) { if (is_array($_REQUEST['new_timeperiod']) && isset($_REQUEST['new_timeperiod']['id'])) { $saveLabel = _('Save'); } else { $saveLabel = _('Add'); } $footer = array(new CSubmit('add_timeperiod', $saveLabel, null, 'link_menu'), SPACE . SPACE, new CSubmit('cancel_new_timeperiod', _('Cancel'), null, 'link_menu')); $maintenancePeriodFormList->addRow(_('Maintenance period'), new CDiv(array(get_timeperiod_form(), $footer), 'objectgroup inlineblock border_dotted')); } /* * Hosts & groups tab */ $hostsAndGroupsFormList = new CFormList('hostsAndGroupsFormList'); $hostTweenBox = new CTweenBox($maintenanceForm, 'hostids', $this->data['hostids'], 10); foreach ($this->data['hosts'] as $host) { $hostTweenBox->addItem($host['hostid'], $host['name']); } $groupsComboBox = new CComboBox('twb_groupid', $this->data['twb_groupid'], 'submit()'); foreach ($this->data['all_groups'] as $group) { $groupsComboBox->addItem($group['groupid'], $group['name']); } $hostTable = new CTable(null, 'formElementTable'); $hostTable->addRow($hostTweenBox->get(_('In maintenance'), array(_('Other hosts | Group') . SPACE, $groupsComboBox))); $hostsAndGroupsFormList->addRow(_('Hosts in maintenance'), $hostTable); $groupTable = new CTable(null, 'formElementTable'); $groupTweenBox = new CTweenBox($maintenanceForm, 'groupids', $this->data['groupids'], 10); foreach ($this->data['all_groups'] as $group) { $groupTweenBox->addItem($group['groupid'], $group['name']);
** 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/configuration.triggers.expression.js.php'; $expressionWidget = new CWidget(); // create form $expressionForm = new CForm(); $expressionForm->setName('expression'); $expressionForm->addVar('dstfrm', $this->data['dstfrm']); $expressionForm->addVar('dstfld1', $this->data['dstfld1']); $expressionForm->addVar('itemid', $this->data['itemid']); if (!empty($this->data['parent_discoveryid'])) { $expressionForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']); } // create form list $expressionFormList = new CFormList('expressionFormList'); // append item to form list $item = array(new CTextBox('description', $this->data['description'], ZBX_TEXTBOX_STANDARD_SIZE, 'yes'), new CButton('select', _('Select'), 'return PopUp(\'popup.php?writeonly=1&dstfrm=' . $expressionForm->getName() . '&dstfld1=itemid&dstfld2=description&submitParent=1' . (!empty($this->data['parent_discoveryid']) ? '&normal_only=1' : '') . '&srctbl=items&srcfld1=itemid&srcfld2=name\', 0, 0, \'zbx_popup_item\');', 'formlist')); if (!empty($this->data['parent_discoveryid'])) { $item[] = new CButton('select', _('Select prototype'), 'return PopUp(\'popup.php?dstfrm=' . $expressionForm->getName() . '&dstfld1=itemid&dstfld2=description&submitParent=1' . url_param('parent_discoveryid', true) . '&srctbl=prototypes&srcfld1=itemid&srcfld2=name\', 0, 0, \'zbx_popup_item\');', 'formlist'); } $expressionFormList->addRow(_('Item'), $item); // append function to form list $functionComboBox = new CComboBox('expr_type', $this->data['expr_type'], 'submit()'); $functionComboBox->addStyle('width: 605px;'); foreach ($this->data['functions'] as $id => $f) { // if user has selected an item, we are filtering out the triggers that can't work with it if (empty($this->data['itemValueType']) || !empty($f['allowed_types'][$this->data['itemValueType']])) { $functionComboBox->addItem($id, $f['description']); } }
** ** 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.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);
function getPermissionsFormList($rights = array(), $user_type = USER_TYPE_ZABBIX_USER, $rightsFormList = null) { // group $lists['group']['label'] = _('Host groups'); $lists['group']['read_write'] = new CListBox('groups_write', null, 15); $lists['group']['read_only'] = new CListBox('groups_read', null, 15); $lists['group']['deny'] = new CListBox('groups_deny', null, 15); $groups = get_accessible_groups_by_rights($rights, $user_type, PERM_DENY); foreach ($groups as $group) { switch ($group['permission']) { case PERM_READ: $list_name = 'read_only'; break; case PERM_READ_WRITE: $list_name = 'read_write'; break; default: $list_name = 'deny'; } $lists['group'][$list_name]->addItem($group['groupid'], $group['name']); } unset($groups); // host $lists['host']['label'] = _('Hosts'); $lists['host']['read_write'] = new CListBox('hosts_write', null, 15); $lists['host']['read_only'] = new CListBox('hosts_read', null, 15); $lists['host']['deny'] = new CListBox('hosts_deny', null, 15); $hosts = get_accessible_hosts_by_rights($rights, $user_type, PERM_DENY); foreach ($hosts as $host) { switch ($host['permission']) { case PERM_READ: $list_name = 'read_only'; break; case PERM_READ_WRITE: $list_name = 'read_write'; break; default: $list_name = 'deny'; } if (HOST_STATUS_PROXY_ACTIVE == $host['status'] || HOST_STATUS_PROXY_PASSIVE == $host['status']) { $host['host_name'] = $host['host']; } $lists['host'][$list_name]->addItem($host['hostid'], $host['host_name']); } unset($hosts); // display if (empty($rightsFormList)) { $rightsFormList = new CFormList('rightsFormList'); } $isHeaderDisplayed = false; foreach ($lists as $list) { $sLabel = ''; $row = new CRow(); foreach ($list as $class => $item) { if (is_string($item)) { $sLabel = $item; } else { $row->addItem(new CCol($item, $class)); } } $table = new CTable(_('No accessible resources'), 'right_table calculated'); if (!$isHeaderDisplayed) { $table->setHeader(array(_('Read-write'), _('Read only'), _('Deny')), 'header'); $isHeaderDisplayed = true; } $table->addRow($row); $rightsFormList->addRow($sLabel, $table); } return $rightsFormList; }
$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 */ if (empty($macros)) { $macros = array(array('macro' => '', 'value' => '')); } $macrosView = new CView('common.macros', array('macros' => $macros, 'readonly' => $isDiscovered)); $divTabs->addTab('macroTab', _('Macros'), $macrosView->render()); $inventoryFormList = new CFormList('inventorylist'); // radio buttons for inventory type choice $inventoryMode = isset($dbHost['inventory']['inventory_mode']) ? $dbHost['inventory']['inventory_mode'] : HOST_INVENTORY_DISABLED; $inventoryDisabledBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_DISABLED, null, 'host_inventory_radio_' . HOST_INVENTORY_DISABLED, $inventoryMode == HOST_INVENTORY_DISABLED); $inventoryDisabledBtn->setEnabled(!$isDiscovered); $inventoryManualBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_MANUAL, null, 'host_inventory_radio_' . HOST_INVENTORY_MANUAL, $inventoryMode == HOST_INVENTORY_MANUAL); $inventoryManualBtn->setEnabled(!$isDiscovered); $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']] = '';
** 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. **/ $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
} } $itemWidget->addPageHeader($this->data['page_header']); // create form $itemForm = new CForm(); $itemForm->setName('itemForm'); $itemForm->addVar('form', $this->data['form']); $itemForm->addVar('hostid', $this->data['hostid']); if (!empty($this->data['parent_discoveryid'])) { $itemForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']); } if (!empty($this->data['itemid'])) { $itemForm->addVar('itemid', $this->data['itemid']); } // create form list $itemFormList = new CFormList('itemFormList'); if (!empty($this->data['templates'])) { if ($this->data['is_discovery_rule']) { $itemFormList->addRow(_('Parent discovery rules'), $this->data['templates']); } else { $itemFormList->addRow(_('Parent items'), $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, 'yes')); } else {
** 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. **/ include 'include/views/js/administration.general.triggerSeverity.js.php'; $severityTab = new CFormList('scriptsTab'); $headerDiv = new CDiv(_('Custom severity'), 'inlineblock'); $headerDiv->addStyle('width: 16.3em; margin-left: 3px; zoom:1; *display: inline;'); $severityTab->addRow(SPACE, array($headerDiv, _('Colour'))); $severityNameTB0 = new CTextBox('severity_name_0', $this->data['config']['severity_name_0']); $severityNameTB0->addStyle('width: 15em;'); $severityNameTB0->setAttribute('maxlength', 32); $severityColorTB0 = new CColor('severity_color_0', $this->data['config']['severity_color_0']); $severityTab->addRow(_('Not classified'), array($severityNameTB0, SPACE, $severityColorTB0)); $severityNameTB1 = new CTextBox('severity_name_1', $this->data['config']['severity_name_1']); $severityNameTB1->addStyle('width: 15em;'); $severityNameTB1->setAttribute('maxlength', 32); $severityColorTB1 = new CColor('severity_color_1', $this->data['config']['severity_color_1']); $severityTab->addRow(_('Information'), array($severityNameTB1, SPACE, $severityColorTB1)); $severityNameTB2 = new CTextBox('severity_name_2', $this->data['config']['severity_name_2']); $severityNameTB2->addStyle('width: 15em;');
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $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)));
** 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. **/ $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);
** 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. **/ include 'include/views/js/administration.general.iconmap.js.php'; $widget = (new CWidget())->setTitle(_('Icon mapping'))->setControls((new CForm())->cleanItems()->addItem((new CList())->addItem(makeAdministrationGeneralMenu('adm.iconmapping.php')))); $iconMapTab = new CFormList(); $name = (new CTextBox('iconmap[name]', $this->data['iconmap']['name']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)->setAttribute('maxlength', 64)->setAttribute('autofocus', 'autofocus'); $iconMapTab->addRow(_('Name'), $name); $iconMapForm = (new CForm())->addVar('form', 1); if (isset($this->data['iconmapid'])) { $iconMapForm->addVar('iconmapid', $this->data['iconmap']['iconmapid']); } $iconMapTable = (new CTable())->setAttribute('style', 'width: 100%;')->setId('iconMapTable')->setHeader(['', '', _('Inventory field'), _('Expression'), _('Icon'), '', _('Action')]); order_result($this->data['iconmap']['mappings'], 'sortorder'); $i = 0; foreach ($this->data['iconmap']['mappings'] as $mapping) { $numSpan = (new CSpan($i + 1 . ':'))->addClass('rowNum'); $profileLinksComboBox = new CComboBox('iconmap[mappings][' . $i . '][inventory_link]', $mapping['inventory_link'], null, $this->data['inventoryList']); $expressionTextBox = [(new CTextBox('iconmap[mappings][' . $i . '][expression]', $mapping['expression']))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH)->setAttribute('maxlength', 64)]; if (isset($mapping['iconmappingid'])) { $expressionTextBox[] = new CVar('iconmap[mappings][' . $i . '][iconmappingid]', $mapping['iconmappingid']);
** 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. **/ require_once dirname(__FILE__) . '/js/reports.toptriggers.js.php'; $topTriggers = (new CWidget())->setTitle(_('100 busiest triggers')); $filterForm = (new CFilter('web.toptriggers.filter.state'))->addVar('filter_from', date(TIMESTAMP_FORMAT, $this->data['filter']['filter_from']))->addVar('filter_till', date(TIMESTAMP_FORMAT, $this->data['filter']['filter_till'])); $filterColumn1 = new CFormList(); $filterColumn2 = new CFormList(); $filterColumn2->addRow(_('From'), createDateSelector('filter_from', $this->data['filter']['filter_from'])); $filterColumn2->addRow(_('Till'), createDateSelector('filter_till', $this->data['filter']['filter_till'])); $filterColumn2->addRow(null, [new CHorList([(new CButton(null, _('Today')))->onClick('javascript: setPeriod(' . REPORT_PERIOD_TODAY . ');')->addClass(ZBX_STYLE_BTN_LINK), (new CButton(null, _('Yesterday')))->onClick('javascript: setPeriod(' . REPORT_PERIOD_YESTERDAY . ');')->addClass(ZBX_STYLE_BTN_LINK), (new CButton(null, _('Current week')))->onClick('javascript: setPeriod(' . REPORT_PERIOD_CURRENT_WEEK . ');')->addClass(ZBX_STYLE_BTN_LINK), (new CButton(null, _('Current month')))->onClick('javascript: setPeriod(' . REPORT_PERIOD_CURRENT_MONTH . ');')->addClass(ZBX_STYLE_BTN_LINK), (new CButton(null, _('Current year')))->onClick('javascript: setPeriod(' . REPORT_PERIOD_CURRENT_YEAR . ');')->addClass(ZBX_STYLE_BTN_LINK)]), new CHorList([(new CButton(null, _('Last week')))->onClick('javascript: setPeriod(' . REPORT_PERIOD_LAST_WEEK . ');')->addClass(ZBX_STYLE_BTN_LINK), (new CButton(null, _('Last month')))->onClick('javascript: setPeriod(' . REPORT_PERIOD_LAST_MONTH . ');')->addClass(ZBX_STYLE_BTN_LINK), (new CButton(null, _('Last year')))->onClick('javascript: setPeriod(' . REPORT_PERIOD_LAST_YEAR . ');')->addClass(ZBX_STYLE_BTN_LINK)])]); $filterColumn1->addRow(_('Host groups'), (new CMultiSelect(['name' => 'groupids[]', 'objectName' => 'hostGroup', 'data' => $this->data['multiSelectHostGroupData'], 'popup' => ['parameters' => 'srctbl=host_groups&dstfrm=' . $filterForm->getName() . '&dstfld1=groupids_' . '&srcfld1=groupid&multiselect=1']]))->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH)); $filterColumn1->addRow(_('Hosts'), (new CMultiSelect(['name' => 'hostids[]', 'objectName' => 'hosts', 'data' => $this->data['multiSelectHostData'], 'popup' => ['parameters' => 'srctbl=hosts&dstfrm=' . $filterForm->getName() . '&dstfld1=hostids_&srcfld1=hostid' . '&real_hosts=1&multiselect=1']]))->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH)); // severities $severity_columns = [0 => [], 1 => []]; for ($severity = TRIGGER_SEVERITY_NOT_CLASSIFIED; $severity < TRIGGER_SEVERITY_COUNT; $severity++) { $severity_columns[$severity % 2][] = new CLabel([(new CCheckBox('severities[' . $severity . ']'))->setChecked(in_array($severity, $this->data['filter']['severities'])), getSeverityName($severity, $this->data['config'])], 'severities[' . $severity . ']'); } $filterColumn1->addRow(_('Severity'), (new CTable())->addRow($severity_columns[0])->addRow($severity_columns[1])); $filterForm->addColumn($filterColumn1)->addColumn($filterColumn2); $topTriggers->addItem($filterForm); // table
**/ $screenWidget = new CWidget(); $screenWidget->addPageHeader(_('CONFIGURATION OF SCREENS')); if (!empty($this->data['templateid'])) { $screenWidget->addItem(get_header_host_table('screens', $this->data['templateid'])); } // create form $screenForm = new CForm(); $screenForm->setName('screenForm'); $screenForm->addVar('form', $this->data['form']); if (!empty($this->data['screenid'])) { $screenForm->addVar('screenid', $this->data['screenid']); } $screenForm->addVar('templateid', $this->data['templateid']); // create screen form list $screenFormList = new CFormList('screenFormList'); $nameTextBox = new CTextBox('name', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE); $nameTextBox->attr('autofocus', 'autofocus'); $screenFormList->addRow(_('Name'), $nameTextBox); $screenFormList->addRow(_('Columns'), new CNumericBox('hsize', $this->data['hsize'], 3)); $screenFormList->addRow(_('Rows'), new CNumericBox('vsize', $this->data['vsize'], 3)); // append tabs to form $screenTab = new CTabView(); $screenTab->addTab('screenTab', _('Screen'), $screenFormList); $screenForm->addItem($screenTab); // append buttons to form if (isset($this->data['screenid'])) { $screenForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), array(new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete screen?'), url_param('form') . url_param('screenid') . url_param('templateid')), new CButtonCancel(url_param('templateid'))))); } else { $screenForm->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel(url_param('templateid')))); }
} else { $triggersWidget->addPageHeader(_('CONFIGURATION OF TRIGGERS')); } // create form $triggersForm = new CForm(); $triggersForm->setName('triggersForm'); $triggersForm->addVar('hostid', $this->data['hostid']); $triggersForm->addVar('action', $this->data['action']); if ($this->data['parent_discoveryid']) { $triggersForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']); } foreach ($this->data['g_triggerid'] as $triggerid) { $triggersForm->addVar('g_triggerid[' . $triggerid . ']', $triggerid); } // create form list $triggersFormList = new CFormList('triggersFormList'); // append severity to form list $severityDiv = new CSeverity(array('id' => 'priority_div', 'name' => 'priority', 'value' => $this->data['priority'])); $triggersFormList->addRow(array(_('Severity'), SPACE, new CVisibilityBox('visible[priority]', isset($this->data['visible']['priority']), 'priority_div', _('Original'))), $severityDiv); // append dependencies to form list if (empty($this->data['parent_discoveryid'])) { $dependenciesTable = new CTable(_('No dependencies defined.'), 'formElementTable'); $dependenciesTable->setAttribute('style', 'min-width: 500px;'); $dependenciesTable->setAttribute('id', 'dependenciesTable'); $dependenciesTable->setHeader(array(_('Name'), _('Action'))); foreach ($this->data['dependencies'] as $dependency) { $triggersForm->addVar('dependencies[]', $dependency['triggerid'], 'dependencies_' . $dependency['triggerid']); $hostNames = array(); foreach ($dependency['hosts'] as $host) { $hostNames[] = CHtml::encode($host['name']); $hostNames[] = ', ';
$httpTestList = array(); foreach ($httpTests as $httpTest) { $httpTestList[$httpTest['httptestid']] = $httpTest['name']; } order_result($httpTestList); $listBox = new CListBox('httpTests', null, 8); $listBox->setAttribute('disabled', 'disabled'); $listBox->addItems($httpTestList); $templateList->addRow(_('Web scenarios'), $listBox); } } $divTabs->addTab('templateTab', _('Template'), $templateList); // FULL CLONE } // } TEMPLATE WIDGET // TEMPLATES{ $tmplList = new CFormList('tmpllist'); // create linked template table $linkedTemplateTable = new CTable(_('No templates linked.'), 'formElementTable'); $linkedTemplateTable->attr('id', 'linkedTemplateTable'); $linkedTemplateTable->attr('style', 'min-width: 400px;'); $linkedTemplateTable->setHeader(array(_('Name'), _('Action'))); $ignoredTemplates = array(); foreach ($this->data['linkedTemplates'] as $template) { $tmplList->addVar('templates[]', $template['templateid']); $linkedTemplateTable->addRow(array($template['name'], array(new CSubmit('unlink[' . $template['templateid'] . ']', _('Unlink'), null, 'link_menu'), SPACE, SPACE, isset($this->data['original_templates'][$template['templateid']]) ? new CSubmit('unlink_and_clear[' . $template['templateid'] . ']', _('Unlink and clear'), null, 'link_menu') : SPACE)), null, 'conditions_' . $template['templateid']); $ignoredTemplates[$template['templateid']] = $template['name']; } $tmplList->addRow(_('Linked templates'), new CDiv($linkedTemplateTable, 'objectgroup inlineblock border_dotted ui-corner-all')); // create new linked template table $newTemplateTable = new CTable(null, 'formElementTable'); $newTemplateTable->attr('id', 'newTemplateTable');