From b1c12a0b7446f9a7293aa0a02d09382812742e07 Mon Sep 17 00:00:00 2001 From: Thilanka Kaushalya Date: Tue, 31 May 2011 23:15:24 +0530 Subject: [PATCH 1/8] Added Ajax behaviour to Add a new user in database privileges --- js/messages.php | 3 ++ js/server_privileges.js | 67 ++++++++++++++++++++++++++++++++--------- server_privileges.php | 49 +++++++++++++++++------------- 3 files changed, 83 insertions(+), 36 deletions(-) diff --git a/js/messages.php b/js/messages.php index a710260a59..03c92fec24 100644 --- a/js/messages.php +++ b/js/messages.php @@ -79,6 +79,9 @@ $js_messages['strCreateTable'] = __('Create Table'); $js_messages['strYes'] = __('Yes'); $js_messages['strNo'] = __('No'); +/* For db_stucture.js */ +$js_messages['strInsertTable'] = __('Insert Table'); + /* For db_search.js */ $js_messages['strSearching'] = __('Searching'); $js_messages['strHideSearchResults'] = __('Hide search results'); diff --git a/js/server_privileges.js b/js/server_privileges.js index 8b9c5e99c3..afe0c5b059 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -154,7 +154,7 @@ $(document).ready(function() { * * @see PMA_ajaxShowMessage() * @see appendNewUser() - * @see $cfg['AjaxEnable'] + * @see $cfg['AjaxEnable'] * @memberOf jQuery * @name add_user_click * @@ -191,14 +191,51 @@ $(document).ready(function() { .remove() .end() .after(data.sql_query); - + //Remove the empty notice div generated due to a NULL query passed to PMA_showMessage() var $notice_class = $("#topmenucontainer").next("div").find('.notice'); if($notice_class.text() == '') { $notice_class.remove(); } + if($('#fieldset_add_user a.ajax').attr('name') == 'db_specific'){ + /*process the topmenucontainer and get the href of privileges*/ + var url = $('#topmenucontainer').find('.tabactive').attr('href'); + if (url.substring(0, 22) == "server_privileges.php?") { + url = url.substring(22); + } + url = url +"&ajax_request=true"; + + /* post request for get the updated userForm table */ + $.post($form.attr('action'),url,function(mydata){ + + /*Remove the old userForm table*/ + if($('#userFormDiv').length != 0){ + $('#userFormDiv').remove(); + }else{ + $("#usersForm").remove(); + } + var user_div = $('
'); + /*If the jason string pared valiedly*/ + if(typeof mydata.success != 'undefined'){ + if(mydata.success == true){ + user_div + .html(mydata.user_form) + .insertAfter('#result_query'); + }else{ + PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : "+data.error, "7000"); + } + }else{ + /*parse the json string*/ + var obj = $.parseJSON(mydata); + user_div + .html(obj.user_form) + .insertAfter('#result_query'); + } + }); + }else{ appendNewUser(data.new_user_string, data.new_user_initial, data.new_user_initial_string); + } } else { PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : "+data.error, "7000"); } @@ -224,7 +261,7 @@ $(document).ready(function() { buttons: button_options }); //dialog options end displayPasswordGenerateButton(); - PMA_ajaxRemoveMessage($msgbox); + PMA_ajaxRemoveMessage($msgbox); }); // end $.get() });//end of Add New User AJAX event handler @@ -234,7 +271,7 @@ $(document).ready(function() { * Ajax event handler for 'Reload Privileges' anchor * * @see PMA_ajaxShowMessage() - * @see $cfg['AjaxEnable'] + * @see $cfg['AjaxEnable'] * @memberOf jQuery * @name reload_privileges_click */ @@ -258,7 +295,7 @@ $(document).ready(function() { * AJAX handler for 'Revoke User' * * @see PMA_ajaxShowMessage() - * @see $cfg['AjaxEnable'] + * @see $cfg['AjaxEnable'] * @memberOf jQuery * @name revoke_user_click */ @@ -268,7 +305,7 @@ $(document).ready(function() { PMA_ajaxShowMessage(PMA_messages['strRemovingSelectedUsers']); $form = $("#usersForm"); - + $.post($form.attr('action'), $form.serialize() + "&delete=" + $(this).attr('value') + "&ajax_request=true", function(data) { if(data.success == true) { PMA_ajaxShowMessage(data.message); @@ -309,7 +346,7 @@ $(document).ready(function() { * Step 1: Load Edit User Dialog * @memberOf jQuery * @name edit_user_click - * @see $cfg['AjaxEnable'] + * @see $cfg['AjaxEnable'] */ $(".edit_user_anchor.ajax").live('click', function(event) { /** @lends jQuery */ @@ -334,15 +371,15 @@ $(document).ready(function() { buttons: button_options }); //dialog options end displayPasswordGenerateButton(); - PMA_ajaxRemoveMessage($msgbox); + PMA_ajaxRemoveMessage($msgbox); }) // end $.get() }) /** * Step 2: Submit the Edit User Dialog - * + * * @see PMA_ajaxShowMessage() - * @see $cfg['AjaxEnable'] + * @see $cfg['AjaxEnable'] * @memberOf jQuery * @name edit_user_submit */ @@ -368,7 +405,7 @@ $(document).ready(function() { if(data.success == true) { PMA_ajaxShowMessage(data.message); - + //Close the jQueryUI dialog $("#edit_user_dialog").dialog("close").remove(); @@ -422,7 +459,7 @@ $(document).ready(function() { * AJAX handler for 'Export Privileges' * * @see PMA_ajaxShowMessage() - * @see $cfg['AjaxEnable'] + * @see $cfg['AjaxEnable'] * @memberOf jQuery * @name export_user_click */ @@ -445,7 +482,7 @@ $(document).ready(function() { width : 500, buttons: button_options }); - PMA_ajaxRemoveMessage($msgbox); + PMA_ajaxRemoveMessage($msgbox); }) //end $.get }) //end export privileges @@ -453,7 +490,7 @@ $(document).ready(function() { * AJAX handler to Paginate the Users Table * * @see PMA_ajaxShowMessage() - * @see $cfg['AjaxEnable'] + * @see $cfg['AjaxEnable'] * @name paginate_users_table_click * @memberOf jQuery */ @@ -476,7 +513,7 @@ $(document).ready(function() { })// end of the paginate users table /* - * Additional confirmation dialog after clicking + * Additional confirmation dialog after clicking * 'Drop the databases...' */ $('#checkbox_drop_users_db').click(function() { diff --git a/server_privileges.php b/server_privileges.php index ec2f0a7d79..dac37456d4 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -2140,7 +2140,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs . '' . "\n"; } else { // check the privileges for a particular database. - echo '
' . "\n" + $user_form = '
' . "\n" . '' . "\n" + $user_form .= ' ' . "\n" . ' 1) { - echo ' rowspan="' . count($current_privileges) . '"'; + $user_form .= ' rowspan="' . count($current_privileges) . '"'; } - echo '>' . (empty($current_user) ? '' . __('Any') . '' : htmlspecialchars($current_user)) . "\n" + $user_form .= '>' . (empty($current_user) ? '' . __('Any') . '' : htmlspecialchars($current_user)) . "\n" . ' ' . "\n" . ' 1) { - echo ' rowspan="' . count($current_privileges) . '"'; + $user_form .= ' rowspan="' . count($current_privileges) . '"'; } - echo '>' . htmlspecialchars($current_host) . '' . "\n"; + $user_form .= '>' . htmlspecialchars($current_host) . '' . "\n"; foreach ($current_privileges as $current) { - echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n" + $user_form .= '' . "\n" . ' ' . "\n"; } if (empty($row) && empty($row1) && empty($row2)) { @@ -2281,21 +2281,28 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs $odd_row = ! $odd_row; } } else { - echo ' ' . "\n" + $user_form .= ' ' . "\n" . ' ' . "\n" . ' ' . "\n"; } - echo '' . "\n" + $user_form .= '' . "\n" . '
' . "\n" . PMA_getIcon('b_usrcheck.png') . ' ' . sprintf(__('Users having access to "%s"'), '' . htmlspecialchars($checkprivs) . '') . "\n" @@ -2235,29 +2235,29 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs $current_privileges[] = $row; $row = PMA_DBI_fetch_assoc($res); } - echo '
' . "\n" + $user_form .= ' ' . "\n" . ' '; if (! isset($current['Db']) || $current['Db'] == '*') { - echo __('global'); + $user_form .= __('global'); } elseif ($current['Db'] == PMA_escape_mysql_wildcards($checkprivs)) { - echo __('database-specific'); + $user_form .= __('database-specific'); } else { - echo __('wildcard'), ': ' . htmlspecialchars($current['Db']) . ''; + $user_form .= __('wildcard'). ': ' . htmlspecialchars($current['Db']) . ''; } - echo "\n" + $user_form .= "\n" . ' ' . "\n" . ' ' . "\n" @@ -2268,11 +2268,11 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs . ' ' . ($current['Grant_priv'] == 'Y' ? __('Yes') : __('No')) . "\n" . ' ' . "\n"; - printf($link_edit, urlencode($current_user), + $user_form .= sprintf($link_edit, urlencode($current_user), urlencode($current_host), urlencode(! isset($current['Db']) || $current['Db'] == '*' ? '' : $current['Db']), ''); - echo '
' . "\n" . ' ' . __('No user found.') . "\n" . '
' . "\n"; - // Offer to create a new user for the current database - echo '
' . "\n" - . ' ' . "\n" - . PMA_getIcon('b_usradd.png') - . ' ' . __('Add a new User') . '' . "\n" - . '
' . "\n"; + if($GLOBALS['is_ajax_request'] == true){ + $extra_data['user_form'] = $user_form; + $message = PMA_Message::success(__('New user has been added.')); + PMA_ajaxResponse($message, $message->isSuccess(), $extra_data); + }else{ + // Offer to create a new user for the current database + $user_form .= '
' . "\n" + . ' ' . "\n" + . PMA_getIcon('b_usradd.png') + . ' ' . __('Add a new User') . '' . "\n" + . '
' . "\n"; + echo $user_form ; + } } // end if (empty($_REQUEST['adduser']) && empty($checkprivs)) ... elseif ... else ... From 344f7a57d389679e9abac713f33eb7e44ab11604 Mon Sep 17 00:00:00 2001 From: Thilanka Kaushalya Date: Wed, 1 Jun 2011 21:41:36 +0530 Subject: [PATCH 2/8] Message undifined bug fixed in add new user to server privileges --- js/server_privileges.js | 14 +++++++------- server_privileges.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/js/server_privileges.js b/js/server_privileges.js index d27a9b2dda..adb459756d 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -204,10 +204,10 @@ $(document).ready(function() { if (url.substring(0, 22) == "server_privileges.php?") { url = url.substring(22); } - url = url +"&ajax_request=true"; + url = url +"&ajax_request=true&db_specific=true"; /* post request for get the updated userForm table */ - $.post($form.attr('action'),url,function(mydata){ + $.post($form.attr('action'),url,function(priv_data){ /*Remove the old userForm table*/ if($('#userFormDiv').length != 0){ @@ -217,17 +217,17 @@ $(document).ready(function() { } var user_div = $('
'); /*If the jason string pared valiedly*/ - if(typeof mydata.success != 'undefined'){ - if(mydata.success == true){ + if(typeof priv_data.success != 'undefined'){ + if(priv_data.success == true){ user_div - .html(mydata.user_form) + .html(priv_data.user_form) .insertAfter('#result_query'); }else{ - PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : "+data.error, "7000"); + PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : "+priv_data.error, "7000"); } }else{ /*parse the json string*/ - var obj = $.parseJSON(mydata); + var obj = $.parseJSON(priv_data); user_div .html(obj.user_form) .insertAfter('#result_query'); diff --git a/server_privileges.php b/server_privileges.php index f35e246f38..3e0809df61 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -1358,7 +1358,7 @@ $link_export = ' Date: Sat, 4 Jun 2011 23:13:39 +0530 Subject: [PATCH 4/8] Fixed the bug at add user in db ckeck privileges --- js/server_privileges.js | 12 +++++------- server_privileges.php | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/js/server_privileges.js b/js/server_privileges.js index 7170f0f2d5..0343aab861 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -199,13 +199,11 @@ $(document).ready(function() { } if($('#fieldset_add_user a.ajax').attr('name') == 'db_specific'){ - /*process the topmenucontainer and get the href of privileges*/ - var url = $('#topmenucontainer').find('.tabactive').attr('href'); - if (url.substring(0, 22) == "server_privileges.php?") { - url = url.substring(22); - } - if(url.substring(url.length-16,url.length) == "&viewing_mode=db"){ - url = url.substring(0, url.length-16); + /*process the fieldset_add_user attribute and get the val of privileges*/ + var url = $('#fieldset_add_user a.ajax').attr('val'); + + if(url.substring(url.length-23,url.length) == "&goto=db_operations.php"){ + url = url.substring(0, url.length-23); } url = url +"&ajax_request=true&db_specific=true"; diff --git a/server_privileges.php b/server_privileges.php index 3e0809df61..13ee074ec9 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -2297,7 +2297,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs }else{ // Offer to create a new user for the current database $user_form .= '
' . "\n" - . ' ' . "\n" + . ' ' . "\n" . PMA_getIcon('b_usradd.png') . ' ' . __('Add a new User') . '' . "\n" . '
' . "\n"; From b9c0f5b01a9f60a2dd5c307e8810f3d478313a75 Mon Sep 17 00:00:00 2001 From: Thilanka Kaushalya Date: Sun, 5 Jun 2011 07:57:52 +0530 Subject: [PATCH 5/8] Modified the indentation of the sever privileges js --- js/server_privileges.js | 94 ++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/js/server_privileges.js b/js/server_privileges.js index 0343aab861..8df224062e 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -176,14 +176,14 @@ $(document).ready(function() { */ var $form = $(this).find("form[name=usersForm]").last(); - if( ! checkAddUser($form.get(0)) ) { - PMA_ajaxShowMessage(PMA_messages['strFormEmpty']); + if ( ! checkAddUser($form.get(0)) ) { + PMA_ajaxShowMessage( PMA_messages['strFormEmpty'] ); return false; } //We also need to post the value of the submit button in order to get this to work correctly - $.post($form.attr('action'), $form.serialize() + "&adduser_submit=" + $(this).find("input[name=adduser_submit]").attr('value'), function(data) { - if(data.success == true) { + $.post( $form.attr('action'), $form.serialize() + "&adduser_submit=" + $(this).find("input[name=adduser_submit]").attr('value'), function( data ) { + if ( data.success == true ) { $("#add_user_dialog").dialog("close").remove(); PMA_ajaxShowMessage(data.message); $("#topmenucontainer") @@ -192,61 +192,61 @@ $(document).ready(function() { .end() .after(data.sql_query); - //Remove the empty notice div generated due to a NULL query passed to PMA_showMessage() - var $notice_class = $("#topmenucontainer").next("div").find('.notice'); - if($notice_class.text() == '') { + //Remove the empty notice div generated due to a NULL query passed to PMA_showMessage() + var $notice_class = $("#topmenucontainer").next("div").find('.notice'); + if ( $notice_class.text() == '' ) { $notice_class.remove(); - } - if($('#fieldset_add_user a.ajax').attr('name') == 'db_specific'){ + } + if ( $('#fieldset_add_user a.ajax').attr('name') == 'db_specific' ) { - /*process the fieldset_add_user attribute and get the val of privileges*/ - var url = $('#fieldset_add_user a.ajax').attr('val'); + /*process the fieldset_add_user attribute and get the val of privileges*/ + var url = $('#fieldset_add_user a.ajax').attr('val'); - if(url.substring(url.length-23,url.length) == "&goto=db_operations.php"){ - url = url.substring(0, url.length-23); - } - url = url +"&ajax_request=true&db_specific=true"; + if ( url.substring( url.length - 23, url.length ) == "&goto=db_operations.php" ) { + url = url.substring( 0, url.length - 23 ); + } + url = url + "&ajax_request=true&db_specific=true"; - /* post request for get the updated userForm table */ - $.post($form.attr('action'),url,function(priv_data){ + /* post request for get the updated userForm table */ + $.post( $form.attr('action' ), url, function( priv_data ) { - /*Remove the old userForm table*/ - if($('#userFormDiv').length != 0){ - $('#userFormDiv').remove(); - }else{ + /*Remove the old userForm table*/ + if ( $('#userFormDiv').length != 0 ) { + $('#userFormDiv').remove(); + } else { $("#usersForm").remove(); - } - var user_div = $('
'); - /*If the jason string pared valiedly*/ - if(typeof priv_data.success != 'undefined'){ - if(priv_data.success == true){ - user_div - .html(priv_data.user_form) - .insertAfter('#result_query'); - }else{ - PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : "+priv_data.error, "7000"); - } - }else{ - /*parse the json string*/ - var obj = $.parseJSON(priv_data); - user_div - .html(obj.user_form) - .insertAfter('#result_query'); } - }); - }else{ - appendNewUser(data.new_user_string, data.new_user_initial, data.new_user_initial_string); - } + var user_div = $('
'); + /*If the jason string pared valiedly*/ + if ( typeof priv_data.success != 'undefined' ) { + if ( priv_data.success == true ) { + user_div + .html( priv_data.user_form ) + .insertAfter('#result_query'); + } else { + PMA_ajaxShowMessage( PMA_messages['strErrorProcessingRequest'] + " : " + priv_data.error, "7000" ); + } + } else { + /*parse the json string*/ + var obj = $.parseJSON( priv_data ); + user_div + .html( obj.user_form ) + .insertAfter('#result_query'); + } + }); + } else { + appendNewUser( data.new_user_string, data.new_user_initial, data.new_user_initial_string ); + } } else { - PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : "+data.error, "7000"); + PMA_ajaxShowMessage( PMA_messages['strErrorProcessingRequest'] + " : " + data.error, "7000"); } }) }; - button_options[PMA_messages['strCancel']] = function() {$(this).dialog("close").remove();} + button_options[PMA_messages['strCancel']] = function() { $(this).dialog("close").remove(); } - $.get($(this).attr("href"), {'ajax_request':true}, function(data) { + $.get( $(this).attr("href"), {'ajax_request':true}, function( data ) { $('
') - .prepend(data) + .prepend( data ) .find("#fieldset_add_user_footer").hide() //showing the "Go" and "Create User" buttons together will confuse the user .end() .find("form[name=usersForm]").append('') @@ -262,7 +262,7 @@ $(document).ready(function() { buttons: button_options }); //dialog options end displayPasswordGenerateButton(); - PMA_ajaxRemoveMessage($msgbox); + PMA_ajaxRemoveMessage( $msgbox ); }); // end $.get() });//end of Add New User AJAX event handler From a7a20980067c9c9dc436e59129cb420d0badafa3 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 5 Jun 2011 05:40:55 -0400 Subject: [PATCH 6/8] - ChangeLog entry for "AJAX for Add a user in Database privileges - Fix whitespace inside function calls --- ChangeLog | 1 + js/server_privileges.js | 50 ++++++++++++++++++++--------------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86756d5c68..cff530b17c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ + rfe #3078542 Remember the last sort order for each table + AJAX for Create table in navigation panel + rfe #3310562 Wording about Column ++ AJAX for Add a user in Database privileges 3.4.3.0 (not yet released) - bug #3311170 [sync] Missing helper icons in Synchronize diff --git a/js/server_privileges.js b/js/server_privileges.js index 8df224062e..0706405012 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -176,14 +176,14 @@ $(document).ready(function() { */ var $form = $(this).find("form[name=usersForm]").last(); - if ( ! checkAddUser($form.get(0)) ) { - PMA_ajaxShowMessage( PMA_messages['strFormEmpty'] ); + if (! checkAddUser($form.get(0))) { + PMA_ajaxShowMessage(PMA_messages['strFormEmpty']); return false; } //We also need to post the value of the submit button in order to get this to work correctly - $.post( $form.attr('action'), $form.serialize() + "&adduser_submit=" + $(this).find("input[name=adduser_submit]").attr('value'), function( data ) { - if ( data.success == true ) { + $.post($form.attr('action'), $form.serialize() + "&adduser_submit=" + $(this).find("input[name=adduser_submit]").attr('value'), function(data) { + if (data.success == true) { $("#add_user_dialog").dialog("close").remove(); PMA_ajaxShowMessage(data.message); $("#topmenucontainer") @@ -194,59 +194,59 @@ $(document).ready(function() { //Remove the empty notice div generated due to a NULL query passed to PMA_showMessage() var $notice_class = $("#topmenucontainer").next("div").find('.notice'); - if ( $notice_class.text() == '' ) { + if ($notice_class.text() == '') { $notice_class.remove(); } - if ( $('#fieldset_add_user a.ajax').attr('name') == 'db_specific' ) { + if ($('#fieldset_add_user a.ajax').attr('name') == 'db_specific') { /*process the fieldset_add_user attribute and get the val of privileges*/ var url = $('#fieldset_add_user a.ajax').attr('val'); - if ( url.substring( url.length - 23, url.length ) == "&goto=db_operations.php" ) { - url = url.substring( 0, url.length - 23 ); + if (url.substring(url.length - 23, url.length) == "&goto=db_operations.php") { + url = url.substring(0, url.length - 23); } - url = url + "&ajax_request=true&db_specific=true"; + url = url + "&ajax_request=true&db_specific=true"; - /* post request for get the updated userForm table */ - $.post( $form.attr('action' ), url, function( priv_data ) { + /* post request for get the updated userForm table */ + $.post($form.attr('action' ), url, function(priv_data) { /*Remove the old userForm table*/ - if ( $('#userFormDiv').length != 0 ) { + if ($('#userFormDiv').length != 0) { $('#userFormDiv').remove(); } else { $("#usersForm").remove(); } var user_div = $('
'); - /*If the jason string pared valiedly*/ - if ( typeof priv_data.success != 'undefined' ) { - if ( priv_data.success == true ) { + /*If the JSON string parsed correctly*/ + if (typeof priv_data.success != 'undefined') { + if (priv_data.success == true) { user_div - .html( priv_data.user_form ) + .html(priv_data.user_form) .insertAfter('#result_query'); } else { - PMA_ajaxShowMessage( PMA_messages['strErrorProcessingRequest'] + " : " + priv_data.error, "7000" ); + PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + priv_data.error, "7000"); } } else { - /*parse the json string*/ - var obj = $.parseJSON( priv_data ); + /*parse the JSON string*/ + var obj = $.parseJSON(priv_data); user_div - .html( obj.user_form ) + .html(obj.user_form) .insertAfter('#result_query'); } }); } else { - appendNewUser( data.new_user_string, data.new_user_initial, data.new_user_initial_string ); + appendNewUser(data.new_user_string, data.new_user_initial, data.new_user_initial_string); } } else { - PMA_ajaxShowMessage( PMA_messages['strErrorProcessingRequest'] + " : " + data.error, "7000"); + PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, "7000"); } }) }; button_options[PMA_messages['strCancel']] = function() { $(this).dialog("close").remove(); } - $.get( $(this).attr("href"), {'ajax_request':true}, function( data ) { + $.get($(this).attr("href"), {'ajax_request':true}, function(data) { $('
') - .prepend( data ) + .prepend(data) .find("#fieldset_add_user_footer").hide() //showing the "Go" and "Create User" buttons together will confuse the user .end() .find("form[name=usersForm]").append('') @@ -262,7 +262,7 @@ $(document).ready(function() { buttons: button_options }); //dialog options end displayPasswordGenerateButton(); - PMA_ajaxRemoveMessage( $msgbox ); + PMA_ajaxRemoveMessage($msgbox); }); // end $.get() });//end of Add New User AJAX event handler From 86d3b7e58c7e87b3ee1fb9cc0fcb08dd2e73d24e Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 5 Jun 2011 06:13:11 -0400 Subject: [PATCH 7/8] bug #3307616 [edit] Inline edit updates multiple duplicate rows --- ChangeLog | 1 + js/sql.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8226ad5e29..b27d7db098 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ - bug #3311170 [sync] Missing helper icons in Synchronize - patch #3304473 [setup] Redefine a lable that was wrong - bug #3304544 [parser] master is not a reserved word +- bug #3307616 [edit] Inline edit updates multiple duplicate rows 3.4.2.0 (not yet released) - bug #3301249 [interface] Iconic table operations does not remove inline edit label diff --git a/js/sql.js b/js/sql.js index 8a3e25f36c..739e5d1c37 100644 --- a/js/sql.js +++ b/js/sql.js @@ -947,6 +947,9 @@ $(document).ready(function() { new_clause = new_clause.substring(0, new_clause.length-5); new_clause = PMA_urlencode(new_clause); sql_query += ' WHERE ' + PMA_urldecode(where_clause); + // Avoid updating more than one row in case there is no primary key + // (happened only for duplicate rows) + sql_query += ' LIMIT 1'; /** * @var rel_fields_list String, url encoded representation of {@link relations_fields} */ From 7996a365756f08c2175d996e1fa9efd3829c4b96 Mon Sep 17 00:00:00 2001 From: Jo Michael Date: Sun, 5 Jun 2011 06:29:46 -0400 Subject: [PATCH 8/8] patch #3311539 Inline Edit does not escape backslash --- ChangeLog | 1 + js/sql.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index b27d7db098..3bc26103b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ - patch #3304473 [setup] Redefine a lable that was wrong - bug #3304544 [parser] master is not a reserved word - bug #3307616 [edit] Inline edit updates multiple duplicate rows +- patch #3311539 [edit] Inline edit does not escape backslashes 3.4.2.0 (not yet released) - bug #3301249 [interface] Iconic table operations does not remove inline edit label diff --git a/js/sql.js b/js/sql.js index 739e5d1c37..73a2b78e3e 100644 --- a/js/sql.js +++ b/js/sql.js @@ -944,6 +944,8 @@ $(document).ready(function() { //Remove the last ',' appended in the above loop sql_query = sql_query.replace(/,\s$/, ''); + //Fix non-escaped backslashes + sql_query = sql_query.replace(/\\/g, '\\\\'); new_clause = new_clause.substring(0, new_clause.length-5); new_clause = PMA_urlencode(new_clause); sql_query += ' WHERE ' + PMA_urldecode(where_clause);