From: hickert Date: Tue, 30 Mar 2010 06:58:08 +0000 (+0000) Subject: Created static method to fetch all available releases X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=11ca3d945cb455b8e24a27b8b42772e021a88b37;p=gosa.git Created static method to fetch all available releases -This enables us to use this method in Applications and Mimtypes too git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17374 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index caae4b9a9..bc2c786ae 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -124,6 +124,7 @@ class faiManagement extends management $this->registerAction("saveBranch","saveBranch"); $this->registerAction("PerformBranch","PerformBranch"); + $releases = $this->getReleaseStates($this->config,$this->fai_base); $this->releaseSelector = new releaseSelector($releases, $this->fai_release, $this->fai_release); parent::__construct($config, $ui, "FAI object", $headpage); } @@ -650,7 +651,7 @@ class faiManagement extends management $this->handle_post_events('remove'); // Update list and release selector to point to a valid release again. - $releases = $this->getReleaseList(); + $releases = $this->getReleaseStates($this->config,$this->fai_base); if(!isset($releases[$this->fai_releaes])){ $this->fai_release = $this->fai_base; } @@ -873,7 +874,7 @@ class faiManagement extends management $headpage->setBase($this->fai_release); $headpage->update(); - $releases = $this->getReleaseList(); + $releases = $this->getReleaseStates($this->config,$this->fai_base); $this->releaseSelector->setBases($releases); $this->releaseSelector->setBase($this->fai_release); exit(); @@ -952,7 +953,6 @@ class faiManagement extends management $ldap = $this->config->get_ldap_link(); $ldap->ls("(objectClass=FAIbranch)",$base,array("ou","FAIstate")); - while($release = $ldap->fetch()){ $list[$release['dn']] = $prefix.$release['ou'][0]; $list = array_merge($list,$this->getReleaseList($release['dn'],$prefix."  ")); @@ -961,6 +961,33 @@ class faiManagement extends management } + /*! \brief Returns a list of all releases for the releaseSelector + * ou=fai... + * ou=siga,ou=fai... "branch" + * ou=1,ou=siga,ou=fai... "freeze" + */ + static function getReleaseStates($config,$base = "", $fai_base="") + { + $list = array(); + if(empty($fai_base)){ + $fai_base = $base; + $list[$base] = ""; + } + + $ldap = $config->get_ldap_link(); + $ldap->ls("(objectClass=FAIbranch)",$base,array("ou","FAIstate")); + + while($release = $ldap->fetch()){ + $list[$release['dn']] = _("Branch"); + if(isset($release['FAIstate'][0]) && preg_match("/freeze/i",$release['FAIstate'][0])){ + $list[$release['dn']] = _("Freeze"); + } + $list = array_merge($list,faiManagement::getReleaseStates($config,$release['dn'], $fai_base)); + } + return($list); + } + + /*! \brief Returns a list of all releases with full release names * ou=fai... / * ou=siga,ou=fai... siga