From 119350072dd50696b161c03a4b4463a16126131d Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 10 Jul 2006 09:48:12 +0000 Subject: [PATCH] Added FAIstate to faiManagement git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4063 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/functions_FAI.inc | 22 ++++++++++++++++++++++ plugins/admin/fai/class_faiManagement.inc | 21 +++++++-------------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/include/functions_FAI.inc b/include/functions_FAI.inc index 09c150514..a54100c03 100644 --- a/include/functions_FAI.inc +++ b/include/functions_FAI.inc @@ -459,6 +459,28 @@ function save_FAI_object($dn,$attrs) } +function get_release_tag($dn) +{ + global $config; + $ldap = $config->get_ldap_link(); + $ldap->cd($dn); + $ldap->cat($dn,array("FAIstate")); + + if($ldap->count()){ + + $attr = $ldap->fetch(); + if(isset($attr['FAIstate'][0])){ + if(preg_match("/freeze/",$attr['FAIstate'][0])){ + return("freeze"); + }elseif(preg_match("/branch/",$attr['FAIstate'][0])){ + return("branch"); + } + } + } + return(""); +} + + function get_following_releases_that_inherit_this_object($dn) { global $config; diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc index 152830c96..7e4f4e50c 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -667,6 +667,8 @@ class faiManagement extends plugin } } + $this->lock_type = get_release_tag(get_release_dn($base)); + /* Get resolved release dependencies */ $tmp = get_all_objects_for_given_base($base,"(&(|(objectClass=FAIpartitionTable)(objectClass=FAIpackageList)(objectClass=FAIscript) (objectClass=FAIvariable)(objectClass=FAIhook)(objectClass=FAIprofile)(objectClass=FAItemplate))(cn=$Regex))"); @@ -709,6 +711,7 @@ class faiManagement extends plugin } /* Clean up object informations */ + $obj = array(); $obj['cn'] = $object['cn'][0]; $obj['dn'] = $object['dn']; $obj['description'] = $object['description'][0]; @@ -717,28 +720,18 @@ class faiManagement extends plugin /* Append type to this string, to be able to check if the selected * entry is of type 'freeze' or 'branch' */ - if(isset($object['FAIstate'])){ - $obj['FAIstate'] = $object['FAIstate'][0]; - $str.="|".$obj['FAIstate']; + if(!isset($object['FAIstate'])){ + $obj['FAIstate'] = $this->lock_type; }else{ - $obj['FAIstate'] =""; + $obj['FAIstate'] = $object['FAIstate'][0]; } + $this->objects[strtolower($obj['cn']).$obj['cn'].$type] = $obj; $this->objects[strtolower($obj['cn']).$obj['cn'].$type]['type']=$type; } } } - /* Tell class what we have currently opened - 'main' has type '' */ - if(preg_match("/freeze/",$str)){ - $this->lock_type = "freeze"; - }elseif(preg_match("/branch/",$str)){ - $this->lock_type = "branch"; - }else{ - $this->lock_type = ""; - } - ksort($this->objects); reset ($this->objects); -- 2.30.2