Minor changes
This commit is contained in:
parent
76cc5d8a96
commit
a045faeb6d
|
@ -13,23 +13,33 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
require_once("include/class/Tree.class.php");
|
||||
// Only accesible by ajax
|
||||
if (is_ajax ()) {
|
||||
global $config;
|
||||
|
||||
$getChildren = (bool)get_parameter('getChildren', 0);
|
||||
|
||||
if ($getChildren) {
|
||||
$type = get_parameter('type', 'group');
|
||||
$filter = get_parameter('filter',
|
||||
array('search' => '',
|
||||
'status' => AGENT_STATUS_ALL));
|
||||
$id = (int)get_parameter('id', 0);
|
||||
$method = get_parameter('method', 'on_demand');
|
||||
// Login check
|
||||
check_login ();
|
||||
|
||||
$tree = new Tree($type, $method, $id);
|
||||
$tree->setFilter(array(
|
||||
'status' => $filter['status'],
|
||||
'search' => $filter['search']));
|
||||
echo json_encode(array('success' => 1, 'tree' => $tree->getArray()));
|
||||
require_once("include/class/Tree.class.php");
|
||||
|
||||
$getChildren = (bool)get_parameter('getChildren', 0);
|
||||
|
||||
if ($getChildren) {
|
||||
$type = get_parameter('type', 'group');
|
||||
$filter = get_parameter('filter',
|
||||
array('search' => '',
|
||||
'status' => AGENT_STATUS_ALL));
|
||||
$id = (int)get_parameter('id', 0);
|
||||
$method = get_parameter('method', 'on_demand');
|
||||
|
||||
$tree = new Tree($type, $method, $id);
|
||||
$tree->setFilter(array(
|
||||
'status' => $filter['status'],
|
||||
'search' => $filter['search']));
|
||||
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,12 +169,18 @@ TreeController = {
|
|||
},
|
||||
success: function(data, textStatus, xhr) {
|
||||
if (data.success) {
|
||||
$node.addClass("leaf-open");
|
||||
|
||||
var $children = _processGroup($node, data.tree);
|
||||
$children.slideDown();
|
||||
if (typeof element.tree != 'undefined' && element.tree.length > 0) {
|
||||
$node.addClass("leaf-open");
|
||||
|
||||
$node.data('children', $children);
|
||||
var $children = _processGroup($node, data.tree);
|
||||
$children.slideDown();
|
||||
|
||||
$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