Code

Removed unused attribute
[gosa.git] / plugins / admin / systems / class_servService.inc
index 57131149446dd6af1ec1d1157f83d68ce479da9c..3c6fae64c4c4db91ef6e2dddc6b1cc7be17b9330 100644 (file)
@@ -7,7 +7,6 @@ class servservice extends plugin
   var $cli_description= "Some longer text\nfor help";
   var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
 
-
   var $goExportEntry  = array();
   var $goTimeSource   = array();
   var $goLdapBase= "";
@@ -19,8 +18,8 @@ class servservice extends plugin
   var $goSyslogServer="";
   var $goCupsServer="";
 
-
   /* attribute list for save action */
+  var $ignore_account= TRUE;
   var $attributes       = array("goExportEntry","goTimeSource","goLdapBase","goXdmcpIsEnabled","goFontPath" );
   var $objectclasses    = array("top","goServer"); 
   var $additionaloc     = array(
@@ -62,6 +61,8 @@ class servservice extends plugin
     $smarty= get_smarty();
 
     
+    $smarty->assign("staticAddress", "");
+      
     /*  
     Handling for Nfs Export Entries
     */
@@ -138,15 +139,20 @@ class servservice extends plugin
     foreach ($this->attributes as $attr){
       $smarty->assign("$attr", $this->$attr);
       $smarty->assign("$attr"."ACL", chkacl($this->acl, $attr));
+      $smarty->assign($attr."State","");
     }
 
 
     /* Classes... */
-    foreach ($this->additionaloc as $oc => $dummy){
+foreach ($this->additionaloc as $oc => $dummy){
       if (isset($this->objectclasses[$oc])){
         $smarty->assign("$oc", "checked");
+        $smarty->assign("$oc"."State", "");
         $smarty->assign("$oc"."ACL", chkacl($this->acl, $oc));
+
       } else {
+        $smarty->assign("$oc", "");
+        $smarty->assign("$oc"."ACL", chkacl($this->acl, $oc));
         $smarty->assign("$oc"."State", "disabled");
       }
     }
@@ -167,14 +173,16 @@ class servservice extends plugin
   /* Save data to object */
   function save_object()
   {
-     plugin::save_object();
-
-    /* Save checkbox state */
-    foreach ($this->additionaloc as $oc => $dummy){
-      if (isset($_POST[$oc]) && $_POST[$oc] == '1'){
-        $this->objectclasses[$oc]= $oc;
-      } else {
-        unset($this->objectclasses[$oc]);
+    if (isset($_POST['servicetab'])){
+      plugin::save_object();
+
+      /* Save checkbox state */
+      foreach ($this->additionaloc as $oc => $dummy){
+        if (isset($_POST[$oc]) && $_POST[$oc] == '1'){
+          $this->objectclasses[$oc]= $oc;
+        } else {
+          unset($this->objectclasses[$oc]);
+        }
       }
     }
  
@@ -203,17 +211,14 @@ class servservice extends plugin
  
     $test = $this->objectclasses;
     $tmp = array_flip($this->attrs['objectClass']);
+   
     
     foreach($this->additionaloc as $key=>$val) {
       unset($tmp[$key]);
       }
-    
-    foreach($tmp as $val){
-      if(in_array($val,$test)){
-        $tmp[$val];
-        }
-      }
-    
+   
+
     $classes = (array_flip(array_merge(array_flip($test),$tmp)));
 
     unset($this->attrs['objectClass']);
@@ -232,10 +237,21 @@ class servservice extends plugin
       }
     }
     $this->attrs = array_reverse($this->attrs);
-    
 
-      
+    /* Check if we are able to set these attributes */
+#fixme : It Would be better to check ObjectClass rights to, but what is to do if there are insuficient rights 
+    foreach($this->additionaloc as $oc => $attrs)
+    {
+      foreach($attrs as $val)
+      {
+      if(chkacl($this->acl,$val)=="")
+        {
+        unset($this->attrs[$val]);
+        unset($this->$val);
+        }
+      }
+    }
+    
     /* Write to LDAP */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->dn);
@@ -249,7 +265,6 @@ class servservice extends plugin
     } else {
       $this->handle_post_events("add");
     }
-
   }
 
 }