diff options
author | Arnaud Desmons <adesmons@mandriva.com> | 2002-07-26 09:41:01 +0000 |
---|---|---|
committer | Arnaud Desmons <adesmons@mandriva.com> | 2002-07-26 09:41:01 +0000 |
commit | 4a44379795c9db5e7cbc4f9688c36e9e7814e765 (patch) | |
tree | 6d216c3e6975153ca647b624087ea469704c99f6 | |
parent | 9d4ad4b20182d19157518e5032476ecd8314feb8 (diff) | |
download | drakwizard-4a44379795c9db5e7cbc4f9688c36e9e7814e765.tar drakwizard-4a44379795c9db5e7cbc4f9688c36e9e7814e765.tar.gz drakwizard-4a44379795c9db5e7cbc4f9688c36e9e7814e765.tar.bz2 drakwizard-4a44379795c9db5e7cbc4f9688c36e9e7814e765.tar.xz drakwizard-4a44379795c9db5e7cbc4f9688c36e9e7814e765.zip |
replaced by drakwizard.pl
-rw-r--r-- | server_wizard.pl | 169 |
1 files changed, 0 insertions, 169 deletions
diff --git a/server_wizard.pl b/server_wizard.pl deleted file mode 100644 index 8ca83e86..00000000 --- a/server_wizard.pl +++ /dev/null @@ -1,169 +0,0 @@ -#!/usr/bin/perl - -# Wizdrake - -# Copyright (C) 2002 MandrakeSoft Mael Dodin (mdodin@mandrakesoft.com) -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -use lib qw(/usr/lib/libDrakX); -use strict; -use vars qw($wizard_title $lib_script %variable $in); - -use XML::Parser; - -use standalone; -use interactive; - -sub translate { $_[0] } - -sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 } - -sub get_parameter { - my ($o, $tree, $tag ,$page) = @_; - foreach my $leaf (@$tree) { - if (ref($leaf) eq 'ARRAY') { - $page = get_parameter($o, $leaf, $tag, $page); - } elsif (ref($leaf) eq 'HASH') { - my $common_freetext_chooser; - my %actions = (Wizard => sub { - ($wizard_title, $lib_script) = @{$leaf}{qw(wizardTitle libScript)}; - }, - Variable => sub { - $variable{$leaf->{name}} = $leaf->{shellVariable}; - $ENV{$leaf->{shellVariable}} = $leaf->{defaultValue}; - }, - Page => sub { - my $old_page = $page; - push @$o, $page = { %$leaf }; - $old_page->{next_page} = $page; - }, - Target => sub { - $page->{Target}->{jumpIndex}->{$leaf->{jumpIndex}} = $leaf->{targetName}; - }, - Info => sub { - $page->{info} = $leaf->{helpText} ? "$page->{info} $leaf->{helpText}" : "$page->{info}\n"; - }, - Freetext => $common_freetext_chooser = sub { - push @{$page->{freetext}}, { %$leaf, main_order => ($tag eq 'Chooser') ? 'combo' - : (($tag eq 'Boolean') ? 'bool' : 'entry') }; - }, - 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; -} - - -sub find_page { - my ($o, $name) = @_; - $_->{name} eq $name and return $_ foreach @$o; -} - -sub display { - my ($o, $page) = @_; - if ( $page->{nextFinish} eq 'true') { - $::Wizard_no_previous = 1; - $in->ask_okcancel(translate($page->{name}), - translate($page->{info}), 1) or quit_global($in, 0); - $in->exit; - } elsif (!$page->{freetext}) { - $in->ask_okcancel(translate($page->{name}), - translate($page->{info}), 1) or navigation($o, $page->{old_page}); - } else { - my $valeur; - my @liste; - my @data = map { - for ($_->{fillScript}) { - system("source $lib_script ; $_"); - } - if($_->{main_order} eq 'combo'){ - if($_->{fillScript}){ - $valeur = `$_->{fillScript}`; - while( $valeur =~ /(.+)\n/g ){ - push @liste, $1; - } - }else{ - @liste = @{$_->{Option}}; - } - } - ($_->{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) } - : { 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}}){ - if($_->{main_order} eq 'bool'){ - $ENV{$variable{$_->{variableName}}} = $ENV{$variable{$_->{variableName}}} ? 1 : 0; - } - } - - } - } - undef $::Wizard_no_previous; -} - -sub navigation { - my ($o, $page, $previous_page) = @_; - $page->{old_page} ||= $previous_page; - display($o, $page); - if ($page->{jumpPage}) { - navigation($o, find_page($o, $page->{jumpPage}), $page->{old_page}); - } else { - my ($next, $prev) = do { - if($page->{jumpScript}) { - system("source $lib_script ; $page->{jumpScript}"); - if ($page->{Target}->{jumpIndex}) { - if(!$page->{Target}->{jumpIndex}->{0}){ - $? = $? ==0|2560 ? 10 : $?-255; - } - find_page($o, $page->{Target}->{jumpIndex}->{$?}), $page; - } else { - $page->{next_page}, $page->{old_page}; - } - } else { - $page->{next_page}, $page; - } - }; - navigation($o, $next, $prev); - } -} - -my $o = []; - -get_parameter($o, XML::Parser->new(Style => 'Tree')->parsefile($ARGV[0])); - -$in = 'interactive'->vnew; - -!$::isEmbedded && $in->isa('interactive_gtk') and $::isWizard=1; -$::Wizard_title = translate($wizard_title); -$::Wizard_pix_up = "wiz_draknet.png"; -$::direct = /-direct/; -$::Wizard_no_previous = 1; - -navigation($o, $o->[0]); |