diff options
author | ivan <ivan> | 2001-09-27 21:32:36 +0000 |
---|---|---|
committer | ivan <ivan> | 2001-09-27 21:32:36 +0000 |
commit | 0df810cde18282c08271a87c50568dd75b61a578 (patch) | |
tree | 2365d266316bfd367a8e6bdee8d40cdc75721e11 /fs_signup | |
parent | bc8a035db564658a7d9abdf3e141651c2de8082b (diff) |
popSELECTOR!
Diffstat (limited to 'fs_signup')
-rwxr-xr-x | fs_signup/FS-SignupClient/cgi/signup.cgi | 72 | ||||
-rwxr-xr-x | fs_signup/FS-SignupClient/cgi/signup.html | 15 |
2 files changed, 60 insertions, 27 deletions
diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index f0d4620c5..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.13 2001-09-11 11:28:15 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 @@ -243,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 = <<END; + <SCRIPT> + 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</SCRIPT>\n"; + + $text .= + qq!<SELECT NAME="popstate" SIZE=1 onChange="popstate_changed(this)">!. + qq!<OPTION> !; + $text .= "<OPTION>$_" foreach sort { $a cmp $b } keys %pop; + $text .= '</SELECT>'; #callback? return 3 html pieces? #'</TD><TD>'; + + $text .= qq!<SELECT NAME="popnum" SIZE=1><OPTION> !; + foreach my $pop ( @$pops ) { + $text .= qq!<OPTION VALUE="!. $pop->{popnum}. '"'. + ( ( $popnum && $pop->{popnum} == $popnum ) ? ' SELECTED' : '' ). ">". + $pop->{city}. ', '. $pop->{state}. + ' ('. $pop->{ac}. ')/'. $pop->{exch}; + } + $text .= '</SELECT>'; + + $text; +} + sub expselect { my $prefix = shift; my $date = shift || ''; @@ -412,19 +467,8 @@ Contact Information (blank to generate)</TD> </TR> <TR> - <TD ALIGN="right">POP</TD> - <TD><SELECT NAME="popnum" SIZE=1><OPTION> - - <%= - foreach my $pop ( @{$pops} ) { - $OUT .= '<OPTION VALUE="'. $pop->{'popnum'}. '"'; - $OUT .= ' SELECTED' if $popnum && $pop->{'popnum'} == $popnum; - $OUT .= '>'. $pop->{'popnum'}. ': '. $pop->{'city'}. ', '. - $pop->{'state'}. ' ('. $pop->{'ac'}. ')/'. $pop->{'exch'}. "\n"; - } - %> - - </SELECT></TD> + <TD ALIGN="right">Access number</TD> + <TD><%= popselector($popnum) %></TD> </TR> </TABLE> <BR><BR><INPUT TYPE="submit" VALUE="Signup"> diff --git a/fs_signup/FS-SignupClient/cgi/signup.html b/fs_signup/FS-SignupClient/cgi/signup.html index fcedde3ab..0f4742d20 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.html +++ b/fs_signup/FS-SignupClient/cgi/signup.html @@ -130,19 +130,8 @@ Contact Information (blank to generate)</TD> </TR> <TR> - <TD ALIGN="right">POP</TD> - <TD><SELECT NAME="popnum" SIZE=1><OPTION> - - <%= - foreach my $pop ( @{$pops} ) { - $OUT .= '<OPTION VALUE="'. $pop->{'popnum'}. '"'; - $OUT .= ' SELECTED' if $popnum && $pop->{'popnum'} == $popnum; - $OUT .= '>'. $pop->{'popnum'}. ': '. $pop->{'city'}. ', '. - $pop->{'state'}. ' ('. $pop->{'ac'}. ')/'. $pop->{'exch'}. "\n"; - } - %> - - </SELECT></TD> + <TD ALIGN="right">Access number</TD> + <TD><%= popselector($popnum) %></TD> </TR> </TABLE> <BR><BR><INPUT TYPE="submit" VALUE="Signup"> |