From a8d08bcabe6c68a41bba9f6e2d6df70e7e123bb2 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Tue, 22 Jan 2008 01:55:10 +0000 Subject: [PATCH] Partial ui-lib conversion --- syslog/edit_log.cgi | 136 +++++++++++++++++++------------------------- 1 file changed, 59 insertions(+), 77 deletions(-) diff --git a/syslog/edit_log.cgi b/syslog/edit_log.cgi index c2e57b185..e4b361e75 100755 --- a/syslog/edit_log.cgi +++ b/syslog/edit_log.cgi @@ -87,13 +87,10 @@ if ($config{'tags'}) { print &ui_table_end(); # Log selection section -print "\n"; -print "\n"; -print "
$text{'edit_header2'}
\n"; +print &ui_table_start($text{'edit_header2'}, "width=100%", 2); @facil = split(/\s+/, $config{'facilities'}); -print " ", - "\n"; +$table = &ui_columns_start([ $text{'edit_facil'}, $text{'edit_pri'} ], 100); $i = 0; foreach $s (@{$log->{'sel'}}, ".none") { ($f, $p) = split(/\./, $s); @@ -101,98 +98,83 @@ foreach $s (@{$log->{'sel'}}, ".none") { $p =~ s/panic$/emerg/; $p =~ s/error$/err/; - print "\n", - $f =~ /,/ ? join(" ", split(/,/, $f)) : ''; - - print "\n"; + $pri .= &ui_select("pri_$i", $selpri, + [ $p eq '*' || $p eq 'none' ? ( '' ) : ( ), + &list_priorities() ], 1, 0, 1); + + $table .= &ui_columns_row([ $facil, $pri ]); $i++; } -print "
$text{'edit_facil'}$text{'edit_pri'}
\n"; - printf "\n", - $f =~ /,/ ? '' : 'checked'; - print " \n"; - printf " %s\n", - $f =~ /,/ ? 'checked' : '', $text{'edit_many'}; - printf "\n"; - printf " %s \n", - $p eq 'none' ? 'checked' : '', $text{'edit_none'}; - if ($config{'pri_all'}) { - printf " %s \n", - $p eq '*' ? 'checked' : '', $text{'edit_all'}; - } - printf "\n", - $p eq 'none' || $p eq '*' ? '' : 'checked'; + # Facility column + local $facil; + $facil .= &ui_radio("fmode_$i", $f =~ /,/ ? 1 : 0, + [ [ 0, &ui_select("facil_$i", $f =~ /,/ ? undef : $f, + [ [ undef, ' ' ], + [ '*', $text{'edit_all'} ], + @facil ], 1, 0, 1) ], + [ 1, $text{'edit_many'}." ". + &ui_textbox("facils_$i", + $f =~ /,/ ? join(" ", split(/,/, $f)) : '', 25) ] ]); + # Priorities range selector if ($config{'pri_dir'} == 1) { - print "\n"; + # Linux style + $psel = &ui_select("pdir_$i", + $p eq '*' || $p eq 'none' ? '' : + $p =~ /^=/ ? '=' : + $p =~ /^![^=]/ ? '!' : + $p =~ /^!=/ ? '!=' : '', + [ [ '', $text{'edit_pdir0'} ], + [ '=', $text{'edit_pdir1'} ], + [ '!', $text{'edit_pdir2'} ], + [ '!=', $text{'edit_pdir3'} ] ]); $p =~ s/^[!=]*//; } elsif ($config{'pri_dir'} == 2) { - print "\n"; + $psel = &ui_select("pdir_$i", + $p eq '*' || $p eq 'none' || + $pfx eq '>=' || $pfx eq '=>' || !$pfx ? '' : + $pfx eq '<=' || $pfx eq '=<' ? '<=' : + $pfx eq '<>' || $pfx eq '><' ? '<>' : $pfx, + [ [ '', '>=' ], + [ '>', '>' ], + [ '<=', '<=' ], + [ '<', '<' ], + [ '<>', '<>' ] ], 1, 0, 1); $p =~ s/^[<=>]*//; } else { - print $text{'edit_pdir0'}; + # No range selection allowed + $psel = $text{'edit_pdir0'}; } - local $pfound = ($p eq '*' || $p eq 'none'); - print "
\n"; +$table .= &ui_columns_end(); +print &ui_table_row(undef, $table, 2); +print &ui_table_end(); -print "\n"; -print "\n"; +@buts = ( [ undef, $text{'save'} ] ); if (!$in{'new'}) { if ($log->{'file'} && -f $log->{'file'}) { - print "\n"; + push(@buts, [ 'view', $text{'edit_view'} ]); } - print "\n"; + push(@buts, [ 'delete', $text{'delete'} ]); } -print "
\n"; +print &ui_form_end(\@buts); &ui_print_footer("", $text{'index_return'});