summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-10-15 08:52:53 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-10-15 08:52:53 +0000
commitd2270fa4ceda2b0844ba91a68eb7c78d223dce6a (patch)
tree9ab4e524f1d3ed5dd7d3a763a94dc374a15d7126
parent35c4437d9c6f876b416915cccac8c0f7b5cf988b (diff)
downloaddrakwizard-d2270fa4ceda2b0844ba91a68eb7c78d223dce6a.tar
drakwizard-d2270fa4ceda2b0844ba91a68eb7c78d223dce6a.tar.gz
drakwizard-d2270fa4ceda2b0844ba91a68eb7c78d223dce6a.tar.bz2
drakwizard-d2270fa4ceda2b0844ba91a68eb7c78d223dce6a.tar.xz
drakwizard-d2270fa4ceda2b0844ba91a68eb7c78d223dce6a.zip
scrollbar workaround
-rwxr-xr-xdrakwizard.pl68
1 files changed, 46 insertions, 22 deletions
diff --git a/drakwizard.pl b/drakwizard.pl
index c21795cf..bc5a7ce6 100755
--- a/drakwizard.pl
+++ b/drakwizard.pl
@@ -27,6 +27,7 @@ use standalone;
use interactive;
use MDK::Common::Func;
use common;
+use Data::Dumper;
#- I18N.
push @::textdomains, 'drakwizard';
@@ -78,18 +79,23 @@ local $_ = join '', @ARGV;
$::isWizard = 1;
if (/-summary/) {
+ $::isSummary = 1;
get_parameter($o2, $xmltree);
$::Wizard_finished = 1;
get_summary($o2, $xmltree);
is_disabled_summary($_[0], $o2->[0]);
my $data = map_freetext($summary->{freetext});
+ # workaround to get get the scrollbar
+ while ($::isSummary--) {
+ push @$data, '';
+ }
$in->ask_from("summary", "", $data) && $::{$perl_module_name."::"}{"$summary_func"}->();
}
else {
get_parameter($o, $xmltree);
if (!$::verbose) {
no warnings;
- eval { navigation($o, $o->[0]) };
+ navigation($o, $o->[0]);
}
else { navigation($o, $o->[0]) };
}
@@ -141,15 +147,13 @@ sub map_freetext {
$chooser_hash{$1} = $1;
}
}
- if($_->{fillfunc}){
+ if ($_->{fillfunc}){
@liste = $::{$perl_module_name."::"}{"$_->{fillfunc}"}->();
}
else {
@liste = @{$_->{Option}};
}
}
- elsif ($_->{main_order} eq 'bool') {
- }
if ($_->{fillScript}) {
$ENV{$variable{$_->{variableName}}} = `. $lib_script && $_->{fillScript}`;
}
@@ -164,14 +168,31 @@ sub map_freetext {
}
elsif ($_->{main_order} eq 'bool') {
if ($_->{fillfunc}) {
- my @list = $::{$perl_module_name."::"}{"$_->{fillfunc}"}->();
- map {{ val => \$bool{$_},
- label => "",
- type => 'bool',
- text => "$_",
- help => "",
- disabled => $disabled{$toto}
- }} @list;
+ my @checklist = $::{$perl_module_name."::"}{"$_->{fillfunc}"}->();
+ my $i = 21 - scalar @checklist;
+ # workaround to get get the scrollbar
+ if (!$::isSummary) {
+ while ($i--) {
+ push @checklist, '';
+ }
+ }
+ else {
+ while ($i--) {
+ $::isSummary++;
+ }
+ }
+ #
+ map {
+ if (length($_)) {
+ { val => \$bool{$_},
+ label => "",
+ type => 'bool',
+ text => "$_",
+ help => "toto",
+ disabled => $disabled{$toto}
+ }
+ }
+ } @checklist;
}
else {
{ val => \$ENV{$variable{$_->{variableName}}},
@@ -240,14 +261,16 @@ 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'), help => $leaf->{help}};
+ my $main_order = ($tag eq 'Chooser') ? 'combo'
+ : ($tag eq 'Boolean') ? 'bool'
+ : ($leaf->{editable} eq 'true') ? 'entry'
+ : 'field';
+ push @{$page->{freetext}},
+ {%$leaf, main_order => $main_order,
+ help => xml_text($leaf->{help})} if $main_order ne 'hidden';
},
- Chooser => \&$common_freetext_chooser,
- Boolean => \&$common_freetext_chooser,
+ Chooser => \&$common_freetext_chooser,
+ Boolean => \&$common_freetext_chooser,
Option => sub {
push @{${$page->{freetext}}[-1]->{Option}}, $leaf->{description};
$chooser_hash{$leaf->{description}} = $leaf->{value};
@@ -270,6 +293,7 @@ sub find_page {
sub display {
my ($o, $page) = @_;
+ my $data;
if ($page->{no_prev} || $page->{name} eq $welcome->{name}) {
$::Wizard_no_previous = 1;
}
@@ -291,11 +315,11 @@ sub display {
my $valeur;
my @liste;
if ($page->{executionLevel} eq 'NORMAL') {
- my $data = map_freetext($page->{freetext});
+ $data = map_freetext($page->{freetext});
$in->ask_from($page->{name}, translate($page->{info}),
$data) or navigation($o, $page->{old_page});
- foreach(@{$page->{freetext}}) {
- if($_->{main_order} eq 'bool') {
+ foreach (@{$page->{freetext}}) {
+ if ($_->{main_order} eq 'bool') {
$ENV{$variable{$_->{variableName}}} = $ENV{$variable{$_->{variableName}}} ? 1 : 0;
$description{$ENV{$variable{$_->{variableName}}}} = $ENV{$variable{$_->{variableName}}} ? _("enabled") : _("disabled");
}