}
    $addButton = new CButton('add', S_ADD, "return PopUp('popup_right.php?dstfrm=" . $dashForm->getName() . "&permission=" . PERM_READ_WRITE . "',450,450);");
    if (!$filterEnable) {
        $addButton->setAttribute('disabled', 'disabled');
    }
    $delButton = new CButton('delete', S_DELETE_SELECTED);
    if (!$filterEnable) {
        $delButton->setAttribute('disabled', 'disabled');
    }
    $dashForm->addRow(S_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');
}
$dashForm->addRow(S_HOSTS, array($cbMain, S_SHOW_HOSTS_IN_MAINTENANCE));
// Trigger
$severity = zbx_toHash($severity);
$trgSeverities = array();
$severities = array(TRIGGER_SEVERITY_NOT_CLASSIFIED, TRIGGER_SEVERITY_INFORMATION, TRIGGER_SEVERITY_WARNING, TRIGGER_SEVERITY_AVERAGE, TRIGGER_SEVERITY_HIGH, TRIGGER_SEVERITY_DISASTER);
foreach ($severities as $snum => $sever) {
    $cb = new CCheckBox('trgSeverity[' . $sever . ']', isset($severity[$sever]), '', 1);
    $cb->setEnabled($filterEnable);
    $trgSeverities[] = array($cb, getSeverityCaption($sever));
    $trgSeverities[] = BR();
}
array_pop($trgSeverities);
$dashForm->addRow(S_TRIGGERS_WITH_SEVERITY, $trgSeverities);
$config = select_config();
Exemple #2
0
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
$rulesTable = new CTable(null, 'formElementTable');
$rulesTable->setHeader(array(SPACE, _('Update existing'), _('Add missing')), 'bold');
$titles = array('groups' => _('Groups'), 'hosts' => _('Hosts'), 'templates' => _('Templates'), 'templateScreens' => _('Template screens'), 'templateLinkage' => _('Template linkage'), 'items' => _('Items'), 'discoveryRules' => _('Discovery rules'), 'triggers' => _('Triggers'), 'graphs' => _('Graphs'), 'screens' => _('Screens'), 'maps' => _('Maps'), 'images' => _('Images'));
$rules = $this->get('rules');
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
    // append data type to form list
    if ($this->data['limited']) {
        $itemForm->addVar('data_type', $this->data['data_type']);
        $dataType = new CTextBox('data_type_name', item_data_type2str($this->data['data_type']), ZBX_TEXTBOX_SMALL_SIZE, 'yes');
    } else {
        $dataType = new CComboBox('data_type', $this->data['data_type']);
        $dataType->addItems(item_data_type2str());
    }
    $itemFormList->addRow(_('Data type'), $dataType, false, 'row_data_type');
    $itemFormList->addRow(_('Units'), new CTextBox('units', $this->data['units'], ZBX_TEXTBOX_STANDARD_SIZE, $this->data['limited']), false, 'row_units');
    // append multiplier to form list
    $multiplier = array();
    if ($this->data['limited']) {
        $itemForm->addVar('multiplier', $this->data['multiplier']);
        $multiplierCheckBox = new CCheckBox('multiplier', $this->data['multiplier'] == 1 ? 'yes' : 'no');
        $multiplierCheckBox->setAttribute('disabled', 'disabled');
        $multiplier[] = $multiplierCheckBox;
        $multiplier[] = SPACE;
        $formulaTextBox = new CTextBox('formula', $this->data['formula'], ZBX_TEXTBOX_SMALL_SIZE, 1);
        $formulaTextBox->setAttribute('style', 'text-align: right;');
        $multiplier[] = $formulaTextBox;
    } else {
        $multiplierCheckBox = new CCheckBox('multiplier', $this->data['multiplier'] == 1 ? 'yes' : 'no', 'var editbx = document.getElementById(\'formula\'); if (editbx) { editbx.disabled = !this.checked; }', 1);
        $multiplier[] = $multiplierCheckBox;
        $multiplier[] = SPACE;
        $formulaTextBox = new CTextBox('formula', $this->data['formula'], ZBX_TEXTBOX_SMALL_SIZE);
        $formulaTextBox->setAttribute('style', 'text-align: right;');
        $multiplier[] = $formulaTextBox;
    }
    $itemFormList->addRow(_('Use custom multiplier'), $multiplier, false, 'row_multiplier');
}
$dstfrm = getRequest('dstfrm', 0);
$permission = getRequest('permission', PERM_DENY);
/*
 * Display
 */
