Code

Updated divlists.
[gosa.git] / plugins / admin / fai / class_faiVariableEntry.inc
index 46614d0cb339932535cc7954ad939197b106f67e..6dc864d17c9ba9fadef3a28bff5a15101b6a6439 100644 (file)
@@ -24,7 +24,7 @@ class faiVariableEntry extends plugin
   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){
@@ -62,14 +62,17 @@ 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","  ");
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $acl = $this->getacl($name);
+      if($this->FAIstate == "freezed"){
+        $acl = preg_replace("/w/","",$acl);
       }
+      $smarty->assign($name."ACL",$acl);
     }
 
+
+
     $display.= $smarty->fetch(get_template_path('faiVariableEntry.tpl', TRUE));
     return($display);
   }
@@ -77,12 +80,14 @@ class faiVariableEntry extends plugin
   /* Save data to object */
   function save_object()
   {
-    if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
+     if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
       foreach($this->attributes as $attrs){
-        if(isset($_POST[$attrs])){
-          $this->$attrs = $_POST[$attrs];
-        }else{
-          $this->$attrs = "";
+        if($this->acl_is_writeable($attrs)){
+          if(isset($_POST[$attrs])){
+            $this->$attrs = $_POST[$attrs];
+          }else{
+            $this->$attrs = "";
+          }
         }
       }
     }
@@ -121,6 +126,26 @@ class faiVariableEntry extends plugin
     $tmp['status']  = $this->status;  
     return($tmp);
   }
+
+  /* Return plugin informations for acl handling */
+  function plInfo()
+  {
+    return (array(
+          "plShortName" => _("Variable entry"),
+          "plDescription" => _("FAI variable entry "),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 23,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name"),
+            "description"       => _("Description"),
+            "FAIvariableContent"=> _("Variable content") )
+          ));
+  }
+
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>