$td_r = new CCol($page_header_r_col, 'page_header_r'); $td_r->setAttribute('width', '100%'); $top_page_row = array(new CCol($logo, 'page_header_l'), $td_r); unset($logo, $page_header_r_col, $help, $support); $table = new CTable(NULL, 'page_header'); $table->setCellSpacing(0); $table->setCellPadding(5); $table->addRow($top_page_row); $table->show(); $menu_table = new CTable(NULL, 'menu'); $menu_table->setCellSpacing(0); $menu_table->setCellPadding(5); $menu_table->addRow($main_menu); $node_form = null; if (ZBX_DISTRIBUTED && !defined('ZBX_HIDE_NODE_SELECTION')) { insert_js_function('check_all'); $available_nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_LIST, PERM_RES_DATA_ARRAY); $available_nodes = get_tree_by_parentid($ZBX_LOCALNODEID, $available_nodes, 'masterid'); //remove parent nodes if (!empty($available_nodes)) { $node_form = new CForm(); $node_form->setMethod('get'); $node_form->setAttribute('id', 'node_form'); // +++ create Combo Box with selected nodes +++ $combo_node_list = null; if (count($ZBX_VIEWED_NODES['nodes']) > 0) { $combo_node_list = new CComboBox('switch_node', $ZBX_VIEWED_NODES['selected'], 'submit()'); foreach ($ZBX_VIEWED_NODES['nodes'] as $nodeid => $nodedata) { $combo_node_list->addItem($nodeid, $nodedata['name']); } }
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **/ require_once "include/config.inc.php"; require_once "include/triggers.inc.php"; require_once "include/forms.inc.php"; require_once "include/js.inc.php"; $dstfrm = get_request("dstfrm", 0); // destination form $page["title"] = "S_MEDIA"; $page["file"] = "popup_media.php"; define('ZBX_PAGE_NO_MENU', 1); include_once "include/page_header.php"; // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = array("dstfrm" => array(T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, NULL), "media" => array(T_ZBX_INT, O_OPT, P_SYS, NULL, NULL), "mediatypeid" => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({add})'), "sendto" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({add})'), "period" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({add})'), "active" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({add})'), "severity" => array(T_ZBX_INT, O_OPT, NULL, NOT_EMPTY, NULL), "add" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), "form" => array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), "form_refresh" => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL)); check_fields($fields); insert_js_function('add_media'); if (isset($_REQUEST['add'])) { if (!validate_period($_REQUEST['period'])) { error("Icorrect time period"); } else { $severity = 0; $_REQUEST['severity'] = get_request('severity', array()); foreach ($_REQUEST['severity'] as $id) { $severity |= 1 << $id; } echo '<script language="JavaScript" type="text/javascript"><!-- add_media("' . $_REQUEST['dstfrm'] . '",' . $_REQUEST['media'] . ',' . $_REQUEST['mediatypeid'] . ',"' . $_REQUEST['sendto'] . '","' . $_REQUEST['period'] . '",' . $_REQUEST['active'] . ',' . $severity . ');' . "\n" . '--></script>'; } } echo SBR; if (isset($_REQUEST['media']) && !isset($_REQUEST['form_refresh'])) {
**/ require_once 'include/config.inc.php'; require_once 'include/triggers.inc.php'; require_once 'include/js.inc.php'; $dstfrm = get_request('dstfrm', 0); // destination form $page['title'] = "S_GRAPH_ITEM"; $page['file'] = 'popup_gitem.php'; $page['scripts'] = array(); define('ZBX_PAGE_NO_MENU', 1); include_once 'include/page_header.php'; // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = array('dstfrm' => array(T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, null), 'graphid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'gid' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0, 65535), null), 'graphtype' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2,3'), 'isset({save})'), 'list_name' => array(T_ZBX_STR, O_OPT, P_SYS, NOT_EMPTY, 'isset({save})&&isset({gid})'), 'itemid' => array(T_ZBX_INT, O_OPT, null, DB_ID . '({}!=0)', 'isset({save})'), 'color' => array(T_ZBX_CLR, O_OPT, null, null, 'isset({save})'), 'drawtype' => array(T_ZBX_INT, O_OPT, null, IN(graph_item_drawtypes()), 'isset({save})&&(({graphtype} == 0) || ({graphtype} == 1))'), 'sortorder' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), 'isset({save})&&(({graphtype} == 0) || ({graphtype} == 1))'), 'yaxisside' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), 'isset({save})&&(({graphtype} == 0) || ({graphtype} == 1))'), 'calc_fnc' => array(T_ZBX_INT, O_OPT, null, IN('1,2,4,7,9'), 'isset({save})'), 'type' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), 'isset({save})'), 'periods_cnt' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 360), 'isset({save})'), 'only_hostid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'monitored_hosts' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'add' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_STR, O_OPT, null, null, null)); check_fields($fields); insert_js_function('add_graph_item'); insert_js_function('update_graph_item'); $_REQUEST['drawtype'] = get_request('drawtype', 0); $_REQUEST['yaxisside'] = get_request('yaxisside', 0); $_REQUEST['sortorder'] = get_request('sortorder', 0); $graphid = get_request('graphid', false); if (isset($_REQUEST['type']) && $_REQUEST['type'] == GRAPH_ITEM_SUM && $graphid !== false) { $sql = 'SELECT COUNT(itemid) as items' . ' FROM graphs_items ' . ' WHERE type=' . GRAPH_ITEM_SUM . ' AND graphid=' . $graphid . ' AND itemid<>' . $_REQUEST['itemid']; $res = DBselect($sql); while ($rows = DBfetch($res)) { if (isset($rows['items']) && $rows['items'] > 0) { show_messages(false, null, S_ANOTHER_ITEM_SUM); if (isset($_REQUEST['save'])) { unset($_REQUEST['save']); } $_REQUEST['type'] = GRAPH_ITEM_SIMPLE; }
$dstfrm = get_request('dstfrm', 0); // destination form $page['title'] = "S_GRAPH_ITEM"; $page['file'] = 'popup_bitem.php'; define('ZBX_PAGE_NO_MENU', 1); include_once 'include/page_header.php'; // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = array('dstfrm' => array(T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, null), 'config' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1,2,3'), NULL), 'gid' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0, 65535), null), 'list_name' => array(T_ZBX_STR, O_OPT, P_SYS, NOT_EMPTY, 'isset({save})&&isset({gid})'), 'caption' => array(T_ZBX_STR, O_OPT, null, null, null), 'itemid' => array(T_ZBX_INT, O_OPT, null, DB_ID . '({}!=0)', 'isset({save})'), 'color' => array(T_ZBX_CLR, O_OPT, null, null, 'isset({save})'), 'calc_fnc' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2,4,7,9'), 'isset({save})'), 'axisside' => array(T_ZBX_INT, O_OPT, null, IN(GRAPH_YAXIS_SIDE_LEFT . ',' . GRAPH_YAXIS_SIDE_RIGHT), null), 'add' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_STR, O_OPT, null, null, null)); check_fields($fields); $_REQUEST['caption'] = get_request('caption', ''); $_REQUEST['axisside'] = get_request('axisside', GRAPH_YAXIS_SIDE_LEFT); if (zbx_empty($_REQUEST['caption']) && isset($_REQUEST['itemid']) && $_REQUEST['itemid'] > 0) { $_REQUEST['caption'] = item_description(get_item_by_itemid($_REQUEST['itemid'])); } insert_js_function('add_bitem'); insert_js_function('update_bitem'); if (isset($_REQUEST['save']) && !isset($_REQUEST['gid'])) { insert_js("add_bitem('" . $_REQUEST['dstfrm'] . "'," . zbx_jsvalue($_REQUEST['caption']) . ",'" . $_REQUEST['itemid'] . "','" . $_REQUEST['color'] . "'," . $_REQUEST['calc_fnc'] . "," . $_REQUEST['axisside'] . ");\n"); } if (isset($_REQUEST['save']) && isset($_REQUEST['gid'])) { insert_js("update_bitem('" . $_REQUEST['dstfrm'] . "','" . $_REQUEST['list_name'] . "','" . $_REQUEST['gid'] . "'," . zbx_jsvalue($_REQUEST['caption']) . ",'" . $_REQUEST['itemid'] . "','" . $_REQUEST['color'] . "'," . $_REQUEST['calc_fnc'] . "," . $_REQUEST['axisside'] . ");\n"); } else { echo SBR; $frmGItem = new CFormTable(S_NEW_ITEM_FOR_THE_GRAPH); $frmGItem->setName('graph_item'); $frmGItem->setHelp('web.graph.item.php'); $frmGItem->addVar('dstfrm', $_REQUEST['dstfrm']); $config = get_request('config', 1); $gid = get_request('gid', null); $list_name = get_request('list_name', null); $caption = get_request('caption', '');
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **/ require_once 'include/config.inc.php'; require_once 'include/js.inc.php'; $dstfrm = get_request('dstfrm', 0); // destination form $page['title'] = "S_PERIOD"; $page['file'] = 'popup_period.php'; $page['scripts'] = array('calendar.js'); define('ZBX_PAGE_NO_MENU', 1); include_once 'include/page_header.php'; // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = array('dstfrm' => array(T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, null), 'config' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1,2,3'), NULL), 'period_id' => array(T_ZBX_INT, O_OPT, null, null, null), 'caption' => array(T_ZBX_STR, O_OPT, null, null, null), 'report_timesince' => array(T_ZBX_INT, O_OPT, null, null, 'isset({save})'), 'report_timetill' => array(T_ZBX_INT, O_OPT, null, null, 'isset({save})'), 'color' => array(T_ZBX_CLR, O_OPT, null, null, 'isset({save})'), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_STR, O_OPT, null, null, null)); check_fields($fields); insert_js_function('add_period'); insert_js_function('update_period'); $_REQUEST['caption'] = get_request('caption', ''); if (zbx_empty($_REQUEST['caption']) && isset($_REQUEST['report_timesince']) && isset($_REQUEST['report_timetill'])) { $_REQUEST['caption'] = date(S_DATE_FORMAT_YMDHMS, $_REQUEST['report_timesince']) . ' - ' . date(S_DATE_FORMAT_YMDHMS, $_REQUEST['report_timetill']); } if (isset($_REQUEST['save'])) { if (isset($_REQUEST['period_id'])) { insert_js("update_period('" . $_REQUEST['period_id'] . "','" . $_REQUEST['dstfrm'] . "','" . $_REQUEST['caption'] . "','" . $_REQUEST['report_timesince'] . "','" . $_REQUEST['report_timetill'] . "','" . $_REQUEST['color'] . "');\n"); } else { insert_js("add_period('" . $_REQUEST['dstfrm'] . "','" . $_REQUEST['caption'] . "','" . $_REQUEST['report_timesince'] . "','" . $_REQUEST['report_timetill'] . "','" . $_REQUEST['color'] . "');\n"); } } else { echo SBR; $frmPd = new CFormTable(S_PERIOD); $frmPd->setName('period'); $frmPd->addVar('dstfrm', $_REQUEST['dstfrm']);
if (str_in_array($srctbl, array('applications', 'triggers'))) { if (zbx_empty($noempty)) { $value1 = isset($_REQUEST['dstfld1']) && zbx_strpos($_REQUEST['dstfld1'], 'id') !== false ? 0 : ''; $value2 = isset($_REQUEST['dstfld2']) && zbx_strpos($_REQUEST['dstfld2'], 'id') !== false ? 0 : ''; $value3 = isset($_REQUEST['dstfld3']) && zbx_strpos($_REQUEST['dstfld3'], 'id') !== false ? 0 : ''; $epmtyScript = get_window_opener($dstfrm, $dstfld1, $value1); $epmtyScript .= get_window_opener($dstfrm, $dstfld2, $value2); $epmtyScript .= get_window_opener($dstfrm, $dstfld3, $value3); $epmtyScript .= ' close_window(); return false;'; $frmTitle->addItem(array(SPACE, new CButton('empty', _('Empty'), $epmtyScript))); } } show_table_header($page['title'], $frmTitle); insert_js_function('addSelectedValues'); insert_js_function('addValues'); insert_js_function('addValue'); /* * User group */ if ($srctbl == 'usrgrp') { $form = new CForm(); $form->setName('usrgrpform'); $form->setAttribute('id', 'usrgrps'); $table = new CTableInfo(_('No user groups found.')); $table->setHeader(array($multiselect ? new CCheckBox('all_usrgrps', null, "javascript: checkAll('" . $form->getName() . "', 'all_usrgrps', 'usrgrps');") : null, _('Name'))); $options = array('nodeids' => $nodeId, 'output' => API_OUTPUT_EXTEND, 'preservekeys' => true); if (!is_null($writeonly)) { $options['editable'] = true; } $userGroups = API::UserGroup()->get($options); order_result($userGroups, 'name');
break; } //if($row["status"] != TRIGGER_STATUS_UNKNOWN) $row["error"]=SPACE; //if($row["error"]=="") $row["error"]=SPACE; if ($multiselect) { $description = new CCol(array(new CCheckBox('trigger[' . $row['triggerid'] . ']', NULL, NULL, $row['triggerid']), $description)); } $table->addRow(array($description, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'])), $status)); unset($description); unset($status); } $form->addItem($table); $form->show(); } else { if ($srctbl == "logitems") { insert_js_function('add_item_variable'); $table = new CTableInfo(S_NO_ITEMS_DEFINED); $table->SetHeader(array($hostid > 0 ? null : S_HOST, S_DESCRIPTION, S_KEY, nbsp(S_UPDATE_INTERVAL), S_STATUS)); $db_items = DBselect('SELECT DISTINCT h.host,i.* ' . ' FROM items i,hosts h' . ' WHERE i.value_type=' . ITEM_VALUE_TYPE_LOG . ' AND h.hostid=i.hostid ' . ' AND ' . DBin_node('i.itemid', $nodeid) . ($hostid > 0 ? ' AND ' . $hostid . '=i.hostid ' : '') . ' and ' . DBcondition('h.hostid', $available_hosts) . ' and h.status in (' . implode(',', $host_status) . ')' . ' ORDER BY h.host,i.description, i.key_, i.itemid'); while ($db_item = DBfetch($db_items)) { $description = new CSpan(item_description($db_item), 'link'); $description->onClick("return add_item_variable('" . $dstfrm . "','" . $db_item["itemid"] . "');"); switch ($db_item["status"]) { case 0: $status = new CCol(S_ACTIVE, "enabled"); break; case 1: $status = new CCol(S_DISABLED, "disabled"); break; case 3: $status = new CCol(S_NOT_SUPPORTED, "unknown");
$filterForm->setAttribute('id', 'zbx_filter'); $filterForm->addVar('action', $this->data['action']); $filterForm->addVar('itemid', zbx_toHash($_REQUEST['itemid'])); $itemListbox = new CListBox('cmbitemlist[]'); foreach ($this->data['items'] as $itemid => $item) { if (!isset($this->data['iv_string'][$item['value_type']])) { unset($this->data['items'][$itemid]); continue; } $host = reset($item['hosts']); $itemListbox->addItem($itemid, $host['name'] . ': ' . itemName($item)); } $addItemButton = new CButton('add_log', _('Add'), "return PopUp('popup.php?multiselect=1&real_hosts=1" . '&reference=itemid&srctbl=items&value_types[]=' . $this->data['item']['value_type'] . "&srcfld1=itemid');"); $deleteItemButton = null; if (count($this->data['items']) > 1) { insert_js_function('removeSelectedItems'); $deleteItemButton = new CSubmit('remove_log', _('Remove selected'), "javascript: removeSelectedItems('cmbitemlist_', 'itemid')"); } $filterForm->addRow(_('Items list'), array($itemListbox, BR(), $addItemButton, $deleteItemButton)); $filterForm->addRow(_('Select rows with value like'), new CTextBox('filter', get_request('filter', ''), ZBX_TEXTBOX_FILTER_SIZE)); $filterTask = get_request('filter_task', 0); $taskComboBox = new CComboBox('filter_task', $filterTask, 'submit()'); $taskComboBox->addItem(FILTER_TASK_SHOW, _('Show selected')); $taskComboBox->addItem(FILTER_TASK_HIDE, _('Hide selected')); $taskComboBox->addItem(FILTER_TASK_MARK, _('Mark selected')); $taskComboBox->addItem(FILTER_TASK_INVERT_MARK, _('Mark others')); $tasks = array($taskComboBox); if (str_in_array($filterTask, array(FILTER_TASK_MARK, FILTER_TASK_INVERT_MARK))) { $colorComboBox = new CComboBox('mark_color', get_request('mark_color', 0)); $colorComboBox->addItem(MARK_COLOR_RED, _('as Red')); $colorComboBox->addItem(MARK_COLOR_GREEN, _('as Green'));