瀏覽代碼

Email filtering menu style

Bob Mottram 7 年之前
父節點
當前提交
498561ac49
共有 2 個文件被更改,包括 17 次插入24 次删除
  1. 1
    1
      src/freedombone-controlpanel
  2. 16
    23
      src/freedombone-controlpanel-user

+ 1
- 1
src/freedombone-controlpanel 查看文件

2298
            21 $"Restart the system")
2298
            21 $"Restart the system")
2299
 
2299
 
2300
         # shellcheck disable=SC2068
2300
         # shellcheck disable=SC2068
2301
-        selection=$(dialog --backtitle $"Freedombone Control Panel" --title $"Administrator Control Panel" --menu $"Choose an operation, or ESC to exit:" 28 60 28 "${W[@]}" 3>&2 2>&1 1>&3)
2301
+        selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Administrator Control Panel" --menu $"Choose an operation, or ESC to exit:" 28 60 28 "${W[@]}" 3>&2 2>&1 1>&3)
2302
         if [ ! "$selection" ]; then
2302
         if [ ! "$selection" ]; then
2303
             break
2303
             break
2304
         fi
2304
         fi

+ 16
- 23
src/freedombone-controlpanel-user 查看文件

775
 function menu_email {
775
 function menu_email {
776
     while true
776
     while true
777
     do
777
     do
778
-        data=$(mktemp 2>/dev/null)
779
-        dialog --backtitle $"Freedombone User Control Panel" \
780
-               --title $"Change Email Filtering Rules" \
781
-               --radiolist $"Choose an operation:" 14 70 7 \
782
-               1 $"Add yourself to a mailing list" off \
783
-               2 $"Remove yourself from a mailing list" off \
784
-               3 $"Add an email rule for an address" off \
785
-               4 $"Add an email rule for a subject" off \
786
-               5 $"Block or unblock an email address" off \
787
-               6 $"Block or unblock email with subject text" off \
788
-               7 $"Back to main menu" on 2> "$data"
789
-        sel=$?
790
-        case $sel in
791
-            1) rm -f "$data"
792
-               break;;
793
-            255) rm -f "$data"
794
-                 break;;
795
-        esac
796
-        case $(cat "$data") in
778
+        W=(1 $"Add yourself to a mailing list"
779
+           2 $"Remove yourself from a mailing list"
780
+           3 $"Add an email rule for an address"
781
+           4 $"Add an email rule for a subject"
782
+           5 $"Block or unblock an email address"
783
+           6 $"Block or unblock email with subject text")
784
+
785
+        # shellcheck disable=SC2068
786
+        selection=$(dialog --backtitle $"Freedombone User Control Panel" --title $"Change Email Filtering Rules" --menu $"Choose an operation, or ESC for main menu:" 14 70 7 "${W[@]}" 3>&2 2>&1 1>&3)
787
+
788
+        if [ ! "$selection" ]; then
789
+            break
790
+        fi
791
+
792
+        case $selection in
797
             1) add_to_mailing_list;;
793
             1) add_to_mailing_list;;
798
             2) remove_user_from_mailing_list;;
794
             2) remove_user_from_mailing_list;;
799
             3) email_rule_address;;
795
             3) email_rule_address;;
800
             4) email_rule_subject;;
796
             4) email_rule_subject;;
801
             5) block_unblock_email;;
797
             5) block_unblock_email;;
802
             6) block_unblock_subject;;
798
             6) block_unblock_subject;;
803
-            7) rm -f "$data"
804
-               break;;
805
         esac
799
         esac
806
-        rm -f "$data"
807
     done
800
     done
808
 }
801
 }
809
 
802
 
910
            9 $"Exit to the command line")
903
            9 $"Exit to the command line")
911
 
904
 
912
         # shellcheck disable=SC2068
905
         # shellcheck disable=SC2068
913
-        selection=$(dialog --backtitle $"Freedombone Control Panel" --title $"User Control Panel" --menu $"Choose an operation, or ESC to log out:" 20 60 13 "${W[@]}" 3>&2 2>&1 1>&3)
906
+        selection=$(dialog --backtitle $"Freedombone User Control Panel" --title $"User Control Panel" --menu $"Choose an operation, or ESC to log out:" 20 60 13 "${W[@]}" 3>&2 2>&1 1>&3)
914
         if [ ! "$selection" ]; then
907
         if [ ! "$selection" ]; then
915
             kill -HUP "$(pgrep -s 0 -o)"
908
             kill -HUP "$(pgrep -s 0 -o)"
916
             break
909
             break