forked from science-ation/science-ation
- Use a list of checkboxes instead of multisel. If the list is large, it puts
in in 3 columns under the config option.. if it's small it goes beside it where the config widgets normally go.
This commit is contained in:
parent
7a7f87f892
commit
998c8b9af5
@ -183,8 +183,6 @@ function config_editor($category, $year, $array_name, $self)
|
|||||||
print("<option $sel value=\"no\">No</option>");
|
print("<option $sel value=\"no\">No</option>");
|
||||||
print("</select>");
|
print("</select>");
|
||||||
break;
|
break;
|
||||||
case 'multisel':
|
|
||||||
$multiple = "multiple=\"multiple\"";
|
|
||||||
case "enum":
|
case "enum":
|
||||||
$val = split(',', $val);
|
$val = split(',', $val);
|
||||||
$values = $var[$k]['type_values'];
|
$values = $var[$k]['type_values'];
|
||||||
@ -213,14 +211,7 @@ function config_editor($category, $year, $array_name, $self)
|
|||||||
|
|
||||||
preg_match_all("/([^\|=]+)(?:=([^\|]+))?\|?/", $values, $regs);
|
preg_match_all("/([^\|=]+)(?:=([^\|]+))?\|?/", $values, $regs);
|
||||||
// print_r($regs);
|
// print_r($regs);
|
||||||
if($multiple != '') {
|
print("<select name=\"$name\">");
|
||||||
$sz = count($regs[1]);
|
|
||||||
if($sz > 5) $sz=5;
|
|
||||||
$multiple = "$multiple size=\"$sz\"";
|
|
||||||
$name="{$name}[]";
|
|
||||||
print("<input type=\"hidden\" name=\"$name\" value=\"\" >\n");
|
|
||||||
}
|
|
||||||
print("<select $multiple name=\"$name\">");
|
|
||||||
for($x=0; $x<count($regs[1]); $x++) {
|
for($x=0; $x<count($regs[1]); $x++) {
|
||||||
$e_key = trim($regs[1][$x]);
|
$e_key = trim($regs[1][$x]);
|
||||||
$e_val = trim($regs[2][$x]);
|
$e_val = trim($regs[2][$x]);
|
||||||
@ -231,6 +222,37 @@ function config_editor($category, $year, $array_name, $self)
|
|||||||
}
|
}
|
||||||
print("</select>");
|
print("</select>");
|
||||||
break;
|
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("</td></tr><tr class=\"$trclass\"><td colspan=2>");
|
||||||
|
print("<table width=\"100%\"><tr><td width=\"10%\"> ");
|
||||||
|
}
|
||||||
|
|
||||||
|
for($x=0; $x<$c; $x++) {
|
||||||
|
if(($x % $rows) == 0 && $rows > 0) {
|
||||||
|
print("</td><td width=\"30%\">");
|
||||||
|
}
|
||||||
|
|
||||||
|
$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("<input type=\"checkbox\" name=\"{$name}[]\" value=\"$e_key\" $ch />");
|
||||||
|
print("$e_val<br />");
|
||||||
|
}
|
||||||
|
if($c > 5) print("</td></tr></table>");
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
print("<input size=\"$size\" type=\"text\" name=\"$name\" value=\"$val\">\n");
|
print("<input size=\"$size\" type=\"text\" name=\"$name\" value=\"$val\">\n");
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user