From 3265938a7cd0ef277bfc550ff47b60ed71b417de Mon Sep 17 00:00:00 2001 From: osmiy Date: Tue, 5 Dec 2006 12:15:43 +0000 Subject: - improved editing of graphs (Eugene) - developed 'Color picker' (Eugene) git-svn-id: svn://svn.zabbix.com/trunk@3567 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- frontends/php/graphs.php | 146 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 108 insertions(+), 38 deletions(-) (limited to 'frontends/php/graphs.php') diff --git a/frontends/php/graphs.php b/frontends/php/graphs.php index 9cfac191..08ed9862 100644 --- a/frontends/php/graphs.php +++ b/frontends/php/graphs.php @@ -49,6 +49,13 @@ include_once "include/page_header.php"; "yaxismin"=> array(T_ZBX_DBL, O_OPT, NULL, BETWEEN(-65535,65535), 'isset({save})'), "yaxismax"=> array(T_ZBX_DBL, O_OPT, NULL, BETWEEN(-65535,65535), 'isset({save})'), "yaxismax"=> array(T_ZBX_DBL, O_OPT, NULL, BETWEEN(-65535,65535), 'isset({save})'), + + "items"=> array(T_ZBX_STR, O_OPT, NULL, null, null), + "new_graph_item"=> array(T_ZBX_STR, O_OPT, NULL, null, null), + "group_gid"=> array(T_ZBX_STR, O_OPT, NULL, null, null), + "move_up"=> array(T_ZBX_INT, O_OPT, NULL, null, null), + "move_down"=> array(T_ZBX_INT, O_OPT, NULL, null, null), + "showworkperiod"=> array(T_ZBX_INT, O_OPT, NULL, IN("1"), NULL), "showtriggers"=> array(T_ZBX_INT, O_OPT, NULL, IN("1"), NULL), @@ -56,6 +63,9 @@ include_once "include/page_header.php"; "copy_targetid"=> array(T_ZBX_INT, O_OPT, NULL, DB_ID, NULL), "filter_groupid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({copy})&&{copy_type}==0'), /* actions */ + "add_item"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + "delete_item"=> 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), "copy"=> 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), @@ -71,51 +81,63 @@ include_once "include/page_header.php"; validate_group_with_host(PERM_READ_WRITE,array("allow_all_hosts","always_select_first_host")); ?> $data) + { + if(!isset($_REQUEST['group_gid'][$gid])) continue; + unset($_REQUEST['items'][$gid]); + } + unset($_REQUEST['delete_item'], $_REQUEST['group_gid']); + } + elseif(isset($_REQUEST['new_graph_item'])) + { + $new_gitem = get_request('new_graph_item', array()); + foreach($_REQUEST['items'] as $gid => $data) + { + if( $new_gitem['itemid'] == $data['itemid'] && + $new_gitem['yaxisside'] == $data['yaxisside'] && + $new_gitem['calc_fnc'] == $data['calc_fnc'] && + $new_gitem['type'] == $data['type'] && + $new_gitem['periods_cnt'] == $data['periods_cnt']) + { + $already_exist = true; + break; + } + } + if(!isset($already_exist)) + { + array_push($_REQUEST['items'], $new_gitem); + } + } + elseif(isset($_REQUEST['move_up']) && isset($_REQUEST['items'])) + { + SDI($_REQUEST['items'][$_REQUEST['move_up']]['sortorder']); + if(isset($_REQUEST['items'][$_REQUEST['move_up']])) + if($_REQUEST['items'][$_REQUEST['move_up']]['sortorder'] > 0) + $_REQUEST['items'][$_REQUEST['move_up']]['sortorder'] + = ''.($_REQUEST['items'][$_REQUEST['move_up']]['sortorder'] - 1); + + SDI($_REQUEST['items'][$_REQUEST['move_up']]['sortorder']); + } + elseif(isset($_REQUEST['move_down']) && isset($_REQUEST['items'])) + { + if(isset($_REQUEST['items'][$_REQUEST['move_down']])) + if($_REQUEST['items'][$_REQUEST['move_down']]['sortorder'] < 1000) + $_REQUEST['items'][$_REQUEST['move_down']]['sortorder']++; + } ?> AddRow(new CImg('chart3.php?period=3600&from=0'.url_param('items'). + url_param('name').url_param('width').url_param('height').url_param('yaxistype'). + url_param('yaxismin').url_param('yaxismax').url_param('show_work_period'). + url_param('show_triggers').url_param('graphtype'))); + $table->Show(); } else { /* Table HEADER */ if(isset($_REQUEST["graphid"])&&($_REQUEST["graphid"]==0)) @@ -248,12 +322,12 @@ include_once "include/page_header.php"; $form->AddVar('hostid',$_REQUEST["hostid"]); $table = new CTableInfo(S_NO_GRAPHS_DEFINED); - $table->setHeader(array( + $table->SetHeader(array( $_REQUEST["hostid"] != 0 ? NULL : S_HOSTS, array( new CCheckBox("all_graphs",NULL, "CheckAll('".$form->GetName()."','all_graphs');"), S_NAME), - S_WIDTH,S_HEIGHT,S_GRAPH_TYPE,S_GRAPH)); + S_WIDTH,S_HEIGHT,S_GRAPH_TYPE)); if($_REQUEST["hostid"] > 0) { @@ -295,8 +369,6 @@ include_once "include/page_header.php"; $name = new CLink($row["name"], "graphs.php?graphid=".$row["graphid"]."&form=update". url_param("groupid").url_param("hostid"),'action'); - $edit = new CLink("Edit", - "graph.php?graphid=".$row["graphid"]); } else { $real_hosts = get_realhosts_by_graphid($row["templateid"]); $real_host = DBfetch($real_hosts); @@ -318,7 +390,6 @@ include_once "include/page_header.php"; expand_trigger_description($row["triggerid"]) ); } - $edit = SPACE; } $chkBox = new CCheckBox("group_graphid[]",NULL,NULL,$row["graphid"]); @@ -334,8 +405,7 @@ include_once "include/page_header.php"; array($chkBox, $name), $row["width"], $row["height"], - $graphtype, - $edit + $graphtype )); } -- cgit