Update recent tables through index,php instead of navigation.php

This commit is contained in:
Rouslan Placella 2012-06-24 18:58:15 +01:00
parent 307fff3570
commit 4d4c8a9bad
5 changed files with 30 additions and 42 deletions

View File

@ -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) {

View File

@ -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 $()
/**

View File

@ -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(){

View File

@ -329,10 +329,6 @@ class PMA_Header
if (! $GLOBALS['cfg']['ShowHint']) {
$retval .= '<span id="no_hint" class="hide"></span>';
}
$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 = '<span class="hide" id="update_recent_tables"></span>';
$params = array('ajax_request' => true, 'recent_table' => true);
$url = 'index.php' . PMA_generate_common_url($params);
$retval = '<a class="hide" id="update_recent_tables" href="' . $url . '"></a>';
} else {
$error = $tmp_result;
$retval = $error->getDisplay();

View File

@ -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'])) {