mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-06 13:34:56 +02:00
Minor changes
This commit is contained in:
parent
76cc5d8a96
commit
a045faeb6d
@ -13,11 +13,18 @@
|
||||
// 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);
|
||||
// Login check
|
||||
check_login ();
|
||||
|
||||
if ($getChildren) {
|
||||
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' => '',
|
||||
@ -30,6 +37,9 @@ if ($getChildren) {
|
||||
'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,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…
x
Reference in New Issue
Block a user