summaryrefslogtreecommitdiffstats
path: root/mdkonline
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2006-03-28 18:12:12 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2006-03-28 18:12:12 +0000
commit0ba969a411872e644f58821c7cefc45e32219a4c (patch)
tree4ca07d8ef780eada389ccf1501d1f4ef76aa274f /mdkonline
parentaa725acfe7a79758be0656a04b50c5af49e802f5 (diff)
downloadmgaonline-0ba969a411872e644f58821c7cefc45e32219a4c.tar
mgaonline-0ba969a411872e644f58821c7cefc45e32219a4c.tar.gz
mgaonline-0ba969a411872e644f58821c7cefc45e32219a4c.tar.bz2
mgaonline-0ba969a411872e644f58821c7cefc45e32219a4c.tar.xz
mgaonline-0ba969a411872e644f58821c7cefc45e32219a4c.zip
switch to proper step history management & error managment (aka bump
popups/error dialogs rather than garbaging steps stack)
Diffstat (limited to 'mdkonline')
-rwxr-xr-xmdkonline94
1 files changed, 47 insertions, 47 deletions
diff --git a/mdkonline b/mdkonline
index 3c68177c..e4985ba3 100755
--- a/mdkonline
+++ b/mdkonline
@@ -43,7 +43,7 @@ my $confdir = '/root/.MdkOnline';
my $conffile = "$confdir/mdkupdate";
my $logfile = '/var/tmp/mdkonline.log';
-my ($greeting, $firstname, $lastname, $login, $account, $password, $npassword, $boxname, $cfmpassword, $email, $is_success, $createaccount, $sendconfres, $country, $ia, $gr, $alias);
+my ($greeting, $firstname, $lastname, $login, $account, $password, $npassword, $boxname, $cfmpassword, $email, $country, $ia, $gr, $alias);
my @info;
@@ -121,32 +121,33 @@ my $wiz =
{ label => N("(Ex: My Home Office's Computer)") },
];
},
- post => sub {
+ complete => sub {
if (!mdkonline::check_valid_boxname($boxname)) {
- $is_success = N("Machine name must be 1 to 40 alphanumerical characters");
- } else {
- my $wait = $in->wait_message(N("Please wait"), N("Connecting to Mandriva Online website...")) if $ia;
- @info = ($login, $password);
- $is_success = mdkonline::create_authenticate_account('authenticate', @info); undef $wait;
+ $in->ask_warn(N("Error"), N("Machine name must be 1 to 40 alphanumerical characters"));
+ return 1;
}
- "authenticate";
+ my $wait = $in->wait_message(N("Please wait"), N("Connecting to Mandriva Online website...")) if $ia;
+ my $err = mdkonline::create_authenticate_account('authenticate', $login, $password);
+ undef $wait;
+ if ($err ne 'OK') {
+ $in->ask_warn(N("Error"), $err);
+ return 1;
+ }
},
+ next => 'authenticate',
},
authenticate => {
- name => sub {
- if ($is_success eq 'OK') {
- N("In order to benefit from Mandriva Online services,\nwe are about to upload your configuration.\n\nThe Wizard will now send the following information to Mandriva:\n1) the list of packages you have installed on your system,\n2) your hardware configuration.\n\nIf you feel uncomfortable by that idea, or do not want to benefit from this service,\nplease press 'Cancel'. By pressing 'Next', you allow us to keep you informed\nabout security updates and useful upgrades via personalized email alerts.\nFurthermore, you benefit from discounted paid support services on\nwww.mandrivaexpert.com.");
- } else {
- $is_success;
- }
+ name =>
+ N("In order to benefit from Mandriva Online services,\nwe are about to upload your configuration.\n\nThe Wizard will now send the following information to Mandriva:\n1) the list of packages you have installed on your system,\n2) your hardware configuration.\n\nIf you feel uncomfortable by that idea, or do not want to benefit from this service,\nplease press 'Cancel'. By pressing 'Next', you allow us to keep you informed\nabout security updates and useful upgrades via personalized email alerts.\nFurthermore, you benefit from discounted paid support services on\nwww.mandrivaexpert.com."),
+ data => [ { } ],
+ complete => sub {
+ my $err = send_conf_via_soap($login, $password, $boxname, $descboxname, $country);
+ if ($err ne 'OK') {
+ $in->ask_warn(N("Error"), N("Connection problem") . "\n\n" . N("Problem occurs when uploading files, please try again") . "\n\n" . $err);
+ return 1;
+ }
},
- no_back => $is_success eq 'OK' ? 1 : 0,
- post => sub {
- if ($is_success eq 'OK') {
- $sendconfres = send_conf_via_soap($login, $password, $boxname, $descboxname, $country);
- "upload";
- } else { "choices" }
- }
+ next => 'upload',
},
noaccount => {
name => N("Create a Mandriva Online Account"),
@@ -160,47 +161,46 @@ my $wiz =
{ label => N("Confirm Password:"), val => \$cfmpassword, hidden => 1 },
];
},
- post => sub {
+ complete => sub {
$gr = find_index { /$gr/ } @greets;
$alias = $firstname . $lastname;
@info = ($account, $npassword, $firstname, $lastname, $lang, $greeting, $alias, 'home');
- $createaccount = $npassword ne $cfmpassword ? N("The passwords do not match\n Please try again\n") : (!$account || !$firstname || !$lastname) ? N("Please fill in each field") : mdkonline::check_valid_email($email) == 0 ? N("Not a valid mail address!\n") : mdkonline::create_authenticate_account('create', @info);
- "createaccount";
- }
+ if ($npassword ne $cfmpassword) {
+ $in->ask_warn(N("Error"), N("The passwords do not match\n Please try again\n"));
+ return 1;
+ }
+ if (!$account || !$firstname || !$lastname) {
+ $in->ask_warn(N("Error"), N("Please fill in each field"));
+ return 1;
+ }
+ if (mdkonline::check_valid_email($email) == 0) {
+ $in->ask_warn(N("Error"), N("Not a valid mail address!\n"));
+ return 1;
+ }
+ if (mdkonline::create_authenticate_account('create', @info) ne 'OK') {
+ $in->ask_warn(N("Error"), N("Creating account failed!"));
+ return 1;
+ }
+
+ },
+ next => 'createaccount',
},
createaccount => {
- name => sub {
- $createaccount eq 'OK' ? "\n\n" . N("Mandriva Online Account successfully created.\nPlease click \"Next\" to authenticate and upload your configuration\n") : $createaccount;
- },
- post => sub {
- $createaccount eq 'OK' ? "account" : "noaccount";
- }
+ name => N("Mandriva Online Account successfully created.\nPlease click \"Next\" to authenticate and upload your configuration\n"),
+ next => 'account',
},
upload => {
- name => sub {
- if ($sendconfres eq 'OK') {
- "\n\n" . N("Your upload was successful!") . "\n\n" . N("From now you will receive on security and updates \nannouncements thanks to Mandriva Online.") . "\n\n" . N("Mandriva Online offers you the ability to automate the updates.\nA program will run regulary in your system waiting for new updates\n");
- } else {
- N("Connection problem") . "\n" . N("Problem occurs when uploading files, please try again")
- . "\n\n" . $sendconfres;
- }
- },
+ name => N("Your upload was successful!") . "\n\n" . N("From now you will receive on security and updates \nannouncements thanks to Mandriva Online.") . "\n\n" . N("Mandriva Online offers you the ability to automate the updates.\nA program will run regulary in your system waiting for new updates\n"),
data => sub {
- if ($sendconfres eq 'OK') {
[
{ label => N("Country"), val => \$country, type => "combo", list => [ sort keys %countries ], not_edit => 0 }
];
- }
},
post => sub {
- if ($sendconfres eq 'OK') {
mdkonline::automated_upgrades();
#mdkonline::clean_confdir();
"end";
- } else {
- "authenticate";
}
- },
},
end => {
name => sub {
@@ -214,9 +214,9 @@ my $wiz =
};
if (!$ia && $login && $password && $boxname) {
- $is_success = mdkonline::create_authenticate_account('authenticate', $login, $password);
+ my $is_success = mdkonline::create_authenticate_account('authenticate', $login, $password);
if ($is_success eq 'OK') {
- $sendconfres = send_conf_via_soap($login, $password, $boxname, $descboxname, $country);
+ my $sendconfres = send_conf_via_soap($login, $password, $boxname, $descboxname, $country);
if ($sendconfres eq 'OK') {
mdkonline::automated_upgrades();
output_p($logfile, N("Configuration uploaded successfully"));