$proxy = get_host_by_hostid($rule_data["proxy_hostid"]);
            array_push($description, $proxy["host"], ":");
        }
        array_push($description, new CLink($rule_data['name'], "?form=update&druleid=" . $rule_data['druleid']));
        $tblDiscovery->addRow(array(new CCheckBox('g_druleid[' . $rule_data["druleid"] . ']', null, null, $rule_data["druleid"]), $description, $rule_data['iprange'], $rule_data['delay'], implode(', ', $checks), $status));
    }
    // pagination at the top and the bottom of the page
    $tblDiscovery->addRow(new CCol($paging));
    $dscry_wdgt->addItem($paging);
    // gobox
    $goBox = new CComboBox('go');
    $goOption = new CComboItem('activate', S_ENABLE_SELECTED);
    $goOption->setAttribute('confirm', S_ENABLE_SELECTED_DISCOVERY_RULES);
    $goBox->addItem($goOption);
    $goOption = new CComboItem('disable', S_DISABLE_SELECTED);
    $goOption->setAttribute('confirm', S_DISABLE_SELECTED_DISCOVERY_RULES);
    $goBox->addItem($goOption);
    $goOption = new CComboItem('delete', S_DELETE_SELECTED);
    $goOption->setAttribute('confirm', S_DELETE_SELECTED_DISCOVERY_RULES);
    $goBox->addItem($goOption);
    // goButton name is necessary!!!
    $goButton = new CButton('goButton', S_GO . ' (0)');
    $goButton->setAttribute('id', 'goButton');
    zbx_add_post_js('chkbxRange.pageGoName = "g_druleid";');
    $tblDiscovery->setFooter(new CCol(array($goBox, $goButton)));
    //----
    $form->addItem($tblDiscovery);
    $dscry_wdgt->addItem($form);
}
$dscry_wdgt->show();
include_once 'include/page_footer.php';
form = window.opener.document.forms['<?php 
    echo $dstfrm;
    ?>
'];
<!--
<?php 
    foreach ($new_groups as $id) {
        echo 'add_var_to_opener_obj(form,"new_groups[' . $id . ']","' . $id . '")' . "\r";
    }
    ?>
if(form){
	form.submit();
	close_window();
}
-->
</script>
<?php 
}
$form = new CForm();
$form->addVar('dstfrm', $dstfrm);
$form->setName('groups');
$table = new CTableInfo(_('No user groups defined.'));
$table->setHeader(array(new CCheckBox("all_groups", NULL, "checkAll('" . $form->getName() . "','all_groups','new_groups');"), _('Name')));
$result = DBselect('select * from usrgrp where ' . DBin_node('usrgrpid') . ' order by name');
while ($row = DBfetch($result)) {
    $table->addRow(array(new CCheckBox('new_groups[' . $row['usrgrpid'] . ']', isset($new_groups[$row['usrgrpid']]), NULL, $row['usrgrpid']), $row['name']));
}
$table->setFooter(new CCol(new CSubmit('select', _('Select'))));
$form->addItem($table);
$form->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
Beispiel #3
0
        $operations = array();
        $db_operations = DBselect('select * from operations where actionid=' . $action_data['actionid'] . ' order by operationtype,operationid');
        while ($operation_data = DBfetch($db_operations)) {
            array_push($operations, array(get_operation_desc(SHORT_DESCRITION, $operation_data), BR()));
        }
        if ($action_data['status'] == ACTION_STATUS_DISABLED) {
            $status = new CLink(S_DISABLED, 'actionconf.php?group_enable=1&g_actionid%5B%5D=' . $action_data['actionid'] . url_param('eventsource'), 'disabled');
        } else {
            $status = new CLink(S_ENABLED, 'actionconf.php?group_disable=1&g_actionid%5B%5D=' . $action_data['actionid'] . url_param('eventsource'), 'enabled');
        }
        $tblActions->addRow(array(new CCheckBox('g_actionid[' . $action_data['actionid'] . ']', null, null, $action_data['actionid']), new CLink($action_data['name'], 'actionconf.php?form=update&actionid=' . $action_data['actionid']), $conditions, $operations, $status));
        $row_count++;
    }
    //----- GO ------
    $goBox = new CComboBox('go');
    $goBox->addItem('activate', S_ENABLE_SELECTED);
    $goBox->addItem('disable', S_DISABLE_SELECTED);
    $goBox->addItem('delete', S_DELETE_SELECTED);
    // goButton name is necessary!!!
    $goButton = new CButton('goButton', S_GO . ' (0)');
    $goButton->setAttribute('id', 'goButton');
    zbx_add_post_js('chkbxRange.pageGoName = "g_actionid";');
    $tblActions->setFooter(new CCol(array($goBox, $goButton)));
    //----
    $form->addItem($tblActions);
    $form->Show();
}
if (isset($row_count)) {
    zbx_add_post_js('insert_in_element("numrows","' . $row_count . '");');
}
include_once "include/page_footer.php";
Beispiel #4
0
    echo $dstfrm;
    ?>
'];
<!--
<?php 
    foreach ($new_group as $id => $name) {
        echo 'add_var_to_opener_obj(form,"new_group[' . $id . ']","' . $name . '")' . "\r";
    }
    ?>
