Code

checkbox instead of combo for bool
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 24 Jun 2005 06:58:33 +0000 (06:58 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 24 Jun 2005 06:58:33 +0000 (06:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@821 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/gofon/phoneaccount/class_phoneAccount.inc

index dd7c7677729042962273b84e64a8e8eb1677357b..e9ec34749523bfd4a9152911a7e751fa069206ee 100644 (file)
@@ -245,19 +245,15 @@ class phoneAccount extends plugin
           $str.="</select>";
         }
 
+
+      
         /* Display switch for true false*/
         if($type == "bool"){
-
-          $str="<select name='".$var."' ".chkacl($this->acl, "goFonMacro").">";
-
-          if($choosen){
-            $str.="\n<option name='".$var."' value='0'>"._("false")."</option>";
-            $str.="\n<option name='".$var."' value='1' selected>"._("true")."</option>";
+          if(!$choosen){
+            $str="\n<input type='checkbox' name='".$var."' value='1'>";
           }else{
-            $str.="\n<option name='".$var."' value='0' selected>"._("false")."</option>";
-            $str.="\n<option name='".$var."' value='1'>"._("true")."</option>";
+            $str="\n<input type='checkbox' name='".$var."' value='1' checked>";
           }
-          $str.="<select name='".$var."'>";
         }
 
         /* display simple textfield */ 
@@ -426,6 +422,17 @@ class phoneAccount extends plugin
           if(isset($_POST[$paras['var']])){
             $this->macroarray[$this->macro][$key]['choosen'] = $_POST[$paras['var']]; 
           }
+        
+          /* Checkboxes are special, they are not Posted if they are not selected, so the won't be changed with the above code 
+             We need this code below to read and save checkboxes correct
+          */
+          if($this->macroarray[$this->macro][$key]['type']=="bool"){
+            if(isset($_POST[$this->macroarray[$this->macro][$key]['var']])) {
+              $this->macroarray[$this->macro][$key]['choosen']=$_POST[$paras['var']];
+            }else{
+              $this->macroarray[$this->macro][$key]['choosen']=false;
+            }
+          }
         }
       }
     }