--- trunk/installer-simple/functions/common-dialogs.sh 2014/01/07 12:59:51 2395 +++ trunk/installer-simple/functions/common-dialogs.sh 2014/01/07 15:03:12 2452 @@ -31,6 +31,7 @@ [[ -z ${OK_LABEL} ]] && OK_LABEL="Next" + echo "DEBUG: paused" >&2; read dialog \ --colors \ --title "${header}" \ @@ -64,6 +65,7 @@ [[ -z ${height} ]] && height=3 [[ -z ${width} ]] && width=70 + echo "DEBUG: paused" >&2; read dialog \ --colors \ --title "${header}" \ @@ -96,6 +98,7 @@ [[ -z ${height} ]] && height=0 [[ -z ${width} ]] && width=0 + echo "DEBUG: paused" >&2; read dialog \ --stdout \ --colors \ @@ -129,6 +132,7 @@ [[ -z ${height} ]] && height=0 [[ -z ${width} ]] && width=0 + echo "DEBUG: paused" >&2; read dialog \ --stdout \ --colors \ @@ -138,6 +142,54 @@ --passwordbox "${text}" "${height}" "${width}" } +menubox() +{ + local header + local text + local height + local width + local items + local index + local dialog_opts + + # very basic getops + local OPTIND opt + while getopts ":h:y:x:i:n" opt + do + case ${opt} in + n) dialog_opts+=" --no-cancel" ;; + h) header="${OPTARG}" ;; + y) height="${OPTARG}" ;; + x) width="${OPTARG}" ;; + esac + done + shift $((OPTIND-1)) + text="$1" + shift + items=( "$@" ) + index="${#items[*]}" + + #[[ -z ${header} ]] && header="empty header: add -h yourheader" + [[ -z ${text} ]] && die "no text given" + [[ -z ${height} ]] && height=0 + [[ -z ${width} ]] && width=70 + + [[ -z ${OK_LABEL} ]] && OK_LABEL="Next" + [[ -z ${CANCEL_LABEL} ]] && CANCEL_LABEL="Back" + + echo "DEBUG: paused" >&2; read + eval dialog \ + --stdout \ + --colors \ + --title "'${header}'" \ + --backtitle "'${TITLE}'" \ + --ok-label "'${OK_LABEL}'" \ + --cancel-label "'${CANCEL_LABEL}'" \ + "${dialog_opts}" \ + --menu "'${text}'" "${height}" "${width}" "${index}" \ + $(for ((i=0;i&2; read dialog \ --colors \ --title "${header}" \ @@ -195,6 +248,7 @@ [[ -z ${height} ]] && height=0 [[ -z ${width} ]] && width=0 + echo "DEBUG: paused" >&2; read dialog \ --colors \ --title "${header}" \ @@ -202,6 +256,3 @@ --defaultno \ --yesno "${text}" "${height}" "${width}" } - -welcome() { messagebox "Welcome" "Welcome to the ${DEFAULT_TITLE}.\n\n\nPress [Enter] to continue." 10 45; } -finish() { OK_LABEL="Exit" messagebox "Finish" "Installation was successfully finished." 10 40; }