summaryrefslogtreecommitdiffstats
path: root/drakwizard.pl
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-08-29 12:05:47 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-08-29 12:05:47 +0000
commitf02e1d850f93e9ea980dc682500a6811b71dfb21 (patch)
tree10ab86fc67b2d9dd768c3ddde0ae303af4401230 /drakwizard.pl
parentb017184459078152c163b1ea77a58451abb9911b (diff)
downloaddrakwizard-f02e1d850f93e9ea980dc682500a6811b71dfb21.tar
drakwizard-f02e1d850f93e9ea980dc682500a6811b71dfb21.tar.gz
drakwizard-f02e1d850f93e9ea980dc682500a6811b71dfb21.tar.bz2
drakwizard-f02e1d850f93e9ea980dc682500a6811b71dfb21.tar.xz
drakwizard-f02e1d850f93e9ea980dc682500a6811b71dfb21.zip
fixed chooser : keep description value and environnement value in separate places
Diffstat (limited to 'drakwizard.pl')
-rwxr-xr-xdrakwizard.pl52
1 files changed, 27 insertions, 25 deletions
diff --git a/drakwizard.pl b/drakwizard.pl
index ddd7b809..e88e40cf 100755
--- a/drakwizard.pl
+++ b/drakwizard.pl
@@ -20,7 +20,7 @@
use lib qw(/usr/lib/libDrakX);
use strict;
-use vars qw($Wizard_title $Wizard_pix_up $lib_script $perl_module %variable $in $rpm %bitfield %chooser_hash $welcome $perl_module_name $verbose);
+use vars qw($Wizard_title $Wizard_pix_up $lib_script $perl_module %variable $in $rpm %chooser_hash $welcome $perl_module_name $verbose %description);
use XML::Parser;
use standalone;
@@ -148,10 +148,10 @@ sub get_parameter {
},
Freetext => $common_freetext_chooser = sub {
push @{$page->{freetext}}, { %$leaf, main_order =>
- (($tag eq 'Chooser') ? 'combo'
- : ($tag eq 'Boolean') ? 'bool'
- : ($leaf->{editable} eq 'true') ? 'entry'
- : 'field')};
+ (($tag eq 'Chooser') ? 'combo'
+ : ($tag eq 'Boolean') ? 'bool'
+ : ($leaf->{editable} eq 'true') ? 'entry'
+ : 'field')};
$leaf->{fillScript} =~ s/\\q/\"/g;
},
Chooser => \&$common_freetext_chooser,
@@ -159,8 +159,8 @@ sub get_parameter {
Option => sub {
push @{${$page->{freetext}}[-1]->{Option}}, $leaf->{description};
$chooser_hash{$leaf->{description}} = $leaf->{value};
- }
- );
+ $description{$leaf->{value}} = $leaf->{description};
+ });
$actions{$tag} and &{$actions{$tag}};
}elsif($leaf=~ /\w\D/){
$tag = $leaf;
@@ -198,48 +198,51 @@ sub display {
else {
my $valeur;
my @liste;
- my $chooser_var;
my @data = map {
if ($_->{main_order} eq 'combo') {
if($_->{fillScript}){
- $valeur = `$_->{fillScript}`;
+ @liste = ();
+ $valeur = `. $lib_script && $_->{fillScript}`;
while( $valeur =~ /(.+)\n/g){
push @liste, $1;
+ $chooser_hash{$1} = $1;
}
- } else{
- $chooser_var = $_->{variableName};
- @liste = @{$_->{Option}};
+ }
+ else {
+ @liste = @{$_->{Option}};
}
}
if ($_->{main_order} eq 'entry' and $_->{fillScript}) {
$ENV{$variable{$_->{variableName}}} = `. $lib_script && $_->{fillScript}`;
- chomp($ENV{$variable{$_->{variableName}}});
}
elsif (!$ENV{$variable{$_->{variableName}}} && $_->{main_order} eq 'entry' && $_->{fillfunc}) {
$ENV{$variable{$_->{variableName}}} = $::{$perl_module_name."::"}{"$_->{fillfunc}"}->();
- chomp($ENV{$variable{$_->{variableName}}});
}
+ chomp($ENV{$variable{$_->{variableName}}});
($_->{main_order} eq 'entry') ? { label => translate($_->{helpText}),
val => \$ENV{$variable{$_->{variableName}}}, type => $_->{main_order} }
- : ($_->{main_order} eq 'bool') ? { val => \$ENV{$variable{$_->{variableName}}}, type => $_->{main_order},
- text => translate($_->{helpText}, advanced => 1) }
- : ($_->{main_order} eq 'field') ? { val => defined $bitfield{$variable{$_->{variableName}}} ?
- $bitfield{$variable{$_->{variableName}}} :
+ : ($_->{main_order} eq 'bool') ? { val => \$ENV{$variable{$_->{variableName}}}, type => $_->{main_order},
+ text => translate($_->{helpText}, advanced => 1) }
+ : ($_->{main_order} eq 'field') ? { val =>
+ $description{$ENV{$variable{$_->{variableName}}}}?
+ $description{$ENV{$variable{$_->{variableName}}}} :
$ENV{$variable{$_->{variableName}}},
label => $_->{helpText} }
- : { label => $_->{helpText}, val => \$ENV{$variable{$_->{variableName}}},
- list => [@liste, ""], type => $_->{main_order} };
+ : { label => $_->{helpText}, val => \$ENV{$variable{$_->{variableName}}},
+ list => [@liste], type => $_->{main_order} };
} @{$page->{freetext}};
- if($page->{executionLevel} eq 'NORMAL'){
+ if($page->{executionLevel} eq 'NORMAL') {
$in->ask_from(translate($page->{name}), translate($page->{info}),
\@data) or navigation($o, $page->{old_page});
foreach(@{$page->{freetext}}) {
- if($_->{main_order} eq 'bool'){
+ if($_->{main_order} eq 'bool') {
$ENV{$variable{$_->{variableName}}} = $ENV{$variable{$_->{variableName}}} ? 1 : 0;
- $bitfield{$variable{$_->{variableName}}} = $ENV{$variable{$_->{variableName}}} ? __("enabled") : __("disabled");
+ $description{$ENV{$variable{$_->{variableName}}}} = $ENV{$variable{$_->{variableName}}} ? __("enabled") : __("disabled");
+ }
+ elsif ($_->{main_order} eq 'combo') {
+ $ENV{$variable{$_->{variableName}}} = $chooser_hash{$ENV{$variable{$_->{variableName}}}};
}
- $ENV{$chooser_var} = $chooser_hash{$ENV{$chooser_var}};
}
}
}
@@ -290,4 +293,3 @@ sub navigation {
};
navigation($o, $next, $prev);
}
-