Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2012-12-23 13:04:05 +01:00
commit 5615d46a66
2 changed files with 9 additions and 7 deletions

View File

@ -48,10 +48,7 @@ AJAX.registerOnload('db_operations.js', function() {
PMA_ajaxShowMessage(data.message);
PMA_commonParams.set('db', data.newname);
PMA_reloadNavigation();
// without this timeout, when looking in the navigation
// tree for the new db name, I only find the old name
setTimeout(function() {
PMA_reloadNavigation(function() {
$('#pma_navigation_tree')
.find("a:not('.expander')")
.each(function(index) {
@ -62,7 +59,7 @@ AJAX.registerOnload('db_operations.js', function() {
$thisAnchor.trigger('click');
}
});
}, 500);
});
} else {
PMA_ajaxShowMessage(data.error, false);
}

View File

@ -220,9 +220,10 @@ $(function() {
/**
* Reloads the whole navigation tree while preserving its state
*
* @param function the callback function
* @return void
*/
function PMA_reloadNavigation() {
function PMA_reloadNavigation(callback) {
var $throbber = $('#pma_navigation .throbber')
.first()
.css('visibility', 'visible');
@ -230,7 +231,7 @@ function PMA_reloadNavigation() {
reload: true,
pos: $('#pma_navigation_tree').find('a.expander:first > span.pos').text()
};
// Trasverse the navigation tree backwards to generate all the actual
// Traverse the navigation tree backwards to generate all the actual
// and virtual paths, as well as the positions in the pagination at
// various levels, if necessary.
var count = 0;
@ -271,6 +272,10 @@ function PMA_reloadNavigation() {
$throbber.css('visibility', 'hidden');
if (data.success) {
$('#pma_navigation_tree').html(data.message).children('div').show();
// Fire the callback, if any
if (typeof callback === 'function') {
callback.call();
}
} else {
PMA_ajaxShowMessage(data.error);
}