Пример #1
0
 public function setAction($value = null)
 {
     if (!is_null($value)) {
         return parent::setAttribute('onclick', $value);
     }
     global $page;
     $confirmation = "Confirm('" . $this->msg . "')";
     if (isset($this->vars)) {
         $link = $page['file'] . '?' . $this->name . '=1' . $this->vars;
         $url = new Curl($link);
         $action = "redirect('" . $url->getUrl() . "')";
     } else {
         $action = 'true';
     }
     return parent::setAttribute('onclick', 'if (' . $confirmation . ') { return ' . $action . '; } else { return false; }');
 }
Пример #2
0
 public function setAction($value = null)
 {
     if (!is_null($value)) {
         parent::onClick($value);
         return $this;
     }
     global $page;
     $confirmation = "Confirm('" . $this->msg . "')";
     if (isset($this->vars)) {
         $link = $page['file'] . '?' . $this->name . '=1' . $this->vars;
         $action = "redirect('" . (new CUrl($link))->getUrl() . "')";
     } else {
         $action = 'true';
     }
     parent::onClick('if (' . $confirmation . ') { return ' . $action . '; } else { return false; }');
     return $this;
 }
Пример #3
0
 function bodyToString($destroy = true)
 {
     $left = new CDiv(null, 'left');
     $left->addItem(new CDiv($this->getList(), 'left_menu'));
     $link1 = new CLink('www.zabbix.com', 'http://www.zabbix.com/', null, null, true);
     $link1->setAttribute('target', '_blank');
     $link2 = new CLink('GPL v2', 'http://www.zabbix.com/license.php', null, null, true);
     $link2->setAttribute('target', '_blank');
     $licence = new CDiv(array($link1, BR(), ' Licensed under ', $link2), 'setup_wizard_licence');
     $left->addItem($licence);
     $right = new CDiv(null, 'right');
     if ($this->getStep() == 0) {
         $right->addItem(new CDiv(null, 'blank_title'));
         $right->addItem(new CDiv($this->getState(), 'blank_under_title'));
         $container = new CDiv(array($left, $right), 'setup_wizard setup_wizard_welcome');
     } else {
         $right->addItem(new CDiv($this->stage[$this->getStep()]['title'], 'setup_title'));
         $right->addItem(new CDiv($this->getState(), 'under_title'));
         $container = new CDiv(array($left, $right), 'setup_wizard');
     }
     if (isset($this->stage[$this->getStep() + 1])) {
         $next = new CSubmit('next[' . $this->getStep() . ']', _('Next') . SPACE . '»');
     } else {
         $next = new CSubmit('finish', _('Finish'));
     }
     if (isset($this->HIDE_CANCEL_BUTTON) && $this->HIDE_CANCEL_BUTTON) {
         $cancel = null;
     } else {
         $cancel = new CDiv(new CSubmit('cancel', _('Cancel')), 'footer_left');
     }
     if ($this->DISABLE_NEXT_BUTTON) {
         $next->setEnabled(false);
     }
     // if the user is not logged in (first setup run) hide the "previous" button on the final step
     if ($this->getStep() && (CWebUser::$data && CWebUser::getType() == USER_TYPE_SUPER_ADMIN || $this->getStep() < 5)) {
         $back = new CSubmit('back[' . $this->getStep() . ']', '&laquo;' . SPACE . _('Previous'));
     } else {
         $back = null;
     }
     $footer = new CDiv(array($cancel, new CDiv(array($back, $next), 'footer_right')), 'footer');
     $container->addItem($footer);
     return parent::bodyToString($destroy) . $container->ToString();
 }
/*
** 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;
    $lstGroups->attributes['style'] = 'width: 320px';
    foreach ($this->data['groups'] as $group) {
        $lstGroups->addItem($group['usrgrpid'], $group['name']);
    }
    $userFormList->addRow(_('Groups'), array($lstGroups, new CButton('add_group', _('Add'), 'return PopUp("popup_usrgrp.php?dstfrm=' . $userForm->getName() . '&list_name=user_groups_to_del[]&var_name=user_groups", 450, 450);', 'formlist'), BR(), count($this->data['user_groups']) > 0 ? new CSubmit('del_user_group', _('Delete selected'), null, 'formlist') : null));
}
// append password to form list
if ($data['auth_type'] == ZBX_AUTH_INTERNAL) {
    if (!$this->data['userid'] || isset($this->data['change_password'])) {
        $userFormList->addRow(_('Password'), new CPassBox('password1', $this->data['password1'], ZBX_TEXTBOX_SMALL_SIZE));
        $userFormList->addRow(_('Password (once again)'), new CPassBox('password2', $this->data['password2'], ZBX_TEXTBOX_SMALL_SIZE));
        if (isset($this->data['change_password'])) {
            $userForm->addVar('change_password', $this->data['change_password']);
        }
    } else {
        $passwdButton = new CSubmit('change_password', _('Change password'), null, 'formlist');
        if ($this->data['alias'] == ZBX_GUEST_USER) {
            $passwdButton->setAttribute('disabled', 'disabled');
        }
        $userFormList->addRow(_('Password'), $passwdButton);
    }
} else {
    $userFormList->addRow(_('Password'), new CSpan(_s('Unavailable for users with %1$s.', authentication2str($data['auth_type']))));
}
// append languages to form list
$languageComboBox = new CComboBox('lang', $this->data['lang']);
$allLocalesAvailable = true;
foreach (getLocales() as $localeId => $locale) {
    if ($locale['display']) {
        // checking if this locale exists in the system. The only way of doing it is to try and set one
        // trying to set only the LC_MONETARY locale to avoid changing LC_NUMERIC
Пример #6
0
 * Display
 */
