diff --git a/config_editor.inc.php b/config_editor.inc.php index df7c230..46df7aa 100644 --- a/config_editor.inc.php +++ b/config_editor.inc.php @@ -183,8 +183,6 @@ function config_editor($category, $year, $array_name, $self) print(""); print(""); break; - case 'multisel': - $multiple = "multiple=\"multiple\""; case "enum": $val = split(',', $val); $values = $var[$k]['type_values']; @@ -213,14 +211,7 @@ function config_editor($category, $year, $array_name, $self) preg_match_all("/([^\|=]+)(?:=([^\|]+))?\|?/", $values, $regs); // print_r($regs); - if($multiple != '') { - $sz = count($regs[1]); - if($sz > 5) $sz=5; - $multiple = "$multiple size=\"$sz\""; - $name="{$name}[]"; - print("\n"); - } - print(""); for($x=0; $x"); break; + case 'multisel': + /* same PERL parse statements as above */ + $val = split(',', $val); + $values = $var[$k]['type_values']; + preg_match_all("/([^\|=]+)(?:=([^\|]+))?\|?/", $values, $regs); + /* Decide which way to show this list */ + $c = count($regs[1]); + $rows = 0; + if($c > 5) { + $rows = intval(($c+2) / 3); + print(""); + print("
 "); + } + + for($x=0; $x<$c; $x++) { + if(($x % $rows) == 0 && $rows > 0) { + print(""); + } + + $e_key = trim($regs[1][$x]); + $e_val = trim($regs[2][$x]); + if($e_val == "") $e_val = $e_key; + + $ch = (in_array($e_key, $val)) ? 'checked="checked"' : ''; + print(""); + print("$e_val
"); + } + if($c > 5) print("
"); + + break; + default: print("\n"); break;