Only sort children after reading additional entries
This commit is contained in:
parent
76ddeccf8c
commit
26fa2ba2c5
@ -147,10 +147,8 @@ class AJAXTree extends HTMLTree {
|
|||||||
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||||
|
|
||||||
$children = array();
|
$children = array();
|
||||||
$pchildren = $parent_entry->getChildren();
|
|
||||||
usort($pchildren,'pla_compare_dns');
|
|
||||||
|
|
||||||
foreach ($pchildren as $child) {
|
foreach ($parent_entry->getChildren() as $child) {
|
||||||
if (! $this->getEntry($child))
|
if (! $this->getEntry($child))
|
||||||
$this->addEntry($child);
|
$this->addEntry($child);
|
||||||
|
|
||||||
|
@ -301,6 +301,8 @@ abstract class Tree {
|
|||||||
if ($nolimit)
|
if ($nolimit)
|
||||||
@set_time_limit($_SESSION[APPCONFIG]->getValue('search','time_limit'));
|
@set_time_limit($_SESSION[APPCONFIG]->getValue('search','time_limit'));
|
||||||
|
|
||||||
|
$this->entries[$dnlower]->readingChildren(true);
|
||||||
|
|
||||||
foreach ($ldap['children'] as $child) {
|
foreach ($ldap['children'] as $child) {
|
||||||
if (DEBUG_ENABLED)
|
if (DEBUG_ENABLED)
|
||||||
debug_log('Adding (%s)',64,0,__FILE__,__LINE__,__METHOD__,$child);
|
debug_log('Adding (%s)',64,0,__FILE__,__LINE__,__METHOD__,$child);
|
||||||
@ -309,6 +311,8 @@ abstract class Tree {
|
|||||||
$this->entries[$dnlower]->addChild($child);
|
$this->entries[$dnlower]->addChild($child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->entries[$dnlower]->readingChildren(false);
|
||||||
|
|
||||||
if (count($this->entries[$dnlower]->getChildren()) == $ldap['child_limit'])
|
if (count($this->entries[$dnlower]->getChildren()) == $ldap['child_limit'])
|
||||||
$this->entries[$dnlower]->setSizeLimited();
|
$this->entries[$dnlower]->setSizeLimited();
|
||||||
else
|
else
|
||||||
|
@ -33,6 +33,10 @@ class TreeItem {
|
|||||||
private $size_limited = true;
|
private $size_limited = true;
|
||||||
# Last template used to edit this entry
|
# Last template used to edit this entry
|
||||||
private $template = null;
|
private $template = null;
|
||||||
|
# Do we need to sort the children
|
||||||
|
private $childsort = true;
|
||||||
|
# Are we reading the children
|
||||||
|
private $reading_children = false;
|
||||||
|
|
||||||
public function __construct($server_id,$dn) {
|
public function __construct($server_id,$dn) {
|
||||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||||
@ -115,9 +119,38 @@ class TreeItem {
|
|||||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||||
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->children);
|
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->children);
|
||||||
|
|
||||||
|
if ($this->childsort && ! $this->reading_children) {
|
||||||
|
usort($this->children,'pla_compare_dns');
|
||||||
|
$this->childsort = false;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->children;
|
return $this->children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function readingChildren($bool) {
|
||||||
|
$this->reading_children = $bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do the children require resorting
|
||||||
|
*/
|
||||||
|
public function isChildSorted() {
|
||||||
|
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||||
|
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->childsort);
|
||||||
|
|
||||||
|
return $this->childsort;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark the children as sorted
|
||||||
|
*/
|
||||||
|
public function childSorted() {
|
||||||
|
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||||
|
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||||
|
|
||||||
|
$this->childsort = false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a child to this DN entry.
|
* Add a child to this DN entry.
|
||||||
*
|
*
|
||||||
@ -131,6 +164,7 @@ class TreeItem {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
array_push($this->children,$dn);
|
array_push($this->children,$dn);
|
||||||
|
$this->childsort = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user