diff --git a/webminlog/index.cgi b/webminlog/index.cgi index 5b452881d..146a8015f 100755 --- a/webminlog/index.cgi +++ b/webminlog/index.cgi @@ -113,10 +113,14 @@ if ($access{'notify'}) { # Notifications enabled? print &ui_table_row($text{'index_notify'}, - &ui_yesno_radio("notify", $gconfig{'webminlog_notify'})); + &ui_yesno_radio("notify", $gconfig{'logemail'} ? 1 : 0)); + + # Send notification to + print &ui_table_row($text{'index_notify_email'}, + &ui_textbox("email", $gconfig{'logemail'}, 60)); # Notify for which modules - my @msel = split(/\s+/, $gconfig{'webminlog_notify_mods'}); + my @msel = split(/\s+/, $gconfig{'logmodulesemail'}); print &ui_table_row($text{'index_notify_mods'}, &ui_radio("mods_all", @msel ? 0 : 1, [ [ 1, $text{'index_mall'} ], @@ -124,17 +128,13 @@ if ($access{'notify'}) { &ui_select("mods", \@msel, \@mods, 10, 1) ] ])); # Notify for which users - my @usel = split(/\s+/, $gconfig{'webminlog_notify_users'}); + my @usel = split(/\s+/, $gconfig{'logusersemail'}); print &ui_table_row($text{'index_notify_users'}, &ui_radio("users_all", @usel ? 0 : 1, [ [ 1, $text{'index_uall'} ], [ 0, $text{'index_users'}."
". &ui_select("users", \@usel, \@unames, 10, 1) ] ])); - # Send notification to - print &ui_table_row($text{'index_notify_email'}, - &ui_textbox("email", $gconfig{'webminlog_notify_email'}, 60)); - print &ui_table_end(); print &ui_form_end([ [ undef, $text{'save'} ] ]); } diff --git a/webminlog/lang/en b/webminlog/lang/en index 38e73ec8d..a11fab833 100644 --- a/webminlog/lang/en +++ b/webminlog/lang/en @@ -144,4 +144,5 @@ notify_eusers=No users selected notify_eemail=No email address entered log_rollback=Rolled back action $1 in module $2 +log_notify=Saved email notifications options __norefs=1 diff --git a/webminlog/log_parser.pl b/webminlog/log_parser.pl index a903d2b54..8691f0a83 100755 --- a/webminlog/log_parser.pl +++ b/webminlog/log_parser.pl @@ -12,6 +12,9 @@ if ($action eq 'rollback') { return &text('log_rollback', "".$p->{'desc'}."", "".$p->{'mdesc'}.""); } +elsif ($action eq 'notify') { + return $text{'log_notify'}; + } return undef; } diff --git a/webminlog/save_notify.cgi b/webminlog/save_notify.cgi index d80626628..5de2a8ff7 100644 --- a/webminlog/save_notify.cgi +++ b/webminlog/save_notify.cgi @@ -9,23 +9,27 @@ our (%text, %gconfig, %access, %in, $config_file); &error_setup($text{'notify_err'}); $access{'notify'} || &error($text{'notify_ecannot'}); -$gconfig{'webminlog_notify'} = $in{'notify'}; +if ($in{'notify'}) { + $in{'email'} =~ /\S/ || &error($text{'notify_eemail'}); + $gconfig{'logemail'} = $in{'email'}; + } +else { + delete($gconfig{'logemail'}); + } if ($in{'mods_all'}) { - delete($gconfig{'webminlog_notify_mods'}); + delete($gconfig{'logmodulesemail'}); } else { $in{'mods'} || &error($text{'notify_emods'}); - $gconfig{'webminlog_notify_mods'} = join(" ", split(/\0/, $in{'mods'})); + $gconfig{'logmodulesemail'} = join(" ", split(/\0/, $in{'mods'})); } if ($in{'users_all'}) { - delete($gconfig{'webminlog_notify_users'}); + delete($gconfig{'logusersemail'}); } else { $in{'users'} || &error($text{'notify_eusers'}); - $gconfig{'webminlog_notify_users'} = join(" ", split(/\0/, $in{'users'})); + $gconfig{'logusersemail'} = join(" ", split(/\0/, $in{'users'})); } -!$in{'notify'} || $in{'email'} =~ /\S/ || &error($text{'notify_eemail'}); -$gconfig{'webminlog_notify_email'} = $in{'email'}; &lock_file($config_file); &save_module_config(\%gconfig, ""); &unlock_file($config_file);