Code

Use binary operator instead of boolean
[gosa.git] / plugins / admin / fai / class_faiVariableEntry.inc
index 06bb6305017e44b04642dd4641ef72f42a00d595..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;
@@ -39,6 +46,7 @@ class faiVariableEntry extends plugin
   {
        /* Call parent execute */
        plugin::execute();
+
     /* Fill templating stuff */
     $smarty     = get_smarty();
     $display = "";
@@ -48,9 +56,17 @@ class faiVariableEntry extends plugin
      */
     foreach($this->attributes as $attrs){
       if(get_magic_quotes_gpc()){
-        $smarty->assign($attrs,htmlentities (stripslashes($this->$attrs)));
+        $smarty->assign($attrs,htmlentities (stripslashes(utf8_decode($this->$attrs))));
+      }else{
+        $smarty->assign($attrs,htmlentities (utf8_decode($this->$attrs)));
+      }
+    }
+
+    foreach($this->attributes as $attr){
+      if(($this->FAIstate == "freeze") || (chkacl($this->acl,$attr)!= "")){
+        $smarty->assign($attr."ACL"," disabled ");
       }else{
-        $smarty->assign($attrs,htmlentities (($this->$attrs)));
+        $smarty->assign($attr."ACL","  ");
       }
     }
 
@@ -61,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];
@@ -75,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'.");