Simplification of control panel menus

This commit is contained in:
Bob Mottram 2015-11-01 10:29:42 +00:00
parent da3c0f5eed
commit 448e15c766
1 changed files with 101 additions and 33 deletions

View File

@ -366,30 +366,21 @@ function restore_gpg_key {
any_key
}
function menu_top_level {
function menu_backup_restore {
while true
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Control Panel" \
--title "Control Panel" \
--radiolist "Choose an operation:" 24 70 16 \
--title "Backup and Restore" \
--radiolist "Choose an operation:" 14 70 7 \
1 "Backup data to USB drive" off \
2 "Restore data from USB drive" off \
3 "Restore from remote backup" off \
4 "Add a user" off \
5 "Delete a user" off \
6 "Change user password" off \
7 "Add a user to a mailing list" off \
8 "Add an email rule" off \
9 "Block/Unblock an email address" off \
10 "Block/Unblock email with subject text" off \
11 "Change security settings" off \
12 "Backup GPG key to USB drive (master keydrive)" off \
13 "Backup GPG key to USB drive (fragment keydrive)" off \
14 "Restore GPG key from USB drive" off \
15 "Turn logging on/off" off \
16 "Exit" on 2> $data
2 "Restore GPG key from USB keydrive" off \
3 "Restore data from USB drive" off \
4 "Restore from remote backup" off \
5 "Backup GPG key to USB (master keydrive)" off \
6 "Backup GPG key to USB (fragment keydrive)" off \
7 "Back to main menu" on 2> $data
sel=$?
case $sel in
1) exit 1;;
@ -397,21 +388,98 @@ function menu_top_level {
esac
case $(cat $data) in
1) backup_data;;
2) restore_data;;
3) restore_data_remote;;
4) add_user;;
5) delete_user;;
6) change_password;;
7) add_to_mailing_list;;
8) email_rule;;
9) block_unblock_email;;
10) block_unblock_subject;;
11) freedombone-sec;;
12) create_keydrive_master;;
13) create_keydrive_fragment;;
14) restore_gpg_key;;
15) logging_on_off;;
16) break;;
2) restore_gpg_key;;
3) restore_data;;
4) restore_data_remote;;
5) create_keydrive_master;;
6) create_keydrive_fragment;;
7) break;;
esac
done
}
function menu_email {
while true
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Control Panel" \
--title "Email Filtering Rules" \
--radiolist "Choose an operation:" 12 70 5 \
1 "Add a user to a mailing list" off \
2 "Add an email rule" off \
3 "Block/Unblock an email address" off \
4 "Block/Unblock email with subject text" off \
5 "Back to main menu" on 2> $data
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
case $(cat $data) in
1) add_to_mailing_list;;
2) email_rule;;
3) block_unblock_email;;
4) block_unblock_subject;;
5) break;;
esac
done
}
function menu_users {
while true
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Control Panel" \
--title "Control Panel" \
--radiolist "Choose an operation:" 12 70 5 \
1 "Add a user" off \
2 "Delete a user" off \
3 "Change user password" off \
4 "Change user ssh public key" off \
5 "Back to main menu" on 2> $data
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
case $(cat $data) in
1) add_user;;
2) delete_user;;
3) change_password;;
4) change_ssh_public_key;;
5) break;;
esac
done
}
function menu_top_level {
while true
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Control Panel" \
--title "Control Panel" \
--radiolist "Choose an operation:" 13 70 6 \
1 "Backup or Restore" off \
2 "Turn logging on/off" off \
3 "Manage users" off \
4 "Email filtering rules" off \
5 "Security settings" off \
6 "Exit" on 2> $data
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
case $(cat $data) in
1) menu_backup_restore;;
2) logging_on_off;;
3) menu_users;;
4) menu_email;;
5) freedombone-sec;;
6) break;;
esac
done
}