diff --git a/index.php b/index.php index db6d0952d9..1c45e3ed62 100644 --- a/index.php +++ b/index.php @@ -41,6 +41,18 @@ if (! empty($_REQUEST['target']) exit; } +/** + * Check if it is an ajax request to reload the recent tables list. + */ +require_once 'libraries/RecentTable.class.php'; +if ($GLOBALS['is_ajax_request'] && ! empty($_REQUEST['recent_table'])) { + $response = PMA_Response::getInstance(); + $response->addJSON( + 'options', + PMA_RecentTable::getInstance()->getHtmlSelectOption() + ); + exit; +} if ($GLOBALS['PMA_Config']->isGitRevision()) { if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) { diff --git a/js/functions.js b/js/functions.js index 739f5d76f4..1d6b1894c1 100644 --- a/js/functions.js +++ b/js/functions.js @@ -3231,13 +3231,17 @@ AJAX.registerOnload('functions.js', function() { return false; }); - $('#update_recent_tables').ready(function() { - if (window.parent.frame_navigation != undefined - && window.parent.frame_navigation.PMA_reloadRecentTable != undefined) - { - window.parent.frame_navigation.PMA_reloadRecentTable(); - } - }); + if ($('#update_recent_tables').length) { + $.get( + $('#update_recent_tables').attr('href'), + function (data) { + if (data.success == true) { + $('#recentTable').html(data.options); + } + } + ); + } + }); // end of $() /** diff --git a/js/navigation.js b/js/navigation.js index f436d28c54..76fd60e31a 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -235,23 +235,6 @@ function clear_fast_db_filter() fast_db_filter(''); } -/** - * Reloads the recent tables list. - */ -function PMA_reloadRecentTable() -{ - $.get('navigation.php', { - 'token': window.parent.token, - 'server': window.parent.server, - 'ajax_request': true, - 'recent_table': true}, - function (data) { - if (data.success == true) { - $('#recentTable').html(data.options); - } - }); -} - /* Performed on load */ $(function(){ diff --git a/libraries/Header.class.php b/libraries/Header.class.php index 0dacbf8ad7..1dd5cec1b3 100644 --- a/libraries/Header.class.php +++ b/libraries/Header.class.php @@ -329,10 +329,6 @@ class PMA_Header if (! $GLOBALS['cfg']['ShowHint']) { $retval .= ''; } - $retval .= $this->_addRecentTable( - $GLOBALS['db'], - $GLOBALS['table'] - ); $retval .= $this->_getWarnings(); if ($this->_menuEnabled && $GLOBALS['server'] > 0) { $retval .= $this->_menu->getDisplay(); @@ -349,6 +345,10 @@ class PMA_Header } } } + $retval .= $this->_addRecentTable( + $GLOBALS['db'], + $GLOBALS['table'] + ); } return $retval; } @@ -545,7 +545,9 @@ class PMA_Header if ($this->_menuEnabled && strlen($table) && $GLOBALS['cfg']['LeftRecentTable'] > 0) { $tmp_result = PMA_RecentTable::getInstance()->add($db, $table); if ($tmp_result === true) { - $retval = ''; + $params = array('ajax_request' => true, 'recent_table' => true); + $url = 'index.php' . PMA_generate_common_url($params); + $retval = ''; } else { $error = $tmp_result; $retval = $error->getDisplay(); diff --git a/navigation.php b/navigation.php index 3e440691da..4205a2dbb9 100644 --- a/navigation.php +++ b/navigation.php @@ -25,19 +25,6 @@ function PMA_exitNavigationFrame() } require_once 'libraries/Util.class.php'; -require_once 'libraries/RecentTable.class.php'; - -/** - * Check if it is an ajax request to reload the recent tables list. - */ -if ($GLOBALS['is_ajax_request'] && $_REQUEST['recent_table']) { - $response = PMA_Response::getInstance(); - $response->addJSON( - 'options', - PMA_RecentTable::getInstance()->getHtmlSelectOption() - ); - exit; -} // keep the offset of the db list in session before closing it if (! isset($_SESSION['tmp_user_values']['navi_limit_offset'])) {