From 754ab32f1ed0f2fe03f51e0fbaf7663583c2c33b Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Thu, 28 Aug 2008 20:48:32 +0000 Subject: [PATCH] ui-lib conversion of misc options page --- bind8/bind8-lib.pl | 23 +++++++++-------------- bind8/conf_misc.cgi | 27 +++++++-------------------- 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/bind8/bind8-lib.pl b/bind8/bind8-lib.pl index eadce0fd2..e557c7751 100644 --- a/bind8/bind8-lib.pl +++ b/bind8/bind8-lib.pl @@ -463,9 +463,9 @@ elsif ($_[0]->{'type'} == 2) { # Returns a table row for a multi-value BIND option sub choice_input { -local ($rv, $v, $i, @opts); -$v = &find_value($_[1], $_[2]); -for($i=3; $i<@_; $i+=2) { +my $v = &find_value($_[1], $_[2]); +my @opts; +for(my $i=3; $i<@_; $i+=2) { push(@opts, [ $_[$i+1], $_[$i] ]); } return &ui_table_row($_[0], &ui_radio($_[1], $v, \@opts)); @@ -637,20 +637,15 @@ local $dir = { 'name' => $_[0], 'type' => 1, 'members' => \@vals }; } # opt_input(text, name, &config, default, size, units) +# Returns a table row with an optional text field sub opt_input { -local($v, $rv, $n); -$v = &find($_[1], $_[2]); +my $v = &find($_[1], $_[2]); +my $n; ($n = $_[1]) =~ s/[^A-Za-z0-9_]/_/g; -$rv = "$_[0] 30 ? " colspan=3>\n" : ">\n"; -$rv .= sprintf " $_[3]\n", - $v ? "" : "checked"; -$rv .= sprintf " ", - $v ? "checked" : ""; -$rv .= sprintf " $_[5]\n", - $v ? $v->{'value'} : ""; -return $rv; +return &ui_table_row($_[0], + &ui_opt_textbox($n, $v ? $v->{'value'} : "", $_[4], $_[3])." ".$_[5], + $_[4] > 30 ? 3 : 1); } sub save_opt diff --git a/bind8/conf_misc.cgi b/bind8/conf_misc.cgi index 64a89f42a..f3148a81e 100755 --- a/bind8/conf_misc.cgi +++ b/bind8/conf_misc.cgi @@ -11,57 +11,44 @@ $conf = &get_config(); $options = &find("options", $conf); $mems = $options->{'members'}; -print "
\n"; -print "\n"; -print "\n"; -print "
$text{'misc_header'}
\n"; +# Start of the form +print &ui_form_start("save_misc.cgi"); +print &ui_table_start($text{'misc_header'}, "width=100%", 4); -print "\n"; print &opt_input($text{'misc_core'}, 'coresize', $mems, $text{'default'}, 8); print &opt_input($text{'misc_data'}, 'datasize', $mems, $text{'default'}, 8); -print "\n"; -print "\n"; print &opt_input($text{'misc_files'}, 'files', $mems, $text{'default'}, 8); print &opt_input($text{'misc_stack'}, 'stacksize', $mems, $text{'default'}, 8); -print "\n"; -print "\n"; +print &ui_table_hr(); -print "\n"; print &opt_input($text{'misc_clean'}, 'cleaning-interval', $mems, $text{'default'}, 8, "$text{'misc_mins'}"); print &opt_input($text{'misc_iface'}, 'interface-interval', $mems, $text{'default'}, 8, "$text{'misc_mins'}"); -print "\n"; -print "\n"; print &opt_input($text{'misc_stats'}, 'statistics-interval', $mems, $text{'default'}, 8, "$text{'misc_mins'}"); -print "\n"; -print "\n"; +print &ui_table_hr(); -print "\n"; print &choice_input($text{'misc_recursion'}, 'recursion', $mems, $text{'yes'}, 'yes', $text{'no'}, 'no', $text{'default'}, undef); print &choice_input($text{'misc_cnames'}, 'multiple-cnames', $mems, $text{'yes'}, 'yes', $text{'no'}, 'no', $text{'default'}, undef); -print "\n"; -print "\n"; print &choice_input($text{'misc_glue'}, 'fetch-glue', $mems, $text{'yes'}, 'yes', $text{'no'}, 'no', $text{'default'}, undef); print &choice_input($text{'misc_nx'}, 'auth-nxdomain', $mems, $text{'yes'}, 'yes', $text{'no'}, 'no', $text{'default'}, undef); -print "\n"; -print "


\n"; -print "
\n"; +print &ui_table_end(); +print &ui_form_end([ [ undef, $text{'save'} ] ]); &ui_print_footer("", $text{'index_return'});