1 |
#!/usr/bin/perl |
2 |
|
3 |
# Drakwizard |
4 |
|
5 |
# Copyright (C) 2002 Arnaud Desmons <adesmons@mandrakesoft.com> |
6 |
# Copyright (C) 2003 Florent Villard <warly@mandrakesoft.com> |
7 |
# |
8 |
# This program is free software; you can redistribute it and/or modify |
9 |
# it under the terms of the GNU General Public License as published by |
10 |
# the Free Software Foundation; either version 2, or (at your option) |
11 |
# any later version. |
12 |
# |
13 |
# This program is distributed in the hope that it will be useful, |
14 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
# GNU General Public License for more details. |
17 |
# |
18 |
# You should have received a copy of the GNU General Public License |
19 |
# along with this program; if not, write to the Free Software |
20 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 |
|
22 |
package Wiztemplate; |
23 |
use strict; |
24 |
|
25 |
use common; |
26 |
use MDK::Wizard::IFCFG; |
27 |
|
28 |
my $wiz = new Wizcommon; |
29 |
|
30 |
my $o = { |
31 |
name => N("configuration wizard"), |
32 |
var => { |
33 |
ip1 => '', |
34 |
ip2 => '' |
35 |
}, |
36 |
needed_packages => [], |
37 |
defaultimage => $ENV{__WIZ_HOME__}, |
38 |
}; |
39 |
|
40 |
$o->{pages} = { |
41 |
welcome => { |
42 |
name => "\n\n" . "\n\n", |
43 |
no_back => 1, |
44 |
next => 'config' |
45 |
}, |
46 |
confige => { |
47 |
name => "\n\n" . "\n\n", |
48 |
pre => sub { |
49 |
$o->{var}{ip1} ||= f1(); |
50 |
$o->{var}{ip2} ||= f2(); |
51 |
}, |
52 |
post => \&check, |
53 |
data => [ |
54 |
{ label => '', val => \$o->{var}{ip1} }, |
55 |
{ label => '', val => \$o->{var}{ip2} }, |
56 |
], |
57 |
next => 'summary' |
58 |
}, |
59 |
warning => { |
60 |
name => N("Warning.") . "\n\n", |
61 |
next => 'summary' |
62 |
}, |
63 |
error => { |
64 |
name => N("Error.") . "\n\n", |
65 |
next => 'config' |
66 |
}, |
67 |
summary => { |
68 |
name => "\n\n" . "\n\n", |
69 |
data => [ |
70 |
{ label => '', val_ref => \$o->{var}{ip1} }, |
71 |
{ label => '' }, |
72 |
{ label => '', val_ref => \$o->{var}{ip2} }, |
73 |
], |
74 |
post => \&do_it, |
75 |
next => 'end' |
76 |
}, |
77 |
end => { |
78 |
name => N("Congratulations") . "\n\n", |
79 |
end => 1, |
80 |
next => 0 |
81 |
}, |
82 |
}; |
83 |
|
84 |
sub new { |
85 |
my ($class) = @_; |
86 |
bless { |
87 |
o => $o, |
88 |
}, $class; |
89 |
} |
90 |
|
91 |
1; |