Permalink
Browse files

Dropped server side functionality for reloading the left frame from u…

…ser preferences forms
  • Loading branch information...
1 parent 50266d2 commit 9008ba42fa16fb01ee3271d0263da7d74158f557 @roccivic roccivic committed Jul 22, 2012
Showing with 7 additions and 49 deletions.
  1. +0 −9 libraries/Footer.class.php
  2. +2 −27 libraries/user_preferences.lib.php
  3. +3 −3 prefs_forms.php
  4. +2 −10 prefs_manage.php
View
9 libraries/Footer.class.php
@@ -93,15 +93,6 @@ private function _addDefaultScripts()
window.parent.refreshNavigation();
}"
);
- } else if (isset($_GET['reload_left_frame'])
- && $_GET['reload_left_frame'] == '1'
- ) {
- // reload left frame (used by user preferences)
- $this->_scripts->addCode(
- "if (window.parent && window.parent.frame_navigation) {
- window.parent.frame_navigation.location.reload();
- }"
- );
}
// set current db, table and sql query in the querywindow
View
29 libraries/user_preferences.lib.php
@@ -223,42 +223,17 @@ function PMA_persistOption($path, $value, $default_value)
/**
* Redirects after saving new user preferences
*
- * @param array $forms
- * @param array $old_settings
* @param string $file_name
* @param array $params
* @param string $hash
*
* @return void
*/
-function PMA_userprefsRedirect(array $forms, array $old_settings, $file_name,
+function PMA_userprefsRedirect($file_name,
$params = null, $hash = null
) {
- $reload_left_frame = isset($params['reload_left_frame']) && $params['reload_left_frame'];
- if (!$reload_left_frame) {
- // compute differences and check whether left frame should be refreshed
- $old_settings = isset($old_settings['config_data'])
- ? $old_settings['config_data']
- : array();
- $new_settings = ConfigFile::getInstance()->getConfigArray();
- $diff_keys = array_keys(
- array_diff_assoc($old_settings, $new_settings)
- + array_diff_assoc($new_settings, $old_settings)
- );
- $check_keys = array('NaturalOrder', 'DefaultTabDatabase',
- 'Server/hide_db', 'Server/only_db');
- $check_keys = array_merge(
- $check_keys, $forms['Left_frame']['Left_frame'],
- $forms['Left_frame']['Left_databases']
- );
- $diff = array_intersect($check_keys, $diff_keys);
- $reload_left_frame = !empty($diff);
- }
-
// redirect
- $url_params = array(
- 'saved' => 1,
- 'reload_left_frame' => $reload_left_frame);
+ $url_params = array('saved' => 1);
if (is_array($params)) {
$url_params = array_merge($params, $url_params);
}
View
6 prefs_forms.php
@@ -52,15 +52,15 @@
$error = null;
if ($form_display->process(false) && !$form_display->hasErrors()) {
// save settings
- $old_settings = PMA_loadUserprefs();
$result = PMA_saveUserprefs(ConfigFile::getInstance()->getConfigArray());
if ($result === true) {
// reload config
$GLOBALS['PMA_Config']->loadUserPreferences();
$hash = ltrim(filter_input(INPUT_POST, 'tab_hash'), '#');
PMA_userprefsRedirect(
- $forms, $old_settings, 'prefs_forms.php',
- array('form' => $form_param), $hash
+ 'prefs_forms.php',
+ array('form' => $form_param),
+ $hash
);
exit;
} else {
View
12 prefs_manage.php
@@ -142,29 +142,24 @@
) {
$_SESSION['PMA_Theme_Manager']->setActiveTheme($config['ThemeDefault']);
$_SESSION['PMA_Theme_Manager']->setThemeCookie();
- $params['reload_left_frame'] = true;
}
if (isset($config['fontsize'])
&& $config['fontsize'] != $GLOBALS['PMA_Config']->get('fontsize')
) {
$params['set_fontsize'] = $config['fontsize'];
- $params['reload_left_frame'] = true;
}
if (isset($config['lang'])
&& $config['lang'] != $GLOBALS['lang']
) {
$params['lang'] = $config['lang'];
- $params['reload_left_frame'] = true;
}
if (isset($config['collation_connection'])
&& $config['collation_connection'] != $GLOBALS['collation_connection']
) {
$params['collation_connection'] = $config['collation_connection'];
- $params['reload_left_frame'] = true;
}
// save settings
- $old_settings = PMA_loadUserprefs();
$result = PMA_saveUserprefs($cf->getConfigArray());
if ($result === true) {
if ($return_url) {
@@ -183,14 +178,13 @@
}
// reload config
$GLOBALS['PMA_Config']->loadUserPreferences();
- PMA_userprefsRedirect($forms, $old_settings, $return_url, $params);
+ PMA_userprefsRedirect($return_url, $params);
exit;
} else {
$error = $result;
}
}
} else if (isset($_POST['submit_clear'])) {
- $old_settings = PMA_loadUserprefs();
$result = PMA_saveUserprefs(array());
if ($result === true) {
$params = array();
@@ -200,15 +194,13 @@
);
unset($_SESSION['PMA_Theme_Manager']);
unset($_SESSION['PMA_Theme']);
- $params['reload_left_frame'] = true;
}
if ($GLOBALS['PMA_Config']->get('fontsize') != '82%') {
$GLOBALS['PMA_Config']->removeCookie('pma_fontsize');
- $params['reload_left_frame'] = true;
}
$GLOBALS['PMA_Config']->removeCookie('pma_collaction_connection');
$GLOBALS['PMA_Config']->removeCookie('pma_lang');
- PMA_userprefsRedirect($forms, $old_settings, 'prefs_manage.php', $params);
+ PMA_userprefsRedirect('prefs_manage.php', $params);
exit;
} else {
$error = $result;

0 comments on commit 9008ba4

Please sign in to comment.