Code

Updated divlists.
[gosa.git] / plugins / admin / fai / class_faiTemplateEntry.inc
index 24bab5d1311f3d4239325e13b4e5de9c06ffd68d..7a3c48ddf370042b058dca626bc8da9956fded21 100644 (file)
@@ -137,47 +137,47 @@ class faiTemplateEntry extends plugin
       $smarty->assign($attr."ACL",$this->getacl($attr,preg_match("/freeze/",$this->FAIstate)));
     }
 
-    $display.= "<h2><font color='red'>Fix / problen and ensure that size and content are correct if you download this template. Revision > 4582 (gosa-2.5 is already patched)</font></h2>".$smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE));
+    $display.=  $smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE));
     return($display);
   }
 
   /* Save data to object */
   function save_object()
   {
-    if (!isset($_POST['FAItemplatePath'])){
-      return;
-    }
+    /* Check if form is posted and we are not freezed */
     if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
-      foreach($this->attributes as $attrs){
-        if($attrs == "FAItemplateFile") 
-          continue;
-        if($attrs == "FAIowner") {
-          $this->$attrs = $_POST["user"] . '.' . $_POST["group"];
-          continue;
-        }
-        if(isset($_POST[$attrs])){
-          $this->$attrs = $_POST[$attrs];
-        }else{
-          $this->$attrs = "";
-        }
+
+      plugin::save_object();
+
+      /* Set user.group (FAIowner) attribute */  
+      if(isset($_POST['group']) && isset($_POST["user"]) && $this->acl_is_writeable("FAIowner")){
+        $this->FAIowner = $_POST["user"].'.'.$_POST["group"];
+        $this->user = $_POST['user'];
+        $this->group= $_POST['group'];
       }
-      /* Save mode */
-      $tmode= "";
-      foreach (array("s", "u", "g", "o") as $type){
-        $nr= 1;
-        $dest= 0;
-        while ($nr < 5){
-          if (isset($_POST["$type$nr"])){
-            $dest+= $nr;
+
+      /* Check if permissions have changed */
+      if($this->acl_is_writeable("FAImode")){
+
+        /* Save mode */
+        $tmode= "";
+        foreach (array("s", "u", "g", "o") as $type){
+          $nr= 1;
+          $dest= 0;
+          while ($nr < 5){
+            if (isset($_POST["$type$nr"])){
+              $dest+= $nr;
+            }
+            $nr+= $nr;
           }
-          $nr+= $nr;
+          $tmode= $tmode.$dest;
         }
-        $tmode= $tmode.$dest;
+        $this->FAImode= $tmode;
       }
-      $this->FAImode= $tmode;
     }
   }
 
+
   /* Check supplied data */
   function check()
   {