Merge branch 'QA_4_1'
Conflicts: js/navigation.js
This commit is contained in:
commit
d3bd91eaaf
107
js/navigation.js
107
js/navigation.js
@ -463,62 +463,79 @@ function PMA_showCurrentNavigation() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
function loadAndHighlightTableOrView($dbItem, table) {
|
||||
function loadAndHighlightTableOrView($dbItem, itemName) {
|
||||
var $container = $dbItem.children('div.list_container');
|
||||
var $tableContainer = $container
|
||||
.children('ul')
|
||||
.children('li.tableContainer');
|
||||
var $viewContainer = $container
|
||||
.children('ul')
|
||||
.children('li.viewContainer');
|
||||
|
||||
if ($tableContainer.length > 0) {
|
||||
highlightTableOrView($tableContainer, table, 'table');
|
||||
} else if ($viewContainer.length > 0) {
|
||||
highlightTableOrView($viewContainer, table, 'view');
|
||||
var $expander;
|
||||
var $whichItem = isItemInContainer($container, itemName, 'li.table, li.view');
|
||||
//If item already there in some container
|
||||
if ($whichItem) {
|
||||
//get the relevant container while may also be a subcontainer
|
||||
var $relatedContainer = $whichItem.closest('li.subContainer').length
|
||||
? $whichItem.closest('li.subContainer')
|
||||
: $dbItem;
|
||||
$whichItem = findLoadedItem(
|
||||
$relatedContainer.children('div.list_container'),
|
||||
itemName, null, true
|
||||
);
|
||||
//Show directly
|
||||
showTableOrView($whichItem, $relatedContainer.children('div:first').children('a.expander'));
|
||||
//else if item not there, try loading once
|
||||
} else {
|
||||
// no containers, highlight the item
|
||||
highlightTableOrView($dbItem, table, null);
|
||||
var $sub_containers = $dbItem.find('.subContainer');
|
||||
//If there are subContainers i.e. tableContainer or viewContainer
|
||||
if($sub_containers.length > 0) {
|
||||
var $containers = new Array();
|
||||
$sub_containers.each(function (index) {
|
||||
$containers[index] = $(this);
|
||||
$expander = $containers[index]
|
||||
.children('div:first')
|
||||
.children('a.expander');
|
||||
collapseTreeNode($expander);
|
||||
loadAndShowTableOrView($expander, $containers[index], itemName);
|
||||
});
|
||||
// else if no subContainers
|
||||
} else {
|
||||
$expander = $dbItem
|
||||
.children('div:first')
|
||||
.children('a.expander');
|
||||
collapseTreeNode($expander);
|
||||
loadAndShowTableOrView($expander, $dbItem, itemName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isItemInContainer($container, name, clazz) {
|
||||
$items = $container.find('li.' + clazz);
|
||||
function loadAndShowTableOrView($expander, $relatedContainer, itemName) {
|
||||
loadChildNodes($expander, function (data) {
|
||||
var $whichItem = findLoadedItem(
|
||||
$relatedContainer.children('div.list_container'),
|
||||
itemName, null, true
|
||||
);
|
||||
if ($whichItem) {
|
||||
showTableOrView($whichItem, $expander);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showTableOrView($whichItem, $expander) {
|
||||
expandTreeNode($expander, function (data) {
|
||||
if ($whichItem) {
|
||||
scrollToView($whichItem, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function isItemInContainer($container, name, clazz)
|
||||
{
|
||||
var $whichItem = null;
|
||||
$items = $container.find(clazz);
|
||||
var found = false;
|
||||
$items.each(function () {
|
||||
if ($(this).children('a').text() == name) {
|
||||
found = true;
|
||||
$whichItem = $(this);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return found;
|
||||
}
|
||||
|
||||
function highlightTableOrView($container, item, clazz) {
|
||||
var $expander = $container
|
||||
.children('div:first')
|
||||
.children('a.expander');
|
||||
if (! $expander.hasClass('loaded') ||
|
||||
$expander.find('img').is('.ic_b_plus')
|
||||
) {
|
||||
expandTreeNode($expander, function () {
|
||||
var $item = findLoadedItem(
|
||||
$container.children('div.list_container'),
|
||||
item, clazz, true
|
||||
);
|
||||
if ($item) {
|
||||
scrollToView($item, false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var $item = findLoadedItem(
|
||||
$container.children('div.list_container'),
|
||||
item, clazz, true
|
||||
);
|
||||
if ($item) {
|
||||
scrollToView($item, false);
|
||||
}
|
||||
}
|
||||
return $whichItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ class Node_Table_Container extends Node
|
||||
);
|
||||
}
|
||||
$this->real_name = 'tables';
|
||||
$this->classes = 'tableContainer';
|
||||
$this->classes = 'tableContainer subContainer';
|
||||
|
||||
$new_label = _pgettext('Create new table', 'New');
|
||||
$new = PMA_NodeFactory::getInstance('Node', $new_label);
|
||||
|
||||
@ -39,7 +39,7 @@ class Node_View_Container extends Node
|
||||
$GLOBALS['cfg']['NavigationTreeTableLevel']
|
||||
);
|
||||
}
|
||||
$this->classes = 'viewContainer';
|
||||
$this->classes = 'viewContainer subContainer';
|
||||
$this->real_name = 'views';
|
||||
|
||||
$new_label = _pgettext('Create new view', 'New');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user