From 77e35cf62a7363ff32a16de2165f9d220ffec1d8 Mon Sep 17 00:00:00 2001 From: osmiy Date: Thu, 16 Feb 2006 10:34:57 +0000 Subject: - Frontend improvement. (Eugene) git-svn-id: svn://svn.zabbix.com/trunk@2647 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- frontends/php/graph.php | 298 +++++++++++++++++++----------------------------- 1 file changed, 116 insertions(+), 182 deletions(-) (limited to 'frontends/php/graph.php') diff --git a/frontends/php/graph.php b/frontends/php/graph.php index 079201c0..db97e9e4 100644 --- a/frontends/php/graph.php +++ b/frontends/php/graph.php @@ -20,11 +20,36 @@ ?> + array(T_ZBX_INT, O_MAND, P_SYS, DB_ID,NULL), + + "gitemid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), + "itemid"=> array(T_ZBX_INT, O_OPT, NULL, NULL, 'isset({save})'), + "color"=> array(T_ZBX_STR, O_OPT, NULL, NULL, 'isset({save})'), + "drawtype"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,1,2,3"), 'isset({save})'), + "sortorder"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,65535), 'isset({save})'), + "yaxisside"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,1"), 'isset({save})'), + + "register"=> 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), + "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), + "form"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), + "form_refresh"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL) + ); + + check_fields($fields); +?> "; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + $db_graphs = DBselect("select name from graphs where graphid=".$_REQUEST["graphid"]); + $db_graph = DBfetch($db_graphs); + show_table_header($db_graph["name"]); - show_table_header(S_DISPLAYED_PARAMETERS_BIG); - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + $table = new CTable(NULL,"graph"); + $table->AddRow(new CImg("chart2.php?graphid=".$_REQUEST["graphid"]."&period=3600&from=0")); + $table->Show(); - $sql="select i.itemid,h.host,i.description,gi.gitemid,gi.color,gi.drawtype,gi.sortorder,i.key_". - " from hosts h,graphs_items gi,items i where i.itemid=gi.itemid". - " and gi.graphid=".$_REQUEST["graphid"]." and h.hostid=i.hostid order by gi.sortorder"; - $result=DBselect($sql); - $col=0; - while($row=DBfetch($result)) + if(isset($_REQUEST["form"])) { - if($col++%2==0) { echo ""; } - else { echo ""; } - - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - } - echo "
".S_SORT_ORDER."".S_HOST."".S_PARAMETER."".S_TYPE."".S_COLOR."".S_ACTIONS."
".$row["sortorder"]."".$row["host"]."".item_description($row["description"],$row["key_"])."".get_drawtype_description($row["drawtype"])."".$row["color"].""; - echo "".S_CHANGE.""; - echo " - "; - echo "".S_UP.""; - echo " - "; - echo "".S_DOWN.""; - echo "
"; -?> -"; - echo ""; - - if(isset($_REQUEST["gitemid"])) - { - $sql="select itemid,color,drawtype,sortorder,yaxisside from graphs_items". - " where gitemid=".$_REQUEST["gitemid"]; - $result=DBselect($sql); - $row=DBfetch($result); - $itemid=$row["itemid"]; - $color=$row["color"]; - $drawtype=$row["drawtype"]; - $sortorder=$row["sortorder"]; - $yaxisside=$row["yaxisside"]; +/****** FORM ******/ + echo BR; + insert_graphitem_form(); } else { - $sortorder=0; - $yaxisside=1; - } - - show_form_begin("graph.item"); - echo S_NEW_ITEM_FOR_THE_GRAPH; - - show_table2_v_delimiter(); - echo "
"; - echo ""; - if(isset($_REQUEST["gitemid"])) - { - echo ""; - } - - echo S_PARAMETER; - show_table2_h_delimiter(); - $result=DBselect("select h.host,i.description,i.itemid,i.key_ from hosts h,items i". - " where h.hostid=i.hostid and h.status in(".HOST_STATUS_MONITORED.",".HOST_STATUS_TEMPLATE.")". - " and i.status=".ITEM_STATUS_ACTIVE." order by h.host,i.description"); - echo ""; - - show_table2_v_delimiter(); - echo S_TYPE; - show_table2_h_delimiter(); - echo ""; - - show_table2_v_delimiter(); - echo S_YAXIS_SIDE; - show_table2_h_delimiter(); - echo ""; - - show_table2_v_delimiter(); - echo S_COLOR; - show_table2_h_delimiter(); - echo ""; - - show_table2_v_delimiter(); - echo nbsp(S_SORT_ORDER_1_100); - show_table2_h_delimiter(); - echo ""; - - show_table2_v_delimiter2(); - echo ""; - if(isset($itemid)) - { - echo ""; - echo ""; - } - - show_table2_header_end(); ?>