show_table_header(permission2str($permission));
// host groups
$hostGroupForm = new CForm();
$hostGroupForm->setAttribute('id', 'groups');
$hostGroupTable = new CTableInfo(_('No host groups found.'));
$hostGroupTable->setHeader(new CCol(array(new CCheckBox('all_groups', null, 'checkAll(this.checked)'), _('Name'))));
$hostGroups = API::HostGroup()->get(array('output' => array('groupid', 'name')));
order_result($hostGroups, 'name');
foreach ($hostGroups as $hostGroup) {
    $hostGroupCheckBox = new CCheckBox();
    $hostGroupCheckBox->setAttribute('data-id', $hostGroup['groupid']);
    $hostGroupCheckBox->setAttribute('data-name', $hostGroup['name']);
    $hostGroupCheckBox->setAttribute('data-permission', $permission);
    $hostGroupTable->addRow(new CCol(array($hostGroupCheckBox, $hostGroup['name'])));
}
$hostGroupTable->setFooter(new CCol(new CButton('select', _('Select'), 'addGroups("' . $dstfrm . '")'), 'right'));
$hostGroupForm->addItem($hostGroupTable);
$hostGroupForm->show();
?>
<script type="text/javascript">
	function addGroups(formName) {
		var parentDocument = window.opener.document;

		if (!parentDocument) {
			return close_window();
		}
// append host groups to form list
$hostGroupsComboBox = new CComboBox('grpswitch', $this->data['grpswitch'], 'submit();');
$hostGroupsComboBox->addItem(0, _('All'));
$hostGroupsComboBox->addItem(1, _('Selected'));
if (!$this->data['isFilterEnable']) {
    $hostGroupsComboBox->setAttribute('disabled', 'disabled');
}
$dashconfFormList->addRow(_('Host groups'), $hostGroupsComboBox);
if ($this->data['grpswitch']) {
    $dashconfFormList->addRow(_('Show selected groups'), new CMultiSelect(array('name' => 'groupids[]', 'objectName' => 'hostGroup', 'data' => $this->data['groups'], 'disabled' => !$this->data['isFilterEnable'], 'popup' => array('parameters' => 'srctbl=host_groups&dstfrm=' . $dashconfForm->getName() . '&dstfld1=groupids_' . '&srcfld1=groupid&multiselect=1', 'width' => 450, 'height' => 450))));
    $dashconfFormList->addRow(_('Hide selected groups'), new CMultiSelect(array('name' => 'hidegroupids[]', 'objectName' => 'hostGroup', 'data' => $this->data['hideGroups'], 'disabled' => !$this->data['isFilterEnable'], 'popup' => array('parameters' => 'srctbl=host_groups&dstfrm=' . $dashconfForm->getName() . '&dstfld1=hidegroupids_' . '&srcfld1=groupid&multiselect=1', 'width' => 450, 'height' => 450))));
}
// append host in maintenance checkbox to form list
$maintenanceCheckBox = new CCheckBox('maintenance', $this->data['maintenance'], null, '1');
if (!$this->data['isFilterEnable']) {
    $maintenanceCheckBox->setAttribute('disabled', 'disabled');
}
$dashconfFormList->addRow(_('Hosts'), array($maintenanceCheckBox, _('Show hosts in maintenance')));
// append trigger severities to form list
$severities = array();
foreach ($this->data['severities'] as $severity) {
    $serverityCheckBox = new CCheckBox('trgSeverity[' . $severity . ']', isset($this->data['severity'][$severity]), '', 1);
    $serverityCheckBox->setEnabled($this->data['isFilterEnable']);
    $severities[] = array($serverityCheckBox, getSeverityCaption($severity));
    $severities[] = BR();
}
array_pop($severities);
$dashconfFormList->addRow(_('Triggers with severity'), $severities);
// append problem display to form list
$extAckComboBox = new CComboBox('extAck', $this->data['extAck']);
$extAckComboBox->addItems(array(EXTACK_OPTION_ALL => _('All'), EXTACK_OPTION_BOTH => _('Separated'), EXTACK_OPTION_UNACK => _('Unacknowledged only')));
Exemple #6
0
function insert_user_form($userid, $profile = 0)
{
    global $ZBX_LOCALES;
    global $USER_DETAILS;
    $config = select_config();
    $frm_title = S_USER;
    if (isset($userid)) {
        /*			if(bccomp($userid,$USER_DETAILS['userid'])==0) $profile = 1;*/
        $user = get_user_by_userid($userid);
        $frm_title = S_USER . ' "' . $user['alias'] . '"';
    }
    if (isset($userid) && (!isset($_REQUEST['form_refresh']) || isset($_REQUEST['register']))) {
        $alias = $user['alias'];
        $name = $user['name'];
        $surname = $user['surname'];
        $password = null;
        $password1 = null;
        $password2 = null;
        $url = $user['url'];
        $autologin = $user['autologin'];
        $autologout = $user['autologout'];
        $lang = $user['lang'];
        $theme = $user['theme'];
        $refresh = $user['refresh'];
        $rows_per_page = $user['rows_per_page'];
        $user_type = $user['type'];
        if ($autologout > 0) {
            $_REQUEST['autologout'] = $autologout;
        }
        $user_groups = array();
        $user_medias = array();
        $sql = 'SELECT g.* ' . ' FROM usrgrp g, users_groups ug ' . ' WHERE ug.usrgrpid=g.usrgrpid ' . ' AND ug.userid=' . $userid;
        $db_user_groups = DBselect($sql);
        while ($db_group = DBfetch($db_user_groups)) {
            $user_groups[$db_group['usrgrpid']] = $db_group['name'];
        }
        $db_medias = DBselect('SELECT m.* FROM media m WHERE m.userid=' . $userid);
        while ($db_media = DBfetch($db_medias)) {
            $user_medias[] = array('mediaid' => $db_media['mediaid'], 'mediatypeid' => $db_media['mediatypeid'], 'period' => $db_media['period'], 'sendto' => $db_media['sendto'], 'severity' => $db_media['severity'], 'active' => $db_media['active']);
        }
        $new_group_id = 0;
        $new_group_name = '';
    } else {
        $alias = get_request('alias', '');
        $name = get_request('name', '');
        $surname = get_request('surname', '');
        $password = null;
        $password1 = get_request('password1', '');
        $password2 = get_request('password2', '');
        $url = get_request('url', '');
        $autologin = get_request('autologin', 0);
        $autologout = get_request('autologout', 90);
        $lang = get_request('lang', 'en_gb');
        $theme = get_request('theme', 'default.css');
        $refresh = get_request('refresh', 30);
        $rows_per_page = get_request('rows_per_page', 50);
        $user_type = get_request('user_type', USER_TYPE_ZABBIX_USER);
        $user_groups = get_request('user_groups', array());
        $change_password = get_request('change_password', null);
        $user_medias = get_request('user_medias', array());
        $new_group_id = get_request('new_group_id', 0);
        $new_group_name = get_request('new_group_name', '');
    }
    if ($autologin || !isset($_REQUEST['autologout'])) {
        $autologout = 0;
    } else {
        if (isset($_REQUEST['autologout']) && $autologout < 90) {
            $autologout = 90;
        }
    }
    $perm_details = get_request('perm_details', 0);
    $media_types = array();
    $media_type_ids = array();
    foreach ($user_medias as $one_media) {
        $media_type_ids[$one_media['mediatypeid']] = 1;
    }
    if (count($media_type_ids) > 0) {
        $db_media_types = DBselect('SELECT mt.mediatypeid, mt.description ' . ' FROM media_type mt ' . ' WHERE mt.mediatypeid IN (' . implode(',', array_keys($media_type_ids)) . ')');
        while ($db_media_type = DBfetch($db_media_types)) {
            $media_types[$db_media_type['mediatypeid']] = $db_media_type['description'];
        }
    }
    $frmUser = new CFormTable($frm_title);
    $frmUser->SetName('user_form');
    $frmUser->SetHelp('web.users.php');
    $frmUser->addVar('config', get_request('config', 0));
    if (isset($userid)) {
        $frmUser->addVar('userid', $userid);
    }
    if ($profile == 0) {
        $frmUser->addRow(S_ALIAS, new CTextBox('alias', $alias, 40));
        $frmUser->addRow(S_NAME, new CTextBox('name', $name, 40));
        $frmUser->addRow(S_SURNAME, new CTextBox('surname', $surname, 40));
    }
    $auth_type = isset($userid) ? get_user_system_auth($userid) : $config['authentication_type'];
    if (ZBX_AUTH_INTERNAL == $auth_type) {
        if (!isset($userid) || isset($change_password)) {
            $frmUser->addRow(S_PASSWORD, new CPassBox('password1', $password1, 20));
            $frmUser->addRow(S_PASSWORD_ONCE_AGAIN, new CPassBox('password2', $password2, 20));
            if (isset($change_password)) {
                $frmUser->addVar('change_password', $change_password);
            }
        } else {
            $passwd_but = new CButton('change_password', S_CHANGE_PASSWORD);
            if ($alias == ZBX_GUEST_USER) {
                $passwd_but->setAttribute('disabled', 'disabled');
            }
            $frmUser->addRow(S_PASSWORD, $passwd_but);
        }
    } else {
        if (!isset($userid) || isset($change_password)) {
            $frmUser->addVar('password1', '');
            $frmUser->addVar('password2', '');
        }
    }
    if ($profile == 0) {
        $frmUser->addVar('user_groups', $user_groups);
        if (isset($userid) && bccomp($USER_DETAILS['userid'], $userid) == 0) {
            $frmUser->addVar('user_type', $user_type);
        } else {
            $cmbUserType = new CComboBox('user_type', $user_type, $perm_details ? 'submit();' : null);
            $cmbUserType->addItem(USER_TYPE_ZABBIX_USER, user_type2str(USER_TYPE_ZABBIX_USER));
            $cmbUserType->addItem(USER_TYPE_ZABBIX_ADMIN, user_type2str(USER_TYPE_ZABBIX_ADMIN));
            $cmbUserType->addItem(USER_TYPE_SUPER_ADMIN, user_type2str(USER_TYPE_SUPER_ADMIN));
            $frmUser->addRow(S_USER_TYPE, $cmbUserType);
        }
        $lstGroups = new CListBox('user_groups_to_del[]');
        $lstGroups->attributes['style'] = 'width: 320px';
        foreach ($user_groups as $groupid => $group_name) {
            $lstGroups->addItem($groupid, $group_name);
        }
        $frmUser->addRow(S_GROUPS, array($lstGroups, BR(), new CButton('add_group', S_ADD, 'return PopUp("popup_usrgrp.php?dstfrm=' . $frmUser->GetName() . '&list_name=user_groups_to_del[]&var_name=user_groups",450, 450);'), SPACE, count($user_groups) > 0 ? new CButton('del_user_group', S_DELETE_SELECTED) : null));
    }
    $cmbLang = new CComboBox('lang', $lang);
    foreach ($ZBX_LOCALES as $loc_id => $loc_name) {
        $cmbLang->addItem($loc_id, $loc_name);
    }
    $frmUser->addRow(S_LANGUAGE, $cmbLang);
    $cmbTheme = new CComboBox('theme', $theme);
    $cmbTheme->addItem(ZBX_DEFAULT_CSS, S_SYSTEM_DEFAULT);
    $cmbTheme->addItem('css_ob.css', S_ORIGINAL_BLUE);
    $cmbTheme->addItem('css_bb.css', S_BLACK_AND_BLUE);
    $frmUser->addRow(S_THEME, $cmbTheme);
    $chkbx_autologin = new CCheckBox("autologin", $autologin, new CScript("var autologout_visible = document.getElementById('autologout_visible');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar autologout = document.getElementById('autologout');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (this.checked) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (autologout_visible.checked) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tautologout_visible.checked = false;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tautologout_visible.onclick();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tautologout_visible.disabled = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tautologout_visible.disabled = false;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}"), 1);
    $chkbx_autologin->setAttribute('autocomplete', 'off');
    $frmUser->AddRow(S_AUTO_LOGIN, $chkbx_autologin);
    $autologoutCheckBox = new CCheckBox('autologout_visible', $autologout == 0 ? 'no' : 'yes', new CScript("var autologout = document.getElementById('autologout');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (this.checked) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tautologout.disabled = false;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tautologout.disabled = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}"));
    $autologoutTextBox = new CNumericBox("autologout", $autologout == 0 ? '90' : $autologout, 4);
    // if autologout is disabled
    if ($autologout == 0) {
        $autologoutTextBox->setAttribute('disabled', 'disabled');
    }
    if ($autologin != 0) {
        $autologoutCheckBox->setAttribute('disabled', 'disabled');
    }
    $frmUser->AddRow(S_AUTO_LOGOUT, array($autologoutCheckBox, $autologoutTextBox));
    $frmUser->AddRow(S_SCREEN_REFRESH, new CNumericBox('refresh', $refresh, 4));
    $frmUser->AddRow(S_ROWS_PER_PAGE, new CNumericBox('rows_per_page', $rows_per_page, 3));
    $frmUser->AddRow(S_URL_AFTER_LOGIN, new CTextBox("url", $url, 50));
    //view Media Settings for users above "User" +++
    if (uint_in_array($USER_DETAILS['type'], array(USER_TYPE_ZABBIX_ADMIN, USER_TYPE_SUPER_ADMIN))) {
        $frmUser->addVar('user_medias', $user_medias);
        $media_table = new CTableInfo(S_NO_MEDIA_DEFINED);
        foreach ($user_medias as $id => $one_media) {
            if (!isset($one_media["active"]) || $one_media["active"] == 0) {
                $status = new CLink(S_ENABLED, '#', 'enabled');
                $status->OnClick("return create_var('" . $frmUser->GetName() . "','disable_media'," . $id . ", true);");
            } else {
                $status = new CLink(S_DISABLED, '#', 'disabled');
                $status->OnClick("return create_var('" . $frmUser->GetName() . "','enable_media'," . $id . ", true);");
            }
            $media_url = '?dstfrm=' . $frmUser->GetName() . '&media=' . $id . '&mediatypeid=' . $one_media['mediatypeid'] . '&sendto=' . $one_media['sendto'] . '&period=' . $one_media['period'] . '&severity=' . $one_media['severity'] . '&active=' . $one_media['active'];
            $media_table->addRow(array(new CCheckBox('user_medias_to_del[' . $id . ']', null, null, $id), new CSpan($media_types[$one_media['mediatypeid']], 'nowrap'), new CSpan($one_media['sendto'], 'nowrap'), new CSpan($one_media['period'], 'nowrap'), media_severity2str($one_media['severity']), $status, new CButton('edit_media', S_EDIT, 'javascript: return PopUp("popup_media.php' . $media_url . '",550,400);')));
        }
        $frmUser->addRow(S_MEDIA, array($media_table, new CButton('add_media', S_ADD, 'javascript: return PopUp("popup_media.php?dstfrm=' . $frmUser->GetName() . '",550,400);'), SPACE, count($user_medias) > 0 ? new CButton('del_user_media', S_DELETE_SELECTED) : null));
    }
    if (0 == $profile) {
        $frmUser->addVar('perm_details', $perm_details);
        $link = new CLink($perm_details ? S_HIDE : S_SHOW, '#', 'action');
        $link->OnClick("return create_var('" . $frmUser->GetName() . "','perm_details'," . ($perm_details ? 0 : 1) . ", true);");
        $resources_list = array(S_RIGHTS_OF_RESOURCES, SPACE . '(', $link, ')');
        $frmUser->addSpanRow($resources_list, 'right_header');
        if ($perm_details) {
            $group_ids = array_keys($user_groups);
            if (count($group_ids) == 0) {
                $group_ids = array(-1);
            }
            $db_rights = DBselect('SELECT * FROM rights r WHERE ' . DBcondition('r.groupid', $group_ids));
            $tmp_perm = array();
            while ($db_right = DBfetch($db_rights)) {
                if (isset($tmp_perm[$db_right['id']])) {
                    $tmp_perm[$db_right['id']] = min($tmp_perm[$db_right['id']], $db_right['permission']);
                } else {
                    $tmp_perm[$db_right['id']] = $db_right['permission'];
                }
            }
            $user_rights = array();
            foreach ($tmp_perm as $id => $perm) {
                array_push($user_rights, array('id' => $id, 'permission' => $perm));
            }
            //SDI($user_rights);
            //SDI($user_type);
            $frmUser->addSpanRow(get_rights_of_elements_table($user_rights, $user_type));
        }
    }
    $frmUser->addItemToBottomRow(new CButton('save', S_SAVE));
    if (isset($userid) && $profile == 0) {
        $frmUser->addItemToBottomRow(SPACE);
        $delete_b = new CButtonDelete("Delete selected user?", url_param("form") . url_param("config") . url_param("userid"));
        if (bccomp($USER_DETAILS['userid'], $userid) == 0) {
            $delete_b->setAttribute('disabled', 'disabled');
        }
        $frmUser->addItemToBottomRow($delete_b);
    }
    $frmUser->addItemToBottomRow(SPACE);
    $frmUser->addItemToBottomRow(new CButtonCancel(url_param("config")));
    $frmUser->show();
}
    $cbDeleted = null;
    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);
    }
    if (isset($rules[$key]['deleteMissing'])) {
        $cbDeleted = new CCheckBox('rules[' . $key . '][deleteMissing]', $rules[$key]['deleteMissing'], null, 1);
        $cbDeleted->setAttribute('class', 'input checkbox pointer deleteMissing');
    }
    $rulesTable->addRow(array($title, new CCol($cbExist, 'center'), new CCol($cbMissed, 'center'), new CCol($cbDeleted, '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
function import_map_form($rules)
{
    global $USER_DETAILS;
    $form = new CFormTable(S_IMPORT, null, 'post', 'multipart/form-data');
    $form->addRow(S_IMPORT_FILE, new CFile('import_file'));
    $table = new CTable();
    $table->setHeader(array(S_ELEMENT, S_UPDATE . SPACE . S_EXISTING, S_ADD . SPACE . S_MISSING), 'bold');
    $titles = array('maps' => S_MAP);
    if ($USER_DETAILS['type'] == USER_TYPE_SUPER_ADMIN) {
        $titles += array('icons' => S_ICON, 'background' => S_BACKGROUND);
    }
    foreach ($titles as $key => $title) {
        $cbExist = new CCheckBox('rules[' . $key . '][exist]', isset($rules[$key]['exist']));
        if ($key != 'maps') {
            $cbExist->setAttribute('onclick', 'javascript: if(this.checked) return confirm(\'Images for all maps will be updated\')');
        }
        $cbMissed = new CCheckBox('rules[' . $key . '][missed]', isset($rules[$key]['missed']));
        $table->addRow(array($title, $cbExist, $cbMissed));
    }
    $form->addRow(S_RULES, $table);
    $form->addItemToBottomRow(new CButton('import', S_IMPORT));
    return $form;
}
 $exp_select->setAttribute('id', 'expr_type');
 $exp_select->addItem(REGEXP_INCLUDE, S_INCLUDE_S);
 $exp_select->addItem(REGEXP_EXCLUDE, S_EXCLUDE);
 $ctb = new CTextBox('expression', '', 80);
 $ctb->setAttribute('id', 'logexpr');
 $cb = new CButton('add_exp', S_ADD, 'javascript: add_logexpr();');
 $cb->setType('button');
 $cb->setAttribute('id', 'add_exp');
 $cbAdd = new CButton('add_key_and', S_AND_BIG, 'javascript: add_keyword_and();');
 $cbAdd->setType('button');
 $cbAdd->setAttribute('id', 'add_key_and');
 $cbOr = new CButton('add_key_or', S_OR_BIG, 'javascript: add_keyword_or();');
 $cbOr->setType('button');
 $cbOr->setAttribute('id', 'add_key_or');
 $cbIregexp = new CCheckBox('iregexp', 'no', null, 1);
 $cbIregexp->setAttribute('id', 'iregexp');
 $frmTRLog->addRow(S_EXPRESSION, array($ctb, BR(), $cbIregexp, 'iregexp', SPACE, $cbAdd, SPACE, $cbOr, SPACE, $exp_select, SPACE, $cb));
 $keyTable = new CTableInfo(null);
 $keyTable->setAttribute('id', 'key_list');
 $keyTable->setHeader(array(S_KEYWORD, S_TYPE, S_ACTION));
 $table = new CTableInfo(null);
 $table->setAttribute('id', 'exp_list');
 $table->setHeader(array(S_EXPRESSION, S_TYPE, S_POSITION, S_ACTION));
 $maxid = 0;
 $bExprResult = true;
 $exprData = new CTriggerExpression(array('expression' => empty($expressions) ? '' : construct_expression($itemid, $expressions)));
 if (isset($_REQUEST['triggerid']) && !isset($_REQUEST['save_trigger']) && !empty($exprData->errors) && !isset($_REQUEST['form_refresh'])) {
     info($exprData->errors);
     unset($expressions);
     $expressions[0]['value'] = $expr_incase;
     $expressions[0]['type'] = 0;
    $itemFormList->addRow(_('Units'), new CTextBox('units', $this->data['units'], ZBX_TEXTBOX_STANDARD_SIZE, $this->data['limited']), false, 'row_units');
    // append multiplier to form list
    $multiplier = array();
    if ($this->data['limited']) {
        $itemForm->addVar('multiplier', $this->data['multiplier']);
        $multiplierCheckBox = new CCheckBox('multiplier', $this->data['multiplier'] == 1 ? 'yes' : 'no');
        $multiplierCheckBox->setAttribute('disabled', 'disabled');
        $multiplierCheckBox->setAttribute('style', 'vertical-align: middle;');
        $multiplier[] = $multiplierCheckBox;
        $multiplier[] = SPACE;
        $formulaTextBox = new CTextBox('formula', $this->data['formula'], ZBX_TEXTBOX_SMALL_SIZE, 1);
        $formulaTextBox->setAttribute('style', 'text-align: right;');
        $multiplier[] = $formulaTextBox;
    } else {
        $multiplierCheckBox = new CCheckBox('multiplier', $this->data['multiplier'] == 1 ? 'yes' : 'no', 'var editbx = document.getElementById(\'formula\'); if (editbx) { editbx.disabled = !this.checked; }', 1);
        $multiplierCheckBox->setAttribute('style', 'vertical-align: middle;');
        $multiplier[] = $multiplierCheckBox;
        $multiplier[] = SPACE;
        $formulaTextBox = new CTextBox('formula', $this->data['formula'], ZBX_TEXTBOX_SMALL_SIZE);
        $formulaTextBox->setAttribute('style', 'text-align: right;');
        $multiplier[] = $formulaTextBox;
    }
    $itemFormList->addRow(_('Use custom multiplier'), $multiplier, false, 'row_multiplier');
}
$itemFormList->addRow(_('Update interval (in sec)'), new CNumericBox('delay', $this->data['delay'], 5), false, 'row_delay');
// append delay flex to form list
$delayFlexTable = new CTable(_('No flexible intervals defined.'), 'formElementTable');
$delayFlexTable->setAttribute('style', 'min-width: 310px;');
$delayFlexTable->setAttribute('id', 'delayFlexTable');
$delayFlexTable->setHeader(array(_('Interval'), _('Period'), _('Action')));
$i = 0;