diff --git a/libraries/chart.lib.php b/libraries/chart.lib.php index 1b7c3079c..03fd2118e 100644 --- a/libraries/chart.lib.php +++ b/libraries/chart.lib.php @@ -1,5 +1,8 @@ toString(); $chartSettings = $chart->getSettings(); - PMA_handle_chart_err($chart->getErrors()); + $chartErrors = array_merge($chartErrors, $chart->getErrors()); + PMA_handle_chart_err($chartErrors); + return $chartCode; } @@ -216,7 +222,7 @@ function PMA_chart_results($data, &$chartSettings) */ function PMA_handle_chart_err($errors) { - if (!empty($errors)) { + if (in_array(ERR_NO_GD, $errors)) { PMA_warnMissingExtension('GD', false, 'GD extension is needed for charts.'); } } diff --git a/libraries/chart/pma_chart.php b/libraries/chart/pma_chart.php index 9ecfa7ad2..232a98e05 100644 --- a/libraries/chart/pma_chart.php +++ b/libraries/chart/pma_chart.php @@ -79,7 +79,7 @@ class PMA_Chart /* * Error codes will be stored here */ - protected $errors = null; + protected $errors = array(); function __construct($options = null) { diff --git a/libraries/chart/pma_pchart_chart.php b/libraries/chart/pma_pchart_chart.php index 80d7f68c2..363a57541 100644 --- a/libraries/chart/pma_pchart_chart.php +++ b/libraries/chart/pma_pchart_chart.php @@ -135,7 +135,7 @@ abstract class PMA_pChart_Chart extends PMA_Chart return ''; } else { - $this->errors = 1; // stub + array_push($this->errors, ERR_NO_GD); return ''; } } diff --git a/tbl_chart.php b/tbl_chart.php index f2c9d5ee9..f00a291b2 100644 --- a/tbl_chart.php +++ b/tbl_chart.php @@ -25,7 +25,7 @@ require_once './libraries/common.inc.php'; */ require './libraries/db_common.inc.php'; $url_params['goto'] = $cfg['DefaultTabDatabase']; -$url_params['back'] = 'tbl_chart.php'; +$url_params['back'] = 'sql.php'; /* * Import chart functions @@ -48,8 +48,16 @@ if (PMA_isValid($_REQUEST['chartSettings'], 'array')) { $chartSettings = $_REQUEST['chartSettings']; } -// get the chart and settings used to generate chart -$chart = PMA_chart_results($data, $chartSettings); +// get the chart and settings and errors after chart generation +$chartErrors = array(); +$chart = PMA_chart_results($data, $chartSettings, $chartErrors); + +if (empty($chartErrors)) { + $message = PMA_Message::success(__('Chart generated successfully.')); +} +else { + $message = PMA_Message::error(__('The result of this query can\'t be used for a chart.')); +} /** * Displays top menu links @@ -80,33 +88,33 @@ $url_params['reload'] = 1; - + - + - + - + - +
- - - - + + + +