diff --git a/bureau/admin/adm_var_edit.php b/bureau/admin/adm_var_edit.php index 3734c8fa..8a30c1c9 100644 --- a/bureau/admin/adm_var_edit.php +++ b/bureau/admin/adm_var_edit.php @@ -22,10 +22,57 @@ $fields = array ( getFields($fields); variable_get("aaa_test3", -array("ns1"=> array("ns"=>"ns1.%%FQDN%%", "ip"=>"%%PUBLIC_IP%%", "enabled"=>"%%ENABLED%%"), "ns2"=>array("ns"=>"fdsffsd", "ip"=>"fdsfdfds", "enabled"=>"fds"), 'ns55'=> 'arf' ), +array( + "ns1"=> + array( + "ns"=>"ns1.%%FQDN%%", + "ip"=>"%%PUBLIC_IP%%", + "enabled"=>"%%ENABLED%%"), + "ns2"=> + array( + "ns"=>"fdsffsd", + "ip"=>"fdsfdfds", + "enabled"=>"fds"), + 'ns55'=> 'arf' +), "This is a test!", -array("ns1"=> array("ns"=>"ns name", "ip"=>"ip address", "enabled"=>"enabled"), "ns2"=>array("ns"=>"ns name", "ip"=>"ip address", "enabled"=>"enabled"), 'ns3'=>'toto' ) -); +array( + "ns1"=> + array( + "ns"=> + array( + 'desc'=>"ns name", + 'type'=>'string'), + "ip"=> + array( + 'desc'=>"ip address", + 'type'=>'ip'), + "enabled"=> + array( + 'desc'=>"enabled", + 'type'=>"boolean"), + ), + "ns2"=>array( + "ns"=> + array( + 'desc'=>"ns name", + 'type'=>'string'), + "ip"=> + array( + 'desc'=>"ip address", + 'type'=>'ip'), + "enabled"=> + array( + 'desc'=>"enabled", + 'type'=>"boolean"), + ), + "ns3"=>array( + "desc"=>"here another", + "type"=>"integer", + ), +) + ); + if (empty($var)) { echo "

";__("Missing var name");echo "

"; @@ -69,27 +116,50 @@ echo ""; echo "
"; +function var_input($infotype, $name, $value='') { + $id = rand(); + echo ""; + switch(strtolower($infotype['type'])) { + case "string": + echo ""; + break; + case "integer": + echo ""; + break; + case "ip": + echo ""; + break; + case "boolean": + echo ""; // This way, there is allways something send, even if checkbox is unchecked + echo ""; + break; + default: + echo "WTF ? Dunno what to do with a ".$infotype['type']; + break; + } +} + function edit_var($var_arr) { global $allvars; echo "
"; echo ""; if (is_array( $allvars['DEFAULT'][null][$var_arr['name']]['type'] )) { echo "
"; echo ""; @@ -117,23 +187,22 @@ function add_var($stratatata, $stratatata_arr=null) { eoption($stratatata_arr, null); echo " "; } - if (is_array( $allvars['DEFAULT'][null][$var]['type'] )) { + $infotype = $allvars['DEFAULT'][null][$var]['type']; + if (is_array( $infotype )) { echo "