summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-08-19 12:17:41 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-08-19 12:17:41 +0000
commit4959b2762ffa80445cf7b1554e6528d0421db7dd (patch)
treea6a4d5823e7b7ee4bd0a35b55d7d1a4e101f6636
parenta50117d7ccbd73a45f26976c5095e9fdc961520d (diff)
downloaddrakwizard-4959b2762ffa80445cf7b1554e6528d0421db7dd.tar
drakwizard-4959b2762ffa80445cf7b1554e6528d0421db7dd.tar.gz
drakwizard-4959b2762ffa80445cf7b1554e6528d0421db7dd.tar.bz2
drakwizard-4959b2762ffa80445cf7b1554e6528d0421db7dd.tar.xz
drakwizard-4959b2762ffa80445cf7b1554e6528d0421db7dd.zip
added entry menu
-rwxr-xr-xdrakwizard.pl63
1 files changed, 42 insertions, 21 deletions
diff --git a/drakwizard.pl b/drakwizard.pl
index 7a19d16d..bbd54c8d 100755
--- a/drakwizard.pl
+++ b/drakwizard.pl
@@ -35,6 +35,41 @@ use Locale::gettext();
setlocale(LC_ALL, "");
Locale::gettext::textdomain("drakwizard");
+my $in = 'interactive'->vnew('su', 'default');
+$::Wizard_title = translate($wizard_title);
+$::Wizard_pix_up = "wiz_drakconnect.png";
+$::direct = /-direct/;
+$::Wizard_no_previous = 1;
+$::Wizard_title = "Drakwizard";
+$::isWizard = 1;
+my $standalone = 1;
+
+if (!defined($ARGV[0])) {
+ my $prefix = "/usr/share/wizards/";
+ my %l = (
+ $prefix."web_wizard/web.wiz" => _("Apache"),
+ $prefix."ftp_wizard/ftp.wiz" => _("Proftpd"),
+ $prefix."samba_wizard/samba.wiz" => _("Samba"),
+ $prefix."dns_wizard/dns.wiz" => _("Dns"),
+ $prefix."proxy_wizard/proxy.wiz" => _("Squid"),
+ $prefix."time_wizard/time.wiz" => _("Time"),
+ $prefix."dhcp_wizard/dhcp.wiz" => _("Dhcp"),
+ $prefix."postfix_wizard/postfix.wiz" => _("Postfix"),
+ $prefix."news_wizard/news.wiz" => _("News"),
+ );
+ $in->ask_from(
+ _("Drakwizard wizard selection"),
+ _("Please select a wizard"),
+ [{ val => \$ARGV[0], list => [ sort keys %l ], format => sub { $l{$_} }}]
+ );
+}
+my $o = [];
+$xmltree = XML::Parser->new(Style => 'Tree')->parsefile($ARGV[0]);
+
+get_parameter($o, $xmltree);
+navigation($o, $o->[0]);
+$in->exit;
+
sub translate {
my ($format, @params) = @_;
@@ -42,8 +77,6 @@ sub translate {
sprintf(Locale::gettext::gettext($format), @params);
}
-defined($ARGV[0]) or die "Usage: drakwizard /usr/share/wizards/*/*.wiz\n";
-my $in = 'interactive'->vnew('su', 'default');
sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 }
@@ -89,8 +122,8 @@ sub get_parameter {
# This is to avoid monospaced text to be interpolated
$leaf->{helpText} = translate($leaf->{helpText});
if ($leaf->{fontName} eq "Monospaced") {
- chomp($leaf->{helpText});
- $leaf->{helpText} = "\n".$leaf->{helpText};
+ chomp($leaf->{helpText});
+ $leaf->{helpText} = "\n".$leaf->{helpText};
}
$page->{info} = $leaf->{helpText} ? "$page->{info} $leaf->{helpText}" : "$page->{info}\n";
if ($leaf->{fillScript}) {
@@ -138,6 +171,7 @@ sub display {
}
if ($page->{finish}) {
$::Wizard_finished = 1;
+ $::Wizard_no_cancel = 1;
}
if ($page->{nextFinish} eq 'true') {
$::Wizard_no_previous = 1;
@@ -172,8 +206,8 @@ sub display {
: ($_->{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}}},
+ label => $_->{helpText} }
+ : { label => $_->{helpText}, val => \$ENV{$variable{$_->{variableName}}},
list => [@liste, ""], type => $_->{main_order} };
} @{$page->{freetext}};
@@ -202,7 +236,7 @@ sub navigation {
@func_arg = split(/\s/, $page->{func});
$modStatus = $::{$perl_module_name."::"}{"$func_arg[0]"}->();
if ($page->{Target}->{jumpIndex}) {
- find_page($o, $page->{Target}->{jumpIndex}->{int($modStatus)}), $page;
+ find_page($o, $page->{Target}->{jumpIndex}->{int($modStatus)}), $page;
}
else {
$page->{next_page}, $page->{old_page};
@@ -228,7 +262,7 @@ sub navigation {
$o->[0], $page, undef;
}
elsif ($page->{jumpPage}) {
- find_page($o, $page->{jumpPage}), $page->{old_page};
+ find_page($o, $page->{jumpPage}), $page;
}
else {
$page->{next_page}, $page;
@@ -237,16 +271,3 @@ sub navigation {
navigation($o, $next, $prev);
}
-my $o = [];
-$xmltree = XML::Parser->new(Style => 'Tree')->parsefile($ARGV[0]);
-
-get_parameter($o, $xmltree);
-
-!$::isEmbedded && $in->isa('interactive_gtk') and $::isWizard=1;
-$::Wizard_title = translate($wizard_title);
-$::Wizard_pix_up = "wiz_drakconnect.png";
-$::direct = /-direct/;
-$::Wizard_no_previous = 1;
-$::isWizard = 1;
-navigation($o, $o->[0]);
-$in->exit;