Public or private mailing list option on control panel

This commit is contained in:
Bob Mottram 2016-02-11 12:20:48 +00:00
parent f3fdfab0a1
commit 927ec5afc4
1 changed files with 13 additions and 3 deletions

View File

@ -667,10 +667,11 @@ function add_to_mailing_list {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \
--title $"Subscribe $SELECTED_USERNAME to a mailing list" \
--form $"You can either enter a subject or an email address\n" 10 68 3 \
--form $"You can either enter a subject or an email address\n" 11 68 4 \
$"List folder name:" 1 1 "" 1 35 26 25 \
$"Name between [] on subject line:" 2 1 "" 2 35 26 25 \
$"List email address:" 3 1 "" 3 35 26 25 \
$"Public:" 4 1 "yes" 4 35 4 25 \
2> $data
sel=$?
case $sel in
@ -680,7 +681,16 @@ function add_to_mailing_list {
LIST_NAME=$(cat $data | sed -n 1p)
LIST_SUBJECT=$(cat $data | sed -n 2p)
LIST_EMAIL=$(cat $data | sed -n 3p)
LIST_PUBLIC=$(cat $data | sed -n 4p)
if [ ${#LIST_PUBLIC} -lt 1 ]; then
LIST_PUBLIC='no'
fi
if [[ $LIST_PUBLIC == 'y' || $LIST_PUBLIC == 'Y' || $LIST_PUBLIC == 'true' || $LIST_PUBLIC == 'True' || $LIST_PUBLIC == 'yes' || $LIST_PUBLIC == 'Yes' || $LIST_PUBLIC == 'YES' ]]; then
LIST_PUBLIC='yes'
else
LIST_PUBLIC='no'
fi
if [ ${#LIST_NAME} -lt 2 ]; then
dialog --title $"Add mailing list" \
--msgbox $"No mailing list name was given" 6 40
@ -695,7 +705,7 @@ function add_to_mailing_list {
fi
if [ ${#LIST_SUBJECT} -gt 1 ]; then
${PROJECT_NAME}-addlist -u $SELECTED_USERNAME -l "$LIST_NAME" \
-s "$LIST_SUBJECT"
-s "$LIST_SUBJECT" --public $LIST_PUBLIC
else
if [[ "$LIST_EMAIL" != *"@"* || "$LIST_EMAIL" != *"."* ]]; then
dialog --title $"Add mailing list" \
@ -703,7 +713,7 @@ function add_to_mailing_list {
return
else
${PROJECT_NAME}-addlist -u $SELECTED_USERNAME -l "$LIST_NAME" \
-e "$LIST_EMAIL"
-e "$LIST_EMAIL" --public $LIST_PUBLIC
fi
fi