47 |
|
|
48 |
|
|
49 |
|
# --- confirm changes with user if we have input more than one value |
50 |
< |
if ( $#{$userquery->querylist()} > 1 ) { |
51 |
< |
print "\nDo you wish to Accept,Restart or Cancel these values? ". |
52 |
< |
"(a/r/c)\n"; |
53 |
< |
my $in=<STDIN>; |
54 |
< |
if ( $in!~/^a/ ) { |
55 |
< |
$rv=0; |
56 |
< |
$userquery->cancel(); |
57 |
< |
if ( $in=~/^r/ ) { |
58 |
< |
return $self->askuser($userquery); |
59 |
< |
} |
60 |
< |
} |
61 |
< |
} |
62 |
< |
if ( $rv ne "0" ) { |
50 |
> |
# if ( $#{$userquery->querylist()} > 1 ) { |
51 |
> |
# print "\nDo you wish to Accept,Restart or Cancel these values? ". |
52 |
> |
# "(a/r/c)\n"; |
53 |
> |
# my $in=<STDIN>; |
54 |
> |
# if ( $in!~/^a/ ) { |
55 |
> |
# $userquery->cancel(); |
56 |
> |
# if ( $in=~/^r/ ) { |
57 |
> |
# return $self->askuser($userquery); |
58 |
> |
# } |
59 |
> |
# } |
60 |
> |
# } |
61 |
> |
if ( defined $rv ) { |
62 |
|
$userquery->OK(); |
63 |
|
} |
64 |
|
return $rv; |
88 |
|
return $rv; |
89 |
|
} |
90 |
|
|
91 |
+ |
# requires typehadler to return the response - undef assumed to be a cancel |
92 |
|
sub _calltype { |
93 |
|
my $self=shift; |
94 |
|
my $command=shift; |
98 |
|
my @options=$userquery->queryoptions($query); |
99 |
|
my $rv=$self->$command( $userquery->queryprompt($query), @options ); |
100 |
|
|
101 |
< |
# now process the response |
102 |
< |
my ($ret,$message,@vals)=$userquery->lodgevalue($query,$rv); |
103 |
< |
if ($ret ne 0 ) { # invalid response |
104 |
< |
print "Input not valid :"; |
105 |
< |
print $message->read(); |
106 |
< |
$rv=$self->_executequery($userquery,$query); |
101 |
> |
if ( defined $rv ) { |
102 |
> |
# now process the response |
103 |
> |
my ($ret,$message,@vals)=$userquery->lodgevalue($query,$rv); |
104 |
> |
if ($ret ne 0 ) { # invalid response |
105 |
> |
print "Input not valid :\n"; |
106 |
> |
print $message->read(); |
107 |
> |
$rv=$self->_executequery($userquery,$query); |
108 |
> |
} |
109 |
|
} |
110 |
|
return $rv; |
111 |
|
} |
124 |
|
$num++; |
125 |
|
} |
126 |
|
if ( $num == 1 ) { |
127 |
< |
$rv=$self->basic($prompt); |
127 |
> |
return $rv=$self->basic($prompt); |
128 |
|
} |
129 |
|
else { |
130 |
|
print $num.". Enter Alternative Value\n"; |
131 |
< |
print "Please Enter a Number from the list above :"; |
132 |
< |
while ( (($menuchoice=$self->basic($prompt))!~/^\d+$/) || |
133 |
< |
(($menuchoice > $num) || ( $menuchoice < 1)) ) { |
134 |
< |
print "Please Select a number Between 1 and $num :" ; |
131 |
> |
while ( ((($menuchoice=$self->basic("Please Enter a Number from". |
132 |
> |
" the list above >"))!~/^\d+$/) || |
133 |
> |
(($menuchoice > $num) || ( $menuchoice < 1)))) { |
134 |
> |
print "Please Select a number Between 1 and $num :\n" ; |
135 |
|
} |
136 |
|
} |
137 |
|
# Deal with alternative value |
138 |
|
if ( $menuchoice == $num ) { |
139 |
< |
$rv=$self->basic("Please enter new value $prompt"); |
139 |
> |
$rv=$self->basic($prompt); |
140 |
|
} |
141 |
+ |
elsif ( $menuchoice eq "" ) { |
142 |
+ |
$rv=undef; |
143 |
+ |
} |
144 |
|
else { |
145 |
|
$rv=$options[$menuchoice-1]; |
146 |
|
print( $rv." selected\n"); |
161 |
|
$num++; |
162 |
|
print $num.". ".$item."\n"; |
163 |
|
} |
164 |
< |
if ( $num == 1 ) { |
165 |
< |
$rv=$self->basic($prompt); |
164 |
> |
if ( $num == 0 ) { |
165 |
> |
return $rv=$self->basic($prompt); |
166 |
|
} |
167 |
+ |
elsif ( $num==1 ) { |
168 |
+ |
$rv=1; |
169 |
+ |
} |
170 |
|
else { |
171 |
|
print "Please Enter a Number from the list above :"; |
172 |
|
while ( (($menuchoice=$self->basic($prompt))!~/^\d+$/) || |