Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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