| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package UI::Dialog::Backend::GDialog; |
|
2
|
|
|
|
|
|
|
############################################################################### |
|
3
|
|
|
|
|
|
|
# Copyright (C) 2004-2016 Kevin C. Krinke |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or |
|
6
|
|
|
|
|
|
|
# modify it under the terms of the GNU Lesser General Public |
|
7
|
|
|
|
|
|
|
# License as published by the Free Software Foundation; either |
|
8
|
|
|
|
|
|
|
# version 2.1 of the License, or (at your option) any later version. |
|
9
|
|
|
|
|
|
|
# |
|
10
|
|
|
|
|
|
|
# This library is distributed in the hope that it will be useful, |
|
11
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13
|
|
|
|
|
|
|
# Lesser General Public License for more details. |
|
14
|
|
|
|
|
|
|
# |
|
15
|
|
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public |
|
16
|
|
|
|
|
|
|
# License along with this library; if not, write to the Free Software |
|
17
|
|
|
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18
|
|
|
|
|
|
|
############################################################################### |
|
19
|
2
|
|
|
2
|
|
12608
|
use 5.006; |
|
|
2
|
|
|
|
|
4
|
|
|
20
|
2
|
|
|
2
|
|
6
|
use strict; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
34
|
|
|
21
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
36
|
|
|
22
|
2
|
|
|
2
|
|
6
|
use Carp; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
132
|
|
|
23
|
2
|
|
|
2
|
|
471
|
use FileHandle; |
|
|
2
|
|
|
|
|
7172
|
|
|
|
2
|
|
|
|
|
8
|
|
|
24
|
2
|
|
|
2
|
|
863
|
use UI::Dialog::Backend; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
53
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
BEGIN { |
|
27
|
2
|
|
|
2
|
|
7
|
use vars qw( $VERSION @ISA ); |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
93
|
|
|
28
|
2
|
|
|
2
|
|
14
|
@ISA = qw( UI::Dialog::Backend ); |
|
29
|
2
|
|
|
|
|
2503
|
$VERSION = '1.21'; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
33
|
|
|
|
|
|
|
#: Constructor Method |
|
34
|
|
|
|
|
|
|
#: |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new { |
|
37
|
1
|
|
|
1
|
1
|
352
|
my $proto = shift(); |
|
38
|
1
|
|
33
|
|
|
5
|
my $class = ref($proto) || $proto; |
|
39
|
1
|
50
|
|
|
|
6
|
my $cfg = ((ref($_[0]) eq "HASH") ? $_[0] : (@_) ? { @_ } : {}); |
|
|
|
50
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
1
|
my $self = {}; |
|
41
|
1
|
|
|
|
|
2
|
bless($self, $class); |
|
42
|
1
|
|
|
|
|
6
|
$self->{'_state'} = {}; |
|
43
|
1
|
|
|
|
|
1
|
$self->{'_opts'} = {}; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
#: Dynamic path discovery... |
|
46
|
1
|
|
|
|
|
2
|
my $CFG_PATH = $cfg->{'PATH'}; |
|
47
|
1
|
50
|
|
|
|
5
|
if ($CFG_PATH) { |
|
|
|
50
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
0
|
if (ref($CFG_PATH) eq "ARRAY") { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
0
|
$self->{'PATHS'} = $CFG_PATH; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
elsif ($CFG_PATH =~ m!:!) { |
|
52
|
0
|
|
|
|
|
0
|
$self->{'PATHS'} = [ split(/:/,$CFG_PATH) ]; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
elsif (-d $CFG_PATH) { |
|
55
|
0
|
|
|
|
|
0
|
$self->{'PATHS'} = [ $CFG_PATH ]; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
elsif ($ENV{'PATH'}) { |
|
59
|
1
|
|
|
|
|
6
|
$self->{'PATHS'} = [ split(/:/,$ENV{'PATH'}) ]; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
else { |
|
62
|
0
|
|
|
|
|
0
|
$self->{'PATHS'} = ''; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
1
|
|
50
|
|
|
6
|
$self->{'_opts'}->{'literal'} = $cfg->{'literal'} || 0; |
|
66
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'callbacks'} = $cfg->{'callbacks'} || undef(); |
|
67
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'debug'} = $cfg->{'debug'} || undef(); |
|
68
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'title'} = $cfg->{'title'} || undef(); |
|
69
|
1
|
|
50
|
|
|
9
|
$self->{'_opts'}->{'backtitle'} = $cfg->{'backtitle'} || undef(); |
|
70
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'width'} = $cfg->{'width'} || 65; |
|
71
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'height'} = $cfg->{'height'} || 10; |
|
72
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'percentage'} = $cfg->{'percentage'} || 1; |
|
73
|
1
|
|
50
|
|
|
10
|
$self->{'_opts'}->{'bin'} ||= $self->_find_bin('gdialog.real') || $self->_find_bin('gdialog') || '/usr/bin/gdialog'; |
|
|
|
|
33
|
|
|
|
|
|
74
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'autoclear'} = $cfg->{'autoclear'} || 0; |
|
75
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'clearbefore'} = $cfg->{'clearbefore'} || 0; |
|
76
|
1
|
|
50
|
|
|
7
|
$self->{'_opts'}->{'clearafter'} = $cfg->{'clearafter'} || 0; |
|
77
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'beepbin'} = $cfg->{'beepbin'} || $self->_find_bin('beep') || '/usr/bin/beep'; |
|
78
|
1
|
|
50
|
|
|
5
|
$self->{'_opts'}->{'beepbefore'} = $cfg->{'beepbefore'} || 0; |
|
79
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'beepafter'} = $cfg->{'beepafter'} || 0; |
|
80
|
1
|
|
50
|
|
|
4
|
$self->{'_opts'}->{'timeout'} = $cfg->{'timeout'} || 0; |
|
81
|
1
|
|
50
|
|
|
3
|
$self->{'_opts'}->{'wait'} = $cfg->{'wait'} || 0; |
|
82
|
1
|
50
|
|
|
|
7
|
unless (-x $self->{'_opts'}->{'bin'}) { |
|
83
|
1
|
|
|
|
|
162
|
croak("the gdialog binary could not be found at: ".$self->{'_opts'}->{'bin'}); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
0
|
|
0
|
|
|
|
$self->{'_opts'}->{'trust-input'} = $cfg->{'trust-input'} || 0; |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
|
$self->{'test_mode'} = $cfg->{'test_mode'} if exists $cfg->{'test_mode'}; |
|
89
|
0
|
|
|
|
|
|
$self->{'test_mode_result'} = ''; |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
return($self); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
95
|
|
|
|
|
|
|
#: Private Methods |
|
96
|
|
|
|
|
|
|
#: |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
my $SIG_CODE = {}; |
|
99
|
|
|
|
|
|
|
sub _del_gauge { |
|
100
|
0
|
|
|
0
|
|
|
my $CODE = $SIG_CODE->{$$}; |
|
101
|
0
|
0
|
|
|
|
|
unless (not ref($CODE)) { |
|
102
|
0
|
|
|
|
|
|
delete($CODE->{'_GAUGE'}); |
|
103
|
0
|
|
|
|
|
|
$CODE->rv('1'); |
|
104
|
0
|
|
|
|
|
|
$CODE->rs('null'); |
|
105
|
0
|
|
|
|
|
|
$CODE->ra('null'); |
|
106
|
0
|
|
|
|
|
|
$SIG_CODE->{$$} = ""; |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub append_format_base { |
|
111
|
0
|
|
|
0
|
0
|
|
my ($self,$args,$fmt) = @_; |
|
112
|
0
|
|
|
|
|
|
return $fmt; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
117
|
|
|
|
|
|
|
#: Public Methods |
|
118
|
|
|
|
|
|
|
#: |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
121
|
|
|
|
|
|
|
#: Ask a binary question (Yes/No) |
|
122
|
|
|
|
|
|
|
sub yesno { |
|
123
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
|
124
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
|
125
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
|
126
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
|
127
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
|
0
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
} |
|
129
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
|
130
|
|
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
|
132
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
|
133
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--yesno {{text}} {{height}} {{width}}'); |
|
134
|
|
|
|
|
|
|
my $command = $self->prepare_command |
|
135
|
|
|
|
|
|
|
( $args, $fmt, |
|
136
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
|
137
|
|
|
|
|
|
|
); |
|
138
|
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
my $rv = $self->command_state($command); |
|
140
|
0
|
0
|
0
|
|
|
|
if ($rv && $rv >= 1) { |
|
141
|
0
|
|
|
|
|
|
$self->ra("NO"); |
|
142
|
0
|
|
|
|
|
|
$self->rs("NO"); |
|
143
|
0
|
|
|
|
|
|
$self->rv($rv); |
|
144
|
|
|
|
|
|
|
} else { |
|
145
|
0
|
|
|
|
|
|
$self->ra("YES"); |
|
146
|
0
|
|
|
|
|
|
$self->rs("YES"); |
|
147
|
0
|
|
|
|
|
|
$self->rv('null'); |
|
148
|
|
|
|
|
|
|
} |
|
149
|
0
|
|
|
|
|
|
$self->_post($args); |
|
150
|
0
|
0
|
|
|
|
|
return($rv == 0 ? 1 : 0); |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
154
|
|
|
|
|
|
|
#: Text entry |
|
155
|
|
|
|
|
|
|
sub inputbox { |
|
156
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
|
157
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
|
158
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
|
159
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
|
160
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
|
0
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
} |
|
162
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
|
163
|
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
|
165
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
|
166
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--inputbox'); |
|
167
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{entry}}'); |
|
168
|
|
|
|
|
|
|
my $command = $self->prepare_command |
|
169
|
|
|
|
|
|
|
( $args, $fmt, |
|
170
|
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
|
171
|
0
|
|
0
|
|
|
|
entry => $self->make_kvl($args,($args->{'init'}||$args->{'entry'})), |
|
172
|
|
|
|
|
|
|
); |
|
173
|
|
|
|
|
|
|
|
|
174
|
0
|
|
|
|
|
|
my ($rv,$text) = $self->command_string($command); |
|
175
|
0
|
|
|
|
|
|
$self->_post($args); |
|
176
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $text : 0); |
|
177
|
|
|
|
|
|
|
} |
|
178
|
|
|
|
|
|
|
#: password boxes aren't supported by gdialog |
|
179
|
|
|
|
|
|
|
sub password { |
|
180
|
0
|
|
|
0
|
1
|
|
carp("Password entry fields are not supported by GDialog."); |
|
181
|
0
|
|
|
|
|
|
return(1); #: Cancel every time. |
|
182
|
|
|
|
|
|
|
} |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
185
|
|
|
|
|
|
|
#: Text box |
|
186
|
|
|
|
|
|
|
sub msgbox { |
|
187
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
|
188
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
|
189
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
|
190
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
|
191
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
|
0
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
} |
|
193
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
|
194
|
|
|
|
|
|
|
|
|
195
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
|
196
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
|
197
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--scrolltext'); |
|
198
|
0
|
0
|
|
|
|
|
if ($args->{'infobox'}) { |
|
199
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--infobox'); |
|
200
|
|
|
|
|
|
|
} |
|
201
|
|
|
|
|
|
|
else { |
|
202
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--msgbox'); |
|
203
|
|
|
|
|
|
|
} |
|
204
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}}'); |
|
205
|
|
|
|
|
|
|
my $command = $self->prepare_command |
|
206
|
|
|
|
|
|
|
( $args, $fmt, |
|
207
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
|
208
|
|
|
|
|
|
|
); |
|
209
|
|
|
|
|
|
|
|
|
210
|
0
|
|
|
|
|
|
my $rv = $self->command_state($command); |
|
211
|
0
|
|
|
|
|
|
$self->_post($args); |
|
212
|
0
|
0
|
|
|
|
|
return($rv == 0 ? 1 : 0); |
|
213
|
|
|
|
|
|
|
} |
|
214
|
|
|
|
|
|
|
sub infobox { |
|
215
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
|
216
|
0
|
|
0
|
|
|
|
return($self->msgbox('caller',((caller(1))[3]||'main'),@_,'infobox',1)); |
|
217
|
|
|
|
|
|
|
} |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
220
|
|
|
|
|
|
|
#: File box |
|
221
|
|
|
|
|
|
|
sub textbox { |
|
222
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
|
223
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
|
224
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
|
225
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
|
226
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
|
0
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
} |
|
228
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
|
229
|
|
|
|
|
|
|
|
|
230
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
|
231
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
|
232
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--textbox'); |
|
233
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{path}} {{height}} {{width}}'); |
|
234
|
|
|
|
|
|
|
my $command = $self->prepare_command |
|
235
|
|
|
|
|
|
|
( $args, $fmt, |
|
236
|
0
|
|
0
|
|
|
|
path => $self->make_kvl($args,($args->{'path'}||'.')), |
|
237
|
|
|
|
|
|
|
); |
|
238
|
|
|
|
|
|
|
|
|
239
|
0
|
|
|
|
|
|
my ($rv,$text) = $self->command_string($command); |
|
240
|
0
|
|
|
|
|
|
$self->_post($args); |
|
241
|
0
|
0
|
|
|
|
|
return($rv == 0 ? 1 : 0); |
|
242
|
|
|
|
|
|
|
} |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
245
|
|
|
|
|
|
|
#: a simple menu list |
|
246
|
|
|
|
|
|
|
sub menu { |
|
247
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
|
248
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
|
249
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
|
250
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
|
251
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
|
0
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
} |
|
253
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
|
254
|
|
|
|
|
|
|
|
|
255
|
0
|
|
0
|
|
|
|
$args->{'listheight'} ||= $args->{'menuheight'}; |
|
256
|
|
|
|
|
|
|
|
|
257
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
|
258
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
|
259
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--menu'); |
|
260
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{listheight}} {{list}}'); |
|
261
|
|
|
|
|
|
|
my $command = $self->prepare_command |
|
262
|
|
|
|
|
|
|
( $args, $fmt, |
|
263
|
0
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
|
264
|
|
|
|
|
|
|
); |
|
265
|
|
|
|
|
|
|
|
|
266
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_string($command); |
|
267
|
0
|
|
|
|
|
|
$self->_post($args); |
|
268
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $selected : 0); |
|
269
|
|
|
|
|
|
|
} |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
#:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
272
|
|
|
|
|
|
|
#: a check list |
|
273
|
|
|
|
|
|
|
sub checklist { |
|
274
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
|
275
|
0
|
|
0
|
|
|
|
my $caller = (caller(1))[3] || 'main'; |
|
276
|
0
|
0
|
0
|
|
|
|
$caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller; |
|
277
|
0
|
0
|
0
|
|
|
|
if ($_[0] && $_[0] eq 'caller') { |
|
278
|
0
|
|
|
|
|
|
shift(); $caller = shift(); |
|
|
0
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
} |
|
280
|
0
|
|
|
|
|
|
my $args = $self->_pre($caller,@_); |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
$args->{'listheight'} = $args->{'menuheight'} |
|
283
|
0
|
0
|
|
|
|
|
if exists $args->{'menuheight'}; |
|
284
|
|
|
|
|
|
|
|
|
285
|
0
|
|
|
|
|
|
my $fmt = $self->prepare_format($args); |
|
286
|
0
|
|
|
|
|
|
$fmt = $self->append_format_base($args,$fmt); |
|
287
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--separate-output'); |
|
288
|
0
|
|
0
|
|
|
|
$args->{radiolist} ||= 0; |
|
289
|
0
|
0
|
|
|
|
|
if ($args->{radiolist}) { |
|
290
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--radiolist'); |
|
291
|
|
|
|
|
|
|
} |
|
292
|
|
|
|
|
|
|
else { |
|
293
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'--checklist'); |
|
294
|
|
|
|
|
|
|
} |
|
295
|
0
|
|
|
|
|
|
$fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{listheight}} {{list}}'); |
|
296
|
|
|
|
|
|
|
my $command = $self->prepare_command |
|
297
|
|
|
|
|
|
|
( $args, $fmt, |
|
298
|
|
|
|
|
|
|
text => $self->make_kvt($args,$args->{'text'}), |
|
299
|
0
|
|
|
|
|
|
listheight => $self->make_kvl($args,$args->{'listheight'}) |
|
300
|
|
|
|
|
|
|
); |
|
301
|
|
|
|
|
|
|
|
|
302
|
0
|
0
|
|
|
|
|
if ($args->{radiolist}) { |
|
303
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_string($command); |
|
304
|
0
|
0
|
|
|
|
|
return($rv == 0 ? $selected : 0); |
|
305
|
|
|
|
|
|
|
} |
|
306
|
0
|
|
|
|
|
|
my ($rv,$selected) = $self->command_array($command); |
|
307
|
0
|
0
|
|
|
|
|
return($rv == 0 ? @{$selected} : 0); |
|
|
0
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
} |
|
309
|
|
|
|
|
|
|
#: a radio button list |
|
310
|
|
|
|
|
|
|
sub radiolist { |
|
311
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
|
312
|
0
|
|
0
|
|
|
|
return($self->checklist('caller',((caller(1))[3]||'main'),@_,'radiolist',1)); |
|
313
|
|
|
|
|
|
|
} |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
1; |
|
316
|
|
|
|
|
|
|
|