From 54623503e47d0cd7c2840d40fffcb7e490f73c77 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sun, 24 Mar 2013 20:50:40 +0530 Subject: [PATCH 1/2] bug #3703 Incorrect updating of the list of users --- ChangeLog | 1 + js/server_privileges.js | 22 ++++++++++++++++++++++ libraries/server_privileges.lib.php | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a8a1f15813..44db2cedb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -99,6 +99,7 @@ underscore + Remove the database ordering sub-feature of the only_db directive - bug #3840 When exporting to gzip format, the data is compressed 2 times + rfe #1319 Permit to create index when creating foreign key +- bug #3703 Incorrect updating of the list of users 3.5.8.0 (not yet released) - bug #3828 MariaDB reported as MySQL diff --git a/js/server_privileges.js b/js/server_privileges.js index 19c907b30f..935b94dc16 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -375,6 +375,23 @@ AJAX.registerOnload('server_privileges.js', function() { */ var curr_submit_value = $t.find('.tblFooters').find('input:submit').val(); + // If any option other than 'keep the old one'(option 4) is chosen, we need to remove + // the old one from the table. + var $row_to_remove; + if ( curr_submit_name == 'change_copy' + && $('input[name=mode]:checked', '#fieldset_mode').val() != '4') { + var old_username = $t.find('input[name="old_username"]').val(); + var old_hostname = $t.find('input[name="old_hostname"]').val(); + $('#usersForm tbody tr').each(function() { + var $tr = $(this); + if ($tr.find('td:nth-child(2) label').text() == old_username + && $tr.find('td:nth-child(3)').text() == old_hostname ) { + $row_to_remove = $tr; + return false; + } + }); + } + $.post($t.attr('action'), $t.serialize() + '&' + curr_submit_name + '=' + curr_submit_value, function(data) { if (data.success == true) { $('#page_content').show(); @@ -394,6 +411,11 @@ AJAX.registerOnload('server_privileges.js', function() { } } //Show SQL Query that was executed + // Remove the old row if the old user is deleted + if ($row_to_remove != null) { + $row_to_remove.remove(); + } + //Append new user if necessary if (data.new_user_string) { appendNewUser(data.new_user_string, data.new_user_initial, data.new_user_initial_string); diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index 4f2d0711ae..d0cc5bb421 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -1937,7 +1937,7 @@ function PMA_getChangeLoginInformationHtmlForm($username, $hostname) . '' . "\n" . PMA_getHtmlForDisplayLoginInformationFields('change'); - $html_output .= '
' . "\n" + $html_output .= '
' . "\n" . ' ' . __('Create a new user with the same privileges and …') . '' . "\n"; From 91791397531e2b5c9d24226820ee5ecd97c7a03c Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sun, 24 Mar 2013 20:53:12 +0530 Subject: [PATCH 2/2] Remove extra spaces --- js/server_privileges.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/server_privileges.js b/js/server_privileges.js index 935b94dc16..f6c05999f1 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -378,14 +378,14 @@ AJAX.registerOnload('server_privileges.js', function() { // If any option other than 'keep the old one'(option 4) is chosen, we need to remove // the old one from the table. var $row_to_remove; - if ( curr_submit_name == 'change_copy' + if (curr_submit_name == 'change_copy' && $('input[name=mode]:checked', '#fieldset_mode').val() != '4') { var old_username = $t.find('input[name="old_username"]').val(); var old_hostname = $t.find('input[name="old_hostname"]').val(); $('#usersForm tbody tr').each(function() { var $tr = $(this); if ($tr.find('td:nth-child(2) label').text() == old_username - && $tr.find('td:nth-child(3)').text() == old_hostname ) { + && $tr.find('td:nth-child(3)').text() == old_hostname) { $row_to_remove = $tr; return false; }