Allow setting of subject line for SMS emails

This commit is contained in:
Jamie Cameron
2016-10-14 11:08:00 -07:00
parent 56270624d1
commit c9345028d7
3 changed files with 25 additions and 0 deletions

View File

@@ -84,6 +84,16 @@ print &ui_table_row($text{'sched_sms'},
$text{'sched_smsnumber'}." ".
&ui_textbox("sms", $config{'sched_sms'}, 15), 3);
# Pager / SMS message subject
$smode = $config{'sched_subject'} eq '' ? 0 :
$config{'sched_subject'} eq '*' ? 1 : 2;
print &ui_table_row($text{'sched_subject'},
&ui_radio_table("smode", $smode,
[ [ 0, $text{'sched_subject0'} ],
[ 1, $text{'sched_subject1'} ],
[ 2, $text{'sched_subject2'},
&ui_textbox("subject", $smode == 2 ? $config{'sched_subject'} : "", 40) ] ]), 3);
print &ui_table_end();
print &ui_form_end([ [ "save", $text{'save'} ] ]);

View File

@@ -180,6 +180,11 @@ sched_smscarrier=Phone on carrier
sched_smsnumber=with number
sched_esmsnumber=Missing or non-numeric SMS number
sched_esmsname=Missing or invalid-looking SMS number
sched_subject=Subject line for SMS messages
sched_subject0=None (alert is in the body)
sched_subject1=Alert text (leave body empty)
sched_subject2=Custom text
sched_esubject=Missing SMS message subject
up_since=Up since $1
depends_mod=The module $1 is not installed on your system

View File

@@ -29,6 +29,16 @@ else {
}
$config{'sched_sms'} = $in{'sms'};
}
if ($in{'smode'} == 0) {
delete($config{'sched_subject'});
}
elsif ($in{'smode'} == 1) {
$config{'sched_subject'} = '*';
}
else {
$in{'subject'} =~ /\S/ || &error($text{'sched_esubject'});
$config{'sched_subject'} = $in{'subject'};
}
if ($in{'from_def'}) {
delete($config{'sched_from'});
}