diff options
Diffstat (limited to 'drakwizard.pl')
-rwxr-xr-x | drakwizard.pl | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/drakwizard.pl b/drakwizard.pl index f2822fb4..1b438616 100755 --- a/drakwizard.pl +++ b/drakwizard.pl @@ -98,6 +98,14 @@ $in->exit; sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 } +sub xml_text { + $_[0] =~ s/\\\'/\'/g; + $_[0] =~ s/\\q/\"/g; + $_[0] =~ s/\\a/\&/g; + $_[0] =~ s/\\n/\n/g; + $_[0]; +} + sub load_wizard { ($Wizard_title, $lib_script, $perl_module, $rpm, $Wizard_pix_up, $summary_func) = @_; if ($rpm) { @@ -121,7 +129,7 @@ sub load_wizard { sub map_freetext { my @liste; my $valeur; - + my @data = map { if ($_->{main_order} eq 'combo') { if($_->{fillScript}){ @@ -142,18 +150,19 @@ sub map_freetext { elsif (!$ENV{$variable{$_->{variableName}}} && $_->{fillfunc}) { $ENV{$variable{$_->{variableName}}} = $::{$perl_module_name."::"}{"$_->{fillfunc}"}->(); } - chomp($ENV{$variable{$_->{variableName}}}); - $ENV{$_->{variableName}} = $ENV{$variable{$_->{variableName}}}; if ($_->{main_order} eq 'entry') { { label => _($_->{helpText}), val => \$ENV{$variable{$_->{variableName}}}, type => $_->{main_order}, - disabled => $disabled{$_->{variableName}} } + disabled => $disabled{$_->{variableName}}, + help => $_->{help}} } - elsif ($_->{main_order} eq 'bool') { { val => \$ENV{$variable{$_->{variableName}}}, - type => $_->{main_order}, - text => translate($_->{helpText}), - disabled => $disabled{$_->{variableName}} }} - elsif ($_->{main_order} eq 'combo') { + elsif ($_->{main_order} eq 'bool') { + { val => \$ENV{$variable{$_->{variableName}}}, + type => $_->{main_order}, + text => translate($_->{helpText}), + disabled => $disabled{$_->{variableName}}, + help => $_->{help} }} + elsif ($_->{main_order} eq 'combo') { { label => $_->{helptext}, val => \$ENV{$variable{$_->{variableName}}}, list => [@liste], type => $_->{main_order}, disabled => $disabled{$_->{variableName}} }} @@ -161,7 +170,8 @@ sub map_freetext { $description{$ENV{$variable{$_->{variableName}}}}? $description{$ENV{$variable{$_->{variableName}}}} : $ENV{$variable{$_->{variableName}}}, - label => $_->{helpText} } } + label => $_->{helpText}, + help => $_->{help}} } } @{$_[0]}; \@data; } @@ -201,24 +211,19 @@ sub get_parameter { chomp($leaf->{helpText}); $leaf->{helpText} = $leaf->{helpText} ? "$leaf->{helpText}\n$leaf->{helpText}" : "$leaf->{helpText}\n"; } - $page->{info} = $leaf->{helpText} ? "$page->{info}\n$leaf->{helpText}" : "$page->{info}\n"; + $page->{info} = xml_text($leaf->{helpText} ? + "$page->{info}\n$leaf->{helpText}" : "$page->{info}\n"); $page->{info} = c::from_utf8($page->{info}); if ($leaf->{fillScript}) { $page->{info} .= translate(`source $lib_script; $leaf->{fillScript}`); } - # XML compatibility - $page->{info} =~ s/\\\'/\'/g; - $page->{info} =~ s/\\q/\"/g; - $page->{info} =~ s/\\a/\&/g; - $page->{info} =~ s/\\n/\n/g; }, 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')}; - $page->{is_defined}->{$leaf->{variableName}} = 1; + : 'field'), help => $leaf->{help}}; }, Chooser => \&$common_freetext_chooser, Boolean => \&$common_freetext_chooser, @@ -331,7 +336,6 @@ sub robot { if ($page->{is}) { my ($val, $arg) = split(/\s*?=\s*/, $page->{is}); - print "$val:$arg\n"; if ($val eq $widget) { foreach (@{$page->{freetext}}) { $disabled{$_->{variableName}} = $arg ? ($ENV{$variable{$val}} != $arg) : !$ENV{$variable{$val}}; @@ -352,7 +356,6 @@ sub callback { } } } - $disabled{$_[0]} = 0; robot($_[0], $o2->[0]); } @@ -373,11 +376,13 @@ sub get_summary { $disabled{$leaf->{name}} = sub { callback($leaf->{name})}; }, Freetext => $common_freetext_chooser = sub { - push @{$summary->{freetext}}, { %$leaf, main_order => - (($tag eq 'Chooser') ? 'combo' - : ($tag eq 'Boolean') ? 'bool' - : ($leaf->{editable} eq 'true') ? 'entry' - : 'hidden')}; + my $main_order = ($tag eq 'Chooser') ? 'combo' + : ($tag eq 'Boolean') ? 'bool' + : ($leaf->{editable} eq 'true') ? 'entry' + : 'hidden'; + push @{$summary->{freetext}}, + {%$leaf, main_order => $main_order, + help => xml_text($leaf->{help})} if $main_order ne 'hidden'; }, Chooser => \&$common_freetext_chooser, Boolean => \&$common_freetext_chooser, |