mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 08:40:24 +00:00
Updates to the notification email form
This commit is contained in:
@@ -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'}."<br>".
|
||||
&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'} ] ]);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -12,6 +12,9 @@ if ($action eq 'rollback') {
|
||||
return &text('log_rollback', "<i>".$p->{'desc'}."</i>",
|
||||
"<i>".$p->{'mdesc'}."</i>");
|
||||
}
|
||||
elsif ($action eq 'notify') {
|
||||
return $text{'log_notify'};
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user