Code

Added FAIstate to faiManagement
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 10 Jul 2006 09:48:12 +0000 (09:48 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 10 Jul 2006 09:48:12 +0000 (09:48 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4063 594d385d-05f5-0310-b6e9-bd551577e9d8

include/functions_FAI.inc
plugins/admin/fai/class_faiManagement.inc

index 09c1505145e98b1a51ae949f12b9c02d9a8d01ab..a54100c03e90b5125f14a7af7d982b81e3b6b26e 100644 (file)
@@ -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;
index 152830c966e2f1ed4a87ce34f485d886b53218a4..7e4f4e50cdae96191642a8b48a40da75acd1aa0f 100644 (file)
@@ -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);