X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=fs_signup%2FFS-SignupClient%2Fcgi%2Fsignup.cgi;h=573cf5d65eb8cacef5ca579fa162f9cfd1423503;hp=0da9605796ea7de102d455acd0ca36d6c8b9ab7d;hb=0df810cde18282c08271a87c50568dd75b61a578;hpb=294b8c0914f497b7714bad51dfb000d33e843995 diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 0da960579..573cf5d65 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.11 2001-08-30 16:23:32 ivan Exp $ +# $Id: signup.cgi,v 1.14 2001-09-27 21:32:36 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $error @@ -73,7 +73,7 @@ if ( -e $signup_html ) { } if ( -e $success_html ) { - my $success_txt = Text::Template::_load_text($signup_html) + my $success_txt = Text::Template::_load_text($success_html) or die $Text::Template::ERROR; $success_txt =~ /^(.*)$/s; #untaint the template source - it's trusted $success_txt = $1; @@ -115,7 +115,7 @@ if ( defined $cgi->param('magic') ) { $invoicing_list = 'POST'; } - ( $error = new_customer ( { + $error = new_customer ( { 'last' => $last = $cgi->param('last'), 'first' => $first = $cgi->param('first'), 'ss' => $ss = $cgi->param('ss'), @@ -140,9 +140,12 @@ if ( defined $cgi->param('magic') ) { 'username' => $username = $cgi->param('username'), '_password' => $password = $cgi->param('_password'), 'popnum' => $popnum = $cgi->param('popnum'), - } ) ) - ? print_form() - : print_okay(); + } ); + if ( $error ) { + print_form(); + } else { + print_okay(); + } } else { die "unrecognized magic: ". $cgi->param('magic'); } @@ -240,6 +243,61 @@ sub pop_info { ''; } +#horrible false laziness with FS/FS/svc_acct_pop.pm::popselector +sub popselector { + my( $popnum, $state ) = @_; + + my %pop = (); + push @{ $pop{$_->{state}} }, $_ foreach @$pops; + + my $text = < + function opt(what,href,text) { + var optionName = new Option(text, href, false, false) + var length = what.length; + what.options[length] = optionName; + } + + function popstate_changed(what) { + state = what.options[what.selectedIndex].text; + for (var i = what.form.popnum.length;i > 0;i--) + what.form.popnum.options[i] = null; + what.form.popnum.options[0] = new Option("", "", false, true); +END + + foreach my $popstate ( sort { $a cmp $b } keys %pop ) { + $text .= "\nif ( state == \"$popstate\" ) {\n"; + + foreach my $pop ( @{$pop{$popstate}}) { + my $o_popnum = $pop->{popnum}; + my $poptext = $pop->{city}. ', '. $pop->{state}. + ' ('. $pop->{ac}. ')/'. $pop->{exch}; + + $text .= "opt(what.form.popnum, \"$o_popnum\", \"$poptext\");\n" + } + $text .= "}\n"; + } + + $text .= "}\n\n"; + + $text .= + qq!'; #callback? return 3 html pieces? #''; + + $text .= qq!'; + + $text; +} + sub expselect { my $prefix = shift; my $date = shift || ''; @@ -409,19 +467,8 @@ Contact Information (blank to generate) - POP - + Access number + <%= popselector($popnum) %>