Esempio n. 1
0
$show_unknown = get_request('show_unknown', get_profile('web.events.filter.show_unknown', 0));
if (isset($_REQUEST['filter_set']) || isset($_REQUEST['filter_rst'])) {
    update_profile('web.events.filter.triggerid', $_REQUEST['triggerid']);
    update_profile('web.events.filter.show_unknown', $show_unknown, PROFILE_TYPE_INT);
}
// --------------
validate_sort_and_sortorder('e.clock', ZBX_SORT_DOWN);
$source = get_request('source', EVENT_SOURCE_TRIGGERS);
update_profile('web.events.source', $source, PROFILE_TYPE_INT);
$_REQUEST['nav_time'] = get_request('nav_time', time());
$_REQUEST['nav_time'] += isset($_REQUEST['next']) ? 86400 : 0;
$_REQUEST['nav_time'] -= isset($_REQUEST['back']) ? 86400 : 0;
$source = get_request('source', EVENT_SOURCE_TRIGGERS);
$r_form = new CForm();
$r_form->setMethod('get');
$r_form->addOption('name', 'events_menu');
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$r_form->addVar('nav_time', $_REQUEST['nav_time']);
if (EVENT_SOURCE_TRIGGERS == $source) {
    if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {
        $sql = 'SELECT DISTINCT hg.groupid, hg.hostid ' . ' FROM hosts_groups hg, functions f, items i' . ' WHERE i.itemid=f.itemid ' . ' AND hg.hostid=i.hostid ' . ' AND f.triggerid=' . $_REQUEST['triggerid'];
        if ($host_group = DBfetch(DBselect($sql, 1))) {
            $_REQUEST['groupid'] = $host_group['groupid'];
            $_REQUEST['hostid'] = $host_group['hostid'];
        } else {
            unset($_REQUEST['triggerid']);
        }
    }
    $options = array('allow_all_hosts', 'monitored_hosts', 'with_items');
    if (!$ZBX_WITH_SUBNODES) {
        array_push($options, 'only_current_node');
Esempio n. 2
0
    $select_acc->addItem(PERM_READ_WRITE, S_WRITE);
    $frmScr->addRow(S_REQUIRED_HOST . SPACE . S_PERMISSIONS_SMALL, $select_acc);
    $frmScr->addItemToBottomRow(new CButton('save', S_SAVE, "javascript: document.getElementById('scripts').action+='?action=1'; "));
    $frmScr->addItemToBottomRow(SPACE);
    if (isset($_REQUEST['scriptid'])) {
        $deleteButton = new CButtonDelete(S_DELETE_SCRIPTS_Q, '&action=1&scriptid=' . $_REQUEST['scriptid']);
        $frmScr->addItemToBottomRow($deleteButton);
        $frmScr->addItemToBottomRow(SPACE);
    }
    $frmScr->addItemToBottomRow(new CButtonCancel());
    $frmScr->Show();
} else {
    validate_sort_and_sortorder('s.name', ZBX_SORT_UP);
    $form = new CForm();
    $form->setName('scripts');
    $form->addOption('id', 'scripts');
    $form->addVar('action', '1');
    $numrows = new CSpan(null, 'info');
    $numrows->addOption('name', 'numrows');
    $header = get_table_header(array(S_SCRIPTS, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
    show_table_header($header);
    $table = new CTableInfo(S_NO_SCRIPTS_DEFINED);
    $table->setHeader(array(array(new CCheckBox('all_scripts', null, "CheckAll('" . $form->GetName() . "','all_scripts');"), make_sorting_link(S_NAME, 's.name')), make_sorting_link(S_COMMAND, 's.command'), S_USER_GROUP, S_HOST_GROUP, S_HOST_ACCESS));
    $sql = 'SELECT s.* ' . ' FROM scripts s ' . ' WHERE ' . DBin_node('s.scriptid') . order_by('s.name,s.command');
    $scripts = DBselect($sql);
    while ($script = DBfetch($scripts)) {
        $user_group_name = S_ALL_S;
        if ($script['usrgrpid'] > 0) {
            $user_group = get_group_by_usrgrpid($script['usrgrpid']);
            $user_group_name = $user_group['name'];
        }
Esempio n. 3
0
$comboform = new CForm();
$comboform->addVar('dstfrm', $dstfrm);
// create table header +
$cmbGroups = new CComboBox('groupid', $groupid, 'submit()');
$cmbGroups->addItem(0, S_ALL_S);
$sql = 'SELECT usrgrpid, name FROM usrgrp WHERE ' . DBin_node('usrgrpid') . ' ORDER BY name';
$result = DBselect($sql);
while ($row = DBfetch($result)) {
    $cmbGroups->addItem($row['usrgrpid'], $row['name']);
}
$comboform->addItem($cmbGroups);
show_table_header(S_USERS, $comboform);
// -
// create user twinbox +
$form = new CForm('users.php');
$form->addOption('id', 'users');
$user_tb = new CTweenBox($form, 'usersid', null, 10);
$from = '';
$where = '';
if ($groupid > 0) {
    $from = ', users_groups g ';
    $where = ' AND u.userid=g.userid AND g.usrgrpid=' . $groupid;
}
$sql = 'SELECT u.userid, u.alias FROM users u ' . $from . ' WHERE ' . DBin_node('u.userid') . $where . ' ORDER BY name';
$result = DBselect($sql);
while ($row = DBfetch($result)) {
    $user_tb->addItem($row['userid'], $row['alias'], false);
}
$form->addItem($user_tb->get('asdasda', 'asdasdasdas'));
// -
$button = new CButton('select', S_SELECT, 'add_users("' . $dstfrm . '")');
Esempio n. 4
0
$frmTitle->AddVar('dstfrm', $dstfrm);
$frmTitle->AddVar('permission', $permission);
if (ZBX_DISTRIBUTED) {
    $available_nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY);
    $cmbResourceNode = new CComboBox('nodeid', $nodeid, 'submit();');
    $cmbResourceNode->AddItem(0, S_ALL_S);
    $sql = 'SELECT name,nodeid FROM nodes WHERE ' . DBcondition('nodeid', $available_nodes);
    $db_nodes = DBselect($sql);
    while ($node = DBfetch($db_nodes)) {
        $cmbResourceNode->AddItem($node['nodeid'], $node['name']);
    }
    $frmTitle->AddItem(array(S_NODE, SPACE, $cmbResourceNode));
}
show_table_header(permission2str($permission), $frmTitle);
$form = new CForm();
$form->addOption('id', 'groups');
$table = new CTableInfo(S_NO_RESOURCES_DEFINED);
$table->SetHeader(new CCol(array(new CCheckBox("all_groups", NULL, 'check_all(this.checked)'), S_NAME)));
$result = DBselect('SELECT n.name as node_name, g.name as name, g.groupid as id' . ' FROM groups g ' . ' LEFT JOIN nodes n on ' . DBid2nodeid('g.groupid') . '=n.nodeid ' . ($nodeid ? ' WHERE nodeid=' . $nodeid : '') . ' ORDER BY n.name, g.name');
$grouplist = array();
while ($row = DBfetch($result)) {
    if (isset($row['node_name'])) {
        $row['name'] = $row['node_name'] . ':' . $row['name'];
    }
    $grouplist[$row['id']] = array('name' => $row['name'], 'permission' => $permission);
    $table->addRow(new CCol(array(new CCheckBox('groups[' . $row['id'] . ']', NULL, NULL, $row['id']), $row['name'])));
}
insert_js('var grouplist = ' . zbx_jsvalue($grouplist) . ';');
$button = new CButton('select', S_SELECT, 'add_groups("' . $dstfrm . '")');
$button->setType('button');
$table->setFooter(new CCol($button, 'right'));
Esempio n. 5
0
			null,//make_webmon_overview(),
			null,
			'hat_custom',
			get_profile('web.dashboard.hats.hat_custom.state',1)
		));
*/
$td_l = new CCol($left_tab);
$td_l->addOption('valign', 'top');
$td_r = new CCol($right_tab);
$td_r->addOption('valign', 'top');
$outer_table = new CTable();
$outer_table->addOption('border', 0);
$outer_table->setCellPadding(1);
$outer_table->setCellSpacing(1);
$outer_table->addRow(array($td_l, $td_r));
$p_elements[] = $outer_table;
$fav_form = new CForm();
$fav_form->addOption('name', 'fav_form');
$fav_form->addOption('id', 'fav_form');
$fav_form->addOption('style', 'display: inline; margin: 0px;');
$fav_form->addVar('favobj', '');
$fav_form->addVar('favid', '');
$fav_form->addVar('source', '');
$p_elements[] = $fav_form;
$dashboard_hat = create_hat(S_DASHBOARD_BIG, $p_elements, array($fs_icon), 'hat_dashboard', get_profile('web.dashboard.hats.hat_dashboard.state', 1));
$dashboard_hat->Show();
$jsmenu = new CPUMenu(null, 170);
$jsmenu->InsertJavaScript();
//	$link = new CLink('Click Me','javascript: callJSON();','highlight');
//	$link->Show();
include_once "include/page_footer.php";
Esempio n. 6
0
     while ($row = DBfetch($result)) {
         $name = new CLink($row["key_"], "#", "action");
         if (isset($_REQUEST['reference']) && $_REQUEST['reference'] == 'dashboard') {
             $action = get_window_opener($dstfrm, $dstfld1, $srcfld2) . get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) . "window.opener.setTimeout('add2favorites();', 1000);";
         } else {
             $action = get_window_opener($dstfrm, $dstfld1, html_entity_decode($row[$srcfld1])) . (isset($srcfld2) ? get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) : '');
         }
         $name->SetAction($action . " close_window(); return false;");
         $table->addRow(array($name, $row["description"]));
     }
     $table->Show();
 } else {
     if ($srctbl == 'triggers') {
         $available_triggers = get_accessible_triggers(PERM_READ_ONLY, $available_hosts, PERM_RES_IDS_ARRAY, $nodeid);
         $form = new CForm();
         $form->addOption('id', S_TRIGGERS);
         $table = new CTableInfo(S_NO_TRIGGERS_DEFINED);
         if ($multiselect) {
             insert_js_function('add_selected_values');
             insert_js_function('check_all');
             $header = array(new CCol(array(new CCheckBox("check", NULL, 'check_all("' . S_TRIGGERS . '", this.checked);'), S_NAME)), S_SEVERITY, S_STATUS);
             $button = new CButton('select', S_SELECT, 'add_selected_values("' . S_TRIGGERS . '", "' . $dstfrm . '", "' . $dstfld1 . '", "' . $dstact . '")');
             $button->setType('button');
             $table->setFooter(new CCol($button, 'right'));
         } else {
             insert_js_function('add_value');
             $header = array(S_NAME, S_SEVERITY, S_STATUS);
         }
         $table->SetHeader($header);
         $sql = 'SELECT h.host,t.triggerid,t.description,t.expression,t.priority,t.status,count(d.triggerid_up) as dep_count ' . ' FROM hosts h,items i,functions f, triggers t' . ' LEFT JOIN trigger_depends d ON d.triggerid_down=t.triggerid ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND t.triggerid=f.triggerid' . ' AND ' . DBin_node('t.triggerid', $nodeid) . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND h.status in (' . implode(',', $host_status) . ')';
         if ($hostid > 0) {