diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-08-03 20:20:25 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-08-03 20:20:25 -0400 |
commit | 2a712c8817417842ed06a7f2920c406d6ac94679 (patch) | |
tree | 6e37a4d78f1c427a41636488096b2010ad9cd3f6 /IkiWiki | |
parent | 39056453424dcb7e01f69c502192e45604d1fe84 (diff) |
use radio, not checkbox, for booleans
Had to do this due to one of CGI::FormBuilder's more annoying quirks -- it
loses the value of a checkbox field with only one option, always treating
it as checked.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/websetup.pm | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/IkiWiki/Plugin/websetup.pm b/IkiWiki/Plugin/websetup.pm index da2551489..7f4bce5e5 100644 --- a/IkiWiki/Plugin/websetup.pm +++ b/IkiWiki/Plugin/websetup.pm @@ -102,11 +102,14 @@ sub showfields ($$$@) { #{{{ my $name="enable.$plugin"; $form->field( name => $name, - label => "", - type => "checkbox", - options => [ [ 1 => sprintf(gettext("enable %s?"), $plugin) ] ], + label => sprintf(gettext("enable %s?"), $plugin), + type => "radio", value => $enabled, fieldset => $section, + options => [ + [ 1 => gettext("Yes") ], + [ 0 => gettext("No") ] + ], ); if ($plugin_forced) { $form->field(name => $name, disabled => 1); @@ -178,10 +181,13 @@ sub showfields ($$$@) { #{{{ elsif ($info{type} eq "boolean") { $form->field( name => $name, - label => "", - type => "checkbox", + label => $description, + type => "radio", value => $value, - options => [ [ 1 => $description ] ], + options => [ + [ 1 => gettext("Yes") ], + [ 0 => gettext("No") ] + ], fieldset => $section, ); } @@ -231,6 +237,7 @@ sub showform ($$) { #{{{ [plugins => gettext("plugins")] ], action => $config{cgiurl}, + table => 0, template => {type => 'div'}, stylesheet => IkiWiki::baseurl()."style.css", ); @@ -345,14 +352,12 @@ sub showform ($$) { #{{{ delete $rebuild{$field}; } else { - print STDERR ">>$key (@value) ($config{$key})\n"; $config{$key}=$value[0]; } } } if (%rebuild && ! $form->field("rebuild_asked")) { - print STDERR ">>".(join "," , keys %rebuild)."\n"; my $required=0; foreach my $field ($form->field) { $required=1 if $rebuild{$field}; |