$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
$valueMappingTab = new CTabView();
$valueMappingTab->addTab('valuemapping', _('Value mapping'), $valueMappingFormList);
$valueMappingForm->addItem($valueMappingTab);
// append buttons
if (!empty($this->data['valuemapid'])) {
    $valueMappingForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), array(new CButtonDelete($this->data['confirmMessage'], url_param('valuemapid')), new CButtonCancel())));
} else {
    $valueMappingForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), new CButtonCancel()));
}
return $valueMappingForm;
$imageForm = new CForm('post', null, 'multipart/form-data');
$imageForm->setName('imageForm');
$imageForm->addVar('form', $this->data['form']);
if (isset($this->data['imageid'])) {
    $imageForm->addVar('imageid', $this->data['imageid']);
}
$imageForm->addVar('imagetype', $this->data['imagetype']);
// append form list
$imageFormList = new CFormList('imageFormList');
$nameTextBox = new CTextBox('name', $this->data['imagename'], 64, false, 64);
$nameTextBox->attr('autofocus', 'autofocus');
$imageFormList->addRow(_('Name'), $nameTextBox);
$imageFormList->addRow(_('Upload'), new CFile('image'));
if (isset($this->data['imageid'])) {
    if ($this->data['imagetype'] == IMAGE_TYPE_BACKGROUND) {
        $imageFormList->addRow(_('Image'), new CLink(new CImg('imgstore.php?width=200&height=200&iconid=' . $this->data['imageid'], 'no image'), 'image.php?imageid=' . $this->data['imageid']));
    } else {
        $imageFormList->addRow(_('Image'), new CImg('imgstore.php?iconid=' . $this->data['imageid'], 'no image', null));
    }
}
// append tab
$imageTab = new CTabView();
$imageTab->addTab('imageTab', $this->data['imagetype'] == IMAGE_TYPE_ICON ? _('Icon') : _('Background'), $imageFormList);
$imageForm->addItem($imageTab);
// append buttons
if (isset($this->data['imageid'])) {
    $imageForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), array(new CButtonDelete(_('Delete selected image?'), url_param('form') . url_param('imageid')), new CButtonCancel())));
} else {
    $imageForm->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel()));
}
return $imageForm;
    $interfaceTable->addRow(array(_('IP address'), _('DNS name'), _('Connect to'), _('Port')));
    $connectByComboBox = new CRadioButtonList('interface[useip]', $this->data['interface']['useip']);
    $connectByComboBox->addValue(_('IP'), 1);
    $connectByComboBox->addValue(_('DNS'), 0);
    $connectByComboBox->useJQueryStyle();
    $interfaceTable->addRow(array(new CTextBox('interface[ip]', $this->data['interface']['ip'], ZBX_TEXTBOX_SMALL_SIZE, 'no', 64), new CTextBox('interface[dns]', $this->data['interface']['dns'], ZBX_TEXTBOX_SMALL_SIZE, 'no', 64), $connectByComboBox, new CTextBox('interface[port]', $this->data['interface']['port'], 18, 'no', 64)));
    $proxyFormList->addRow(_('Interface'), new CDiv($interfaceTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
}
// append hosts to form list
$hostsTweenBox = new CTweenBox($proxyForm, 'hosts', $this->data['hosts']);
foreach ($this->data['dbHosts'] as $host) {
    // show only normal hosts, and discovered hosts monitored by the current proxy
    // for new proxies display only normal hosts
    if ($this->data['proxyid'] && idcmp($this->data['proxyid'], $host['proxy_hostid']) || $host['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
        $hostsTweenBox->addItem($host['hostid'], $host['name'], null, empty($host['proxy_hostid']) || !empty($this->data['proxyid']) && bccomp($host['proxy_hostid'], $this->data['proxyid']) == 0 && $host['flags'] == ZBX_FLAG_DISCOVERY_NORMAL);
    }
}
$proxyFormList->addRow(_('Hosts'), $hostsTweenBox->get(_('Proxy hosts'), _('Other hosts')));
// append tabs to form
$proxyTab = new CTabView();
$proxyTab->addTab('proxyTab', _('Proxy'), $proxyFormList);
$proxyForm->addItem($proxyTab);
// append buttons to form
if (!empty($this->data['proxyid'])) {
    $proxyForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), array(new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete proxy?'), url_param('form') . url_param('proxyid')), new CButtonCancel())));
} else {
    $proxyForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), new CButtonCancel()));
}
// append form to widget
$proxyWidget->addItem($proxyForm);
return $proxyWidget;
foreach ($this->data['slides'] as $step => $slides) {
    $name = '';
    if (!empty($slides['screenid'])) {
        $screen = get_screen_by_screenid($slides['screenid']);
        if (!empty($screen['name'])) {
            $name = $screen['name'];
        }
    }
    $delay = new CNumericBox('slides[' . $step . '][delay]', !empty($slides['delay']) ? $slides['delay'] : '', 5, 'no', true, false);
    $delay->setAttribute('placeholder', _('default'));
    $removeButton = new CButton('remove_' . $step, _('Remove'), 'javascript: removeSlide(this);', 'link_menu');
    $removeButton->setAttribute('remove_slide', $step);
    $row = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), new CSpan($i++ . ':', 'rowNum', 'current_slide_' . $step), $name, $delay, $removeButton), 'sortable', 'slides_' . $step);
    $slideTable->addRow($row);
}
$addButtonColumn = new CCol(empty($this->data['work_slide']) ? new CButton('add', _('Add'), 'return PopUp("popup.php?srctbl=screens&srcfld1=screenid&dstfrm=' . $slideForm->getName() . '&multiselect=1", 450, 450)', 'link_menu') : null, null, 5);
$addButtonColumn->setAttribute('style', 'vertical-align: middle;');
$slideTable->addRow(new CRow($addButtonColumn, null, 'screenListFooter'));
$slideFormList->addRow(_('Slides'), new CDiv($slideTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
// append tabs to form
$slideTab = new CTabView();
$slideTab->addTab('slideTab', _('Slide'), $slideFormList);
$slideForm->addItem($slideTab);
// append buttons to form
if (empty($this->data['slideshowid'])) {
    $slideForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), new CButtonCancel()));
} else {
    $slideForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), array(new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete slide show?'), url_param('form') . url_param('slideshowid') . url_param('config')), new CButtonCancel())));
}
$slideWidget->addItem($slideForm);
return $slideWidget;
$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;
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/js/monitoring.triggerComment.js.php';
$commentWidget = new CWidget('triggerComment');
$commentWidget->addPageHeader(_('TRIGGER DESCRIPTION'));
// create form
$commentForm = new CForm();
$commentForm->setName('commentForm');
$commentForm->addVar('triggerid', $this->data['triggerid']);
// create form list
$commentFormList = new CFormList('commentFormList');
$commentTextArea = new CTextArea('comments', CMacrosResolverHelper::resolveTriggerDescription($this->data['trigger']), array('rows' => 25, 'width' => ZBX_TEXTAREA_BIG_WIDTH, 'readonly' => $this->data['isCommentExist']));
$commentTextArea->attr('autofocus', 'autofocus');
$commentFormList->addRow(_('Description'), $commentTextArea);
// append tabs to form
$commentTab = new CTabView();
$commentTab->addTab('commentTab', _s('Description for "%s".', $this->data['trigger']['description']), $commentFormList);
$commentForm->addItem($commentTab);
// append buttons to form
$updateButton = new CSubmit('update', _('Update'));
$updateButton->setEnabled(!$this->data['isCommentExist']);
if ($this->data['isCommentExist']) {
    $editButton = new CButton('edit', _('Edit'));
    $editButton->setEnabled($this->data['isTriggerEditable']);
} else {
    $editButton = null;
}
$commentForm->addItem(makeFormFooter($updateButton, array($editButton, new CButtonCancel('&triggerid=' . $this->data['triggerid']))));
$commentWidget->addItem($commentForm);
return $commentWidget;
    if (!isset($_REQUEST['stepid'])) {
        insert_js('add_httpstep(' . zbx_jsvalue($_REQUEST['dstfrm']) . ',' . zbx_jsvalue($_REQUEST['name']) . ',' . zbx_jsvalue($_REQUEST['timeout']) . ',' . zbx_jsvalue($_REQUEST['url']) . ',' . zbx_jsvalue($_REQUEST['posts']) . ',' . zbx_jsvalue($_REQUEST['variables']) . ',' . zbx_jsvalue($_REQUEST['required']) . ',' . zbx_jsvalue($_REQUEST['status_codes']) . ");\n");
    } else {
        insert_js('update_httpstep(' . zbx_jsvalue($_REQUEST['dstfrm']) . ',' . zbx_jsvalue($_REQUEST['list_name']) . ',' . zbx_jsvalue($_REQUEST['stepid']) . ',' . zbx_jsvalue($_REQUEST['name']) . ',' . zbx_jsvalue($_REQUEST['timeout']) . ',' . zbx_jsvalue($_REQUEST['url']) . ',' . zbx_jsvalue($_REQUEST['posts']) . ',' . zbx_jsvalue($_REQUEST['variables']) . ',' . zbx_jsvalue($_REQUEST['required']) . ',' . zbx_jsvalue($_REQUEST['status_codes']) . ");\n");
    }
} else {
    $httpPopupForm = new CForm();
    $httpPopupForm->addVar('dstfrm', get_request('dstfrm', null));
    $httpPopupForm->addVar('stepid', get_request('stepid', null));
    $httpPopupForm->addVar('list_name', get_request('list_name', null));
    $httpPopupForm->addVar('templated', get_request('templated', null));
    $httpPopupForm->addVar('old_name', get_request('old_name', null));
    $httpPopupForm->addVar('steps_names', get_request('steps_names', null));
    $httpPopupFormList = new CFormList('httpPopupFormList');
    $httpPopupFormList->addRow(_('Name'), new CTextBox('name', get_request('name', ''), ZBX_TEXTBOX_STANDARD_SIZE, get_request('templated', null), 64));
    $httpPopupFormList->addRow(_('URL'), new CTextBox('url', get_request('url', ''), ZBX_TEXTBOX_STANDARD_SIZE));
    $httpPopupFormList->addRow(_('Post'), new CTextArea('posts', get_request('posts', '')));
    $httpPopupFormList->addRow(_('Variables'), new CTextArea('variables', get_request('variables', '')));
    $httpPopupFormList->addRow(_('Timeout'), new CNumericBox('timeout', get_request('timeout', 15), 5));
    $httpPopupFormList->addRow(_('Required string'), new CTextBox('required', get_request('required', ''), ZBX_TEXTBOX_STANDARD_SIZE));
    $httpPopupFormList->addRow(_('Required status codes'), new CTextBox('status_codes', get_request('status_codes', ''), ZBX_TEXTBOX_STANDARD_SIZE));
    // append tabs to form
    $httpPopupTab = new CTabView();
    $httpPopupTab->addTab('scenarioStepTab', _('Step of scenario'), $httpPopupFormList);
    $httpPopupForm->addItem($httpPopupTab);
    // append buttons to form
    $stepid = get_request('stepid', null);
    $httpPopupForm->addItem(makeFormFooter(new CSubmit('save', isset($stepid) ? _('Update') : _('Add')), new CButtonCancel(null, 'close_window();')));
    $httpPopupWidget->addItem($httpPopupForm);
}
return $httpPopupWidget;
}
if (!$this->data['templated']) {
    $stepsTable->addRow((new CCol((new CButton('add_step', _('Add')))->addClass(ZBX_STYLE_BTN_LINK)))->setColSpan(8));
}
$httpStepFormList->addRow(_('Steps'), (new CDiv($stepsTable))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR));
// append tabs to form
$httpTab = (new CTabView())->addTab('scenarioTab', _('Scenario'), $httpFormList)->addTab('stepTab', _('Steps'), $httpStepFormList)->addTab('authenticationTab', _('Authentication'), $httpAuthenticationFormList);
if (!$this->data['form_refresh']) {
    $httpTab->setSelected(0);
}
// append buttons to form
if (!empty($this->data['httptestid'])) {
    $buttons = [new CSubmit('clone', _('Clone'))];
    if ($this->data['templated'] == 0) {
        $buttons[] = new CButtonDelete(_('Delete web scenario?'), url_param('form') . url_param('httptestid') . url_param('hostid'));
    }
    if ($this->data['host']['status'] == HOST_STATUS_MONITORED || $this->data['host']['status'] == HOST_STATUS_NOT_MONITORED) {
        $buttons[] = new CButtonQMessage('del_history', _('Clear history and trends'), _('History clearing can take a long time. Continue?'));
    }
    $buttons[] = new CButtonCancel();
    $httpTab->setFooter(makeFormFooter(new CSubmit('update', _('Update')), $buttons));
} else {
    $httpTab->setFooter(makeFormFooter(new CSubmit('add', _('Add')), [new CButtonCancel()]));
}
$httpForm->addItem($httpTab);
$widget->addItem($httpForm);
$this->data['agentVisibility'] = [];
zbx_subarray_push($this->data['agentVisibility'], ZBX_AGENT_OTHER, 'agent_other');
zbx_subarray_push($this->data['agentVisibility'], ZBX_AGENT_OTHER, 'row_agent_other');
require_once dirname(__FILE__) . '/js/configuration.httpconf.edit.js.php';
return $widget;
    // macro
    $macro = (new CTextBox('conditions[' . $i . '][macro]', $condition['macro'], false, 64))->setWidth(ZBX_TEXTAREA_MACRO_WIDTH)->addClass(ZBX_STYLE_UPPERCASE)->addClass('macro')->setAttribute('placeholder', '{#MACRO}')->setAttribute('data-formulaid', $condition['formulaid']);
    // value
    $value = (new CTextBox('conditions[' . $i . '][value]', $condition['value'], false, 255))->setWidth(ZBX_TEXTAREA_MACRO_VALUE_WIDTH)->setAttribute('placeholder', _('regular expression'));
    // delete button
    $deleteButtonCell = [(new CButton('conditions_' . $i . '_remove', _('Remove')))->addClass(ZBX_STYLE_BTN_LINK)->addClass('element-table-remove')];
    $row = [$formulaId, $macro, new CSpan(_('matches')), $value, (new CCol($deleteButtonCell))->addClass(ZBX_STYLE_NOWRAP)];
    $conditionTable->addRow($row, 'form_row');
}
$conditionTable->setFooter(new CCol((new CButton('macro_add', _('Add')))->addClass(ZBX_STYLE_BTN_LINK)->addClass('element-table-add')));
$conditionFormList->addRow(_('Filters'), (new CDiv($conditionTable))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('style', 'min-width: ' . ZBX_TEXTAREA_BIG_WIDTH . 'px;'));
// append tabs to form
$itemTab = (new CTabView())->addTab('itemTab', $this->data['caption'], $itemFormList)->addTab('macroTab', _('Filters'), $conditionFormList);
if (!hasRequest('form_refresh')) {
    $itemTab->setSelected(0);
}
// append buttons to form
if (!empty($this->data['itemid'])) {
    $buttons = [new CSubmit('clone', _('Clone'))];
    if (!$this->data['limited']) {
        $buttons[] = new CButtonDelete(_('Delete discovery rule?'), url_params(['form', 'groupid', 'itemid', 'parent_discoveryid', 'hostid']));
    }
    $buttons[] = new CButtonCancel(url_param('groupid') . url_param('parent_discoveryid') . url_param('hostid'));
    $itemTab->setFooter(makeFormFooter(new CSubmit('update', _('Update')), $buttons));
} else {
    $itemTab->setFooter(makeFormFooter(new CSubmit('add', _('Add')), [new CButtonCancel(url_param('groupid') . url_param('parent_discoveryid') . url_param('hostid'))]));
}
$itemForm->addItem($itemTab);
$widget->addItem($itemForm);
require_once dirname(__FILE__) . '/js/configuration.host.discovery.edit.js.php';
return $widget;
/*
** Zabbix
** Copyright (C) 2001-2015 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.
**/
$macrosForm = new CForm();
$macrosForm->setName('macrosForm');
// tab
$macrosTab = new CTabView();
$macrosView = new CView('common.macros', array('macros' => $this->get('macros')));
$macrosTab->addTab('macros', _('Macros'), $macrosView->render());
$saveButton = new CSubmit('save', _('Save'));
$saveButton->attr('data-removed-count', 0);
$saveButton->addClass('main');
$macrosForm->addItem($macrosTab);
$macrosForm->addItem(makeFormFooter(null, array($saveButton)));
return $macrosForm;
        $passwordField = array($passwordButton, $passwordBox);
    } else {
        $passwordField = new CPassBox('password', '', ZBX_TEXTBOX_SMALL_SIZE);
    }
    // append password field to form list
    if ($this->data['type'] == MEDIA_TYPE_JABBER) {
        $mediaTypeFormList->addRow(_('Jabber identifier'), new CTextBox('username', $this->data['username'], ZBX_TEXTBOX_STANDARD_SIZE));
        $mediaTypeFormList->addRow(_('Password'), $passwordField);
    } else {
        $mediaTypeFormList->addRow(_('Username'), new CTextBox('username', $this->data['username'], ZBX_TEXTBOX_STANDARD_SIZE));
        $mediaTypeFormList->addRow(_('Password'), $passwordField);
        $limitCb = new CComboBox('exec_path', $this->data['exec_path']);
        $limitCb->addItems(array(EZ_TEXTING_LIMIT_USA => _('USA (160 characters)'), EZ_TEXTING_LIMIT_CANADA => _('Canada (136 characters)')));
        $mediaTypeFormList->addRow(_('Message text limit'), $limitCb);
    }
}
$mediaTypeFormList->addRow(_('Enabled'), new CCheckBox('status', MEDIA_TYPE_STATUS_ACTIVE == $this->data['status'], null, MEDIA_TYPE_STATUS_ACTIVE));
// append form list to tab
$mediaTypeTab = new CTabView();
$mediaTypeTab->addTab('mediaTypeTab', _('Media type'), $mediaTypeFormList);
// append tab to form
$mediaTypeForm->addItem($mediaTypeTab);
// append buttons to form
if (empty($this->data['mediatypeid'])) {
    $mediaTypeForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), array(new CButtonCancel(url_param('config')))));
} else {
    $mediaTypeForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), array(new CButtonDelete(_('Delete selected media type?'), url_param('form') . url_param('mediatypeid') . url_param('config')), new CButtonCancel(url_param('config')))));
}
// append form to widget
$mediaTypeWidget->addItem($mediaTypeForm);
return $mediaTypeWidget;
Example #12
0
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;
            $operationConditionValueComboBox = new CComboBox('new_opcondition[value]', $new_opcondition['value']);
            $operationConditionValueComboBox->addItem(0, _('Not Ack'));
            $operationConditionValueComboBox->addItem(1, _('Ack'));
            $rowCondition[] = $operationConditionValueComboBox;
        }
        $newOperationConditionTable->addRow($rowCondition);
        $newOperationConditionFooter = array(new CSubmit('add_opcondition', _('Add'), null, 'link_menu'), SPACE . SPACE, new CSubmit('cancel_new_opcondition', _('Cancel'), null, 'link_menu'));
        $newOperationsTable->addRow(array(_('Operation condition'), new CDiv(array($newOperationConditionTable, $newOperationConditionFooter), 'objectgroup inlineblock border_dotted ui-corner-all')));
    }
    $footer = array(new CSubmit('add_operation', isset($this->data['new_operation']['id']) ? _('Update') : _('Add'), null, 'link_menu'), SPACE . SPACE, new CSubmit('cancel_new_operation', _('Cancel'), null, 'link_menu'));
    $operationFormList->addRow(_('Operation details'), new CDiv(array($newOperationsTable, $footer), 'objectgroup floatleft border_dotted ui-corner-all'));
}
// append tabs to form
$actionTabs = new CTabView();
if (!hasRequest('form_refresh')) {
    $actionTabs->setSelected(0);
}
$actionTabs->addTab('actionTab', _('Action'), $actionFormList);
$actionTabs->addTab('conditionTab', _('Conditions'), $conditionFormList);
$actionTabs->addTab('operationTab', _('Operations'), $operationFormList);
$actionForm->addItem($actionTabs);
// append buttons to form
$others = array();
if (!empty($this->data['actionid'])) {
    $actionForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), array(new CButton('clone', _('Clone')), new CButtonDelete(_('Delete current action?'), url_param('form') . url_param('eventsource') . url_param('actionid')), new CButtonCancel(url_param('actiontype')))));
} else {
    $actionForm->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel(url_param('actiontype'))));
}
// append form to widget
$actionWidget->addItem($actionForm);
return $actionWidget;
    $graphsLink = _('Graphs');
    $discoveryLink = _('Discovery');
    $webLink = _('Web');
}
$configurationArray = array($hostLink, new CSpan(array($applicationsLink, SPACE, '(' . $this->data['host']['applications'] . ')'), 'overview-link'), new CSpan(array($itemsLink, SPACE, '(' . $this->data['host']['items'] . ')'), 'overview-link'), new CSpan(array($triggersLink, SPACE, '(' . $this->data['host']['triggers'] . ')'), 'overview-link'), new CSpan(array($graphsLink, SPACE, '(' . $this->data['host']['graphs'] . ')'), 'overview-link'), new CSpan(array($discoveryLink, SPACE, '(' . $this->data['host']['discoveries'] . ')'), 'overview-link'), new CSpan(array($webLink, SPACE, '(' . $this->data['host']['httpTests'] . ')'), 'overview-link'));
$overviewFormList->addRow(_('Configuration'), $configurationArray);
$hostInventoriesTab = new CTabView(array('remember' => true));
$hostInventoriesTab->setSelected(0);
$hostInventoriesTab->addTab('overviewTab', _('Overview'), $overviewFormList);
/*
 * Details tab
 */