$latestWidget = new CWidget(null, 'latest-mon');
$latestWidget->addHeader(_('Items'));
$filterForm = new CForm('get');
$filterForm->setAttribute('name', ' zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterTable = new CTable(null, 'filter');
$filterTable->setCellPadding(0);
$filterTable->setCellSpacing(0);
$filterTable->addRow(array(new CCol(bold(_('Host groups') . ':'), 'label'), new CCol(new CMultiSelect(array('name' => 'groupids[]', 'objectName' => 'hostGroup', 'data' => $multiSelectHostGroupData, 'popup' => array('parameters' => 'srctbl=host_groups&dstfrm=' . $filterForm->getName() . '&dstfld1=groupids_' . '&srcfld1=groupid&multiselect=1', 'width' => 450, 'height' => 450, 'buttonClass' => 'input filter-multiselect-select-button'))), 'inputcol'), new CCol(bold(_('Name') . ':'), 'label'), new CCol(new CTextBox('select', $filter['select'], 40), 'inputcol')));
$filterTable->addRow(array(new CCol(bold(_('Hosts') . ':'), 'label'), new CCol(new CMultiSelect(array('name' => 'hostids[]', 'objectName' => 'hosts', 'data' => $multiSelectHostData, 'popup' => array('parameters' => 'srctbl=hosts&dstfrm=' . $filterForm->getName() . '&dstfld1=hostids_&srcfld1=hostid' . '&real_hosts=1&multiselect=1', 'width' => 450, 'height' => 450, 'buttonClass' => 'input filter-multiselect-select-button'))), 'inputcol'), new CCol(bold(_('Show items without data') . ':'), 'label'), new CCol(new CCheckBox('show_without_data', $filter['showWithoutData'], null, 1), 'inputcol')));
$filterTable->addRow(array(new CCol(bold(_('Application') . ':'), 'label'), new CCol(array(new CTextBox('application', $filter['application']), new CButton('application_name', _('Select'), 'return PopUp("popup.php?srctbl=applications&srcfld1=name&real_hosts=1&dstfld1=application' . '&with_applications=1&dstfrm=' . $filterForm->getName() . '");', 'filter-select-button')), 'inputcol'), new CCol(bold(_('Show details') . ':'), 'label'), new CCol(new CCheckBox('show_details', $filter['showDetails'], null, 1), 'inputcol')));
$filterButton = new CSubmit('filter_set', _('Filter'), 'chkbxRange.clearSelectedOnFilterChange();');
$filterButton->useJQueryStyle();
$resetButton = new CSubmit('filter_rst', _('Reset'), 'chkbxRange.clearSelectedOnFilterChange();');
$resetButton->useJQueryStyle();
$divButtons = new CDiv(array($filterButton, SPACE, $resetButton));
$divButtons->setAttribute('style', 'padding: 4px 0px;');
$filterTable->addRow(new CCol($divButtons, 'controls', 4));
$filterForm->addItem($filterTable);
$latestWidget->addFlicker($filterForm, CProfile::get('web.latest.filter.state', 0));
$latestWidget->addPageHeader(_('LATEST DATA'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])));
$form = new CForm('GET', 'history.php');
$form->setName('items');
// set an ID for the hidden input so that it wouldn't conflict with the ID of the "Go" button list
$form->addItem(new CVar('action', HISTORY_BATCH_GRAPH, 'action-hidden'));
// table
$table = new CTableInfo($filterSet ? _('No values found.') : _('Specify some filter condition to see the values.'));
if ($singleHostSelected) {
    $hostHeader = null;
Пример #7
0
        $group['nodename'] = get_node_name_by_elid($group['groupid'], true, ': ');
    }
    unset($group);
    $sortFields = array(array('field' => 'nodename', 'order' => ZBX_SORT_UP), array('field' => 'name', 'order' => ZBX_SORT_UP));
    CArrayHelper::sort($groups, $sortFields);
    $lstGroups = new CListBox('del_groups[]', null, 15);
    $lstGroups->setAttribute('style', 'width: 200px;');
    foreach ($groups as $gnum => $group) {
        $lstGroups->addItem($group['groupid'], $group['nodename'] . $group['name']);
    }
    if (!$filterEnable) {
        $lstGroups->setAttribute('disabled', 'disabled');
    }
    $addButton = new CButton('add', _('Add'), "return PopUp('popup_right.php?dstfrm=" . $dashForm->getName() . "&permission=" . PERM_READ_WRITE . "',450,450);");
    $addButton->setEnabled($filterEnable);
    $delButton = new CSubmit('delete', _('Delete selected'));
    $delButton->setEnabled($filterEnable);
    $dashList->addRow(_('Groups'), array($lstGroups, BR(), $addButton, $delButton));
}
//HOSTS
// SPACE added to extend CB width in Chrome
$cbMain = new CCheckBox('maintenance', $maintenance, null, '1');
if (!$filterEnable) {
    $cbMain->setAttribute('disabled', 'disabled');
}
$dashList->addRow(_('Hosts'), array($cbMain, _('Show hosts in maintenance')));
// Trigger
$severity = zbx_toHash($severity);
$trgSeverities = array();
$severities = array(TRIGGER_SEVERITY_NOT_CLASSIFIED, TRIGGER_SEVERITY_INFORMATION, TRIGGER_SEVERITY_WARNING, TRIGGER_SEVERITY_AVERAGE, TRIGGER_SEVERITY_HIGH, TRIGGER_SEVERITY_DISASTER);
foreach ($severities as $snum => $sever) {
$hostInventoryWidget->addHeader(_('Hosts'), $rForm);
$filterTable = new CTable('', 'filter filter-center');
// getting inventory fields to make a drop down
$inventoryFields = getHostInventories(true);
// 'true' means list should be ordered by title
$inventoryFieldsComboBox = new CComboBox('filter_field', $this->data['filterField']);
foreach ($inventoryFields as $inventoryField) {
    $inventoryFieldsComboBox->addItem($inventoryField['db_field'], $inventoryField['title']);
}
$exactComboBox = new CComboBox('filter_exact', $this->data['filterExact']);
$exactComboBox->addItem('0', _('like'));
$exactComboBox->addItem('1', _('exactly'));
$filterTable->addRow(array(array(array(bold(_('Field')), SPACE, $inventoryFieldsComboBox), array($exactComboBox, new CTextBox('filter_field_value', $this->data['filterFieldValue'], 20)))), 'host-inventories');
$filter = new CSubmit('filter_set', _('Filter'));
$filter->useJQueryStyle('main');
$reset = new CSubmit('filter_rst', _('Reset'));
$reset->useJQueryStyle();
$divButtons = new CDiv(array($filter, SPACE, $reset));
$divButtons->setAttribute('style', 'padding: 4px 0px;');
$footerCol = new CCol($divButtons, 'controls');
$filterTable->addRow($footerCol);
$filterForm = new CForm('get');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->addItem($filterTable);
$hostInventoryWidget->addFlicker($filterForm, CProfile::get('web.hostinventories.filter.state', 0));
$hostInventoryWidget->addHeaderRowNumber();
$table = new CTableInfo(_('No hosts found.'));
$table->setHeader(array(make_sorting_header(_('Host'), 'name', $this->data['sort'], $this->data['sortorder']), _('Group'), make_sorting_header(_('Name'), 'pr_name', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'pr_type', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('OS'), 'pr_os', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Serial number A'), 'pr_serialno_a', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Tag'), 'pr_tag', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('MAC address A'), 'pr_macaddress_a', $this->data['sort'], $this->data['sortorder'])));
foreach ($this->data['hosts'] as $host) {
    $hostGroups = array();
** 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;
}
$graphFormList->addRow(_('Items'), (new CDiv($itemsTable))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR));
// append tabs to form
$graphTab = new CTabView();
if (!$this->data['form_refresh']) {
    $graphTab->setSelected(0);
}
$graphTab->addTab('graphTab', empty($this->data['parent_discoveryid']) ? _('Graph') : _('Graph prototype'), $graphFormList);
/*
 * Preview tab
 */
$graphPreviewTable = (new CTable())->addStyle('width: 100%;')->addRow((new CRow((new CDiv())->setId('previewChar')))->addClass(ZBX_STYLE_CENTER));
$graphTab->addTab('previewTab', _('Preview'), $graphPreviewTable);
// append buttons to form
if (!empty($this->data['graphid'])) {
    $updateButton = new CSubmit('update', _('Update'));
    $deleteButton = new CButtonDelete($this->data['parent_discoveryid'] ? _('Delete graph prototype?') : _('Delete graph?'), url_params(['graphid', 'parent_discoveryid', 'hostid']));
    if (!empty($this->data['templateid'])) {
        $updateButton->setEnabled(false);
        $deleteButton->setEnabled(false);
    }
    $graphTab->setFooter(makeFormFooter($updateButton, [new CSubmit('clone', _('Clone')), $deleteButton, new CButtonCancel(url_param('parent_discoveryid') . url_param('hostid', $this->data['hostid']))]));
} else {
    $graphTab->setFooter(makeFormFooter(new CSubmit('add', _('Add')), [new CButtonCancel(url_param('parent_discoveryid') . url_param('hostid', $this->data['hostid']))]));
}
// insert js (depended from some variables inside the file)
insert_show_color_picker_javascript();
require_once dirname(__FILE__) . '/js/configuration.graph.edit.js.php';
$graphForm->addItem($graphTab);
// append form to widget
$widget->addItem($graphForm);
$graphTab = new CTabView();
if (!$this->data['form_refresh']) {
    $graphTab->setSelected(0);
}
$graphTab->addTab('graphTab', empty($this->data['parent_discoveryid']) ? _('Graph') : _('Graph prototype'), $graphFormList);
/*
 * Preview tab
 */
