public function get($caption_l = null, $caption_r = null)
 {
     if (empty($caption_l)) {
         $caption_l = _('In');
     }
     if (empty($caption_r)) {
         $caption_r = _('Other');
     }
     $grp_tab = new CTable();
     $grp_tab->attr('name', $this->name);
     $grp_tab->attr('id', zbx_formatDomId($this->name));
     $grp_tab->setCellSpacing(0);
     $grp_tab->setCellPadding(0);
     if (!is_null($caption_l) || !is_null($caption_r)) {
         $grp_tab->addRow(array($caption_l, SPACE, $caption_r));
     }
     $add_btn = new CButton('add', ' « ', null, 'formlist');
     $add_btn->setAttribute('onclick', 'javascript: moveListBoxSelectedItem("' . $this->form->getName() . '", "' . $this->varname . '", "' . $this->id_r . '", "' . $this->id_l . '", "add");');
     $rmv_btn = new CButton('remove', ' » ', null, 'formlist');
     $rmv_btn->setAttribute('onclick', 'javascript: moveListBoxSelectedItem("' . $this->form->getName() . '", "' . $this->varname . '", "' . $this->id_l . '", "' . $this->id_r . '", "rmv");');
     $grp_tab->addRow(array($this->lbox, new CCol(array($add_btn, BR(), $rmv_btn), 'top'), $this->rbox));
     return $grp_tab;
 }
Пример #2
0
            $row = new CRow(array(SPACE, $config['event_ack_enable'] ? $ack_cb_col : null, $status, $clock, zbx_date2age($row_event['clock']), zbx_date2age($next_clock, $row_event['clock']), $config['event_ack_enable'] ? $ack : NULL, is_show_all_nodes() ? SPACE : null, $empty_col), 'odd_row');
            $row->setAttribute('data-parentid', $trigger['triggerid']);
            $row->addStyle('display: none;');
            $table->addRow($row);
            if ($i > $config['event_show_max']) {
                break;
            }
        }
    }
}
//----- GO ------
$footer = null;
if ($config['event_ack_enable']) {
    $goBox = new CComboBox('go');
    $goBox->addItem('bulkacknowledge', S_BULK_ACKNOWLEDGE);
    // goButton name is necessary!!!
    $goButton = new CButton('goButton', S_GO . ' (0)');
    $goButton->setAttribute('id', 'goButton');
    $show_event_col ? zbx_add_post_js('chkbxRange.pageGoName = "events";') : zbx_add_post_js('chkbxRange.pageGoName = "triggers";');
    $footer = get_table_header(array($goBox, $goButton));
}
//----
$table = array($paging, $table, $paging, $footer);
$m_form->addItem($table);
$trigg_wdgt->addItem($m_form);
$trigg_wdgt->show();
zbx_add_post_js('blink.init();');
zbx_add_post_js("var switcher = new CSwitcher('{$switcherName}');");
$jsmenu = new CPUMenu(null, 170);
$jsmenu->InsertJavaScript();
include_once 'include/page_footer.php';
$slideTable->setAttribute('style', 'min-width: 500px;');
$slideTable->setAttribute('id', 'slideTable');
$slideTable->setHeader(array(new CCol(SPACE, null, null, '15'), new CCol(SPACE, null, null, '15'), new CCol(_('Screen'), null, null, '140'), new CCol(_('Delay'), null, null, '70'), new CCol(_('Action'), null, null, '50')));
$i = 1;
foreach ($this->data['slides'] as $step => $slides) {
    $name = '';
    if (!empty($slides['screenid'])) {
        $screen = get_screen_by_screenid($slides['screenid']);
        if (!empty($screen['name'])) {
            $name = $screen['name'];
        }
    }
    $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 {
Пример #4
0
	$prev_page = new CDiv(SPACE,'arrowleft');
	$prev_page->setAttribute('title','Previous page');
	$prev_page->addAction('onclick',new CScript("javascript: alert('left');"));

	$next_page = new CDiv(SPACE,'arrowright');
	$next_page->setAttribute('title','Next page');
	$next_page->addAction('onclick',new CScript("javascript: alert('right');"));
//*/
//*
$prev_page = new CButton('prev_page', '« ' . S_BACK);
if (empty($prev_clock)) {
    $prev_page->setAttribute('disabled', 'disabled');
}
$next_page = new CButton('next_page', S_NEXT . ' »');
if ($count < $limit) {
    $next_page->setAttribute('disabled', 'disabled');
}
//*/
$navForm->addItem(array($prev_page, SPACE, $next_page));
$navigation = $navForm;
//------------
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable();
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$script = new CScript("javascript: if(CLNDR['audit_since'].clndr.setSDateFromOuterObj()){" . "\$('nav_time').value = parseInt(CLNDR['audit_since'].clndr.sdt.getTime()/1000);}");
$filterForm->addAction('onsubmit', $script);
$filterForm->addVar('nav_time', $_REQUEST['nav_time'] > 0 ? $_REQUEST['nav_time'] : '');
$filterForm->addVar('config', $_REQUEST['config']);
$filterForm->addVar('userid', $_REQUEST['userid']);
    $numSpan->addClass('rowNum');
    $numSpan->setAttribute('id', 'current_step_' . $stepid);
    $name = new CSpan($step['name'], 'link');
    $name->setAttributes(array('id' => 'name_' . $stepid, 'name_step' => $stepid));
    if (zbx_strlen($step['url']) > 70) {
        $url = new CSpan(substr($step['url'], 0, 35) . SPACE . '...' . SPACE . substr($step['url'], zbx_strlen($step['url']) - 25, 25));
        $url->setHint($step['url']);
    } else {
        $url = $step['url'];
    }
    if ($this->data['templated']) {
        $removeButton = SPACE;
        $dragHandler = SPACE;
    } else {
        $removeButton = new CButton('remove_' . $stepid, _('Remove'), 'javascript: removeStep(this);', 'link_menu');
        $removeButton->setAttribute('remove_step', $stepid);
        $dragHandler = new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move');
    }
    $row = new CRow(array($dragHandler, $numSpan, $name, $step['timeout'] . SPACE . _('sec'), $url, htmlspecialchars($step['required']), $step['status_codes'], $removeButton), 'sortable', 'steps_' . $stepid);
    $stepsTable->addRow($row);
}
if (!$this->data['templated']) {
    $stepsTable->addRow(new CCol(new CButton('add_step', _('Add'), null, 'link_menu'), null, 8));
}
$httpStepFormList->addRow(_('Steps'), new CDiv($stepsTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
// append tabs to form
$httpTab = new CTabView();
if (!$this->data['form_refresh']) {
    $httpTab->setSelected(0);
}
$httpTab->addTab('scenarioTab', _('Scenario'), $httpFormList);
Пример #6
0
 $frmTRLog->addVar('itemid', $itemid);
 $exp_select = new CComboBox('expr_type');
 $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);
Пример #7
0
function make_operation_box_footer($hostids, $form_name)
{
    $box = new CComboBox("script");
    $hostScripts = API::Script()->getScriptsByHosts($hostids);
    $scripts = array();
    foreach ($hostScripts as $hostid => $hscripts) {
        foreach ($hscripts as $script) {
            if (!in_array($script, $scripts) && check_script($form_name, $script['name'])) {
                array_push($scripts, $script);
            }
        }
    }
    foreach ($scripts as $script) {
        $option = new CComboItem($script['scriptid'], $script['name']);
        $box->addItem($option);
    }
    $button = new CButton('execute', _('Execute'), "return executeScriptOnMultipleHosts('{$form_name}', 'script', 'hostids[]', 'Execute');");
    $button->setAttribute('id', 'executeButton');
    return array($box, $button);
}
$slideTable->setAttribute('style', 'min-width: 312px;');
$slideTable->setAttribute('id', 'slideTable');
$slideTable->setHeader(array(new CCol(SPACE, null, null, '15'), new CCol(SPACE, null, null, '15'), _('Screen'), new CCol(_('Delay'), null, null, '70'), new CCol(_('Action'), null, null, '50')));
$i = 1;
foreach ($this->data['slides'] as $key => $slides) {
    $name = '';
    if (!empty($slides['screenid'])) {
        $screen = get_screen_by_screenid($slides['screenid']);
        if ($screen) {
            $name = $screen['name'];
        }
    }
    $delay = new CNumericBox('slides[' . $key . '][delay]', !empty($slides['delay']) ? $slides['delay'] : '', 5, false, true, false);
    $delay->setAttribute('placeholder', _('default'));
    $removeButton = new CButton('remove_' . $key, _('Remove'), 'javascript: removeSlide(this);', 'link_menu');
    $removeButton->setAttribute('remove_slide', $key);
    $row = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), new CSpan($i++ . ':', 'rowNum', 'current_slide_' . $key), $name, $delay, $removeButton), 'sortable', 'slides_' . $key);
    $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&writeonly=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'));
