Browse Source

Public or private mailing list option on control panel

Bob Mottram 9 years ago
parent
commit
927ec5afc4
1 changed files with 13 additions and 3 deletions
  1. 13
    3
      src/freedombone-controlpanel

+ 13
- 3
src/freedombone-controlpanel View File

@@ -667,10 +667,11 @@ function add_to_mailing_list {
667 667
     trap "rm -f $data" 0 1 2 5 15
668 668
     dialog --backtitle $"Freedombone Control Panel" \
669 669
            --title $"Subscribe $SELECTED_USERNAME to a mailing list" \
670
-           --form $"You can either enter a subject or an email address\n" 10 68 3 \
670
+           --form $"You can either enter a subject or an email address\n" 11 68 4 \
671 671
               $"List folder name:" 1 1 "" 1 35 26 25 \
672 672
               $"Name between [] on subject line:" 2 1 "" 2 35 26 25 \
673 673
               $"List email address:" 3 1 "" 3 35 26 25 \
674
+              $"Public:" 4 1 "yes" 4 35 4 25 \
674 675
               2> $data
675 676
     sel=$?
676 677
     case $sel in
@@ -680,7 +681,16 @@ function add_to_mailing_list {
680 681
     LIST_NAME=$(cat $data | sed -n 1p)
681 682
     LIST_SUBJECT=$(cat $data | sed -n 2p)
682 683
     LIST_EMAIL=$(cat $data | sed -n 3p)
684
+    LIST_PUBLIC=$(cat $data | sed -n 4p)
683 685
 
686
+    if [ ${#LIST_PUBLIC} -lt 1 ]; then
687
+        LIST_PUBLIC='no'
688
+    fi
689
+    if [[ $LIST_PUBLIC == 'y' || $LIST_PUBLIC == 'Y' || $LIST_PUBLIC == 'true' || $LIST_PUBLIC == 'True' || $LIST_PUBLIC == 'yes' || $LIST_PUBLIC == 'Yes' || $LIST_PUBLIC == 'YES' ]]; then
690
+        LIST_PUBLIC='yes'
691
+    else
692
+        LIST_PUBLIC='no'
693
+    fi
684 694
     if [ ${#LIST_NAME} -lt 2 ]; then
685 695
         dialog --title $"Add mailing list" \
686 696
                --msgbox $"No mailing list name was given" 6 40
@@ -695,7 +705,7 @@ function add_to_mailing_list {
695 705
     fi
696 706
     if [ ${#LIST_SUBJECT} -gt 1 ]; then
697 707
         ${PROJECT_NAME}-addlist -u $SELECTED_USERNAME -l "$LIST_NAME" \
698
-                       -s "$LIST_SUBJECT"
708
+                       -s "$LIST_SUBJECT" --public $LIST_PUBLIC
699 709
     else
700 710
         if [[ "$LIST_EMAIL" != *"@"* || "$LIST_EMAIL" != *"."* ]]; then
701 711
             dialog --title $"Add mailing list" \
@@ -703,7 +713,7 @@ function add_to_mailing_list {
703 713
             return
704 714
         else
705 715
             ${PROJECT_NAME}-addlist -u $SELECTED_USERNAME -l "$LIST_NAME" \
706
-                           -e "$LIST_EMAIL"
716
+                           -e "$LIST_EMAIL" --public $LIST_PUBLIC
707 717
         fi
708 718
     fi
709 719