if(form)
{
	form.submit();
	close_window();
}
-->
</script>
<?php 
}
$form = new CForm();
$form->AddVar('dstfrm', $dstfrm);
$form->SetName('groups');
$table = new CTableInfo(S_NO_GROUPS_DEFINED);
$table->setHeader(array(new CCheckBox("all_groups", NULL, "checkAll('" . $form->getName() . "','all_groups','new_group');"), S_NAME));
$result = DBselect('select * from usrgrp where ' . DBin_node('usrgrpid') . ' order by name');
while ($row = DBfetch($result)) {
    $table->addRow(array(new CCheckBox('new_group[' . $row['usrgrpid'] . ']', isset($new_group[$row['usrgrpid']]), NULL, $row['name']), $row['name']));
}
$table->setFooter(new CButton('select', S_SELECT));
$form->addItem($table);
$form->show();
include_once "include/page_footer.php";
foreach ($groups as $gnum => $row) {
    $groups[$gnum]['nodename'] = get_node_name_by_elid($row['groupid'], true, ':') . $row['name'];
    if ($nodeid == 0) {
        $groups[$gnum]['name'] = $groups[$gnum]['nodename'];
    }
}
order_result($groups, 'name');
foreach ($groups as $gnum => $row) {
    $grouplist[$count] = array('groupid' => $row['groupid'], 'name' => $row['nodename'], 'permission' => $permission);
    $table->addRow(new CCol(array(new CCheckBox('groups[' . $count . ']', NULL, NULL, $count), $row['name'])));
    $count++;
}
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'));
$form->addItem($table);
$form->show();
?>
<script language="JavaScript" type="text/javascript">
<!--
function add_groups(formname) {
	var parent_document = window.opener.document;

	if(!parent_document) return close_window();

	$('groups').getInputs("checkbox").each(
		function(box){
			if(box.checked && (box.name != "all_groups")){
				var groupid = grouplist[box.value].groupid;
				add_variable('input', 'new_right['+groupid+'][permission]', grouplist[box.value].permission, formname, parent_document);
Beispiel #6
0
        if ($host['proxy_hostid']) {
            $proxyHostIds[$host['proxy_hostid']] = $host['proxy_hostid'];
        }
    }
    if ($proxyHostIds) {
        $proxies = API::Proxy()->get(['proxyids' => $proxyHostIds, 'output' => ['proxyid', 'host'], 'preservekeys' => true]);
    }
    $table->setHeader([_('Scheduled check'), _('Delayed by'), _('Host'), _('Name')]);
    $i = 0;
    foreach ($queueData as $itemData) {
        if (!isset($items[$itemData['itemid']])) {
            continue;
        }
        // display only the first 500 items
        $i++;
        if ($i > QUEUE_DETAIL_ITEM_COUNT) {
            break;
        }
        $item = $items[$itemData['itemid']];
        $host = reset($item['hosts']);
        $table->addRow([zbx_date2str(DATE_TIME_FORMAT_SECONDS, $itemData['nextcheck']), zbx_date2age($itemData['nextcheck']), isset($proxies[$hosts[$item['hostid']]['proxy_hostid']]) ? $proxies[$hosts[$item['hostid']]['proxy_hostid']]['host'] . NAME_DELIMITER . $host['name'] : $host['name'], $item['name_expanded']]);
    }
}
// display the table footer
if ($config == QUEUE_OVERVIEW_BY_PROXY) {
    $table->setFooter(new CCol(_('Total') . ': ' . $table->getNumRows()));
} elseif ($config == QUEUE_DETAILS) {
    $table->setFooter(new CCol(_('Total') . ': ' . $table->getNumRows() . (count($queueData) > QUEUE_DETAIL_ITEM_COUNT ? ' (' . _('Truncated') . ')' : '')));
}
$widget->addItem($table)->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
Beispiel #7
0
if (isset($_REQUEST["form"])) {
    insert_map_form();
} else {
    $form = new CForm();
    $form->setName('frm_maps');
    $numrows = new CSpan(null, 'info');
    $numrows->setAttribute('name', 'numrows');
    $header = get_table_header(array(S_MAPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
    show_table_header($header);
    $table = new CTableInfo(S_NO_MAPS_DEFINED);
    $table->SetHeader(array(new CCheckBox('all_maps', NULL, "checkAll('" . $form->getName() . "','all_maps','maps');"), make_sorting_link(S_NAME, 'sm.name'), make_sorting_link(S_WIDTH, 'sm.width'), make_sorting_link(S_HEIGHT, 'sm.height'), S_MAP));
    $result = DBselect('SELECT sm.sysmapid,sm.name,sm.width,sm.height ' . ' FROM sysmaps sm' . ' WHERE ' . DBin_node('sm.sysmapid') . order_by('sm.name,sm.width,sm.height', 'sm.sysmapid'));
    while ($row = DBfetch($result)) {
        if (!sysmap_accessible($row["sysmapid"], PERM_READ_WRITE)) {
            continue;
        }
        $table->AddRow(array(new CCheckBox('maps[' . $row['sysmapid'] . ']', NULL, NULL, $row['sysmapid']), new CLink($row["name"], "sysmaps.php?form=update" . "&sysmapid=" . $row["sysmapid"] . "#form", 'action'), $row["width"], $row["height"], new CLink(S_EDIT, "sysmap.php?sysmapid=" . $row["sysmapid"])));
    }
    //----- GO ------
    $goBox = new CComboBox('go');
    $goBox->addItem('delete', S_DELETE_SELECTED);
    // goButton name is necessary!!!
    $goButton = new CButton('goButton', S_GO . ' (0)');
    $goButton->setAttribute('id', 'goButton');
    zbx_add_post_js('chkbxRange.pageGoName = "maps";');
    $table->setFooter(new CCol(array($goBox, $goButton)));
    $form->addItem($table);
    $form->show();
    zbx_add_post_js('insert_in_element("numrows","' . $table->getNumRows() . '");');
}
include_once "include/page_footer.php";
function make_ipmistat_summary($preloading = false)
{
    $form_name = 'ipmi_control';
    $table = new CTableInfo();
    $ipmicontrol_form = new CForm();
    $ipmicontrol_form->setName('ipmi_control');
    $ipmicontrol_form->setAttribute('id', 'ipmi_control');
    $ipmicontrol_form->addVar('driver', 'ipmi');
    $script_itemkey = 'push_message.py[{$HYCLOPS_SERVER},{$HYCLOPS_PORT},ipmi,{HOST.HOST}]';
    $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, new CCheckBox('all_physical_hosts', null, "checkAllHosts('" . $ipmicontrol_form->getName() . "', 'all_physical_hosts', '');"), _('Host name'), _('IPMI interface'), _('Status'), _('Problems')));
    $hosts = get_ipmi_hosts();
    if (empty($hosts)) {
        return null;
    }
    foreach ($hosts as $host) {
        $triggers = get_triggers($host['hostid']);
        $trigger_count = count($triggers);
        // get State
        if (!$preloading) {
            if (is_script_success($host['hostid'], $script_itemkey)) {
                $state = strtolower(get_item_value($host['hostid'], "ipmi.state.text"));
            } else {
                $state = _('script failed');
            }
        } else {
            $state = _('loading...');
        }
        // Check box
        $checkbox_col = new CCheckBox("hostids[]", null, null, $host['hostid']);
        if (!is_operation_available("ipmi", $state)) {
            $checkbox_col->attributes['disabled'] = 'disabled';
        }
        // Host name
        if ($trigger_count == 0) {
            $hostname_col = new CCol(new CSpan($host['host']));
        } else {
            $hostname_col = new CLink(new CSpan($host['host']), 'tr_status.php?&hostid=' . $host['hostid'] . '&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE);
        }
        // IPMI Interfaces
        $ipmi_addresses = get_addresses($host['hostid'], INTERFACE_TYPE_IPMI);
        $ipmi_ip_col = new CCol(reset($ipmi_addresses));
        // Status
        $state_col = new CCol($state, get_item_level($state));
        // Problem
        if ($trigger_count == 0) {
            $problem_col = new CCol($trigger_count, 'normal');
        } else {
            $problem_col = new CCol($trigger_count, 'high');
            $problem_col->setHint(make_trigger_table($triggers, $hostname_col));
        }
        $r = new CRow();
        $r->addItem($checkbox_col);
        $r->addItem($hostname_col);
        $r->addItem($ipmi_ip_col);
        $r->addItem($state_col);
        $r->addItem($problem_col);
        $table->addRow($r);
    }
    $table->setFooter(new CCol(make_operation_box_footer(zbx_objectValues($hosts, 'hostid'), $form_name)));
    $ipmicontrol_form->addItem($table);
    $script = new CJSScript(get_js("jQuery('#hat_ipmistat_footer').html('" . _s('Updated: %s', zbx_date2str(_('H:i:s'))) . "')"));
    return new CDiv(array($ipmicontrol_form, $script));
}
Beispiel #9
0
             }
         }
         $table->ShowRow(array(new CCol($host['host'], 'top'), $el_table));
         unset($el_table);
     }
     $form = new CForm(null, 'post');
     $form->setName('hosts');
     $form->addVar("config", $config);
     $form->addVar('update', true);
     $form->addVar('hosts', $hosts);
     $form->addVar('templates', $templates);
     $form->addVar('items', $items);
     $form->addVar('graphs', $graphs);
     $form->addVar('triggers', $triggers);
     $form->addItem(array(new CButton('back', S_BACK), new CButton('preview', S_REFRESH), new CButton('export', S_EXPORT)));
     $table->setFooter(new CCol($form));
     $table->showEnd();
 } else {
     /* table HOSTS */
     $form = new CForm(null, 'post');
     $form->SetName('hosts');
     $form->AddVar('config', $config);
     $form->AddVar('update', true);
     $cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();');
     foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
         $cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
     }
     $header = get_table_header(S_HOSTS_BIG, array(S_GROUP . SPACE, $cmbGroups));
     $form->addItem($header);
     $table = new CTableInfo(S_NO_HOSTS_DEFINED);
     $table->setHeader(array(array(new CCheckBox("all_hosts", true, "CheckAll('" . $form->GetName() . "','all_hosts','hosts');"), make_sorting_link(S_NAME, 'h.host')), make_sorting_link(S_DNS, 'h.dns'), make_sorting_link(S_IP, 'h.ip'), make_sorting_link(S_PORT, 'h.port'), make_sorting_link(S_STATUS, 'h.status'), array(new CCheckBox("all_templates", true, "CheckAll('" . $form->GetName() . "','all_templates','templates');"), S_TEMPLATES), array(new CCheckBox("all_items", true, "CheckAll('" . $form->GetName() . "','all_items','items');"), S_ITEMS), array(new CCheckBox("all_triggers", true, "CheckAll('" . $form->GetName() . "','all_triggers','triggers');"), S_TRIGGERS), array(new CCheckBox("all_graphs", true, "CheckAll('" . $form->GetName() . "','all_graphs','graphs');"), S_GRAPHS)));
