diff options
author | ivan <ivan> | 2011-08-10 05:22:32 +0000 |
---|---|---|
committer | ivan <ivan> | 2011-08-10 05:22:32 +0000 |
commit | 424ae31847c4fd44e6ed55ec275c8e668c7d2b51 (patch) | |
tree | 96455a553e39b85eda278a78f29d0042da26e7c5 /httemplate/elements | |
parent | 9694a17150af02e8fa3e61f732b776c5f7389874 (diff) |
multiple DID provisioning, RT#13721
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/select-areacode.html | 4 | ||||
-rw-r--r-- | httemplate/elements/select-did.html | 30 | ||||
-rw-r--r-- | httemplate/elements/select-exchange.html | 4 | ||||
-rw-r--r-- | httemplate/elements/select-phonenum.html | 17 | ||||
-rw-r--r-- | httemplate/elements/select-state.html | 15 |
5 files changed, 47 insertions, 23 deletions
diff --git a/httemplate/elements/select-areacode.html b/httemplate/elements/select-areacode.html index 453205c02..a302befc2 100644 --- a/httemplate/elements/select-areacode.html +++ b/httemplate/elements/select-areacode.html @@ -38,7 +38,9 @@ // blank the current phonenum too for ( var i = what.form.<% $opt{'prefix'} %>phonenum.length; i >= 0; i-- ) what.form.<% $opt{'prefix'} %>phonenum.options[i] = null; - opt(what.form.<% $opt{'prefix'} %>phonenum, '', 'Select phone number'); + if ( what.form.<% $opt{'prefix'} %>phonenum.type != 'select-multiple' ) { + opt(what.form.<% $opt{'prefix'} %>phonenum, '', 'Select phone number'); + } % if ($opt{empty}) { opt(what.form.<% $opt{'prefix'} %>areacode, '', '<% $opt{empty} %>'); diff --git a/httemplate/elements/select-did.html b/httemplate/elements/select-did.html index 8e981fde1..a69450c2a 100644 --- a/httemplate/elements/select-did.html +++ b/httemplate/elements/select-did.html @@ -18,47 +18,46 @@ Example: <TABLE> <TR> - <TD> + <TD VALIGN="top"> <% include('/elements/select-state.html', 'prefix' => 'phonenum_', #$field.'_', 'country' => $country, + 'svcpart' => $svcpart, 'disable_empty' => 0, 'empty_label' => 'Select state', ) %> + <BR><FONT SIZE="-1">State</FONT> </TD> - <TD> + <TD VALIGN="top"> <% include('/elements/select-areacode.html', 'state_prefix' => 'phonenum_', #$field.'_', 'svcpart' => $svcpart, 'empty' => 'Select area code', ) %> + <BR><FONT SIZE="-1">Area code</FONT> </TD> - <TD> + <TD VALIGN="top"> <% include('/elements/select-exchange.html', 'svcpart' => $svcpart, 'empty' => 'Select exchange', ) %> + <BR><FONT SIZE="-1">City / Exchange</FONT> </TD> - <TD> + <TD VALIGN="top"> <% include('/elements/select-phonenum.html', - 'svcpart' => $svcpart, - 'empty' => 'Select phone number', - 'bulknum' => $bulknum, + 'svcpart' => $svcpart, + 'empty' => 'Select phone number', + 'bulknum' => $bulknum, + 'multiple' => $multiple, ) %> + <BR><FONT SIZE="-1">Phone number</FONT> </TD> </TR> - <TR> - <TD><FONT SIZE="-1">State</FONT></TD> - <TD><FONT SIZE="-1">Area code</FONT></TD> - <TD><FONT SIZE="-1">City / Exchange</FONT></TD> - <TD><FONT SIZE="-1">Phone number</FONT></TD> - </TR> - </TABLE> % } @@ -118,7 +117,8 @@ $export = $exports[0] if scalar(@exports); my $use_selector = scalar(@exports) ? 1 : 0; -my $bulknum = $opt{'bulknum'} || 0; +my $bulknum = $opt{'bulknum'} || 0; #Bulk DID orders via ordering system, vs. +my $multiple = $opt{'multiple'} || 0; #just selecting a bunch at a time my $country = ( $export && $export->option('country') ) || $conf->config('countrydefault') diff --git a/httemplate/elements/select-exchange.html b/httemplate/elements/select-exchange.html index 012e7c6b7..9e4b5ce97 100644 --- a/httemplate/elements/select-exchange.html +++ b/httemplate/elements/select-exchange.html @@ -33,7 +33,9 @@ // blank the current phonenum too for ( var i = what.form.<% $opt{'prefix'} %>phonenum.length; i >= 0; i-- ) what.form.<% $opt{'prefix'} %>phonenum.options[i] = null; - opt(what.form.<% $opt{'prefix'} %>phonenum, '', 'Select phone number'); + if ( what.form.<% $opt{'prefix'} %>phonenum.type != 'select-multiple' ) { + opt(what.form.<% $opt{'prefix'} %>phonenum, '', 'Select phone number'); + } % if ($opt{empty}) { opt(what.form.<% $opt{'prefix'} %>exchange, '', '<% $opt{empty} %>'); diff --git a/httemplate/elements/select-phonenum.html b/httemplate/elements/select-phonenum.html index 25a885a39..d555bf4b6 100644 --- a/httemplate/elements/select-phonenum.html +++ b/httemplate/elements/select-phonenum.html @@ -30,7 +30,9 @@ what.form.<% $opt{'prefix'} %>phonenum.options[i] = null; % if ($opt{empty}) { - opt(what.form.<% $opt{'prefix'} %>phonenum, '', '<% $opt{empty} %>'); + if ( what.form.<% $opt{'prefix'} %>phonenum.type != 'select-multiple' ){ + opt(what.form.<% $opt{'prefix'} %>phonenum, '', '<% $opt{empty} %>'); + } % } // add the new phonenums @@ -127,10 +129,15 @@ <DIV ID="phonenumerror" STYLE="display:none"><IMG SRC="<%$fsurl%>images/cross.png"> <B>Select a different city/exchange</B></DIV> % } -<SELECT ID="<% $opt{'prefix'} %>phonenum" NAME="<% $opt{'prefix'} %>phonenum" - notonChange="<% $opt{'prefix'} %>phonenum_changed(this); <% $opt{'onchange'} %>" - <% $opt{'disabled'} %>> - <OPTION VALUE="">Select phone number</OPTION> +<SELECT <% $opt{multiple} ? 'MULTIPLE SIZE=25' : '' %> + ID = "<% $opt{'prefix'} %>phonenum" + NAME = "<% $opt{'prefix'} %>phonenum" + <% $opt{'disabled'} %> +%# notonChange="<% $opt{'prefix'} %>phonenum_changed(this); <% $opt{'onchange'} %>" +> +% unless ( $opt{multiple} ) { + <OPTION VALUE="">Select phone number</OPTION> +% } </SELECT> <%init> diff --git a/httemplate/elements/select-state.html b/httemplate/elements/select-state.html index 2d60fde0f..785b2ec24 100644 --- a/httemplate/elements/select-state.html +++ b/httemplate/elements/select-state.html @@ -42,7 +42,9 @@ Example: <%init> my %opt = @_; -foreach my $opt (qw( state country prefix onchange disabled empty_label )) { +foreach my $opt (qw( + state country prefix onchange disabled empty_label svcpart +)) { $opt{$opt} = '' unless exists($opt{$opt}) && defined($opt{$opt}); } @@ -62,5 +64,16 @@ my $style = tie my %states, 'Tie::IxHash', states_hash( $opt{'country'} ); +if ( $opt{'svcpart'} ) { + + my $sth = dbh->prepare( + 'SELECT DISTINCT state FROM phone_avail WHERE svcnum IS NULL' + ) or die dbh->errstr; + $sth->execute or die $sth->errstr; + my %avail_states = map { $_->[0] => 1 } @{ $sth->fetchall_arrayref }; + + delete $states{$_} foreach grep ! $avail_states{$_}, keys %states; +} + </%init> |