Exemple #1
0
            $frmCnct->AddVar("linkid", $_REQUEST["linkid"]);
            $db_link = DBfetch(DBselect('SELECT * FROM sysmaps_link_triggers WHERE linkid=' . $_REQUEST["linkid"] . ' AND triggerid=' . $_REQUEST['triggerid']));
            $triggerid = $_REQUEST['triggerid'];
            $drawtype = $db_link["drawtype"];
            $color = $db_link["color"];
        } else {
            $triggerid = get_request("triggerid", 0);
            $drawtype = get_request("drawtype", 0);
            $color = get_request("color", 0);
        }
        $frmCnct->AddVar("triggerid", $triggerid);
        /* START comboboxes preparations */
        $cmbType = new CComboBox("drawtype", $drawtype);
        foreach (map_link_drawtypes() as $i) {
            $value = map_link_drawtype2str($i);
            $cmbType->AddItem($i, $value);
        }
        $btnSelect = new CButton('btn1', S_SELECT, "return PopUp('popup.php?dstfrm=" . $frmCnct->GetName() . "&dstfld1=triggerid&dstfld2=trigger&srctbl=triggers&srcfld1=triggerid&srcfld2=description');", 'T');
        $btnSelect->SetType('button');
        /* END preparation */
        $description = $triggerid > 0 ? expand_trigger_description($triggerid) : '';
        $frmCnct->AddRow(S_TRIGGER, array(new CTextBox('trigger', $description, 70, 'yes'), SPACE, $btnSelect));
        $frmCnct->AddRow(S_TYPE . ' (' . S_PROBLEM_BIG . ')', $cmbType);
        $frmCnct->AddRow(S_COLOR . ' (' . S_PROBLEM_BIG . ')', new CColor('color', $color));
        $frmCnct->AddItemToBottomRow(new CButton("save", isset($_REQUEST['triggerid']) ? S_SAVE : S_ADD));
        $frmCnct->AddItemToBottomRow(SPACE);
        $frmCnct->AddItemToBottomRow(new CButton("cancel", S_CANCEL, 'javascript: window.close();'));
        $frmCnct->Show();
    }
}
include_once "include/page_footer.php";
Exemple #2
0
);
		close_window();
	}
}
-->
</script>
<?php 
}
echo SBR;
$form = new CFormTable(S_CONDITION);
$form->SetHelp('config_triggers.php');
$form->SetName('expression');
$form->AddVar('dstfrm', $dstfrm);
$form->AddVar('dstfld1', $dstfld1);
$form->AddVar('itemid', $itemid);
$form->AddRow(S_ITEM, array(new CTextBox('description', $description, 50, 'yes'), new CButton('select', S_SELECT, "return PopUp('popup.php?dstfrm=" . $form->GetName() . "&dstfld1=itemid&dstfld2=description&" . "srctbl=items&srcfld1=itemid&srcfld2=description',0,0,'zbx_popup_item');")));
$cmbFnc = new CComboBox('expr_type', $expr_type, 'submit()');
foreach ($functions as $id => $f) {
    foreach ($f['operators'] as $op => $txt_op) {
        $cmbFnc->AddItem($id . '[' . $op . ']', str_replace('{OP}', $txt_op, $f['description']));
    }
}
$form->AddRow(S_FUNCTION, $cmbFnc);
if (isset($functions[$function]['params'])) {
    foreach ($functions[$function]['params'] as $pid => $pf) {
        $pv = isset($param[$pid]) ? $param[$pid] : null;
        if ($pf['T'] == T_ZBX_INT) {
            if (0 == $pid) {
                if (isset($pf['M']) && is_array($pf['M'])) {
                    $cmbParamType = new CComboBox('paramtype', $paramtype);
                    foreach ($pf['M'] as $mid => $caption) {
Exemple #3
0
}
$media = get_request('media', -1);
$sendto = get_request('sendto', '');
$mediatypeid = get_request('mediatypeid', 0);
$active = get_request('active', 0);
$period = get_request('period', '1-7,00:00-23:59');
$frmMedia = new CFormTable(S_NEW_MEDIA);
$frmMedia->SetHelp("web.media.php");
$frmMedia->AddVar("media", $media);
$frmMedia->AddVar("dstfrm", $_REQUEST["dstfrm"]);
$cmbType = new CComboBox("mediatypeid", $mediatypeid);
$types = DBselect('SELECT mediatypeid,description ' . ' FROM media_type' . ' WHERE ' . DBin_node('mediatypeid') . ' ORDER BY type');
while ($type = DBfetch($types)) {
    $cmbType->AddItem($type["mediatypeid"], get_node_name_by_elid($type["mediatypeid"]) . $type["description"]);
}
$frmMedia->AddRow(S_TYPE, $cmbType);
$frmMedia->AddRow(S_SEND_TO, new CTextBox("sendto", $sendto, 20));
$frmMedia->AddRow(S_WHEN_ACTIVE, new CTextBox("period", $period, 48));
$frm_row = array();
for ($i = 0; $i <= 5; $i++) {
    array_push($frm_row, array(new CCheckBox("severity[{$i}]", str_in_array($i, $severity) ? 'yes' : 'no', null, $i), get_severity_description($i)), BR());
}
$frmMedia->AddRow(S_USE_IF_SEVERITY, $frm_row);
$cmbStat = new CComboBox("active", $active);
$cmbStat->AddItem(0, S_ENABLED);
$cmbStat->AddItem(1, S_DISABLED);
$frmMedia->AddRow("Status", $cmbStat);
$frmMedia->AddItemToBottomRow(new CButton("add", $media > -1 ? S_SAVE : S_ADD));
$frmMedia->AddItemToBottomRow(SPACE);
$frmMedia->AddItemToBottomRow(new CButtonCancel(null, 'close_window();'));
$frmMedia->Show();
Exemple #4
0
//,'events.php?filter_set=1','POST',null,'sform');
$filterForm->AddOption('name', 'zbx_filter');
$filterForm->AddOption('id', 'zbx_filter');
$filterForm->SetMethod('get');
$filterForm->AddVar('nav_time', $_REQUEST['nav_time']);
if (EVENT_SOURCE_TRIGGERS == $source) {
    $script = new CScript("javascript: if(CLNDR['events_since'].clndr.setSDateFromOuterObj()){" . "\$('filter_timesince').value = parseInt(CLNDR['events_since'].clndr.sdt.getTime()/1000);}" . "if(CLNDR['events_till'].clndr.setSDateFromOuterObj()){" . "\$('filter_timetill').value = parseInt(CLNDR['events_till'].clndr.sdt.getTime()/1000);}");
    $filterForm->AddAction('onsubmit', $script);
    $filterForm->AddVar('triggerid', $_REQUEST['triggerid']);
    if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {
        $trigger = expand_trigger_description($_REQUEST['triggerid']);
    } else {
        $trigger = "";
    }
    $row = new CRow(array(new CCol(S_TRIGGER, 'form_row_l'), new CCol(array(new CTextBox("trigger", $trigger, 96, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->GetName() . "&dstfld1=triggerid&dstfld2=trigger" . "&srctbl=triggers&srcfld1=triggerid&srcfld2=description&real_hosts=1');", 'T')), 'form_row_r')));
    $filterForm->AddRow($row);
    $filterForm->AddVar('show_unknown', $show_unknown);
    $unkcbx = new CCheckBox('show_unk', $show_unknown, null, '1');
    $unkcbx->SetAction('javascript: create_var("' . $filterForm->GetName() . '", "show_unknown", (this.checked?1:0), 0); ');
    $filterForm->AddRow(S_SHOW_UNKNOWN, $unkcbx);
    $reset = new CButton("filter_rst", S_RESET);
    $reset->SetType('button');
    $reset->SetAction('javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst",1); location.href = uri.getUrl();');
    $filterForm->AddItemToBottomRow(new CButton("filter_set", S_FILTER));
    $filterForm->AddItemToBottomRow($reset);
    $p_elements[] = create_filter(S_FILTER, $navigation, $filterForm, 'tr_filter', get_profile('web.events.filter.state', 0));
} else {
    $p_elements[] = get_thin_table_header(SPACE, $navigation);
}
//-------
$p_elements[] = $table;
Exemple #5
0
function insert_host_form($show_only_tmp = 0)
{
    global $USER_DETAILS;
    $groups = get_request('groups', array());
    $newgroup = get_request('newgroup', '');
    $host = get_request('host', '');
    $port = get_request('port', get_profile('HOST_PORT', 10050));
    $status = get_request('status', HOST_STATUS_MONITORED);
    $useip = get_request('useip', 0);
    $dns = get_request('dns', '');
    $ip = get_request('ip', '0.0.0.0');
    $proxy_hostid = get_request('proxy_hostid', '');
    $useipmi = get_request('useipmi', 'no');
    $ipmi_ip = get_request('ipmi_ip', '');
    $ipmi_port = get_request('ipmi_port', 623);
    $ipmi_authtype = get_request('ipmi_authtype', -1);
    $ipmi_privilege = get_request('ipmi_privilege', 2);
    $ipmi_username = get_request('ipmi_username', '');
    $ipmi_password = get_request('ipmi_password', '');
    $useprofile = get_request('useprofile', 'no');
    $devicetype = get_request('devicetype', '');
    $name = get_request('name', '');
    $os = get_request('os', '');
    $serialno = get_request('serialno', '');
    $tag = get_request('tag', '');
    $macaddress = get_request('macaddress', '');
    $hardware = get_request('hardware', '');
    $software = get_request('software', '');
    $contact = get_request('contact', '');
    $location = get_request('location', '');
    $notes = get_request('notes', '');
    // BEGIN: HOSTS PROFILE EXTENDED Section
    $useprofile_ext = get_request('useprofile_ext', 'no');
    $ext_host_profiles = get_request('ext_host_profiles', array());
    // END:   HOSTS PROFILE EXTENDED Section
    $templates = get_request('templates', array());
    $clear_templates = get_request('clear_templates', array());
    $frm_title = $show_only_tmp ? S_TEMPLATE : S_HOST;
    if ($_REQUEST['hostid'] > 0) {
        $db_host = get_host_by_hostid($_REQUEST['hostid']);
        $frm_title .= SPACE . ' [' . $db_host['host'] . ']';
        $original_templates = get_templates_by_hostid($_REQUEST['hostid']);
    } else {
        $original_templates = array();
    }
    if ($_REQUEST['hostid'] > 0 && !isset($_REQUEST['form_refresh'])) {
        $proxy_hostid = $db_host['proxy_hostid'];
        $host = $db_host['host'];
        $port = $db_host['port'];
        $status = $db_host['status'];
        $useip = $db_host['useip'];
        $useipmi = $db_host['useipmi'] ? 'yes' : 'no';
        $ip = $db_host['ip'];
        $dns = $db_host['dns'];
        $ipmi_ip = $db_host['ipmi_ip'];
        $ipmi_port = $db_host['ipmi_port'];
        $ipmi_authtype = $db_host['ipmi_authtype'];
        $ipmi_privilege = $db_host['ipmi_privilege'];
        $ipmi_username = $db_host['ipmi_username'];
        $ipmi_password = $db_host['ipmi_password'];
        // add groups
        $available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_LIST);
        $db_groups = DBselect('SELECT DISTINCT groupid ' . ' FROM hosts_groups ' . ' WHERE hostid=' . $_REQUEST['hostid'] . ' AND ' . DBcondition('groupid', $available_groups));
        while ($db_group = DBfetch($db_groups)) {
            if (uint_in_array($db_group['groupid'], $groups)) {
                continue;
            }
            $groups[$db_group['groupid']] = $db_group['groupid'];
        }
        // read profile
        $db_profiles = DBselect('SELECT * FROM hosts_profiles WHERE hostid=' . $_REQUEST['hostid']);
        $useprofile = 'no';
        $db_profile = DBfetch($db_profiles);
        if ($db_profile) {
            $useprofile = 'yes';
            $devicetype = $db_profile['devicetype'];
            $name = $db_profile['name'];
            $os = $db_profile['os'];
            $serialno = $db_profile['serialno'];
            $tag = $db_profile['tag'];
            $macaddress = $db_profile['macaddress'];
            $hardware = $db_profile['hardware'];
            $software = $db_profile['software'];
            $contact = $db_profile['contact'];
            $location = $db_profile['location'];
            $notes = $db_profile['notes'];
        }
        // BEGIN: HOSTS PROFILE EXTENDED Section
        $useprofile_ext = 'no';
        $db_profiles_alt = DBselect('SELECT * FROM hosts_profiles_ext		 WHERE hostid=' . $_REQUEST['hostid']);
        if ($ext_host_profiles = DBfetch($db_profiles_alt)) {
            $useprofile_ext = 'yes';
        } else {
            $ext_host_profiles = array();
        }
        // END:   HOSTS PROFILE EXTENDED Section
        $templates = $original_templates;
    }
    $ext_profiles_fields = array('device_alias', 'device_type', 'device_chassis', 'device_os', 'device_os_short', 'device_hw_arch', 'device_serial', 'device_model', 'device_tag', 'device_vendor', 'device_contract', 'device_who', 'device_status', 'device_app_01', 'device_app_02', 'device_app_03', 'device_app_04', 'device_app_05', 'device_url_1', 'device_url_2', 'device_url_3', 'device_networks', 'device_notes', 'device_hardware', 'device_software', 'ip_subnet_mask', 'ip_router', 'ip_macaddress', 'oob_ip', 'oob_subnet_mask', 'oob_router', 'date_hw_buy', 'date_hw_install', 'date_hw_expiry', 'date_hw_decomm', 'site_street_1', 'site_street_2', 'site_street_3', 'site_city', 'site_state', 'site_country', 'site_zip', 'site_rack', 'site_notes', 'poc_1_name', 'poc_1_email', 'poc_1_phone_1', 'poc_1_phone_2', 'poc_1_cell', 'poc_1_screen', 'poc_1_notes', 'poc_2_name', 'poc_2_email', 'poc_2_phone_1', 'poc_2_phone_2', 'poc_2_cell', 'poc_2_screen', 'poc_2_notes');
    foreach ($ext_profiles_fields as $id => $field) {
        if (!isset($ext_host_profiles[$field])) {
            $ext_host_profiles[$field] = '';
        }
    }
    $clear_templates = array_intersect($clear_templates, array_keys($original_templates));
    $clear_templates = array_diff($clear_templates, array_keys($templates));
    asort($templates);
    $frmHost = new CFormTable($frm_title, 'hosts.php');
    $frmHost->setHelp('web.hosts.host.php');
    $frmHost->addVar('config', get_request('config', 0));
    $frmHost->addVar('clear_templates', $clear_templates);
    if ($_REQUEST['hostid'] > 0) {
        $frmHost->addVar('hostid', $_REQUEST['hostid']);
    }
    if ($_REQUEST['groupid'] > 0) {
        $frmHost->addVar('groupid', $_REQUEST['groupid']);
    }
    $frmHost->addRow(S_NAME, new CTextBox('host', $host, 54));
    $available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_LIST);
    $grp_tb = new CTweenBox($frmHost, 'groups', $groups, 10);
    $db_groups = DBselect('SELECT DISTINCT groupid,name ' . ' FROM groups ' . ' WHERE ' . DBcondition('groupid', $available_groups) . ' ORDER BY name');
    while ($db_group = DBfetch($db_groups)) {
        $grp_tb->addItem($db_group['groupid'], $db_group['name']);
    }
    $frmHost->addRow(S_GROUPS, $grp_tb->get(S_IN . SPACE . S_GROUPS, S_OTHER . SPACE . S_GROUPS));
    $frmHost->addRow(S_NEW_GROUP, new CTextBox('newgroup', $newgroup), 'new');
    // onchange does not work on some browsers: MacOS, KDE browser
    if ($show_only_tmp) {
        $frmHost->addVar('useip', 0);
        $frmHost->addVar('ip', '0.0.0.0');
        $frmHost->addVar('dns', '');
    } else {
        $frmHost->addRow(S_DNS_NAME, new CTextBox('dns', $dns, '40'));
        if (defined('ZBX_HAVE_IPV6')) {
            $frmHost->addRow(S_IP_ADDRESS, new CTextBox('ip', $ip, '39'));
        } else {
            $frmHost->addRow(S_IP_ADDRESS, new CTextBox('ip', $ip, '15'));
        }
        $cmbConnectBy = new CComboBox('useip', $useip);
        $cmbConnectBy->addItem(0, S_DNS_NAME);
        $cmbConnectBy->addItem(1, S_IP_ADDRESS);
        $frmHost->addRow(S_CONNECT_TO, $cmbConnectBy);
    }
    if ($show_only_tmp) {
        $port = '10050';
        $status = HOST_STATUS_TEMPLATE;
        $frmHost->addVar('port', $port);
        $frmHost->addVar('status', $status);
    } else {
        $frmHost->AddRow(S_AGENT_PORT, new CNumericBox('port', $port, 5));
        //Proxy
        $cmbProxy = new CComboBox('proxy_hostid', $proxy_hostid);
        $cmbProxy->addItem(0, S_NO_PROXY);
        $db_proxies = DBselect('SELECT hostid,host FROM hosts' . ' where status in (' . HOST_STATUS_PROXY . ') and ' . DBin_node('hostid'));
        while ($db_proxy = DBfetch($db_proxies)) {
            $cmbProxy->addItem($db_proxy['hostid'], $db_proxy['host']);
        }
        $frmHost->addRow(S_MONITORED_BY_PROXY, $cmbProxy);
        //----------
        $cmbStatus = new CComboBox('status', $status);
        $cmbStatus->addItem(HOST_STATUS_MONITORED, S_MONITORED);
        $cmbStatus->addItem(HOST_STATUS_NOT_MONITORED, S_NOT_MONITORED);
        $frmHost->addRow(S_STATUS, $cmbStatus);
    }
    $template_table = new CTable();
    $template_table->SetCellPadding(0);
    $template_table->SetCellSpacing(0);
    foreach ($templates as $id => $temp_name) {
        $frmHost->addVar('templates[' . $id . ']', $temp_name);
        $template_table->addRow(array($temp_name, new CButton('unlink[' . $id . ']', S_UNLINK), isset($original_templates[$id]) ? new CButton('unlink_and_clear[' . $id . ']', S_UNLINK_AND_CLEAR) : SPACE));
    }
    $frmHost->addRow(S_LINK_WITH_TEMPLATE, array($template_table, new CButton('add_template', S_ADD, "return PopUp('popup.php?dstfrm=" . $frmHost->GetName() . "&dstfld1=new_template&srctbl=templates&srcfld1=hostid&srcfld2=host" . url_param($templates, false, 'existed_templates') . "',450,450)", 'T')));
    if ($show_only_tmp) {
        $frmHost->addVar('useipmi', $useipmi);
    } else {
        $frmHost->addRow(S_USEIPMI, new CCheckBox('useipmi', $useipmi, 'submit()'));
    }
    if ($useipmi == 'yes') {
        $frmHost->addRow(S_IPMI_IP_ADDRESS, new CTextBox('ipmi_ip', $ipmi_ip, defined('ZBX_HAVE_IPV6') ? 39 : 15));
        $frmHost->addRow(S_IPMI_PORT, new CNumericBox('ipmi_port', $ipmi_port, 5));
        $cmbIPMIAuthtype = new CComboBox('ipmi_authtype', $ipmi_authtype);
        $cmbIPMIAuthtype->addItem(IPMI_AUTHTYPE_DEFAULT, S_AUTHTYPE_DEFAULT);
        $cmbIPMIAuthtype->addItem(IPMI_AUTHTYPE_NONE, S_AUTHTYPE_NONE);
        $cmbIPMIAuthtype->addItem(IPMI_AUTHTYPE_MD2, S_AUTHTYPE_MD2);
        $cmbIPMIAuthtype->addItem(IPMI_AUTHTYPE_MD5, S_AUTHTYPE_MD5);
        $cmbIPMIAuthtype->addItem(IPMI_AUTHTYPE_STRAIGHT, S_AUTHTYPE_STRAIGHT);
        $cmbIPMIAuthtype->addItem(IPMI_AUTHTYPE_OEM, S_AUTHTYPE_OEM);
        $cmbIPMIAuthtype->addItem(IPMI_AUTHTYPE_RMCP_PLUS, S_AUTHTYPE_RMCP_PLUS);
        $frmHost->addRow(S_IPMI_AUTHTYPE, $cmbIPMIAuthtype);
        $cmbIPMIPrivilege = new CComboBox('ipmi_privilege', $ipmi_privilege);
        $cmbIPMIPrivilege->addItem(IPMI_PRIVILEGE_CALLBACK, S_PRIVILEGE_CALLBACK);
        $cmbIPMIPrivilege->addItem(IPMI_PRIVILEGE_USER, S_PRIVILEGE_USER);
        $cmbIPMIPrivilege->addItem(IPMI_PRIVILEGE_OPERATOR, S_PRIVILEGE_OPERATOR);
        $cmbIPMIPrivilege->addItem(IPMI_PRIVILEGE_ADMIN, S_PRIVILEGE_ADMIN);
        $cmbIPMIPrivilege->addItem(IPMI_PRIVILEGE_OEM, S_PRIVILEGE_OEM);
        $frmHost->addRow(S_IPMI_PRIVILEGE, $cmbIPMIPrivilege);
        $frmHost->addRow(S_IPMI_USERNAME, new CTextBox('ipmi_username', $ipmi_username, 16));
        $frmHost->addRow(S_IPMI_PASSWORD, new CTextBox('ipmi_password', $ipmi_password, 20));
    } else {
        $frmHost->addVar('ipmi_ip', $ipmi_ip);
        $frmHost->addVar('ipmi_port', $ipmi_port);
        $frmHost->addVar('ipmi_authtype', $ipmi_authtype);
        $frmHost->addVar('ipmi_privilege', $ipmi_privilege);
        $frmHost->addVar('ipmi_username', $ipmi_username);
        $frmHost->addVar('ipmi_password', $ipmi_password);
    }
    if ($show_only_tmp) {
        $useprofile = 'no';
        $frmHost->addVar('useprofile', $useprofile);
        $useprofile_ext = 'no';
        $frmHost->addVar('useprofile_ext', $useprofile_ext);
    } else {
        $frmHost->addRow(S_USE_PROFILE, new CCheckBox('useprofile', $useprofile, 'submit()'));
        $frmHost->addRow(S_USE_EXTENDED_PROFILE, new CCheckBox('useprofile_ext', $useprofile_ext, 'submit()', 'yes'));
    }
    if ($useprofile == 'yes') {
        $frmHost->addRow(S_DEVICE_TYPE, new CTextBox("devicetype", $devicetype, 61));
        $frmHost->addRow(S_NAME, new CTextBox("name", $name, 61));
        $frmHost->addRow(S_OS, new CTextBox("os", $os, 61));
        $frmHost->addRow(S_SERIALNO, new CTextBox("serialno", $serialno, 61));
        $frmHost->addRow(S_TAG, new CTextBox("tag", $tag, 61));
        $frmHost->addRow(S_MACADDRESS, new CTextBox("macaddress", $macaddress, 61));
        $frmHost->addRow(S_HARDWARE, new CTextArea("hardware", $hardware, 60, 4));
        $frmHost->addRow(S_SOFTWARE, new CTextArea("software", $software, 60, 4));
        $frmHost->addRow(S_CONTACT, new CTextArea("contact", $contact, 60, 4));
        $frmHost->addRow(S_LOCATION, new CTextArea("location", $location, 60, 4));
        $frmHost->addRow(S_NOTES, new CTextArea("notes", $notes, 60, 4));
    } else {
        $frmHost->addVar("devicetype", $devicetype);
        $frmHost->addVar("name", $name);
        $frmHost->addVar("os", $os);
        $frmHost->addVar("serialno", $serialno);
        $frmHost->addVar("tag", $tag);
        $frmHost->addVar("macaddress", $macaddress);
        $frmHost->addVar("hardware", $hardware);
        $frmHost->addVar("software", $software);
        $frmHost->addVar("contact", $contact);
        $frmHost->addVar("location", $location);
        $frmHost->addVar("notes", $notes);
    }
    // 		BEGIN: HOSTS PROFILE EXTENDED Section
    if ($useprofile_ext == "yes") {
        $frmHost->addRow(S_DEVICE_ALIAS, new CTextBox('ext_host_profiles[device_alias]', $ext_host_profiles['device_alias'], 61));
        $frmHost->addRow(S_DEVICE_TYPE, new CTextBox('ext_host_profiles[device_type]', $ext_host_profiles['device_type'], 61));
        $frmHost->addRow(S_DEVICE_CHASSIS, new CTextBox('ext_host_profiles[device_chassis]', $ext_host_profiles['device_chassis'], 61));
        $frmHost->addRow(S_DEVICE_OS, new CTextBox('ext_host_profiles[device_os]', $ext_host_profiles['device_os'], 61));
        $frmHost->addRow(S_DEVICE_OS_SHORT, new CTextBox('ext_host_profiles[device_os_short]', $ext_host_profiles['device_os_short'], 61));
        $frmHost->addRow(S_DEVICE_HW_ARCH, new CTextBox('ext_host_profiles[device_hw_arch]', $ext_host_profiles['device_hw_arch'], 61));
        $frmHost->addRow(S_DEVICE_SERIAL, new CTextBox('ext_host_profiles[device_serial]', $ext_host_profiles['device_serial'], 61));
        $frmHost->addRow(S_DEVICE_MODEL, new CTextBox('ext_host_profiles[device_model]', $ext_host_profiles['device_model'], 61));
        $frmHost->addRow(S_DEVICE_TAG, new CTextBox('ext_host_profiles[device_tag]', $ext_host_profiles['device_tag'], 61));
        $frmHost->addRow(S_DEVICE_VENDOR, new CTextBox('ext_host_profiles[device_vendor]', $ext_host_profiles['device_vendor'], 61));
        $frmHost->addRow(S_DEVICE_CONTRACT, new CTextBox('ext_host_profiles[device_contract]', $ext_host_profiles['device_contract'], 61));
        $frmHost->addRow(S_DEVICE_WHO, new CTextBox('ext_host_profiles[device_who]', $ext_host_profiles['device_who'], 61));
        $frmHost->addRow(S_DEVICE_STATUS, new CTextBox('ext_host_profiles[device_status]', $ext_host_profiles['device_status'], 61));
        $frmHost->addRow(S_DEVICE_APP_01, new CTextBox('ext_host_profiles[device_app_01]', $ext_host_profiles['device_app_01'], 61));
        $frmHost->addRow(S_DEVICE_APP_02, new CTextBox('ext_host_profiles[device_app_02]', $ext_host_profiles['device_app_02'], 61));
        $frmHost->addRow(S_DEVICE_APP_03, new CTextBox('ext_host_profiles[device_app_03]', $ext_host_profiles['device_app_03'], 61));
        $frmHost->addRow(S_DEVICE_APP_04, new CTextBox('ext_host_profiles[device_app_04]', $ext_host_profiles['device_app_04'], 61));
        $frmHost->addRow(S_DEVICE_APP_05, new CTextBox('ext_host_profiles[device_app_05]', $ext_host_profiles['device_app_05'], 61));
        $frmHost->addRow(S_DEVICE_URL_1, new CTextBox('ext_host_profiles[device_url_1]', $ext_host_profiles['device_url_1'], 61));
        $frmHost->addRow(S_DEVICE_URL_2, new CTextBox('ext_host_profiles[device_url_2]', $ext_host_profiles['device_url_2'], 61));
        $frmHost->addRow(S_DEVICE_URL_3, new CTextBox('ext_host_profiles[device_url_3]', $ext_host_profiles['device_url_3'], 61));
        $frmHost->addRow(S_DEVICE_NETWORKS, new CTextArea('ext_host_profiles[device_networks]', $ext_host_profiles['device_networks'], 50, 5));
        $frmHost->addRow(S_DEVICE_NOTES, new CTextArea('ext_host_profiles[device_notes]', $ext_host_profiles['device_notes'], 50, 5));
        $frmHost->addRow(S_DEVICE_HARDWARE, new CTextArea('ext_host_profiles[device_hardware]', $ext_host_profiles['device_hardware'], 50, 5));
        $frmHost->addRow(S_DEVICE_SOFTWARE, new CTextArea('ext_host_profiles[device_software]', $ext_host_profiles['device_software'], 50, 5));
        $frmHost->addRow(S_IP_SUBNET_MASK, new CTextBox('ext_host_profiles[ip_subnet_mask]', $ext_host_profiles['ip_subnet_mask'], 61));
        $frmHost->addRow(S_IP_ROUTER, new CTextBox('ext_host_profiles[ip_router]', $ext_host_profiles['ip_router'], 61));
        $frmHost->addRow(S_IP_MACADDRESS, new CTextBox('ext_host_profiles[ip_macaddress]', $ext_host_profiles['ip_macaddress'], 61));
        $frmHost->addRow(S_OOB_IP, new CTextBox('ext_host_profiles[oob_ip]', $ext_host_profiles['oob_ip'], 61));
        $frmHost->addRow(S_OOB_SUBNET_MASK, new CTextBox('ext_host_profiles[oob_subnet_mask]', $ext_host_profiles['oob_subnet_mask'], 61));
        $frmHost->addRow(S_OOB_ROUTER, new CTextBox('ext_host_profiles[oob_router]', $ext_host_profiles['oob_router'], 61));
        $frmHost->addRow(S_DATE_HW_BUY, new CTextBox('ext_host_profiles[date_hw_buy]', $ext_host_profiles['date_hw_buy'], 15));
        $frmHost->addRow(S_DATE_HW_INSTALL, new CTextBox('ext_host_profiles[date_hw_install]', $ext_host_profiles['date_hw_install'], 15));
        $frmHost->addRow(S_DATE_HW_EXPIRY, new CTextBox('ext_host_profiles[date_hw_expiry]', $ext_host_profiles['date_hw_expiry'], 15));
        $frmHost->addRow(S_DATE_HW_DECOMM, new CTextBox('ext_host_profiles[date_hw_decomm]', $ext_host_profiles['date_hw_decomm'], 15));
        $frmHost->addRow(S_SITE_STREET_1, new CTextBox('ext_host_profiles[site_street_1]', $ext_host_profiles['site_street_1'], 61));
        $frmHost->addRow(S_SITE_STREET_2, new CTextBox('ext_host_profiles[site_street_2]', $ext_host_profiles['site_street_2'], 61));
        $frmHost->addRow(S_SITE_STREET_3, new CTextBox('ext_host_profiles[site_street_3]', $ext_host_profiles['site_street_3'], 61));
        $frmHost->addRow(S_SITE_CITY, new CTextBox('ext_host_profiles[site_city]', $ext_host_profiles['site_city'], 61));
        $frmHost->addRow(S_SITE_STATE, new CTextBox('ext_host_profiles[site_state]', $ext_host_profiles['site_state'], 61));
        $frmHost->addRow(S_SITE_COUNTRY, new CTextBox('ext_host_profiles[site_country]', $ext_host_profiles['site_country'], 61));
        $frmHost->addRow(S_SITE_ZIP, new CTextBox('ext_host_profiles[site_zip]', $ext_host_profiles['site_zip'], 61));
        $frmHost->addRow(S_SITE_RACK, new CTextBox('ext_host_profiles[site_rack]', $ext_host_profiles['site_rack'], 61));
        $frmHost->addRow(S_SITE_NOTES, new CTextArea('ext_host_profiles[site_notes]', $ext_host_profiles['site_notes'], 50, 5));
        $frmHost->addRow(S_POC_1_NAME, new CTextBox('ext_host_profiles[poc_1_name]', $ext_host_profiles['poc_1_name'], 61));
        $frmHost->addRow(S_POC_1_EMAIL, new CTextBox('ext_host_profiles[poc_1_email]', $ext_host_profiles['poc_1_email'], 61));
        $frmHost->addRow(S_POC_1_PHONE_1, new CTextBox('ext_host_profiles[poc_1_phone_1]', $ext_host_profiles['poc_1_phone_1'], 61));
        $frmHost->addRow(S_POC_1_PHONE_2, new CTextBox('ext_host_profiles[poc_1_phone_2]', $ext_host_profiles['poc_1_phone_2'], 61));
        $frmHost->addRow(S_POC_1_CELL, new CTextBox('ext_host_profiles[poc_1_cell]', $ext_host_profiles['poc_1_cell'], 61));
        $frmHost->addRow(S_POC_1_SCREEN, new CTextBox('ext_host_profiles[poc_1_screen]', $ext_host_profiles['poc_1_screen'], 61));
        $frmHost->addRow(S_POC_1_NOTES, new CTextArea('ext_host_profiles[poc_1_notes]', $ext_host_profiles['poc_1_notes'], 50, 5));
        $frmHost->addRow(S_POC_2_NAME, new CTextBox('ext_host_profiles[poc_2_name]', $ext_host_profiles['poc_2_name'], 61));
        $frmHost->addRow(S_POC_2_EMAIL, new CTextBox('ext_host_profiles[poc_2_email]', $ext_host_profiles['poc_2_email'], 61));
        $frmHost->addRow(S_POC_2_PHONE_1, new CTextBox('ext_host_profiles[poc_2_phone_1]', $ext_host_profiles['poc_2_phone_1'], 61));
        $frmHost->addRow(S_POC_2_PHONE_2, new CTextBox('ext_host_profiles[poc_2_phone_2]', $ext_host_profiles['poc_2_phone_2'], 61));
        $frmHost->addRow(S_POC_2_CELL, new CTextBox('ext_host_profiles[poc_2_cell]', $ext_host_profiles['poc_2_cell'], 61));
        $frmHost->addRow(S_POC_2_SCREEN, new CTextBox('ext_host_profiles[poc_2_screen]', $ext_host_profiles['poc_2_screen'], 61));
        $frmHost->addRow(S_POC_2_NOTES, new CTextArea('ext_host_profiles[poc_2_notes]', $ext_host_profiles['poc_2_notes'], 50, 5));
    } else {
        $frmHost->addVar('ext_host_profiles[device_alias]', $ext_host_profiles['device_alias']);
        $frmHost->addVar('ext_host_profiles[device_type]', $ext_host_profiles['device_type']);
        $frmHost->addVar('ext_host_profiles[device_chassis]', $ext_host_profiles['device_chassis']);
        $frmHost->addVar('ext_host_profiles[device_os]', $ext_host_profiles['device_os']);
        $frmHost->addVar('ext_host_profiles[device_os_short]', $ext_host_profiles['device_os_short']);
        $frmHost->addVar('ext_host_profiles[device_hw_arch]', $ext_host_profiles['device_hw_arch']);
        $frmHost->addVar('ext_host_profiles[device_serial]', $ext_host_profiles['device_serial']);
        $frmHost->addVar('ext_host_profiles[device_model]', $ext_host_profiles['device_model']);
        $frmHost->addVar('ext_host_profiles[device_tag]', $ext_host_profiles['device_tag']);
        $frmHost->addVar('ext_host_profiles[device_vendor]', $ext_host_profiles['device_vendor']);
        $frmHost->addVar('ext_host_profiles[device_contract]', $ext_host_profiles['device_contract']);
        $frmHost->addVar('ext_host_profiles[device_who]', $ext_host_profiles['device_who']);
        $frmHost->addVar('ext_host_profiles[device_status]', $ext_host_profiles['device_status']);
        $frmHost->addVar('ext_host_profiles[device_app_01]', $ext_host_profiles['device_app_01']);
        $frmHost->addVar('ext_host_profiles[device_app_02]', $ext_host_profiles['device_app_02']);
        $frmHost->addVar('ext_host_profiles[device_app_03]', $ext_host_profiles['device_app_03']);
        $frmHost->addVar('ext_host_profiles[device_app_04]', $ext_host_profiles['device_app_04']);
        $frmHost->addVar('ext_host_profiles[device_app_05]', $ext_host_profiles['device_app_05']);
        $frmHost->addVar('ext_host_profiles[device_url_1]', $ext_host_profiles['device_url_1']);
        $frmHost->addVar('ext_host_profiles[device_url_2]', $ext_host_profiles['device_url_2']);
        $frmHost->addVar('ext_host_profiles[device_url_3]', $ext_host_profiles['device_url_3']);
        $frmHost->addVar('ext_host_profiles[device_networks]', $ext_host_profiles['device_networks']);
        $frmHost->addVar('ext_host_profiles[device_notes]', $ext_host_profiles['device_notes']);
        $frmHost->addVar('ext_host_profiles[device_hardware]', $ext_host_profiles['device_hardware']);
        $frmHost->addVar('ext_host_profiles[device_software]', $ext_host_profiles['device_software']);
        $frmHost->addVar('ext_host_profiles[ip_subnet_mask]', $ext_host_profiles['ip_subnet_mask']);
        $frmHost->addVar('ext_host_profiles[ip_router]', $ext_host_profiles['ip_router']);
        $frmHost->addVar('ext_host_profiles[ip_macaddress]', $ext_host_profiles['ip_macaddress']);
        $frmHost->addVar('ext_host_profiles[oob_ip]', $ext_host_profiles['oob_ip']);
        $frmHost->addVar('ext_host_profiles[oob_subnet_mask]', $ext_host_profiles['oob_subnet_mask']);
        $frmHost->addVar('ext_host_profiles[oob_router]', $ext_host_profiles['oob_router']);
        $frmHost->addVar('ext_host_profiles[date_hw_buy]', $ext_host_profiles['date_hw_buy']);
        $frmHost->addVar('ext_host_profiles[date_hw_install]', $ext_host_profiles['date_hw_install']);
        $frmHost->addVar('ext_host_profiles[date_hw_expiry]', $ext_host_profiles['date_hw_expiry']);
        $frmHost->addVar('ext_host_profiles[date_hw_decomm]', $ext_host_profiles['date_hw_decomm']);
        $frmHost->addVar('ext_host_profiles[site_street_1]', $ext_host_profiles['site_street_1']);
        $frmHost->addVar('ext_host_profiles[site_street_2]', $ext_host_profiles['site_street_2']);
        $frmHost->addVar('ext_host_profiles[site_street_3]', $ext_host_profiles['site_street_3']);
        $frmHost->addVar('ext_host_profiles[site_city]', $ext_host_profiles['site_city']);
        $frmHost->addVar('ext_host_profiles[site_state]', $ext_host_profiles['site_state']);
        $frmHost->addVar('ext_host_profiles[site_country]', $ext_host_profiles['site_country']);
        $frmHost->addVar('ext_host_profiles[site_zip]', $ext_host_profiles['site_zip']);
        $frmHost->addVar('ext_host_profiles[site_rack]', $ext_host_profiles['site_rack']);
        $frmHost->addVar('ext_host_profiles[site_notes]', $ext_host_profiles['site_notes']);
        $frmHost->addVar('ext_host_profiles[poc_1_name]', $ext_host_profiles['poc_1_name']);
        $frmHost->addVar('ext_host_profiles[poc_1_email]', $ext_host_profiles['poc_1_email']);
        $frmHost->addVar('ext_host_profiles[poc_1_phone_1]', $ext_host_profiles['poc_1_phone_1']);
        $frmHost->addVar('ext_host_profiles[poc_1_phone_2]', $ext_host_profiles['poc_1_phone_2']);
        $frmHost->addVar('ext_host_profiles[poc_1_cell]', $ext_host_profiles['poc_1_cell']);
        $frmHost->addVar('ext_host_profiles[poc_1_screen]', $ext_host_profiles['poc_1_screen']);
        $frmHost->addVar('ext_host_profiles[poc_1_notes]', $ext_host_profiles['poc_1_notes']);
        $frmHost->addVar('ext_host_profiles[poc_2_name]', $ext_host_profiles['poc_2_name']);
        $frmHost->addVar('ext_host_profiles[poc_2_email]', $ext_host_profiles['poc_2_email']);
        $frmHost->addVar('ext_host_profiles[poc_2_phone_1]', $ext_host_profiles['poc_2_phone_1']);
        $frmHost->addVar('ext_host_profiles[poc_2_phone_2]', $ext_host_profiles['poc_2_phone_2']);
        $frmHost->addVar('ext_host_profiles[poc_2_cell]', $ext_host_profiles['poc_2_cell']);
        $frmHost->addVar('ext_host_profiles[poc_2_screen]', $ext_host_profiles['poc_2_screen']);
        $frmHost->addVar('ext_host_profiles[poc_2_notes]', $ext_host_profiles['poc_2_notes']);
    }
    // 		END:   HOSTS PROFILE EXTENDED Section
    if ($_REQUEST['form'] == 'full_clone') {
        // Host items
        $items_lbx = new CListBox('items', null, 8);
        $items_lbx->addOption('disabled', 'disabled');
        $sql = 'SELECT * ' . ' FROM items ' . ' WHERE hostid=' . $_REQUEST['hostid'] . ' AND templateid=0 ' . ' ORDER BY description';
        $host_items_res = DBselect($sql);
        while ($host_item = DBfetch($host_items_res)) {
            $item_description = item_description($host_item);
            $items_lbx->addItem($host_item['itemid'], $item_description);
        }
        if ($items_lbx->ItemsCount() < 1) {
            $items_lbx->addOption('style', 'width: 200px;');
        }
        $frmHost->addRow(S_ITEMS, $items_lbx);
        // Host triggers
        $available_triggers = get_accessible_triggers(PERM_READ_ONLY, array($_REQUEST['hostid']), PERM_RES_IDS_ARRAY);
        $trig_lbx = new CListBox('triggers', null, 8);
        $trig_lbx->addOption('disabled', 'disabled');
        $sql = 'SELECT DISTINCT t.* ' . ' FROM triggers t, items i, functions f' . ' WHERE i.hostid=' . $_REQUEST['hostid'] . ' AND f.itemid=i.itemid ' . ' AND t.triggerid=f.triggerid ' . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND t.templateid=0 ' . ' ORDER BY t.description';
        $host_trig_res = DBselect($sql);
        while ($host_trig = DBfetch($host_trig_res)) {
            $trig_description = expand_trigger_description($host_trig["triggerid"]);
            $trig_lbx->addItem($host_trig['triggerid'], $trig_description);
        }
        if ($trig_lbx->ItemsCount() < 1) {
            $trig_lbx->addOption('style', 'width: 200px;');
        }
        $frmHost->addRow(S_TRIGGERS, $trig_lbx);
        // Host graphs
        $available_graphs = get_accessible_graphs(PERM_READ_ONLY, array($_REQUEST['hostid']), PERM_RES_IDS_ARRAY);
        $graphs_lbx = new CListBox('graphs', null, 8);
        $graphs_lbx->addOption('disabled', 'disabled');
        $def_items = array();
        $sql = 'SELECT DISTINCT g.* ' . ' FROM graphs g, graphs_items gi,items i ' . ' WHERE ' . DBcondition('g.graphid', $available_graphs) . ' AND gi.graphid=g.graphid ' . ' AND g.templateid=0 ' . ' AND i.itemid=gi.itemid ' . ' AND i.hostid=' . $_REQUEST['hostid'] . ' ORDER BY g.name';
        $host_graph_res = DBselect($sql);
        while ($host_graph = DBfetch($host_graph_res)) {
            $graphs_lbx->addItem($host_graph['graphid'], $host_graph['name']);
        }
        if ($graphs_lbx->ItemsCount() < 1) {
            $graphs_lbx->addOption('style', 'width: 200px;');
        }
        $frmHost->addRow(S_GRAPHS, $graphs_lbx);
    }
    $frmHost->addItemToBottomRow(new CButton("save", S_SAVE));
    if ($_REQUEST['hostid'] > 0 && $_REQUEST['form'] != 'full_clone') {
        $frmHost->addItemToBottomRow(SPACE);
        $frmHost->addItemToBottomRow(new CButton("clone", S_CLONE));
        $frmHost->addItemToBottomRow(SPACE);
        $frmHost->addItemToBottomRow(new CButton("full_clone", S_FULL_CLONE));
        $frmHost->addItemToBottomRow(SPACE);
        $frmHost->addItemToBottomRow(new CButtonDelete(S_DELETE_SELECTED_HOST_Q, url_param("form") . url_param("config") . url_param("hostid") . url_param('groupid')));
        if ($show_only_tmp) {
            $frmHost->addItemToBottomRow(SPACE);
            $frmHost->addItemToBottomRow(new CButtonQMessage('delete_and_clear', 'Delete AND clear', S_DELETE_SELECTED_HOSTS_Q, url_param("form") . url_param("config") . url_param("hostid") . url_param('groupid')));
        }
    }
    $frmHost->addItemToBottomRow(SPACE);
    $frmHost->addItemToBottomRow(new CButtonCancel(url_param("config") . url_param('groupid')));
    $frmHost->Show();
}
Exemple #6
0
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once "include/config.inc.php";
require_once "include/forms.inc.php";
$page["title"] = "S_INSTALLATION";
$page["file"] = "instal.php";
include_once "include/page_header.php";
include_once "setup.php";
include_once "include/page_footer.php";
/*******************************/
/* THIS POINT NEVER BE REACHED */
/*******************************/
$fields = array("install" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), "update" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL));
check_fields($fields);
if (isset($_REQUEST['install'])) {
    redirect('setup.php');
} elseif (isset($_REQUEST['update'])) {
    error('*UNDER CONSTRUCTION*');
}
$form = new CFormTable(S_INSTALLATION_UPDATE);
$form->SetHelp('install_source_web.php');
$form->AddRow(array(bold(S_NEW_INSTALLATION_BIG), BR(), BR(), bold(S_DESCRIPTION), BR(), 'Not implemented yet!', BR(), BR(), BR()), new CButton('install', S_NEW_INSTALLATION));
$form->AddRow(array(bold(S_UPDATE_BIG), BR(), BR(), bold(S_DESCRIPTION), BR(), 'Not implemented yet!', BR(), BR(), BR()), new CButton('update', S_UPDATE));
$form->Show();
include_once "include/page_footer.php";
Exemple #7
0
$form->addItem($cmbConfig);
show_table_header($title, $form);
if ($config == 1) {
    if (isset($_FILES['import_file'])) {
        include_once "include/import.inc.php";
        DBstart();
        $importer = new CZabbixXMLImport();
        $importer->setRules($rules['host'], $rules['template'], $rules['item'], $rules['trigger'], $rules['graph']);
        $result = $importer->Parse($_FILES['import_file']['tmp_name']);
        unset($importer);
        $result = DBend($result);
        show_messages($result, S_IMPORTED . SPACE . S_SUCCESSEFULLY_SMALL, S_IMPORT . SPACE . S_FAILED_SMALL);
    }
    $form = new CFormTable($frm_title, null, "post", "multipart/form-data");
    $form->AddVar('config', $config);
    $form->AddRow(S_IMPORT_FILE, new CFile('import_file'));
    $table = new CTable();
    $table->SetHeader(array(S_ELEMENT, S_EXISTING, S_MISSING), 'bold');
    foreach (array('host' => S_HOST, 'template' => S_TEMPLATE, 'item' => S_ITEM, 'trigger' => S_TRIGGER, 'graph' => S_GRAPH) as $key => $title) {
        $cmbExist = new CComboBox('rules[' . $key . '][exist]', $rules[$key]['exist']);
        $cmbExist->AddItem(0, S_UPDATE);
        $cmbExist->AddItem(1, S_SKIP);
        $cmbMissed = new CComboBox('rules[' . $key . '][missed]', $rules[$key]['missed']);
        $key == 'template' ? '' : $cmbMissed->AddItem(0, S_ADD);
        $cmbMissed->AddItem(1, S_SKIP);
        $table->AddRow(array($title, $cmbExist, $cmbMissed));
    }
    $form->AddRow(S_RULES, $table);
    $form->AddItemToBottomRow(new CButton('import', S_IMPORT));
    $form->Show();
} else {
Exemple #8
0
                    $usr_test->AddItem($db_user['alias'], $db_user['alias']);
                }
            }
        } else {
            $usr_test = new CTextBox('user', $USER_DETAILS['alias'], null, 'yes');
        }
        $frmAuth->AddRow(S_LOGIN, $usr_test);
        $frmAuth->AddRow(S_USER . SPACE . S_PASSWORD, new CPassBox('user_password'));
        $frmAuth->AddItemToBottomRow(new CButton('save', S_SAVE));
        $frmAuth->AddItemToBottomRow(new CButton('test', S_TEST));
        $frmAuth->Show();
    } else {
        if (ZBX_AUTH_HTTP == $_REQUEST['config']) {
            $form_refresh_http = get_request('form_refresh_http', 0);
            $form_refresh_http++;
            $frmAuth = new CFormTable(S_HTTP_AUTH, 'authentication.php');
            $frmAuth->SetHelp('web.authentication.php');
            $frmAuth->AddVar('form_refresh_http', $form_refresh_http);
            $cmbConfig = new CCombobox('config', ZBX_AUTH_HTTP, 'submit()');
            $cmbConfig->AddItem(ZBX_AUTH_INTERNAL, S_INTERNAL_S);
            $cmbConfig->AddItem(ZBX_AUTH_LDAP, S_LDAP);
            $cmbConfig->AddItem(ZBX_AUTH_HTTP, S_HTTP);
            $frmAuth->AddRow(S_DEFAULT_AUTHENTICATION, $cmbConfig);
            $action = "javascript: if(confirm('Switching HTTP authentication will reset all current sessions! Continue?')) return true; else return false;";
            $frmAuth->AddRow(S_HTTP_AUTH . SPACE . S_ENABLED, new CCheckBox('authentication_type', ZBX_AUTH_HTTP == $config['authentication_type'], $action, ZBX_AUTH_HTTP));
            $frmAuth->AddItemToBottomRow(new CButton('save', S_SAVE));
            $frmAuth->Show();
        }
    }
}
include_once 'include/page_footer.php';
Exemple #9
0
function get_screen_item_form()
{
    global $USER_DETAILS;
    $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY, get_current_nodeid(true));
    $form = new CFormTable(S_SCREEN_CELL_CONFIGURATION, 'screenedit.php#form');
    $form->SetHelp('web.screenedit.cell.php');
    if (isset($_REQUEST['screenitemid'])) {
        $iresult = DBSelect('SELECT * FROM screens_items' . ' WHERE screenid=' . $_REQUEST['screenid'] . ' AND screenitemid=' . $_REQUEST['screenitemid']);
        $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']);
    $cmbRes = new CCombobox('resourcetype', $resourcetype, 'submit()');
    $cmbRes->addItem(SCREEN_RESOURCE_GRAPH, S_GRAPH);
    $cmbRes->addItem(SCREEN_RESOURCE_SIMPLE_GRAPH, S_SIMPLE_GRAPH);
    $cmbRes->addItem(SCREEN_RESOURCE_PLAIN_TEXT, S_PLAIN_TEXT);
    $cmbRes->addItem(SCREEN_RESOURCE_MAP, S_MAP);
    $cmbRes->addItem(SCREEN_RESOURCE_SCREEN, S_SCREEN);
    $cmbRes->addItem(SCREEN_RESOURCE_SERVER_INFO, S_SERVER_INFO);
    $cmbRes->addItem(SCREEN_RESOURCE_HOSTS_INFO, S_HOSTS_INFO);
    $cmbRes->addItem(SCREEN_RESOURCE_TRIGGERS_INFO, S_TRIGGERS_INFO);
    $cmbRes->addItem(SCREEN_RESOURCE_TRIGGERS_OVERVIEW, S_TRIGGERS_OVERVIEW);
    $cmbRes->addItem(SCREEN_RESOURCE_STATUS_OF_TRIGGERS, S_STATUS_OF_TRIGGERS);
    $cmbRes->addItem(SCREEN_RESOURCE_DATA_OVERVIEW, S_DATA_OVERVIEW);
    $cmbRes->addItem(SCREEN_RESOURCE_CLOCK, S_CLOCK);
    $cmbRes->addItem(SCREEN_RESOURCE_URL, S_URL);
    $cmbRes->addItem(SCREEN_RESOURCE_ACTIONS, S_HISTORY_OF_ACTIONS);
    $cmbRes->addItem(SCREEN_RESOURCE_EVENTS, S_HISTORY_OF_EVENTS);
    $form->addRow(S_RESOURCE, $cmbRes);
    if ($resourcetype == SCREEN_RESOURCE_GRAPH) {
        // User-defined graph
        $resourceid = graph_accessible($resourceid) ? $resourceid : 0;
        $caption = '';
        $id = 0;
        if ($resourceid > 0) {
            $result = DBselect('SELECT DISTINCT g.graphid,g.name,n.name as node_name, h.host' . ' FROM graphs g ' . ' LEFT JOIN graphs_items gi ON g.graphid=gi.graphid ' . ' LEFT JOIN items i ON gi.itemid=i.itemid ' . ' LEFT JOIN hosts h ON h.hostid=i.hostid ' . ' LEFT JOIN nodes n ON n.nodeid=' . DBid2nodeid('g.graphid') . ' WHERE g.graphid=' . $resourceid);
            while ($row = DBfetch($result)) {
                $row['node_name'] = isset($row['node_name']) ? '(' . $row['node_name'] . ') ' : '';
                $caption = $row['node_name'] . $row['host'] . ':' . $row['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?dstfrm=" . $form->getName() . "&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
            $caption = '';
            $id = 0;
            if ($resourceid > 0) {
                $result = DBselect('SELECT n.name as node_name,h.host,i.description,i.itemid,i.key_ ' . ' FROM hosts h,items i ' . ' LEFT JOIN nodes n on n.nodeid=' . DBid2nodeid('i.itemid') . ' WHERE h.hostid=i.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('i.hostid', $available_hosts) . ' AND i.itemid=' . $resourceid);
                while ($row = DBfetch($result)) {
                    $description_ = item_description($row);
                    $row["node_name"] = isset($row["node_name"]) ? "(" . $row["node_name"] . ") " : '';
                    $caption = $row['node_name'] . $row['host'] . ': ' . $description_;
                    $id = $resourceid;
                }
            }
            $form->AddVar('resourceid', $id);
            $textfield = new Ctextbox('caption', $caption, 75, 'yes');
            $selectbtn = new Cbutton('select', S_SELECT, "javascript: return PopUp('popup.php?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
                $caption = '';
                $id = 0;
                if ($resourceid > 0) {
                    $result = DBselect('SELECT n.name as node_name, s.sysmapid,s.name ' . ' FROM sysmaps s' . ' LEFT JOIN nodes n ON n.nodeid=' . DBid2nodeid('s.sysmapid') . ' WHERE s.sysmapid=' . $resourceid);
                    while ($row = DBfetch($result)) {
                        if (!sysmap_accessible($row['sysmapid'], PERM_READ_ONLY)) {
                            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?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
                    $caption = '';
                    $id = 0;
                    if ($resourceid > 0) {
                        $result = DBselect('SELECT n.name as node_name,h.host,i.description,i.itemid,i.key_ ' . ' FROM hosts h,items i ' . ' LEFT JOIN nodes n on n.nodeid=' . DBid2nodeid('i.itemid') . ' WHERE h.hostid=i.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('i.hostid', $available_hosts) . ' AND i.itemid=' . $resourceid);
                        while ($row = DBfetch($result)) {
                            $description_ = item_description($row);
                            $row["node_name"] = isset($row["node_name"]) ? '(' . $row["node_name"] . ') ' : '';
                            $caption = $row['node_name'] . $row['host'] . ': ' . $description_;
                            $id = $resourceid;
                        }
                    }
                    $form->AddVar('resourceid', $id);
                    $textfield = new Ctextbox('caption', $caption, 75, 'yes');
                    $selectbtn = new Cbutton('select', S_SELECT, "javascript: return PopUp('popup.php?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_EVENTS, SCREEN_RESOURCE_STATUS_OF_TRIGGERS, SCREEN_RESOURCE_ACTIONS))) {
                        // History of actions
                        // History of events
                        // Status of triggers
                        $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) {
                                $available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_ONLY);
                                $result = DBselect('SELECT DISTINCT n.name as node_name,g.groupid,g.name ' . ' FROM hosts_groups hg,hosts h,groups g ' . ' LEFT JOIN nodes n ON n.nodeid=' . DBid2nodeid('g.groupid') . ' WHERE ' . DBcondition('g.groupid', $available_groups) . ' AND g.groupid=hg.groupid ' . ' AND hg.hostid=h.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' 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;
                                }
                            }
                            $form->AddVar('resourceid', $id);
                            $textfield = new Ctextbox('caption', $caption, 75, 'yes');
                            $selectbtn = new Cbutton('select', S_SELECT, "javascript: return PopUp('popup.php?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)) {
                                        if (!screen_accessible($row['screenid'], PERM_READ_ONLY)) {
                                            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?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?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;
}
Exemple #10
0
     $showsla = get_request('showsla', 0);
     $goodsla = get_request('goodsla', 99.05);
     $sortorder = get_request('sortorder', 0);
     $algorithm = get_request('algorithm', SERVICE_ALGORITHM_MAX);
     $triggerid = get_request('triggerid', 0);
     $linktrigger = get_request('linktrigger', 0);
     //links
     $parentid = get_request('parentid', 0);
     $parentname = get_request('parentname', '');
     $childs = get_request('childs', array());
     //-----
 }
 if (isset($service)) {
     $frmService->AddVar('serviceid', $service['serviceid']);
 }
 $frmService->AddRow(S_NAME, new CTextBox('name', $name, 60));
 //link
 //-------------------------------------------- <LINK> --------------------------------------------
 //parent link
 $ctb = new CTextBox('parent_name', $parentname, 60);
 $ctb->setAttribute('disabled', 'disabled');
 $frmService->AddVar('parentname', $parentname);
 $frmService->AddVar('parentid', $parentid);
 $cb = new CButton('select_parent', S_CHANGE);
 $cb->SetType('button');
 $cb->SetAction("javascript: openWinCentered('services_form.php?pservices=1" . url_param('serviceid') . "','ZBX_Services_List',740,420,'scrollbars=1, toolbar=0, menubar=0, resizable=1, dialog=0');");
 $frmService->AddRow('Parent Service', array($ctb, $cb));
 //----------
 //child links
 $table = new CTable();
 $table->setClass('tableinfo');