Minor changes
This commit is contained in:
parent
76cc5d8a96
commit
a045faeb6d
|
@ -13,6 +13,13 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Only accesible by ajax
|
||||
if (is_ajax ()) {
|
||||
global $config;
|
||||
|
||||
// Login check
|
||||
check_login ();
|
||||
|
||||
require_once("include/class/Tree.class.php");
|
||||
|
||||
$getChildren = (bool)get_parameter('getChildren', 0);
|
||||
|
@ -32,4 +39,7 @@ if ($getChildren) {
|
|||
echo json_encode(array('success' => 1, 'tree' => $tree->getArray()));
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
?>
|
|
@ -116,11 +116,11 @@ TreeController = {
|
|||
|
||||
container.append($node);
|
||||
|
||||
if (typeof element.children != 'undefined' && element.children.length > 0) {
|
||||
if (typeof element.tree != 'undefined' && element.tree.length > 0) {
|
||||
$node.addClass("leaf-closed");
|
||||
|
||||
// Add children
|
||||
var $children = _processGroup($node, element.children);
|
||||
var $children = _processGroup($node, element.tree);
|
||||
$node.data('children', $children);
|
||||
|
||||
$leafIcon.click(function () {
|
||||
|
@ -146,7 +146,7 @@ TreeController = {
|
|||
$leafIcon.click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (! $node.hasClass("children-loaded")) {
|
||||
if (! $node.hasClass("children-loaded") && ! $node.hasClass("leaf-empty")) {
|
||||
$node
|
||||
.removeClass("leaf-closed")
|
||||
.removeClass("leaf-error")
|
||||
|
@ -169,6 +169,8 @@ TreeController = {
|
|||
},
|
||||
success: function(data, textStatus, xhr) {
|
||||
if (data.success) {
|
||||
|
||||
if (typeof element.tree != 'undefined' && element.tree.length > 0) {
|
||||
$node.addClass("leaf-open");
|
||||
|
||||
var $children = _processGroup($node, data.tree);
|
||||
|
@ -176,6 +178,10 @@ TreeController = {
|
|||
|
||||
$node.data('children', $children);
|
||||
}
|
||||
else {
|
||||
$node.addClass("leaf-empty");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$node.addClass("leaf-error");
|
||||
}
|
||||
|
@ -185,7 +191,7 @@ TreeController = {
|
|||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
else if (! $node.hasClass("leaf-empty")) {
|
||||
if ($node.hasClass("leaf-open")) {
|
||||
$node
|
||||
.removeClass("leaf-open")
|
||||
|
|
Loading…
Reference in New Issue