From ebe2cb6edadc6e49b06607209c1b856f3db29091 Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 19 Aug 2009 21:19:35 +1000 Subject: [PATCH] Performance improvements for the tree. --- lib/AJAXTree.php | 5 ++++- lib/QueryRender.php | 10 ++++++---- lib/Tree.php | 8 ++++++-- lib/TreeItem.php | 1 - 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/AJAXTree.php b/lib/AJAXTree.php index e94d869..d50d946 100644 --- a/lib/AJAXTree.php +++ b/lib/AJAXTree.php @@ -149,7 +149,10 @@ class AJAXTree extends HTMLTree { debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs); $children = array(); - foreach ($parent_entry->getChildren() as $child) { + $pchildren = $parent_entry->getChildren(); + usort($pchildren,'pla_compare_dns'); + + foreach ($pchildren as $child) { if (! $this->getEntry($child)) $this->addEntry($child); diff --git a/lib/QueryRender.php b/lib/QueryRender.php index 8b7096d..aeeaf4c 100644 --- a/lib/QueryRender.php +++ b/lib/QueryRender.php @@ -261,11 +261,13 @@ function hideall(key,except) { echo "\n\n"; $this->drawBaseTabs(); + $ado = $this->template->getAttrDisplayOrder(); switch(get_request('format','REQUEST',false,'table')) { case 'list': $counter = 0; + foreach ($this->template->results as $base => $results) { if (! $show = get_request('show','REQUEST')) $show = ($counter++ === 0 ? $this->getAjaxRef($base) : null); @@ -303,7 +305,7 @@ function hideall(key,except) { htmlspecialchars(dn_unescape($dn))); # Iterate over each attribute for this entry - foreach (explode(',',$this->template->getAttrDisplayOrder()) as $attr) { + foreach (explode(',',$ado) as $attr) { # Ignore DN, we've already displayed it. if ($attr == 'dn') continue; @@ -387,7 +389,7 @@ function hideall(key,except) { echo ' '; echo ' '; - foreach (explode(',',$this->template->getAttrDisplayOrder()) as $attr) { + foreach (explode(',',$ado) as $attr) { echo ''; $this->draw('Name',$afattrs[$attr]); echo ''; @@ -418,7 +420,7 @@ function hideall(key,except) { IMGDIR,get_icon($server->getIndex(),$dn)); # We'll clone our attribute factory attributes, since we need to add the values to them for rendering. - foreach (explode(',',$this->template->getAttrDisplayOrder()) as $attr) { + foreach (explode(',',$ado) as $attr) { # If the entry is blank, we'll draw an empty box and continue. if (! isset($dndetails[$attr])) { echo ' '; @@ -454,7 +456,7 @@ function hideall(key,except) { if ($_SESSION[APPCONFIG]->getValue('mass','enabled')) { printf('',++$counter%2 ? 'odd' : 'even',$counter); echo ''; - printf('',2+count(explode(',',$this->template->getAttrDisplayOrder()))); + printf('',2+count(explode(',',$ado))); echo '