Merge remote-tracking branch 'origin/QA_3_5' into QA_3_5
This commit is contained in:
commit
3be794daab
@ -8,6 +8,7 @@ phpMyAdmin - ChangeLog
|
||||
- bug #3576322 [search] Invalid select query generated for tables with ENUM fields
|
||||
- bug #3577468 [display] Incorrect imagejpeg Syntax Breaks Image Transformation
|
||||
- bug #3578776 [search] Editing SQL not possible when no records found
|
||||
- bug #3571970 [interface] Display chart and number of rows to plot
|
||||
|
||||
3.5.3.0 (2012-10-08)
|
||||
- bug #3539044 [interface] Browse mode "Show" button gives blank page if no results anymore
|
||||
|
||||
@ -4,10 +4,13 @@ var chart_xaxis_idx = -1;
|
||||
var chart_series;
|
||||
var chart_series_index = -1;
|
||||
var temp_chart_title;
|
||||
var currentChart = null;
|
||||
var chart_data = null;
|
||||
var nonJqplotSettings = null;
|
||||
var currentSettings = null;
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
var currentChart = null;
|
||||
var chart_data = jQuery.parseJSON($('#querychart').html());
|
||||
chart_series = 'columns';
|
||||
chart_xaxis_idx = $('select[name="chartXAxis"]').attr('value');
|
||||
|
||||
@ -24,15 +27,15 @@ $(document).ready(function() {
|
||||
currentChart.replot( {resetAxes: true})
|
||||
});
|
||||
|
||||
var nonJqplotSettings = {
|
||||
nonJqplotSettings = {
|
||||
chart: {
|
||||
type: 'line',
|
||||
width: $('#resizer').width() - 20,
|
||||
height: $('#resizer').height() - 20
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var currentSettings = {
|
||||
currentSettings = {
|
||||
grid: {
|
||||
drawBorder: false,
|
||||
shadow: false,
|
||||
@ -57,7 +60,7 @@ $(document).ready(function() {
|
||||
placement: 'outsideGrid',
|
||||
location: 'se'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$('#querychart').html('');
|
||||
|
||||
@ -118,20 +121,62 @@ $(document).ready(function() {
|
||||
drawChart();
|
||||
});
|
||||
|
||||
function drawChart() {
|
||||
nonJqplotSettings.chart.width = $('#resizer').width() - 20;
|
||||
nonJqplotSettings.chart.height = $('#resizer').height() - 20;
|
||||
});
|
||||
|
||||
// todo: a better way using .replot() ?
|
||||
if (currentChart != null) {
|
||||
currentChart.destroy();
|
||||
}
|
||||
currentChart = PMA_queryChart(chart_data, currentSettings, nonJqplotSettings);
|
||||
/**
|
||||
* Ajax Event handler for 'Go' button click
|
||||
*
|
||||
*/
|
||||
$("#tblchartform").live('submit', function(event) {
|
||||
|
||||
if(!checkFormElementInRange(this, 'session_max_rows', PMA_messages['strNotValidRowNumber'], 1)
|
||||
|| !checkFormElementInRange(this, 'pos', PMA_messages['strNotValidRowNumber'], 0-1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
drawChart();
|
||||
$('#querychart').show();
|
||||
});
|
||||
var $form = $(this);
|
||||
if (! checkSqlQuery($form[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// remove any div containing a previous error message
|
||||
$('.error').remove();
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
|
||||
$.post($form.attr('action'), $form.serialize() , function(data) {
|
||||
if (data.success == true) {
|
||||
$('.success').fadeOut();
|
||||
|
||||
if (typeof data.chartData != 'undefined') {
|
||||
chart_data = jQuery.parseJSON(data.chartData);
|
||||
drawChart();
|
||||
$('#querychart').show();
|
||||
}
|
||||
} else {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
chart_data = null;
|
||||
drawChart();
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}, "json"); // end $.post()
|
||||
|
||||
return false;
|
||||
}); // end
|
||||
|
||||
function drawChart() {
|
||||
nonJqplotSettings.chart.width = $('#resizer').width() - 20;
|
||||
nonJqplotSettings.chart.height = $('#resizer').height() - 20;
|
||||
|
||||
// todo: a better way using .replot() ?
|
||||
if (currentChart != null) {
|
||||
currentChart.destroy();
|
||||
}
|
||||
currentChart = PMA_queryChart(chart_data, currentSettings, nonJqplotSettings);
|
||||
}
|
||||
|
||||
function in_array(element,array)
|
||||
{
|
||||
|
||||
@ -18,6 +18,43 @@ if (! defined('PMA_NO_VARIABLES_IMPORT')) {
|
||||
*
|
||||
*/
|
||||
require_once './libraries/common.inc.php';
|
||||
require_once './libraries/common.lib.php';
|
||||
|
||||
/*
|
||||
* Execute the query and return the result
|
||||
*/
|
||||
if(isset($_REQUEST['ajax_request']) && isset($_REQUEST['pos']) && isset($_REQUEST['session_max_rows'])) {
|
||||
|
||||
if (strlen($GLOBALS['table']) && strlen($GLOBALS['db'])) {
|
||||
include './libraries/tbl_common.php';
|
||||
}
|
||||
else {
|
||||
PMA_ajaxResponse(__('Error'), false);
|
||||
}
|
||||
|
||||
$sql_limit_to_append = ' LIMIT ' . $_REQUEST['pos'] . ', ' . $_REQUEST['session_max_rows'] . " ";
|
||||
$sql_query .= $sql_limit_to_append;
|
||||
|
||||
$data = array();
|
||||
$result = PMA_DBI_try_query($sql_query);
|
||||
while ($row = PMA_DBI_fetch_assoc($result)) {
|
||||
$data[] = $row;
|
||||
}
|
||||
if(empty($data))
|
||||
PMA_ajaxResponse(__('Error'), false);
|
||||
|
||||
$sanitized_data = array();
|
||||
foreach ($data as $data_row_number => $data_row) {
|
||||
$tmp_row = array();
|
||||
foreach ($data_row as $data_column => $data_value) {
|
||||
$tmp_row[htmlspecialchars($data_column)] = htmlspecialchars($data_value);
|
||||
}
|
||||
$sanitized_data[] = $tmp_row;
|
||||
}
|
||||
$extra_data['chartData'] = json_encode($sanitized_data);
|
||||
unset($sanitized_data);
|
||||
PMA_ajaxResponse(null, true, $extra_data);
|
||||
}
|
||||
|
||||
$GLOBALS['js_include'][] = 'tbl_chart.js';
|
||||
$GLOBALS['js_include'][] = 'jqplot/jquery.jqplot.js';
|
||||
@ -56,11 +93,7 @@ if (strlen($GLOBALS['table'])) {
|
||||
include './libraries/server_links.inc.php';
|
||||
}
|
||||
|
||||
/*
|
||||
* Execute the query and return the result
|
||||
*/
|
||||
$data = array();
|
||||
|
||||
$result = PMA_DBI_try_query($sql_query);
|
||||
while ($row = PMA_DBI_fetch_assoc($result)) {
|
||||
$data[] = $row;
|
||||
@ -86,7 +119,7 @@ url_query = '<?php echo $url_query;?>';
|
||||
</script>
|
||||
<!-- Display Chart options -->
|
||||
<div id="div_view_options">
|
||||
<form method="post" action="tbl_chart.php">
|
||||
<form method="post" id="tblchartform" action="tbl_chart.php">
|
||||
<?php echo PMA_generate_common_hidden_inputs($url_params); ?>
|
||||
<fieldset>
|
||||
<legend><?php echo __('Display chart'); ?></legend>
|
||||
@ -146,23 +179,17 @@ url_query = '<?php echo $url_query;?>';
|
||||
<input style="margin-top:0;" type="text" name="xaxis_label" id="xaxis_label"
|
||||
value="<?php echo ($yaxis == -1) ? __('X Values') : htmlspecialchars($keys[$yaxis]); ?>" /><br />
|
||||
<label for="yaxis_label"><?php echo __('Y-Axis label:'); ?></label>
|
||||
<input type="text" name="yaxis_label" id="yaxis_label" value="<?php echo __('Y Values'); ?>" />
|
||||
<input type="text" name="yaxis_label" id="yaxis_label" value="<?php echo __('Y Values'); ?>" /><br />
|
||||
<label for="pos"><?php echo __('Start row') . ': ' . "\n"; ?></label>
|
||||
<input type="text" name="pos" size="3" value="<?php echo $_SESSION['tmp_user_values']['pos']; ?>" /><br />
|
||||
<label for="session_max_rows"><?php echo __('Number of rows') . ': ' . "\n"; ?></label>
|
||||
<input type="text" name="session_max_rows" size="3" value="<?php echo (($_SESSION['tmp_user_values']['max_rows'] != 'all') ? $_SESSION['tmp_user_values']['max_rows'] : $GLOBALS['cfg']['MaxRows']); ?>" /><br />
|
||||
<input type="submit" name="submit" class="Go" value="<?php echo __('Go'); ?>" />
|
||||
<input type="hidden" name="sql_query" value="<?php echo htmlspecialchars($sql_query); ?>" />
|
||||
</div>
|
||||
<p style="clear:both;"> </p>
|
||||
<div id="resizer" style="width:600px; height:400px;">
|
||||
<div id="querychart">
|
||||
<?php
|
||||
$sanitized_data = array();
|
||||
foreach ($data as $data_row_number => $data_row) {
|
||||
$tmp_row = array();
|
||||
foreach ($data_row as $data_column => $data_value) {
|
||||
$tmp_row[htmlspecialchars($data_column)] = htmlspecialchars($data_value);
|
||||
}
|
||||
$sanitized_data[] = $tmp_row;
|
||||
}
|
||||
echo json_encode($sanitized_data);
|
||||
unset($sanitized_data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user