$chartImage = new CImg('chart3.php?period=3600');
$chartImage->preload();
$graphPreviewTable = new CTable(null, 'graph');
$graphPreviewTable->addRow(new CDiv($chartImage, null, 'previewChar'));
$graphTab->addTab('previewTab', _('Preview'), $graphPreviewTable);
$graphForm->addItem($graphTab);
// append buttons to form
$saveButton = new CSubmit('save', _('Save'));
$cancelButton = new CButtonCancel(url_param('parent_discoveryid'));
if (!empty($this->data['graphid'])) {
    $deleteButton = new CButtonDelete($this->data['parent_discoveryid'] ? _('Delete graph prototype?') : _('Delete graph?'), url_params(array('graphid', 'parent_discoveryid', 'hostid')));
    $cloneButton = new CSubmit('clone', _('Clone'));
    if (!empty($this->data['templateid'])) {
        $saveButton->setEnabled(false);
        $deleteButton->setEnabled(false);
    }
    $graphForm->addItem(makeFormFooter($saveButton, array($cloneButton, $deleteButton, $cancelButton)));
} else {
    $graphForm->addItem(makeFormFooter($saveButton, $cancelButton));
}
// insert js (depended from some variables inside the file)
insert_show_color_picker_javascript();
require_once dirname(__FILE__) . '/js/configuration.graph.edit.js.php';
Пример #12
0
        }
    }
    $col = new CCol($result);
    $col->setAttribute('style', $style);
    $resultTable->addRow(new CRow(array($e['list'], $col)));
}
$result = '-';
$style = 'text-align: center;';
if ($allowedTesting && $test) {
    if (evalExpressionData($expression, $macrosData)) {
        $result = 'TRUE';
        $style = 'background-color: #ccf; color: #00f;';
    } else {
        $result = 'FALSE';
        $style = 'background-color: #fcc; color: #f00;';
    }
}
$col = new CCol($result);
$col->setAttribute('style', $style);
$resultTable->setFooter(array($outline, $col), $resultTable->headerClass);
$testForm->addRow(_('Result'), $resultTable);
// action buttons
$testButton = new CSubmit('test_expression', _('Test'));
if (!$allowedTesting) {
    $testButton->setAttribute('disabled', 'disabled');
}
$testForm->addItemToBottomRow($testButton);
$testForm->addItemToBottomRow(SPACE);
$testForm->addItemToBottomRow(new CButton('close', _('Close'), 'javascript: self.close();'));
$testForm->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
        array_push($expressionRow, $addExpressionButton);
    } else {
        // add button
        $addExpressionButton = new CSubmit('and_expression', _('And'), null, 'formlist');
        if ($this->data['limited']) {
            $addExpressionButton->setAttribute('disabled', 'disabled');
        }
        array_push($expressionRow, $addExpressionButton);
        // or button
        $orExpressionButton = new CSubmit('or_expression', _('Or'), null, 'formlist');
        if ($this->data['limited']) {
            $orExpressionButton->setAttribute('disabled', 'disabled');
        }
        array_push($expressionRow, $orExpressionButton);
        // replace button
        $replaceExpressionButton = new CSubmit('replace_expression', _('Replace'), null, 'formlist');
        if ($this->data['limited']) {
            $replaceExpressionButton->setAttribute('disabled', 'disabled');
        }
        array_push($expressionRow, $replaceExpressionButton);
    }
} elseif ($this->data['input_method'] != IM_FORCED) {
    $inputMethodToggle = new CSpan(_('Expression constructor'), 'link');
    $inputMethodToggle->setAttribute('onclick', 'javascript: ' . 'document.getElementById("toggle_input_method").value=1;' . 'document.getElementById("input_method").value=' . ($this->data['input_method'] == IM_TREE ? IM_ESTABLISHED : IM_TREE) . ';' . 'document.forms["' . $triggersForm->getName() . '"].submit();');
    $expressionRow[] = array(BR(), $inputMethodToggle);
}
$triggersFormList->addRow(_('Expression'), $expressionRow);
// append expression table to form list
if ($this->data['input_method'] == IM_TREE) {
    $expressionTable = new CTable(null, 'formElementTable');
    $expressionTable->setAttribute('style', 'min-width: 500px;');
    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', null, ZBX_TEXTBOX_SMALL_SIZE));
    } else {
        $authenticationFormList->addRow(_('Bind password'), new CSubmit('change_bind_password', _('Change password'), null, 'formlist'));
    }
    $authenticationFormList->addRow(_('Test authentication'), ' [' . _('must be a valid LDAP user') . ']');
    $authenticationFormList->addRow(_('Login'), $userComboBox);
    $authenticationFormList->addRow(_('User password'), new CPassBox('user_password', null, ZBX_TEXTBOX_SMALL_SIZE));
}
// append form list to tab
$authenticationTab = new CTabView();
$authenticationTab->addTab('authenticationTab', $this->data['title'], $authenticationFormList);
// append tab to form
$authenticationForm->addItem($authenticationTab);
// create save button
$saveButton = new CSubmit('save', _('Save'));
if ($this->data['is_authentication_type_changed']) {
    $saveButton->addAction('onclick', 'javascript: ' . 'if (Confirm("' . _('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) {
    $authenticationForm->addItem(makeFormFooter($saveButton, new CSubmit('test', _('Test'))));
} else {
    $authenticationForm->addItem(makeFormFooter($saveButton));
}
// append form to widget
$authenticationWidget->addItem($authenticationForm);
return $authenticationWidget;
Пример #15
0
 function bodyToString($destroy = true)
 {
     $left = new CDiv(null, 'left');
     $left->addItem(new CDiv(null, 'setup_logo'));
     $left->addItem(new CDiv(ZABBIX_VERSION, 'setup_version'));
     $left->addItem(new CDiv($this->getList(), 'left_menu'));
     $link1 = new CLink('www.zabbix.com', 'http://www.zabbix.com/', null, null, true);
     $link1->setAttribute('target', '_blank');
     $link2 = new CLink('GPL v2', 'http://www.zabbix.com/license.php', null, null, true);
     $link2->setAttribute('target', '_blank');
     $licence = new CDiv(array($link1, BR(), ' Licensed under ', $link2), 'setup_wizard_licence');
     $left->addItem($licence);
     $right = new CDiv(null, 'right');
     if ($this->getStep() == 0) {
         $right->addItem(new CDiv(null, 'blank_title'));
         $right->addItem(new CDiv($this->getState(), 'blank_under_title'));
         $container = new CDiv(array($left, $right), 'setup_wizard setup_wizard_welcome');
     } else {
         $right->addItem(new CDiv($this->stage[$this->getStep()]['title'], 'setup_title'));
         $right->addItem(new CDiv($this->getState(), 'under_title'));
         $container = new CDiv(array($left, $right), 'setup_wizard');
     }
     if (isset($this->stage[$this->getStep() + 1])) {
         $next = new CSubmit('next[' . $this->getStep() . ']', _('Next') . ' >>');
     } else {
         $next = new CSubmit('finish', _('Finish'));
     }
     if (isset($this->HIDE_CANCEL_BUTTON) && $this->HIDE_CANCEL_BUTTON) {
         $cancel = null;
     } else {
         $cancel = new CDiv(new CSubmit('cancel', _('Cancel')), 'footer_left');
     }
     if ($this->DISABLE_NEXT_BUTTON) {
         $next->setEnabled(false);
     }
     $footer = new CDiv(array($cancel, new CDiv(array($this->getStep() != 0 ? new CSubmit('back[' . $this->getStep() . ']', '<< ' . _('Previous')) : null, $next), 'footer_right')), 'footer');
     $container->addItem($footer);
     return parent::bodyToString($destroy) . $container->ToString();
 }
        $isCheckboxEnabled = false;
    } else {
        $name[] = new CLink($graph['name'], 'graphs.php?' . 'form=update' . '&graphid=' . $graphid . url_param('parent_discoveryid') . '&hostid=' . $this->data['hostid']);
    }
    $checkBox = new CCheckBox('group_graphid[' . $graphid . ']', null, null, $graphid);
    $checkBox->setEnabled($isCheckboxEnabled);
    $graphTable->addRow(array($checkBox, $this->data['displayNodes'] ? $graph['nodename'] : null, $hostList, $name, $graph['width'], $graph['height'], $graph['graphtype']));
}
// create go buttons
$goComboBox = new CComboBox('go');
if (!$this->data['parent_discoveryid']) {
    $goComboBox->addItem('copy_to', _('Copy selected to ...'));
}
$goOption = new CComboItem('delete', _('Delete selected'));
$goOption->setAttribute('confirm', $this->data['parent_discoveryid'] ? _('Delete selected graph prototypes?') : _('Delete selected graphs?'));
$goComboBox->addItem($goOption);
$goButton = new CSubmit('goButton', _('Go') . ' (0)');
$goButton->attr('id', 'goButton');
zbx_add_post_js('chkbxRange.pageGoName = "group_graphid";');
if ($this->data['parent_discoveryid']) {
    zbx_add_post_js('chkbxRange.prefix = "' . $this->data['parent_discoveryid'] . '";');
    zbx_add_post_js('cookie.prefix = "' . $this->data['parent_discoveryid'] . '";');
} else {
    zbx_add_post_js('chkbxRange.prefix = "' . $this->data['hostid'] . '";');
    zbx_add_post_js('cookie.prefix = "' . $this->data['hostid'] . '";');
}
// append table to form
$graphForm->addItem(array($this->data['paging'], $graphTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton))));
// append form to widget
$graphWidget->addItem($graphForm);
return $graphWidget;
    // bind password
    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);
