diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 27b6b153cb..faff804bc1 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2010-06-11 Sergio Martin + + * godmode/reporting/graph_builder.php: Fixed the + period of graph for bug #3014781, the creation + of combined graphs before store the graph for bug + #3014796 and the message over the header for bug #3014798 + 2010-06-09 Miguel de Dios * include/javascript/pandora.js: fixed lost semi colon. diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index 7b771c86b1..321ebbd202 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -72,65 +72,6 @@ $stacked = 0; $add_module = (bool) get_parameter ('add_module'); $editGraph = (bool) get_parameter('edit_graph'); -if (isset ($_GET["store_graph"])) { - $name = get_parameter_post ("name"); - $description = get_parameter_post ("description"); - $module_number = get_parameter_post ("module_number"); - //$private = get_parameter_post ("private"); - $idGroup = get_parameter_post ('graph_id_group'); - $width = get_parameter_post ("width"); - $height = get_parameter_post ("height"); - $events = get_parameter_post ("events"); - $stacked = get_parameter ("stacked", 0); - if ($events == "") // Temporal workaround - $events = 0; - $period = get_parameter_post ("period"); - // Create graph - $sql = "INSERT INTO tgraph - (id_user, name, description, period, width, height, private, id_group, events, stacked) VALUES - ('".$config['id_user']."', - '$name', - '$description', - $period, - $width, - $height, - 0, - $idGroup, - $events, - $stacked)"; - //echo "DEBUG $sql
"; - $res = mysql_query($sql); - if ($res){ - $id_graph = mysql_insert_id(); - if ($id_graph){ - for ($a=0; $a < $module_number; $a++){ - $id_agentemodulo = get_parameter_post ("module_".$a); - $id_agentemodulo_w = get_parameter_post ("module_weight_".$a); - $sql = "INSERT INTO tgraph_source (id_graph, id_agent_module, weight) VALUES - ($id_graph, $id_agentemodulo, $id_agentemodulo_w)"; - //echo "DEBUG $sql
"; - mysql_query($sql); - } - echo "

".__('Graph stored successfully')."

"; - } else - echo "

".__('There was a problem storing Graph')."

"; - } else - echo "

".__('There was a problem storing Graph')."

"; -} - -if (isset($_GET['change_graph'])) { - $id = get_parameter('id'); - $name = get_parameter('name'); - $id_group = get_parameter('graph_id_group'); - $description = get_parameter('description'); - - $success = process_sql_update('tgraph', - array('name' => $name, 'id_group' => $id_group, 'description' => $description), - array('id_graph' => $id)); - - print_result_message($success, __("Update the graph"), __("Bad update the graph")); -} - if (isset ($_GET["get_agent"])) { $id_agent = $_POST["id_agent"]; if (isset($_POST["chunk"])) @@ -149,7 +90,7 @@ if (isset ($_GET["delete_module"] )) { $chunkdata = $_POST["chunk"]; if (isset($chunkdata)) { $chunk1 = array(); - $chunk1 = explode ("\|", $chunkdata); + $chunk1 = explode ("|", $chunkdata); $modules="";$weights=""; for ($a = 0; $a < count ($chunk1); $a++) { if (isset ($_POST["delete_$a"])) { @@ -250,7 +191,7 @@ if (! isset($_GET["delete_module"])) { $weight_array = array(); $agent_array = array(); $chunk1 = array(); - $chunk1 = explode ("\|", $chunkdata); + $chunk1 = explode ("|", $chunkdata); $modules="";$weights=""; for ($a=0; $a < count($chunk1); $a++){ $chunk2[$a] = array(); @@ -306,7 +247,7 @@ if ($editGraph) { $graphInTgraph = get_db_row_sql("SELECT * FROM tgraph WHERE id_graph = " . $id); $stacked = $graphInTgraph['stacked']; $events = $graphInTgraph['events']; - + $period = $graphInTgraph['period']; $modules = implode(',', $module_array); $weights = implode(',', $weight_array); $chunkdata = implode('|', $tempChunkdata); @@ -390,6 +331,66 @@ if (($render == 1) && (isset($modules))) { // Header print_page_header (__('Graph builder'), "", false, "", true); + +if (isset ($_GET["store_graph"])) { + $name = get_parameter_post ("name"); + $description = get_parameter_post ("description"); + $module_number = get_parameter_post ("module_number"); + //$private = get_parameter_post ("private"); + $idGroup = get_parameter_post ('graph_id_group'); + $width = get_parameter_post ("width"); + $height = get_parameter_post ("height"); + $events = get_parameter_post ("events"); + $stacked = get_parameter ("stacked", 0); + if ($events == "") // Temporal workaround + $events = 0; + $period = get_parameter_post ("period"); + // Create graph + $sql = "INSERT INTO tgraph + (id_user, name, description, period, width, height, private, id_group, events, stacked) VALUES + ('".$config['id_user']."', + '$name', + '$description', + $period, + $width, + $height, + 0, + $idGroup, + $events, + $stacked)"; + //echo "DEBUG $sql
"; + $res = mysql_query($sql); + if ($res){ + $id_graph = mysql_insert_id(); + if ($id_graph){ + for ($a=0; $a < $module_number; $a++){ + $id_agentemodulo = get_parameter_post ("module_".$a); + $id_agentemodulo_w = get_parameter_post ("module_weight_".$a); + $sql = "INSERT INTO tgraph_source (id_graph, id_agent_module, weight) VALUES + ($id_graph, $id_agentemodulo, $id_agentemodulo_w)"; + //echo "DEBUG $sql
"; + mysql_query($sql); + } + echo "

".__('Graph stored successfully')."

"; + } else + echo "

".__('There was a problem storing Graph')."

"; + } else + echo "

".__('There was a problem storing Graph')."

"; +} + +if (isset($_GET['change_graph'])) { + $id = get_parameter('id'); + $name = get_parameter('name'); + $id_group = get_parameter('graph_id_group'); + $description = get_parameter('description'); + + $success = process_sql_update('tgraph', + array('name' => $name, 'id_group' => $id_group, 'description' => $description), + array('id_graph' => $id)); + + print_result_message($success, __("Update the graph"), __("Bad update the graph")); +} + echo ""; if ($editGraph) { echo "";