diff --git a/ChangeLog b/ChangeLog index 319658a732..3cd0d8f326 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,10 +40,12 @@ phpMyAdmin - ChangeLog + [interface] Improved support for triggers + [interface] Improved server monitoring + AJAX for table Structure column Add ++ AJAX for table Operations copy table 3.4.5.0 (not yet released) - bug #3375325 [interface] Page list in navigation frame looks odd - bug #3313235 [interface] Error div misplaced +- bug #3374802 [interface] Comment on a column breaks inline editing 3.4.4.0 (not yet released) - bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes diff --git a/js/functions.js b/js/functions.js index bbe00b51d3..287195dcce 100644 --- a/js/functions.js +++ b/js/functions.js @@ -211,9 +211,10 @@ function confirmLink(theLink, theSqlQuery) var is_confirmed = confirm(PMA_messages['strDoYouReally'] + ' :\n' + theSqlQuery); if (is_confirmed) { if ( $(theLink).hasClass('formLinkSubmit') ) { - var name = 'is_js_confirmed'; - if($(theLink).attr('href').indexOf('usesubform') != -1) - name = 'subform[' + $(theLink).attr('href').substr('#').match(/usesubform\[(\d+)\]/i)[1] + '][is_js_confirmed]'; + var name = 'is_js_confirmed'; + if ($(theLink).attr('href').indexOf('usesubform') != -1) { + name = 'subform[' + $(theLink).attr('href').substr('#').match(/usesubform\[(\d+)\]/i)[1] + '][is_js_confirmed]'; + } $(theLink).parents('form').append(''); } else if ( typeof(theLink.href) != 'undefined' ) { @@ -596,7 +597,7 @@ $(document).ready(function() { * next pages reached via AJAX); a tr may have the class noclick to remove * this behavior. */ - $('tr.odd:not(.noclick), tr.even:not(.noclick)').live('click',function(e) { + $('table:not(.noclick) tr.odd:not(.noclick), table:not(.noclick) tr.even:not(.noclick)').live('click',function(e) { // do not trigger when clicked on anchor if ($(e.target).is('a, img, a *')) { return; @@ -848,10 +849,11 @@ function insertValueQuery() { var chaineAj = ""; var NbSelect = 0; for(var i=0; i 1) + if (NbSelect > 1) { chaineAj += ", "; + } chaineAj += myListBox.options[i].value; } } @@ -1139,12 +1141,14 @@ function pdfPaperSize(format, axis) { function popupBSMedia(url_params, bs_ref, m_type, is_cust_type, w_width, w_height) { // if width not specified, use default - if (w_width == undefined) + if (w_width == undefined) { w_width = 640; + } // if height not specified, use default - if (w_height == undefined) + if (w_height == undefined) { w_height = 480; + } // open popup window (for displaying video/playing audio) var mediaWin = window.open('bs_play_media.php?' + url_params + '&bs_reference=' + bs_ref + '&media_type=' + m_type + '&custom_type=' + is_cust_type, 'viewBSMedia', 'width=' + w_width + ', height=' + w_height + ', resizable=1, scrollbars=1, status=0'); @@ -1161,15 +1165,17 @@ function popupBSMedia(url_params, bs_ref, m_type, is_cust_type, w_width, w_heigh function requestMIMETypeChange(db, table, reference, current_mime_type) { // no mime type specified, set to default (nothing) - if (undefined == current_mime_type) + if (undefined == current_mime_type) { current_mime_type = ""; + } // prompt user for new mime type var new_mime_type = prompt("Enter custom MIME type", current_mime_type); // if new mime_type is specified and is not the same as the previous type, request for mime type change - if (new_mime_type && new_mime_type != current_mime_type) + if (new_mime_type && new_mime_type != current_mime_type) { changeMIMEType(db, table, reference, new_mime_type); + } } /** @@ -1470,8 +1476,11 @@ function PMA_createChart(passedSettings) { return; } - if(lastValue==null) diff = curValue.x - thisChart.xAxis[0].getExtremes().max; - else diff = parseInt(curValue.x - lastValue.x); + if (lastValue==null) { + diff = curValue.x - thisChart.xAxis[0].getExtremes().max; + } else { + diff = parseInt(curValue.x - lastValue.x); + } thisChart.xAxis[0].setExtremes( thisChart.xAxis[0].getExtremes().min+diff, @@ -1485,7 +1494,9 @@ function PMA_createChart(passedSettings) { 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, @@ -1537,11 +1548,13 @@ function PMA_createChart(passedSettings) { /* Set/Get realtime chart default values */ if(passedSettings.realtime) { - if(!passedSettings.realtime.refreshRate) + if(!passedSettings.realtime.refreshRate) { passedSettings.realtime.refreshRate = 5000; + } - if(!passedSettings.realtime.numMaxPoints) + if(!passedSettings.realtime.numMaxPoints) { passedSettings.realtime.numMaxPoints = 30; + } // 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); @@ -1597,10 +1610,15 @@ function PMA_createProfilingChart(data, options) { // Formats a profiling duration nicely. Used in PMA_createProfilingChart() and server_status.js function PMA_prettyProfilingNum(num, acc) { - if(!acc) acc = 1; + if (!acc) { + acc = 1; + } acc = Math.pow(10,acc); - if(num*1000 < 0.1) num = Math.round(acc*(num*1000*1000))/acc + 'µ' - else if(num < 0.1) num = Math.round(acc*(num*1000))/acc + 'm' + if (num*1000 < 0.1) { + num = Math.round(acc*(num*1000*1000))/acc + 'µ' + } else if (num < 0.1) { + num = Math.round(acc*(num*1000))/acc + 'm' + } return num + 's'; } @@ -1954,6 +1972,9 @@ $(document).ready(function() { if ($("#sqlqueryresults").length != 0) { $("#sqlqueryresults").remove(); } + if ($("#result_query").length != 0) { + $("#result_query").remove(); + } if (data.success == true) { PMA_ajaxShowMessage(data.message); $("
").insertAfter("#topmenucontainer"); @@ -1961,10 +1982,57 @@ $(document).ready(function() { $("#result_query .notice").remove(); $("#result_query").prepend((data.message)); } else { - PMA_ajaxShowMessage(data.error); + $temp_div = $("
") + $temp_div.html(data.error); + $error = $temp_div.find("code").addClass("error"); + PMA_ajaxShowMessage($error); } }) // end $.post() });//end of alterTableOrderby ajax submit + + /** + *Ajax action for submitting the "Copy table" + **/ + $("#copyTable.ajax input[name='submit_copy']").live('click', function(event) { + event.preventDefault(); + $form = $("#copyTable"); + if($form.find("input[name='switch_to_new']").attr('checked')) { + $form.append(''); + $form.removeClass('ajax'); + $form.find("#ajax_request_hidden").remove(); + $form.submit(); + } else { + PMA_prepareForAjaxRequest($form); + /*variables which stores the common attributes*/ + $.post($form.attr('action'), $form.serialize()+"&submit_copy=Go", function(data) { + if ($("#sqlqueryresults").length != 0) { + $("#sqlqueryresults").remove(); + } + if ($("#result_query").length != 0) { + $("#result_query").remove(); + } + if (data.success == true) { + PMA_ajaxShowMessage(data.message); + $("
").insertAfter("#topmenucontainer"); + $("#sqlqueryresults").html(data.sql_query); + $("#result_query .notice").remove(); + $("#result_query").prepend((data.message)); + $("#copyTable").find("select[name='target_db'] option[value="+data.db+"]").attr('selected', 'selected'); + + //Refresh navigation frame when the table is coppied + if (window.parent && window.parent.frame_navigation) { + window.parent.frame_navigation.location.reload(); + } + } else { + $temp_div = $("
") + $temp_div.html(data.error); + $error = $temp_div.find("code").addClass("error"); + PMA_ajaxShowMessage($error); + } + }) // end $.post() + } + });//end of copyTable ajax submit + }, 'top.frame_content'); //end $(document).ready for 'Table operations' diff --git a/js/server_synchronize.js b/js/server_synchronize.js index 1dfd3d2387..2cc03652fe 100644 --- a/js/server_synchronize.js +++ b/js/server_synchronize.js @@ -33,17 +33,17 @@ function showDetails(i, update_size, insert_size, remove_size, insert_index, rem // The image source is changed when the showDetails function is called. if ($img.hasClass('selected')) { if ($img.hasClass('struct_img')) { - $img.attr('src', pmaThemeImage + 'new_struct_selected.jpg'); + $img.attr('src', pmaThemeImage + 'new_struct_selected.png'); } if ($img.hasClass('data_img')) { - $img.attr('src', pmaThemeImage + 'new_data_selected.jpg'); + $img.attr('src', pmaThemeImage + 'new_data_selected.png'); } } else { if ($img.hasClass('struct_img')) { - $img.attr('src', pmaThemeImage + 'new_struct.jpg'); + $img.attr('src', pmaThemeImage + 'new_struct.png'); } if ($img.hasClass('data_img')) { - $img.attr('src', pmaThemeImage + 'new_data.jpg'); + $img.attr('src', pmaThemeImage + 'new_data.png'); } } @@ -347,9 +347,9 @@ $(document).ready(function() { var $img = $(this); $img.addClass('hover'); if ($img.hasClass('selected')) { - $img.attr('src', pmaThemeImage + 'new_struct_selected_hovered.jpg'); + $img.attr('src', pmaThemeImage + 'new_struct_selected_hovered.png'); } else { - $img.attr('src', pmaThemeImage + 'new_struct_hovered.jpg'); + $img.attr('src', pmaThemeImage + 'new_struct_hovered.png'); } }, function() { @@ -357,9 +357,9 @@ $(document).ready(function() { var $img = $(this); $img.removeClass('hover'); if ($img.hasClass('selected')) { - $img.attr('src', pmaThemeImage + 'new_struct_selected.jpg'); + $img.attr('src', pmaThemeImage + 'new_struct_selected.png'); } else { - $img.attr('src', pmaThemeImage + 'new_struct.jpg'); + $img.attr('src', pmaThemeImage + 'new_struct.png'); } } ); @@ -370,9 +370,9 @@ $(document).ready(function() { var $img = $(this); $img.addClass('hover'); if ($img.hasClass('selected')) { - $img.attr('src', pmaThemeImage + 'new_data_selected_hovered.jpg'); + $img.attr('src', pmaThemeImage + 'new_data_selected_hovered.png'); } else { - $img.attr('src', pmaThemeImage + 'new_data_hovered.jpg'); + $img.attr('src', pmaThemeImage + 'new_data_hovered.png'); } }, function() { @@ -380,9 +380,9 @@ $(document).ready(function() { var $img = $(this); $img.removeClass('hover'); if ($img.hasClass('selected')) { - $img.attr('src', pmaThemeImage + 'new_data_selected.jpg'); + $img.attr('src', pmaThemeImage + 'new_data_selected.png'); } else { - $img.attr('src', pmaThemeImage + 'new_data.jpg'); + $img.attr('src', pmaThemeImage + 'new_data.png'); } } ); diff --git a/libraries/common.lib.php b/libraries/common.lib.php index e86046148d..64a8b4a887 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1183,7 +1183,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view // in the tools div, only display the Inline link when not in ajax // mode because 1) it currently does not work and 2) we would // have two similar mechanisms on the page for the same goal - if ($is_select || $GLOBALS['is_ajax_request'] === false) { + if ($is_select || $GLOBALS['is_ajax_request'] === false && ! $query_too_big) { // see in js/functions.js the jQuery code attached to id inline_edit // document.write conflicts with jQuery, hence used $().append() echo "