Пример #18
0
$cn_rmv = new CIcon(_('Remove link'), 'iconminus');
$cn_rmv->setAttribute('id', 'linkRemove');
$expandMacros = new CSpan($sysmap['expand_macros'] == SYSMAP_EXPAND_MACROS_ON ? _('On') : _('Off'), 'whitelink');
$expandMacros->setAttribute('id', 'expand_macros');
$gridShow = new CSpan($sysmap['grid_show'] == SYSMAP_GRID_SHOW_ON ? _('Shown') : _('Hidden'), 'whitelink');
$gridShow->setAttribute('id', 'gridshow');
$gridAutoAlign = new CSpan($sysmap['grid_align'] == SYSMAP_GRID_ALIGN_ON ? _('On') : _('Off'), 'whitelink');
$gridAutoAlign->setAttribute('id', 'gridautoalign');
$possibleGridSizes = array(20 => '20x20', 40 => '40x40', 50 => '50x50', 75 => '75x75', 100 => '100x100');
$gridSize = new CComboBox('gridsize', $sysmap['grid_size']);
$gridSize->addItems($possibleGridSizes);
$gridAlignAll = new CSubmit('gridalignall', _('Align icons'));
$gridAlignAll->setAttribute('id', 'gridalignall');
$gridForm = new CDiv(array($gridSize, $gridAlignAll));
$gridForm->setAttribute('id', 'gridalignblock');
$saveButton = new CSubmit('save', _('Save'));
$saveButton->setAttribute('id', 'sysmap_save');
$menuRow = array(_s('Map "%s"', $sysmap['name']), SPACE . SPACE, _('Icon'), SPACE, $el_add, SPACE, $el_rmv, SPACE . SPACE, _('Link'), SPACE, $cn_add, SPACE, $cn_rmv, SPACE . SPACE, _('Expand macros') . ' [ ', $expandMacros, ' ]', SPACE . SPACE, _('Grid') . SPACE . '[', $gridShow, '|', $gridAutoAlign, ']', SPACE, $gridForm, SPACE . '|' . SPACE, $saveButton);
$elcn_tab = new CTable(null, 'textwhite');
$elcn_tab->addRow($menuRow);
show_table_header($elcn_tab);
$sysmap_img = new CImg('images/general/tree/zero.gif', 'Sysmap');
$sysmap_img->setAttribute('id', 'sysmap_img', $sysmap['width'], $sysmap['height']);
$table = new CTable();
$table->addRow($sysmap_img);
$table->Show();
$container = new CDiv();
$container->setAttribute('id', 'sysmap_cnt');
$container->Show();
insert_show_color_picker_javascript();
add_elementNames($sysmap['selements']);
Пример #19
0
function getItemFilterForm(&$items)
{
    $filter_groupId = $_REQUEST['filter_groupid'];
    $filter_hostId = $_REQUEST['filter_hostid'];
    $filter_application = $_REQUEST['filter_application'];
    $filter_name = $_REQUEST['filter_name'];
    $filter_type = $_REQUEST['filter_type'];
    $filter_key = $_REQUEST['filter_key'];
    $filter_snmp_community = $_REQUEST['filter_snmp_community'];
    $filter_snmpv3_securityname = $_REQUEST['filter_snmpv3_securityname'];
    $filter_snmp_oid = $_REQUEST['filter_snmp_oid'];
    $filter_port = $_REQUEST['filter_port'];
    $filter_value_type = $_REQUEST['filter_value_type'];
    $filter_data_type = $_REQUEST['filter_data_type'];
    $filter_delay = $_REQUEST['filter_delay'];
    $filter_history = $_REQUEST['filter_history'];
    $filter_trends = $_REQUEST['filter_trends'];
    $filter_status = $_REQUEST['filter_status'];
    $filter_state = $_REQUEST['filter_state'];
    $filter_templated_items = $_REQUEST['filter_templated_items'];
    $filter_with_triggers = $_REQUEST['filter_with_triggers'];
    $subfilter_hosts = $_REQUEST['subfilter_hosts'];
    $subfilter_apps = $_REQUEST['subfilter_apps'];
    $subfilter_types = $_REQUEST['subfilter_types'];
    $subfilter_value_types = $_REQUEST['subfilter_value_types'];
    $subfilter_status = $_REQUEST['subfilter_status'];
    $subfilter_state = $_REQUEST['subfilter_state'];
    $subfilter_templated_items = $_REQUEST['subfilter_templated_items'];
    $subfilter_with_triggers = $_REQUEST['subfilter_with_triggers'];
    $subfilter_history = $_REQUEST['subfilter_history'];
    $subfilter_trends = $_REQUEST['subfilter_trends'];
    $subfilter_interval = $_REQUEST['subfilter_interval'];
    $form = new CForm('get');
    $form->setAttribute('name', 'zbx_filter');
    $form->setAttribute('id', 'zbx_filter');
    $form->addVar('subfilter_hosts', $subfilter_hosts);
    $form->addVar('subfilter_apps', $subfilter_apps);
    $form->addVar('subfilter_types', $subfilter_types);
    $form->addVar('subfilter_value_types', $subfilter_value_types);
    $form->addVar('subfilter_status', $subfilter_status);
    $form->addVar('subfilter_state', $subfilter_state);
    $form->addVar('subfilter_templated_items', $subfilter_templated_items);
    $form->addVar('subfilter_with_triggers', $subfilter_with_triggers);
    $form->addVar('subfilter_history', $subfilter_history);
    $form->addVar('subfilter_trends', $subfilter_trends);
    $form->addVar('subfilter_interval', $subfilter_interval);
    // type select
    $fTypeVisibility = array();
    $cmbType = new CComboBox('filter_type', $filter_type);
    $cmbType->setAttribute('id', 'filter_type');
    $cmbType->addItem(-1, _('all'));
    foreach (array('filter_delay_label', 'filter_delay') as $vItem) {
        zbx_subarray_push($fTypeVisibility, -1, $vItem);
    }
    $itemTypes = item_type2str();
    unset($itemTypes[ITEM_TYPE_HTTPTEST]);
    // httptest items are only for internal zabbix logic
    $cmbType->addItems($itemTypes);
    foreach ($itemTypes as $typeNum => $typeLabel) {
        if ($typeNum != ITEM_TYPE_TRAPPER) {
            zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay_label');
            zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay');
        }
        switch ($typeNum) {
            case ITEM_TYPE_SNMPV1:
            case ITEM_TYPE_SNMPV2C:
                $snmp_types = array('filter_snmp_community_label', 'filter_snmp_community', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_port_label', 'filter_port');
                foreach ($snmp_types as $vItem) {
                    zbx_subarray_push($fTypeVisibility, $typeNum, $vItem);
                }
                break;
            case ITEM_TYPE_SNMPV3:
                foreach (array('filter_snmpv3_securityname_label', 'filter_snmpv3_securityname', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_port_label', 'filter_port') as $vItem) {
                    zbx_subarray_push($fTypeVisibility, $typeNum, $vItem);
                }
                break;
        }
    }
    zbx_add_post_js("var filterTypeSwitcher = new CViewSwitcher('filter_type', 'change', " . zbx_jsvalue($fTypeVisibility, true) . ');');
    // type of information select
    $fVTypeVisibility = array();
    $cmbValType = new CComboBox('filter_value_type', $filter_value_type);
    $cmbValType->addItem(-1, _('all'));
    $cmbValType->addItem(ITEM_VALUE_TYPE_UINT64, _('Numeric (unsigned)'));
    $cmbValType->addItem(ITEM_VALUE_TYPE_FLOAT, _('Numeric (float)'));
    $cmbValType->addItem(ITEM_VALUE_TYPE_STR, _('Character'));
    $cmbValType->addItem(ITEM_VALUE_TYPE_LOG, _('Log'));
    $cmbValType->addItem(ITEM_VALUE_TYPE_TEXT, _('Text'));
    foreach (array('filter_data_type_label', 'filter_data_type') as $vItem) {
        zbx_subarray_push($fVTypeVisibility, ITEM_VALUE_TYPE_UINT64, $vItem);
    }
    zbx_add_post_js("var filterValueTypeSwitcher = new CViewSwitcher('filter_value_type', 'change', " . zbx_jsvalue($fVTypeVisibility, true) . ');');
    // status select
    $cmbStatus = new CComboBox('filter_status', $filter_status);
    $cmbStatus->addItem(-1, _('all'));
    foreach (array(ITEM_STATUS_ACTIVE, ITEM_STATUS_DISABLED) as $status) {
        $cmbStatus->addItem($status, item_status2str($status));
    }
    // state select
    $cmbState = new CComboBox('filter_state', $filter_state);
    $cmbState->addItem(-1, _('all'));
    foreach (array(ITEM_STATE_NORMAL, ITEM_STATE_NOTSUPPORTED) as $state) {
        $cmbState->addItem($state, itemState($state));
    }
    // update interval
    $updateIntervalLabel = new CSpan(array(bold(_('Update interval')), SPACE . _('(in sec)') . NAME_DELIMITER));
    $updateIntervalLabel->setAttribute('id', 'filter_delay_label');
    $updateIntervalInput = new CNumericBox('filter_delay', $filter_delay, 5, false, true);
    $updateIntervalInput->setEnabled('no');
    // data type
    $dataTypeLabel = new CSpan(bold(_('Data type') . NAME_DELIMITER));
    $dataTypeLabel->setAttribute('id', 'filter_data_type_label');
    $dataTypeInput = new CComboBox('filter_data_type', $filter_data_type);
    $dataTypeInput->addItem(-1, _('all'));
    $dataTypeInput->addItems(item_data_type2str());
    $dataTypeInput->setEnabled('no');
    // filter table
    $table = new CTable('', 'filter');
    $table->setCellPadding(0);
    $table->setCellSpacing(0);
    // SNMP community
    $snmpCommunityLabel = new CSpan(array(bold(_('SNMP community')), SPACE . _('like') . NAME_DELIMITER));
    $snmpCommunityLabel->setAttribute('id', 'filter_snmp_community_label');
    $snmpCommunityField = new CTextBox('filter_snmp_community', $filter_snmp_community, ZBX_TEXTBOX_FILTER_SIZE);
    $snmpCommunityField->setEnabled('no');
    // SNMPv3 security name
    $snmpSecurityLabel = new CSpan(array(bold(_('Security name')), SPACE . _('like') . NAME_DELIMITER));
    $snmpSecurityLabel->setAttribute('id', 'filter_snmpv3_securityname_label');
    $snmpSecurityField = new CTextBox('filter_snmpv3_securityname', $filter_snmpv3_securityname, ZBX_TEXTBOX_FILTER_SIZE);
    $snmpSecurityField->setEnabled('no');
    // SNMP OID
    $snmpOidLabel = new CSpan(array(bold(_('SNMP OID')), SPACE . _('like') . NAME_DELIMITER));
    $snmpOidLabel->setAttribute('id', 'filter_snmp_oid_label');
    $snmpOidField = new CTextBox('filter_snmp_oid', $filter_snmp_oid, ZBX_TEXTBOX_FILTER_SIZE);
    $snmpOidField->setEnabled('no');
    // port
    $portLabel = new CSpan(array(bold(_('Port')), SPACE . _('like') . NAME_DELIMITER));
    $portLabel->setAttribute('id', 'filter_port_label');
    $portField = new CNumericBox('filter_port', $filter_port, 5, false, true);
    $portField->setEnabled('no');
    // row 1
    $groupFilter = null;
    if (!empty($filter_groupId)) {
        $getHostInfo = API::HostGroup()->get(array('groupids' => $filter_groupId, 'output' => array('name')));
        $getHostInfo = reset($getHostInfo);
        if (!empty($getHostInfo)) {
            $groupFilter[] = array('id' => $getHostInfo['groupid'], 'name' => $getHostInfo['name']);
        }
    }
    $table->addRow(array(new CCol(bold(_('Host group') . NAME_DELIMITER), 'label col1'), new CCol(array(new CMultiSelect(array('name' => 'filter_groupid', 'selectedLimit' => 1, 'objectName' => 'hostGroup', 'objectOptions' => array('editable' => true), 'data' => $groupFilter, 'popup' => array('parameters' => 'srctbl=host_groups&dstfrm=' . $form->getName() . '&dstfld1=filter_groupid' . '&srcfld1=groupid&writeonly=1', 'width' => 450, 'height' => 450, 'buttonClass' => 'input filter-multiselect-select-button')))), 'col1'), new CCol(bold(_('Type') . NAME_DELIMITER), 'label col2'), new CCol($cmbType, 'col2'), new CCol(bold(_('Type of information') . NAME_DELIMITER), 'label col3'), new CCol($cmbValType, 'col3'), new CCol(bold(_('State') . NAME_DELIMITER), 'label'), new CCol($cmbState, 'col4')), 'item-list-row');
    // row 2
    $hostFilterData = null;
    if (!empty($filter_hostId)) {
        $getHostInfo = API::Host()->get(array('hostids' => $filter_hostId, 'templated_hosts' => true, 'output' => array('name')));
        $getHostInfo = reset($getHostInfo);
        if (!empty($getHostInfo)) {
            $hostFilterData[] = array('id' => $getHostInfo['hostid'], 'name' => $getHostInfo['name']);
        }
    }
    $table->addRow(array(new CCol(bold(_('Host') . NAME_DELIMITER), 'label'), new CCol(array(new CMultiSelect(array('name' => 'filter_hostid', 'selectedLimit' => 1, 'objectName' => 'hosts', 'objectOptions' => array('editable' => true, 'templated_hosts' => true), 'data' => $hostFilterData, 'popup' => array('parameters' => 'srctbl=host_templates&dstfrm=' . $form->getName() . '&dstfld1=filter_hostid' . '&srcfld1=hostid&writeonly=1', 'width' => 450, 'height' => 450, 'buttonClass' => 'input filter-multiselect-select-button')))), 'col1'), new CCol($updateIntervalLabel, 'label'), new CCol($updateIntervalInput), new CCol($dataTypeLabel, 'label'), new CCol($dataTypeInput), new CCol(bold(_('Status') . NAME_DELIMITER), 'label col4'), new CCol($cmbStatus, 'col4')), 'item-list-row');
    // row 3
    $table->addRow(array(new CCol(bold(_('Application') . NAME_DELIMITER), 'label'), new CCol(array(new CTextBox('filter_application', $filter_application, ZBX_TEXTBOX_FILTER_SIZE), new CButton('btn_app', _('Select'), 'return PopUp("popup.php?srctbl=applications&srcfld1=name' . '&dstfrm=' . $form->getName() . '&dstfld1=filter_application' . '&with_applications=1' . '" + (jQuery("input[name=\'filter_hostid\']").length > 0 ? "&hostid="+jQuery("input[name=\'filter_hostid\']").val() : "")' . ', 550, 450, "application");', 'filter-select-button')), 'col1'), new CCol(array($snmpCommunityLabel, $snmpSecurityLabel), 'label'), new CCol(array($snmpCommunityField, $snmpSecurityField)), new CCol(array(bold(_('History')), SPACE . _('(in days)') . NAME_DELIMITER), 'label'), new CCol(new CNumericBox('filter_history', $filter_history, 8, false, true)), new CCol(bold(_('Triggers') . NAME_DELIMITER), 'label'), new CCol(new CComboBox('filter_with_triggers', $filter_with_triggers, null, array(-1 => _('all'), 1 => _('With triggers'), 0 => _('Without triggers'))))), 'item-list-row');
    // row 4
    $table->addRow(array(new CCol(array(bold(_('Name')), SPACE . _('like') . NAME_DELIMITER), 'label'), new CCol(new CTextBox('filter_name', $filter_name, ZBX_TEXTBOX_FILTER_SIZE), 'col1'), new CCol($snmpOidLabel, 'label'), new CCol($snmpOidField), new CCol(array(bold(_('Trends')), SPACE . _('(in days)') . NAME_DELIMITER), 'label'), new CCol(new CNumericBox('filter_trends', $filter_trends, 8, false, true)), new CCol(bold(_('Template') . NAME_DELIMITER), 'label'), new CCol(new CComboBox('filter_templated_items', $filter_templated_items, null, array(-1 => _('all'), 1 => _('Templated items'), 0 => _('Not Templated items'))))), 'item-list-row');
    // row 5
    $table->addRow(array(new CCol(array(bold(_('Key')), SPACE . _('like') . NAME_DELIMITER), 'label'), new CCol(new CTextBox('filter_key', $filter_key, ZBX_TEXTBOX_FILTER_SIZE), 'col1'), new CCol($portLabel, 'label'), new CCol($portField), new CCol(null, 'label'), new CCol(), new CCol(null, 'label'), new CCol()), 'item-list-row');
    $filter = new CSubmit('filter_set', _('Filter'), 'chkbxRange.clearSelectedOnFilterChange();');
    $filter->useJQueryStyle('main');
    $reset = new CSubmit('filter_rst', _('Reset'), 'chkbxRange.clearSelectedOnFilterChange();');
    $reset->useJQueryStyle();
    $div_buttons = new CDiv(array($filter, SPACE, $reset));
    $div_buttons->setAttribute('style', 'padding: 4px 0px;');
    $footer = new CCol($div_buttons, 'controls', 8);
    $table->addRow($footer);
    $form->addItem($table);
    // subfilters
    $table_subfilter = new CTable(null, 'filter sub-filter');
    // array contains subfilters and number of items in each
    $item_params = array('hosts' => array(), 'applications' => array(), 'types' => array(), 'value_types' => array(), 'status' => array(), 'state' => array(), 'templated_items' => array(), 'with_triggers' => array(), 'history' => array(), 'trends' => array(), 'interval' => array());
    // generate array with values for subfilters of selected items
    foreach ($items as $item) {
        // hosts
        if (zbx_empty($filter_hostId)) {
            $host = reset($item['hosts']);
            if (!isset($item_params['hosts'][$host['hostid']])) {
                $item_params['hosts'][$host['hostid']] = array('name' => $host['name'], 'count' => 0);
            }
            $show_item = true;
            foreach ($item['subfilters'] as $name => $value) {
                if ($name == 'subfilter_hosts') {
                    continue;
                }
                $show_item &= $value;
            }
            if ($show_item) {
                $host = reset($item['hosts']);
                $item_params['hosts'][$host['hostid']]['count']++;
            }
        }
        // applications
        if (!empty($item['applications'])) {
            foreach ($item['applications'] as $application) {
                if (!isset($item_params['applications'][$application['name']])) {
                    $item_params['applications'][$application['name']] = array('name' => $application['name'], 'count' => 0);
                }
            }
        }
        $show_item = true;
        foreach ($item['subfilters'] as $name => $value) {
            if ($name == 'subfilter_apps') {
                continue;
            }
            $show_item &= $value;
        }
        $sel_app = false;
        if ($show_item) {
            // if any of item applications are selected
            foreach ($item['applications'] as $app) {
                if (str_in_array($app['name'], $subfilter_apps)) {
                    $sel_app = true;
                    break;
                }
            }
            foreach ($item['applications'] as $app) {
                if (str_in_array($app['name'], $subfilter_apps) || !$sel_app) {
                    $item_params['applications'][$app['name']]['count']++;
                }
            }
        }
        // types
        if ($filter_type == -1) {
            if (!isset($item_params['types'][$item['type']])) {
                $item_params['types'][$item['type']] = array('name' => item_type2str($item['type']), 'count' => 0);
            }
            $show_item = true;
            foreach ($item['subfilters'] as $name => $value) {
                if ($name == 'subfilter_types') {
                    continue;
                }
                $show_item &= $value;
            }
            if ($show_item) {
                $item_params['types'][$item['type']]['count']++;
            }
        }
        // value types
        if ($filter_value_type == -1) {
            if (!isset($item_params['value_types'][$item['value_type']])) {
                $item_params['value_types'][$item['value_type']] = array('name' => itemValueTypeString($item['value_type']), 'count' => 0);
            }
            $show_item = true;
            foreach ($item['subfilters'] as $name => $value) {
                if ($name == 'subfilter_value_types') {
                    continue;
                }
                $show_item &= $value;
            }
            if ($show_item) {
                $item_params['value_types'][$item['value_type']]['count']++;
            }
        }
        // status
        if ($filter_status == -1) {
            if (!isset($item_params['status'][$item['status']])) {
                $item_params['status'][$item['status']] = array('name' => item_status2str($item['status']), 'count' => 0);
            }
            $show_item = true;
            foreach ($item['subfilters'] as $name => $value) {
                if ($name == 'subfilter_status') {
                    continue;
                }
                $show_item &= $value;
            }
            if ($show_item) {
                $item_params['status'][$item['status']]['count']++;
            }
        }
        // state
        if ($filter_state == -1) {
            if (!isset($item_params['state'][$item['state']])) {
                $item_params['state'][$item['state']] = array('name' => itemState($item['state']), 'count' => 0);
            }
            $show_item = true;
            foreach ($item['subfilters'] as $name => $value) {
                if ($name == 'subfilter_state') {
                    continue;
                }
                $show_item &= $value;
            }
            if ($show_item) {
                $item_params['state'][$item['state']]['count']++;
            }
        }
        // template
        if ($filter_templated_items == -1) {
            if ($item['templateid'] == 0 && !isset($item_params['templated_items'][0])) {
                $item_params['templated_items'][0] = array('name' => _('Not Templated items'), 'count' => 0);
            } elseif ($item['templateid'] > 0 && !isset($item_params['templated_items'][1])) {
                $item_params['templated_items'][1] = array('name' => _('Templated items'), 'count' => 0);
            }
            $show_item = true;
            foreach ($item['subfilters'] as $name => $value) {
                if ($name == 'subfilter_templated_items') {
                    continue;
                }
                $show_item &= $value;
            }
            if ($show_item) {
                if ($item['templateid'] == 0) {
                    $item_params['templated_items'][0]['count']++;
                } else {
                    $item_params['templated_items'][1]['count']++;
                }
            }
        }
        // with triggers
        if ($filter_with_triggers == -1) {
            if (count($item['triggers']) == 0 && !isset($item_params['with_triggers'][0])) {
                $item_params['with_triggers'][0] = array('name' => _('Without triggers'), 'count' => 0);
            } elseif (count($item['triggers']) > 0 && !isset($item_params['with_triggers'][1])) {
                $item_params['with_triggers'][1] = array('name' => _('With triggers'), 'count' => 0);
            }
            $show_item = true;
            foreach ($item['subfilters'] as $name => $value) {
                if ($name == 'subfilter_with_triggers') {
                    continue;
                }
                $show_item &= $value;
            }
            if ($show_item) {
                if (count($item['triggers']) == 0) {
                    $item_params['with_triggers'][0]['count']++;
                } else {
                    $item_params['with_triggers'][1]['count']++;
                }
            }
        }
        // trends
        if (zbx_empty($filter_trends)) {
            if (!isset($item_params['trends'][$item['trends']])) {
                $item_params['trends'][$item['trends']] = array('name' => $item['trends'], 'count' => 0);
            }
            $show_item = true;
            foreach ($item['subfilters'] as $name => $value) {
                if ($name == 'subfilter_trends') {
                    continue;
                }
                $show_item &= $value;
            }
            if ($show_item) {
                $item_params['trends'][$item['trends']]['count']++;
            }
        }
        // history
        if (zbx_empty($filter_history)) {
            if (!isset($item_params['history'][$item['history']])) {
                $item_params['history'][$item['history']] = array('name' => $item['history'], 'count' => 0);
            }
            $show_item = true;
            foreach ($item['subfilters'] as $name => $value) {
                if ($name == 'subfilter_history') {
                    continue;
                }
                $show_item &= $value;
            }
            if ($show_item) {
                $item_params['history'][$item['history']]['count']++;
            }
        }
        // interval
        if (zbx_empty($filter_delay) && $filter_type != ITEM_TYPE_TRAPPER) {
            if (!isset($item_params['interval'][$item['delay']])) {
                $item_params['interval'][$item['delay']] = array('name' => $item['delay'], 'count' => 0);
            }
            $show_item = true;
            foreach ($item['subfilters'] as $name => $value) {
                if ($name == 'subfilter_interval') {
                    continue;
                }
                $show_item &= $value;
            }
            if ($show_item) {
                $item_params['interval'][$item['delay']]['count']++;
            }
        }
    }
    // output
    if (zbx_empty($filter_hostId) && count($item_params['hosts']) > 1) {
        $hosts_output = prepareSubfilterOutput($item_params['hosts'], $subfilter_hosts, 'subfilter_hosts');
        $table_subfilter->addRow(array(_('Hosts'), $hosts_output));
    }
    if (!empty($item_params['applications']) && count($item_params['applications']) > 1) {
        $application_output = prepareSubfilterOutput($item_params['applications'], $subfilter_apps, 'subfilter_apps');
        $table_subfilter->addRow(array(_('Applications'), $application_output));
    }
    if ($filter_type == -1 && count($item_params['types']) > 1) {
        $type_output = prepareSubfilterOutput($item_params['types'], $subfilter_types, 'subfilter_types');
        $table_subfilter->addRow(array(_('Types'), $type_output));
    }
    if ($filter_value_type == -1 && count($item_params['value_types']) > 1) {
        $value_types_output = prepareSubfilterOutput($item_params['value_types'], $subfilter_value_types, 'subfilter_value_types');
        $table_subfilter->addRow(array(_('Type of information'), $value_types_output));
    }
    if ($filter_status == -1 && count($item_params['status']) > 1) {
        $status_output = prepareSubfilterOutput($item_params['status'], $subfilter_status, 'subfilter_status');
        $table_subfilter->addRow(array(_('Status'), $status_output));
    }
    if ($filter_state == -1 && count($item_params['state']) > 1) {
        $state_output = prepareSubfilterOutput($item_params['state'], $subfilter_state, 'subfilter_state');
        $table_subfilter->addRow(array(_('State'), $state_output));
    }
    if ($filter_templated_items == -1 && count($item_params['templated_items']) > 1) {
        $templated_items_output = prepareSubfilterOutput($item_params['templated_items'], $subfilter_templated_items, 'subfilter_templated_items');
        $table_subfilter->addRow(array(_('Template'), $templated_items_output));
    }
    if ($filter_with_triggers == -1 && count($item_params['with_triggers']) > 1) {
        $with_triggers_output = prepareSubfilterOutput($item_params['with_triggers'], $subfilter_with_triggers, 'subfilter_with_triggers');
        $table_subfilter->addRow(array(_('With triggers'), $with_triggers_output));
    }
    if (zbx_empty($filter_history) && count($item_params['history']) > 1) {
        $history_output = prepareSubfilterOutput($item_params['history'], $subfilter_history, 'subfilter_history');
        $table_subfilter->addRow(array(_('History'), $history_output));
    }
    if (zbx_empty($filter_trends) && count($item_params['trends']) > 1) {
        $trends_output = prepareSubfilterOutput($item_params['trends'], $subfilter_trends, 'subfilter_trends');
        $table_subfilter->addRow(array(_('Trends'), $trends_output));
    }
    if (zbx_empty($filter_delay) && $filter_type != ITEM_TYPE_TRAPPER && count($item_params['interval']) > 1) {
        $interval_output = prepareSubfilterOutput($item_params['interval'], $subfilter_interval, 'subfilter_interval');
        $table_subfilter->addRow(array(_('Interval'), $interval_output));
    }
    $form->addItem(new CDiv(_('Subfilter [affects only filtered data!]'), 'thin_header'));
    $form->addItem($table_subfilter);
    return $form;
}
if (!$this->data['form_refresh']) {
    $graphTab->setSelected(0);
}
$graphTab->addTab('graphTab', empty($this->data['parent_discoveryid']) ? _('Graph') : _('Graph prototype'), $graphFormList);
/*
 * Preview tab
 */
$chartImage = new CImg('chart3.php?period=3600');
$chartImage->preload();
$graphPreviewTable = new CTable(null, 'center maxwidth');
$graphPreviewTable->addRow(new CDiv($chartImage, null, 'previewChar'));
$graphTab->addTab('previewTab', _('Preview'), $graphPreviewTable);
$graphForm->addItem($graphTab);
// append buttons to form
if (!empty($this->data['graphid'])) {
    $updateButton = new CSubmit('update', _('Update'));
    $deleteButton = new CButtonDelete($this->data['parent_discoveryid'] ? _('Delete graph prototype?') : _('Delete graph?'), url_params(array('graphid', 'parent_discoveryid', 'hostid')));
    if (!empty($this->data['templateid'])) {
        $updateButton->setEnabled(false);
        $deleteButton->setEnabled(false);
    }
    $graphForm->addItem(makeFormFooter($updateButton, array(new CSubmit('clone', _('Clone')), $deleteButton, new CButtonCancel(url_param('parent_discoveryid')))));
} else {
    $graphForm->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel(url_param('parent_discoveryid'))));
}
// insert js (depended from some variables inside the file)
insert_show_color_picker_javascript();
require_once dirname(__FILE__) . '/js/configuration.graph.edit.js.php';
// append form to widget
$graphWidget->addItem($graphForm);
return $graphWidget;
    if ($result != '-') {
        $style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
    }
    $col = new CCol($result);
    $col->setAttribute('style', $style);
    $res_table->addRow(new CRow(array($e['list'], $col)));
}
$result = '-';
if ($allowedTesting && $test) {
    $result = evalExpressionData($expression, $macrosData, $octet);
}
$style = 'text-align: center;';
if ($result != '-') {
    $style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
}
$col = new CCol($result);
$col->setAttribute('style', $style);
$res_table->setFooter(array($outline, $col), $res_table->headerClass);
$frm_test->addRow(_('Result'), $res_table);
// action buttons
$btn_test = new CSubmit('test_expression', _('Test'));
if (!$allowedTesting) {
    $btn_test->setAttribute('disabled', 'disabled');
}
$frm_test->addItemToBottomRow($btn_test);
$frm_test->addItemToBottomRow(SPACE);
$btn_close = new CButton('close', _('Close'), 'javascript: self.close();');
$frm_test->addItemToBottomRow($btn_close);
$frm_test->show();
//------------------------ </FORM> ---------------------------
require_once dirname(__FILE__) . '/include/page_footer.php';
        $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'), [_('Other hosts | Group') . SPACE, $groupsComboBox]));
