Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartynas Mickevicius <mmartynas@gmail.com>2010-07-09 18:34:28 +0400
committerMartynas Mickevicius <mmartynas@gmail.com>2010-07-09 18:34:28 +0400
commit979aa9a7ed7b4179d41de6998d6e8b4183611d22 (patch)
tree92e0f6ff4eb0ac166940177468dfa7513835e098 /tbl_chart.php
parent3df1126c8539d410c0bc376a04c94401dbc109ed (diff)
graceful error handling
Diffstat (limited to 'tbl_chart.php')
-rw-r--r--tbl_chart.php32
1 files changed, 20 insertions, 12 deletions
diff --git a/tbl_chart.php b/tbl_chart.php
index f2c9d5ee9d..f00a291b2f 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;
<table>
<tr><td><label for="width"><?php echo __("Width"); ?></label></td>
- <td><input type="text" name="chartSettings[width]" id="width" value="<?php echo $chartSettings['width']; ?>" /></td>
+ <td><input type="text" name="chartSettings[width]" id="width" value="<?php echo (isset($chartSettings['width']) ? $chartSettings['width'] : ''); ?>" /></td>
</tr>
<tr><td><label for="height"><?php echo __("Height"); ?></label></td>
- <td><input type="text" name="chartSettings[height]" id="height" value="<?php echo $chartSettings['height']; ?>" /></td>
+ <td><input type="text" name="chartSettings[height]" id="height" value="<?php echo (isset($chartSettings['height']) ? $chartSettings['height'] : ''); ?>" /></td>
</tr>
<tr><td><label for="titleText"><?php echo __("Title"); ?></label></td>
- <td><input type="text" name="chartSettings[titleText]" id="titleText" value="<?php echo $chartSettings['titleText']; ?>" /></td>
+ <td><input type="text" name="chartSettings[titleText]" id="titleText" value="<?php echo (isset($chartSettings['titleText']) ? $chartSettings['titleText'] : ''); ?>" /></td>
</tr>
<?php if ($chartSettings['type'] != 'pie' && $chartSettings['type'] != 'radar') { ?>
<tr><td><label for="xLabel"><?php echo __("X Axis label"); ?></label></td>
- <td><input type="text" name="chartSettings[xLabel]" id="xLabel" value="<?php echo $chartSettings['xLabel']; ?>" /></td>
+ <td><input type="text" name="chartSettings[xLabel]" id="xLabel" value="<?php echo (isset($chartSettings['xLabel']) ? $chartSettings['xLabel'] : ''); ?>" /></td>
</tr>
<tr><td><label for="yLabel"><?php echo __("Y Axis label"); ?></label></td>
- <td><input type="text" name="chartSettings[yLabel]" id="yLabel" value="<?php echo $chartSettings['yLabel']; ?>" /></td>
+ <td><input type="text" name="chartSettings[yLabel]" id="yLabel" value="<?php echo (isset($chartSettings['yLabel']) ? $chartSettings['yLabel'] : ''); ?>" /></td>
</tr>
<?php } ?>
<tr><td><label for="areaMargins"><?php echo __("Area margins"); ?></label></td>
<td>
- <input type="text" name="chartSettings[areaMargins][]" size="2" value="<?php echo $chartSettings['areaMargins'][0]; ?>" />
- <input type="text" name="chartSettings[areaMargins][]" size="2" value="<?php echo $chartSettings['areaMargins'][1]; ?>" />
- <input type="text" name="chartSettings[areaMargins][]" size="2" value="<?php echo $chartSettings['areaMargins'][2]; ?>" />
- <input type="text" name="chartSettings[areaMargins][]" size="2" value="<?php echo $chartSettings['areaMargins'][3]; ?>" />
+ <input type="text" name="chartSettings[areaMargins][]" size="2" value="<?php echo (isset($chartSettings['areaMargins'][0]) ? $chartSettings['areaMargins'][0] : ''); ?>" />
+ <input type="text" name="chartSettings[areaMargins][]" size="2" value="<?php echo (isset($chartSettings['areaMargins'][1]) ? $chartSettings['areaMargins'][1] : ''); ?>" />
+ <input type="text" name="chartSettings[areaMargins][]" size="2" value="<?php echo (isset($chartSettings['areaMargins'][2]) ? $chartSettings['areaMargins'][2] : ''); ?>" />
+ <input type="text" name="chartSettings[areaMargins][]" size="2" value="<?php echo (isset($chartSettings['areaMargins'][3]) ? $chartSettings['areaMargins'][3] : ''); ?>" />
</td>
</tr>