keep selected tab after save

change pmadb to phpMyAdmin configuration storage in warning string
This commit is contained in:
Crack
2010-07-27 22:12:53 +02:00
parent 65e0676ab4
commit ac3e9e323b
5 changed files with 12 additions and 5 deletions

View File

@@ -498,6 +498,7 @@ function setTab(tab_id) {
$('.tabs a').removeClass('active').filter('[href=' + tab_id + ']').addClass('active'); $('.tabs a').removeClass('active').filter('[href=' + tab_id + ']').addClass('active');
$('.tabs_contents fieldset').hide().filter(tab_id).show(); $('.tabs_contents fieldset').hide().filter(tab_id).show();
location.hash = 'tab_' + tab_id.substr(1); location.hash = 'tab_' + tab_id.substr(1);
$('.config-form input[name=tab_hash]').val(location.hash);
} }
$(function() { $(function() {

View File

@@ -27,6 +27,7 @@ function display_form_top($action = null, $method = 'post', $hidden_fields = nul
} }
?> ?>
<form method="<?php echo $method ?>" action="<?php echo htmlspecialchars($action) ?>" class="config-form"> <form method="<?php echo $method ?>" action="<?php echo htmlspecialchars($action) ?>" class="config-form">
<input type="hidden" name="tab_hash" value="" />
<?php <?php
// we do validation on page refresh when browser remembers field values, // we do validation on page refresh when browser remembers field values,
// add a field with known value which will be used for checks // add a field with known value which will be used for checks

View File

@@ -69,8 +69,8 @@ $msg->display();
// warn about using session storage for settings // warn about using session storage for settings
$cfgRelation = PMA_getRelationsParam(); $cfgRelation = PMA_getRelationsParam();
if (!$cfgRelation['userconfigwork']) { if (!$cfgRelation['userconfigwork']) {
$msg = __('Your preferences will be saved for current session only. Storing them permanently requires %spmadb%s.'); $msg = __('Your preferences will be saved for current session only. Storing them permanently requires %sphpMyAdmin configuration storage%s.');
$msg = PMA_sanitize(sprintf($msg, '[a@http://wiki.phpmyadmin.net/pma/pmadb@_blank]', '[/a]')); $msg = PMA_sanitize(sprintf($msg, '[a@./Documentation.html#linked-tables@_blank]', '[/a]'));
PMA_Message::notice($msg)->display(); PMA_Message::notice($msg)->display();
} }

View File

@@ -217,8 +217,9 @@ function PMA_persist_option($path, $value, $default_value)
* @param array $old_settings * @param array $old_settings
* @param string $file_name * @param string $file_name
* @param array $params * @param array $params
* @param string $hash
*/ */
function PMA_userprefs_redirect(array $forms, array $old_settings, $file_name, $params = null) function PMA_userprefs_redirect(array $forms, array $old_settings, $file_name, $params = null, $hash = null)
{ {
$reload_left_frame = isset($params['reload_left_frame']) && $params['reload_left_frame']; $reload_left_frame = isset($params['reload_left_frame']) && $params['reload_left_frame'];
if (!$reload_left_frame) { if (!$reload_left_frame) {
@@ -243,8 +244,11 @@ function PMA_userprefs_redirect(array $forms, array $old_settings, $file_name, $
if (is_array($params)) { if (is_array($params)) {
$url_params = array_merge($params, $url_params); $url_params = array_merge($params, $url_params);
} }
if ($hash) {
$hash = '#' . urlencode($hash);
}
PMA_sendHeaderLocation($GLOBALS['cfg']['PmaAbsoluteUri'] . $file_name PMA_sendHeaderLocation($GLOBALS['cfg']['PmaAbsoluteUri'] . $file_name
. PMA_generate_common_url($url_params, '&')); . PMA_generate_common_url($url_params, '&') . $hash);
} }
function PMA_userprefs_autoload_header() function PMA_userprefs_autoload_header()

View File

@@ -61,8 +61,9 @@ if (!$form_display->process(false)) {
$old_settings = PMA_load_userprefs(); $old_settings = PMA_load_userprefs();
$result = PMA_save_userprefs($cf->getConfigArray()); $result = PMA_save_userprefs($cf->getConfigArray());
if ($result === true) { if ($result === true) {
$hash = ltrim(filter_input(INPUT_POST, 'tab_hash'), '#');
PMA_userprefs_redirect($forms, $old_settings, 'prefs_forms.php', array( PMA_userprefs_redirect($forms, $old_settings, 'prefs_forms.php', array(
'form' => $form_param)); 'form' => $form_param), $hash);
exit; exit;
} else { } else {
$result->display(); $result->display();