diff options
author | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-05 13:16:51 +0000 |
---|---|---|
committer | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-05 13:16:51 +0000 |
commit | 28c00aeb56fc149c57e9c0cafc426eccdf033efb (patch) | |
tree | 25dd49ddcf6b4f776f7502fc1f7c30a508ffd7ab /drakwizard.pl | |
parent | 307ebd80da743e1eb29e5ab73182e8a35b801e68 (diff) | |
download | drakwizard-28c00aeb56fc149c57e9c0cafc426eccdf033efb.tar drakwizard-28c00aeb56fc149c57e9c0cafc426eccdf033efb.tar.gz drakwizard-28c00aeb56fc149c57e9c0cafc426eccdf033efb.tar.bz2 drakwizard-28c00aeb56fc149c57e9c0cafc426eccdf033efb.tar.xz drakwizard-28c00aeb56fc149c57e9c0cafc426eccdf033efb.zip |
print enabled or disabled instead of 1 or 0
Diffstat (limited to 'drakwizard.pl')
-rwxr-xr-x | drakwizard.pl | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/drakwizard.pl b/drakwizard.pl index e9731338..5ed9d576 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); +use vars qw($wizard_title $lib_script $perl_module %variable $in $welcome $rpm $bifield); use XML::Parser; use standalone; @@ -47,14 +47,12 @@ sub get_parameter { Wizard => sub { ($wizard_title, $lib_script, $perl_module, $rpm) = @{$leaf}{qw(wizardTitle libScript perlModule rpm)}; if ($perl_module) { + ($::perl_module_name) = ($perl_module =~ /.*\/(.*)\.pm/); require $perl_module; } - if ($perl_module =~ /.*\/(.*)\.pm/) { - $::perl_module_name = $1; - } if ($rpm) { if (!$in->do_pkgs->is_installed($rpm)) { - $in->ask_okcancel("error", "$rpm is not installed\nClick ok to add it or cancel to exit") and + $in->ask_okcancel("error", "$rpm is not installed\nClick \"Ok\" to install or \"Cancel\" to quit") and $in->do_pkgs->install($rpm) or $in->exit; } @@ -75,6 +73,7 @@ sub get_parameter { }, Info => sub { $page->{info} = $leaf->{helpText} ? "$page->{info} $leaf->{helpText}" : "$page->{info}\n"; + $page->{info} =~ s/\\\'/\'/g; $page->{info} =~ s/\\q/\"/g; $page->{info} =~ s/\\a/\&/g; }, @@ -86,16 +85,14 @@ sub get_parameter { : 'field')}; }, Chooser => \&$common_freetext_chooser, - Boolean => \&$common_freetext_chooser, - Option => sub { push @{${$page->{freetext}}[-1]->{Option}}, $leaf->{value}.$leaf->{description};} ); $actions{$tag} and &{$actions{$tag}}; }elsif($leaf=~ /\w\D/){ $tag = $leaf; } } - return $page; + $page; } @@ -130,9 +127,9 @@ sub display { if ($_->{main_order} eq 'combo') { if($_->{fillScript}){ $valeur = `$_->{fillScript}`; - while( $valeur =~ /(.+)\n/g){ - push @liste, $1; - } + while( $valeur =~ /(.+)\n/g){ + push @liste, $1; + } } else{ @liste = @{$_->{Option}}; push @list, $1; @@ -142,20 +139,22 @@ sub display { 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 => $ENV{$variable{$_->{variableName}}}, - label => translate($_->{helpText}) } + : ($_->{main_order} eq 'field') ? { val => defined $bitfield{$variable{$_->{variableName}}} ? + $bitfield{$variable{$_->{variableName}}} : + $ENV{$variable{$_->{variableName}}}, + label => translate($_->{helpText}) } : { label => translate($_->{helpText}), val => \$ENV{$variable{$_->{variableName}}}, list => [@liste, ""], type => $_->{main_order} }; } @{$page->{freetext}}; if($page->{executionLevel} eq 'NORMAL'){ $in->ask_from(translate($page->{name}), translate($page->{info}), \@data) or navigation($o, $page->{old_page}); - foreach(@{$page->{freetext}}) { - print "$_->{variableName} : $ENV{$variable{$_->{variableName}}}\n"; - if($_->{main_order} eq 'bool'){ - $ENV{$variable{$_->{variableName}}} = $ENV{$variable{$_->{variableName}}} ? 1 : 0; - } - } + foreach(@{$page->{freetext}}) { + if($_->{main_order} eq 'bool'){ + $ENV{$variable{$_->{variableName}}} = $ENV{$variable{$_->{variableName}}} ? 1 : 0; + $bitfield{$variable{$_->{variableName}}} = $ENV{$variable{$_->{variableName}}} ? "enabled" : "disabled"; + } + } } } undef $::Wizard_no_previous; @@ -192,7 +191,7 @@ sub navigation { my $sub_xmltree = XML::Parser->new(Style => 'Tree')->parsefile($page->{subWizard}); get_parameter($sub_o, $sub_xmltree); eval { navigation($sub_o, $sub_o->[0]); }; - $in->exit if $@ =~ /wizcancel/; + $in->exit if $@ =~ /^wizcancel/; $o->[0], undef; } else { |