From b535f03d225f57dd12d97a8d32f88d0bb650f688 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Thu, 11 Jul 2013 11:11:16 +0000 Subject: [PATCH] 2013-07-11 Sergio Martin * include/graphs/pChart/pPie.class.php: Fix the colors of the legend when we want to have legend of data that not appears in the pie. Merge from 4.1 * operation/users/user_edit.php: Fix repeated select control for main page in workspace section * godmode/servers/modificar_server.php: Fix crash in servers view git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8516 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 12 +++++++++ .../godmode/servers/modificar_server.php | 1 + .../include/graphs/pChart/pPie.class.php | 27 +++++++++++-------- pandora_console/operation/users/user_edit.php | 5 +--- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index f1a395338c..48e268691a 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2013-07-11 Sergio Martin + + * include/graphs/pChart/pPie.class.php: Fix the colors of the + legend when we want to have legend of data that not appears + in the pie. Merge from 4.1 + + * operation/users/user_edit.php: Fix repeated select control + for main page in workspace section + + * godmode/servers/modificar_server.php: Fix crash in + servers view + 2013-07-11 Sergio Martin * include/functions_graph.php: Change Data by Avg on graphs legends diff --git a/pandora_console/godmode/servers/modificar_server.php b/pandora_console/godmode/servers/modificar_server.php index 3206126a3f..7f53c47dd8 100644 --- a/pandora_console/godmode/servers/modificar_server.php +++ b/pandora_console/godmode/servers/modificar_server.php @@ -17,6 +17,7 @@ global $config; require_once ("include/functions_servers.php"); +require_once ("include/functions_graph.php"); check_login(); diff --git a/pandora_console/include/graphs/pChart/pPie.class.php b/pandora_console/include/graphs/pChart/pPie.class.php index bea05181f3..5afcc35886 100755 --- a/pandora_console/include/graphs/pChart/pPie.class.php +++ b/pandora_console/include/graphs/pChart/pPie.class.php @@ -84,9 +84,12 @@ /* Dump the real number of data to draw */ $Values = ""; + $PaletteAux = array(); // Fix to store only necesary colors foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value) - { if ($Value != 0) { $Values[] = $Value; } } - + { if ($Value != 0) { $Values[$Key] = $Value; $PaletteAux[] = $Palette[$Key]; } } + + $Palette = $PaletteAux; + /* Compute the wasted angular space between series */ if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = count($Values) * $DataGapAngle; } @@ -292,9 +295,12 @@ /* Dump the real number of data to draw */ $Values = ""; + $PaletteAux = array(); // Fix to store only necesary colors foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value) - { if ($Value != 0) { $Values[$Key] = $Value; } } - + { if ($Value != 0) { $Values[$Key] = $Value; $PaletteAux[] = $Palette[$Key]; } } + + $Palette = $PaletteAux; + /* Compute the wasted angular space between series */ if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = count($Values) * $DataGapAngle; } @@ -306,17 +312,15 @@ /* Draw the polygon pie elements */ $Step = 360 / (2 * PI * $Radius); - $Offset = 360; - // Commented due to fix bellow - //$ID = count($Values)-1; + $Offset = 360; + + $ID = count($Values)-1; // Commented due to fix bellow // $Values = array_reverse($Values); $Slice = 0; $Slices = ""; $SliceColors = ""; $Visible = ""; $SliceAngle = ""; foreach($Values as $Key => $Value) { - // Fix: ID equal to the index of array - $ID = $Key; $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]); $SliceColors[$Slice] = $Settings; @@ -518,7 +522,8 @@ if ( $SecondPass ) { $Step = 360 / (2 * PI * $Radius); - $Offset = 360; $ID = 0; + $Offset = 360; + $ID = count($Values)-1; foreach($Values as $Key => $Value) { $FirstPoint = TRUE; @@ -566,7 +571,7 @@ } $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); - $Offset = $i - $DataGapAngle; $ID++; + $Offset = $i - $DataGapAngle; $ID--; } } diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 1aae0b5566..7823c87cfd 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -294,10 +294,7 @@ if (!$meta) { } $data[1] .= '
' . html_print_select($values, 'section', io_safe_output($user_info["section"]), 'show_data_section();', '', -1, true, false, false); - - echo html_print_select($values, 'section', io_safe_output($user_info["section"]), 'show_data_section();', '', -1, true, false, false); - echo "  "; - + if (enterprise_installed()) { $dashboards = get_user_dashboards ($config['id_user']); $dashboards_aux = array();