The branch, master has been updated via aa83986a29c065e92dd8943a9e87f886faa17dbb (commit) via 0047da1b67c5b605c6c9c9f5cd2882206a9848c5 (commit) via 6616a6b34c51d11013dc4956507af85de055f50d (commit) via aa7704b067f390a8a5efd281ba4f12447bb5d3e6 (commit) via 4ee08ac03d5cb054b462ee080bc81790bd5e2f77 (commit) via 91458b66fd499b0a093f51bda0d491efd3d254c8 (commit) via d29b16b52eb9d408801cd4f31095a2204d4cfe7b (commit) via 5c44a402489d2356b997b858927af6d093a2e430 (commit) from 1f226191cdb22130fd03dfa2c61118362acd2038 (commit)
- Log ----------------------------------------------------------------- commit aa83986a29c065e92dd8943a9e87f886faa17dbb Merge: 0047da1b67c5b605c6c9c9f5cd2882206a9848c5 aa7704b067f390a8a5efd281ba4f12447bb5d3e6 Author: Michal Čihař mcihar@suse.cz Date: Mon Jun 20 11:50:06 2011 +0200
Merge remote-tracking branch 'tyron/master'
commit 0047da1b67c5b605c6c9c9f5cd2882206a9848c5 Merge: 1f226191cdb22130fd03dfa2c61118362acd2038 6616a6b34c51d11013dc4956507af85de055f50d Author: Michal Čihař mcihar@suse.cz Date: Mon Jun 20 11:44:51 2011 +0200
Merge remote-tracking branch 'origin/QA_3_4'
commit aa7704b067f390a8a5efd281ba4f12447bb5d3e6 Author: Tyron Madlener tyronx@gmail.com Date: Sun Jun 19 20:43:02 2011 +0200
global vars: mysql wants numeric datatype for numeric values
commit 4ee08ac03d5cb054b462ee080bc81790bd5e2f77 Author: Tyron Madlener tyronx@gmail.com Date: Sun Jun 19 12:28:18 2011 +0200
no ajax variable escaping
commit 91458b66fd499b0a093f51bda0d491efd3d254c8 Author: Tyron Madlener tyronx@gmail.com Date: Fri Jun 17 21:36:04 2011 +0200
Hopefull fixes server variable editing
commit d29b16b52eb9d408801cd4f31095a2204d4cfe7b Author: Tyron Madlener tyronx@gmail.com Date: Fri Jun 17 19:12:05 2011 +0200
Set variables in quotes
commit 5c44a402489d2356b997b858927af6d093a2e430 Author: Tyron Madlener tyronx@gmail.com Date: Fri Jun 17 19:04:00 2011 +0200
Bugfixes, Adjustments and Server variable editing
-----------------------------------------------------------------------
Summary of changes: js/functions.js | 4 +- js/server_status.js | 2 +- js/server_variables.js | 76 +++++++++++++++++++++- server_status.php | 4 +- server_variables.php | 109 +++++++++++++++++++----------- themes/original/css/theme_right.css.php | 33 +++++++++ themes/pmahomme/css/theme_right.css.php | 22 ++++++- 7 files changed, 202 insertions(+), 48 deletions(-)
diff --git a/js/functions.js b/js/functions.js index 3d69b3a..6657ac9 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1480,10 +1480,10 @@ function PMA_createChart(passedSettings) { passedSettings.realtime.refreshRate = 5000;
if(!passedSettings.realtime.numMaxPoints) - passedSettings.realtime.numMaxPoints = 32; + passedSettings.realtime.numMaxPoints = 30;
settings.xAxis.min = new Date().getTime() - passedSettings.realtime.numMaxPoints * passedSettings.realtime.refreshRate; - settings.xAxis.max = new Date().getTime() + passedSettings.realtime.refreshRate / 2; + settings.xAxis.max = new Date().getTime() + passedSettings.realtime.refreshRate / 4; }
// Overwrite/Merge default settings with passedsettings diff --git a/js/server_status.js b/js/server_status.js index 08b2b43..87c2fa9 100644 --- a/js/server_status.js +++ b/js/server_status.js @@ -85,7 +85,7 @@ $(function() {
chart.xAxis[0].setExtremes( new Date().getTime() - chart.options.realtime.numMaxPoints * chart.options.realtime.refreshRate, - chart.xAxis[0].getExtremes().max, + new Date().getTime() + chart.options.realtime.refreshRate / 4, true );
diff --git a/js/server_variables.js b/js/server_variables.js index 11be3de..a2c0788 100644 --- a/js/server_variables.js +++ b/js/server_variables.js @@ -1,11 +1,83 @@ -$(function() { +function editVariable(link) { + var varName = $(link).parent().parent().find('th:first').first().text().replace(/ /g,'_'); + var mySaveLink = $(saveLink); + var myCancelLink = $(cancelLink); + var $cell = $(link).parent(); + + $cell.addClass('edit'); + // remove edit link + $cell.find('a.editLink').remove(); + + mySaveLink.click(function() { + $.get('server_variables.php?' + url_query, + { ajax_request: true, type: 'setval', varName: varName, varValue: $cell.find('input').attr('value') }, + function(data) { + if(data.success) $cell.html(data.variable); + else { + PMA_ajaxShowMessage(data.error); + $cell.html($cell.find('span.oldContent').html()); + } + $cell.removeClass('edit'); + }, + 'json' + ); + return false; + }); + + myCancelLink.click(function() { + $cell.html($cell.find('span.oldContent').html()); + $cell.removeClass('edit'); + return false; + }); + + + $.get('server_variables.php?' + url_query, + { ajax_request: true, type: 'getval', varName: varName }, + function(data) { + // hide original content + $cell.html('<span class="oldContent" style="display:none;">' + $cell.html() + '</span>'); + // put edit field and save/cancel link + $cell.prepend('<table class="serverVariableEditTable" border="0"><tr><td></td><td style="width:100%;"><input type="text" value="' + data + '"/></td></tr</table>'); + $cell.find('table td:first').append(mySaveLink); + $cell.find('table td:first').append(myCancelLink); + } + ); + + return false; +} + +$(function() { var textFilter=null; var odd_row=false; var testString = 'abcdefghijklmnopqrstuvwxyz0123456789,ABCEFGHIJKLMOPQRSTUVWXYZ'; var $tmpDiv; var charWidth; + + // Global vars + editLink = '<a href="#" class="editLink" onclick="return editVariable(this);"><img src="'+pma_theme_image+'b_edit.png" alt="" width="16" height="16"> '+PMA_messages['strEdit']+'</a>'; + saveLink = '<a href="#" class="saveLink"><img src="'+pma_theme_image+'b_save.png" alt="" width="16" height="16"> '+PMA_messages['strSave']+'</a> '; + cancelLink = '<a href="#" class="cancelLink"><img src="'+pma_theme_image+'b_close.png" alt="" width="16" height="16"> '+PMA_messages['strCancel']+'</a> '; +
- /*** This code snippet takes care that the table stays readable. It cuts off long strings when the window is resized ***/ + $.ajaxSetup({ + cache:false + }); + + /* Variable editing */ + if(isSuperuser) { + $('table.data tbody tr td:nth-child(2)').hover( + function() { + // Only add edit element if it is the global value, not session value and not when the element is being edited + if($(this).parent().children('th').length > 0 && ! $(this).hasClass('edit')) + $(this).prepend(editLink); + }, + function() { + $(this).find('a.editLink').remove(); + } + ); + } + + /*** This code snippet takes care that the table stays readable. It cuts off long strings the table overlaps the window size ***/ $('table.data').after($tmpDiv=$('<span>'+testString+'</span>')); charWidth = $tmpDiv.width() / testString.length; $tmpDiv.remove(); diff --git a/server_status.php b/server_status.php index fd3eb08..b47fda4 100644 --- a/server_status.php +++ b/server_status.php @@ -380,7 +380,7 @@ require './libraries/server_links.inc.php'; ?> <script type="text/javascript"> pma_token = '<?php echo $_SESSION[' PMA_token ']; ?>'; -url_query = '<?php echo $url_query;?>'; +url_query = '<?php echo str_replace('&','&',$url_query);?>'; pma_theme_image = '<?php echo $GLOBALS['pmaThemeImage']; ?>'; </script> <div id="serverstatus"> @@ -603,7 +603,7 @@ function printQueryStatistics() {
function printServerTraffic() { global $server_status,$PMA_PHP_SELF; - global $server_master_status, $server_slave_status; + global $server_master_status, $server_slave_status, $replication_types;
$hour_factor = 3600 / $server_status['Uptime'];
diff --git a/server_variables.php b/server_variables.php index e538c91..d269852 100644 --- a/server_variables.php +++ b/server_variables.php @@ -21,17 +21,53 @@ $GLOBALS['js_include'][] = 'server_variables.js'; */ require './libraries/server_common.inc.php';
+/** + * Required to display documentation links + */ +require './libraries/server_variables_doc.php';
/** - * Displays the links + * Ajax request */ -require './libraries/server_links.inc.php';
+if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { + // Send with correct charset + header('Content-Type: text/html; charset=UTF-8'); + + if(isset($_REQUEST['type'])) { + switch($_REQUEST['type']) { + case 'getval': + $varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="'.$_REQUEST['varName'].'";','NUM'); + exit($varValue[1]); + break; + case 'setval': + $value = $_REQUEST['varValue']; + if(!is_numeric($value)) $value="'".$value."'"; + + if(PMA_DBI_query('SET GLOBAL '.$_REQUEST['varName'].' = '.$value)) + // Some values are rounded down etc. + $varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="'.$_REQUEST['varName'].'";','NUM'); + + exit(json_encode(array( + 'success' => true, + 'variable' => formatVariable($_REQUEST['varName'],$varValue[1]) + )) + ); + exit(json_encode(array( + 'success' => false, + 'error' => __('Setting variable failed') + )) + ); + break; + } + } +}
/** - * Required to display documentation links + * Displays the links */ -require './libraries/server_variables_doc.php'; +require './libraries/server_links.inc.php'; +
/** * Displays the sub-page heading @@ -42,18 +78,24 @@ echo '<h2>' . "\n" . PMA_showMySQLDocu('server_system_variables','server_system_variables') . '</h2>' . "\n";
- /** * Sends the queries and buffers the results */ -$serverVars = PMA_DBI_fetch_result('SHOW SESSION VARIABLES;', 0, 1); -$serverVarsGlobal = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES;', 0, 1); +$serverVarsSession = PMA_DBI_fetch_result('SHOW SESSION VARIABLES;', 0, 1); +$serverVars = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES;', 0, 1);
/** * Displays the page */ ?> +<script type="text/javascript"> +pma_token = '<?php echo $_SESSION[' PMA_token ']; ?>'; +url_query = '<?php echo str_replace('&','&',$url_query);?>'; +pma_theme_image = '<?php echo $GLOBALS['pmaThemeImage']; ?>'; +isSuperuser = <?php echo PMA_isSuperuser()?'true':'false'; ?>; +</script> + <fieldset id="tableFilter" style="display:none;"> <legend>Filters</legend> <div class="formelement"> @@ -61,10 +103,10 @@ $serverVarsGlobal = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES;', 0, 1); <input name="filterText" type="text" id="filterText" style="vertical-align: baseline;" /> </div> </fieldset> -<table class="data filteredData"> +<table id="serverVariables" class="data filteredData"> <thead> <tr><th><?php echo __('Variable'); ?></th> - <th> + <th class="valueHeader"> <?php echo __('Session value') . ' / ' . __('Global value'); ?> @@ -77,44 +119,20 @@ echo __('Session value') . ' / ' . __('Global value'); $odd_row = true; foreach ($serverVars as $name => $value) { ?> -<tr class="noclick <?php - echo $odd_row ? 'odd' : 'even'; - if ($serverVarsGlobal[$name] !== $value) { - echo ' marked'; - } - ?>"> - <th nowrap="nowrap"> - <?php echo htmlspecialchars(str_replace('_', ' ', $name)); ?></th> - <td class="value"><?php - if (is_numeric($value)) { - if(isset($VARIABLE_DOC_LINKS[$name][3]) && $VARIABLE_DOC_LINKS[$name][3]=='byte') - echo '<abbr title="'.PMA_formatNumber($value, 0).'">'.implode(' ',PMA_formatByteDown($value,3,3)).'</abbr>'; - else echo PMA_formatNumber($value, 0); - $is_numeric = true; - } else { - echo htmlspecialchars($value); - $is_numeric = false; - } - ?></td> +<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>"> + <th nowrap="nowrap"><?php echo htmlspecialchars(str_replace('_', ' ', $name)); ?></th> + <td class="value"><?php echo formatVariable($name,$value); ?></td> <td class="value"><?php if (isset($VARIABLE_DOC_LINKS[$name])) // To display variable documentation link echo PMA_showMySQLDocu($VARIABLE_DOC_LINKS[$name][1], $VARIABLE_DOC_LINKS[$name][1], false, $VARIABLE_DOC_LINKS[$name][2] . '_' . $VARIABLE_DOC_LINKS[$name][0]); ?></td> <?php - if ($serverVarsGlobal[$name] !== $value) { + if (isset($serverVarsSession[$name]) && $serverVarsSession[$name] != $value) { ?> </tr> -<tr class="noclick <?php - echo $odd_row ? 'odd' : 'even'; - ?> marked"> - <td>(<?php echo __('Global value'); ?>)</td> - <td class="value"><?php - if ($is_numeric) { - echo PMA_formatNumber($serverVarsGlobal[$name], 0); - } else { - echo htmlspecialchars($serverVarsGlobal[$name]); - } - ?></td> +<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?> "> + <td>(<?php echo __('Session value'); ?>)</td> + <td class="value"><?php echo formatVariable($name,$serverVarsSession[$name]); ?></td> <td class="value"></td> <?php } ?> </tr> @@ -132,4 +150,15 @@ foreach ($serverVars as $name => $value) { */ require './libraries/footer.inc.php';
+function formatVariable($name,$value) { + global $VARIABLE_DOC_LINKS; + + if (is_numeric($value)) { + if(isset($VARIABLE_DOC_LINKS[$name][3]) && $VARIABLE_DOC_LINKS[$name][3]=='byte') + return '<abbr title="'.PMA_formatNumber($value, 0).'">'.implode(' ',PMA_formatByteDown($value,3,3)).'</abbr>'; + else return PMA_formatNumber($value, 0); + } + return htmlspecialchars($value); +} + ?> diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php index 8f03feb..960f63f 100644 --- a/themes/original/css/theme_right.css.php +++ b/themes/original/css/theme_right.css.php @@ -1056,6 +1056,39 @@ div.liveChart {
/* end serverstatus */
+/* server variables */ + +a.editLink { + float: <?php echo $left; ?>; + font-family:sans-serif; +} + +table.serverVariableEditTable { + border:0; + margin:0; + padding:0; + width:100%; +} +table.serverVariableEditTable td { + border:0; + margin:0; + padding:0; +} +table.serverVariableEditTable td:first-child { + white-space:nowrap; + vertical-align:middle; +} + +table.serverVariableEditTable input { + width:95%; +} + +table#serverVariables td { + height:18px; +} + +/* end server variables */ + /* querywindow */ body#bodyquerywindow { margin: 0; diff --git a/themes/pmahomme/css/theme_right.css.php b/themes/pmahomme/css/theme_right.css.php index e55caad..fcaba3d 100644 --- a/themes/pmahomme/css/theme_right.css.php +++ b/themes/pmahomme/css/theme_right.css.php @@ -1247,11 +1247,31 @@ div.liveChart {
/* server variables */
-a.editIcon { +a.editLink { float: <?php echo $left; ?>; font-family:sans-serif; }
+table.serverVariableEditTable { + border:0; + margin:0; + padding:0; + width:100%; +} +table.serverVariableEditTable td { + border:0; + margin:0; + padding:0; +} +table.serverVariableEditTable td:first-child { + white-space:nowrap; + vertical-align:middle; +} + +table.serverVariableEditTable input { + width:95%; +} + table#serverVariables td { height:18px; }
hooks/post-receive