$detailsFormList = new CFormList();
$inventoryValues = false;
if ($this->data['host']['inventory']) {
    foreach ($this->data['host']['inventory'] as $key => $value) {
        if (!zbx_empty($value)) {
            $detailsFormList->addRow($this->data['tableTitles'][$key]['title'], new CSpan(zbx_str2links($value), 'text-field'));
            $inventoryValues = true;
        }
    }
}
if (!$inventoryValues) {
    $hostInventoriesTab->setDisabled(array(1));
}
$hostInventoriesTab->addTab('detailsTab', _('Details'), $detailsFormList);
// append tabs and form
$hostInventoriesForm->addItem($hostInventoriesTab);
$hostInventoriesForm->addItem(makeFormFooter(null, new CButtonCancel(url_param('groupid'))));
$hostInventoryWidget->addItem($hostInventoriesForm);
return $hostInventoryWidget;
    if (isset($this->data['change_bind_password']) || zbx_empty($this->data['config']['ldap_bind_password'])) {
        $authenticationForm->addVar('change_bind_password', 1);
        $authenticationFormList->addRow(_('Bind password'), (new CPassBox('ldap_bind_password'))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH));
    } else {
        $authenticationFormList->addRow(_('Bind password'), (new CSubmit('change_bind_password', _('Change password')))->addClass(ZBX_STYLE_BTN_GREY));
    }
    $authenticationFormList->addRow(_('Test authentication'), ' [' . _('must be a valid LDAP user') . ']');
    $authenticationFormList->addRow(_('Login'), $userComboBox);
    $authenticationFormList->addRow(_('User password'), (new CPassBox('user_password'))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH));
}
// append form list to tab
$authenticationTab = new CTabView();
$authenticationTab->addTab('authenticationTab', $this->data['title'], $authenticationFormList);
// create save button
$saveButton = new CSubmit('update', _('Update'));
if ($this->data['is_authentication_type_changed']) {
    $saveButton->onClick('javascript: if (confirm(' . CJs::encodeJson(_('Switching authentication method will reset all except this session! Continue?')) . ')) {' . 'jQuery("#authenticationForm").submit(); return true; } else { return false; }');
} elseif ($this->data['config']['authentication_type'] != ZBX_AUTH_LDAP) {
    $saveButton->setAttribute('disabled', 'true');
}
// append buttons to form
if ($this->data['config']['authentication_type'] == ZBX_AUTH_LDAP) {
    $authenticationTab->setFooter(makeFormFooter($saveButton, [new CSubmit('test', _('Test'))]));
} else {
    $authenticationTab->setFooter(makeFormFooter($saveButton));
}
// append tab to form
$authenticationForm->addItem($authenticationTab);
// append form to widget
$widget->addItem($authenticationForm);
return $widget;
}
$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']);
    }
}
foreach ($this->data['r_hosts'] as $host) {
    if ($host['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
        $hostsComboBox->addItem($host['hostid'], $host['name']);
    } else {
        $hostsComboBox->addItem($host['hostid'], $host['name'], true, false);
    }
}
$hostGroupFormList->addRow(_('Hosts'), $hostsComboBox->get(_('Hosts in'), array(_('Other hosts | Group') . SPACE, $groupsComboBox)));
// append tabs to form
$hostGroupTab = new CTabView();
$hostGroupTab->addTab('hostgroupTab', _('Host group'), $hostGroupFormList);
$hostGroupForm->addItem($hostGroupTab);
// append buttons to form
if ($this->data['groupid'] == 0) {
    $hostGroupForm->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel()));
} else {
    $deleteButton = new CButtonDelete(_('Delete selected group?'), url_param('form') . url_param('groupid'));
    if (!isset($this->data['deletableHostGroups'][$this->data['groupid']])) {
        $deleteButton->attr('disabled', 'disabled');
    }
    $hostGroupForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), array(new CSubmit('clone', _('Clone')), $deleteButton, new CButtonCancel())));
}
$hostGroupWidget->addItem($hostGroupForm);
return $hostGroupWidget;
                    } elseif ($pf['M'] == PARAM_TYPE_COUNTS) {
                        $expressionForm->addVar('paramtype', PARAM_TYPE_COUNTS);
                        $paramTypeElement = SPACE . _('Count');
                    }
                } else {
                    $expressionForm->addVar('paramtype', PARAM_TYPE_SECONDS);
                    $paramTypeElement = SPACE . _('Seconds');
                }
            }
            if ($pid == 1 && (substr($this->data['expr_type'], 0, 3) != 'str' || substr($this->data['expr_type'], 0, 6) == 'strlen') && substr($this->data['expr_type'], 0, 6) != 'regexp' && substr($this->data['expr_type'], 0, 7) != 'iregexp') {
                $paramTypeElement = SPACE . _('Seconds');
            }
            $expressionFormList->addRow($pf['C'] . ' ', array(new CNumericBox('param[' . $pid . ']', $paramValue, 10, $paramIsReadonly), $paramTypeElement));
        } else {
            $expressionFormList->addRow($pf['C'], new CTextBox('param[' . $pid . ']', $paramValue, 30));
            $expressionForm->addVar('paramtype', PARAM_TYPE_SECONDS);
        }
    }
} else {
    $expressionForm->addVar('paramtype', PARAM_TYPE_SECONDS);
    $expressionForm->addVar('param', 0);
}
$expressionFormList->addRow('N', new CTextBox('value', $this->data['value'], 10));
// append tabs to form
$expressionTab = new CTabView();
$expressionTab->addTab('expressionTab', _('Trigger expression condition'), $expressionFormList);
$expressionForm->addItem($expressionTab);
// append buttons to form
$expressionForm->addItem(makeFormFooter(array(new CSubmit('insert', _('Insert'))), array(new CButtonCancel(url_param('parent_discoveryid') . url_param('dstfrm') . url_param('dstfld1')))));
$expressionWidget->addItem($expressionForm);
return $expressionWidget;
$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']);
}
$groupTable->addRow($groupTweenBox->get(_('In maintenance'), _('Other groups')));
$hostsAndGroupsFormList->addRow(_('Groups in maintenance'), $groupTable);
// append tabs to form
$maintenanceTab = new CTabView();
if (!$this->data['form_refresh']) {
    $maintenanceTab->setSelected(0);
}
$maintenanceTab->addTab('maintenanceTab', _('Maintenance'), $maintenanceFormList);
$maintenanceTab->addTab('periodsTab', _('Periods'), $maintenancePeriodFormList);
$maintenanceTab->addTab('hostTab', _('Hosts & Groups'), $hostsAndGroupsFormList);
$maintenanceForm->addItem($maintenanceTab);
// append buttons to form
if (empty($this->data['maintenanceid'])) {
    $maintenanceForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), new CButtonCancel()));
} else {
    $maintenanceForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), array(new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete maintenance period?'), url_param('form') . url_param('maintenanceid')), new CButtonCancel())));
}
$maintenanceWidget->addItem($maintenanceForm);
return $maintenanceWidget;
/*
** Zabbix
** Copyright (C) 2001-2016 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.
**/
$this->includeJSfile('app/views/monitoring.acknowledge.edit.js.php');
$form_list = (new CFormList())->addRow(_('Message'), (new CTextArea('message'))->setWidth(ZBX_TEXTAREA_BIG_WIDTH)->setMaxLength(255)->setAttribute('autofocus', 'autofocus'));
if (array_key_exists('event', $data)) {
    $acknowledgesTable = (new CTable())->setAttribute('style', 'width: 100%;')->setHeader([_('Time'), _('User'), _('Message')]);
    foreach ($data['event']['acknowledges'] as $acknowledge) {
        $acknowledgesTable->addRow([(new CCol(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $acknowledge['clock'])))->addClass(ZBX_STYLE_NOWRAP), (new CCol(getUserFullname($acknowledge)))->addClass(ZBX_STYLE_NOWRAP), zbx_nl2br($acknowledge['message'])]);
    }
    $form_list->addRow(_('History'), (new CDiv($acknowledgesTable))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('style', 'min-width: ' . ZBX_TEXTAREA_BIG_WIDTH . 'px;'));
}
$selected_events = count($data['eventids']);
$form_list->addRow(_('Acknowledge'), (new CDiv((new CRadioButtonList('acknowledge_type', (int) $data['acknowledge_type']))->makeVertical()->addValue([_n('Only selected event', 'Only selected events', $selected_events), $selected_events > 1 ? (new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN) : null, $selected_events > 1 ? new CSup(_n('%1$s event', '%1$s events', $selected_events)) : null], ZBX_ACKNOWLEDGE_SELECTED)->addValue([_('Selected and all unacknowledged PROBLEM events'), (new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN), new CSup(_n('%1$s event', '%1$s events', $data['unack_problem_events_count']))], ZBX_ACKNOWLEDGE_PROBLEM)->addValue([_('Selected and all unacknowledged events'), (new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN), new CSup(_n('%1$s event', '%1$s events', $data['unack_events_count']))], ZBX_ACKNOWLEDGE_ALL)))->setAttribute('style', 'min-width: ' . ZBX_TEXTAREA_BIG_WIDTH . 'px;')->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR));
$footer_buttons = makeFormFooter(new CSubmitButton(_('Acknowledge'), 'action', 'acknowledge.create'), [new CRedirectButton(_('Cancel'), $data['backurl'])]);
(new CWidget())->setTitle(_('Alarm acknowledgements'))->addItem((new CForm())->setId('acknowledge_form')->addVar('eventids', $data['eventids'])->addVar('backurl', $data['backurl'])->addItem((new CTabView())->addTab('ackTab', null, $form_list)->setFooter($footer_buttons)))->show();
<?php

