Merge branch 'integration'

This commit is contained in:
Michal Čihař 2011-07-19 14:24:45 +02:00
commit b011de5bdb
25 changed files with 3269 additions and 863 deletions

View File

@ -7,17 +7,17 @@
*/
define('PMA_MINIMUM_COMMON',true);
define('PMA_MINIMUM_COMMON', true);
require_once './libraries/common.inc.php';
if(isset($_REQUEST['filename']) && isset($_REQUEST['image'])) {
$allowed = Array( 'image/png'=>'png', 'image/svg+xml'=>'svg');
if(!isset($allowed[$_REQUEST['type']])) exit('Invalid export type');
if(! isset($allowed[$_REQUEST['type']])) exit('Invalid export type');
if(!preg_match("/(".implode("|",$allowed).")$/i",$_REQUEST['filename']))
$_REQUEST['filename'].='.'.$allowed[$_REQUEST['type']];
if(! preg_match("/(".implode("|",$allowed).")$/i", $_REQUEST['filename']))
$_REQUEST['filename'] .= '.' . $allowed[$_REQUEST['type']];
header("Cache-Control: public");
header("Content-Description: File Transfer");
@ -25,8 +25,8 @@ if(isset($_REQUEST['filename']) && isset($_REQUEST['image'])) {
header("Content-Type: ".$_REQUEST['type']);
header("Content-Transfer-Encoding: binary");
if($allowed[$_REQUEST['type']]!='svg')
echo base64_decode(substr($_REQUEST['image'],strpos($_REQUEST['image'],',')+1));
if($allowed[$_REQUEST['type']] != 'svg')
echo base64_decode(substr($_REQUEST['image'], strpos($_REQUEST['image'],',') + 1));
else
echo $_REQUEST['image'];

View File

@ -723,13 +723,13 @@ var last_shift_clicked_row = -1;
* Row highlighting in horizontal mode (use "live"
* so that it works also for pages reached via AJAX)
*/
$(document).ready(function() {
/*$(document).ready(function() {
$('tr.odd, tr.even').live('hover',function(event) {
var $tr = $(this);
$tr.toggleClass('hover',event.type=='mouseover');
$tr.children().toggleClass('hover',event.type=='mouseover');
});
})
})*/
/**
* This array is used to remember mark status of rows in browse mode
@ -1461,20 +1461,26 @@ function PMA_createChart(passedSettings) {
chart: {
type: 'spline',
marginRight: 10,
backgroundColor: 'transparent',
events: {
/* Live charting support */
load: function() {
var thisChart = this;
var lastValue = null, curValue = null;
var numLoadedPoints = 0, otherSum = 0;
var diff;
// No realtime updates for graphs that are being exported, and disabled when no callback is set
// No realtime updates for graphs that are being exported, and disabled when realtime is not set
// Also don't do live charting if we don't have the server time
if(thisChart.options.chart.forExport == true ||
! passedSettings.realtime ||
! passedSettings.realtime.callback) return;
! thisChart.options.realtime ||
! thisChart.options.realtime.callback ||
! server_time_diff) return;
thisChart.options.realtime.timeoutCallBack = function() {
$.post(passedSettings.realtime.url,
{ ajax_request: true, chart_data: 1, type: passedSettings.realtime.type },
thisChart.options.realtime.postRequest = $.post(
thisChart.options.realtime.url,
thisChart.options.realtime.postData,
function(data) {
curValue = jQuery.parseJSON(data);
@ -1487,13 +1493,13 @@ function PMA_createChart(passedSettings) {
false
);
passedSettings.realtime.callback(thisChart,curValue,lastValue,numLoadedPoints);
thisChart.options.realtime.callback(thisChart,curValue,lastValue,numLoadedPoints);
lastValue = curValue;
numLoadedPoints++;
// Timeout has been cleared => don't start a new timeout
if(chart_activeTimeouts[container]==null) return;
if(chart_activeTimeouts[container] == null) return;
chart_activeTimeouts[container] = setTimeout(
thisChart.options.realtime.timeoutCallBack,
@ -1502,7 +1508,7 @@ function PMA_createChart(passedSettings) {
});
}
chart_activeTimeouts[container] = setTimeout(thisChart.options.realtime.timeoutCallBack, 0);
chart_activeTimeouts[container] = setTimeout(thisChart.options.realtime.timeoutCallBack, 5);
}
}
},
@ -1544,15 +1550,20 @@ function PMA_createChart(passedSettings) {
}
/* Set/Get realtime chart default values */
if(passedSettings.realtime) {
if(passedSettings.realtime) {
if(!passedSettings.realtime.refreshRate)
passedSettings.realtime.refreshRate = 5000;
if(!passedSettings.realtime.numMaxPoints)
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 / 4;
// Allow custom POST vars to be added
passedSettings.realtime.postData = $.extend(false,{ ajax_request: true, chart_data: 1, type: passedSettings.realtime.type },passedSettings.realtime.postData);
if(server_time_diff) {
settings.xAxis.min = new Date().getTime() - server_time_diff - passedSettings.realtime.numMaxPoints * passedSettings.realtime.refreshRate;
settings.xAxis.max = new Date().getTime() - server_time_diff + passedSettings.realtime.refreshRate;
}
}
// Overwrite/Merge default settings with passedsettings
@ -2564,10 +2575,10 @@ $(document).ready(function() {
$('.vpointer').live('hover',
//handlerInOut
function(e) {
var $this_td = $(this);
var row_num = PMA_getRowNumber($this_td.attr('class'));
// for all td of the same vertical row, toggle hover
$('.vpointer').filter('.row_' + row_num).toggleClass('hover');
var $this_td = $(this);
var row_num = PMA_getRowNumber($this_td.attr('class'));
// for all td of the same vertical row, toggle hover
$('.vpointer').filter('.row_' + row_num).toggleClass('hover');
}
);
}) // end of $(document).ready() for vertical pointer
@ -2577,11 +2588,35 @@ $(document).ready(function() {
* Vertical marker
*/
$('.vmarker').live('click', function(e) {
// do not trigger when clicked on anchor
if ($(e.target).is('a, img, a *')) {
return;
}
var $this_td = $(this);
var row_num = PMA_getRowNumber($this_td.attr('class'));
// for all td of the same vertical row, toggle the marked class
$('.vmarker').filter('.row_' + row_num).toggleClass('marked');
});
// XXX: FF fires two click events for <label> (label and checkbox), so we need to handle this differently
var $tr = $(this);
var $checkbox = $('.vmarker').filter('.row_' + row_num + ':first').find(':checkbox');
if ($checkbox.length) {
// checkbox in a row, add or remove class depending on checkbox state
var checked = $checkbox.attr('checked');
if (!$(e.target).is(':checkbox, label')) {
checked = !checked;
$checkbox.attr('checked', checked);
}
// for all td of the same vertical row, toggle the marked class
if (checked) {
$('.vmarker').filter('.row_' + row_num).addClass('marked');
} else {
$('.vmarker').filter('.row_' + row_num).removeClass('marked');
}
} else {
// normaln data table, just toggle class
$('.vmarker').filter('.row_' + row_num).toggleClass('marked');
}
});
/**
* Reveal visual builder anchor

View File

@ -46,7 +46,7 @@ var HC = Highcharts,
downloadPDF: 'Download PDF document',
downloadSVG: 'Download SVG vector image',
exportButtonTitle: 'Export to raster or vector image',
printButtonTitle: 'Print the chart'
printButton: 'Print the chart'
}
});
@ -106,7 +106,7 @@ defaultOptions.exporting = {
type: 'image/png',
url: 'chart_export.php',
width: 800,
buttons: {
buttons: {
exportButton: {
//enabled: true,
symbol: 'exportIcon',
@ -114,54 +114,26 @@ defaultOptions.exporting = {
symbolFill: '#A8BF77',
hoverSymbolFill: '#768F3E',
_titleKey: 'exportButtonTitle',
menuName: 'export',
menuItems: [{
textKey: 'downloadPNG',
onclick: function() {
this.exportChart();
}
},/* {
textKey: 'downloadJPEG',
onclick: function() {
this.exportChart({
type: 'image/jpeg'
});
}
}, {
textKey: 'downloadPDF',
onclick: function() {
this.exportChart({
type: 'application/pdf'
});
}
}, */{
},{
textKey: 'downloadSVG',
onclick: function() {
this.exportChart({
type: 'image/svg+xml'
});
}
}/*, {
text: 'View SVG',
},{
textKey: 'printButton',
onclick: function() {
var svg = this.getSVG()
.replace(/</g, '\n&lt;')
.replace(/>/g, '&gt;');
doc.body.innerHTML = '<pre>'+ svg +'</pre>';
}
}*/]
this.print();
}
}]
},
printButton: {
//enabled: true,
symbol: 'printIcon',
x: -36,
symbolFill: '#B5C9DF',
hoverSymbolFill: '#779ABF',
_titleKey: 'printButtonTitle',
onclick: function() {
this.print();
}
}
}
};
@ -522,8 +494,8 @@ extend(Chart.prototype, {
btnOptions = merge(chart.options.navigation.buttonOptions, options),
onclick = btnOptions.onclick,
menuItems = btnOptions.menuItems,
/*position = chart.getAlignment(btnOptions),
buttonLeft = position.x,
//position = chart.getAlignment(btnOptions),
/*buttonLeft = position.x,
buttonTop = position.y,*/
buttonWidth = btnOptions.width,
buttonHeight = btnOptions.height,
@ -543,7 +515,7 @@ extend(Chart.prototype, {
if (btnOptions.enabled === false) {
return;
}
// element to capture the click
function revert() {
symbol.attr(symbolAttr);
@ -603,7 +575,7 @@ extend(Chart.prototype, {
onclick = function(e) {
revert();
var bBox = button.getBBox();
chart.contextMenu('export-menu', menuItems, bBox.x, bBox.y, buttonWidth, buttonHeight);
chart.contextMenu(btnOptions.menuName, menuItems, bBox.x, bBox.y, buttonWidth, buttonHeight);
};
}
/*addEvent(button.element, 'click', function() {
@ -612,7 +584,7 @@ extend(Chart.prototype, {
button.on('click', function() {
onclick.apply(chart, arguments);
});
// the icon
symbol = renderer.symbol(
btnOptions.symbol,
@ -653,33 +625,6 @@ HC.Renderer.prototype.symbols.exportIcon = function(x, y, radius) {
'Z'
];
};
// Create the print icon
HC.Renderer.prototype.symbols.printIcon = function(x, y, radius) {
return [
M, // the printer
x - radius, y + radius * 0.5,
L,
x + radius, y + radius * 0.5,
x + radius, y - radius / 3,
x - radius, y - radius / 3,
'Z',
M, // the upper sheet
x - radius * 0.5, y - radius / 3,
L,
x - radius * 0.5, y - radius,
x + radius * 0.5, y - radius,
x + radius * 0.5, y - radius / 3,
'Z',
M, // the lower sheet
x - radius * 0.5, y + radius * 0.5,
L,
x - radius * 0.75, y + radius,
x + radius * 0.75, y + radius,
x + radius * 0.5, y + radius * 0.5,
'Z'
];
};
// Add the buttons on chart load
Chart.prototype.callbacks.push(function(chart) {
@ -692,6 +637,10 @@ Chart.prototype.callbacks.push(function(chart) {
for (n in buttons) {
chart.addButton(buttons[n]);
}
for (n in chart.options.buttons) {
chart.addButton(chart.options.buttons[n]);
}
}
});

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,262 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @fileoverview A jquery plugin that allows drag&drop sorting in tables.
* Coded because JQuery UI sortable doesn't support tables. Also it has no animation
*
* @name Sortable Table JQuery plugin
*
* @requires jQuery
*
*/
/* Options:
$('table').sortableTable({
ignoreRect: { top, left, width, height } - relative coordinates on each element. If the user clicks
in this area, it is not seen as a drag&drop request. Useful for toolbars etc.
events: {
start: callback function when the user starts dragging
drop: callback function after an element has been dropped
}
})
*/
/* Commands:
$('table').sortableTable('init') - equivalent to $('table').sortableTable()
$('table').sortableTable('refresh') - if the table has been changed, refresh correctly assigns all events again
$('table').sortableTable('destroy') - removes all events from the table
*/
(function($) {
jQuery.fn.sortableTable = function(method) {
var methods = {
init : function(options) {
var tb = new sortableTableInstance(this, options);
tb.init();
$(this).data('sortableTable',tb);
},
refresh : function( ) {
$(this).data('sortableTable').refresh();
},
destroy : function( ) {
$(this).data('sortableTable').destroy();
},
};
if ( methods[method] ) {
return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
} else if ( typeof method === 'object' || ! method ) {
return methods.init.apply( this, arguments );
} else {
$.error( 'Method ' + method + ' does not exist on jQuery.sortableTable' );
}
function sortableTableInstance(table, options) {
var down = false;
var $draggedEl, oldCell, previewMove, id;
if(!options) options = {};
/* Mouse handlers on the child elements */
var onMouseUp = function(e) {
dropAt(e.pageX, e.pageY);
}
var onMouseDown = function(e) {
$draggedEl = $(this).children();
if($draggedEl.length == 0) return;
if(options.ignoreRect && insideRect({x: e.pageX - $draggedEl.offset().left, y: e.pageY - $draggedEl.offset().top}, options.ignoreRect)) return;
down = true;
oldCell = this;
//move(e.pageX,e.pageY);
if(options.events && options.events.start)
options.events.start(this);
return false;
}
var globalMouseMove = function(e) {
if(down) {
move(e.pageX,e.pageY);
if(inside($(oldCell), e.pageX, e.pageY)) {
if(previewMove != null) {
moveTo(previewMove);
previewMove = null;
}
} else
$(table).find('td').each(function() {
if(inside($(this), e.pageX, e.pageY)) {
if($(previewMove).attr('class') != $(this).children().first().attr('class')) {
if(previewMove != null) moveTo(previewMove);
previewMove = $(this).children().first();
if(previewMove.length > 0)
moveTo($(previewMove), { pos: {
top: $(oldCell).offset().top - $(previewMove).parent().offset().top,
left: $(oldCell).offset().left - $(previewMove).parent().offset().left
} });
}
return false;
}
});
}
return false;
}
var globalMouseOut = function() {
if(down) {
down = false;
if(previewMove) moveTo(previewMove);
moveTo($draggedEl);
previewMove = null;
}
}
// Initialize sortable table
this.init = function() {
id = 1;
// Add some required css to each child element in the <td>s
$(table).find('td').children().each(function() {
// Remove any old occurences of our added draggable-num class
$(this).attr('class',$(this).attr('class').replace(/\s*draggable\-\d+/g,''));
$(this).addClass('draggable-' + (id++));
});
// Mouse events
$(table).find('td').bind('mouseup',onMouseUp);
$(table).find('td').bind('mousedown',onMouseDown);
$(document).mousemove(globalMouseMove);
$(document).bind('mouseleave', globalMouseOut);
}
// Call this when the table has been updated
this.refresh = function() {
this.destroy();
this.init();
}
this.destroy = function() {
// Add some required css to each child element in the <td>s
$(table).find('td').children().each(function() {
// Remove any old occurences of our added draggable-num class
$(this).attr('class',$(this).attr('class').replace(/\s*draggable\-\d+/g,''));
});
// Mouse events
$(table).find('td').unbind('mouseup',onMouseUp)
$(table).find('td').unbind('mousedown',onMouseDown);
$(document).unbind('mousemove',globalMouseMove);
$(document).unbind('mouseleave',globalMouseOut);
}
function switchElement(drag, dropTo) {
var dragPosDiff = {
left: $(drag).children().first().offset().left - $(dropTo).offset().left,
top: $(drag).children().first().offset().top - $(dropTo).offset().top
};
var dropPosDiff = null;
if($(dropTo).children().length > 0) {
dropPosDiff = {
left: $(dropTo).children().first().offset().left - $(drag).offset().left,
top: $(dropTo).children().first().offset().top - $(drag).offset().top
};
}
/* I love you append(). It moves the DOM Elements so gracefully <3 */
// Put the element in the way to old place
$(drag).append($(dropTo).children().first()).children()
.stop(true,true)
.bind('mouseup',onMouseUp);
if(dropPosDiff)
$(drag).append($(dropTo).children().first()).children()
.css('left',dropPosDiff.left + 'px')
.css('top',dropPosDiff.top + 'px');
// Put our dragged element into the space we just freed up
$(dropTo).append($(drag).children().first()).children()
.bind('mouseup',onMouseUp)
.css('left',dragPosDiff.left + 'px')
.css('top',dragPosDiff.top + 'px');
moveTo($(dropTo).children().first(), { duration: 100 });
moveTo($(drag).children().first(), { duration: 100 });
if(options.events && options.events.drop) {
// Drop event. The drag child element is moved into the drop element
// and vice versa. So the parameters are switched.
// Calculate row and column index
colIdx = $(dropTo).prevAll().length;
rowIdx = $(dropTo).parent().prevAll().length;
options.events.drop(drag,dropTo, { col: colIdx, row: rowIdx });
}
}
function move(x,y) {
$draggedEl.offset({
top: Math.min($(document).height(), Math.max(0, y - $draggedEl.height()/2)),
left: Math.min($(document).width(), Math.max(0, x - $draggedEl.width()/2))
});
}
function inside($el, x,y) {
var off = $el.offset();
return y >= off.top && x >= off.left && x < off.left + $el.width() && y < off.top + $el.height();
}
function insideRect(pos, r) {
return pos.y > r.top && pos.x > r.left && pos.y < r.top + r.height && pos.x < r.left + r.width;
}
function dropAt(x,y) {
if(!down) return;
down = false;
var switched = false;
$(table).find('td').each(function() {
if($(this).children().first().attr('class') != $(oldCell).children().first().attr('class') && inside($(this), x, y)) {
switchElement(oldCell, this);
switched = true;
return;
}
});
if(!switched) {
if(previewMove) moveTo(previewMove);
moveTo($draggedEl);
}
previewMove = null;
}
function moveTo(elem, opts) {
if(!opts) opts = {};
if(!opts.pos) opts.pos = { left: 0, top: 0 };
if(!opts.duration) opts.duration = 200;
$(elem).css('position','relative');
$(elem).animate({ top: opts.pos.top, left: opts.pos.left }, {
duration: opts.duration,
complete: function() {
if(opts.pos.left == 0 && opts.pos.top == 0) {
$(elem)
.css('position','')
.css('left','')
.css('top','');
}
}
});
}
}
}
})( jQuery );

View File

@ -81,11 +81,73 @@ $js_messages['strChartServerTraffic'] = __('Server traffic (in KiB)');
$js_messages['strChartConnections'] = __('Connections since last refresh');
$js_messages['strChartProcesses'] = __('Processes');
$js_messages['strChartConnectionsTitle'] = __('Connections / Processes');
$js_messages['strChartIssuedQueries'] = __('Issued queries since last refresh');
$js_messages['strChartIssuedQueriesTitle'] = __('Issued queries');
/* l10n: Questions is the name of a MySQL Status variable */
$js_messages['strChartIssuedQueries'] = __('Questions since last refresh');
/* l10n: Questions is the name of a MySQL Status variable */
$js_messages['strChartIssuedQueriesTitle'] = __('Questions (executed statements by the server)');
$js_messages['strChartQueryPie'] = __('Query statistics');
/* server status monitor */
$js_messages['strSystemCPUUsage'] = __('System CPU Usage');
$js_messages['strSystemMemory'] = __('System memory');
$js_messages['strSystemSwap'] = __('System swap');
$js_messages['strMiB'] = __('MiB');
$js_messages['strKiB'] = __('KiB');
$js_messages['strAverageLoad'] = __('Average load');
/* l10n: Questions is the name of a MySQL Status variable */
$js_messages['strQuestions'] = __('Questions');
$js_messages['strTraffic'] = __('Traffic');
$js_messages['strSettings'] = __('Settings');
$js_messages['strRemoveChart'] = __('Remove chart');
$js_messages['strEditChart'] = __('Edit labels and series');
$js_messages['strAddChart'] = __('Add chart to grid');
$js_messages['strClose'] = __('Close');
$js_messages['strAddOneSeriesWarning'] = __('Please add at least one variable to the series');
$js_messages['strNone'] = __('None');
$js_messages['strResumeMonitor'] = __('Resume monitor');
$js_messages['strPauseMonitor'] = __('Pause monitor');
/* Monitor: Instructions Dialog */
$js_messages['strBothLogOn'] = __('general_log and slow_query_log is enabled.');
$js_messages['strGenLogOn'] = __('general_log is enabled.');
$js_messages['strSlowLogOn'] = __('slow_query_log is enabled.');
$js_messages['strBothLogOff'] = __('slow_query_log and general_log is disabled.');
$js_messages['strLogOutNotTable'] = __('log_output is not set to TABLE.');
$js_messages['strLogOutIsTable'] = __('log_output is set to TABLE.');
$js_messages['strSmallerLongQueryTimeAdvice'] = __('slow_query_log is enabled, but the server logs only queries that take longer than %d seconds. It is advisable to set this long_query_time 0-2 seconds, depending on your system.');
$js_messages['strLongQueryTimeSet'] = __('long_query_time is set to %d second(s).');
$js_messages['strSettingsAppliedGlobal'] = __('Following settings will be applied globally and reset to default on server restart:');
/* l10n: %s is FILE or TABLE */
$js_messages['strSetLogOutput'] = __('Set log_output to %s');
/* l10n: Enable in this context means setting a status variable to ON */
$js_messages['strEnableVar'] = __('Enable %s');
/* l10n: Disable in this context means setting a status variable to OFF */
$js_messages['strDisableVar'] = __('Disable %s');
/* l10n: %d seconds */
$js_messages['setSetLongQueryTime'] = __('Set long_query_time to %ds');
$js_messages['strNoSuperUser'] = __('You don\'t have super user rights to change this variables. Please log in as root account or contact your database administrator.');
$js_messages['strChangeSettings'] = __('Change settings');
$js_messages['strCurrentSettings'] = __('Current settings');
$js_messages['strChartTitle'] = __('Chart Title');
/* l10n: As in differential values */
$js_messages['strDifferential'] = __('Differential');
$js_messages['strDividedBy'] = __('Divided by %s:');
$js_messages['strSelectedTimeRange'] = __('Selected time range:');
$js_messages['strGroupInserts'] = __('Group together INSERTs into same table');
$js_messages['strLogAnalyseInfo'] = __('<p>Choose from which log you want the statistics to be generated from.</p> Results are grouped by query text.');
$js_messages['strFromSlowLog'] = __('From slow log');
$js_messages['strFromGeneralLog'] = __('From general log');
$js_messages['strAnalysingLogs'] = __('Analysing & loading logs. This may take a while.');
$js_messages['strCountColumnExplanation'] = __('This columns shows the amount of identical queries that are grouped together. However only the SQL Text is being compared, thus the queries other attributes such as start time may differ.');
$js_messages['strMoreCountColumnExplanation'] = __('Since grouping of INSERTs queries has been selected, INSERT queries into the same table are also being grouped together, disregarding of the inserted data.');
$js_messages['strLogDataLoaded'] = __('Log data loaded. Queries executed in this time span:');
$js_messages['strJumpToTable'] = __('Jump to Log table');
$js_messages['strNoDataFound'] = __('Log analysed, but not data found in this time span.');
/* For inline query editing */
$js_messages['strGo'] = __('Go');
$js_messages['strCancel'] = __('Cancel');

File diff suppressed because it is too large Load Diff

View File

@ -54,9 +54,9 @@ $(function() {
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> ';
editLink = '<a href="#" class="editLink" onclick="return editVariable(this);"><img src="'+pmaThemeImage+'b_edit.png" alt="" width="16" height="16"> '+PMA_messages['strEdit']+'</a>';
saveLink = '<a href="#" class="saveLink"><img src="'+pmaThemeImage+'b_save.png" alt="" width="16" height="16"> '+PMA_messages['strSave']+'</a> ';
cancelLink = '<a href="#" class="cancelLink"><img src="'+pmaThemeImage+'b_close.png" alt="" width="16" height="16"> '+PMA_messages['strCancel']+'</a> ';
$.ajaxSetup({
@ -129,7 +129,7 @@ $(function() {
$('#filterText').keyup(function(e) {
if($(this).val().length==0) textFilter=null;
else textFilter = new RegExp("(^| )"+$(this).val(),'i');
else textFilter = new RegExp("(^| )"+$(this).val().replace('_',' '),'i');
filterVariables();
});

View File

@ -162,6 +162,24 @@ $(document).ready(function() {
$('#table_results').makegrid();
})
/**
* Attach the {@link refreshgrid} function to a custom event, which will be
* triggered manually everytime the table of results is manipulated (e.g., by inline edit)
* @memberOf jQuery
*/
$("#sqlqueryresults").live('refreshgrid', function() {
$('#table_results').refreshgrid();
})
/**
* Attach the {@link makegrid} function to a custom event, which will be
* triggered manually everytime the table of results is reloaded
* @memberOf jQuery
*/
$("#sqlqueryresults").live('makegrid', function() {
$('#table_results').makegrid();
})
/**
* Attach the {@link refreshgrid} function to a custom event, which will be
* triggered manually everytime the table of results is manipulated (e.g., by inline edit)

View File

@ -3,7 +3,7 @@ var chart_series;
var chart_series_index = -1;
$(document).ready(function() {
var currentChart=null;
var currentChart = null;
var chart_data = jQuery.parseJSON($('#querychart').html());
chart_series = 'columns';
chart_xaxis_idx = $('select[name="chartXAxis"]').attr('value');
@ -26,9 +26,9 @@ $(document).ready(function() {
var currentSettings = {
chart: {
type:'line',
width:$('#resizer').width()-20,
height:$('#resizer').height()-20
type: 'line',
width: $('#resizer').width() - 20,
height: $('#resizer').height() - 20
},
xAxis: {
title: { text: $('input[name="xaxis_label"]').attr('value') }
@ -36,7 +36,10 @@ $(document).ready(function() {
yAxis: {
title: { text: $('input[name="yaxis_label"]').attr('value') }
},
title: { text: $('input[name="chartTitle"]').attr('value'), margin:20 },
title: {
text: $('input[name="chartTitle"]').attr('value'),
margin:20
},
plotOptions: {
series: {}
}
@ -45,11 +48,11 @@ $(document).ready(function() {
$('#querychart').html('');
$('input[name="chartType"]').click(function() {
currentSettings.chart.type=$(this).attr('value');
currentSettings.chart.type = $(this).attr('value');
drawChart();
if($(this).attr('value')=='bar' || $(this).attr('value')=='column')
if($(this).attr('value') == 'bar' || $(this).attr('value') == 'column')
$('span.barStacked').show();
else
$('span.barStacked').hide();
@ -64,9 +67,9 @@ $(document).ready(function() {
});
$('input[name="chartTitle"]').keyup(function() {
var title=$(this).attr('value');
if(title.length==0) title=' ';
currentChart.setTitle({text: title});
var title = $(this).attr('value');
if(title.length == 0) title = ' ';
currentChart.setTitle({ text: title });
});
$('select[name="chartXAxis"]').change(function() {
@ -90,10 +93,10 @@ $(document).ready(function() {
});
function drawChart(noAnimation) {
currentSettings.chart.width=$('#resizer').width()-20;
currentSettings.chart.height=$('#resizer').height()-20;
currentSettings.chart.width = $('#resizer').width() - 20;
currentSettings.chart.height = $('#resizer').height() - 20;
if(currentChart!=null) currentChart.destroy();
if(currentChart != null) currentChart.destroy();
if(noAnimation) currentSettings.plotOptions.series.animation = false;
currentChart = PMA_queryChart(chart_data,currentSettings);
@ -101,22 +104,22 @@ $(document).ready(function() {
}
drawChart();
$('#querychart').show();
$('#querychart').show();
});
function in_array(element,array) {
for(var i=0; i<array.length; i++)
if(array[i]==element) return true;
return false;
for(var i=0; i < array.length; i++)
if(array[i] == element) return true;
return false;
}
function PMA_queryChart(data,passedSettings) {
if($('#querychart').length==0) return;
if($('#querychart').length == 0) return;
var columnNames = Array();
var series = new Array();
var xaxis = new Object();
var xaxis = { type: 'linear' };
var yaxis = new Object();
$.each(data[0],function(index,element) {
@ -130,16 +133,17 @@ function PMA_queryChart(data,passedSettings) {
case 'bar':
xaxis.categories = new Array();
if(chart_series=='columns') {
var j=0;
if(chart_series == 'columns') {
var j = 0;
for(var i=0; i<columnNames.length; i++)
if(i!=chart_xaxis_idx) {
if(i != chart_xaxis_idx) {
series[j] = new Object();
series[j].data = new Array();
series[j].name = columnNames[i];
$.each(data,function(key,value) {
series[j].data.push(parseFloat(value[columnNames[i]]));
if(j==0 && chart_xaxis_idx!=-1 && !xaxis.categories[value[columnNames[chart_xaxis_idx]]])
if( j== 0 && chart_xaxis_idx != -1 && ! xaxis.categories[value[columnNames[chart_xaxis_idx]]])
xaxis.categories.push(value[columnNames[chart_xaxis_idx]]);
});
j++;
@ -149,9 +153,9 @@ function PMA_queryChart(data,passedSettings) {
var seriesIndex = new Object();
// Get series types and build series object from the query data
$.each(data,function(index,element) {
var contains=false;
for(var i=0; i<series.length; i++)
if(series[i].name == element[chart_series]) contains=true;
var contains = false;
for(var i=0; i < series.length; i++)
if(series[i].name == element[chart_series]) contains = true;
if(!contains) {
seriesIndex[element[chart_series]] = j;
@ -167,14 +171,15 @@ function PMA_queryChart(data,passedSettings) {
$.each(data,function(key,value) {
type = value[chart_series];
series[seriesIndex[type]].data.push(parseFloat(value[columnNames[0]]));
if(!in_array(value[columnNames[chart_xaxis_idx]],xaxis.categories))
xaxis.categories.push(value[columnNames[chart_xaxis_idx]]);
if( !in_array(value[columnNames[chart_xaxis_idx]],xaxis.categories))
xaxis.categories.push(value[columnNames[chart_xaxis_idx]]);
});
}
if(columnNames.length==2)
if(columnNames.length == 2)
yaxis.title = { text: columnNames[0] };
break;
@ -182,7 +187,10 @@ function PMA_queryChart(data,passedSettings) {
series[0] = new Object();
series[0].data = new Array();
$.each(data,function(key,value) {
series[0].data.push({name:value[columnNames[chart_xaxis_idx]],y:parseFloat(value[columnNames[0]])});
series[0].data.push({
name: value[columnNames[chart_xaxis_idx]],
y: parseFloat(value[columnNames[0]])
});
});
break;
}
@ -192,10 +200,12 @@ function PMA_queryChart(data,passedSettings) {
var settings = {
chart: {
renderTo: 'querychart',
backgroundColor: $('fieldset').css('background-color')
renderTo: 'querychart'
},
title: {
text: '',
margin: 0
},
title: { text:'', margin:0 },
series: series,
xAxis: xaxis,
yAxis: yaxis,
@ -212,12 +222,6 @@ function PMA_queryChart(data,passedSettings) {
}
}
},
credits: {
enabled:false
},
exporting: {
enabled: true
},
tooltip: {
formatter: function() {
if(this.point.name) return '<b>'+this.series.name+'</b><br/>'+this.point.name+'<br/>'+this.y;
@ -226,11 +230,11 @@ function PMA_queryChart(data,passedSettings) {
}
};
if(passedSettings.chart.type=='pie')
if(passedSettings.chart.type == 'pie')
settings.tooltip.formatter = function() { return '<b>'+columnNames[0]+'</b><br/>'+this.y; }
// Overwrite/Merge default settings with passedsettings
$.extend(true,settings,passedSettings);
return new Highcharts.Chart(settings);
return PMA_createChart(settings);
}

View File

@ -1391,7 +1391,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
$is_field_truncated = false;
//If the previous column had blob data, we need to reset the class
// to $inline_edit_class
$class = 'data ' . $inline_edit_class . ' ' . $not_null_class . ' ' . $alternating_color_class . ' ' . $relation_class . ' ' . $hide_class;
$class = 'data ' . $inline_edit_class . ' ' . $not_null_class . ' ' . $relation_class; //' ' . $alternating_color_class .
// See if this column should get highlight because it's used in the
// where-query.

123
libraries/sysinfo.lib.php Normal file
View File

@ -0,0 +1,123 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Library for extracting information about system memory and cpu. Currently supports all
* Windows and Linux plattforms
*
* This code is based on the OS Classes from the phpsysinfo project (http://phpsysinfo.sourceforge.net/)
*
* @package phpMyAdmin
*/
function getSysInfo() {
$supported = array('Linux','WINNT');
$sysinfo = array();
if(in_array(PHP_OS, $supported)) {
return eval("return new ".PHP_OS."();");
}
return $sysinfo;
}
class WINNT {
private $_wmi;
public $os = 'WINNT';
public function __construct() {
// initialize the wmi object
$objLocator = new COM('WbemScripting.SWbemLocator');
$this->_wmi = $objLocator->ConnectServer();
}
function loadavg() {
$loadavg = "";
$sum = 0;
$buffer = $this->_getWMI('Win32_Processor', array('LoadPercentage'));
foreach ($buffer as $load) {
$value = $load['LoadPercentage'];
$loadavg .= $value.' ';
$sum += $value;
}
return array('loadavg' => $sum / count($buffer));
}
private function _getWMI($strClass, $strValue = array()) {
$arrData = array();
$value = "";
$objWEBM = $this->_wmi->Get($strClass);
$arrProp = $objWEBM->Properties_;
$arrWEBMCol = $objWEBM->Instances_();
foreach ($arrWEBMCol as $objItem) {
if (is_array($arrProp)) {
reset($arrProp);
}
$arrInstance = array();
foreach ($arrProp as $propItem) {
if ( empty($strValue)) {
eval("\$value = \$objItem->".$propItem->Name.";");
$arrInstance[$propItem->Name] = trim($value);
} else {
if (in_array($propItem->Name, $strValue)) {
eval("\$value = \$objItem->".$propItem->Name.";");
$arrInstance[$propItem->Name] = trim($value);
}
}
}
$arrData[] = $arrInstance;
}
return $arrData;
}
function memory() {
$buffer = $this->_getWMI("Win32_OperatingSystem", array('TotalVisibleMemorySize', 'FreePhysicalMemory'));
$mem = Array();
$mem['MemTotal'] = $buffer[0]['TotalVisibleMemorySize'];
$mem['MemFree'] = $buffer[0]['FreePhysicalMemory'];
$mem['MemUsed'] = $mem['MemTotal'] - $mem['MemFree'];
$buffer = $this->_getWMI('Win32_PageFileUsage');
$mem['SwapTotal'] = 0;
$mem['SwapUsed'] = 0;
$mem['SwapPeak'] = 0;
foreach ($buffer as $swapdevice) {
$mem['SwapTotal'] += $swapdevice['AllocatedBaseSize'] * 1024;
$mem['SwapUsed'] += $swapdevice['CurrentUsage'] * 1024;
$mem['SwapPeak'] += $swapdevice['PeakUsage'] * 1024;
}
return $mem;
}
}
class Linux {
public $os = 'Linux';
function loadavg() {
$buf = file_get_contents('/proc/stat');
$nums=preg_split("/\s+/", substr($buf,0,strpos($buf,"\n")));
return Array('busy' => $nums[1]+$nums[2]+$nums[3], 'idle' => intval($nums[4]));
}
function memory() {
preg_match_all('/^(MemTotal|MemFree|Cached|Buffers|SwapCached|SwapTotal|SwapFree):\s+(.*)\s*kB/im', file_get_contents('/proc/meminfo'), $matches);
$mem = array_combine( $matches[1], $matches[2] );
$mem['MemUsed'] = $mem['MemTotal'] - $mem['MemFree'] - $mem['Cached'] - $mem['Buffers'];
$mem['SwapUsed'] = $mem['SwapTotal'] - $mem['SwapFree'] - $mem['SwapCached'];
foreach($mem as $idx=>$value)
$mem[$idx] = intval($value);
return $mem;
}
}

View File

@ -101,7 +101,7 @@ if (!$db_is_information_schema && !PMA_DRIZZLE) {
if (PMA_currentUserHasPrivilege('TRIGGER', $db, $table)) {
$tabs['triggers']['link'] = 'tbl_triggers.php';
$tabs['triggers']['text'] = __('Triggers');
$tabs['triggers']['icon'] = 'b_triggers.png';
$tabs['triggers']['icon'] = 'ic_b_triggers';
}
}

View File

@ -4936,6 +4936,37 @@ msgstr ""
msgid "Link not found"
msgstr ""
#: libraries/display_triggers.inc.php:35
#, possible-php-format
msgid "Export of trigger %s"
msgstr ""
#: libraries/display_triggers.inc.php:39
#, possible-php-format
msgid "Export of trigger \"%s\""
msgstr ""
#: libraries/display_triggers.inc.php:47
#, possible-php-format
msgid "No trigger with name %s found"
msgstr ""
#: libraries/display_triggers.inc.php:64 libraries/display_triggers.inc.php:66
msgid "There are no triggers to display."
msgstr ""
#: libraries/display_triggers.inc.php:77 server_status.php:800 sql.php:943
msgid "Time"
msgstr ""
#: libraries/display_triggers.inc.php:78
msgid "Event"
msgstr ""
#: libraries/display_triggers.inc.php:120
msgid "Add a trigger"
msgstr ""
#: libraries/engines/bdb.lib.php:20 main.php:211
msgid "Version information"
msgstr ""

View File

@ -43,6 +43,20 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
// Send with correct charset
header('Content-Type: text/html; charset=UTF-8');
if (isset($_REQUEST['logging_vars'])) {
if(isset($_REQUEST['varName']) && isset($_REQUEST['varValue'])) {
$value = PMA_sqlAddslashes($_REQUEST['varValue']);
if(!is_numeric($value)) $value="'".$value."'";
if(! preg_match("/[^a-zA-Z0-9_]+/",$_REQUEST['varName']))
PMA_DBI_query('SET GLOBAL '.$_REQUEST['varName'].' = '.$value);
}
$loggingVars = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES WHERE Variable_name IN ("general_log","slow_query_log","long_query_time","log_output")', 0, 1);
exit(json_encode($loggingVars));
}
// real-time charting data
if (isset($_REQUEST['chart_data'])) {
switch($_REQUEST['type']) {
@ -58,20 +72,24 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
);
exit(json_encode($ret));
case 'queries':
$queries = PMA_DBI_fetch_result('SHOW GLOBAL STATUS WHERE Variable_name LIKE "Com_%" AND Value>0', 0, 1);
$queries = PMA_DBI_fetch_result('SHOW GLOBAL STATUS WHERE Variable_name LIKE "Com_%" OR Variable_name="Questions" AND Value>0', 0, 1);
cleanDeprecated($queries);
// admin commands are not queries
unset($queries['Com_admin_commands']);
$questions = $queries['Questions'];
unset($queries['Questions']);
$sum = array_sum($queries);
//$sum=array_sum($queries);
$ret = array(
'x' => microtime(true)*1000,
'y' => $sum,
'y' => $questions,
'pointInfo' => $queries
);
exit(json_encode($ret));
case 'traffic':
$traffic = PMA_DBI_fetch_result('SHOW GLOBAL STATUS WHERE Variable_name="Bytes_received" OR Variable_name="Bytes_sent"', 0, 1);
@ -82,7 +100,150 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
);
exit(json_encode($ret));
case 'chartgrid':
$ret = json_decode($_REQUEST['requiredData'],true);
$statusVars = Array();
$sysinfo = $cpuload = $memory = 0;
foreach($ret as $chart_id=>$chartNodes) {
foreach($chartNodes as $node_id=>$node) {
switch($node['dataType']) {
case 'statusvar':
// Some white list filtering
if(! preg_match('/[^a-zA-Z_]+/',$node['name']))
$statusVars[] = $node['name'];
break;
case 'proc':
$result = PMA_DBI_query('SHOW PROCESSLIST');
$ret[$chart_id][$node_id]['y'] = PMA_DBI_num_rows($result);
break;
case 'cpu':
if(! $sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if(! $cpuload)
$cpuload = $sysinfo->loadavg();
if(PHP_OS == 'Linux') {
$ret[$chart_id][$node_id]['idle'] = $cpuload['idle'];
$ret[$chart_id][$node_id]['busy'] = $cpuload['busy'];
} else
$ret[$chart_id][$node_id]['y'] = $cpuload['loadavg'];
break;
case 'memory':
if(! $sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if(! $memory)
$memory = $sysinfo->memory();
$ret[$chart_id][$node_id]['y'] = $memory[$node['name']];
break;
}
}
}
$vars = PMA_DBI_fetch_result('SHOW GLOBAL STATUS WHERE Variable_name="' . implode('" OR Variable_name="',$statusVars) . '"', 0, 1);
foreach($ret as $chart_id=>$chartNodes) {
foreach($chartNodes as $node_id=>$node) {
if($node['dataType'] == 'statusvar')
$ret[$chart_id][$node_id]['y'] = $vars[$node['name']];
}
}
$ret['x'] = microtime(true)*1000;
exit(json_encode($ret));
}
}
if(isset($_REQUEST['log_data'])) {
$start = intval($_REQUEST['time_start']);
$end = intval($_REQUEST['time_end']);
if($_REQUEST['type'] == 'slow') {
$q = 'SELECT SUM(query_time) AS TIME(query_time), SUM(lock_time) as lock_time, '.
'SUM(rows_sent) AS rows_sent, SUM(rows_examined) AS rows_examined, sql_text, COUNT(sql_text) AS \'#\' '.
'FROM `mysql`.`slow_log` WHERE event_time > FROM_UNIXTIME('.$start.') '.
'AND event_time < FROM_UNIXTIME('.$end.') GROUP BY sql_text';
$result = PMA_DBI_try_query($q);
$return = array( 'rows' => array(), 'sum' => array());
$type = '';
while ($row = PMA_DBI_fetch_assoc($result)) {
$type = substr($row['sql_text'],0,strpos($row['sql_text'],' '));
$return['sum'][$type]++;
$return['rows'][] = $row;
}
$return['sum']['TOTAL'] = array_sum($return['sum']);
PMA_DBI_free_result($result);
exit(json_encode($return));
}
if($_REQUEST['type'] == 'general') {
$q = 'SELECT TIME(event_time) as event_time, user_host, thread_id, server_id, argument, count(argument) as \'#\' FROM `mysql`.`general_log` WHERE command_type=\'Query\' '.
'AND event_time > FROM_UNIXTIME('.$start.') AND event_time < FROM_UNIXTIME('.$end.') '.
'AND argument REGEXP \'^(INSERT|SELECT|UPDATE|DELETE)\' GROUP by argument'; // HAVING count > 1';
$result = PMA_DBI_try_query($q);
$return = array( 'rows' => array(), 'sum' => array());
$type = '';
$insertTables = array();
$insertTablesFirst = -1;
$i = 0;
while ($row = PMA_DBI_fetch_assoc($result)) {
preg_match('/^(\w+)\s/',$row['argument'],$match);
$type = strtolower($match[1]);
// Ignore undefined index warning, just increase counter by one
@$return['sum'][$type]++;
if($type=='insert' || $type=='update') {
// Group inserts if selected
if($type=='insert' && isset($_REQUEST['groupInserts']) && $_REQUEST['groupInserts'] && preg_match('/^INSERT INTO (`|\'|"|)([^\s\\1]+)\\1/i',$row['argument'],$matches)) {
$insertTables[$matches[2]]++;
if ($insertTables[$matches[2]] > 1) {
$return['rows'][$insertTablesFirst]['#'] = $insertTables[$matches[2]];
// Add a ... to the end of this query to indicate that there's been other queries
$return['rows'][$insertTablesFirst]['argument'][strlen($return['rows'][$insertTablesFirst]['argument'])-1] != '.';
$return['rows'][$insertTablesFirst]['argument'] .= '<br/>...';
// Group this value, thus do not add to the result list
continue;
} else {
$insertTablesFirst = $i;
$insertTables[$matches[2]] += $row['#'] - 1;
}
}
// Cut off big selects, but append byte count therefor
if(strlen($row['argument']) > 180)
$row['argument'] = substr($row['argument'],0,160) . '... [' .
PMA_formatByteDown(strlen($row['argument']), 2).']';
}
$return['rows'][] = $row;
$i++;
}
$return['sum']['TOTAL'] = array_sum($return['sum']);
PMA_DBI_free_result($result);
exit(json_encode($return));
}
}
}
@ -102,6 +263,10 @@ $GLOBALS['js_include'][] = 'server_status.js';
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
$GLOBALS['js_include'][] = 'jquery/jquery.tablesorter.js';
$GLOBALS['js_include'][] = 'jquery/jquery.cookie.js'; // For tab persistence
$GLOBALS['js_include'][] = 'jquery/jquery.json-2.2.js';
$GLOBALS['js_include'][] = 'jquery/jquery.sprintf.js';
$GLOBALS['js_include'][] = 'jquery/jquery.sortableTable.js';
// Charting
$GLOBALS['js_include'][] = 'highcharts/highcharts.js';
/* Files required for chart exporting */
$GLOBALS['js_include'][] = 'highcharts/exporting.js';
@ -109,7 +274,6 @@ $GLOBALS['js_include'][] = 'canvg/flashcanvas.js';
$GLOBALS['js_include'][] = 'canvg/canvg.js';
$GLOBALS['js_include'][] = 'canvg/rgbcolor.js';
/**
* flush status variables if requested
*/
@ -377,15 +541,23 @@ require './libraries/server_common.inc.php';
*/
require './libraries/server_links.inc.php';
$server = 1;
if(isset($_REQUEST['server']) && intval($_REQUEST['server'])) $server = intval($_REQUEST['server']);
$server_db_isLocal = strtolower($cfg['Servers'][$server]['host']) == 'localhost'
|| $cfg['Servers'][$server]['host'] == '127.0.0.1';
?>
<script type="text/javascript">
pma_token = '<?php echo $_SESSION[' PMA_token ']; ?>';
url_query = '<?php echo str_replace('&amp;','&',$url_query);?>';
pma_theme_image = '<?php echo $GLOBALS['pmaThemeImage']; ?>';
server_time_diff = new Date().getTime() - <?php echo microtime(true)*1000; ?>;
server_os = '<?php echo PHP_OS; ?>';
is_superuser = <?php echo PMA_isSuperuser()?'true':'false'; ?>;
server_db_isLocal = <?php echo ($server_db_isLocal)?'true':'false'; ?>;
</script>
<div id="serverstatus">
<h2><?php
/**
* Displays the sub-page heading
*/
@ -401,19 +573,18 @@ echo __('Runtime Information');
<li><a href="#statustabs_traffic"><?php echo __('Server traffic'); ?></a></li>
<li><a href="#statustabs_queries"><?php echo __('Query statistics'); ?></a></li>
<li><a href="#statustabs_allvars"><?php echo __('All status variables'); ?></a></li>
<li><a href="#statustabs_charting"><?php echo __('Monitor'); ?></a></li>
</ul>
<div id="statustabs_traffic">
<div class="statuslinks">
<div class="buttonlinks">
<a class="tabRefresh" href="<?php echo $PMA_PHP_SELF . '?show=server_traffic&amp;' . PMA_generate_common_url(); ?>" >
<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" style="display: none;" />
<?php echo __('Refresh'); ?>
</a>
<span class="refreshList" style="display:none;">
<label for="trafficChartRefresh"><?php echo __('Refresh rate:'); ?></label>
<select name="trafficChartRefresh" style="display:none;">
<?php PMA_choose_refresh_rate(); ?>
</select>
<label for="trafficChartRefresh"><?php echo __('Refresh rate: '); ?></label>
<?php refreshList('trafficChartRefresh'); ?>
</span>
<a class="tabChart livetrafficLink" href="#">
@ -421,8 +592,6 @@ echo __('Runtime Information');
</a>
<a class="tabChart liveconnectionsLink" href="#">
<?php echo __('Live conn./process chart'); ?>
</a>
</div>
<div class="tabInnerContent">
@ -430,16 +599,14 @@ echo __('Runtime Information');
</div>
</div>
<div id="statustabs_queries">
<div class="statuslinks">
<div class="buttonlinks">
<a class="tabRefresh" href="<?php echo $PMA_PHP_SELF . '?show=query_statistics&amp;' . PMA_generate_common_url(); ?>" >
<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" style="display: none;" />
<?php echo __('Refresh'); ?>
</a>
<span class="refreshList" style="display:none;">
<label for="queryChartRefresh"><?php echo __('Refresh rate:'); ?></label>
<select name="queryChartRefresh" style="display:none;">
<?php PMA_choose_refresh_rate(); ?>
</select>
<label for="queryChartRefresh"><?php echo __('Refresh rate: '); ?></label>
<?php refreshList('queryChartRefresh'); ?>
</span>
<a class="tabChart livequeriesLink" href="#">
<?php echo __('Live query chart'); ?>
@ -451,7 +618,7 @@ echo __('Runtime Information');
</div>
<div id="statustabs_allvars">
<fieldset id="tableFilter">
<div class="statuslinks">
<div class="buttonlinks">
<a class="tabRefresh" href="<?php echo $PMA_PHP_SELF . '?show=variables_table&amp;' . PMA_generate_common_url(); ?>" >
<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" style="display: none;" />
<?php echo __('Refresh'); ?>
@ -481,7 +648,7 @@ echo __('Runtime Information');
</div>
</fieldset>
<div id="linkSuggestions" class="defaultLinks" style="display:none">
<p><?php echo __('Related links:'); ?>
<p class="notice"><?php echo __('Related links:'); ?>
<?php
foreach ($links as $section_name => $section_links) {
echo '<span class="status_'.$section_name.'"> ';
@ -505,6 +672,10 @@ echo __('Runtime Information');
<?php printVariablesTable(); ?>
</div>
</div>
<div id="statustabs_charting">
<?php printMonitor(); ?>
</div>
</div>
</div>
@ -519,28 +690,30 @@ function printQueryStatistics() {
?>
<h3 id="serverstatusqueries">
<?php
echo sprintf('Queries since startup: %s',PMA_formatNumber($total_queries, 0));
<?php
/* l10n: Questions is the name of a MySQL Status variable */
echo sprintf(__('Questions since startup: %s'),PMA_formatNumber($total_queries, 0)) . ' ';
echo PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_Questions');
?>
<br>
<span>
<?php
echo '&oslash;'.__('per hour').':';
echo '&oslash; '.__('per hour').': ';
echo PMA_formatNumber($total_queries * $hour_factor, 0);
echo '<br>';
echo '&oslash;'.__('per minute').':';
echo PMA_formatNumber( $total_queries * 60 / $server_status['Uptime'], 0);
echo '&oslash; '.__('per minute').': ';
echo PMA_formatNumber( $total_queries * 60 / $server_status['Uptime'], 0);
echo '<br>';
if ($total_queries / $server_status['Uptime'] >= 1) {
echo '&oslash;'.__('per second').':';
echo PMA_formatNumber( $total_queries / $server_status['Uptime'], 0);
if($total_queries / $server_status['Uptime'] >= 1) {
echo '&oslash; '.__('per second').': ';
echo PMA_formatNumber( $total_queries / $server_status['Uptime'], 0);
}
?>
</span><br>
</span>
</h3>
<?php
}
// reverse sort by value to show most used statements first
arsort($used_queries);
@ -555,7 +728,7 @@ function printQueryStatistics() {
<col class="namecol" />
<col class="valuecol" span="3" />
<thead>
<tr><th><?php echo __('Query type'); ?></th>
<tr><th><?php echo __('Statements'); ?></th>
<th><?php
/* l10n: # = Amount of queries */
echo __('#');
@ -578,7 +751,8 @@ function printQueryStatistics() {
// but is included in Questions. Then the total of the percentages is 100.
$name = str_replace(array('Com_', '_'), array('', ' '), $name);
if ($value < $query_sum * 0.02)
// Group together values that make out less than 2% into "Other", but only if we have more than 6 fractions already
if($value < $query_sum * 0.02 && count($chart_json)>6)
$other_sum += $value;
else $chart_json[$name] = $value;
?>
@ -597,12 +771,14 @@ function printQueryStatistics() {
</table>
<div id="serverstatusquerieschart">
<span style="display:none;">
<?php
if ($other_sum > 0)
$chart_json[__('Other')] = $other_sum;
echo json_encode($chart_json);
?>
</span>
</div>
<?php
}
@ -628,9 +804,9 @@ function printServerTraffic() {
?>
</h3>
<p>
<p class="notice">
<?php
echo sprintf(__('This MySQL server has been running for %s. It started up on %s.'),
echo sprintf(__('This MySQL server has been running for %1$s. It started up on %2$s.'),
PMA_timespanFormat($server_status['Uptime']),
PMA_localisedDate($start_time)) . "\n";
?>
@ -638,7 +814,7 @@ function printServerTraffic() {
<?php
if ($server_master_status || $server_slave_status) {
echo '<p>';
echo '<p class="notice">';
if ($server_master_status && $server_slave_status) {
echo __('This MySQL server works as <b>master</b> and <b>slave</b> in <b>replication</b> process.');
} elseif ($server_master_status) {
@ -853,6 +1029,7 @@ function printVariablesTable() {
* Messages are built using the message name
*/
$strShowStatus = array(
'Aborted_clients' => __('The number of connections that were aborted because the client died without closing the connection properly.'),
'Aborted_connects' => __('The number of failed attempts to connect to the MySQL server.'),
'Binlog_cache_disk_use' => __('The number of transactions that used the temporary binary log cache but that exceeded the value of binlog_cache_size and used a temporary file to store statements from the transaction.'),
'Binlog_cache_use' => __('The number of transactions that used the temporary binary log cache.'),
@ -1038,7 +1215,7 @@ function printVariablesTable() {
$odd_row = !$odd_row;
?>
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; echo isset($allocationMap[$name])?' s_'.$allocationMap[$name]:''; ?>">
<th class="name"><?php echo htmlspecialchars($name) . PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_' . $name); ?>
<th class="name"><?php echo htmlspecialchars(str_replace('_',' ',$name)) . PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_' . $name); ?>
</th>
<td class="value"><?php
if (isset($alerts[$name])) {
@ -1091,6 +1268,189 @@ function printVariablesTable() {
<?php
}
function printMonitor() {
global $server_status, $server_db_isLocal;
?>
<div class="monitorLinks">
<a href="#pauseCharts">
<img src="<?php echo $GLOBALS['pmaThemeImage'];?>play.png" alt="" />
<?php echo __('Start Monitor'); ?>
</a>
<a href="#settingsPopup" rel="popupLink" style="display:none;">
<img src="<?php echo $GLOBALS['pmaThemeImage'];?>s_cog.png" alt="" />
<?php echo __('Settings'); ?>
</a>
<a href="#monitorInstructionsDialog">
<img src="<?php echo $GLOBALS['pmaThemeImage'];?>b_help.png" alt="" />
<?php echo __('Instructions/Setup'); ?>
</a>
<a href="#endChartEditMode" style="display:none;">
<img src="<?php echo $GLOBALS['pmaThemeImage'];?>s_okay.png" alt="" />
<?php echo __('Done rearranging/editing charts'); ?>
</a>
</div>
<div class="popupContent settingsPopup">
<a href="#addNewChart">
<img src="<?php echo $GLOBALS['pmaThemeImage'];?>b_chart.png" alt="" />
<?php echo __('Add chart'); ?>
</a> |
<a href="#rearrangeCharts"> <?php echo __('Rearrange/edit charts'); ?></a><br>
<p>
<?php echo __('Refresh rate:'); refreshList('gridChartRefresh'); ?><br>
</p>
<p>
<?php echo __('Chart columns:'); ?>
<select name="chartColumns">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</select>
</p>
<a href="#clearMonitorConfig"><?php echo __('Clear monitor config'); ?></a>
</div>
<div id="monitorInstructionsDialog" title="<?php echo __('Monitor Instructions'); ?>" style="display:none;">
<?php echo __('The phpMyAdmin Monitor can assist you in optimizing the server configuration and track down time intensive
queries. For the latter you will need to log_output set to \'TABLE\' and have either the slow_query_log or general_log enabled.'); ?>
<p></p>
<img class="ajaxIcon" src="<?php echo $GLOBALS['pmaThemeImage']; ?>ajax_clock_small.gif" alt="Loading">
<div class="ajaxContent">
</div>
<div class="monitorUse" style="display:none;">
<p></p>
<?php echo __('<b>Using the monitor:</b><br/>
Ok, you are good to go! Once you click \'Start monitor\' your browser will refresh all displayed charts
in a regular interval. You may add charts and change the refresh rate under \'Settings\', or remove any chart
using the cog icon on each respective chart.
<p>When you get to see a sudden spike in activity, select the relevant time span on any chart by holding down the
left mouse button and panning over the chart. This will load statistics from the logs helping you find what caused the
activity spike.</p>
<p><b>Please note:</b>
Enabling the general_log may increase the server load by up to 5-15%. Also be aware that generating statistics out of the logs is a
very load intensive task, thus it is advisable to select only a small time span.
</p>'); ?>
</div>
</div>
<div id="addChartDialog" title="Add chart" style="display:none;">
<div id="tabGridVariables">
<p><input type="text" name="chartTitle" value="<?php echo __('Chart Title'); ?>" /></p>
<?php if($server_db_isLocal) { ?>
<input type="radio" name="chartType" value="cpu" id="chartCPU">
<label for="chartCPU"><?php echo __('CPU Usage'); ?></label><br/>
<input type="radio" name="chartType" value="memory" id="chartMemory">
<label for="chartMemory"><?php echo __('Memory Usage'); ?></label><br/>
<input type="radio" name="chartType" value="swap" id="chartSwap">
<label for="chartSwap"><?php echo __('Swap Usage'); ?></label><br/>
<?php } ?>
<input type="radio" name="chartType" value="variable" id="chartStatusVar" checked="checked">
<label for="chartStatusVar"><?php echo __('Status variable(s)'); ?></label><br/>
<div id="chartVariableSettings">
<label for="chartSeries"><?php echo __('Select series:'); ?></label><br>
<select id="chartSeries" name="varChartList" size="1">
<option><?php echo __('Commonly monitored'); ?></option>
<option>Processes</option>
<option>Questions</option>
<option>Connections</option>
<option>Bytes_sent</option>
<option>Bytes_received</option>
<option>Threads_connected</option>
<option>Created_tmp_disk_tables</option>
<option>Handler_read_first</option>
<option>Innodb_buffer_pool_wait_free</option>
<option>Key_reads</option>
<option>Open_tables</option>
<option>Select_full_join</option>
<option>Slow_queries</option>
</select><br>
<label for="variableInput"><?php echo __('or type variable name:'); ?> </label>
<input type="text" name="variableInput" id="variableInput" />
<p></p>
<input type="checkbox" name="differentialValue" id="differentialValue" value="differential" checked="checked" />
<label for="differentialValue"><?php echo __('Display as differential value'); ?></label><br>
<input type="checkbox" id="useDivisor" name="useDivisor" value="1" />
<label for="useDivisor"><?php echo __('Apply a divisor'); ?></label>
<span class="divisorInput" style="display:none;">
<input type="text" name="valueDivisor" size="4" value="1">
(<a href="#kibDivisor"><?php echo __('KiB'); ?></a>, <a href="#mibDivisor"><?php echo __('MiB'); ?></a>)
</span><br>
<input type="checkbox" id="useUnit" name="useUnit" value="1" />
<label for="useUnit"><?php echo __('Append unit to data values'); ?></label>
<span class="unitInput" style="display:none;">
<input type="text" name="valueUnit" size="4" value="">
</span>
<p>
<a href="#submitAddSeries"><b><?php echo __('Add this series'); ?></b></a>
<span id="clearSeriesLink" style="display:none;">
| <a href="#submitClearSeries"><?php echo __('Clear series'); ?></a>
</span>
</p>
<?php echo __('Series in Chart:'); ?><br/>
<span id="seriesPreview">
<i><?php echo __('None'); ?></i>
</span>
</div>
</div>
</div>
<div id="loadingLogsDialog" title="<?php echo __('Loading logs'); ?>" style="display:none;">
</div>
<div id="logAnalyseDialog" title="<?php echo __('Log statistics'); ?>">
</div>
<table border="0" class="clearfloat" id="chartGrid">
</table>
<div id="logTable">
<br/>
</div>
<script type="text/javascript">
variableNames = [ <?php
$i=0;
foreach($server_status as $name=>$value) {
if(is_numeric($value)) {
if($i++ > 0) echo ", ";
echo "'".$name."'";
}
}
?> ];
</script>
<?php
}
/* Builds a <select> list for refresh rates */
function refreshList($name,$defaultRate=5, $refreshRates=Array(1, 2, 5, 10, 20, 40, 60, 120, 300, 600)) {
?>
<select name="<?php echo $name; ?>">
<?php
foreach($refreshRates as $rate) {
$selected = ($rate == $defaultRate)?' selected="selected"':'';
if($rate<60)
echo '<option value="'.$rate.'"'.$selected.'>'.sprintf(_ngettext('%d second', '%d seconds', $rate), $rate).'</option>';
else
echo '<option value="'.$rate.'"'.$selected.'>'.sprintf(_ngettext('%d minute', '%d minutes', $rate/60), $rate/60).'</option>';
}
?>
</select>
<?php
}
/**
* cleanup of some deprecated values
*/

View File

@ -37,16 +37,16 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
if(isset($_REQUEST['type'])) {
switch($_REQUEST['type']) {
case 'getval':
$varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="'.$_REQUEST['varName'].'";','NUM');
$varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="'.PMA_sqlAddslashes($_REQUEST['varName']).'";','NUM');
exit($varValue[1]);
break;
case 'setval':
$value = $_REQUEST['varValue'];
$value = PMA_sqlAddslashes($_REQUEST['varValue']);
if(!is_numeric($value)) $value="'".$value."'";
if(PMA_DBI_query('SET GLOBAL '.PMA_backquote($_REQUEST['varName']).' = '.$value))
if(! preg_match("/[^a-zA-Z0-9_]+/",$_REQUEST['varName']) && 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');
$varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="'.PMA_sqlAddslashes($_REQUEST['varName']).'";','NUM');
exit(json_encode(array(
'success' => true,
@ -92,7 +92,6 @@ $serverVars = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES;', 0, 1);
<script type="text/javascript">
pma_token = '<?php echo $_SESSION[' PMA_token ']; ?>';
url_query = '<?php echo str_replace('&amp;','&',$url_query);?>';
pma_theme_image = '<?php echo $GLOBALS['pmaThemeImage']; ?>';
isSuperuser = <?php echo PMA_isSuperuser()?'true':'false'; ?>;
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

View File

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 264 B

View File

@ -419,6 +419,8 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
.ui-tabs .ui-tabs-hide {
position: absolute;
left: -10000px;
/* required so that overflowing content doesn't cause scrolling */
top: -10000px;
}
/* Datepicker
----------------------------------*/

View File

@ -1185,9 +1185,10 @@ th.headerSortDown img.sortableIcon, th.headerSortDown img.sortableIcon {
background-image:url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_asc.png);
}
.statuslinks {
.buttonlinks {
float: <?php echo $right; ?>;
white-space: nowrap;
display: none; /* Made visible with js */
}
/* Also used for the variables page */
@ -1210,10 +1211,14 @@ div#serverstatusquerieschart {
padding-<?php echo $left; ?>: 30px;
}
div#serverstatus table#serverstatusqueriesdetails {
table#serverstatusqueriesdetails, table#serverstatustraffic {
float: <?php echo $left; ?>;
}
table#serverstatusqueriesdetails th {
min-width: 35px;
}
.clearfloat {
clear: both;
}
@ -1228,9 +1233,6 @@ table#serverstatusvariables .name {
table#serverstatusvariables .value {
width: 6em;
}
table#serverstatustraffic {
float: <?php echo $left; ?>;
}
table#serverstatusconnections {
float: <?php echo $left; ?>;
margin-<?php echo $left; ?>: 30px;
@ -1247,6 +1249,52 @@ div.liveChart {
height:400px;
padding-bottom:80px;
}
#addChartDialog input[type="text"] {
margin:0px;
padding:3px;
}
div#chartVariableSettings {
border:1px solid #ddd;
background-color:#E6E6E6;
margin-left:10px;
}
table#chartGrid div.monitorChart {
background: #EBEBEB;
}
div#statustabs_charting div.monitorLinks {
float:<?php echo $left; ?>;
}
.popupContent {
display: none;
position: absolute;
border: 1px solid #CCC;
margin:0;
padding:3px;
-moz-box-shadow: 1px 1px 6px #ddd;
-webkit-box-shadow: 2px 2px 3px #666;
box-shadow: 2px 2px 3px #666;
background-color:white;
z-index: 2;
}
div#logTable {
padding-top: 10px;
clear: both;
}
div#logTable table {
width:100%;
}
.smallIndent {
padding-left: 7px;
}
/* end serverstatus */
/* server variables */
@ -1257,23 +1305,23 @@ a.editLink {
}
table.serverVariableEditTable {
border:0;
margin:0;
padding:0;
width:100%;
border:0;
margin:0;
padding:0;
width:100%;
}
table.serverVariableEditTable td {
border:0;
margin:0;
padding:0;
border:0;
margin:0;
padding:0;
}
table.serverVariableEditTable td:first-child {
white-space:nowrap;
vertical-align:middle;
white-space:nowrap;
vertical-align:middle;
}
table.serverVariableEditTable input {
width:95%;
width:95%;
}
table#serverVariables td {
@ -1282,6 +1330,37 @@ table#serverVariables td {
/* end server variables */
p.notice {
margin: 1.5em 0px;
border: 1px solid #000;
<?php if ($GLOBALS['cfg']['ErrorIconic']) { ?>
background-repeat: no-repeat;
<?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
background-position: 10px 50%;
padding: 10px 10px 10px 25px;
<?php } else { ?>
background-position: 99% 50%;
padding: 25px 10px 10px 10px
<?php } ?>
<?php } else { ?>
padding: 0.3em;
<?php } ?>
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
-moz-box-shadow: 0px 1px 2px #fff inset;
-webkit-box-shadow: 0px 1px 2px #fff inset;
box-shadow:0px 1px 2px #fff; inset;
background:#555;
color:#d4fb6a;
}
p.notice a {
color:#fff;
text-decoration:underline;
}
/* querywindow */
body#bodyquerywindow {
margin: 0;
@ -1326,32 +1405,6 @@ div#profilingchart {
#togglequerybox{margin:0 10px}
#serverstatus p {
margin: 1.5em 0px;
border: 1px solid #000;
<?php if ($GLOBALS['cfg']['ErrorIconic']) { ?>
background-repeat: no-repeat;
<?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
background-position: 10px 50%;
padding: 10px 10px 10px 25px;
<?php } else { ?>
background-position: 99% 50%;
padding: 25px 10px 10px 10px
<?php } ?>
<?php } else { ?>
padding: 0.3em;
<?php } ?>
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
-moz-box-shadow: 0px 1px 2px #fff inset;
-webkit-box-shadow: 0px 1px 2px #fff inset;
box-shadow:0px 1px 2px #fff; inset;
background:#555;
color:#d4fb6a;
}
#serverstatus p a{color:#fff;text-decoration:underline;}
#serverstatus h3
{
margin: 15px 0;
@ -1370,7 +1423,7 @@ div#profilingchart {
-webkit-box-shadow:0px 1px 1px #fff inset;
-moz-box-shadow:0px 1px 1px #fff inset;
}
#sectionlinks a, .statuslinks a{
#sectionlinks a, .buttonlinks a, a.button {
font-size:0.88em;
font-weight:bold;
text-shadow: 0px 1px 0px #fff;
@ -1398,7 +1451,7 @@ div#profilingchart {
background: -o-linear-gradient(top, #ffffff, #cccccc);
<?php echo PMA_ieFilter('#ffffff', '#cccccc'); ?>
}
#sectionlinks a:hover, .statuslinks a:hover{
#sectionlinks a:hover, .buttonlinks a:hover, a.button:hover {
background-image: url(./themes/svg_gradient.php?from=cccccc&to=dddddd);
background-size: 100% 100%;
background: -webkit-gradient(linear, left top, left bottom, from(#cccccc), to(#dddddd));

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

View File

Before

Width:  |  Height:  |  Size: 512 B

After

Width:  |  Height:  |  Size: 512 B

View File

@ -419,6 +419,8 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
.ui-tabs .ui-tabs-hide {
position: absolute;
left: -10000px;
/* required so that overflowing content doesn't cause scrolling */
top: -10000px;
}
/* Datepicker
----------------------------------*/