Magellan Linux

Contents of /trunk/installer-simple/functions/common-dialogs.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2346 - (show annotations) (download) (as text)
Fri Jan 3 15:03:47 2014 UTC (10 years, 3 months ago) by niro
File MIME type: application/x-sh
File size: 2154 byte(s)
-renamed common.sh to common-dialogs.sh
1 # $Id$
2
3 # common dialog boxes
4 messagebox()
5 {
6 local header="$1"
7 local text="$2"
8 local height="$3"
9 local width="$4"
10
11 [[ -z ${header} ]] && die "no header given"
12 [[ -z ${text} ]] && die "no text given"
13 [[ -z ${height} ]] && height=0
14 [[ -z ${width} ]] && width=0
15
16 [[ -z ${OK_LABEL} ]] && OK_LABEL="Next"
17
18 dialog \
19 --colors \
20 --title "${header}" \
21 --backtitle "${TITLE}" \
22 --ok-label "${OK_LABEL}" \
23 --msgbox "${text}" "${height}" "${width}"
24 }
25
26 inputbox()
27 {
28 local header="$1"
29 local text="$2"
30 local height="$3"
31 local width="$4"
32
33 [[ -z ${header} ]] && die "no header given"
34 [[ -z ${text} ]] && die "no text given"
35 [[ -z ${height} ]] && height=0
36 [[ -z ${width} ]] && width=0
37
38 dialog \
39 --stdout \
40 --colors \
41 --title "${header}" \
42 --backtitle "${TITLE}" \
43 --inputbox "${text}" "${height}" "${width}"
44 }
45
46 passwordbox()
47 {
48 local header="$1"
49 local text="$2"
50 local height="$3"
51 local width="$4"
52
53 [[ -z ${header} ]] && die "no header given"
54 [[ -z ${text} ]] && die "no text given"
55 [[ -z ${height} ]] && height=0
56 [[ -z ${width} ]] && width=0
57
58 dialog \
59 --stdout \
60 --colors \
61 --title "${header}" \
62 --backtitle "${TITLE}" \
63 --insecure \
64 --passwordbox "${text}" "${height}" "${width}"
65 }
66
67 gauge()
68 {
69 local header="$1"
70 local text="$2"
71 local height="$3"
72 local width="$4"
73
74 [[ -z ${header} ]] && die "no header given"
75 [[ -z ${text} ]] && die "no text given"
76 [[ -z ${height} ]] && height=0
77 [[ -z ${width} ]] && width=0
78
79 dialog \
80 --colors \
81 --title "${header}" \
82 --backtitle "${TITLE}" \
83 --gauge "${text}" "${height}" "${width}"
84 }
85
86 yesno()
87 {
88 local header="$1"
89 local text="$2"
90 local height="$3"
91 local width="$4"
92
93 [[ -z ${header} ]] && die "no header given"
94 [[ -z ${text} ]] && die "no text given"
95 [[ -z ${height} ]] && height=0
96 [[ -z ${width} ]] && width=0
97
98 dialog \
99 --colors \
100 --title "${header}" \
101 --backtitle "${TITLE}" \
102 --defaultno \
103 --yesno "${text}" "${height}" "${width}"
104 }
105
106 welcome() { messagebox "Welcome" "Welcome to the ${DEFAULT_TITLE}.\n\n\nPress [Enter] to continue." 10 45; }
107 finish() { OK_LABEL="Exit" messagebox "Finish" "Installation was successfully finished." 10 40; }