/*
** Zabbix
** Copyright (C) 2001-2016 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.
**/
require_once dirname(__FILE__) . '/js/administration.general.housekeeper.edit.js.php';
$widget = (new CWidget())->setTitle(_('Housekeeping'))->setControls((new CForm())->cleanItems()->addItem((new CList())->addItem(makeAdministrationGeneralMenu('adm.housekeeper.php'))));
$houseKeeperTab = (new CFormList())->addRow(new CTag('h4', true, _('Events and alerts')))->addRow(new CLabel(_('Enable internal housekeeping'), 'hk_events_mode'), (new CCheckBox('hk_events_mode'))->setChecked($data['hk_events_mode'] == 1))->addRow(new CLabel(_('Trigger data storage period (in days)'), 'hk_events_trigger'), (new CNumericBox('hk_events_trigger', $data['hk_events_trigger'], 5))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)->setEnabled($data['hk_events_mode'] == 1))->addRow(new CLabel(_('Internal data storage period (in days)'), 'hk_events_internal'), (new CNumericBox('hk_events_internal', $data['hk_events_internal'], 5))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)->setEnabled($data['hk_events_mode'] == 1))->addRow(new CLabel(_('Network discovery data storage period (in days)'), 'hk_events_discovery'), (new CNumericBox('hk_events_discovery', $data['hk_events_discovery'], 5))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)->setEnabled($data['hk_events_mode'] == 1))->addRow(new CLabel(_('Auto-registration data storage period (in days)'), 'hk_events_autoreg'), (new CNumericBox('hk_events_autoreg', $data['hk_events_autoreg'], 5))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)->setEnabled($data['hk_events_mode'] == 1))->addRow(null)->addRow(new CTag('h4', true, _('IT services')))->addRow(new CLabel(_('Enable internal housekeeping'), 'hk_services_mode'), (new CCheckBox('hk_services_mode'))->setChecked($data['hk_services_mode'] == 1))->addRow(new CLabel(_('Data storage period (in days)'), 'hk_services'), (new CNumericBox('hk_services', $data['hk_services'], 5))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)->setEnabled($data['hk_services_mode'] == 1))->addRow(null)->addRow(new CTag('h4', true, _('Audit')))->addRow(new CLabel(_('Enable internal housekeeping'), 'hk_audit_mode'), (new CCheckBox('hk_audit_mode'))->setChecked($data['hk_audit_mode'] == 1))->addRow(new CLabel(_('Data storage period (in days)'), 'hk_audit'), (new CNumericBox('hk_audit', $data['hk_audit'], 5))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)->setEnabled($data['hk_audit_mode'] == 1))->addRow(null)->addRow(new CTag('h4', true, _('User sessions')))->addRow(new CLabel(_('Enable internal housekeeping'), 'hk_sessions_mode'), (new CCheckBox('hk_sessions_mode'))->setChecked($data['hk_sessions_mode'] == 1))->addRow(new CLabel(_('Data storage period (in days)'), 'hk_sessions'), (new CNumericBox('hk_sessions', $data['hk_sessions'], 5))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)->setEnabled($data['hk_sessions_mode'] == 1))->addRow(null)->addRow(new CTag('h4', true, _('History')))->addRow(new CLabel(_('Enable internal housekeeping'), 'hk_history_mode'), (new CCheckBox('hk_history_mode'))->setChecked($data['hk_history_mode'] == 1))->addRow(new CLabel(_('Override item history period'), 'hk_history_global'), (new CCheckBox('hk_history_global'))->setChecked($data['hk_history_global'] == 1))->addRow(new CLabel(_('Data storage period (in days)'), 'hk_history'), (new CNumericBox('hk_history', $data['hk_history'], 5))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)->setEnabled($data['hk_history_global'] == 1))->addRow(null)->addRow(new CTag('h4', true, _('Trends')))->addRow(new CLabel(_('Enable internal housekeeping'), 'hk_trends_mode'), (new CCheckBox('hk_trends_mode'))->setChecked($data['hk_trends_mode'] == 1))->addRow(new CLabel(_('Override item trend period'), 'hk_trends_global'), (new CCheckBox('hk_trends_global'))->setChecked($data['hk_trends_global'] == 1))->addRow(new CLabel(_('Data storage period (in days)'), 'hk_trends'), (new CNumericBox('hk_trends', $data['hk_trends'], 5))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)->setEnabled($data['hk_trends_global'] == 1));
$houseKeeperView = (new CTabView())->addTab('houseKeeper', _('Housekeeping'), $houseKeeperTab)->setFooter(makeFormFooter(new CSubmit('update', _('Update')), [new CButton('resetDefaults', _('Reset defaults'))]));
$widget->addItem((new CForm())->addItem($houseKeeperView));
return $widget;
        $passwordField = array($passwordButton, $passwordBox);
    } else {
        $passwordField = new CPassBox('password', '', ZBX_TEXTBOX_SMALL_SIZE);
    }
    // append password field to form list
    if ($this->data['type'] == MEDIA_TYPE_JABBER) {
        $mediaTypeFormList->addRow(_('Jabber identifier'), new CTextBox('username', $this->data['username'], ZBX_TEXTBOX_STANDARD_SIZE));
        $mediaTypeFormList->addRow(_('Password'), $passwordField);
    } else {
        $mediaTypeFormList->addRow(_('Username'), new CTextBox('username', $this->data['username'], ZBX_TEXTBOX_STANDARD_SIZE));
        $mediaTypeFormList->addRow(_('Password'), $passwordField);
        $limitCb = new CComboBox('exec_path', $this->data['exec_path']);
        $limitCb->addItems(array(EZ_TEXTING_LIMIT_USA => _('USA (160 characters)'), EZ_TEXTING_LIMIT_CANADA => _('Canada (136 characters)')));
        $mediaTypeFormList->addRow(_('Message text limit'), $limitCb);
    }
}
$mediaTypeFormList->addRow(_('Enabled'), new CCheckBox('status', MEDIA_TYPE_STATUS_ACTIVE == $this->data['status'], null, MEDIA_TYPE_STATUS_ACTIVE));
// append form list to tab
$mediaTypeTab = new CTabView();
$mediaTypeTab->addTab('mediaTypeTab', _('Media type'), $mediaTypeFormList);
// append tab to form
$mediaTypeForm->addItem($mediaTypeTab);
// append buttons to form
if (!empty($this->data['mediatypeid'])) {
    $mediaTypeForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), array(new CButtonDelete(_('Delete selected media type?'), url_param('form') . url_param('mediatypeid') . url_param('config')), new CButtonCancel(url_param('config')))));
} else {
    $mediaTypeForm->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel(url_param('config'))));
}
// append form to widget
$mediaTypeWidget->addItem($mediaTypeForm);
return $mediaTypeWidget;
        }
    } else {
        $populatingItemCell = '';
    }
    $input->addStyle('float: left;');
    $populatingItem = new CSpan($populatingItemCell, 'populating_item');
    if ($inventory_mode != HOST_INVENTORY_AUTOMATIC) {
        // those links are visible only in automatic mode
        $populatingItem->addStyle('display: none');
    }
    $inventoryFormList->addRow($inventoryInfo['title'], array($input, $populatingItem));
}
// clearing the float
$clearFixDiv = new CDiv();
$clearFixDiv->addStyle('clear: both;');
$inventoryFormList->addRow('', $clearFixDiv);
$divTabs->addTab('inventoryTab', _('Host inventory'), $inventoryFormList);
$frmHost->addItem($divTabs);
/*
 * footer
 */
