The branch, master has been updated via f09d12cb4c343866c7f955f06c75d4cb4eb05307 (commit) via eba14cfbca7d274e605640f46658a2f9d75b231f (commit) via 3cbf056e4bb962f9a082f9ebac0b7f3be7f4af65 (commit) from cf004d89ca6786cff687f064740aa9b9fdaa77d5 (commit)
- Log ----------------------------------------------------------------- commit f09d12cb4c343866c7f955f06c75d4cb4eb05307 Author: Michal Čihař mcihar@suse.cz Date: Fri Aug 5 15:03:24 2011 +0200
Remove trailing commas from arrays, MSIE can add extra element in such case
commit eba14cfbca7d274e605640f46658a2f9d75b231f Author: Michal Čihař mcihar@suse.cz Date: Fri Aug 5 15:00:35 2011 +0200
Saner loop declarations, always define start point
commit 3cbf056e4bb962f9a082f9ebac0b7f3be7f4af65 Author: Michal Čihař mcihar@suse.cz Date: Fri Aug 5 14:58:08 2011 +0200
Avoid messing up with keywords
-----------------------------------------------------------------------
Summary of changes: js/pmd/history.js | 36 +++++----- js/pmd/move.js | 10 ++-- js/server_status.js | 196 +++++++++++++++++++++++++------------------------- 3 files changed, 121 insertions(+), 121 deletions(-)
diff --git a/js/pmd/history.js b/js/pmd/history.js index d55d5b3..3e3a195 100644 --- a/js/pmd/history.js +++ b/js/pmd/history.js @@ -37,15 +37,15 @@ function panel(index) * @uses history_delete() * * @param {int} init starting index of unsorted array - * @param {int} final last index of unsorted array + * @param {int} finit last index of unsorted array * **/
-function display(init,final) +function display(init,finit) { var str,i,j,k,sto; // this part sorts the history array based on table name,this is needed for clubbing all object of same name together. - for (i = init;i < final;i++) { + for (i = init;i < finit;i++) { sto = history_array[i]; var temp = history_array[i].get_tab() ;//+ '.' + history_array[i].get_obj_no(); for Self JOINS for(j = 0;j < i;j++){ @@ -488,7 +488,7 @@ function build_query(formtitle, fadin) { var q_select = "SELECT "; var temp; - for(i = 0;i < select_field.length; i++) { + for (i = 0;i < select_field.length; i++) { temp = check_aggregate(select_field[i]); if (temp != "") { q_select += temp; @@ -535,7 +535,7 @@ function build_query(formtitle, fadin)
function query_from() { - var i =0; + var i; var tab_left = []; var tab_used = []; var t_tab_used = []; @@ -547,7 +547,7 @@ function query_from() var t_array = []; t_array = from_array; var K = 0; - for(i; i < history_array.length ; i++) { + for (i = 0; i < history_array.length ; i++) { from_array.push(history_array[i].get_tab()); } from_array = unique( from_array ); @@ -650,9 +650,9 @@ function remove_array(rem,arr)
function query_groupby() { - var i = 0; + var i; var str = ""; - for(i; i < history_array.length;i++) { + for (i = 0; i < history_array.length;i++) { if(history_array[i].get_type() == "GroupBy") { str +=history_array[i].get_column_name() + ", ";} } str = str.substr(0,str.length -1); @@ -666,9 +666,9 @@ function query_groupby()
function query_having() { - var i = 0; + var i; var and = "("; - for(i; i < history_array.length;i++) { + for (i = 0; i < history_array.length;i++) { if(history_array[i].get_type() == "Having") { if (history_array[i].get_obj().get_operator() != 'None') { and += history_array[i].get_obj().get_operator() + "(" + history_array[i].get_column_name() + " ) " + history_array[i].get_obj().getrelation_operator(); @@ -692,9 +692,9 @@ function query_having()
function query_orderby() { - var i = 0; + var i; var str = "" ; - for(i; i < history_array.length;i++) { + for (i = 0; i < history_array.length;i++) { if(history_array[i].get_type() == "OrderBy") { str += history_array[i].get_column_name() + " , "; } } str = str.substr(0,str.length -1); @@ -709,10 +709,10 @@ function query_orderby()
function query_where() { - var i = 0; + var i; var and = "("; var or = "("; - for(i; i < history_array.length;i++) { + for (i = 0; i < history_array.length;i++) { if(history_array[i].get_type() == "Where") { if(history_array[i].get_and_or() == 0) { and += "( " + history_array[i].get_column_name() + " " + history_array[i].get_obj().getrelation_operator() +" " + history_array[i].get_obj().getquery() + ")"; and += " AND "; @@ -741,8 +741,8 @@ function query_where()
function check_aggregate(id_this) { - var i = 0; - for(i;i < history_array.length;i++) { + var i; + for (i = 0;i < history_array.length;i++) { var temp = '`' + history_array[i].get_tab() + '`.`' +history_array[i].get_column_name() +'`'; if(temp == id_this && history_array[i].get_type() == "Aggregate") { return history_array[i].get_obj().get_operator() + '(' + id_this +')'; @@ -753,8 +753,8 @@ function check_aggregate(id_this)
function check_rename(id_this) { - var i = 0; - for (i;i < history_array.length;i++) { + var i; + for (i = 0;i < history_array.length;i++) { var temp = '`' + history_array[i].get_tab() + '`.`' +history_array[i].get_column_name() +'`'; if(temp == id_this && history_array[i].get_type() == "Rename") { return " AS `" + history_array[i].get_obj().getrename_to() +"`"; diff --git a/js/pmd/move.js b/js/pmd/move.js index b23a8f1..eb2b246 100644 --- a/js/pmd/move.js +++ b/js/pmd/move.js @@ -1038,7 +1038,7 @@ function Select_all(id_this,owner) downer =owner; var i; var tab = []; - for(i = 0; i < parent.elements.length; i++) { + for (i = 0; i < parent.elements.length; i++) { if (parent.elements[i].type == "checkbox" && parent.elements[i].id.substring(0,(9 + id_this.length)) == 'select_' + id_this + '._') { if(document.getElementById('select_all_' + id_this).checked == true) { parent.elements[i].checked = true; @@ -1094,20 +1094,20 @@ function Table_onover(id_this,val,buil) */ function store_column(id_this,owner,col) { - var i = 0; - var k = 0; + var i; + var k; if (document.getElementById('select_' + owner + '.' + id_this + '._' + col).checked == true) { select_field.push('`' + id_this + '`.`' + col +'`'); from_array.push(id_this); } else { - for(i; i < select_field.length ;i++) { + for (i = 0; i < select_field.length ;i++) { if (select_field[i] == ('`' + id_this + '`.`' + col +'`')) { select_field.splice(i,1); break; } } - for(k =0 ;k < from_array.length;k++){ + for (k = 0 ;k < from_array.length;k++){ if(from_array[k] == id_this){ from_array.splice(k,1); break; diff --git a/js/server_status.js b/js/server_status.js index eced236..5abb5df 100644 --- a/js/server_status.js +++ b/js/server_status.js @@ -217,7 +217,7 @@ $(function() { { x: curVal.x, y: (curVal.y_received - lastVal.y_received) / 1024 }, true, numLoadedPoints >= chartObj.options.realtime.numMaxPoints - ); + ); }, error: function() { serverResponseError(); } } @@ -260,7 +260,7 @@ $(function() { { x: curVal.x, y: curVal.y_proc }, true, numLoadedPoints >= chartObj.options.realtime.numMaxPoints - ); + ); }, error: function() { serverResponseError(); } } @@ -365,7 +365,7 @@ $(function() { categoryFilter = $(this).val(); filterVariables(); }); - + $('input#dontFormat').change(function() { $('#serverstatusvariables td.value span.original').toggle(this.checked); $('#serverstatusvariables td.value span.formatted').toggle(! this.checked); @@ -558,24 +558,24 @@ $(function() { $('a[href="#openAdvisorInstructions"]').click(function() { $('#advisorInstructionsDialog').dialog(); }); - + $('a[href="#startAnalyzer"]').click(function() { var $cnt = $('#statustabs_advisor .tabInnerContent'); $cnt.html('<img class="ajaxIcon" src="' + pmaThemeImage + 'ajax_clock_small.gif" alt="">'); - + $.get('server_status.php?'+url_query, { ajax_request: true, advisor: true },function(data) { var $tbody, $tr, str, even = true; - + data = $.parseJSON(data); $cnt.html('<p><b>Possible performance issues</b></p>'); if(data.fired.length > 0) { - $cnt.append('<table class="data" id="rulesFired" border="0"><thead><tr><th>Issue</th><th>Recommendation</th></tr></thead><tbody></tbody></table>'); + $cnt.append('<table class="data" id="rulesFired" border="0"><thead><tr><th>Issue</th><th>Recommendation</th></tr></thead><tbody></tbody></table>'); $tbody = $cnt.find('table#rulesFired'); $.each(data.fired, function(key,value) { $tbody.append($tr = $('<tr class="linkElem noclick ' + (even ? 'even' : 'odd') + '"><td>' + value.issue + '</td>' + - '<td>' + value.recommendation + ' </td></tr>')); + '<td>' + value.recommendation + ' </td></tr>')); even = !even; - + $tr.data('rule',value); $tr.click(function() { var rule = $(this).data('rule'); @@ -599,7 +599,7 @@ $(function() { }); } }); - + return false; });
@@ -631,7 +631,7 @@ $(function() { xmin: -1, xmax: -1 }; - + var monitorSettings = null;
var defaultMonitorSettings = { @@ -655,14 +655,14 @@ $(function() { title: PMA_messages['strSystemMemory'], nodes: [ { dataType: 'memory', name: PMA_messages['strTotalMemory'], dataPoint: 'MemTotal', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, - { dataType: 'memory', name: PMA_messages['strUsedMemory'], dataPoint: 'MemUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, + { dataType: 'memory', name: PMA_messages['strUsedMemory'], dataPoint: 'MemUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] } ] }, 'swap-WINNT': { title: PMA_messages['strSystemSwap'], nodes: [ { dataType: 'memory', name: PMA_messages['strTotalSwap'], dataPoint: 'SwapTotal', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, - { dataType: 'memory', name: PMA_messages['strUsedSwap'], dataPoint: 'SwapUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, + { dataType: 'memory', name: PMA_messages['strUsedSwap'], dataPoint: 'SwapUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] } ] }, 'cpu-Linux': { @@ -681,7 +681,7 @@ $(function() { { dataType: 'memory', name: PMA_messages['strUsedMemory'], dataPoint: 'MemUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, { dataType: 'memory', name: PMA_messages['strCachedMemory'], dataPoint: 'Cached', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, { dataType: 'memory', name: PMA_messages['strBufferedMemory'], dataPoint: 'Buffers', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, - { dataType: 'memory', name: PMA_messages['strFreeMemory'], dataPoint:'MemFree', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, + { dataType: 'memory', name: PMA_messages['strFreeMemory'], dataPoint:'MemFree', valueDivisor: 1024, unit: PMA_messages['strMiB'] } ], settings: { chart: { @@ -700,7 +700,7 @@ $(function() { nodes: [ { dataType: 'memory', name: PMA_messages['strTotalSwap'], dataPoint: 'SwapUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, { dataType: 'memory', name: PMA_messages['strCachedSwap'], dataPoint: 'SwapCached', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, - { dataType: 'memory', name: PMA_messages['strFreeSwap'], dataPoint: 'SwapFree', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, + { dataType: 'memory', name: PMA_messages['strFreeSwap'], dataPoint: 'SwapFree', valueDivisor: 1024, unit: PMA_messages['strMiB'] } ], settings: { chart: { @@ -968,14 +968,14 @@ $(function() {
$(this).dialog("close"); }; - + dlgButtons[PMA_messages['strClose']] = function() { newChart = null; $('span#clearSeriesLink').hide(); $('#seriesPreview').html(''); $(this).dialog("close"); }; - + $('div#addChartDialog').dialog({ width:'auto', height:'auto', @@ -986,7 +986,7 @@ $(function() {
return false; }); - + $('a[href="#exportMonitorConfig"]').click(function() { var gridCopy = {};
@@ -996,15 +996,15 @@ $(function() { gridCopy[key].settings = elem.settings; gridCopy[key].title = elem.title; }); - + var exportData = { monitorCharts: gridCopy, monitorSettings: monitorSettings }; var $form; - + $('body').append($form = $('<form method="post" action="file_echo.php?'+url_query+'&filename=1" style="display:none;"></form>')); - + $form.append('<input type="hidden" name="monitorconfig" value="' + encodeURI($.toJSON(exportData)) + '">'); $form.submit(); $form.remove(); @@ -1014,16 +1014,16 @@ $(function() { $('div#emptyDialog').attr('title','Import monitor configuration'); $('div#emptyDialog').html('Please select the file you want to import:<br/><form action="file_echo.php?'+url_query+'&import=1" method="post" enctype="multipart/form-data">'+ '<input type="file" name="file"> <input type="hidden" name="import" value="1"> </form>'); - + var dlgBtns = {}; - + dlgBtns[PMA_messages['strImport']] = function() { var $iframe, $form; $('body').append($iframe = $('<iframe id="monitorConfigUpload" style="display:none;"></iframe>')); var d = $iframe[0].contentWindow.document; d.open(); d.close(); mew = d; - + $iframe.load(function() { var json;
@@ -1037,14 +1037,14 @@ $(function() { $('div#emptyDialog').dialog('close'); return; } - + // Basic check, is this a monitor config json? if(!json || ! json.monitorCharts || ! json.monitorCharts) { alert(PMA_messages['strFailedParsingConfig']); $('div#emptyDialog').dialog('close'); return; } - + // If json ok, try applying config try { window.localStorage['monitorCharts'] = $.toJSON(json.monitorCharts); @@ -1057,20 +1057,20 @@ $(function() { window.localStorage.removeItem('monitorSettings'); rebuildGrid(); } - + $('div#emptyDialog').dialog('close'); }); - + $("body", d).append($form=$('div#emptyDialog').find('form')); $form.submit(); $('div#emptyDialog').append('<img class="ajaxIcon" src="' + pmaThemeImage + 'ajax_clock_small.gif" alt="">'); }; - + dlgBtns[PMA_messages['strCancel']] = function() { $(this).dialog('close'); } - - + + $('div#emptyDialog').dialog({ width: 'auto', height: 'auto', @@ -1211,8 +1211,8 @@ $(function() { } ); }; - - + + loadLogVars();
return false; @@ -1353,7 +1353,7 @@ $(function() { height: $('table#chartGrid tr:nth-child(2) td:nth-child(2)').offset().top - $('table#chartGrid tr:nth-child(1) td:nth-child(1)').offset().top } $('table#chartGrid').html(''); - + /* Add all charts - in correct order */ var keys = []; $.each(runtime.charts, function(key, value) { @@ -1372,11 +1372,11 @@ $(function() {
// Empty cells should keep their size so you can drop onto them $('table#chartGrid tr td').css('width',chartSize().width + 'px'); - + buildRequiredDataList(); refreshChartGrid(); } - + function destroyGrid() { if(runtime.charts) $.each(runtime.charts, function(key, value) { @@ -1387,17 +1387,17 @@ $(function() { try { runtime.refreshRequest.abort(); } catch(err) {} - try { + try { clearTimeout(runtime.refreshTimeout); } catch(err) {} - + $('table#chartGrid').html('');
runtime.charts = null; runtime.chartAI = 0; monitorSettings = null; } - + function rebuildGrid() { var oldData = null; if(runtime.charts) { @@ -1410,10 +1410,10 @@ $(function() { } }); } - + destroyGrid(); initGrid(); - + if(oldData) { $.each(runtime.charts, function(key, chartObj) { for(var j=0; j < chartObj.nodes.length; j++) { @@ -1421,7 +1421,7 @@ $(function() { chartObj.chart.series[j].setData(oldData[chartObj.nodes[j].dataPoint]); } }); - } + } }
function chartSize() { @@ -1475,7 +1475,7 @@ $(function() {
$(this).dialog("close"); }; - + dlgBtns[PMA_messages['strFromGeneralLog']] = function() { var dateStart = Date.parse($('#logAnalyseDialog input[name="dateStart"]').attr('value')) || min; var dateEnd = Date.parse($('#logAnalyseDialog input[name="dateEnd"]').attr('value')) || max; @@ -1492,7 +1492,7 @@ $(function() {
$(this).dialog("close"); }; - + $('#logAnalyseDialog').dialog({ width: 'auto', height: 'auto', @@ -1548,7 +1548,7 @@ $(function() {
chartObj.chart = PMA_createChart(settings); chartObj.numPoints = 0; - + if(initialize != true) { runtime.charts['c'+runtime.chartAI] = chartObj; buildRequiredDataList(); @@ -1563,7 +1563,7 @@ $(function() { function editChart(chartObj) { var htmlnode = chartObj.options.chart.renderTo; if(! htmlnode ) return; - + var chart=null; var chartKey=null; $.each(runtime.charts, function(key, value) { @@ -1573,33 +1573,33 @@ $(function() { return false; } }); - + if(chart == null) return; - - var htmlStr = '<p><b>Chart title: </b> <br/> <input type="text" size="35" name="chartTitle" value="' + chart.title + '" />'; + + var htmlStr = '<p><b>Chart title: </b> <br/> <input type="text" size="35" name="chartTitle" value="' + chart.title + '" />'; htmlStr += '</p><p><b>Series:</b> </p><ol>'; for(var i=0; i<chart.nodes.length; i++) { htmlStr += '<li><i>' + chart.nodes[i].dataPoint +': </i><br/><input type="text" name="chartSerie-' + i + '" value=" ' + chart.nodes[i].name + '" /></li>'; } - + dlgBtns = {}; dlgBtns['Save'] = function() { runtime.charts[chartKey].title = $('div#emptyDialog input[name="chartTitle"]').attr('value'); runtime.charts[chartKey].chart.setTitle({ text: runtime.charts[chartKey].title }); - + $('div#emptyDialog input[name*="chartSerie"]').each(function() { var idx = $(this).attr('name').split('-')[1]; runtime.charts[chartKey].nodes[idx].name = $(this).attr('value'); runtime.charts[chartKey].chart.series[idx].name = $(this).attr('value'); }); - + $(this).dialog('close'); saveMonitor(); }; dlgBtns['Cancel'] = function() { $(this).dialog('close'); }; - + $('div#emptyDialog').attr('title','Edit chart'); $('div#emptyDialog').html(htmlStr+'</ol>'); $('div#emptyDialog').dialog({ @@ -1608,11 +1608,11 @@ $(function() { buttons: dlgBtns }); } - + function removeChart(chartObj) { var htmlnode = chartObj.options.chart.renderTo; if(! htmlnode ) return; - + $.each(runtime.charts, function(key, value) { if(value.chart.options.chart.renderTo == htmlnode) { delete runtime.charts[key]; @@ -1643,7 +1643,7 @@ $(function() { } var value, i=0; var diff; - + /* Update values in each graph */ $.each(runtime.charts, function(orderKey, elem) { var key = elem.chartID; @@ -1673,12 +1673,12 @@ $(function() {
if(elem.nodes[j].transformFn) { value = chartValueTransform( - elem.nodes[j].transformFn, - chartData[key][j], + elem.nodes[j].transformFn, + chartData[key][j], (oldChartData == null ? null : oldChartData[key][j]) ); } - + if(value != undefined) elem.chart.series[j].addPoint( { x: chartData.x, y: value }, @@ -1699,7 +1699,7 @@ $(function() { runtime.refreshTimeout = setTimeout(refreshChartGrid, monitorSettings.gridRefresh); }); } - + function chartValueTransform(name,cur,prev) { switch(name) { case 'cpu-linux': @@ -1731,7 +1731,7 @@ $(function() { opts.removeVariables = false; if(! opts.limitTypes) opts.limitTypes = false; - + $('#emptyDialog').html(PMA_messages['strAnalysingLogs'] + ' <img class="ajaxIcon" src="' + pmaThemeImage + 'ajax_clock_small.gif" alt="">');
$('#emptyDialog').dialog({ @@ -1757,14 +1757,14 @@ $(function() { removeVariables: opts.removeVariables, limitTypes: opts.limitTypes }, - function(data) { + function(data) { var logData; try { logData = $.parseJSON(data); } catch(err) { return serverResponseError(); } - + if(logData.rows.length != 0) { runtime.logDataCols = buildLogTable(logData);
@@ -1813,17 +1813,17 @@ $(function() { $(this).dialog("close"); $(document).scrollTop($('div#logTable').offset().top); }; - + $('#emptyDialog').dialog( "option", "buttons", dlgBtns); - + } else { $('#emptyDialog').html('<p>' + PMA_messages['strNoDataFound'] + '</p>'); - + var dlgBtns = {}; - dlgBtns[PMA_messages['strClose']] = function() { - $(this).dialog("close"); + dlgBtns[PMA_messages['strClose']] = function() { + $(this).dialog("close"); }; - + $('#emptyDialog').dialog( "option", "buttons", dlgBtns ); } } @@ -1835,7 +1835,7 @@ $(function() {
if(val.length == 0) textFilter = null; else textFilter = new RegExp(val, 'i'); - + var rowSum = 0, totalSum = 0, i=0, q; var noVars = $('div#logTable input#noWHEREData').attr('checked'); var equalsFilter = /([^=]+)=(\d+|(('|"|).*?[^\])\4((\s+)|$))/gi; @@ -1845,10 +1845,10 @@ $(function() { var hide = false, rowData; var queryColumnName = runtime.logDataCols[runtime.logDataCols.length - 2]; var sumColumnName = runtime.logDataCols[runtime.logDataCols.length - 1]; - + var isSlowLog = opts.src == 'slow'; var columnSums = {}; - + var countRow = function(query, row) { var cells = row.match(/<td>(.*?)</td>/gi); if(!columnSums[query]) columnSums[query] = [0,0,0,0]; @@ -1858,7 +1858,7 @@ $(function() { columnSums[query][2] += parseInt(cells[4].replace(/(<td>|</td>)/gi,'')); columnSums[query][3] += parseInt(cells[5].replace(/(<td>|</td>)/gi,'')); }; - + // We just assume the sql text is always in the second last column, and that the total count is right of it $('div#logTable table tbody tr td:nth-child(' + (runtime.logDataCols.length - 1) + ')').each(function() { if(varFilterChange && $(this).html().match(/^SELECT/i)) { @@ -1877,11 +1877,11 @@ $(function() { $(this).text(q); } if(isSlowLog) countRow(q, $(this).parent().html()); - + // Restore original columns } else { rowData = $(this).parent().data('query'); - + // SQL Text $(this).text(rowData[queryColumnName]); // # @@ -1918,18 +1918,18 @@ $(function() { hide = false; i++; }); - + // Update count values of grouped entries if(varFilterChange) { if(noVars) { var numCol, row, $table = $('div#logTable table tbody'); $.each(filteredQueriesLines, function(key,value) { if(filteredQueries[key] <= 1) return; - + row = $table.children('tr:nth-child(' + (value+1) + ')'); numCol = row.children(':nth-child(' + (runtime.logDataCols.length) + ')'); numCol.text(filteredQueries[key]); - + if(isSlowLog) { row.children('td:nth-child(3)').text(secToTime(columnSums[key][0])); row.children('td:nth-child(4)').text(secToTime(columnSums[key][1])); @@ -1938,9 +1938,9 @@ $(function() { } }); } - - $('div#logTable table').trigger("update"); - setTimeout(function() { + + $('div#logTable table').trigger("update"); + setTimeout(function() { $('div#logTable table').trigger('sorton',[[[runtime.logDataCols.length - 1,1]]]); }, 0); } @@ -1959,25 +1959,25 @@ $(function() { removeVariables: true, limitTypes: true });*/ - + function timeToSec(timeStr) { var time = timeStr.split(':'); return parseInt(time[0]*3600) + parseInt(time[1]*60) + parseInt(time[2]); } - + function secToTime(timeInt) { hours = Math.floor(timeInt / 3600); timeInt -= hours*3600; minutes = Math.floor(timeInt / 60); timeInt -= minutes*60; - + if(hours < 10) hours = '0' + hours; if(minutes < 10) minutes = '0' + minutes; if(timeInt < 10) timeInt = '0' + timeInt; - + return hours + ':' + minutes + ':' + timeInt; } - + function buildLogTable(data) { var rows = data.rows; var cols = new Array(); @@ -1993,7 +1993,7 @@ $(function() { } return value; }; - + for(var i=0; i < rows.length; i++) { if(i == 0) { $.each(rows[0],function(key, value) { @@ -2035,9 +2035,9 @@ $(function() { - Any string appearance containing a MySQL Keyword, surrounded by whitespaces, e.g. WHERE bar = "This where the formatter fails" - Subqueries too probably */ - + // Matches the columns to be selected - // .* selector doesn't include whitespace and we have no PCRE_DOTALL modifier, (.|\s)+ crashes Chrome (reported and confirmed), + // .* selector doesn't include whitespace and we have no PCRE_DOTALL modifier, (.|\s)+ crashes Chrome (reported and confirmed), // [^]+ results in JS error in IE8, thus we use [^\0]+ for matching each column since the zero-byte char (hopefully) doesn't appear in column names ;) var sLists = query.match(/SELECT\s+[^\0]+\s+FROM\s+/gi); if(sLists) { @@ -2080,7 +2080,7 @@ $(function() { // Float sux, I'll use table :( $('div#queryAnalyzerDialog div.placeHolder') .html('<table width="100%" border="0"><tr><td class="explain"></td><td class="chart"></td></tr></table>'); - + var explain = '<b>Explain output</b> '+explain_docu; if(data.explain.length > 1) { explain += ' ('; @@ -2095,25 +2095,25 @@ $(function() { explain += '<div class="explain-' + i + '"' + (i>0? 'style="display:none;"' : '' ) + '>'; $.each(data.explain[i], function(key,value) { value = (value==null)?'null':value; - + if(key == 'type' && value.toLowerCase() == 'all') value = '<span class="attention">' + value +'</span>'; if(key == 'Extra') value = value.replace(/(using (temporary|filesort))/gi,'<span class="attention">$1</span>'); explain += key+': ' + value + '<br />'; }); explain += '</div>'; } - + // Since there is such a nice free space below the explain, lets put it here for now explain += '<p><b>' + PMA_messages['strAffectedRows'] + '</b> ' + data.affectedRows;
$('div#queryAnalyzerDialog div.placeHolder td.explain').append(explain); - + $('div#queryAnalyzerDialog div.placeHolder a[href*="#showExplain"]').click(function() { var id = $(this).attr('href').split('-')[1]; $(this).parent().find('div[class*="explain"]').hide(); $(this).parent().find('div[class*="explain-' + id + '"]').show(); }); - + if(data.profiling) { var chartData = []; var numberTable = '<table class="queryNums"><thead><tr><th>Status</th><th>Time</th></tr></thead><tbody>'; @@ -2129,9 +2129,9 @@ $(function() { } numberTable += '<tr><td><b>Total time:</b></td><td>' + PMA_prettyProfilingNum(totalTime,2) + '</td></tr>'; numberTable += '</tbody></table>'; - + $('div#queryAnalyzerDialog div.placeHolder td.chart').append('<b>Profiling results ' + profiling_docu + '</b> (<a href="#showNums">Table</a>, <a href="#showChart">Chart</a>)<br/>' + numberTable + ' <div id="queryProfiling"></div>'); - + $('div#queryAnalyzerDialog div.placeHolder a[href="#showNums"]').click(function() { $('div#queryAnalyzerDialog div#queryProfiling').hide(); $('div#queryAnalyzerDialog table.queryNums').show(); @@ -2230,7 +2230,7 @@ $(function() { }; $('#emptyDialog').attr('title',PMA_messages['strRefreshFailed']); $('#emptyDialog').html('<img class="icon ic_s_attention" src="themes/dot.gif" alt=""> ' + PMA_messages['strInvalidResponseExplanation']) - $('#emptyDialog').dialog({ buttons: btns }); + $('#emptyDialog').dialog({ buttons: btns }); } - + });
hooks/post-receive