diff options
author | Mark Wells <mark@freeside.biz> | 2014-12-23 21:01:03 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2014-12-24 10:58:41 -0800 |
commit | fcb43580b83129097a2abf53104ca29f3185d44b (patch) | |
tree | 5300e33e7b25d7a7c8b41f87dbe081a97b4b8eef /httemplate | |
parent | 403bd5f61004717ecfecf8c5211141939e3b7176 (diff) |
Thinktel VoIP provisioning, #32084
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/edit/elements/export_svc.html | 84 | ||||
-rw-r--r-- | httemplate/edit/elements/part_svc_column.html | 40 | ||||
-rwxr-xr-x | httemplate/edit/part_svc.cgi | 3 | ||||
-rw-r--r-- | httemplate/elements/select-phonenum.html | 31 | ||||
-rw-r--r-- | httemplate/elements/tr-pkg_svc.html | 2 | ||||
-rw-r--r-- | httemplate/misc/phonenums.cgi | 2 |
6 files changed, 128 insertions, 34 deletions
diff --git a/httemplate/edit/elements/export_svc.html b/httemplate/edit/elements/export_svc.html new file mode 100644 index 000000000..5962ae7f8 --- /dev/null +++ b/httemplate/edit/elements/export_svc.html @@ -0,0 +1,84 @@ +<%args> +$part_svc +$svcdb +$clone => undef +</%args> +<%init> + +my $svcpart = $clone || $part_svc->svcpart; # may be undef + +# get a list of applicable part_exports +my @part_export; +my $export_info = FS::part_export::export_info($svcdb); +foreach ( keys %{ $export_info } ) { + push @part_export, qsearch('part_export', { exporttype => $_ }); +} +# and a hash of which ones are already assigned to this part_svc +my %export_svc; +if ( $svcpart ) { + %export_svc = map { $_->exportnum => $_ } + qsearch('export_svc', { svcpart => $svcpart }); +} + +my $count = 0; +my $columns = 3; + +</%init> +<script type="text/javascript"> +function toggle_selectrole() { + var selectrole = document.getElementById( this.name + '_selectrole' ); + if ( selectrole ) { + selectrole.style.visibility = (this.checked) ? '' : 'hidden'; + } +} +<&| /elements/onload.js &> + var boxes = document.getElementsByClassName('checkbox_export'); + for ( var i = 0; i < boxes.length; i++ ) { + boxes[i].onchange = toggle_selectrole; + toggle_selectrole.apply(boxes[i]); + } +</&> +</script> +<& /elements/table.html &> + <TR><TH COLSPAN=<% $columns %>>Exports</TH></TR> + <TR> +% # exports +% foreach my $part_export (@part_export) { +% my $exportnum = $part_export->exportnum; + <TD> + <INPUT CLASS="checkbox_export" + TYPE="checkbox" \ + NAME="exportnum<% $exportnum %>" \ + VALUE=1 \ + <% $export_svc{$exportnum} ? 'CHECKED' : '' %>> + <% $part_export->label_html %> +% if ( $part_export->info->{roles} ) { +% my $role_info = $part_export->info->{roles}; +% my @role_names = keys %$role_info; +% my %role_labels = map { %_ => $role_info->{$_}->{label} } @role_names; +% my $curr_role = $export_svc{$exportnum} ? $export_svc{$exportnum}->role +% : ''; + <SPAN CLASS="selectrole" ID="exportnum<%$exportnum%>_selectrole"> + as: + <& /elements/select.html, + 'field' => "exportnum${exportnum}_role", + 'options' => \@role_names, + 'labels' => \%role_labels, + 'curr_value' => $curr_role, + 'empty_label' => 'select', + &> + </SPAN> +% # XXX should lock out roles that don't apply to the selected svcdb, +% # but that's a pain in the ass +% } + </SELECT> + </SPAN> + </TD> +% $count++; +% if ( $count % $columns == 0 ) { + </TR> + <TR> +% } +% } + </TR> +</TABLE><BR><BR> diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html index 6dcb602fe..53cda859e 100644 --- a/httemplate/edit/elements/part_svc_column.html +++ b/httemplate/edit/elements/part_svc_column.html @@ -64,26 +64,11 @@ my %communigate_fields = ( </%once> <INPUT TYPE="hidden" NAME="svcdb" VALUE="<% $svcdb %>"> <BR><BR> -<& /elements/table.html &> - <TR><TH COLSPAN=<% $columns %>>Exports</TH></TR> - <TR> -% # exports -% foreach my $part_export (@part_export) { - <TD> - <INPUT TYPE="checkbox" \ - NAME="exportnum<% $part_export->exportnum %>" \ - VALUE=1 \ - <% $has_export_svc{$part_export->exportnum} ? 'CHECKED' : '' %>> - <% $part_export->label_html %> - </TD> -% $count++; -% if ( $count % $columns == 0 ) { - </TR> - <TR> -% } -% } - </TR> -</TABLE><BR><BR> +%# include export selection +<& export_svc.html, + part_svc => $part_svc, + svcdb => $svcdb +&> For the selected table, you can give fields default or fixed (unchangeable) values, or select an inventory class to manually or automatically fill in that field. @@ -285,27 +270,18 @@ that field. <%init> my $svcdb = shift; my %opt = @_; -my $columns = 3; my $count = 0; my $communigate = 0; my $conf = FS::Conf->new; my $part_svc = $opt{'part_svc'} || FS::part_svc->new; -my @part_export; -my $export_info = FS::part_export::export_info($svcdb); -foreach (keys %{ $export_info }) { - push @part_export, qsearch('part_export', { exporttype => $_ }); +# see if there are communigate exports configured +if ( exists $communigate_fields{$svcdb} ) { + $communigate = FS::part_export->count("exporttype like 'communigate%'"); } -$communigate = scalar(grep {$_->exporttype =~ /^communigate/} @part_export); my $svcpart = $opt{'clone'} || $part_svc->svcpart; -my %has_export_svc; -if ( $svcpart ) { - foreach (qsearch('export_svc', { svcpart => $svcpart })) { - $has_export_svc{$_->exportnum} = 1; - } -} my @fields; if ( defined( dbdef->table($svcdb) ) ) { # when is it ever not defined? diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 2ec024269..47b020c5a 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -31,6 +31,9 @@ font-size: smaller; font-style: italic; } +.selectrole { + font-size: small +} </STYLE> <SCRIPT TYPE="text/javascript"> function fixup_submit(layer) { diff --git a/httemplate/elements/select-phonenum.html b/httemplate/elements/select-phonenum.html index a8d9a7c3e..118fe4901 100644 --- a/httemplate/elements/select-phonenum.html +++ b/httemplate/elements/select-phonenum.html @@ -1,3 +1,34 @@ +<%doc> +Selector for DID phone number. + +Options: + +- prefix: prefix for all the object IDs, field names, javascript functions, +etc. for including multiple DID selectors on a single page. + +- empty: text to display when no number is selected ("empty_label") + +- bulknum: allow bulk selection of up to this many numbers (self-service +only? wtf?) + +- svcpart: svcpart (required) + +- tollfree: pass "tollfree" to misc/phonenums.cgi, instead of passing an +exchange/region/anything else. + +- region: corresponds to the inverse of "get_dids_npa_select". The selector +creates an on-change handler telling the previous selector in the hierarchy +to update the list of phone numbers. If 'region' is true, it will look for +a previous selector named "region", and prefix the query it sends to +phonenums.cgi with '_REGION', which results in get_dids() being called +with a 'region' parameter instead of 'ratecenter' and 'state'. + + +Internally, this will set up an exchange_changed or region_changed function +to refresh the phone number list. The function will fetch misc/phonenums.cgi, +passing the exchange (or region) and +</%doc> + <% include('/elements/xmlhttp.html', 'url' => $p.'misc/phonenums.cgi', 'subs' => [ $opt{'prefix'}. 'get_phonenums' ], diff --git a/httemplate/elements/tr-pkg_svc.html b/httemplate/elements/tr-pkg_svc.html index 1923f12c2..a44c5b9df 100644 --- a/httemplate/elements/tr-pkg_svc.html +++ b/httemplate/elements/tr-pkg_svc.html @@ -61,7 +61,7 @@ </TD> <TD> - <A HREF="part_svc.cgi?<% $part_svc->svcpart %>"><% $part_svc->svc %></A> <% $part_svc->disabled =~ /^Y/i ? ' (DISABLED' : '' %> + <A HREF="part_svc.cgi?<% $part_svc->svcpart %>"><% $part_svc->svc %></A> <% $part_svc->disabled =~ /^Y/i ? ' (DISABLED)' : '' %> </TD> <TD ALIGN="center"> diff --git a/httemplate/misc/phonenums.cgi b/httemplate/misc/phonenums.cgi index a048280bb..62923ac62 100644 --- a/httemplate/misc/phonenums.cgi +++ b/httemplate/misc/phonenums.cgi @@ -29,7 +29,7 @@ if ( $exchangestring ) { $opts{'state'} = $2; } else { $exchangestring =~ /\((\d{3})-(\d{3})-XXXX\)\s*$/i - or die "unparsable exchange: $exchangestring"; + or die "unparseable exchange: $exchangestring"; my( $areacode, $exchange ) = ( $1, $2 ); $opts{'areacode'} = $areacode; $opts{'exchange'} = $exchange; |