When a new user is added, his details are now appended to the user's table
This commit is contained in:
@@ -102,7 +102,7 @@ function suggestPassword(passwd_form) {
|
|||||||
* Revoke a user
|
* Revoke a user
|
||||||
* Edit privileges
|
* Edit privileges
|
||||||
* Export privileges
|
* Export privileges
|
||||||
* Paginate table of users - use ajax, replace #usersForm
|
* Paginate table of users
|
||||||
* Flush privileges
|
* Flush privileges
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -144,6 +144,37 @@ $(document).ready(function() {
|
|||||||
if($(notice_class).text() == '') {
|
if($(notice_class).text() == '') {
|
||||||
$(notice_class).remove();
|
$(notice_class).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Append the newly retrived user to the table now
|
||||||
|
|
||||||
|
//Calculate the index for the new row
|
||||||
|
var curr_last_row = $("#usersForm").find('tbody').find('tr:last');
|
||||||
|
var curr_last_row_index_string = $(curr_last_row).find('input:checkbox').attr('id').match(/\d+/)[0];
|
||||||
|
var curr_last_row_index = parseFloat(curr_last_row_index_string);
|
||||||
|
var new_last_row_index = curr_last_row_index + 1;
|
||||||
|
var new_last_row_id = 'checkbox_sel_users_' + new_last_row_index;
|
||||||
|
|
||||||
|
//Append to the table and set the id/names correctly
|
||||||
|
$(data.new_user_string)
|
||||||
|
.insertAfter($(curr_last_row))
|
||||||
|
.find('input:checkbox')
|
||||||
|
.attr('id', new_last_row_id)
|
||||||
|
.val(function() {
|
||||||
|
//the insert messes up the &27; part. let's fix it
|
||||||
|
return $(this).val().replace(/&/,'&');
|
||||||
|
})
|
||||||
|
.end()
|
||||||
|
.find('label')
|
||||||
|
.attr('for', new_last_row_id)
|
||||||
|
.end();
|
||||||
|
|
||||||
|
//Re-check the classes of each row
|
||||||
|
$("#usersForm")
|
||||||
|
.find('tbody').find('tr:odd')
|
||||||
|
.removeClass('even').addClass('odd')
|
||||||
|
.end()
|
||||||
|
.find('tr:even')
|
||||||
|
.removeClass('odd').addClass('even');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : "+data.error, "7000");
|
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : "+data.error, "7000");
|
||||||
|
@@ -981,8 +981,11 @@ if (isset($_REQUEST['adduser_submit']) || isset($_REQUEST['change_copy'])) {
|
|||||||
$message = PMA_Message::rawError(PMA_DBI_getError());
|
$message = PMA_Message::rawError(PMA_DBI_getError());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$GLOBALS['reload'] = TRUE;
|
|
||||||
PMA_reloadNavigation();
|
if($GLOBALS['is_ajax_request'] != true) {
|
||||||
|
$GLOBALS['reload'] = TRUE;
|
||||||
|
PMA_reloadNavigation();
|
||||||
|
}
|
||||||
|
|
||||||
$q = 'GRANT ALL PRIVILEGES ON '
|
$q = 'GRANT ALL PRIVILEGES ON '
|
||||||
. PMA_backquote(PMA_sqlAddslashes($username)) . '.* TO \''
|
. PMA_backquote(PMA_sqlAddslashes($username)) . '.* TO \''
|
||||||
@@ -1336,33 +1339,6 @@ if (isset($_REQUEST['flush_privileges'])) {
|
|||||||
$message = PMA_Message::success(__('The privileges were reloaded successfully.'));
|
$message = PMA_Message::success(__('The privileges were reloaded successfully.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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']) && !isset($_REQUEST['initial']) && !isset($_REQUEST['showall']) && !isset($_REQUEST['edit_user_dialog'])) {
|
|
||||||
if(isset($sql_query)) {
|
|
||||||
$extra_data['sql_query'] = PMA_showMessage(NULL, $sql_query);
|
|
||||||
}
|
|
||||||
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays the links
|
|
||||||
*/
|
|
||||||
if (isset($viewing_mode) && $viewing_mode == 'db') {
|
|
||||||
$db = $checkprivs;
|
|
||||||
$url_query .= '&goto=db_operations.php';
|
|
||||||
|
|
||||||
// Gets the database structure
|
|
||||||
$sub_part = '_structure';
|
|
||||||
require './libraries/db_info.inc.php';
|
|
||||||
echo "\n";
|
|
||||||
} else {
|
|
||||||
require './libraries/server_links.inc.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* defines some standard links
|
* defines some standard links
|
||||||
*/
|
*/
|
||||||
@@ -1391,6 +1367,68 @@ $link_export = '<a class="export_user_anchor" href="server_privileges.php?' . $G
|
|||||||
. PMA_getIcon('b_tblexport.png', __('Export'))
|
. PMA_getIcon('b_tblexport.png', __('Export'))
|
||||||
. '</a>';
|
. '</a>';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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']) && !isset($_REQUEST['initial']) && !isset($_REQUEST['showall']) && !isset($_REQUEST['edit_user_dialog'])) {
|
||||||
|
if(isset($sql_query)) {
|
||||||
|
$extra_data['sql_query'] = PMA_showMessage(NULL, $sql_query);
|
||||||
|
}
|
||||||
|
if(isset($_REQUEST['adduser_submit'])) {
|
||||||
|
//generate html on the fly for the new user that was just created.
|
||||||
|
$new_user_string = '<tr>'."\n"
|
||||||
|
.'<td> <input type="checkbox" name="selected_usr[]" id="checkbox_sel_users_" value="' . htmlspecialchars($username) . '&#27;' . htmlspecialchars($hostname) . '" /> </td>'."\n"
|
||||||
|
.'<td><label for="checkbox_sel_users_">' . (empty($username) ? '<span style="color: #FF0000">' . __('Any') . '</span>' : htmlspecialchars($username) ) . '</label></td>' . "\n"
|
||||||
|
.'<td>' . htmlspecialchars($hostname) . '</td>' . "\n";
|
||||||
|
$new_user_string .= '<td>';
|
||||||
|
|
||||||
|
if(!empty($password) || isset($pma_pw)) {
|
||||||
|
$new_user_string .= __('Yes');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$new_user_string .= '<span style="color: #FF0000">' . __('No') . '</span>';
|
||||||
|
};
|
||||||
|
|
||||||
|
$new_user_string .= '</td>'."\n";
|
||||||
|
$new_user_string .= '<td><tt>' . join(', ', PMA_extractPrivInfo()) . '</tt></td>'; //Fill in privileges here
|
||||||
|
$new_user_string .= '<td>';
|
||||||
|
|
||||||
|
if((isset($Grant_priv) && $Grant_priv == 'Y')) {
|
||||||
|
$new_user_string .= __('Yes');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$new_user_string .= __('No');
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_user_string .='</td>';
|
||||||
|
|
||||||
|
$new_user_string .= '<td>'.sprintf($link_edit, urlencode($username), urlencode($host), '', '' ).'</td>'."\n";
|
||||||
|
$new_user_string .= '<td>'.sprintf($link_export, urlencode($username), urlencode($hostname), (isset($initial) ? $initial : '')).'</td>'."\n";
|
||||||
|
|
||||||
|
$new_user_string .= '</tr>';
|
||||||
|
|
||||||
|
$extra_data['new_user_string'] = $new_user_string;
|
||||||
|
}
|
||||||
|
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the links
|
||||||
|
*/
|
||||||
|
if (isset($viewing_mode) && $viewing_mode == 'db') {
|
||||||
|
$db = $checkprivs;
|
||||||
|
$url_query .= '&goto=db_operations.php';
|
||||||
|
|
||||||
|
// Gets the database structure
|
||||||
|
$sub_part = '_structure';
|
||||||
|
require './libraries/db_info.inc.php';
|
||||||
|
echo "\n";
|
||||||
|
} else {
|
||||||
|
require './libraries/server_links.inc.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the page
|
* Displays the page
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user