// append tabs to form
$slideTab = new CTabView();
$slideTab->addTab('slideTab', _('Slide'), $slideFormList);
$slideForm->addItem($slideTab);
// append buttons to form
if (isset($this->data['slideshowid'])) {
    $slideForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), array(new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete slide show?'), url_params(array('form', 'slideshowid'))), new CButtonCancel())));
} else {
                    if (gettype($e['list'][$i]) == 'object' && get_class($e['list'][$i]) == 'CSpan' && $e['list'][$i]->getAttribute('class') == 'link') {
                        $e['list'][$i]->removeAttribute('class');
                        $e['list'][$i]->setAttribute('onclick', '');
                    }
                }
            }
            $row = new CRow(array($triggerCheckbox, $e['list'], $errorColumn, isset($deleteUrl) ? $deleteUrl : null));
            $expressionTable->addRow($row);
        }
    } else {
        $allowedTesting = false;
        $this->data['outline'] = '';
    }
    $testButton = new CButton('test_expression', _('Test'), 'openWinCentered("tr_testexpr.php?expression=" + encodeURIComponent(this.form.elements["expression"].value),' . '"ExpressionTest", 850, 400, "titlebar=no, resizable=yes, scrollbars=yes"); return false;', 'link_menu');
    if (!$allowedTesting) {
        $testButton->setAttribute('disabled', 'disabled');
    }
    if (empty($this->data['outline'])) {
        $testButton->setAttribute('disabled', 'disabled');
    }
    $wrapOutline = new CSpan(array($this->data['outline']));
    $triggersFormList->addRow(SPACE, array($wrapOutline, BR(), BR(), new CDiv(array($expressionTable, $testButton), 'objectgroup inlineblock border_dotted ui-corner-all')));
    $inputMethodToggle = new CSpan(_('Close expression constructor'), 'link');
    $inputMethodToggle->setAttribute('onclick', 'javascript: ' . 'document.getElementById("toggle_input_method").value=1;' . 'document.getElementById("input_method").value=' . IM_ESTABLISHED . ';' . 'document.forms["' . $triggersForm->getName() . '"].submit();');
    $triggersFormList->addRow(SPACE, array($inputMethodToggle, BR()));
}
$triggersFormList->addRow(_('Multiple PROBLEM events generation'), new CCheckBox('type', $this->data['type'] == TRIGGER_MULT_EVENT_ENABLED ? 'yes' : 'no', null, 1));
$triggersFormList->addRow(_('Description'), new CTextArea('comments', $this->data['comments']));
$triggersFormList->addRow(_('URL'), new CTextBox('url', $this->data['url'], ZBX_TEXTBOX_STANDARD_SIZE));
$triggersFormList->addRow(_('Severity'), new CSeverity(array('name' => 'priority', 'value' => $this->data['priority'])));
// append status to form list
Пример #10
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();
}
Пример #11
0
$reporttimetab2->addRow(array(array(bold(_zeT('Analysis')), ': '), array($cmbTimeSource, $cmbAgregation)));
$reporttimetab2->addRow(array(array(bold(_zeT('Projection')), ': '), array($cmbTimeProjection, array(bold(_zeT('Amount')), ': '), new CTextBox('num_projection', get_request('num_projection', 7), 2))));
$reporttimetab2->addRow(array(array(bold(_zeT('Formatting')), ': '), array($cmbFormato)));
/*----------- Implementa o Filtro por período ---------------*/
$filter_table->addRow(array(array(bold(_('Group')), ': ', $cmbGroups), array(bold(_('Host')), ': ', $cmbHosts), exibeConteudo($hostid > 0, array(bold(_zeT('Application')), ': ', $cmbApplications)), array()));
$filter_table->addRow(array(exibeConteudo($applicationid > 0, array(bold(_('Item')), ': ', $cmbItems)), exibeConteudo($itemid > 0, $reporttimetab), exibeConteudo($itemid > 0, $reporttimetab2)));
$filter_form = new CForm();
$filter_form->setMethod('get');
$filter_form->setAttribute('name', 'zbx_filter');
$filter_form->setAttribute('id', 'zbx_filter');
$reset = new CButton('reset', _('Reset'));
$reset->onClick("javascript: clearAllForm('zbx_filter');");
$grafico = new CButton('grafico', _zeT('Chart'));
// Habilita o botão de geração de gráfico quando tem host e item selecionado =============================================
if ($hostid < 1 and $itemid < 1) {
    $grafico->setAttribute('disabled', '');
}
$grafico->onClick("javascript: fnGrafico();");
$filter = new CButton('filter', _zeT("Update Filter"));
$filter->onClick("javascript: submit();");
$footer_col = new CCol(array($filter, SPACE, $reset, SPACE, $grafico), 'center');
$footer_col->setColSpan(4);
$filter_table->addRow($footer_col);
$filter_form->addItem($filter_table);
$filter_form->addVar('report_timesince', date('YmdHis', $report_timesince));
$filter_form->addVar('report_timetill', date('YmdHis', $report_timetill));
$hostprof_wdgt->addFlicker($filter_form, true);
function campoPadrao($p_campo, $p_mascara)
{
}
// FIM Formulario de Filtro =========================================================
Пример #12
0
    }
    $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(S_RESULT, $res_table);
