Standardize the way functions build their arguments leading up to a dialog

invocation. Specifically, "top-load" your arguments and in the order in-
which they will be displayed. For example, many [if not all] widgets display
information in the following order, top-to-bottom (visually):

+ backtitle (displayed behind the widget at top-left)
+ title (at the top of the `window')
+ prompt text (just below the title and above whatever widget you choose)
+ Depending on widget, _one_ of the following:
  - menu list
  - radio list
  - check list
  - text input box with initial text
  - [Xdialog(1)] 2x or 3x text input boxes
  - [dialog(1)] a multi-part form
  - progress bar
  - etc. (many more widget choices)
+ buttons (right below the selected widget)
+ [dialog(1)] the hline (displayed at bottom of `window')

NOTE: Xdialog(1) accepts and silently ignores --hline

When building local arguments for your dialog invocation, if the value can't
be cleanly loaded into a local, add "# Calculated below" to the end of the
local declaration while retaining the block order of argument declarations.

Move other local declarations that are not associated with this top-loading
the dialog arguments to right-above where they are first-used.

Also, standardize on the names of the arguments. For example, always use
$prompt (instead of sometimes $msg and sometimes $prompt); use $menu_list
or $shell_list or $radio_list for those respective widgets; ad nauseum.

While we're doing this, flush-out full arguments for many invocations that
were passing NULL strings (making it unapparent if you were staring at this
one invocation what argument that NULL string was supposed to represent).

Last, while we're in startup/rcconf let's remove the unnecessary use of a
GLOBAL (RCCONF_MENU_LIST) for the menu_list.
This commit is contained in:
Devin Teske 2013-06-02 20:02:50 +00:00
parent eeff88a7ca
commit 052f89691c
32 changed files with 275 additions and 285 deletions

View File

@ -50,7 +50,8 @@ USAGE_HELPFILE=$BSDCFG_LIBE/include/usage.hlp
#
usage()
{
local index="INDEX" cmd_list=""
local index="INDEX"
local cmd_list # Calculated below
cd $BSDCFG_LIBE
# No need to preserve CWD (headed toward exit)
@ -145,13 +146,12 @@ dialog_menu_main()
local title="$DIALOG_TITLE"
local btitle="$DIALOG_BACKTITLE"
local prompt="$msg_menu_text"
local menu_list
local defaultitem= # Calculated below
menu_list="
local menu_list="
'X' '$msg_exit' '$msg_exit_bsdconfig'
'1' '$msg_usage' '$msg_quick_start_how_to_use_this_menu_system'
" # END-QUOTE
local defaultitem= # Calculated below
local hline=
local sanitize_awk="{ gsub(/'/, \"'\\\\''\"); print }"
@ -185,7 +185,7 @@ dialog_menu_main()
\"\$title\" \
\"\$btitle\" \
\"\$prompt\" \
\"\" \
\"\$hline\" \
$menu_list
# Obtain default-item from previously stored selection
@ -196,6 +196,7 @@ dialog_menu_main()
--clear \
--title \"\$title\" \
--backtitle \"\$btitle\" \
--hline \"\$hline\" \
--item-help \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_exit_bsdconfig\" \

View File

@ -48,12 +48,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list
local hline="$hline_configure_system_console_settings"
local prompt="$msg_console_menu_text"
local defaultitem= # Calculated below
menu_list="
local menu_list="
'X $msg_exit' '$msg_exit_this_menu'
'2 $msg_font' '$msg_choose_alternate_screen_font'
'3 $msg_keymap' '$msg_choose_alternate_keyboard_map'
@ -62,6 +58,8 @@ dialog_menu_main()
'6 $msg_screenmap' '$msg_choose_alternate_screenmap'
'7 $msg_ttys' '$msg_choose_console_terminal_type'
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_configure_system_console_settings"
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list defaultitem=
local hline="$hline_choose_a_font"
local prompt="$msg_font_menu_text"
menu_list="
local menu_list="
'1 $msg_none' '$msg_use_hardware_default_font'
'2 $msg_ibm_437' '$msg_ibm_437_desc'
'3 $msg_ibm_850' '$msg_ibm_850_desc'
@ -69,6 +66,8 @@ dialog_menu_main()
'd $msg_iso_8859_15' '$msg_iso_8859_15_desc'
'e $msg_swiss' '$msg_swiss_desc'
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_choose_a_font"
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -77,9 +77,9 @@ KEYMAP_NAMES="
#
dialog_menu_main()
{
local menu_list defaultitem=
local hline="$hline_choose_a_keyboard_map"
local prompt="$msg_keymap_menu_text"
local menu_list defaultitem= # Calculated below
local hline="$hline_choose_a_keyboard_map"
#
# Export variables for awk(1) ENVIRON visibility

View File

@ -49,16 +49,15 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list defaultitem=
local hline="$hline_choose_a_keyboard_repeat_rate"
local prompt="$msg_repeat_menu_text"
menu_list="
local menu_list="
'$msg_default' '$msg_default_desc'
'$msg_slow' '$msg_slow_desc'
'$msg_normal' '$msg_normal_desc'
'$msg_fast' '$msg_fast_desc'
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_choose_a_keyboard_repeat_rate"
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list defaultitem=
local hline="$hline_choose_a_screen_saver"
local prompt="$msg_saver_menu_text"
menu_list="
local menu_list="
'1 $msg_blank' '$msg_blank_desc'
'2 $msg_beastie' '$msg_beastie_desc'
'3 $msg_daemon' '$msg_daemon_desc'
@ -69,6 +66,8 @@ dialog_menu_main()
'd $msg_none' '$msg_none_saver_desc'
'$msg_timeout' '$msg_timeout_desc'
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_choose_a_screen_saver"
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list defaultitem=
local hline="$hline_choose_a_screen_map"
local prompt="$msg_screenmap_menu_text"
menu_list="
local menu_list="
'1 $msg_none' '$msg_none_screenmap_desc'
'2 $msg_iso_8859_1_to_ibm437' '$msg_iso_8859_1_to_ibm437_desc'
'3 $msg_iso_8859_7_to_ibm437' '$msg_iso_8859_7_to_ibm437_desc'
@ -61,6 +58,8 @@ dialog_menu_main()
'5 $msg_koi8_r_to_ibm866' '$msg_koi8_r_to_ibm866_desc'
'6 $msg_koi8_u_to_ibm866u' '$msg_koi8_u_to_ibm866u_desc'
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_choose_a_screen_map"
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -72,8 +72,8 @@ TTY_MENU_LIST="
#
dialog_menu_main()
{
local hline="$hline_choose_a_terminal_type"
local prompt="$msg_ttys_menu_text"
local hline="$hline_choose_a_terminal_type"
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -48,12 +48,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list
local hline=""
local prompt="$msg_menu_text"
local defaultitem= # Calculated below
menu_list="
local menu_list="
'X $msg_exit' '$msg_exit_this_menu'
'2 $msg_enable' '$msg_test_and_run_the_mouse_daemon'
'3 $msg_type' '$msg_select_mouse_protocol_type'
@ -61,6 +57,8 @@ dialog_menu_main()
'5 $msg_flags' '$msg_set_additional_flags'
'6 $msg_disable' '$msg_disable_the_mouse_daemon'
" # END-QUOTE
local defaultitem= # Calculated below
local hline=
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list defaultitem=
local hline=""
local prompt="$msg_port_menu_text"
menu_list="
local menu_list="
'1 $msg_ps2' '$msg_ps2_desc'
'2 $msg_com1' '$msg_com1_desc'
'3 $msg_com2' '$msg_com2_desc'
@ -61,6 +58,8 @@ dialog_menu_main()
'5 $msg_com4' '$msg_com4_desc'
'6 $msg_busmouse' '$msg_busmouse_desc'
" # END-QUOTE
local defaultitem= # Calculated below
local hline=
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list defaultitem=
local hline=""
local prompt="$msg_protocol_menu_text"
menu_list="
local menu_list="
'1 $msg_auto' '$msg_auto_desc'
'2 $msg_glidepoint' '$msg_glidepoint_desc'
'3 $msg_hitachi' '$msg_hitachi_desc'
@ -65,6 +62,8 @@ dialog_menu_main()
'9 $msg_mousesystems' '$msg_mousesystems_desc'
'A $msg_thinkingmouse' '$msg_thinkingmouse_desc'
" # END-QUOTE
local defaultitem= # Calculated below
local hline=
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -48,23 +48,22 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list
local hline="$hline_arrows_tab_enter"
local defaultitem= # Calculated below
menu_list="
local prompt=
local menu_list="
'X' '$msg_exit'
'1' '$msg_hostname_domain'
'2' '$msg_network_interfaces'
'3' '$msg_default_router'
'4' '$msg_dns_nameservers'
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_arrows_tab_enter"
local height width rows
eval f_dialog_menu_size height width rows \
\"\$DIALOG_TITLE\" \
\"\$DIALOG_BACKTITLE\" \
\"\" \
\"\$prompt\" \
\"\$hline\" \
$menu_list
@ -79,7 +78,7 @@ dialog_menu_main()
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--default-item \"\$defaultitem\" \
--menu \"\" \
--menu \"\$prompt\" \
$height $width $rows \
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD

View File

@ -392,23 +392,24 @@ f_dialog_input_nameserver()
#
f_dialog_menu_nameservers()
{
local prompt="$msg_dns_configuration"
local menu_list # Calculated below
local hline="$hline_arrows_tab_enter"
local defaultitem=
local height width rows
local opt_exit="$msg_return_to_previous_menu"
local opt_add="$msg_add_nameserver"
local hline="$hline_arrows_tab_enter"
local prompt defaultitem=
#
# Loop forever until the user has finished configuring nameservers
#
prompt="$msg_dns_configuration"
while :; do
#
# Re/Build list of nameservers
#
local nameservers="$( f_resolv_conf_nameservers )"
local menu_list="$(
menu_list=$(
index=1
echo "'X $msg_exit' '$opt_exit'"
@ -423,7 +424,7 @@ f_dialog_menu_nameservers()
echo "'$tag nameserver' '$ns'"
index=$(( $index + 1 ))
done
)"
)
#
# Display configuration-edit menu

View File

@ -45,24 +45,23 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
#
f_dialog_input_password()
{
local prompt1="$msg_enter_new_password"
local prompt2="$msg_reenter_password"
local hline="$hline_alnum_punc_tab_enter"
local msg rmsg
msg=$( printf "$msg_enter_new_password" )
local height1 width1
f_dialog_inputbox_size height1 width1 \
"$DIALOG_TITLE" \
"$DIALOG_BACKTITLE" \
"$msg" \
"$prompt1" \
"" \
"$hline"
rmsg=$( printf "$msg_reenter_password" )
local height2 width2
f_dialog_inputbox_size height2 width2 \
"$DIALOG_TITLE" \
"$DIALOG_BACKTITLE" \
"$rmsg" \
"$prompt2" \
"" \
"$hline"
@ -78,7 +77,7 @@ f_dialog_input_password()
--ok-label "$msg_ok" \
--cancel-label "$msg_cancel" \
--insecure \
--passwordbox "$msg" \
--passwordbox "$prompt1" \
$height1 $width1 \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
) || return $?
@ -92,7 +91,7 @@ f_dialog_input_password()
--ok-label "$msg_ok" \
--cancel-label "$msg_cancel" \
--insecure \
--passwordbox "$rmsg" \
--passwordbox "$prompt2" \
$height2 $width2 \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
) || return $?

View File

@ -51,16 +51,15 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list defaultitem=
local hline="$hline_select_securelevel_to_operate_at"
local prompt="$msg_securelevels_menu_text"
menu_list="
local menu_list="
'$msg_disabled' '$msg_disable_securelevels'
'$msg_secure' '$msg_secure_mode'
'$msg_highly_secure' '$msg_highly_secure_mode'
'$msg_network_secure' '$msg_network_secure_mode'
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_select_securelevel_to_operate_at"
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -49,21 +49,21 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list mark=" " defaultitem=
local hline="$hline_arrows_tab_enter"
local prompt="$msg_menu_text"
local menu_list="
'X <<< $msg_exit' '$msg_exit_this_menu'
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_arrows_tab_enter"
# Obtain default-item (adjusted below for dynamic tags)
f_dialog_default_fetch defaultitem
local ditem="${defaultitem%%[$IFS]*}"
menu_list="
'X <<< $msg_exit' '$msg_exit_this_menu'
" # END-QUOTE
#
# Add dynamically tagged entry for kern_securelevels
#
local mark=" "
case "$( f_sysrc_get kern_securelevel_enable )" in
[Yy][Ee][Ss])
local kern_securelevel="$( f_sysrc_get kern_securelevel )"

View File

@ -68,10 +68,7 @@ f_media_get_type()
local title="$DIALOG_TITLE" btitle="$DIALOG_BACKTITLE"
f_dialog_title_restore
local prompt="$msg_choose_installation_media_description"
local hline="$hline_choose_help_for_more_information_on_media_types"
local menu_list
menu_list="
local menu_list="
'1 $msg_cd_dvd' '$msg_install_from_a_freebsd_cd_dvd'
'2 $msg_ftp' '$msg_install_from_an_ftp_server'
'3 $msg_ftp_passive'
@ -85,6 +82,7 @@ f_media_get_type()
'A $msg_usb' '$msg_install_from_a_usb_drive'
'X $msg_options' '$msg_view_set_various_media_options'
" # END-QUOTE
local hline="$hline_choose_help_for_more_information_on_media_types"
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -72,9 +72,7 @@ f_dialog_menu_media_ftp()
f_dialog_title "$msg_please_select_a_freebsd_ftp_distribution_site"
local title="$DIALOG_TITLE" btitle="$DIALOG_BACKTITLE"
f_dialog_title_restore
local prompt="$msg_please_select_the_site_closest_to_you_or_other"
local hline="$msg_select_a_site_thats_close"
local menu_list="
'$msg_main_site' 'ftp.freebsd.org'
'URL' '$msg_specify_some_other_ftp_site'
@ -228,6 +226,7 @@ f_dialog_menu_media_ftp()
' $msg_usa #14' 'ftp14.us.freebsd.org'
' $msg_usa #15' 'ftp15.us.freebsd.org'
" # END-QUOTE
local hline="$msg_select_a_site_thats_close"
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -53,9 +53,10 @@ f_media_options_menu()
f_dialog_title "$msg_options_editor"
local title="$DIALOG_TITLE" btitle="$DIALOG_BACKTITLE"
f_dialog_title_restore
local prompt=""
local prompt=
local menu_list # Calculated below
local defaultitem=
local hline="$hline_arrows_tab_enter"
local menu_list cp
#
# A hack so that the dialogs below are always interactive in a script
@ -66,7 +67,7 @@ f_media_options_menu()
unset $VAR_NONINTERACTIVE
fi
local defaultitem=
local cp
while :; do
menu_list=""

View File

@ -77,7 +77,7 @@ SECURE_DIVULGE_UNKNOWN_USER=
#
f_become_root_via_sudo()
{
local msg hline height width rows
local prompt hline height width rows msg
[ "$( id -u )" = "0" ] && return $SUCCESS
@ -90,18 +90,19 @@ f_become_root_via_sudo()
#
local checkpath="${HOME%/}/.bsdconfig_uses_sudo"
if [ ! -e "$checkpath" ]; then
prompt=$( printf "$msg_you_are_not_root_but" bsdconfig )
msg=$( printf "$msg_always_try_sudo_when_run_as" "$USER" )
local menu_list="
'X' '$msg_cancel_exit'
'1' '$msg'
'2' '$msg_try_sudo_only_this_once'
" # END-QUOTE
msg=$( printf "$msg_you_are_not_root_but" bsdconfig )
hline="$hline_arrows_tab_enter"
eval f_dialog_menu_size height width rows \
\"\$DIALOG_TITLE\" \
\"\$DIALOG_BACKTITLE\" \
\"\$msg\" \
\"\$prompt\" \
\"\$hline\" \
$menu_list
@ -112,7 +113,7 @@ f_become_root_via_sudo()
--hline \"\$hline\" \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--menu \"\$msg\" \
--menu \"\$prompt\" \
$height $width $rows \
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
@ -147,12 +148,12 @@ f_become_root_via_sudo()
#
# sudo(8) access denied. Prompt for their password.
#
msg="$msg_please_enter_password"
prompt="$msg_please_enter_password"
hline="$hline_alnum_punc_tab_enter"
f_dialog_inputbox_size height width \
"$DIALOG_TITLE" \
"$DIALOG_BACKTITLE" \
"$msg" \
"$prompt" \
"$hline"
#
@ -168,7 +169,7 @@ f_become_root_via_sudo()
--hline "$hline" \
--ok-label "$msg_ok" \
--cancel-label "$msg_cancel" \
--password --inputbox "$msg" \
--password --inputbox "$prompt" \
$height $width \
2>&1 > /dev/null )
retval=$?
@ -184,7 +185,7 @@ f_become_root_via_sudo()
--ok-label "$msg_ok" \
--cancel-label "$msg_cancel" \
--insecure \
--passwordbox "$msg" \
--passwordbox "$prompt" \
$height $width \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
) || exit $?

View File

@ -277,25 +277,26 @@ f_package_calculate_rundeps()
#
f_package_menu_categories()
{
local var_to_get="$1" defaultitem="$2" category_list menu_list
local var_to_get="$1" defaultitem="$2"
local prompt="$msg_please_select_a_category_to_display"
local menu_list="
'> $msg_review' '$msg_review_desc' '$msg_review_help'
" # End-Quote
local hline=
f_package_calculate_rundeps
# updates package mark variables and SELECTED_PACKAGES
f_package_calculate_totals
# creates _{varcat}_ninstalled and _{varcat}_nselected
local category_list
debug= f_getvar "$var_to_get" category_list || return $FAILURE
# Accent the category menu list with ninstalled/nselected
eval f_package_accent_category_menu category_list $category_list
local prompt="$msg_please_select_a_category_to_display"
local hline=""
menu_list="
'> $msg_review' '$msg_review_desc' '$msg_review_help'
$category_list
" # End-Quote
# Add list of categories to menu list
menu_list="$menu_list $category_list"
local height width rows
eval f_dialog_menu_with_help_size height width rows \
@ -365,22 +366,26 @@ f_package_index_get_page()
#
f_package_menu_select()
{
local category="$1" page="${2:-1}" defaultitem="$3"
local varcat npkgs=0 npages menu_list
local category="$1" page="${2:-1}"
local prompt= # Calculated below
local menu_list # Calculated below
local defaultitem="$3"
local hline="$hline_arrows_tab_punc_enter"
f_isinteger "$page" || return $FAILURE
local varcat
f_str2varname "$category" varcat
f_package_index_get_page "$category" $page index_page
# Get number of packages for this category
local npkgs=0
case "$category" in
"$msg_all"|"") npkgs="${_npkgs:-0}";;
*) f_getvar _npkgs_$varcat npkgs
esac
# Calculate number of pages
npages=$(( ${npkgs:=0} / $PACKAGE_MENU_PAGESIZE ))
local npages=$(( ${npkgs:=0} / $PACKAGE_MENU_PAGESIZE ))
# Add a page to the pagecount if not evenly divisible
[ $(( $npages * $PACKAGE_MENU_PAGESIZE )) -lt $npkgs ] &&
@ -407,6 +412,9 @@ f_package_menu_select()
next_page="$next_page*"
fi
local index_page
f_package_index_get_page "$category" $page index_page
menu_list="
${add_prev:+'> $previous_page' '' ${SHOW_DESC:+''}}
${add_next:+'> $next_page' '' ${SHOW_DESC:+''}}
@ -446,7 +454,6 @@ f_package_menu_select()
${add_next:+'> $next_page' '' ${SHOW_DESC:+''}}
" # End-Quote
local prompt=""
# Accept/Translate i18n "All" but other category names must
# match tree definitions from INDEX, ports, FTP, etc.
case "$category" in
@ -456,7 +463,6 @@ f_package_menu_select()
prompt="$prompt $( printf "$msg_page_of_npages" \
"$page" "$npages" )"
local hline="$hline_arrows_tab_punc_enter"
local mheight mwidth mrows
f_dialog_menu${SHOW_DESC:+_with_help}_size mheight mwidth mrows \
\"\$DIALOG_TITLE\" \"\$DIALOG_BACKTITLE\" \
@ -509,14 +515,16 @@ f_package_menu_select()
#
f_package_menu_deselect()
{
local package="$1" prompt menu_list
prompt=$( printf "$msg_what_would_you_like_to_do_with" "$package" )
local hline="$hline_alnum_arrows_punc_tab_enter"
menu_list="
local package="$1"
local prompt # Calculated below
local menu_list="
'X $msg_installed' '$msg_installed_desc'
'R $msg_reinstall' '$msg_reinstall_desc'
'U $msg_uninstall' '$msg_uninstall_desc'
" # End-Quote
local hline="$hline_alnum_arrows_punc_tab_enter"
prompt=$( printf "$msg_what_would_you_like_to_do_with" "$package" )
local height width rows
eval f_dialog_menu_size height width rows \
@ -551,12 +559,16 @@ f_package_menu_deselect()
#
f_package_review()
{
local prompt package varpkg mark menu_list=
prompt=$( printf "$msg_reviewing_selected_packages" \
"$_All_nselected" )
local prompt # Calculated below
local menu_list # Calculated below
local hline="$hline_alnum_arrows_punc_tab_enter"
f_dprintf "f_package_review: SELECTED_PACKAGES=[%s]" \
"$SELECTED_PACKAGES"
prompt=$( printf "$msg_reviewing_selected_packages" "$_All_nselected" )
local package varpkg mark
for package in $SELECTED_PACKAGES; do
mark=
f_str2varname "$package" varpkg

View File

@ -56,19 +56,14 @@ UNAME_P=$( uname -p ) # Processor Architecture (i.e. i386)
#
dialog_menu_main()
{
local menu_list var_list defaultitem=
local hline="$hline_arrows_tab_enter"
local prompt="$msg_miscellaneous_menu_text"
# Obtain default-item (adjusted below for dynamic tags)
f_dialog_default_fetch defaultitem
local ditem="${defaultitem%%[$IFS]*}"
menu_list="
local menu_list="
'X <<< $msg_exit' '$msg_exit_this_menu'
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_arrows_tab_enter"
var_list="
local var_list="
accounting_enable
local_startup
lpd_enable
@ -88,6 +83,10 @@ dialog_menu_main()
" # END-QUOTE
fi
# Obtain default-item (adjusted below for dynamic tags)
f_dialog_default_fetch defaultitem
local ditem="${defaultitem%%[$IFS]*}"
eval "$(
. "$RC_DEFAULTS"
source_rc_confs

View File

@ -57,14 +57,12 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list
local hline="$hline_arrows_tab_enter"
local prompt=""
menu_list="
local prompt=
local menu_list="
'1' '$msg_add_from_list'
'2' '$msg_add_custom'
" # END-QUOTE
local hline="$hline_arrows_tab_enter"
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -49,7 +49,6 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
RCCONF_MAP=
_RCCONF_MAP=
RCCONF_MENU_LIST=
#
# Options
@ -79,11 +78,8 @@ fi
#
dialog_menu_main()
{
local hline="$hline_arrows_tab_enter"
local prompt=""
local defaultitem= # Calculated below
RCCONF_MENU_LIST="
local prompt=
local menu_list="
'X $msg_exit' '$msg_exit_desc'
${SHOW_DESC:+'$msg_exit_help'}
'> $msg_add_new' '$msg_add_new_desc'
@ -95,6 +91,8 @@ dialog_menu_main()
${SHOW_DESC:+'$msg_view_details_help'}
}
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_arrows_tab_enter"
if [ ! "$_RCCONF_MAP" ]; then
# Genreate RCCONF_MAP of `var desc ...' per-line
@ -110,7 +108,7 @@ dialog_menu_main()
[ "$SHOW_DEFAULT_VALUE" -o "$SHOW_CONFIGURED" ] &&
f_dialog_info "$msg_creating_menu_list"
RCCONF_MENU_LIST="$RCCONF_MENU_LIST $(
menu_list="$menu_list $(
. "$RC_DEFAULTS" > /dev/null
source_rc_confs > /dev/null
var_list=$( f_startup_rcconf_list )
@ -169,7 +167,7 @@ dialog_menu_main()
\"\$DIALOG_BACKTITLE\" \
\"\$prompt\" \
\"\$hline\" \
$RCCONF_MENU_LIST
$menu_list
# Obtain default-item from previously stored selection
f_dialog_default_fetch defaultitem
@ -187,7 +185,7 @@ dialog_menu_main()
--default-item \"\$defaultitem\" \
--menu \"\$prompt\" \
$height $width $rows \
$RCCONF_MENU_LIST \
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
)
local retval=$?

View File

@ -146,9 +146,23 @@ dialog_create_main()
#
dialog_menu_main()
{
local hline="$hline_arrows_tab_enter"
local prompt=""
local prompt=
local menu_list="
'X $msg_exit_cancel' '$msg_exit_cancel_desc'
${SHOW_DESC:+'$msg_exit_cancel_help'}
'> $msg_delete_selected' '$msg_delete_selected_desc'
${SHOW_DESC:+'$msg_delete_selected_help'}
'> $msg_all' '$msg_all_desc'
${SHOW_DESC:+'$msg_all_help'}
'> $msg_none' '$msg_none_desc'
${SHOW_DESC:+'$msg_none_help'}
${USE_XDIALOG:+
'> $msg_view_details' '$msg_view_details_desc'
${SHOW_DESC:+'$msg_view_details_help'}
}
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_arrows_tab_enter"
#
# [Re-]Accent the menu list before incorporating it
@ -178,22 +192,7 @@ dialog_menu_main()
menu_buf="$menu_buf
'$rcconf_var' '$details' ${SHOW_DESC:+'$help'}" # End-Quote
done
local menu_list="
'X $msg_exit_cancel' '$msg_exit_cancel_desc'
${SHOW_DESC:+'$msg_exit_cancel_help'}
'> $msg_delete_selected' '$msg_delete_selected_desc'
${SHOW_DESC:+'$msg_delete_selected_help'}
'> $msg_all' '$msg_all_desc'
${SHOW_DESC:+'$msg_all_help'}
'> $msg_none' '$msg_none_desc'
${SHOW_DESC:+'$msg_none_help'}
${USE_XDIALOG:+
'> $msg_view_details' '$msg_view_details_desc'
${SHOW_DESC:+'$msg_view_details_help'}
}
$menu_buf
" # END-QUOTE
menu_list="$menu_list $menu_buf"
set -f # noglob (descriptions in $RCCONF_MENU_LIST may contain *)
@ -244,9 +243,9 @@ dialog_menu_main()
#
dialog_menu_confirm_delete()
{
local hline="$hline_arrows_tab_enter"
local prompt="$msg_are_you_sure_you_want_delete_the_following"
local var_list menu_list
local menu_list # Calculated below
local hline="$hline_arrows_tab_enter"
[ $# -ge 1 ] || return $FAILURE
@ -255,6 +254,7 @@ dialog_menu_confirm_delete()
return $?
fi
local var_list
var_list=$( for var in $*; do echo "$var"; done | sort -u )
menu_list=$(
. "$RC_DEFAULTS"

View File

@ -65,8 +65,8 @@ RCVAR_MENU_LIST=
#
dialog_menu_main()
{
local prompt=
local hline="$hline_arrows_tab_enter"
local prompt=""
local defaultitem= # Calculated below
RCVAR_MENU_LIST="

View File

@ -273,15 +273,16 @@ f_startup_rcconf_map_expand()
#
f_dialog_input_view_details()
{
local menu_list
local prompt=
local menu_list # calculated below
local defaultitem= # calculated below
local hline="$hline_arrows_tab_enter"
local prompt=""
local md=" "
if [ "$SHOW_DESC" ]; then
md="X"
fi
local m1=" " m2=" " m3=" " defaultitem=
local m1=" " m2=" " m3=" "
if [ "$SHOW_VALUE" ]; then
m1="*"
defaultitem="1 ($m1) $msg_show_value"
@ -367,13 +368,11 @@ f_dialog_input_view_details()
#
f_dialog_input_rclist()
{
local hline="$hline_arrows_tab_enter"
local prompt="$msg_please_select_an_rcconf_directive"
local menu_list
menu_list="
local menu_list="
'X $msg_exit' '' ${SHOW_DESC:+'$msg_exit_help'}
" # END-QUOTE
local hline="$hline_arrows_tab_enter"
if [ ! "$_RCCONF_MAP" ]; then
# Generate RCCONF_MAP of `var desc ...' per-line

View File

@ -48,17 +48,15 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list
local hline="$hline_arrows_tab_enter"
local prompt=""
local defaultitem= # Calculated below
menu_list="
local prompt=
local menu_list="
'X' '$msg_exit'
'1' '$msg_toggle_startup_services'
'2' '$msg_view_edit_startup_configuration'
'3' '$msg_miscellaneous_startup_services'
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_arrows_tab_enter"
local height width rows
eval f_dialog_menu_size height width rows \

View File

@ -84,13 +84,14 @@ dialog_menu_main()
local btitle="$DIALOG_BACKTITLE"
local prompt="$msg_select_region"
local defaultitem= # Calculated below
local hline=
local height width rows
eval f_dialog_menu_size height width rows \
\"\$title\" \
\"\$btitle\" \
\"\$prompt\" \
\"\" \
\"\$hline\" \
$continent_menu_list
# Obtain default-item from previously stored selection
@ -100,6 +101,7 @@ dialog_menu_main()
menu_choice=$( eval $DIALOG \
--title \"\$title\" \
--backtitle \"\$btitle\" \
--hline \"\$hline\" \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--default-item \"\$defaultitem\" \

View File

@ -65,13 +65,12 @@ f_input_group()
#
f_dialog_menu_group_list()
{
local defaultitem="$1"
local menu_list
local hline="$hline_alnum_punc_tab_enter"
menu_list="
local prompt=
local menu_list="
'X $msg_exit' ''
" # END-QUOTE
local defaultitem="$1"
local hline="$hline_alnum_punc_tab_enter"
# Add groups from group(5)
menu_list="$menu_list $( pw groupshow -a | awk -F: '
@ -84,7 +83,7 @@ f_dialog_menu_group_list()
eval f_dialog_menu_size height width rows \
\"\$DIALOG_TITLE\" \
\"\$DIALOG_BACKTITLE\" \
\"\" \
\"\$prompt\" \
\"\$hline\" \
$menu_list
@ -96,7 +95,7 @@ f_dialog_menu_group_list()
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--default-item \"\$defaultitem\" \
--menu \"\" \
--menu \"\$prompt\" \
$height $width $rows \
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
@ -171,24 +170,23 @@ f_dialog_input_group_name()
#
f_dialog_input_group_password()
{
local prompt1="$msg_group_password"
local prompt2="$msg_reenter_group_password"
local hline="$hline_alnum_punc_tab_enter"
local msg rmsg
msg=$( printf "$msg_group_password" )
local height1 width1
f_dialog_inputbox_size height1 width1 \
"$DIALOG_TITLE" \
"$DIALOG_BACKTITLE" \
"$msg" \
"$prompt1" \
"" \
"$hline"
rmsg=$( printf "$msg_reenter_group_password" )
local height2 width2
f_dialog_inputbox_size height2 width2 \
"$DIALOG_TITLE" \
"$DIALOG_BACKTITLE" \
"$rmsg" \
"$prompt2" \
"" \
"$hline"
@ -204,7 +202,7 @@ f_dialog_input_group_password()
--ok-label "$msg_ok" \
--cancel-label "$msg_cancel" \
--insecure \
--passwordbox "$msg" \
--passwordbox "$prompt1" \
$height1 $width1 \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
)
@ -221,7 +219,7 @@ f_dialog_input_group_password()
--ok-label "$msg_ok" \
--cancel-label "$msg_cancel" \
--insecure \
--passwordbox "$rmsg" \
--passwordbox "$prompt2" \
$height2 $width2 \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
)
@ -288,30 +286,25 @@ f_dialog_input_group_gid()
#
f_dialog_input_group_members()
{
local menu_choice retval _input="$1"
local msg="$msg_group_members:"
local hline="$hline_num_arrows_tab_enter"
local user
local menu_list
local all_users_valid
local _group_members
local checklist_users
menu_list="
local _input="$1"
local prompt="$msg_group_members:"
local menu_list="
'X' '$msg_continue'
'1' '$msg_select_group_members_from_list'
'2' '$msg_enter_group_members_manually'
" # END-QUOTE
local defaultitem=
local hline="$hline_num_arrows_tab_enter"
local menu_choice defaultitem=
local mheight mwidth mrows
eval f_dialog_menu_size mheight mwidth mrows \
\"\$DIALOG_TITLE\" \
\"\$DIALOG_BACKTITLE\" \
\"\$msg\" \
\"\$prompt\" \
\"\$hline\" \
$menu_list
local menu_choice retval
while :; do
menu_choice=$( eval $DIALOG \
--title \"\$DIALOG_TITLE\" \
@ -320,7 +313,7 @@ f_dialog_input_group_members()
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--default-item \"\$defaultitem\" \
--menu \"\$msg\" \
--menu \"\$prompt\" \
$mheight $mwidth $mrows \
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
@ -333,19 +326,20 @@ f_dialog_input_group_members()
# Return if user has either pressed ESC or chosen Cancel/No
[ $retval -eq $SUCCESS ] || return $retval
local _group_members
case "$menu_choice" in
X) # Exit
break ;;
1) # Select Group Members from a list
user_list=$( pw usershow -a | awk -F: '
!/^[[:space:]]*(#|$)/ { printf "%s\n", $1 }' )
checklist_users=
for user in $user_list; do
checklist_users="$checklist_users $user \"\""
local user check_list=
for user in $( pw usershow -a |
awk -F: '!/^[[:space:]]*(#|$)/{print $1}'
); do
# Format of a checklist entry: tag item status
if echo "$_input" | grep -q "\<$user\>"; then
checklist_users="$checklist_users on"
check_list="$check_list $user '' on"
else
checklist_users="$checklist_users off"
check_list="$check_list $user '' off"
fi
done
@ -353,9 +347,9 @@ f_dialog_input_group_members()
eval f_dialog_checklist_size cheight cwidth crows \
\"\$DIALOG_TITLE\" \
\"\$DIALOG_BACKTITLE\" \
\"\" \
\"\$prompt\" \
\"\$hline\" \
$checklist_users
$check_list
_group_members=$( eval $DIALOG \
--title \"\$DIALOG_TITLE\" \
--backtitle \"\$DIALOG_BACKTITLE\" \
@ -363,9 +357,9 @@ f_dialog_input_group_members()
--hline \"\$hline\" \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--checklist \"\$msg\" \
--checklist \"\$prompt\" \
$cheight $cwidth $crows \
$checklist_users \
$check_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
) || continue
# Return to previous menu if user either
@ -383,9 +377,9 @@ f_dialog_input_group_members()
_input="$_group_members"
;;
2) # Enter Group Members manually
msg="$msg_group_members ($msg_separated_by_commas)"
local p="$msg_group_members ($msg_separated_by_commas)"
f_dialog_input _group_members "$msg" "$_input" \
f_dialog_input _group_members "$p" "$_input" \
"$hline_num_tab_enter" || continue
# Return to previous menu if user either
# pressed ESC or chose Cancel/No

View File

@ -90,13 +90,12 @@ f_input_user()
#
f_dialog_menu_user_list()
{
local defaultitem="$1"
local menu_list
local hline="$hline_alnum_punc_tab_enter"
menu_list="
local prompt=
local menu_list="
'X $msg_exit' ''
" # END-QUOTE
local defaultitem="$1"
local hline="$hline_alnum_punc_tab_enter"
# Add users from passwd(5)
menu_list="$menu_list $( pw usershow -a | awk -F: '
@ -109,7 +108,7 @@ f_dialog_menu_user_list()
eval f_dialog_menu_size height width rows \
\"\$DIALOG_TITLE\" \
\"\$DIALOG_BACKTITLE\" \
\"\" \
\"\$prompt\" \
\"\$hline\" \
$menu_list
@ -121,7 +120,7 @@ f_dialog_menu_user_list()
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--default-item \"\$defaultitem\" \
--menu \"\" \
--menu \"\$prompt\" \
$height $width $rows \
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
@ -139,35 +138,38 @@ f_dialog_menu_user_list()
#
f_dialog_input_member_groups()
{
local msg="$( printf "$msg_member_of_groups" )"
local _member_groups="$1"
local prompt="$msg_member_of_groups"
local check_list= # Calculated below
local hline="$hline_alnum_space_tab_enter"
local group
#
# Generate the checklist menu
#
for group in $(
pw groupshow -a | awk -F: '!/^[[:space:]]*(#|$)/{print $1}'
); do
# Format of a checklist menu entry is "tag item status"
# (setting both tag and item to the group name below).
if echo "$_member_groups" | grep -q "\<$group\>"; then
check_list="$check_list $group $group on"
else
check_list="$check_list $group $group off"
fi
done
#
# Loop until the user provides taint-free/valid input
#
local retval all_groups checklist_groups="" _member_groups="$1"
all_groups=$( pw groupshow -a | awk -F: '
!/^[[:space:]]*(#|$)/ {
printf "%s\n", $1
}'
)
for grp in $all_groups; do
checklist_groups="$checklist_groups $grp $grp"
if echo "$_member_groups" | grep -q "\<$grp\>"; then
checklist_groups="$checklist_groups on"
else
checklist_groups="$checklist_groups off"
fi
done
local height width rows
while :; do
eval f_dialog_checklist_size height width rows \
\"\$DIALOG_TITLE\" \
\"\$DIALOG_BACKTITLE\" \
\"\" \
\"\$prompt\" \
\"\$hline\" \
$checklist_groups
$check_list
_member_groups=$( eval $DIALOG \
--title \"\$DIALOG_TITLE\" \
--backtitle \"\$DIALOG_BACKTITLE\" \
@ -175,9 +177,9 @@ f_dialog_input_member_groups()
--hline \"\$hline\" \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--checklist \"\$msg\" \
--checklist \"\$prompt\" \
$height $width $rows \
$checklist_groups \
$check_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
) || return $?
# Return if user either pressed ESC or chose Cancel/No
@ -186,7 +188,7 @@ f_dialog_input_member_groups()
#
# Validate each of the groups the user has entered
#
local group all_groups_valid=1
local all_groups_valid=1
for group in $_member_groups; do
if ! f_quietly pw groupshow -n "$group"; then
f_show_msg "$msg_group_not_found" "$group"
@ -272,24 +274,22 @@ f_dialog_input_name()
#
f_dialog_input_password()
{
local prompt1="$msg_password"
local prompt2="$msg_reenter_password"
local hline="$hline_alnum_punc_tab_enter"
local msg rmsg
msg=$( printf "$msg_password" )
local height1 width1
f_dialog_inputbox_size height1 width1 \
"$DIALOG_TITLE" \
"$DIALOG_BACKTITLE" \
"$msg" \
"$prompt1" \
"" \
"$hline"
rmsg=$( printf "$msg_reenter_password" )
local height2 width2
f_dialog_inputbox_size height2 width2 \
"$DIALOG_TITLE" \
"$DIALOG_BACKTITLE" \
"$rmsg" \
"$prompt2" \
"" \
"$hline"
@ -305,7 +305,7 @@ f_dialog_input_password()
--ok-label "$msg_ok" \
--cancel-label "$msg_cancel" \
--insecure \
--passwordbox "$msg" \
--passwordbox "$prompt1" \
$height1 $width1 \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
) || return $?
@ -319,7 +319,7 @@ f_dialog_input_password()
--ok-label "$msg_ok" \
--cancel-label "$msg_cancel" \
--insecure \
--passwordbox "$rmsg" \
--passwordbox "$prompt2" \
$height2 $width2 \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
) || return $?
@ -450,35 +450,34 @@ f_dialog_input_class()
#
f_dialog_input_change()
{
local retval _input="$1"
local msg="$msg_password_expires_on"
local hline="$hline_num_arrows_tab_enter"
local prompt="$msg_password_expires_on"
local menu_list="
'1' '$msg_password_does_not_expire'
'2' '$msg_edit_date_time_with_a_calendar'
'3' '$msg_enter_number_of_days_into_the_future'
'4' '$msg_enter_value_manually'
" # END-QUOTE
local hline="$hline_num_arrows_tab_enter"
local retval _input="$1"
local mheight mwidth mrows
eval f_dialog_menu_size mheight mwidth mrows \
\"\$DIALOG_TITLE\" \
\"\$DIALOG_BACKTITLE\" \
\"\$msg\" \
\"\$prompt\" \
\"\$hline\" \
$menu_list
local cheight cwidth
f_dialog_calendar_size cheight cwidth \
"$DIALOG_TITLE" \
"$DIALOG_BACKTITLE" \
"$msg" \
"$prompt" \
"$hline"
local theight twidth
f_dialog_timebox_size theight twidth \
"$DIALOG_TITLE" \
"$DIALOG_BACKTITLE" \
"$msg" \
"$prompt" \
"$hline"
#
@ -492,7 +491,7 @@ f_dialog_input_change()
--hline \"\$hline\" \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--menu \"\$msg\" \
--menu \"\$prompt\" \
$mheight $mwidth $mrows \
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
@ -522,7 +521,7 @@ f_dialog_input_change()
--hline \"\$hline\" \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--calendar \"\$msg\" \
--calendar \"\$prompt\" \
$cheight $cwidth \
$_input_date \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
@ -543,7 +542,7 @@ f_dialog_input_change()
--hline \"\$hline\" \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--timebox \"\$msg\" \
--timebox \"\$prompt\" \
$theight $twidth \
$_input_time \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
@ -592,6 +591,7 @@ f_dialog_input_change()
break ;;
4) # Enter value manually
local msg
msg=$( printf "$msg_number_of_seconds_since_epoch" \
"$( date -r 1 "+%c %Z" )" )
@ -631,35 +631,34 @@ f_dialog_input_change()
#
f_dialog_input_expire()
{
local retval _input="$1"
local msg="$msg_account_expires_on"
local hline="$hline_num_arrows_tab_enter"
local prompt="$msg_account_expires_on"
local menu_list="
'1' '$msg_account_does_not_expire'
'2' '$msg_edit_date_time_with_a_calendar'
'3' '$msg_enter_number_of_days_into_the_future'
'4' '$msg_enter_value_manually'
" # END-QUOTE
local hline="$hline_num_arrows_tab_enter"
local retval _input="$1"
local mheight mwidth mrows
eval f_dialog_menu_size mheight mwidth mrows \
\"\$DIALOG_TITLE\" \
\"\$DIALOG_BACKTITLE\" \
\"\$msg\" \
\"\$prompt\" \
\"\$hline\" \
$menu_list
local cheight cwidth
f_dialog_calendar_size cheight cwidth \
"$DIALOG_TITLE" \
"$DIALOG_BACKTITLE" \
"$msg" \
"$prompt" \
"$hline"
local theight twidth
f_dialog_timebox_size theight twidth \
"$DIALOG_TITLE" \
"$DIALOG_BACKTITLE" \
"$msg" \
"$prompt" \
"$hline"
#
@ -673,7 +672,7 @@ f_dialog_input_expire()
--hline \"\$hline\" \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--menu \"\$msg\" \
--menu \"\$prompt\" \
$mheight $mwidth $mrows \
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
@ -703,7 +702,7 @@ f_dialog_input_expire()
--hline \"\$hline\" \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--calendar \"\$msg\" \
--calendar \"\$prompt\" \
$cheight $cwidth \
$_input_date \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
@ -724,7 +723,7 @@ f_dialog_input_expire()
--hline \"\$hline\" \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--timebox \"\$msg\" \
--timebox \"\$prompt\" \
$theight $twidth \
$_input_time \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
@ -773,6 +772,7 @@ f_dialog_input_expire()
break ;;
4) # Enter value manually
local msg
msg=$( printf "$msg_number_of_seconds_since_epoch" \
"$( date -r 1 "+%c %Z" )" )
@ -959,20 +959,23 @@ f_dialog_input_dotfiles_create()
#
f_dialog_input_shell()
{
local shells shell_list _input="$1"
local hline="$hline_arrows_space_tab_enter"
local _input="$1"
local prompt="$msg_select_login_shell"
local radio_list= # Calculated below
local hline="$hline_arrows_space_tab_enter"
shells=$( awk '!/^[[:space:]]*(#|$)/{print}' "$ETC_SHELLS" )
shell_list=$(
for shell in $shells; do
if [ "$shell" = "$_input" ]; then
echo "'$shell' '' 'on'"
else
echo "'$shell' '' 'off'"
fi
done
)
#
# Generate the radiolist of shells
#
local shell
for shell in $( awk '!/^[[:space:]]*(#|$)/{print}' "$ETC_SHELLS" ); do
# Format of a radiolist menu entry is "tag item status"
if [ "$shell" = "$_input" ]; then
radio_list="$radio_list '$shell' '' 'on'"
else
radio_list="$radio_list '$shell' '' 'off'"
fi
done
local height width rows
eval f_dialog_radiolist_size height width rows \
@ -980,7 +983,7 @@ f_dialog_input_shell()
\"\$DIALOG_BACKTITLE\" \
\"\$prompt\" \
\"\$hline\" \
$shell_list
$radio_list
_input=$( eval $DIALOG \
--title \"\$DIALOG_TITLE\" \
@ -990,7 +993,7 @@ f_dialog_input_shell()
--cancel-label \"\$msg_cancel\" \
--radiolist \"\$prompt\" \
$height $width $rows \
$shell_list \
$radio_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
) || return $?
# Return if user either pressed ESC or chose Cancel/No

View File

@ -51,11 +51,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
local menu_list
local hline="$hline_arrows_tab_enter"
local defaultitem= # Calculated below
menu_list="
local prompt=
local menu_list="
'X' '$msg_exit'
'1' '$msg_add_login'
'2' '$msg_edit_login'
@ -65,12 +62,14 @@ dialog_menu_main()
'5' '$msg_edit_group'
'6' '$msg_delete_group'
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_arrows_tab_enter"
local height width rows
eval f_dialog_menu_size height width rows \
\"\$DIALOG_TITLE\" \
\"\$DIALOG_BACKTITLE\" \
\"\" \
\"\$prompt\" \
\"\$hline\" \
$menu_list
@ -91,7 +90,7 @@ dialog_menu_main()
--help-label \"\$msg_help\" \
${USE_XDIALOG:+--help \"\"} \
--default-item \"\$defaultitem\" \
--menu \"\" \
--menu \"\$prompt\" \
$height $width $rows \
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD