Code

Added on-the-fly state-changing of proxy checkboxes
[gosa.git] / plugins / personal / connectivity / class_proxyAccount.inc
index 9422d83e3ff61ec0a18d463062ce0acbbd22ed31..a097972ddc889696a482a309908a55e6cee6c384 100644 (file)
@@ -48,8 +48,15 @@ class proxyAccount extends plugin
     foreach (array("F", "T", "B", "N") as $val){
       if (is_integer(strpos($this->gosaProxyAcctFlags, "$val"))) {
         $smarty->assign("filter$val", "checked");
+
+        /* Add state variables for on-the-fly state-changing of checkboxes */
+        $smarty->assign($val."state", "");
+        
       } else {
         $smarty->assign("filter$val", "");
+
+        /* Same as above */
+        $smarty->assign($val."state", "disabled");
       }
     }
 
@@ -80,6 +87,8 @@ class proxyAccount extends plugin
     /* Prepare correct state */
     if (!$this->is_account){
       $smarty->assign("pstate", "disabled");
+    } else {
+      $smarty->assign("pstate", "");
     }
 
     /* Show main page */
@@ -107,6 +116,25 @@ class proxyAccount extends plugin
     $this->handle_post_events("remove");
   }
 
+  /* Check values */
+  function check()
+  {
+    $message= array();
+    
+    /* We've got only one value to check for positive integer or emtpy field */
+    if ($this->is_account){
+      if (isset($_POST["quota_size"])){
+        if ($_POST["quota_size"] == ""){
+          $message[]= _("Numerical value for Quota Setting is empty.");
+        }
+        else if ($_POST["quota_size"] <= 0){
+          $message[]= _("Numerical value for Quota Setting is not valid.");
+        }
+      }
+    }
+
+    return $message;
+  }
 
   /* Save data to object */
   function save_object()
@@ -152,10 +180,14 @@ class proxyAccount extends plugin
       /* Save quota values */
       if (chkacl ($this->acl, "gosaProxyQuota") == ""){
         $old= $this->gosaProxyQuota;
-        $this->gosaProxyQuota= $_POST["quota_size"].$_POST["quota_unit"];
+        if(isset($_POST["quota_size"]) && isset($_POST["quota_unit"])){
+          $this->gosaProxyQuota= $_POST["quota_size"].$_POST["quota_unit"];
+        }
         $this->is_modified= ($old != $this->gosaProxyQuota)?TRUE:$this->is_modified;
         $old= $this->gosaProxyQuotaPeriod;
-        $this->gosaProxyQuotaPeriod = $_POST["gosaProxyQuotaPeriod"];
+        if(isset($_POST["gosaProxyQuotaPeriod"])){
+          $this->gosaProxyQuotaPeriod = $_POST["gosaProxyQuotaPeriod"];
+        }
         $this->is_modified= ($old != $this->gosaProxyQuotaPeriod)?TRUE:$this->is_modified;
       }
     }