// append tabs to form
$hostGroupTab = new CTabView();
$hostGroupTab->addTab('hostgroupTab', _('Host group'), $hostGroupFormList);
// append buttons to form
if ($this->data['groupid'] == 0) {
    $hostGroupTab->setFooter(makeFormFooter(new CSubmit('add', _('Add')), [new CButtonCancel()]));
} else {
    $clone_button = new CSubmit('clone', _('Clone'));
    if (CWebUser::getType() != USER_TYPE_SUPER_ADMIN) {
        $clone_button->setAttribute('disabled', 'disabled');
    }
    $delete_button = new CButtonDelete(_('Delete selected group?'), url_param('form') . url_param('groupid'));
    if (!isset($this->data['deletableHostGroups'][$this->data['groupid']])) {
        $delete_button->setAttribute('disabled', 'disabled');
    }
    $hostGroupTab->setFooter(makeFormFooter(new CSubmit('update', _('Update')), [$clone_button, $delete_button, new CButtonCancel()]));
}
$hostGroupForm->addItem($hostGroupTab);
$widget->addItem($hostGroupForm);
return $widget;
            $hostTemplates[] = ', ';
        }
        if ($hostTemplates) {
            array_pop($hostTemplates);
        }
    }
    // status
    $status = new CLink(item_status2str($hostPrototype['status']), '?group_hostid=' . $hostPrototype['hostid'] . '&parent_discoveryid=' . $discoveryRule['itemid'] . '&go=' . ($hostPrototype['status'] ? 'activate' : 'disable'), itemIndicatorStyle($hostPrototype['status']));
    $hostTable->addRow(array(new CCheckBox('group_hostid[' . $hostPrototype['hostid'] . ']', null, null, $hostPrototype['hostid']), $name, new CCol($hostTemplates, 'wraptext'), $status));
}
// create go buttons
$goComboBox = new CComboBox('go');
$goOption = new CComboItem('activate', _('Activate selected'));
$goOption->setAttribute('confirm', _('Enable selected host prototypes?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('disable', _('Disable selected'));
$goOption->setAttribute('confirm', _('Disable selected host prototypes?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('delete', _('Delete selected'));
$goOption->setAttribute('confirm', _('Delete selected host prototypes?'));
$goComboBox->addItem($goOption);
$goButton = new CSubmit('goButton', _('Go') . ' (0)');
$goButton->setAttribute('id', 'goButton');
zbx_add_post_js('chkbxRange.pageGoName = "group_hostid";');
zbx_add_post_js('chkbxRange.prefix = "' . $discoveryRule['itemid'] . '";');
zbx_add_post_js('cookie.prefix = "' . $discoveryRule['itemid'] . '";');
// append table to form
$itemForm->addItem(array($this->data['paging'], $hostTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton))));
// append form to widget
$itemsWidget->addItem($itemForm);
return $itemsWidget;
$addLinkIcon->setAttribute('id', 'linkAdd');
$removeLinkIcon = new CIcon(_('Remove link'), 'iconminus');
$removeLinkIcon->setAttribute('id', 'linkRemove');
$expandMacros = new CSpan($this->data['sysmap']['expand_macros'] == SYSMAP_EXPAND_MACROS_ON ? _('On') : _('Off'), 'whitelink');
$expandMacros->setAttribute('id', 'expand_macros');
$gridShow = new CSpan($this->data['sysmap']['grid_show'] == SYSMAP_GRID_SHOW_ON ? _('Shown') : _('Hidden'), 'whitelink');
$gridShow->setAttribute('id', 'gridshow');
$gridAutoAlign = new CSpan($this->data['sysmap']['grid_align'] == SYSMAP_GRID_ALIGN_ON ? _('On') : _('Off'), 'whitelink');
$gridAutoAlign->setAttribute('id', 'gridautoalign');
$gridSize = new CComboBox('gridsize', $this->data['sysmap']['grid_size']);
$gridSize->addItems(array(20 => '20x20', 40 => '40x40', 50 => '50x50', 75 => '75x75', 100 => '100x100'));
$gridAlignAll = new CSubmit('gridalignall', _('Align icons'));
$gridAlignAll->setAttribute('id', 'gridalignall');
$gridForm = new CDiv(array($gridSize, $gridAlignAll));
$gridForm->setAttribute('id', 'gridalignblock');
$saveButton = new CSubmit('update', _('Update'));
$saveButton->setAttribute('id', 'sysmap_update');
$menuTable = new CTable(null, 'textwhite');
$menuTable->addRow(array(_s('Map "%s"', $this->data['sysmap']['name']), SPACE . SPACE, _('Icon'), SPACE, $addIcon, SPACE, $removeIcon, SPACE . SPACE, _('Link'), SPACE, $addLinkIcon, SPACE, $removeLinkIcon, SPACE . SPACE, _('Expand macros') . ' [ ', $expandMacros, ' ]', SPACE . SPACE, _('Grid') . SPACE . '[', $gridShow, '|', $gridAutoAlign, ']', SPACE, $gridForm, SPACE . '|' . SPACE, $saveButton));
$sysmapWidget->addPageHeader($menuTable);
// create map
$backgroundImage = new CImg('images/general/tree/zero.gif', 'Sysmap');
$backgroundImage->setAttribute('id', 'sysmap_img', $this->data['sysmap']['width'], $this->data['sysmap']['height']);
$backgroundImageTable = new CTable();
$backgroundImageTable->addRow($backgroundImage);
$sysmapWidget->addItem($backgroundImageTable);
$container = new CDiv();
$container->setAttribute('id', 'sysmap_cnt');
$sysmapWidget->addItem($container);
// create elements
zbx_add_post_js('ZABBIX.apps.map.run("sysmap_cnt", ' . CJs::encodeJson(array('sysmap' => $this->data['sysmap'], 'iconList' => $this->data['iconList'], 'defaultAutoIconId' => $this->data['defaultAutoIconId'], 'defaultIconId' => $this->data['defaultIconId'], 'defaultIconName' => $this->data['defaultIconName']), true) . ');');