Code

Use binary operator instead of boolean
[gosa.git] / plugins / admin / fai / class_faiVariableEntry.inc
index f367315026db30f7af6f4bf136aacb228cd9a0ed..5a0e04f2ef08421922c5758b78baef2087fbfcf2 100644 (file)
@@ -18,17 +18,24 @@ class faiVariableEntry extends plugin
   var $FAIvariableContent   = "";
   var $description   = "";
   var $status        = "new";
+
+  var $FAIstate      = "";
   
   function faiVariableEntry ($config, $dn= NULL,$object=false)
   {
     plugin::plugin ($config, $dn);
-    if($dn != "new"){
+    if((isset($object['cn'])) && (!empty($object['cn']))){
       $this->orig_cn= $object['cn'];
       $this->dn=$object['dn'];
       foreach($object as $name=>$value){
         $oname = $name;
         $this->$oname=addslashes($value);
       }
+
+      if(isset($this->attrs['FAIstate'][0])){
+        $this->FAIstate = $this->attrs['FAIstate'][0];
+      }
+
     }else{
       $this->status = "new";
       $this->orig_cn       = false;
@@ -55,6 +62,14 @@ class faiVariableEntry extends plugin
       }
     }
 
+    foreach($this->attributes as $attr){
+      if(($this->FAIstate == "freeze") || (chkacl($this->acl,$attr)!= "")){
+        $smarty->assign($attr."ACL"," disabled ");
+      }else{
+        $smarty->assign($attr."ACL","  ");
+      }
+    }
+
     $display.= $smarty->fetch(get_template_path('faiVariableEntry.tpl', TRUE));
     return($display);
   }
@@ -62,7 +77,7 @@ class faiVariableEntry extends plugin
   /* Save data to object */
   function save_object()
   {
-    if(isset($_POST['SubObjectFormSubmitted'])){
+    if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
       foreach($this->attributes as $attrs){
         if(isset($_POST[$attrs])){
           $this->$attrs = $_POST[$attrs];
@@ -76,7 +91,8 @@ class faiVariableEntry extends plugin
   /* Check supplied data */
   function check()
   {
-    $message= array();
+    /* Call common method to give check the hook */
+    $message= plugin::check();
     
     if(empty($this->FAIvariableContent)) {
       $message[]=_("Please specify a value for the attribute 'content'.");