$others = array();
// do not display the clone and delete buttons for clone forms and new host forms
if (getRequest('hostid') && !in_array(getRequest('form'), array('clone', 'full_clone'))) {
    $others[] = new CSubmit('clone', _('Clone'));
    $others[] = new CSubmit('full_clone', _('Full clone'));
    $others[] = new CButtonDelete(_('Delete selected host?'), url_param('form') . url_param('hostid') . url_param('groupid'));
}
$others[] = new CButtonCancel(url_param('groupid'));
$frmHost->addItem(makeFormFooter(new CSubmit('save', _('Save')), $others));
return $frmHost;
Example #23
0
foreach ($eHTMLTree as $e) {
    $result = '';
    $style = null;
    if ($allowedTesting && $test && isset($e['expression'])) {
        if (evalExpressionData($e['expression']['value'], $macrosData)) {
            $result = 'TRUE';
            $style = ZBX_STYLE_GREEN;
        } else {
            $result = 'FALSE';
            $style = ZBX_STYLE_RED;
        }
    }
    $resultTable->addRow([$e['list'], (new CCol($result))->addClass($style)]);
}
$result = '';
if ($allowedTesting && $test) {
    if (evalExpressionData($expression, $macrosData)) {
        $result = 'TRUE';
        $style = ZBX_STYLE_GREEN;
    } else {
        $result = 'FALSE';
        $style = ZBX_STYLE_RED;
    }
}
$resultTable->setFooter([$outline, (new CCol($result))->addClass($style)]);
$form_list->addRow(_('Result'), (new CDiv($resultTable))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('style', 'min-width: ' . ZBX_TEXTAREA_BIG_WIDTH . 'px;'));
$tab = (new CTabView())->addTab('test_tab', null, $form_list);
$tab->setFooter(makeFormFooter((new CSubmit('test_expression', _('Test')))->setEnabled($allowedTesting), [(new CButton('close', _('Close')))->onClick('javascript: self.close();')]));
$form->addItem($tab);
$widget->addItem($form)->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
$buttons = array();
if (!empty($this->data['itemid'])) {
    array_push($buttons, new CSubmit('clone', _('Clone')));
    if (!$this->data['is_template'] && !empty($this->data['itemid']) && empty($this->data['parent_discoveryid']) && !$this->data['is_discovery_rule']) {
        array_push($buttons, new CButtonQMessage('del_history', _('Clear history and trends'), _('History clearing can take a long time. Continue?')));
    }
    if (!$this->data['limited']) {
        if ($this->data['is_discovery_rule']) {
            array_push($buttons, new CButtonDelete(_('Delete discovery rule?'), url_params(array('form', 'groupid', 'itemid', 'parent_discoveryid', 'hostid'))));
        } else {
            $buttons[] = new CButtonDelete($this->data['parent_discoveryid'] ? _('Delete item prototype?') : _('Delete item?'), url_params(array('form', 'groupid', 'itemid', 'parent_discoveryid', 'hostid')));
        }
    }
}
array_push($buttons, new CButtonCancel(url_param('groupid') . url_param('parent_discoveryid') . url_param('hostid')));
$itemForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), $buttons));
$itemWidget->addItem($itemForm);
/*
 * Visibility
 */
