Code

Input fields must be disabled in case of missing ACL
[gosa.git] / plugins / gofon / phoneaccount / class_phoneAccount.inc
index 8b7fdca069b8898b1321db50edca427fe5f73f55..0a9601386ec7c9856418606a92106ee48cc99018 100644 (file)
@@ -238,7 +238,7 @@ class phoneAccount extends plugin
         switch ($type){
 
           case "combo":
-            $str= "<select name='".$var."' ".chkacl($this->acl, "goFonMacro").">";
+            $str= "<select name='".$var."' ".chkacl($this->acl, "goFonMacro")."  ".chkacl($this->acl, "goFonMacro").">";
             foreach(split(":",$default) as $choice){
               if($choosen==$choice){
                 $str.= "\n<option value='".$choice."' selected>".$choice."&nbsp;</option>";
@@ -252,9 +252,9 @@ class phoneAccount extends plugin
 
           case "bool":
             if(!$choosen){
-              $str="\n<input type='checkbox' name='".$var."' value='1'>";
+              $str="\n<input type='checkbox' name='".$var."' value='1' ".chkacl($this->acl, "goFonMacro")." >";
             }else{
-              $str="\n<input type='checkbox' name='".$var."' value='1' checked>";
+              $str="\n<input type='checkbox' name='".$var."' value='1' checked  ".chkacl($this->acl, "goFonMacro").">";
             }
             $macrotab.= "<td colspan='2'>$str&nbsp;$name";
             break;
@@ -330,6 +330,7 @@ class phoneAccount extends plugin
     /* Transfer ACL's */
     foreach($this->attributes as $val){
       $smarty->assign($val."ACL", chkacl($this->acl, "$val"));
+      $smarty->assign($val,$this->$val);
     }
 
     /* Fill arrays */
@@ -453,6 +454,16 @@ class phoneAccount extends plugin
       $message[]= sprintf(_("You need to specify at least one phone number!"));
     }
 
+    if(($this->goFonPIN)==""){
+      $this->goFonPIN = array();
+    }else{
+      if(strcmp ((int)($this->goFonPIN),($this->goFonPIN))){
+        $message[] = sprintf(_("The given PIN is not valid, only numbers are allowed for this type."));
+      }elseif(strlen($this->goFonPIN) < 4){
+        $message[] = sprintf(_("The given PIN is too short"));
+      }
+
+    }
     /* Check timestamps and phonenumbers */
     foreach ($this->forwarders as $fw){