From: hickert Date: Wed, 3 May 2006 08:21:42 +0000 (+0000) Subject: Some fixes for summary tab X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c1de1d55942fe7810df980634062fb3861e85f1d;p=gosa.git Some fixes for summary tab git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3188 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/class_faiSummaryTab.inc b/plugins/admin/fai/class_faiSummaryTab.inc index dbe14a3cf..d42dbb8c1 100644 --- a/plugins/admin/fai/class_faiSummaryTab.inc +++ b/plugins/admin/fai/class_faiSummaryTab.inc @@ -52,21 +52,37 @@ class faiSummaryTab extends plugin{ $_SESSION['faiSummaryTab']['UniqueID'] = 0; - /* Get Releases */ - $ldap = $config->get_ldap_link(); - $ldap->cd($config->current['BASE']); - $ldap->search("(&(objectClass=organizationalUnit)(objectClass=FAIbranch))",array("ou")); - while($attrs = $ldap->fetch()){ - if(preg_match("/,ou=systems,/i",$attrs['dn'])){ - $this->Releases [ $attrs['ou'][0]] = $attrs['dn']; + $this->Releases = array_flip($this->getBranches()); + + if(count($this->Classes) && (!empty($this->Release))){ + foreach($this->Classes as $class){ + $this->Result[$class] = $this->resolveObject($class); } } + } - foreach($this->Classes as $class){ - $this->Result[$class] = $this->resolveObject($class); + /* returns an array with all possibly release types */ + function getBranches($base = false,$prefix = "") + { + $ret = array("main"=>"/"); + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $faifilter = $_SESSION['faifilter']; + if(!$base){ + $base= "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; } + $ldap->cd($base); + $ldap->ls("(objectClass=FAIbranch)",$base); + while($attrs = $ldap->fetch()){ + if((isset($attrs['ou']))&&($attrs['dn']!=$base)){ + $ret[$attrs['dn']]= $prefix.$attrs['ou'][0]; + $ret = array_merge($ret,$this->getBranches($attrs['dn'],"".$prefix.$attrs['ou'][0]."/")); + } + } + return($ret); } + function execute() { $display = ""; @@ -80,9 +96,17 @@ class faiSummaryTab extends plugin{ /* Create output of our resolved objects */ function createSummary($data) { + + /* Don't generate any output, if there is no result */ $str =" "; + if(!count($this->Result)){ + $str.="
"; + $str.= (_("This object has no FAI classes assigned.")); + $str.= "
"; + return($str); + } - /* walkt throigh all classes */ + /* walk through all classes */ foreach($data as $key => $entry){ /* Check every kind of object type */