$this->data['typeVisibility'] = array();
$i = 0;
foreach ($this->data['delay_flex'] as $delayFlex) {
    if (!isset($delayFlex['delay']) && !isset($delayFlex['period'])) {
        continue;
    }
    foreach ($this->data['types'] as $type => $label) {
        if ($type == ITEM_TYPE_TRAPPER || $type == ITEM_TYPE_ZABBIX_ACTIVE || $type == ITEM_TYPE_SNMPTRAP) {
            continue;
        }
        zbx_subarray_push($this->data['typeVisibility'], $type, 'delay_flex[' . $i . '][delay]');
            $operationConditionValueComboBox->addItem(0, _('Not Ack'));
            $operationConditionValueComboBox->addItem(1, _('Ack'));
            $rowCondition[] = $operationConditionValueComboBox;
        }
        $newOperationConditionTable->addRow($rowCondition);
        $newOperationConditionFooter = array(new CSubmit('add_opcondition', _('Add'), null, 'link_menu'), SPACE . SPACE, new CSubmit('cancel_new_opcondition', _('Cancel'), null, 'link_menu'));
        $newOperationsTable->addRow(array(_('Operation condition'), new CDiv(array($newOperationConditionTable, $newOperationConditionFooter), 'objectgroup inlineblock border_dotted ui-corner-all')));
    }
    $footer = array(new CSubmit('add_operation', $this->data['new_operation']['action'] == 'update' ? _('Update') : _('Add'), null, 'link_menu'), SPACE . SPACE, new CSubmit('cancel_new_operation', _('Cancel'), null, 'link_menu'));
    $operationFormList->addRow(_('Operation details'), new CDiv(array($newOperationsTable, $footer), 'objectgroup inlineblock border_dotted ui-corner-all'));
}
// append tabs to form
$actionTabs = new CTabView();
if (!isset($_REQUEST['form_refresh'])) {
    $actionTabs->setSelected(0);
}
$actionTabs->addTab('actionTab', _('Action'), $actionFormList);
$actionTabs->addTab('conditionTab', _('Conditions'), $conditionFormList);
$actionTabs->addTab('operationTab', _('Operations'), $operationFormList);
$actionForm->addItem($actionTabs);
// append buttons to form
$others = array();
if (!empty($this->data['actionid'])) {
    $others[] = new CButton('clone', _('Clone'));
    $others[] = new CButtonDelete(_('Delete current action?'), url_param('form') . url_param('eventsource') . url_param('actionid'));
}
$others[] = new CButtonCancel(url_param('actiontype'));
$actionForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), $others));
// append form to widget
$actionWidget->addItem($actionForm);
return $actionWidget;
    $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']);
    }
    $iconsComboBox = new CComboBox('iconmap[mappings][' . $i . '][iconid]', $mapping['iconid'], null, $this->data['iconList']);
    $iconsComboBox->addClass('mappingIcon');
    $iconPreviewImage = (new CImg('imgstore.php?iconid=' . $mapping['iconid'] . '&width=' . ZBX_ICON_PREVIEW_WIDTH . '&height=' . ZBX_ICON_PREVIEW_HEIGHT, _('Preview'), null, null))->addClass('preview')->addClass(ZBX_STYLE_CURSOR_POINTER)->setAttribute('data-image-full', 'imgstore.php?iconid=' . $mapping['iconid']);
    $iconMapTable->addRow((new CRow([(new CCol((new CDiv())->addClass(ZBX_STYLE_DRAG_ICON)))->addClass(ZBX_STYLE_TD_DRAG_ICON), $numSpan, $profileLinksComboBox, $expressionTextBox, $iconsComboBox, $iconPreviewImage, (new CCol((new CButton('remove', _('Remove')))->addClass(ZBX_STYLE_BTN_LINK)->addClass('removeMapping')))->addClass(ZBX_STYLE_NOWRAP)]))->addClass('sortable')->setId('iconmapidRow_' . $i));
    $i++;
}
// add row button
$iconMapTable->addRow((new CRow([(new CCol((new CButton('addMapping', _('Add')))->addClass(ZBX_STYLE_BTN_LINK)))->setColSpan(7)]))->setId('iconMapListFooter'));
// <default icon row>
$iconsComboBox = new CComboBox('iconmap[default_iconid]', $this->data['iconmap']['default_iconid'], null, $this->data['iconList']);
$iconsComboBox->addClass('mappingIcon');
$iconPreviewImage = (new CImg('imgstore.php?iconid=' . $this->data['iconmap']['default_iconid'] . '&width=' . ZBX_ICON_PREVIEW_WIDTH . '&height=' . ZBX_ICON_PREVIEW_HEIGHT, _('Preview'), null, null))->addClass(ZBX_STYLE_CURSOR_POINTER)->addClass('preview')->setAttribute('data-image-full', 'imgstore.php?iconid=' . $this->data['iconmap']['default_iconid']);
$iconMapTable->addRow([(new CCol(_('Default')))->setColSpan(4), $iconsComboBox, $iconPreviewImage]);
// </default icon row>
$iconMapTab->addRow(_('Mappings'), (new CDiv($iconMapTable))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('style', 'min-width: ' . ZBX_TEXTAREA_BIG_WIDTH . 'px;'));
$iconMapView = new CTabView();
$iconMapView->addTab('iconmap', _('Icon map'), $iconMapTab);
// footer
if (isset($this->data['iconmapid'])) {
    $iconMapView->setFooter(makeFormFooter(new CSubmit('update', _('Update')), [new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete icon map?'), url_param('form') . url_param('iconmapid')), new CButtonCancel()]));
} else {
    $iconMapView->setFooter(makeFormFooter(new CSubmit('add', _('Add')), [new CButtonCancel()]));
}
$iconMapForm->addItem($iconMapView);
$widget->addItem($iconMapForm);
return $widget;
$itemFormList = new CFormList('itemFormList');
// append type to form list
$copyTypeComboBox = new CComboBox('copy_type', $this->data['copy_type'], 'submit()');
$copyTypeComboBox->addItem(0, _('Hosts'));
$copyTypeComboBox->addItem(1, _('Host groups'));
$itemFormList->addRow(_('Target type'), $copyTypeComboBox);
// append targets to form list
$targetList = array();
if ($this->data['copy_type'] == 0) {
    $groupComboBox = new CComboBox('copy_groupid', $this->data['copy_groupid'], 'submit()');
    foreach ($this->data['groups'] as $group) {
        $groupComboBox->addItem($group['groupid'], $group['name']);
    }
    $itemFormList->addRow(_('Group'), $groupComboBox);
    foreach ($this->data['hosts'] as $host) {
        array_push($targetList, array(new CCheckBox('copy_targetid[' . $host['hostid'] . ']', uint_in_array($host['hostid'], $this->data['copy_targetid']), null, $host['hostid']), SPACE, $host['name'], BR()));
    }
} else {
    foreach ($this->data['groups'] as $group) {
        array_push($targetList, array(new CCheckBox('copy_targetid[' . $group['groupid'] . ']', uint_in_array($group['groupid'], $this->data['copy_targetid']), null, $group['groupid']), SPACE, $group['name'], BR()));
    }
}
$itemFormList->addRow(_('Target'), !empty($targetList) ? $targetList : SPACE);
// append tabs to form
$itemTab = new CTabView();
$itemTab->addTab('itemTab', count($this->data['group_itemid']) . ' ' . _('elements copy to ...'), $itemFormList);
$itemForm->addItem($itemTab);
// append buttons to form
$itemForm->addItem(makeFormFooter(new CSubmit('copy', _('Copy')), new CButtonCancel(url_param('groupid') . url_param('hostid') . url_param('config'))));
$itemWidget->addItem($itemForm);
return $itemWidget;
$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'))));
}
$screenWidget->addItem($screenForm);
return $screenWidget;
    $dependenciesTable->setHeader(array(_('Name'), _('Action')));
    foreach ($this->data['dependencies'] as $dependency) {
        $triggersForm->addVar('dependencies[]', $dependency['triggerid'], 'dependencies_' . $dependency['triggerid']);
        $hostNames = array();
        foreach ($dependency['hosts'] as $host) {
            $hostNames[] = CHtml::encode($host['name']);
            $hostNames[] = ', ';
        }
        array_pop($hostNames);
        if ($dependency['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
            $description = new CLink(array($hostNames, NAME_DELIMITER, CHtml::encode($dependency['description'])), 'triggers.php?form=update&hostid=' . $dependency['hostid'] . '&triggerid=' . $dependency['triggerid']);
            $description->setAttribute('target', '_blank');
        } else {
            $description = array($hostNames, NAME_DELIMITER, $dependency['description']);
        }
        $row = new CRow(array($description, new CButton('remove', _('Remove'), 'javascript: removeDependency(\'' . $dependency['triggerid'] . '\');', 'link_menu')));
        $row->setAttribute('id', 'dependency_' . $dependency['triggerid']);
        $dependenciesTable->addRow($row);
    }
    $dependenciesDiv = new CDiv(array($dependenciesTable, new CButton('btn1', _('Add'), 'return PopUp("popup.php?' . 'dstfrm=massupdate' . '&dstact=add_dependency' . '&reference=deptrigger' . '&dstfld1=new_dependency' . '&srctbl=triggers' . '&objname=triggers' . '&srcfld1=triggerid' . '&multiselect=1' . '&with_triggers=1", 1000, 700);', 'link_menu')), 'objectgroup inlineblock border_dotted ui-corner-all');
    $dependenciesDiv->setAttribute('id', 'dependencies_div');
    $triggersFormList->addRow(array(_('Replace dependencies'), SPACE, new CVisibilityBox('visible[dependencies]', isset($this->data['visible']['dependencies']), 'dependencies_div', _('Original'))), $dependenciesDiv);
}
// append tabs to form
$triggersTab = new CTabView();
$triggersTab->addTab('triggersTab', _('Mass update'), $triggersFormList);
$triggersForm->addItem($triggersTab);
// append buttons to form
$triggersForm->addItem(makeFormFooter(new CSubmit('massupdate', _('Update')), new CButtonCancel(url_params(array('groupid', 'hostid', 'parent_discoveryid')))));
$triggersWidget->addItem($triggersForm);
return $triggersWidget;
$imageForm->setName('imageForm');
$imageForm->addVar('form', $this->data['form']);
$imageForm->addVar('imageid', $this->data['imageid']);
$imageComboBox = new CComboBox('imagetype', $this->data['imagetype']);
$imageComboBox->addItem(IMAGE_TYPE_ICON, _('Icon'));
$imageComboBox->addItem(IMAGE_TYPE_BACKGROUND, _('Background'));
// append form list
$imageFormList = new CFormList('imageFormList');
$nameTextBox = new CTextBox('name', $this->data['imagename'], 64, 'no', 64);
$nameTextBox->attr('autofocus', 'autofocus');
$imageFormList->addRow(_('Name'), $nameTextBox);
$imageFormList->addRow(_('Type'), $imageComboBox);
$imageFormList->addRow(_('Upload'), new CFile('image'));
if (!empty($this->data['imageid'])) {
    if ($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', _('Image'), $imageFormList);
$imageForm->addItem($imageTab);
// append buttons
if (empty($this->data['imageid'])) {
    $imageForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), new CButtonCancel()));
} else {
    $imageForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), array(new CButtonDelete(_('Delete selected image?'), url_param('form') . url_param('imageid')), new CButtonCancel())));
}
return $imageForm;