function make_graph_menu(&$menu, &$submenu) { $menu['menu_graphs'][] = array(_('Favourite graphs'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))); $menu['menu_graphs'][] = array(_('Add') . ' ' . _('Graph'), 'javascript: PopUp(\'popup.php?srctbl=graphs&srcfld1=graphid&reference=graphid&monitored_hosts=1&multiselect=1\',800,450); void(0);', null, array('outer' => 'pum_o_submenu', 'inner' => array('pum_i_submenu'))); $menu['menu_graphs'][] = array(_('Add') . ' ' . _('Simple graph'), 'javascript: PopUp(\'popup.php?srctbl=items&srcfld1=itemid&monitored_hosts=1&reference=itemid' . '&multiselect=1&numeric=1&templated=0&with_simple_graph_items=1\',800,450); void(0);', null, array('outer' => 'pum_o_submenu', 'inner' => array('pum_i_submenu'))); $menu['menu_graphs'][] = array(_('Remove'), null, null, array('outer' => 'pum_o_submenu', 'inner' => array('pum_i_submenu'))); $submenu['menu_graphs'] = make_graph_submenu(); }
$result = false; if ($_REQUEST['favaction'] == 'add') { zbx_value2array($_REQUEST['favid']); foreach ($_REQUEST['favid'] as $sourceid) { $result = add2favorites('web.favorite.graphids', $sourceid, $_REQUEST['favobj']); } } elseif ($_REQUEST['favaction'] == 'remove') { $result = rm4favorites('web.favorite.graphids', $_REQUEST['favid'], $_REQUEST['favobj']); } if ($page['type'] == PAGE_TYPE_JS && $result) { $innerHTML = make_favorite_graphs(); $innerHTML = $innerHTML->toString(); echo '$("hat_favgrph").update(' . zbx_jsvalue($innerHTML) . ');'; $menu = array(); $submenu = array(); echo 'page_submenu["menu_graphs"] = ' . zbx_jsvalue(make_graph_submenu()) . ';'; } } if ($_REQUEST['favobj'] == 'sysmapid') { $result = false; if ($_REQUEST['favaction'] == 'add') { zbx_value2array($_REQUEST['favid']); foreach ($_REQUEST['favid'] as $sourceid) { $result = add2favorites('web.favorite.sysmapids', $sourceid, $_REQUEST['favobj']); } } elseif ($_REQUEST['favaction'] == 'remove') { $result = rm4favorites('web.favorite.sysmapids', $_REQUEST['favid'], $_REQUEST['favobj']); } if ($page['type'] == PAGE_TYPE_JS && $result) { $innerHTML = make_favorite_maps(); $innerHTML = $innerHTML->toString();
function make_graph_menu(&$menu, &$submenu) { $menu['menu_graphs'][] = array(S_FAVOURITE . SPACE . S_GRAPHS, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))); $menu['menu_graphs'][] = array(S_ADD . SPACE . S_GRAPH, 'javascript: ' . "PopUp('popup.php?srctbl=graphs&" . 'reference=dashboard&' . 'dstfrm=fav_form&' . 'dstfld1=favobj&' . 'dstfld2=favid&' . 'srcfld1=name&' . "srcfld2=graphid',800,450);" . 'void(0);', null, array('outer' => 'pum_o_submenu', 'inner' => array('pum_i_submenu'))); $menu['menu_graphs'][] = array(S_ADD . SPACE . S_SIMPLE_GRAPH, 'javascript: ' . "PopUp('popup.php?srctbl=simple_graph&" . 'reference=dashboard&' . 'dstfrm=fav_form&' . 'dstfld1=favobj&' . 'dstfld2=favid&' . 'srcfld1=description&' . "srcfld2=itemid',800,450);" . "void(0);", null, array('outer' => 'pum_o_submenu', 'inner' => array('pum_i_submenu'))); $menu['menu_graphs'][] = array(S_REMOVE, null, null, array('outer' => 'pum_o_submenu', 'inner' => array('pum_i_submenu'))); $submenu['menu_graphs'] = make_graph_submenu(); }
function make_graph_menu(&$menu, &$submenu) { $menu['menu_graphs'][] = array(S_FAVOURITE_GRAPHS, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))); $menu['menu_graphs'][] = array(S_ADD . SPACE . S_GRAPH, 'javascript: ' . "PopUp('popup.php?srctbl=graphs" . '&srcfld1=graphid' . '&reference=graphid' . '&real_hosts=1' . "&multiselect=1',800,450);" . "void(0);", null, array('outer' => 'pum_o_submenu', 'inner' => array('pum_i_submenu'))); $menu['menu_graphs'][] = array(S_ADD . SPACE . S_SIMPLE_GRAPH, 'javascript: ' . "PopUp('popup.php?srctbl=simple_graph" . '&srcfld1=itemid' . '&real_hosts=1' . '&reference=itemid' . "&multiselect=1',800,450);" . "void(0);", null, array('outer' => 'pum_o_submenu', 'inner' => array('pum_i_submenu'))); $menu['menu_graphs'][] = array(S_REMOVE, null, null, array('outer' => 'pum_o_submenu', 'inner' => array('pum_i_submenu'))); $submenu['menu_graphs'] = make_graph_submenu(); }