Removed extra calls to PMA_ajaxResponse and added a common call to it

for multiple actions.  Modified the code for paginating the users table
with ajax, however it is still buggy
This commit is contained in:
ninadsp
2010-06-27 03:27:29 +05:30
parent 6ab286d6ca
commit a87c4fc363

View File

@@ -1032,10 +1032,6 @@ if (isset($_REQUEST['adduser_submit']) || isset($_REQUEST['change_copy'])) {
} }
unset($res, $real_sql_query); unset($res, $real_sql_query);
} }
if( $GLOBALS['is_ajax_request'] ) {
PMA_ajaxResponse($message, true);
}
} }
@@ -1307,10 +1303,6 @@ if (isset($_REQUEST['delete']) || (isset($_REQUEST['change_copy']) && $_REQUEST[
} }
unset($queries); unset($queries);
} }
if( $GLOBALS['is_ajax_request']) {
PMA_ajaxResponse($message, $message->isSuccess());
}
} }
@@ -1342,16 +1334,17 @@ if (isset($_REQUEST['flush_privileges'])) {
$sql_query = 'FLUSH PRIVILEGES;'; $sql_query = 'FLUSH PRIVILEGES;';
PMA_DBI_query($sql_query); PMA_DBI_query($sql_query);
$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, just display the message and exit. * If we are in an Ajax request for Create User/Edit User/Revoke User/Flush Privileges,
* jQuery will take care of displaying the data with a dialog * show $message and exit.
*
* @todo How to show the queries? Refactoring PMA_ajaxShowMessage might help
*/ */
if( $GLOBALS['is_ajax_request'] ) { if( $GLOBALS['is_ajax_request'] && !isset($_REQUEST['export']) && !isset($_REQUEST['adduser']) && !isset($_REQUEST['initial']) && !isset($_REQUEST['showall'])) {
PMA_ajaxResponse($message); PMA_ajaxResponse($message, $message->isSuccess());
} }
}
/** /**
* Displays the links * Displays the links
@@ -1505,6 +1498,8 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
* Displays the initials * Displays the initials
*/ */
if( !$GLOBALS['is_ajax_request'] ) {
// initialize to FALSE the letters A-Z // initialize to FALSE the letters A-Z
for ($letter_counter = 1; $letter_counter < 27; $letter_counter++) { for ($letter_counter = 1; $letter_counter < 27; $letter_counter++) {
if (! isset($array_initials[chr($letter_counter + 64)])) { if (! isset($array_initials[chr($letter_counter + 64)])) {
@@ -1523,7 +1518,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
uksort($array_initials, "strnatcasecmp"); uksort($array_initials, "strnatcasecmp");
echo '<table cellspacing="5"><tr>'; echo '<table id="initials_table" cellspacing="5"><tr>';
foreach ($array_initials as $tmp_initial => $initial_was_found) { foreach ($array_initials as $tmp_initial => $initial_was_found) {
if ($initial_was_found) { if ($initial_was_found) {
echo '<td><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;initial=' . urlencode($tmp_initial) . '">' . $tmp_initial . '</a></td>' . "\n"; echo '<td><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;initial=' . urlencode($tmp_initial) . '">' . $tmp_initial . '</a></td>' . "\n";
@@ -1533,6 +1528,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
} }
echo '<td><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;showall=1">[' . __('Show all') . ']</a></td>' . "\n"; echo '<td><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;showall=1">[' . __('Show all') . ']</a></td>' . "\n";
echo '</tr></table>'; echo '</tr></table>';
}
/** /**
* Display the user overview * Display the user overview
@@ -1653,6 +1649,11 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
. ' ' . __('Add a new User') . '</a>' . "\n" . ' ' . __('Add a new User') . '</a>' . "\n"
. ' </fieldset>' . "\n"; . ' </fieldset>' . "\n";
} // end if (display overview) } // end if (display overview)
if( $GLOBALS['is_ajax_request'] ) {
exit;
}
$flushnote = new PMA_Message(__('Note: phpMyAdmin gets the users\' privileges directly from MySQL\'s privilege tables. The content of these tables may differ from the privileges the server uses, if they have been changed manually. In this case, you should %sreload the privileges%s before you continue.'), PMA_Message::NOTICE); $flushnote = new PMA_Message(__('Note: phpMyAdmin gets the users\' privileges directly from MySQL\'s privilege tables. The content of these tables may differ from the privileges the server uses, if they have been changed manually. In this case, you should %sreload the privileges%s before you continue.'), PMA_Message::NOTICE);
$flushnote->addParam('<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;flush_privileges=1" id="reload_privileges_anchor">', false); $flushnote->addParam('<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;flush_privileges=1" id="reload_privileges_anchor">', false);
$flushnote->addParam('</a>', false); $flushnote->addParam('</a>', false);