The branch, master has been updated via a7a20980067c9c9dc436e59129cb420d0badafa3 (commit) via b9c0f5b01a9f60a2dd5c307e8810f3d478313a75 (commit) via ba71acb32eae8d2d018d8cd45a2d8878fe393634 (commit) via 48f5745492cf92130ffb6d54263ae57d7c2393fb (commit) via 67b67faa71da9ada447e29aed7e1735af85ffcf4 (commit) via 65c8851e032dab93b62a9f37a3bb7bec4f6d0b4c (commit) via dc951157008e6407e9e6b35bb9df0a0822deaa2e (commit) via 344f7a57d389679e9abac713f33eb7e44ab11604 (commit) via 14b5515d3a686fcb88ba44c95494c92ce388f825 (commit) via b1c12a0b7446f9a7293aa0a02d09382812742e07 (commit) from 8d07c5bd77f86e65843248d31ccfa7d4d28a6586 (commit)
- Log ----------------------------------------------------------------- commit a7a20980067c9c9dc436e59129cb420d0badafa3 Author: Marc Delisle marc@infomarc.info Date: Sun Jun 5 05:40:55 2011 -0400
- ChangeLog entry for "AJAX for Add a user in Database privileges - Fix whitespace inside function calls
commit b9c0f5b01a9f60a2dd5c307e8810f3d478313a75 Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Sun Jun 5 07:57:52 2011 +0530
Modified the indentation of the sever privileges js
commit ba71acb32eae8d2d018d8cd45a2d8878fe393634 Merge: 48f5745492cf92130ffb6d54263ae57d7c2393fb 8d07c5bd77f86e65843248d31ccfa7d4d28a6586 Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Sat Jun 4 23:14:58 2011 +0530
Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 48f5745492cf92130ffb6d54263ae57d7c2393fb Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Sat Jun 4 23:13:39 2011 +0530
Fixed the bug at add user in db ckeck privileges
commit 67b67faa71da9ada447e29aed7e1735af85ffcf4 Merge: 65c8851e032dab93b62a9f37a3bb7bec4f6d0b4c c16138f9fd9b7c88ee412c0ef43419ef100ad0d8 Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Fri Jun 3 22:50:39 2011 +0530
Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 65c8851e032dab93b62a9f37a3bb7bec4f6d0b4c Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Fri Jun 3 22:48:18 2011 +0530
Bug fixed on header warning
commit dc951157008e6407e9e6b35bb9df0a0822deaa2e Merge: 344f7a57d389679e9abac713f33eb7e44ab11604 0dbc9f4a3c7fa46baed1477f001e37dad14fc908 Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Wed Jun 1 21:42:37 2011 +0530
Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 344f7a57d389679e9abac713f33eb7e44ab11604 Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Wed Jun 1 21:41:36 2011 +0530
Message undifined bug fixed in add new user to server privileges
commit 14b5515d3a686fcb88ba44c95494c92ce388f825 Merge: b1c12a0b7446f9a7293aa0a02d09382812742e07 575f265293ffe0625da6a8fc0877a84d595d5322 Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Tue May 31 23:16:28 2011 +0530
Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit b1c12a0b7446f9a7293aa0a02d09382812742e07 Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Tue May 31 23:15:24 2011 +0530
Added Ajax behaviour to Add a new user in database privileges
-----------------------------------------------------------------------
Summary of changes: ChangeLog | 1 + js/messages.php | 3 ++ js/server_privileges.js | 88 +++++++++++++++++++++++++++++++++------------- server_privileges.php | 51 +++++++++++++++------------ 4 files changed, 96 insertions(+), 47 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 86756d5..cff530b 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/messages.php b/js/messages.php index a710260..03c92fe 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 314663f..0706405 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 * @@ -176,14 +176,14 @@ $(document).ready(function() { */ var $form = $(this).find("form[name=usersForm]").last();
- if( ! checkAddUser($form.get(0)) ) { + 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) { + if (data.success == true) { $("#add_user_dialog").dialog("close").remove(); PMA_ajaxShowMessage(data.message); $("#topmenucontainer") @@ -191,20 +191,58 @@ $(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(); - }
- appendNewUser(data.new_user_string, data.new_user_initial, data.new_user_initial_string); + //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 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"; + + /* 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 { + $("#usersForm").remove(); + } + var user_div = $('<div id="userFormDiv"></div>'); + /*If the JSON string parsed correctly*/ + 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) { $('<div id="add_user_dialog"></div>') @@ -224,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 @@ -234,7 +272,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 +296,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 +306,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 +347,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 +372,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 +406,7 @@ $(document).ready(function() { if(data.success == true) {
PMA_ajaxShowMessage(data.message); - + //Close the jQueryUI dialog $("#edit_user_dialog").dialog("close").remove();
@@ -422,7 +460,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 +483,7 @@ $(document).ready(function() { width : 500, buttons: button_options }); - PMA_ajaxRemoveMessage($msgbox); + PMA_ajaxRemoveMessage($msgbox); }) //end $.get }) //end export privileges
@@ -453,7 +491,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 +514,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 2cc6bdc..13ee074 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -1358,7 +1358,7 @@ $link_export = '<a class="export_user_anchor ' . $conditional_class . '" href="s * If we are in an Ajax request for Create User/Edit User/Revoke User/Flush Privileges, * show $message and exit. */ -if( $GLOBALS['is_ajax_request'] && ! isset($_REQUEST['export']) && (! isset($_REQUEST['adduser']) || $_add_user_error) && ! isset($_REQUEST['initial']) && ! isset($_REQUEST['showall']) && ! isset($_REQUEST['edit_user_dialog'])) { +if( $GLOBALS['is_ajax_request'] && ! isset($_REQUEST['export']) && (! isset($_REQUEST['adduser']) || $_add_user_error) && ! isset($_REQUEST['initial']) && ! isset($_REQUEST['showall']) && ! isset($_REQUEST['edit_user_dialog']) && ! isset($_REQUEST['db_specific'])) {
if(isset($sql_query)) { $extra_data['sql_query'] = PMA_showMessage(NULL, $sql_query); @@ -2140,7 +2140,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs . '</form>' . "\n"; } else { // check the privileges for a particular database. - echo '<form id="usersForm"><table id="dbspecificuserrights" class="data">' . "\n" + $user_form = '<form id="usersForm"><table id="dbspecificuserrights" class="data">' . "\n" . '<caption class="tblHeaders">' . "\n" . PMA_getIcon('b_usrcheck.png') . ' ' . sprintf(__('Users having access to "%s"'), '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' . htmlspecialchars($checkprivs) . '</a>') . "\n" @@ -2235,29 +2235,29 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs $current_privileges[] = $row; $row = PMA_DBI_fetch_assoc($res); } - echo ' <tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">' . "\n" + $user_form .= ' <tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">' . "\n" . ' <td'; if (count($current_privileges) > 1) { - echo ' rowspan="' . count($current_privileges) . '"'; + $user_form .= ' rowspan="' . count($current_privileges) . '"'; } - echo '>' . (empty($current_user) ? '<span style="color: #FF0000">' . __('Any') . '</span>' : htmlspecialchars($current_user)) . "\n" + $user_form .= '>' . (empty($current_user) ? '<span style="color: #FF0000">' . __('Any') . '</span>' : htmlspecialchars($current_user)) . "\n" . ' </td>' . "\n" . ' <td'; if (count($current_privileges) > 1) { - echo ' rowspan="' . count($current_privileges) . '"'; + $user_form .= ' rowspan="' . count($current_privileges) . '"'; } - echo '>' . htmlspecialchars($current_host) . '</td>' . "\n"; + $user_form .= '>' . htmlspecialchars($current_host) . '</td>' . "\n"; foreach ($current_privileges as $current) { - echo ' <td>' . "\n" + $user_form .= ' <td>' . "\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'), ': <tt>' . htmlspecialchars($current['Db']) . '</tt>'; + $user_form .= __('wildcard'). ': <tt>' . htmlspecialchars($current['Db']) . '</tt>'; } - echo "\n" + $user_form .= "\n" . ' </td>' . "\n" . ' <td>' . "\n" . ' <tt>' . "\n" @@ -2268,11 +2268,11 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs . ' ' . ($current['Grant_priv'] == 'Y' ? __('Yes') : __('No')) . "\n" . ' </td>' . "\n" . ' <td>' . "\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 '</td>' . "\n" + $user_form .= '</td>' . "\n" . ' </tr>' . "\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 ' <tr class="odd">' . "\n" + $user_form .= ' <tr class="odd">' . "\n" . ' <td colspan="6">' . "\n" . ' ' . __('No user found.') . "\n" . ' </td>' . "\n" . ' </tr>' . "\n"; } - echo '</tbody>' . "\n" + $user_form .= '</tbody>' . "\n" . '</table></form>' . "\n";
- // Offer to create a new user for the current database - echo '<fieldset id="fieldset_add_user">' . "\n" - . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1&dbname=' . htmlspecialchars($checkprivs) .'">' . "\n" - . PMA_getIcon('b_usradd.png') - . ' ' . __('Add a new User') . '</a>' . "\n" - . '</fieldset>' . "\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 .= '<fieldset id="fieldset_add_user">' . "\n" + . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1&dbname=' . htmlspecialchars($checkprivs) .'" val="'.'checkprivs='.htmlspecialchars($checkprivs). '&'.$GLOBALS['url_query'] . '" class="'.$conditional_class.'" name="db_specific">' . "\n" + . PMA_getIcon('b_usradd.png') + . ' ' . __('Add a new User') . '</a>' . "\n" + . '</fieldset>' . "\n"; + echo $user_form ; + }
} // end if (empty($_REQUEST['adduser']) && empty($checkprivs)) ... elseif ... else ...
hooks/post-receive