Beispiel #10
0
     $col->SetColSpan(6);
     $table->addRow(array(get_node_name_by_elid($db_app['applicationid']), $_REQUEST['hostid'] > 0 ? NULL : $db_app['host'], $col));
     $any_app_exist = true;
     foreach ($app_rows as $row) {
         $table->addRow($row);
     }
 }
 $footerButtons = array();
 array_push($footerButtons, new CButtonQMessage('group_task', S_ACTIVATE_SELECTED, S_ACTIVATE_SELECTED_SCENARIOS_Q));
 array_push($footerButtons, SPACE);
 array_push($footerButtons, new CButtonQMessage('group_task', S_DISABLE_SELECTED, S_DISABLE_SELECTED_SCENARIOS_Q));
 array_push($footerButtons, SPACE);
 array_push($footerButtons, new CButtonQMessage('group_task', S_CLEAN_HISTORY_SELECTED_SCENARIOS, S_HISTORY_CLEANING_CAN_TAKE_A_LONG_TIME_CONTINUE_Q));
 array_push($footerButtons, SPACE);
 array_push($footerButtons, new CButtonQMessage('group_task', S_DELETE_SELECTED, S_DELETE_SELECTED_SCENARIOS_Q));
 $table->setFooter(new CCol($footerButtons));
 $form->addItem($table);
 $form->Show();
 /* TABLE
 		$form = new CForm();
 		$form->setName('scenarios');
 		$form->addVar('hostid',$_REQUEST['hostid']);
 
 		if(isset($show_all_apps))
 			$link = new CLink(new CImg('images/general/opened.gif'),'?close=1'.url_param('groupid').url_param('hostid'));
 		else
 			$link = new CLink(new CImg('images/general/closed.gif'),'?open=1'.url_param('groupid').url_param('hostid'));
 
 		$table  = new CTableInfo();
 		$table->setHeader(array(
 			array(	$link, SPACE, new CCheckBox('all_httptests',null,
Beispiel #11
0
function make_discovery_status()
{
    $options = array('filter' => array('status' => DHOST_STATUS_ACTIVE), 'selectDHosts' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND);
    $drules = CDRule::get($options);
    order_result($drules, 'name');
    foreach ($drules as $drnum => $drule) {
        $drules[$drnum]['up'] = 0;
        $drules[$drnum]['down'] = 0;
        foreach ($drule['dhosts'] as $dhnum => $dhost) {
            if (DRULE_STATUS_DISABLED == $dhost['status']) {
                $drules[$drnum]['down']++;
            } else {
                $drules[$drnum]['up']++;
            }
        }
    }
    $header = array(is_show_all_nodes() ? new CCol(S_NODE, 'center') : null, new CCol(S_DISCOVERY_RULE, 'center'), new CCol(S_UP), new CCol(S_DOWN));
    $table = new CTableInfo();
    $table->setHeader($header, 'header');
    foreach ($drules as $drnum => $drule) {
        $table->addRow(array(get_node_name_by_elid($drule['druleid']), new CLink(get_node_name_by_elid($drule['druleid'], null, ': ') . $drule['name'], 'discovery.php?druleid=' . $drule['druleid']), new CSpan($drule['up'], 'green'), new CSpan($drule['down'], $drule['down'] > 0 ? 'red' : 'green')));
    }
    $table->setFooter(new CCol(S_UPDATED . ': ' . zbx_date2str(S_BLOCKS_DISCOVERY_STATUS_TIME_FORMAT)));
    return $table;
}
Beispiel #12
0
    $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'];
        }
        $host_group_name = S_ALL_S;
        if ($script['groupid'] > 0) {
            $group = get_hostgroup_by_groupid($script['groupid']);
            $host_group_name = $group['name'];
        }
        $table->addRow(array(array(new CCheckBox('scripts[' . $script['scriptid'] . ']', 'no', NULL, $script['scriptid']), new CLink($script['name'], 'scripts.php?form=1' . '&scriptid=' . $script['scriptid'] . '#form', 'action')), htmlspecialchars($script['command']), $user_group_name, $host_group_name, PERM_READ_WRITE == $script['host_access'] ? S_WRITE : S_READ));
        $row_count++;
    }
    $qbutton = new CButtonQMessage('delete', S_DELETE_SELECTED, S_DELETE_SELECTED_SCRIPTS_Q);
    //$qbutton->setAction('javascript:document.getElementById("scripts").action += "?action=1";');
    $tr = new CCol(array($qbutton));
    $table->setFooter($tr);
    $form->addItem($table);
    $form->show();
    zbx_add_post_js('insert_in_element("numrows","' . $row_count . '");');
}
include_once 'include/page_footer.php';
function get_expression_form()
{
    $tblExp = new CTable();
    /* init new_timeperiod variable */
    $new_expression = get_request('new_expression', array());
    if (is_array($new_expression) && isset($new_expression['id'])) {
        $tblExp->addItem(new Cvar('new_expression[id]', $new_expression['id']));
    }
    if (!is_array($new_expression)) {
        $new_expression = array();
    }
    if (isset($new_expression['expressionid'])) {
        $tblExp->addItem(new CVar('new_expression[expressionid]', $new_expression['expressionid']));
    }
    if (!isset($new_expression['expression'])) {
        $new_expression['expression'] = '';
    }
    if (!isset($new_expression['expression_type'])) {
        $new_expression['expression_type'] = EXPRESSION_TYPE_INCLUDED;
    }
    if (!isset($new_expression['case_sensitive'])) {
        $new_expression['case_sensitive'] = 0;
    }
    if (!isset($new_expression['exp_delimiter'])) {
        $new_expression['exp_delimiter'] = ',';
    }
    $tblExp->addRow(array(_('Expression'), new CTextBox('new_expression[expression]', $new_expression['expression'], 60)));
    $cmbType = new CComboBox('new_expression[expression_type]', $new_expression['expression_type'], 'javascript: submit();');
    $cmbType->addItem(EXPRESSION_TYPE_INCLUDED, expression_type2str(EXPRESSION_TYPE_INCLUDED));
    $cmbType->addItem(EXPRESSION_TYPE_ANY_INCLUDED, expression_type2str(EXPRESSION_TYPE_ANY_INCLUDED));
    $cmbType->addItem(EXPRESSION_TYPE_NOT_INCLUDED, expression_type2str(EXPRESSION_TYPE_NOT_INCLUDED));
    $cmbType->addItem(EXPRESSION_TYPE_TRUE, expression_type2str(EXPRESSION_TYPE_TRUE));
    $cmbType->addItem(EXPRESSION_TYPE_FALSE, expression_type2str(EXPRESSION_TYPE_FALSE));
    $tblExp->addRow(array(_('Expression type'), $cmbType));
    if (EXPRESSION_TYPE_ANY_INCLUDED == $new_expression['expression_type']) {
        $cmbDelimiter = new CComboBox('new_expression[exp_delimiter]', $new_expression['exp_delimiter']);
        $cmbDelimiter->addItem(',', ',');
        $cmbDelimiter->addItem('.', '.');
        $cmbDelimiter->addItem('/', '/');
        $tblExp->addRow(array(_('Delimiter'), $cmbDelimiter));
    } else {
        $tblExp->addItem(new Cvar('new_expression[exp_delimiter]', $new_expression['exp_delimiter']));
    }
    $chkbCase = new CCheckBox('new_expression[case_sensitive]', $new_expression['case_sensitive'], null, 1);
    $tblExp->addRow(array(_('Case sensitive'), $chkbCase));
    $tblExpFooter = new CTableInfo($tblExp);
    $oper_buttons = array();
    $oper_buttons[] = new CSubmit('add_expression', isset($new_expression['id']) ? _('Save') : _('Add'));
    $oper_buttons[] = new CSubmit('cancel_new_expression', _('Cancel'));
    $td = new CCol($oper_buttons);
    $td->setAttribute('colspan', 2);
    $td->setAttribute('style', 'text-align: right;');
    $tblExpFooter->setFooter($td);
    return $tblExpFooter;
}
Beispiel #14
0
                        $db_exps = DBselect($sql);
                        while ($exp = DBfetch($db_exps)) {
                            if (!isset($expressions[$exp['regexpid']])) {
                                $count[$exp['regexpid']] = 1;
                            } else {
                                $count[$exp['regexpid']]++;
                            }
                            if (!isset($expressions[$exp['regexpid']])) {
                                $expressions[$exp['regexpid']] = new CTable();
                            }
                            $expressions[$exp['regexpid']]->addRow(array($count[$exp['regexpid']], ' &raquo; ', $exp['expression'], ' [' . expression_type2str($exp['expression_type']) . ']'));
                            $regexp[$exp['regexpid']]['expressions'][$exp['expressionid']] = $exp;
                        }
                        $form = new CForm(null, 'post');
                        $form->setName('regexp');
                        $table = new CTableInfo();
                        $table->setHeader(array(new CCheckBox('all_regexps', NULL, "checkAll('" . $form->GetName() . "','all_regexps','regexpids');"), S_NAME, S_EXPRESSIONS));
                        foreach ($regexps as $regexpid => $regexp) {
                            $table->addRow(array(new CCheckBox('regexpids[' . $regexp['regexpid'] . ']', NULL, NULL, $regexp['regexpid']), new CLink($regexp['name'], 'config.php?form=update' . url_param('config') . '&regexpid=' . $regexp['regexpid'] . '#form'), isset($expressions[$regexpid]) ? $expressions[$regexpid] : '-'));
                        }
                        //			$table->SetFooter(new CCol(new CButtonQMessage('delete_selected',S_DELETE_SELECTED,S_DELETE_SELECTED_USERS_Q)));
                        $table->setFooter(new CCol(array(new CButtonQMessage('delete', S_DELETE_SELECTED, S_DELETE_SELECTED_REGULAR_EXPRESSIONS_Q))));
                        $form->AddItem($table);
                        $form->show();
                    }
                }
            }
        }
    }
}
include_once 'include/page_footer.php';
Beispiel #15
0
                            $db_maintenances = DBselect($sql);
                            while ($maintenance = DBfetch($db_maintenances)) {
                                $maintenances[$maintenance['maintenanceid']] = $maintenance;
                                $maintenanceids[$maintenance['maintenanceid']] = $maintenance['maintenanceid'];
                            }
                            $form = new CForm(null, 'post');
                            $form->setName('maintenances');
                            $table = new CTableInfo();
                            $table->setHeader(array(array(new CCheckBox('all_maintenances', NULL, "CheckAll('" . $form->GetName() . "','all_maintenances','group_maintenanceid');"), make_sorting_link(S_NAME, 'm.name')), S_TYPE, S_STATUS, S_DESCRIPTION));
                            foreach ($maintenances as $maintenanceid => $maintenance) {
                                if ($maintenance['active_till'] < time()) {
                                    $mnt_status = new CSpan(S_EXPIRED, 'red');
                                } else {
                                    $mnt_status = new CSpan(S_ACTIVE, 'green');
                                }
                                $table->addRow(array(array(new CCheckBox('maintenanceids[' . $maintenance['maintenanceid'] . ']', NULL, NULL, $maintenance['maintenanceid']), new CLink($maintenance['name'], 'hosts.php?form=update' . url_param('config') . '&maintenanceid=' . $maintenance['maintenanceid'] . '#form', 'action')), $maintenance['maintenance_type'] ? S_NO_DATA_PROCESSING : S_NORMAL_PROCESSING, $mnt_status, $maintenance['description']));
                                $row_count++;
                            }
                            //			$table->setFooter(new CCol(new CButtonQMessage('delete_selected',S_DELETE_SELECTED,S_DELETE_SELECTED_USERS_Q)));
                            $table->setFooter(new CCol(array(new CButtonQMessage('delete', S_DELETE_SELECTED, S_DELETE_SELECTED_GROUPS_Q))));
                            $form->addItem($table);
                            $form->show();
                        }
                    }
                }
            }
        }
    }
}
zbx_add_post_js('insert_in_element("numrows","' . $row_count . '");');
include_once 'include/page_footer.php';
Beispiel #16
0
show_table_header(permission2str($permission));
// host groups
$hostGroupForm = new CForm();
$hostGroupForm->setAttribute('id', 'groups');
$hostGroupTable = new CTableInfo(_('No host groups found.'));
$hostGroupTable->setHeader(new CCol(array(new CCheckBox('all_groups', null, 'checkAll(this.checked)'), _('Name'))));
$hostGroups = API::HostGroup()->get(array('output' => array('groupid', 'name')));
order_result($hostGroups, 'name');
foreach ($hostGroups as $hostGroup) {
    $hostGroupCheckBox = new CCheckBox();
    $hostGroupCheckBox->setAttribute('data-id', $hostGroup['groupid']);
    $hostGroupCheckBox->setAttribute('data-name', $hostGroup['name']);
    $hostGroupCheckBox->setAttribute('data-permission', $permission);
    $hostGroupTable->addRow(new CCol(array($hostGroupCheckBox, $hostGroup['name'])));
}
$hostGroupTable->setFooter(new CCol(new CButton('select', _('Select'), 'addGroups("' . $dstfrm . '")'), 'right'));
$hostGroupForm->addItem($hostGroupTable);
$hostGroupForm->show();
?>
<script type="text/javascript">
	function addGroups(formName) {
		var parentDocument = window.opener.document;

		if (!parentDocument) {
			return close_window();
		}

		jQuery('#groups input[type=checkbox]').each(function() {
			var obj = jQuery(this);

			if (obj.attr('name') !== 'all_groups' && obj.prop('checked')) {
// create table
$servicesParentTable = new CTableInfo();
$servicesParentTable->setHeader(array(_('Service'), _('Status calculation'), _('Trigger')));
$prefix = null;
// root
$description = new CLink(_('root'), '#', null, 'javascript:
	jQuery(\'#parent_name\', window.opener.document).val(' . zbx_jsvalue(_('root')) . ');
	jQuery(\'#parentname\', window.opener.document).val(' . zbx_jsvalue(_('root')) . ');
	jQuery(\'#parentid\', window.opener.document).val(' . zbx_jsvalue(0) . ');
	self.close();
	return false;');
$servicesParentTable->addRow(array(array($prefix, $description), _('Note'), '-'));
// others
foreach ($this->data['db_pservices'] as $db_service) {
    $description = new CSpan($db_service['name'], 'link');
    $description->setAttribute('onclick', 'javascript:
		jQuery(\'#parent_name\', window.opener.document).val(' . zbx_jsvalue($db_service['name']) . ');
		jQuery(\'#parentname\', window.opener.document).val(' . zbx_jsvalue($db_service['name']) . ');
		jQuery(\'#parentid\', window.opener.document).val(' . zbx_jsvalue($db_service['serviceid']) . ');
		self.close();
		return false;');
    $servicesParentTable->addRow(array(array($prefix, $description), serviceAlgorythm($db_service['algorithm']), $db_service['trigger']));
}
$column = new CCol(new CButton('cancel', _('Cancel'), 'javascript: self.close();'));
$column->setAttribute('style', 'text-align:right;');
$servicesParentTable->setFooter($column);
// append table to form
$servicesParentForm->addItem($servicesParentTable);
// append form to widget
$servicesParentWidget->addItem($servicesParentForm);
return $servicesParentWidget;
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
include dirname(__FILE__) . '/js/configuration.services.child.list.js.php';
$servicesChildWidget = new CWidget();
$servicesChildWidget->addPageHeader(_('IT service dependencies'));
// create form
$servicesChildForm = new CForm();
$servicesChildForm->setName('servicesForm');
if (!empty($this->data['service'])) {
    $servicesChildForm->addVar('serviceid', $this->data['service']['serviceid']);
}
// create table
$servicesChildTable = new CTableInfo(_('No IT services found.'));
$servicesChildTable->setHeader(array(new CCheckBox('all_services', null, "javascript: checkAll('" . $servicesChildForm->getName() . "', 'all_services', 'services');"), _('Service'), _('Status calculation'), _('Trigger')));
$prefix = null;
foreach ($this->data['db_cservices'] as $service) {
    $description = new CLink($service['name'], '#', 'service-name');
    $description->setAttributes(array('id' => 'service-name-' . $service['serviceid'], 'data-name' => $service['name'], 'data-serviceid' => $service['serviceid'], 'data-trigger' => $service['trigger']));
    $cb = new CCheckBox('services[' . $service['serviceid'] . ']', null, null, $service['serviceid']);
    $cb->addClass('service-select');
    $servicesChildTable->addRow(array($cb, array($prefix, $description), serviceAlgorythm($service['algorithm']), $service['trigger']));
}
$servicesChildTable->setFooter(new CCol(new CButton('select', _('Select')), 'right'));
// append table to form
$servicesChildForm->addItem($servicesChildTable);
// append form to widget
$servicesChildWidget->addItem($servicesChildForm);
return $servicesChildWidget;
Beispiel #19
0
    }
    $params = array('nodeids' => get_current_nodeid(), 'pattern' => $search, 'count' => 1, 'editable' => 1);
    $hosts_count = CTemplate::get($params);
    $overalCount = $hosts_count['rowscount'];
    $viewCount = count($templates);
    $header = array(is_show_all_nodes() ? new CCol(S_NODE) : null, new CCol(S_TEMPLATES), new CCol(S_ITEMS), new CCol(S_TRIGGERS), new CCol(S_GRAPHS));
    $table = new CTableInfo();
    $table->setHeader($header);
    foreach ($templates as $num => $template) {
        $templateid = $template['hostid'];
        $groupid = isset($hostsgroups[$templateid]) ? $hostsgroups[$templateid] : 0;
        $link = 'groupid=' . $groupid . '&hostid=' . $templateid;
        $caption = make_decoration($template['host'], $search);
        $table->addRow(array(get_node_name_by_elid($templateid), new CLink($caption, 'hosts.php?config=3&hostid=' . $templateid), new CLink(S_GO, 'items.php?' . $link), new CLink(S_GO, 'triggers.php?' . $link), new CLink(S_GO, 'graphs.php?' . $link)));
    }
    $table->setFooter(new CCol(S_DISPLAYING . SPACE . $viewCount . SPACE . S_OF_SMALL . SPACE . $overalCount . SPACE . S_FOUND_SMALL));
    $wdgt_templates = new CWidget('search_templates', $table);
    $wdgt_templates->addHeader(S_TEMPLATES, SPACE);
    $right_tab->addRow($wdgt_templates);
}
//----------------
$td_l = new CCol($left_tab);
$td_l->setAttribute('valign', 'top');
$td_r = new CCol($right_tab);
$td_r->setAttribute('valign', 'top');
$outer_table = new CTable();
$outer_table->setAttribute('border', 0);
$outer_table->setCellPadding(1);
$outer_table->setCellSpacing(1);
$outer_table->addRow(array($td_l, $td_r));
$search_wdgt->addItem($outer_table);
Beispiel #20
0
function get_expression_form()
{
    $tblExp = new CTable();
    /* init new_timeperiod variable */
    $new_expression = get_request('new_expression', array());
    if (is_array($new_expression) && isset($new_expression['id'])) {
        $tblExp->addItem(new Cvar('new_expression[id]', $new_expression['id']));
    }
    if (!is_array($new_expression)) {
        $new_expression = array();
    }
    if (!isset($new_expression['expression'])) {
        $new_expression['expression'] = '';
    }
    if (!isset($new_expression['expression_type'])) {
        $new_expression['expression_type'] = EXPRESSION_TYPE_INCLUDED;
    }
    if (!isset($new_expression['case_sensitive'])) {
        $new_expression['case_sensitive'] = 0;
    }
    if (!isset($new_expression['exp_delimiter'])) {
        $new_expression['exp_delimiter'] = ',';
    }
    $tblExp->addRow(array(S_EXPRESSION, new CTextBox('new_expression[expression]', $new_expression['expression'], 60)));
    $cmbType = new CComboBox('new_expression[expression_type]', $new_expression['expression_type'], 'javascript: submit();');
    $cmbType->addItem(EXPRESSION_TYPE_INCLUDED, expression_type2str(EXPRESSION_TYPE_INCLUDED));
    $cmbType->addItem(EXPRESSION_TYPE_ANY_INCLUDED, expression_type2str(EXPRESSION_TYPE_ANY_INCLUDED));
    $cmbType->addItem(EXPRESSION_TYPE_NOT_INCLUDED, expression_type2str(EXPRESSION_TYPE_NOT_INCLUDED));
    $cmbType->addItem(EXPRESSION_TYPE_TRUE, expression_type2str(EXPRESSION_TYPE_TRUE));
    $cmbType->addItem(EXPRESSION_TYPE_FALSE, expression_type2str(EXPRESSION_TYPE_FALSE));
    $tblExp->addRow(array(S_EXPRESSION_TYPE, $cmbType));
    if (EXPRESSION_TYPE_ANY_INCLUDED == $new_expression['expression_type']) {
        $cmbDelimiter = new CComboBox('new_expression[exp_delimiter]', $new_expression['exp_delimiter']);
        $cmbDelimiter->addItem(',', ',');
        $cmbDelimiter->addItem('.', '.');
        $cmbDelimiter->addItem('/', '/');
        $tblExp->addRow(array(S_DELIMITER, $cmbDelimiter));
    } else {
        $tblExp->addItem(new Cvar('new_expression[exp_delimiter]', $new_expression['exp_delimiter']));
    }
    $chkbCase = new CCheckBox('new_expression[case_sensitive]', $new_expression['case_sensitive'], null, 1);
    $tblExp->addRow(array(S_IGNORE_CASE, $chkbCase));
    $tblExpFooter = new CTableInfo($tblExp);
    $oper_buttons = array();
    $oper_buttons[] = new CButton('add_expression', isset($new_expression['id']) ? S_SAVE : S_ADD);
    $oper_buttons[] = new CButton('cancel_new_expression', S_CANCEL);
    $td = new CCol($oper_buttons);
    $td->addOption('colspan', 2);
    $td->addOption('style', 'text-align: right;');
    $tblExpFooter->setFooter($td);
    // end of condition list preparation
    return $tblExpFooter;
}
Beispiel #21
0
function make_discovery_status()
{
    $drules = array();
    $db_drules = DBselect('select distinct * from drules where ' . DBin_node('druleid') . ' order by name');
    while ($drule_data = DBfetch($db_drules)) {
        $drules[$drule_data['druleid']] = $drule_data;
        $drules[$drule_data['druleid']]['up'] = 0;
        $drules[$drule_data['druleid']]['down'] = 0;
    }
    $db_dhosts = DBselect('SELECT d.* ' . ' FROM dhosts d ' . ' ORDER BY d.dhostid,d.status,d.ip');
    $services = array();
    $discovery_info = array();
    while ($drule_data = DBfetch($db_dhosts)) {
        if (DHOST_STATUS_DISABLED == $drule_data['status']) {
            $drules[$drule_data['druleid']]['down']++;
        } else {
            $drules[$drule_data['druleid']]['up']++;
        }
    }
    $header = array(is_show_all_nodes() ? new CCol(S_NODE, 'center') : null, new CCol(S_DISCOVERY_RULE, 'center'), new CCol(S_UP), new CCol(S_DOWN));
    $table = new CTableInfo();
    $table->setHeader($header, 'vertical_header');
    foreach ($drules as $druleid => $drule) {
        $table->addRow(array(get_node_name_by_elid($druleid), new CLink(get_node_name_by_elid($drule['druleid']) . $drule['name'], 'discovery.php?druleid=' . $druleid), new CSpan($drule['up'], 'green'), new CSpan($drule['down'], $drule['down'] > 0 ? 'red' : 'green')));
    }
    $table->setFooter(new CCol(S_UPDATED . ': ' . date("H:i:s", time())));
    return $table;
}
Beispiel #22
0
                $ack = array(new CSpan(S_YES, 'off'), SPACE . '(' . $acks_cnt['cnt'] . SPACE, new CLink(S_SHOW, 'acknow.php?eventid=' . $row_event['eventid'], 'action'), ')');
            } else {
                $ack = new CLink(S_NOT_ACKNOWLEDGED, 'acknow.php?eventid=' . $row_event['eventid'], 'on');
            }
        }
        $description = expand_trigger_description_by_data(array_merge($row, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT);
        $font = new CTag('font', 'yes');
        $font->addOption('color', '#808080');
        $font->addItem(array('&nbsp;-&nbsp;', $description));
        $description = $font;
        $description = new CCol($description);
        $description->addOption('style', 'white-space: normal; width: 90%;');
        $table->addRow(array($config['event_ack_enable'] ? $row_event['acknowledged'] == 1 ? SPACE : new CCheckBox('events[' . $row_event['eventid'] . ']', 'no', NULL, $row_event['eventid']) : NULL, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'], $row_event['value'])), $value, new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row_event['clock']), 'tr_events.php?triggerid=' . $row['triggerid'] . '&eventid=' . $row_event['eventid'], 'action'), get_node_name_by_elid($row['triggerid']), $host, $description, $actions, $config['event_ack_enable'] ? new CCol($ack, 'center') : NULL, new CLink($row['comments'] == '' ? S_ADD : S_SHOW, 'tr_comments.php?triggerid=' . $row['triggerid'], 'action')));
        $event_limit++;
        if ($event_limit >= $config['event_show_max']) {
            break;
        }
    }
    unset($row, $description, $actions);
}
$table->setFooter(new CCol(array($config['event_ack_enable'] ? new CButton('bulkacknowledge', S_BULK_ACKNOWLEDGE, 'javascript: submit();') : SPACE)));
$m_form->addItem($table);
unset($table);
$p_elements[] = $m_form;
$triggers_hat = create_hat($text, $p_elements, array($mute_icon, $fs_icon), 'hat_triggers', get_profile('web.tr_status.hats.hat_triggers.state', 1));
$triggers_hat->Show();
zbx_add_post_js('insert_in_element("tr_numrows","' . $triggers_num . '");');
zbx_add_post_js('blink.init();');
$jsmenu = new CPUMenu(null, 170);
$jsmenu->InsertJavaScript();
include_once 'include/page_footer.php';