diff options
author | Renaud Chaillat <rchaillat@mandriva.com> | 2001-09-06 15:15:44 +0000 |
---|---|---|
committer | Renaud Chaillat <rchaillat@mandriva.com> | 2001-09-06 15:15:44 +0000 |
commit | d5e42cf6ea863851b1917063957681a0f4f10ab4 (patch) | |
tree | 0e5d7954666241671e7f1add665d5dcb8ff49587 | |
parent | 965943974c5e04ed2e65e89ab3e0e0b5280dbf24 (diff) | |
download | mgaonline-d5e42cf6ea863851b1917063957681a0f4f10ab4.tar mgaonline-d5e42cf6ea863851b1917063957681a0f4f10ab4.tar.gz mgaonline-d5e42cf6ea863851b1917063957681a0f4f10ab4.tar.bz2 mgaonline-d5e42cf6ea863851b1917063957681a0f4f10ab4.tar.xz mgaonline-d5e42cf6ea863851b1917063957681a0f4f10ab4.zip |
added step number in buttons, and encode binary file in base64 to prevent corruption of the uploaded file
-rwxr-xr-x | mdkonline | 43 |
1 files changed, 31 insertions, 12 deletions
@@ -33,6 +33,7 @@ use Digest::MD5 qw(md5 md5_hex md5_base64); use HTTP::Request; use HTTP::Request::Common; use LWP::UserAgent; +use MIME::Base64 qw(encode_base64); my $in = 'interactive'->vnew('su', 'default'); @@ -84,10 +85,10 @@ $Main_Window->set_usize(540, 430); $Main_Window->realize(); $Main_Window->signal_connect( "delete_event", \>k_main_quit); -my $Button_Next= new Gtk::Button(" " . _("Next >") . " "); +my $Button_Next= new Gtk::Button(" " . _("Next") . " 2/".$nb_pages." > "); my $Button_End= new Gtk::Button(" " . _("Finish") . " "); my $Button_SkipWiz= new Gtk::Button(" " ._("Quit") . " "); -my $Button_Prev= new Gtk::Button(" " . _("< Back") . " "); +my $Button_Prev= new Gtk::Button(" < " . _("Back") . " "); my $notebook_global = new Gtk::Notebook; $Button_End->show(); $notebook_global->set_show_border($false); @@ -158,6 +159,10 @@ sub on_next_clicked { $hbox->pack_end($Button_End, 0, 1, 0); $hbox->pack_end($Button_Prev, 0, 1, 0); } + + # Update the buttons labels + $Button_Next->child->set(" "._("Next")." ".($page+2)."/".$nb_pages." > "); + $Button_Prev->child->set(" < ".$page."/".$nb_pages." "._("Back")." "); } sub on_prev_clicked { @@ -186,6 +191,14 @@ sub on_prev_clicked { foreach (@no_back_button_pages) { /$page/ and $Button_Prev->set_sensitive(0), last; } + + # Update the buttons labels + $Button_Next->child->set(_("Next")." ".($page+2)."/".$nb_pages." > "); + if ($page-1 >0) { + $Button_Prev->child->set(" < ".$page."/".$nb_pages." "._("Back")." "); + } else { + $Button_Prev->child->set(" < "._("Back")." "); + } } sub subscribe_mdkonline() { @@ -210,7 +223,7 @@ sub test_passwd () { $login = $login_user->get_text(); $passwd = $passwd_user->get_text(); - if ($login !~ /\s+/ && $passwd !~ /\s+/) { + if ($login && $passwd && $login !~ /\s+/ && $passwd !~ /\s+/) { # OLD METHOD, keep it for next version ?... # my $ssh_script = ""; @@ -262,7 +275,18 @@ sub send_config { my $result = -1; `/usr/sbin/drakbug_report > /root/$login-drakbug_report.log`; -# `/usr/bin/bzip2 \\\-9 \\\-f /root/$login-drakbug_report.log`; + `/usr/bin/bzip2 \\\-9 \\\-f /root/$login-drakbug_report.log`; + + # Turn the binary file into a uuencoded ascii file + open (FILE, " /root/$login-drakbug_report.log.bz2") or die "$!"; + my ($chunk, $buffer); + while (read(FILE, $chunk, 60*57)) { + $buffer .= $chunk; + } + close (FILE); + open (FILEOUT, "> /root/$login-drakbug_report.log.bz2.uue") or die "$!"; + print FILEOUT encode_base64($buffer); + close (FILEOUT); # OLD METHOD (scp) # my $scp_script = ""; @@ -276,16 +300,11 @@ sub send_config { # NEW METHOD (http) my $ua = LWP::UserAgent->new; $ua->agent("MdkOnlineAgent/0.15" . $ua->agent); - my $response = $ua->request(POST 'http://devweb.mandrakesoft.com/online/dev/test/test-up-wizard.php', + my $response = $ua->request(POST 'http://devweb.mandrakesoft.com/dev/test/test-up-wizard.php', Content_Type => 'form-data', - Content => [name => "mark", - submit => "test_upload", - wizard => ["/root/$login-drakbug_report.log", - "test_upload_file" - ] + Content => [submit => "test_upload", + wizard => ["/root/$login-drakbug_report.log.bz2.uue"] ]); -# undef, -# Content_Type => 'application/x-bzip2 # Check the outcome of the response print "REPONSE: ".$response->content."\n"; |