From 785e682e1d25f426aee4f3dc33698cb6a95870cb Mon Sep 17 00:00:00 2001 From: Arnaud Desmons Date: Mon, 5 Aug 2002 15:26:13 +0000 Subject: added Chooser support --- drakwizard.pl | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'drakwizard.pl') diff --git a/drakwizard.pl b/drakwizard.pl index 5ed9d576..49324e4f 100755 --- a/drakwizard.pl +++ b/drakwizard.pl @@ -20,7 +20,7 @@ use lib qw(/usr/lib/libDrakX); #use strict; -use vars qw($wizard_title $lib_script $perl_module %variable $in $welcome $rpm $bifield); +use vars qw($wizard_title $lib_script $perl_module %variable $in $welcome $rpm $bifield $chooser_hash); use XML::Parser; use standalone; @@ -63,7 +63,7 @@ sub get_parameter { $ENV{$leaf->{shellVariable}} = $leaf->{defaultValue}; }, Page => sub { - !$welcome and $welcome = $page; + $welcome ||= $page; my $old_page = $page; push @$o, $page = { %$leaf }; $old_page->{next_page} = $page; @@ -86,7 +86,11 @@ sub get_parameter { }, Chooser => \&$common_freetext_chooser, Boolean => \&$common_freetext_chooser, - Option => sub { push @{${$page->{freetext}}[-1]->{Option}}, $leaf->{value}.$leaf->{description};} ); + Option => sub { + push @{${$page->{freetext}}[-1]->{Option}}, $leaf->{description}; + $chooser_hash{$leaf->{description}} = $leaf->{value}; + } + ); $actions{$tag} and &{$actions{$tag}}; }elsif($leaf=~ /\w\D/){ $tag = $leaf; @@ -120,10 +124,11 @@ sub display { else { my $valeur; my @liste; + my $chooser_var; my @data = map { - for ($_->{fillScript}) { - system("source $lib_script ; $_->{fillScript}"); - } +# for ($_->{fillScript}) { +# system("source $lib_script ; $_->{fillScript}"); +# } if ($_->{main_order} eq 'combo') { if($_->{fillScript}){ $valeur = `$_->{fillScript}`; @@ -131,8 +136,8 @@ sub display { push @liste, $1; } } else{ + $chooser_var = $_->{variableName}; @liste = @{$_->{Option}}; - push @list, $1; } } ($_->{main_order} eq 'entry') ? { label => translate($_->{helpText}), @@ -149,11 +154,12 @@ sub display { if($page->{executionLevel} eq 'NORMAL'){ $in->ask_from(translate($page->{name}), translate($page->{info}), \@data) or navigation($o, $page->{old_page}); - foreach(@{$page->{freetext}}) { + foreach(@{$page->{freetext}}) { if($_->{main_order} eq 'bool'){ $ENV{$variable{$_->{variableName}}} = $ENV{$variable{$_->{variableName}}} ? 1 : 0; $bitfield{$variable{$_->{variableName}}} = $ENV{$variable{$_->{variableName}}} ? "enabled" : "disabled"; } + $ENV{$chooser_var} = $chooser_hash{$ENV{$chooser_var}}; } } } -- cgit v1.2.1