// action buttons
$btn_test = new CButton('test_expression', S_TEST);
if (!$allowedTesting) {
    $btn_test->setAttribute('disabled', 'disabled');
}
$frm_test->addItemToBottomRow($btn_test);
$frm_test->addItemToBottomRow(SPACE);
$btn_close = new CButton('close', S_CLOSE);
$btn_close->setType('button');
$btn_close->setAction('javascript: self.close();');
$frm_test->addItemToBottomRow($btn_close);
$frm_test->show();
//------------------------ </FORM> ---------------------------
include_once 'include/page_footer.php';
Пример #13
0
function insert_trigger_form()
{
    $frmTrig = new CFormTable(S_TRIGGER, 'triggers.php');
    $frmTrig->setHelp('config_triggers.php');
    //		if(isset($_REQUEST['hostid'])){
    //			$frmTrig->addVar('hostid',$_REQUEST['hostid']);
    //		}
    $dep_el = array();
    $dependencies = get_request('dependencies', array());
    $limited = null;
    if (isset($_REQUEST['triggerid'])) {
        $frmTrig->addVar('triggerid', $_REQUEST['triggerid']);
        $trigger = get_trigger_by_triggerid($_REQUEST['triggerid']);
        $caption = array();
        $trigid = $_REQUEST['triggerid'];
        do {
            $sql = 'SELECT t.triggerid, t.templateid, h.host' . ' FROM triggers t, functions f, items i, hosts h' . ' WHERE t.triggerid=' . $trigid . ' AND h.hostid=i.hostid' . ' AND i.itemid=f.itemid' . ' AND f.triggerid=t.triggerid';
            $trig = DBfetch(DBselect($sql));
            if ($_REQUEST['triggerid'] != $trigid) {
                $caption[] = ' : ';
                $caption[] = new CLink($trig['host'], 'triggers.php?form=update&triggerid=' . $trig['triggerid'], 'highlight underline');
            }
            $trigid = $trig['templateid'];
        } while ($trigid != 0);
        $caption[] = S_TRIGGER . ' "';
        $caption = array_reverse($caption);
        $caption[] = htmlspecialchars($trigger['description']);
        $caption[] = '"';
        $frmTrig->setTitle($caption);
        $limited = $trigger['templateid'] ? 'yes' : null;
    }
    $expression = get_request('expression', '');
    $description = get_request('description', '');
    $type = get_request('type', 0);
    $priority = get_request('priority', 0);
    $status = get_request('status', 0);
    $comments = get_request('comments', '');
    $url = get_request('url', '');
    $expr_temp = get_request('expr_temp', '');
    $input_method = get_request('input_method', IM_ESTABLISHED);
    if (isset($_REQUEST['triggerid']) && !isset($_REQUEST['form_refresh']) || isset($limited)) {
        $description = $trigger['description'];
        $expression = explode_exp($trigger['expression'], 0);
        if (!isset($limited) || !isset($_REQUEST['form_refresh'])) {
            $type = $trigger['type'];
            $priority = $trigger['priority'];
            $status = $trigger['status'];
            $comments = $trigger['comments'];
            $url = $trigger['url'];
            $trigs = DBselect('SELECT t.triggerid,t.description,t.expression ' . ' FROM triggers t,trigger_depends d ' . ' WHERE t.triggerid=d.triggerid_up ' . ' AND d.triggerid_down=' . $_REQUEST['triggerid']);
            while ($trig = DBfetch($trigs)) {
                if (uint_in_array($trig['triggerid'], $dependencies)) {
                    continue;
                }
                array_push($dependencies, $trig['triggerid']);
            }
        }
    }
    $frmTrig->addRow(S_NAME, new CTextBox('description', $description, 90, $limited));
    if ($input_method == IM_TREE) {
        $alz = analyze_expression($expression);
        if ($alz !== false) {
            list($outline, $eHTMLTree) = $alz;
            if (isset($_REQUEST['expr_action']) && $eHTMLTree != null) {
                $new_expr = remake_expression($expression, $_REQUEST['expr_target_single'], $_REQUEST['expr_action'], $expr_temp);
                if ($new_expr !== false) {
                    $expression = $new_expr;
                    $alz = analyze_expression($expression);
                    if ($alz !== false) {
                        list($outline, $eHTMLTree) = $alz;
                    } else {
                        show_messages(false, '', S_EXPRESSION_SYNTAX_ERROR);
                    }
                    $expr_temp = '';
                } else {
                    show_messages(false, '', S_EXPRESSION_SYNTAX_ERROR);
                }
            }
            $frmTrig->addVar('expression', $expression);
            $exprfname = 'expr_temp';
            $exprtxt = new CTextBox($exprfname, $expr_temp, 65, 'yes');
            $macrobtn = new CButton('insert_macro', S_INSERT_MACRO, 'return call_ins_macro_menu(event);');
            //disabling button, if this trigger is templated
            if ($limited == 'yes') {
                $macrobtn->setAttribute('disabled', 'disabled');
            }
            $exprparam = "this.form.elements['{$exprfname}'].value";
        } else {
            show_messages(false, '', S_EXPRESSION_SYNTAX_ERROR);
            $input_method = IM_ESTABLISHED;
        }
    }
    if ($input_method != IM_TREE) {
        $exprfname = 'expression';
        $exprtxt = new CTextBox($exprfname, $expression, 75, $limited);
        $exprparam = "getSelectedText(this.form.elements['{$exprfname}'])";
    }
    $add_expr_button = new CButton('insert', $input_method == IM_TREE ? S_EDIT : S_ADD, "return PopUp('popup_trexpr.php?dstfrm=" . $frmTrig->getName() . "&dstfld1={$exprfname}&srctbl=expression" . "&srcfld1=expression&expression=' + escape({$exprparam}),1000,700);");
    //disabling button, if this trigger is templated
    if ($limited == 'yes') {
        $add_expr_button->setAttribute('disabled', 'disabled');
    }
    $row = array($exprtxt, $add_expr_button);
    if (isset($macrobtn)) {
        array_push($row, $macrobtn);
    }
    if ($input_method == IM_TREE) {
        array_push($row, BR());
        if (empty($outline)) {
            $tmpbtn = new CButton('add_expression', S_ADD, "");
            if ($limited == 'yes') {
                $tmpbtn->setAttribute('disabled', 'disabled');
            }
            array_push($row, $tmpbtn);
        } else {
            $tmpbtn = new CButton('and_expression', S_AND_BIG, "");
            if ($limited == 'yes') {
                $tmpbtn->setAttribute('disabled', 'disabled');
            }
            array_push($row, $tmpbtn);
            $tmpbtn = new CButton('or_expression', S_OR_BIG, "");
            if ($limited == 'yes') {
                $tmpbtn->setAttribute('disabled', 'disabled');
            }
            array_push($row, $tmpbtn);
            $tmpbtn = new CButton('replace_expression', S_REPLACE, "");
            if ($limited == 'yes') {
                $tmpbtn->setAttribute('disabled', 'disabled');
            }
            array_push($row, $tmpbtn);
        }
    }
    $frmTrig->addVar('input_method', $input_method);
    $frmTrig->addVar('toggle_input_method', '');
    $exprtitle = array(S_EXPRESSION);
    if ($input_method != IM_FORCED) {
        $btn_im = new CSpan(S_TOGGLE_INPUT_METHOD, 'link');
        $btn_im->setAttribute('onclick', 'javascript: ' . "document.getElementById('toggle_input_method').value=1;" . "document.getElementById('input_method').value=" . ($input_method == IM_TREE ? IM_ESTABLISHED : IM_TREE) . ';' . "document.forms['" . $frmTrig->getName() . "'].submit();");
        $exprtitle[] = array(SPACE, '(', $btn_im, ')');
    }
    $frmTrig->addRow($exprtitle, $row);
    if ($input_method == IM_TREE) {
        $exp_table = new CTable();
        $exp_table->setClass('tableinfo');
        $exp_table->setAttribute('id', 'exp_list');
        $exp_table->setOddRowClass('even_row');
        $exp_table->setEvenRowClass('even_row');
        $exp_table->setHeader(array($limited == 'yes' ? null : S_TARGET, S_EXPRESSION, S_EXPRESSION_PART_ERROR, $limited == 'yes' ? null : S_DELETE));
        $allowedTesting = true;
        if ($eHTMLTree != null) {
            foreach ($eHTMLTree as $i => $e) {
                if ($limited != 'yes') {
                    $del_url = new CSpan(S_DELETE, 'link');
                    $del_url->setAttribute('onclick', 'javascript: if(confirm("' . S_DELETE_EXPRESSION_Q . '")) {' . ' delete_expression(\'' . $e['id'] . '\');' . ' document.forms["config_triggers.php"].submit(); ' . '}');
                    $tgt_chk = new CCheckbox('expr_target_single', $i == 0 ? 'yes' : 'no', 'check_target(this);', $e['id']);
                } else {
                    $tgt_chk = null;
                }
                if (!isset($e['expression']['levelErrors'])) {
                    $errorImg = new CImg('images/general/ok_icon.png', 'expression_no_errors');
                    $errorImg->setHint(S_EXPRESSION_PART_NO_ERROR, '', '', false);
                } else {
                    $allowedTesting = false;
                    $errorImg = new CImg('images/general/error_icon.png', 'expression_errors');
                    $errorTexts = array();
                    if (is_array($e['expression']['levelErrors'])) {
                        foreach ($e['expression']['levelErrors'] as $expVal => $errTxt) {
                            if (count($errorTexts) > 0) {
                                array_push($errorTexts, BR());
                            }
                            array_push($errorTexts, $expVal, ':', $errTxt);
                        }
                    }
                    $errorImg->setHint($errorTexts, '', 'left', false);
                }
                //if it is a templated trigger
                if ($limited == 'yes') {
                    //make all links inside inactive
                    for ($i = 0; $i < count($e['list']); $i++) {
                        if (gettype($e['list'][$i]) == 'object' && get_class($e['list'][$i]) == 'CSpan' && $e['list'][$i]->getAttribute('class') == 'link') {
                            $e['list'][$i]->setClass('');
                            $e['list'][$i]->setAttribute('onclick', '');
                        }
                    }
                }
                $errorCell = new CCol($errorImg, 'center');
                $row = new CRow(array($tgt_chk, $e['list'], $errorCell, isset($del_url) ? $del_url : null));
                $exp_table->addRow($row);
            }
        } else {
            $allowedTesting = false;
            $outline = '';
        }
        $frmTrig->addVar('remove_expression', '');
        $btn_test = new CButton('test_expression', S_TEST, "openWinCentered(" . "'tr_testexpr.php?expression=' + encodeURIComponent(this.form.elements['expression'].value)" . ",'ExpressionTest'" . ",850,400" . ",'titlebar=no, resizable=yes, scrollbars=yes');" . "return false;");
        if (!isset($allowedTesting) || !$allowedTesting) {
            $btn_test->setAttribute('disabled', 'disabled');
        }
        if (empty($outline)) {
            $btn_test->setAttribute('disabled', 'yes');
        }
        //SDI($outline);
        $wrapOutline = new CSpan(array($outline));
        $wrapOutline->addStyle('white-space: pre;');
        $frmTrig->addRow(SPACE, array($wrapOutline, BR(), BR(), $exp_table, $btn_test));
    }
    // dependencies
    foreach ($dependencies as $val) {
        array_push($dep_el, array(new CCheckBox('rem_dependence[' . $val . ']', 'no', null, strval($val)), expand_trigger_description($val)), BR());
        $frmTrig->addVar('dependencies[]', strval($val));
    }
    if (count($dep_el) == 0) {
        array_push($dep_el, S_NO_DEPENDENCES_DEFINED);
    } else {
        array_push($dep_el, new CButton('del_dependence', S_DELETE_SELECTED));
    }
    $frmTrig->addRow(S_THE_TRIGGER_DEPENDS_ON, $dep_el);
    /* end dependencies */
    /* new dependency */
    //		$frmTrig->addVar('new_dependence','0');
    //		$txtCondVal = new CTextBox('trigger','',75,'yes');
    $btnSelect = new CButton('btn1', S_ADD, "return PopUp('popup.php?srctbl=triggers" . '&srcfld1=triggerid' . '&reference=deptrigger' . '&multiselect=1' . "',1000,700);", 'T');
    $frmTrig->addRow(S_NEW_DEPENDENCY, $btnSelect, 'new');
    // end new dependency
    $type_select = new CComboBox('type');
    $type_select->additem(TRIGGER_MULT_EVENT_DISABLED, S_NORMAL, $type == TRIGGER_MULT_EVENT_ENABLED ? 'no' : 'yes');
    $type_select->additem(TRIGGER_MULT_EVENT_ENABLED, S_NORMAL . SPACE . '+' . SPACE . S_MULTIPLE_PROBLEM_EVENTS, $type == TRIGGER_MULT_EVENT_ENABLED ? 'yes' : 'no');
    $frmTrig->addRow(S_EVENT_GENERATION, $type_select);
    $cmbPrior = new CComboBox('priority', $priority);
    for ($i = 0; $i <= 5; $i++) {
        $cmbPrior->addItem($i, get_severity_description($i));
    }
    $frmTrig->addRow(S_SEVERITY, $cmbPrior);
    $frmTrig->addRow(S_COMMENTS, new CTextArea("comments", $comments, 90, 7));
    $frmTrig->addRow(S_URL, new CTextBox("url", $url, 90));
    $frmTrig->addRow(S_DISABLED, new CCheckBox("status", $status));
    $frmTrig->addItemToBottomRow(new CButton("save", S_SAVE));
    if (isset($_REQUEST["triggerid"])) {
        $frmTrig->addItemToBottomRow(SPACE);
        $frmTrig->addItemToBottomRow(new CButton("clone", S_CLONE));
        $frmTrig->addItemToBottomRow(SPACE);
        if (!$limited) {
            $frmTrig->addItemToBottomRow(new CButtonDelete(S_DELETE_TRIGGER_Q, url_param("form") . url_param('groupid') . url_param("hostid") . url_param("triggerid")));
        }
    }
    $frmTrig->addItemToBottomRow(SPACE);
    $frmTrig->addItemToBottomRow(new CButtonCancel(url_param('groupid') . url_param("hostid")));
    $jsmenu = new CPUMenu(null, 170);
    $jsmenu->InsertJavaScript();
    $script = "function addPopupValues(list){\n\t\t\t\t\t\tif(!isset('object', list)) return false;\n\n\t\t\t\t\t\tif(list.object == 'deptrigger'){\n\t\t\t\t\t\t\tfor(var i=0; i < list.values.length; i++){\n\t\t\t\t\t\t\t\tcreate_var('" . $frmTrig->getName() . "', 'new_dependence['+i+']', list.values[i], false);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcreate_var('" . $frmTrig->getName() . "','add_dependence', 1, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}";
    insert_js($script);
    return $frmTrig;
}
Пример #14
0
         $mapname = get_request("mapname", "");
         $valuemap = get_request("valuemap", array());
     }
     $frmValmap->addRow(S_NAME, new CTextBox("mapname", $mapname, 40));
     $i = 0;
     $valuemap_el = array();
     foreach ($valuemap as $value) {
         array_push($valuemap_el, array(new CCheckBox("rem_value[]", 'no', null, $i), $value["value"] . SPACE . RARR . SPACE . $value["newvalue"]), BR());
         $frmValmap->addVar("valuemap[{$i}][value]", $value["value"]);
         $frmValmap->addVar("valuemap[{$i}][newvalue]", $value["newvalue"]);
         $i++;
     }
     $saveButton = new CButton('save', S_SAVE);
     if (count($valuemap_el) == 0) {
         array_push($valuemap_el, S_NO_MAPPING_DEFINED);
         $saveButton->setAttribute('disabled', 'true');
     } else {
         array_push($valuemap_el, new CButton('del_map', S_DELETE_SELECTED));
     }
     $frmValmap->addRow(S_MAPPING, $valuemap_el);
     $frmValmap->addRow(S_NEW_MAPPING, array(new CTextBox("add_value", "", 10), new CSpan(RARR, "rarr"), new CTextBox("add_newvalue", "", 10), SPACE, new CButton("add_map", S_ADD)), 'new');
     $frmValmap->addItemToBottomRow($saveButton);
     if (isset($_REQUEST["valuemapid"])) {
         $frmValmap->addItemToBottomRow(SPACE);
         $frmValmap->addItemToBottomRow(new CButtonDelete("Delete selected value mapping?", url_param("form") . url_param("valuemapid") . url_param("config")));
     } else {
     }
     $frmValmap->addItemToBottomRow(SPACE);
     $frmValmap->addItemToBottomRow(new CButtonCancel(url_param("config")));
     $frmValmap->Show();
 } else {
Пример #15
0
    order_result($groups, 'name');
    $lstGroups = new CListBox('del_groups[]', null, 15);
    $lstGroups->setAttribute('style', 'width: 200px;');
    foreach ($groups as $gnum => $group) {
        $lstGroups->addItem($group['groupid'], get_node_name_by_elid($group['groupid'], true, ':') . $group['name']);
    }
    if (!$filterEnable) {
        $lstGroups->setAttribute('disabled', 'disabled');
    }
    $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) {
Пример #16
0
function get_screen_item_form()
{
    global $USER_DETAILS;
    $form = new CFormTable(S_SCREEN_CELL_CONFIGURATION, 'screenedit.php?screenid=' . $_REQUEST['screenid']);
    $form->SetHelp('web.screenedit.cell.php');
    if (isset($_REQUEST['screenitemid'])) {
        $sql = 'SELECT * ' . ' FROM screens_items' . ' WHERE screenid=' . $_REQUEST['screenid'] . ' AND screenitemid=' . $_REQUEST['screenitemid'];
        $iresult = DBSelect($sql);
        $form->addVar('screenitemid', $_REQUEST['screenitemid']);
    } else {
        $form->addVar('x', $_REQUEST['x']);
        $form->addVar('y', $_REQUEST['y']);
    }
    if (isset($_REQUEST['screenitemid']) && !isset($_REQUEST['form_refresh'])) {
        $irow = DBfetch($iresult);
        $resourcetype = $irow['resourcetype'];
        $resourceid = $irow['resourceid'];
        $width = $irow['width'];
        $height = $irow['height'];
        $colspan = $irow['colspan'];
        $rowspan = $irow['rowspan'];
        $elements = $irow['elements'];
        $valign = $irow['valign'];
        $halign = $irow['halign'];
        $style = $irow['style'];
        $url = $irow['url'];
        $dynamic = $irow['dynamic'];
    } else {
        $resourcetype = get_request('resourcetype', 0);
        $resourceid = get_request('resourceid', 0);
        $width = get_request('width', 500);
        $height = get_request('height', 100);
        $colspan = get_request('colspan', 0);
        $rowspan = get_request('rowspan', 0);
        $elements = get_request('elements', 25);
        $valign = get_request('valign', VALIGN_DEFAULT);
        $halign = get_request('halign', HALIGN_DEFAULT);
        $style = get_request('style', 0);
        $url = get_request('url', '');
        $dynamic = get_request('dynamic', SCREEN_SIMPLE_ITEM);
    }
    $form->addVar('screenid', $_REQUEST['screenid']);
    // a-z order!!!
    $cmbRes = new CCombobox('resourcetype', $resourcetype, 'submit()');
    $cmbRes->addItem(SCREEN_RESOURCE_CLOCK, S_CLOCK);
    $cmbRes->addItem(SCREEN_RESOURCE_DATA_OVERVIEW, S_DATA_OVERVIEW);
    $cmbRes->addItem(SCREEN_RESOURCE_GRAPH, S_GRAPH);
    $cmbRes->addItem(SCREEN_RESOURCE_ACTIONS, S_HISTORY_OF_ACTIONS);
    $cmbRes->addItem(SCREEN_RESOURCE_EVENTS, S_HISTORY_OF_EVENTS);
    $cmbRes->addItem(SCREEN_RESOURCE_HOSTS_INFO, S_HOSTS_INFO);
    $cmbRes->addItem(SCREEN_RESOURCE_MAP, S_MAP);
    $cmbRes->addItem(SCREEN_RESOURCE_PLAIN_TEXT, S_PLAIN_TEXT);
    $cmbRes->addItem(SCREEN_RESOURCE_SCREEN, S_SCREEN);
    $cmbRes->addItem(SCREEN_RESOURCE_SERVER_INFO, S_SERVER_INFO);
    $cmbRes->addItem(SCREEN_RESOURCE_SIMPLE_GRAPH, S_SIMPLE_GRAPH);
    $cmbRes->addItem(SCREEN_RESOURCE_HOSTGROUP_TRIGGERS, S_STATUS_OF_HOSTGROUP_TRIGGERS);
    $cmbRes->addItem(SCREEN_RESOURCE_HOST_TRIGGERS, S_STATUS_OF_HOST_TRIGGERS);
    $cmbRes->addItem(SCREEN_RESOURCE_SYSTEM_STATUS, S_SYSTEM_STATUS);
    $cmbRes->addItem(SCREEN_RESOURCE_TRIGGERS_INFO, S_TRIGGERS_INFO);
    $cmbRes->addItem(SCREEN_RESOURCE_TRIGGERS_OVERVIEW, S_TRIGGERS_OVERVIEW);
    $cmbRes->addItem(SCREEN_RESOURCE_URL, S_URL);
    $form->addRow(S_RESOURCE, $cmbRes);
    if ($resourcetype == SCREEN_RESOURCE_GRAPH) {
        // User-defined graph
        $options = array('graphids' => $resourceid, 'select_hosts' => array('hostid', 'host'), 'output' => API_OUTPUT_EXTEND);
        $graphs = CGraph::get($options);
        $caption = '';
        $id = 0;
        if (!empty($graphs)) {
            $id = $resourceid;
            $graph = reset($graphs);
            order_result($graph['hosts'], 'host');
            $graph['host'] = reset($graph['hosts']);
            $caption = $graph['host']['host'] . ':' . $graph['name'];
            $nodeName = get_node_name_by_elid($graph['host']['hostid']);
            if (!zbx_empty($nodeName)) {
                $caption = '(' . $nodeName . ') ' . $caption;
            }
        }
        $form->addVar('resourceid', $id);
        $textfield = new CTextbox('caption', $caption, 75, 'yes');
        $selectbtn = new CButton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&dstfrm=" . $form->getName() . "&real_hosts=1&dstfld1=resourceid&dstfld2=caption&srctbl=graphs&srcfld1=graphid&srcfld2=name',800,450);");
        $selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
        $form->addRow(S_GRAPH_NAME, array($textfield, SPACE, $selectbtn));
    } else {
        if ($resourcetype == SCREEN_RESOURCE_SIMPLE_GRAPH) {
            // Simple graph
            $options = array('itemids' => $resourceid, 'select_hosts' => array('hostid', 'host'), 'output' => API_OUTPUT_EXTEND);
            $items = CItem::get($options);
            $caption = '';
            $id = 0;
            if (!empty($items)) {
                $id = $resourceid;
                $item = reset($items);
                $item['host'] = reset($item['hosts']);
                $caption = item_description($item);
                $nodeName = get_node_name_by_elid($item['itemid']);
                if (!zbx_empty($nodeName)) {
                    $caption = '(' . $nodeName . ') ' . $caption;
                }
            }
            $form->addVar('resourceid', $id);
            $textfield = new Ctextbox('caption', $caption, 75, 'yes');
            $selectbtn = new Cbutton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&real_hosts=1&dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=simple_graph&srcfld1=itemid&srcfld2=description',800,450);");
            $selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
            $form->addRow(S_PARAMETER, array($textfield, SPACE, $selectbtn));
        } else {
            if ($resourcetype == SCREEN_RESOURCE_MAP) {
                // Map
                $options = array('sysmapids' => $resourceid, 'output' => API_OUTPUT_EXTEND);
                $maps = CMap::get($options);
                $caption = '';
                $id = 0;
                if (!empty($maps)) {
                    $id = $resourceid;
                    $map = reset($maps);
                    $caption = $map['name'];
                    $nodeName = get_node_name_by_elid($map['sysmapid']);
                    if (!zbx_empty($nodeName)) {
                        $caption = '(' . $nodeName . ') ' . $caption;
                    }
                }
                $form->addVar('resourceid', $id);
                $textfield = new Ctextbox('caption', $caption, 60, 'yes');
                $selectbtn = new Cbutton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=sysmaps&srcfld1=sysmapid&srcfld2=name',400,450);");
                $selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
                $form->addRow(S_PARAMETER, array($textfield, SPACE, $selectbtn));
            } else {
                if ($resourcetype == SCREEN_RESOURCE_PLAIN_TEXT) {
                    // Plain text
                    $options = array('itemids' => $resourceid, 'select_hosts' => array('hostid', 'host'), 'output' => API_OUTPUT_EXTEND);
                    $items = CItem::get($options);
                    $caption = '';
                    $id = 0;
                    if (!empty($items)) {
                        $id = $resourceid;
                        $item = reset($items);
                        $item['host'] = reset($item['hosts']);
                        $caption = item_description($item);
                        $nodeName = get_node_name_by_elid($item['itemid']);
                        if (!zbx_empty($nodeName)) {
                            $caption = '(' . $nodeName . ') ' . $caption;
                        }
                    }
                    $form->addVar('resourceid', $id);
                    $textfield = new CTextbox('caption', $caption, 75, 'yes');
                    $selectbtn = new CButton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=plain_text&srcfld1=itemid&srcfld2=description',800,450);");
                    $selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
                    $form->addRow(S_PARAMETER, array($textfield, SPACE, $selectbtn));
                    $form->addRow(S_SHOW_LINES, new CNumericBox('elements', $elements, 2));
                    $form->addRow(S_SHOW_TEXT_AS_HTML, new CCheckBox('style', $style, null, 1));
                } else {
                    if (uint_in_array($resourcetype, array(SCREEN_RESOURCE_HOSTGROUP_TRIGGERS, SCREEN_RESOURCE_HOST_TRIGGERS))) {
                        // Status of triggers
                        $caption = '';
                        $id = 0;
                        if (SCREEN_RESOURCE_HOSTGROUP_TRIGGERS == $resourcetype) {
                            if ($resourceid > 0) {
                                $options = array('groupids' => $resourceid, 'output' => API_OUTPUT_EXTEND, 'editable' => 1);
                                $groups = CHostgroup::get($options);
                                foreach ($groups as $gnum => $group) {
                                    $caption = get_node_name_by_elid($group['groupid'], true, ':') . $group['name'];
                                    $id = $resourceid;
                                }
                            }
                            $form->addVar('resourceid', $id);
                            $textfield = new CTextbox('caption', $caption, 60, 'yes');
                            $selectbtn = new CButton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=host_group&srcfld1=groupid&srcfld2=name',800,450);");
                            $selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
                            $form->addRow(S_GROUP, array($textfield, SPACE, $selectbtn));
                        } else {
                            if ($resourceid > 0) {
                                $options = array('hostids' => $resourceid, 'output' => API_OUTPUT_EXTEND, 'editable' => 1);
                                $hosts = CHost::get($options);
                                foreach ($hosts as $hnum => $host) {
                                    $caption = get_node_name_by_elid($host['hostid'], true, ':') . $host['host'];
                                    $id = $resourceid;
                                }
                            }
                            $form->addVar('resourceid', $id);
                            $textfield = new CTextbox('caption', $caption, 60, 'yes');
                            $selectbtn = new CButton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=hosts&srcfld1=hostid&srcfld2=host',800,450);");
                            $selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
                            $form->addRow(S_HOST, array($textfield, SPACE, $selectbtn));
                        }
                        $form->addRow(S_SHOW_LINES, new CNumericBox('elements', $elements, 2));
                    } else {
                        if (uint_in_array($resourcetype, array(SCREEN_RESOURCE_EVENTS, SCREEN_RESOURCE_ACTIONS))) {
                            // History of actions
                            // History of events
                            $form->addRow(S_SHOW_LINES, new CNumericBox('elements', $elements, 2));
                            $form->addVar('resourceid', 0);
                        } else {
                            if (uint_in_array($resourcetype, array(SCREEN_RESOURCE_TRIGGERS_OVERVIEW, SCREEN_RESOURCE_DATA_OVERVIEW))) {
                                // Overviews
                                $caption = '';
                                $id = 0;
                                if ($resourceid > 0) {
                                    $options = array('groupids' => $resourceid, 'output' => API_OUTPUT_EXTEND, 'editable' => 1);
                                    $groups = CHostgroup::get($options);
                                    foreach ($groups as $gnum => $group) {
                                        $caption = get_node_name_by_elid($group['groupid'], true, ':') . $group['name'];
                                        $id = $resourceid;
                                    }
                                }
                                $form->addVar('resourceid', $id);
                                $textfield = new CTextbox('caption', $caption, 75, 'yes');
                                $selectbtn = new CButton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=overview&srcfld1=groupid&srcfld2=name',800,450);");
                                $selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
                                $form->addRow(S_GROUP, array($textfield, SPACE, $selectbtn));
                            } else {
                                if ($resourcetype == SCREEN_RESOURCE_SCREEN) {
                                    // Screens
                                    $caption = '';
                                    $id = 0;
                                    if ($resourceid > 0) {
                                        $result = DBselect('SELECT DISTINCT n.name as node_name,s.screenid,s.name ' . ' FROM screens s ' . ' LEFT JOIN nodes n ON n.nodeid=' . DBid2nodeid('s.screenid') . ' WHERE s.screenid=' . $resourceid);
                                        while ($row = DBfetch($result)) {
                                            $r = CScreen::get(array('screenids' => $row['screenid'], 'output' => API_OUTPUT_SHORTEN));
                                            if (empty($r)) {
                                                continue;
                                            }
                                            if (check_screen_recursion($_REQUEST['screenid'], $row['screenid'])) {
                                                continue;
                                            }
                                            $row['node_name'] = isset($row['node_name']) ? '(' . $row['node_name'] . ') ' : '';
                                            $caption = $row['node_name'] . $row['name'];
                                            $id = $resourceid;
                                        }
                                    }
                                    $form->addVar('resourceid', $id);
                                    $textfield = new Ctextbox('caption', $caption, 60, 'yes');
                                    $selectbtn = new Cbutton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=screens2&srcfld1=screenid&srcfld2=name&screenid=" . $_REQUEST['screenid'] . "',800,450);");
                                    $selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
                                    $form->addRow(S_PARAMETER, array($textfield, SPACE, $selectbtn));
                                } else {
                                    if ($resourcetype == SCREEN_RESOURCE_HOSTS_INFO || $resourcetype == SCREEN_RESOURCE_TRIGGERS_INFO) {
                                        // HOSTS info
                                        $caption = '';
                                        $id = 0;
                                        $available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_ONLY);
                                        if (remove_nodes_from_id($resourceid) > 0) {
                                            $result = DBselect('SELECT DISTINCT n.name as node_name,g.groupid,g.name ' . ' FROM hosts_groups hg, groups g ' . ' LEFT JOIN nodes n ON n.nodeid=' . DBid2nodeid('g.groupid') . ' WHERE ' . DBcondition('g.groupid', $available_groups) . ' AND g.groupid=' . $resourceid);
                                            while ($row = DBfetch($result)) {
                                                $row['node_name'] = isset($row['node_name']) ? '(' . $row['node_name'] . ') ' : '';
                                                $caption = $row['node_name'] . $row['name'];
                                                $id = $resourceid;
                                            }
                                        } else {
                                            if (remove_nodes_from_id($resourceid) == 0) {
                                                $result = DBselect('SELECT DISTINCT n.name as node_name ' . ' FROM nodes n ' . ' WHERE n.nodeid=' . id2nodeid($resourceid));
                                                while ($row = DBfetch($result)) {
                                                    $row['node_name'] = isset($row['node_name']) ? '(' . $row['node_name'] . ') ' : '';
                                                    $caption = $row['node_name'] . S_MINUS_ALL_GROUPS_MINUS;
                                                    $id = $resourceid;
                                                }
                                            }
                                        }
                                        $form->addVar('resourceid', $id);
                                        $textfield = new CTextbox('caption', $caption, 60, 'yes');
                                        $selectbtn = new Cbutton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=host_group_scr&srcfld1=groupid&srcfld2=name',480,450);");
                                        $selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
                                        $form->addRow(S_GROUP, array($textfield, SPACE, $selectbtn));
                                    } else {
                                        // SCREEN_RESOURCE_CLOCK
                                        $form->addVar('resourceid', 0);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if (uint_in_array($resourcetype, array(SCREEN_RESOURCE_HOSTS_INFO, SCREEN_RESOURCE_TRIGGERS_INFO))) {
        $cmbStyle = new CComboBox("style", $style);
        $cmbStyle->addItem(STYLE_HORISONTAL, S_HORIZONTAL);
        $cmbStyle->addItem(STYLE_VERTICAL, S_VERTICAL);
        $form->addRow(S_STYLE, $cmbStyle);
    } else {
        if (uint_in_array($resourcetype, array(SCREEN_RESOURCE_TRIGGERS_OVERVIEW, SCREEN_RESOURCE_DATA_OVERVIEW))) {
            $cmbStyle = new CComboBox('style', $style);
            $cmbStyle->addItem(STYLE_LEFT, S_LEFT);
            $cmbStyle->addItem(STYLE_TOP, S_TOP);
            $form->addRow(S_HOSTS_LOCATION, $cmbStyle);
        } else {
            if ($resourcetype == SCREEN_RESOURCE_CLOCK) {
                $cmbStyle = new CComboBox('style', $style);
                $cmbStyle->addItem(TIME_TYPE_LOCAL, S_LOCAL_TIME);
                $cmbStyle->addItem(TIME_TYPE_SERVER, S_SERVER_TIME);
                $form->addRow(S_TIME_TYPE, $cmbStyle);
            } else {
                $form->addVar('style', 0);
            }
        }
    }
    if (uint_in_array($resourcetype, array(SCREEN_RESOURCE_URL))) {
        $form->addRow(S_URL, new CTextBox('url', $url, 60));
    } else {
        $form->addVar('url', '');
    }
    if (uint_in_array($resourcetype, array(SCREEN_RESOURCE_GRAPH, SCREEN_RESOURCE_SIMPLE_GRAPH, SCREEN_RESOURCE_CLOCK, SCREEN_RESOURCE_URL))) {
        $form->addRow(S_WIDTH, new CNumericBox('width', $width, 5));
        $form->addRow(S_HEIGHT, new CNumericBox('height', $height, 5));
    } else {
        $form->addVar('width', 500);
        $form->addVar('height', 100);
    }
    if (uint_in_array($resourcetype, array(SCREEN_RESOURCE_GRAPH, SCREEN_RESOURCE_SIMPLE_GRAPH, SCREEN_RESOURCE_MAP, SCREEN_RESOURCE_CLOCK, SCREEN_RESOURCE_URL))) {
        $cmbHalign = new CComboBox('halign', $halign);
        $cmbHalign->addItem(HALIGN_CENTER, S_CENTRE);
        $cmbHalign->addItem(HALIGN_LEFT, S_LEFT);
        $cmbHalign->addItem(HALIGN_RIGHT, S_RIGHT);
        $form->addRow(S_HORIZONTAL_ALIGN, $cmbHalign);
    } else {
        $form->addVar('halign', 0);
    }
    $cmbValign = new CComboBox('valign', $valign);
    $cmbValign->addItem(VALIGN_MIDDLE, S_MIDDLE);
    $cmbValign->addItem(VALIGN_TOP, S_TOP);
    $cmbValign->addItem(VALIGN_BOTTOM, S_BOTTOM);
    $form->addRow(S_VERTICAL_ALIGN, $cmbValign);
    $form->addRow(S_COLUMN_SPAN, new CNumericBox('colspan', $colspan, 2));
    $form->addRow(S_ROW_SPAN, new CNumericBox('rowspan', $rowspan, 2));
    // dynamic AddOn
    if (uint_in_array($resourcetype, array(SCREEN_RESOURCE_GRAPH, SCREEN_RESOURCE_SIMPLE_GRAPH, SCREEN_RESOURCE_PLAIN_TEXT))) {
        $form->addRow(S_DYNAMIC_ITEM, new CCheckBox('dynamic', $dynamic, null, 1));
    }
    $form->addItemToBottomRow(new CButton('save', S_SAVE));
    if (isset($_REQUEST['screenitemid'])) {
        $form->addItemToBottomRow(SPACE);
        $form->addItemToBottomRow(new CButtonDelete(null, url_param('form') . url_param('screenid') . url_param('screenitemid')));
    }
    $form->addItemToBottomRow(SPACE);
    $form->addItemToBottomRow(new CButtonCancel(url_param('screenid')));
    return $form;
}
Пример #17
0
 $node_form->setAttribute('id', 'node_form');
 // +++ create Combo Box with selected nodes +++
 $combo_node_list = null;
 if (count($ZBX_VIEWED_NODES['nodes']) > 0) {
     $combo_node_list = new CComboBox('switch_node', $ZBX_VIEWED_NODES['selected'], 'submit()');
     foreach ($ZBX_VIEWED_NODES['nodes'] as $nodeid => $nodedata) {
         $combo_node_list->addItem($nodeid, $nodedata['name']);
     }
 }
 // --- ---
 $jscript = 'javascript : ' . " var pos = getPosition('button_show_tree');" . " ShowHide('div_node_tree',IE6?'block':'table');" . ' pos.top += 20;' . " \$('div_node_tree').setStyle({top: pos.top+'px'});" . " showPopupDiv('div_node_tree','select_iframe');";
 // IE6
 $button_show_tree = new CButton('show_node_tree', S_SELECT_NODES, $jscript);
 //sdelatj konstatntu!
 $button_show_tree->setType('button');
 $button_show_tree->setAttribute('id', 'button_show_tree');
 // +++ Create node tree +++
 $combo_check_all = new CCheckbox('check_all_nodes', null, "javascript : check_all('node_form', this.checked);");
 $node_tree = array();
 $node_tree[0] = array('id' => 0, 'caption' => S_ALL_S, 'combo_select_node' => $combo_check_all, 'parentid' => 0);
 //root
 foreach ($available_nodes as $num => $node) {
     $checked = uint_in_array($node['nodeid'], $ZBX_VIEWED_NODES['nodeids']);
     $combo_select_node = new CCheckbox('selected_nodes[' . $node['nodeid'] . ']', $checked, null, $node['nodeid']);
     // If not exist parent for node, link it to root (0)
     if (!isset($available_nodes[$node['masterid']])) {
         $node['masterid'] = 0;
     }
     $node_tree[$node['nodeid']] = array('id' => $node['nodeid'], 'caption' => $node['name'], 'combo_select_node' => $combo_select_node, 'parentid' => $node['masterid']);
 }
 $node_tree_captions = array('caption' => bold(S_NODE), 'combo_select_node' => SPACE);
Пример #18
0
$save_btn = new CButton('save', S_SAVE);
$save_btn->setAttribute('id', 'sysmap_save');
$elcn_tab = new CTable(null, 'textwhite');
$menuRow = array();
$gridShow = new CSpan(S_SHOWN, 'whitelink');
$gridShow->setAttribute('id', 'gridshow');
$gridAutoAlign = new CSpan(S_ON, 'whitelink');
$gridAutoAlign->setAttribute('id', 'gridautoalign');
$gridSize = new CComboBox('gridsize');
$gridSize->addItem('20x20', '20x20');
$gridSize->addItem('40x40', '40x40');
$gridSize->addItem('50x50', '50x50', 1);
$gridSize->addItem('75x75', '75x75');
$gridSize->addItem('100x100', '100x100');
$gridAlignAll = new CButton('gridalignall', S_ALIGN_ICONS);
$gridAlignAll->setAttribute('id', 'gridalignall');
$gridForm = new CDiv(array($gridSize, $gridAlignAll));
$gridForm->setAttribute('id', 'gridalignblock');
array_push($menuRow, S_MAP . ' "' . $sysmap['name'] . '"');
array_push($menuRow, SPACE . SPACE);
array_push($menuRow, S_ICON . ' [', $el_add, $el_rmv, ']');
array_push($menuRow, SPACE . SPACE);
array_push($menuRow, S_LINK . ' [', $cn_add, $cn_rmv, ']');
array_push($menuRow, SPACE . SPACE);
array_push($menuRow, S_GRID . ' [', $gridShow, '|', $gridAutoAlign, ']');
array_push($menuRow, SPACE, $gridForm);
$elcn_tab->addRow($menuRow);
//	show_table_header($map['name'], $save_btn);
show_table_header($elcn_tab, $save_btn);
$sysmap_img = new CImg('images/general/tree/zero.gif', 'sysmap');
$sysmap_img->setAttribute('id', 'sysmap_img');