fixed loosing paramters and page navigation

This commit is contained in:
Sebastian Mendel
2006-04-13 14:18:14 +00:00
parent 5d084ddce8
commit 31f86274d6

View File

@@ -19,20 +19,17 @@ if (empty($_REQUEST['sort_by'])) {
} else { } else {
$sort_by = PMA_sanitize($_REQUEST['sort_by']); $sort_by = PMA_sanitize($_REQUEST['sort_by']);
} }
if (empty($_REQUEST['sort_order'])) {
if ($sort_by == 'SCHEMA_NAME') { if (isset($_REQUEST['sort_order'])
$sort_order = 'asc'; && strtoupper($_REQUEST['sort_order']) == 'DESC') {
} else { $sort_order = 'DESC';
$sort_order = 'desc';
}
} else { } else {
$sort_order = PMA_sanitize($_REQUEST['sort_order']); $sort_order = 'ASC';
} }
$dbstats = empty($_REQUEST['dbstats']) ? 0 : 1; $dbstats = empty($_REQUEST['dbstats']) ? 0 : 1;
$pos = empty($_REQUEST['pos']) ? 0 : (int) $_REQUEST['pos']; $pos = empty($_REQUEST['pos']) ? 0 : (int) $_REQUEST['pos'];
$sort_by = empty($_REQUEST['sort_by']) ? 'SCHEMA_NAME' : $_REQUEST['sort_by'];
$sort_order = empty($_REQUEST['sort_order']) ? 'ASC' : $_REQUEST['sort_order'];
/** /**
* Drops multiple databases * Drops multiple databases
@@ -142,9 +139,15 @@ if ($databases_count > 0) {
'footer' => 0, 'footer' => 0,
); );
$_url_params = array(
'pos' => $pos,
'dbstats' => $dbstats,
'sort_by' => $sort_by,
'sort_order' => $sort_order,
);
if ($GLOBALS['cfg']['MaxDbList'] if ($GLOBALS['cfg']['MaxDbList']
&& $GLOBALS['cfg']['MaxDbList'] < $databases_count) { && $GLOBALS['cfg']['MaxDbList'] < $databases_count) {
$_url_params = array();
// Move to the beginning or to the previous page // Move to the beginning or to the previous page
if ($pos > 0) { if ($pos > 0) {
// loic1: patch #474210 from Gosha Sakovich - part 1 // loic1: patch #474210 from Gosha Sakovich - part 1
@@ -169,9 +172,10 @@ if ($databases_count > 0) {
. $caption2 . '</a>'; . $caption2 . '</a>';
} }
echo '<form action="none">'; echo '<form action="./server_databases.php" method="post">' . "\n";
echo PMA_generate_common_hidden_inputs($_url_params);
echo PMA_pageselector('server_databases.php?', 100, echo PMA_pageselector('server_databases.php?', 100,
($pos / $GLOBALS['cfg']['MaxDbList']) - 1, ($pos / $GLOBALS['cfg']['MaxDbList']) + 1,
$databases_count / $GLOBALS['cfg']['MaxDbList']); $databases_count / $GLOBALS['cfg']['MaxDbList']);
echo '</form>'; echo '</form>';
@@ -198,16 +202,19 @@ if ($databases_count > 0) {
} }
} }
$_url_params['pos'] = $pos;
echo '<form action="./server_databases.php" method="post" name="dbStatsForm" id="dbStatsForm">' . "\n" echo '<form action="./server_databases.php" method="post" name="dbStatsForm" id="dbStatsForm">' . "\n"
. PMA_generate_common_hidden_inputs('', '', 1) . PMA_generate_common_hidden_inputs($_url_params);
. '<input type="hidden" name="dbstats" value="' . $dbstats . '" />' . "\n"
. '<input type="hidden" name="sort_by" value="' . $sort_by . '" />' . "\n" $_url_params['sort_by'] = 'SCHEMA_NAME';
. '<input type="hidden" name="sort_order" value="' . $sort_order . '" />' . "\n" $_url_params['sort_order'] = ($sort_by == 'SCHEMA_NAME' && $sort_order == 'ASC') ? 'DESC' : 'ASC';
. '<table id="tabledatabases" class="data">' . "\n"
echo '<table id="tabledatabases" class="data">' . "\n"
. '<thead>' . "\n" . '<thead>' . "\n"
. '<tr>' . "\n" . '<tr>' . "\n"
. ($is_superuser || $cfg['AllowUserDropDatabase'] ? ' <th>&nbsp;</th>' . "\n" : '') . ($is_superuser || $cfg['AllowUserDropDatabase'] ? ' <th>&nbsp;</th>' . "\n" : '')
. ' <th><a href="./server_databases.php?' . $url_query . '&amp;dbstats=' . $dbstats . '&amp;sort_by=SCHEMA_NAME&amp;sort_order=' . (($sort_by == 'SCHEMA_NAME' && $sort_order == 'asc') ? 'desc' : 'asc') . '">' . "\n" . ' <th><a href="./server_databases.php' . PMA_generate_common_url($_url_params) . '">' . "\n"
. ' ' . $strDatabase . "\n" . ' ' . $strDatabase . "\n"
. ($sort_by == 'SCHEMA_NAME' ? ' <img class="icon" src="' . $pmaThemeImage . 's_' . $sort_order . '.png" width="11" height="9" alt="' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '" />' . "\n" : '') . ($sort_by == 'SCHEMA_NAME' ? ' <img class="icon" src="' . $pmaThemeImage . 's_' . $sort_order . '.png" width="11" height="9" alt="' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '" />' . "\n" : '')
. ' </a></th>' . "\n"; . ' </a></th>' . "\n";
@@ -221,8 +228,10 @@ if ($databases_count > 0) {
$table_columns++; $table_columns++;
$colspan = ''; $colspan = '';
} }
$_url_params['sort_by'] = $stat_name;
$_url_params['sort_order'] = ($sort_by == $stat_name && $sort_order == 'DESC') ? 'ASC' : 'DESC';
echo ' <th' . $colspan . '>' echo ' <th' . $colspan . '>'
.'<a href="./server_databases.php?' . $url_query . '&amp;dbstats=' . (int) $dbstats . '&amp;sort_by=' . urlencode( $stat_name ) . '&amp;sort_order=' . (($sort_by == $stat_name && $sort_order == 'desc') ? 'asc' : 'desc') . '">' . "\n" .'<a href="./server_databases.php' . PMA_generate_common_url($_url_params) . '">' . "\n"
.' ' . $stat['disp_name'] . "\n" .' ' . $stat['disp_name'] . "\n"
.($sort_by == $stat_name ? ' <img class="icon" src="' . $pmaThemeImage . 's_' . $sort_order . '.png" width="11" height="9" alt="' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '" />' . "\n" : '') .($sort_by == $stat_name ? ' <img class="icon" src="' . $pmaThemeImage . 's_' . $sort_order . '.png" width="11" height="9" alt="' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '" />' . "\n" : '')
.' </a></th>' . "\n"; .' </a></th>' . "\n";