summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2008-06-28 23:03:10 +0000
committerivan <ivan>2008-06-28 23:03:10 +0000
commit9c7dee35f91a386fcce14cb6c3e9d23ba3eee8af (patch)
treeb21b3ca250947289caaecdeba659bc37257bf464 /httemplate
parenta1871d3d13c1dafa93b956762c0d23728d261da7 (diff)
get DIDs from globalpops
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/edit/cust_main/select-state.html24
-rw-r--r--httemplate/edit/elements/svc_Common.html4
-rw-r--r--httemplate/edit/svc_phone.cgi8
-rw-r--r--httemplate/elements/input-text.html44
-rw-r--r--httemplate/elements/select-areacode.html91
-rw-r--r--httemplate/elements/select-did.html80
-rw-r--r--httemplate/elements/select-exchange.html86
-rw-r--r--httemplate/elements/select-phonenum.html84
-rw-r--r--httemplate/elements/select-state.html24
-rw-r--r--httemplate/elements/tr-input-text.html44
-rw-r--r--httemplate/elements/tr-select-did.html23
-rw-r--r--httemplate/images/wait-orange.gifbin0 -> 1849 bytes
-rw-r--r--httemplate/misc/areacodes.cgi24
-rw-r--r--httemplate/misc/exchanges.cgi24
-rw-r--r--httemplate/misc/phonenums.cgi29
15 files changed, 522 insertions, 67 deletions
diff --git a/httemplate/edit/cust_main/select-state.html b/httemplate/edit/cust_main/select-state.html
index 4f1c056b5..ce08443e4 100644
--- a/httemplate/edit/cust_main/select-state.html
+++ b/httemplate/edit/cust_main/select-state.html
@@ -1,24 +1,4 @@
-<SELECT NAME="<% $opt{'prefix'} %>state" onChange="<% $opt{'prefix'} %>state_changed(this); <% $opt{'onchange'} %>" <% $opt{'disabled'} %>>
-
-% if ($opt{empty}) {
- <OPTION VALUE=""<% $opt{state} eq '' ? ' SELECTED' : '' %>><% $opt{empty} %>
-% }
-
-% foreach my $state ( keys %states ) {
-
- <OPTION VALUE="<% $state %>"<% $state eq $opt{'state'} ? ' SELECTED' : '' %>><% $states{$state} || '(n/a)' %>
-
-% }
-
-
-</SELECT>
-
+<% include('/elements/select-state.html', @_) %>
<%init>
-my %opt = @_;
-foreach my $opt (qw( county state country prefix onchange disabled empty )) {
- $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_});
-}
-
-tie my %states, 'Tie::IxHash', states_hash( $opt{'country'} );
+warn "cust_main/select-state.html depreated; use /elements/select-state.html instead";
</%init>
-
diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html
index b6737c14a..4355cb4cd 100644
--- a/httemplate/edit/elements/svc_Common.html
+++ b/httemplate/edit/elements/svc_Common.html
@@ -28,6 +28,8 @@
$part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart });
die "No part_svc entry!" unless $part_svc;
+
+ $svc_x->setfield('svcpart', $svcpart);
},
'edit_callback' => sub {
@@ -43,7 +45,7 @@
die "No part_svc entry!" unless $part_svc;
},
- 'new_hash_callback' => sub {
+ 'new_hashref_callback' => sub {
#my( $cgi, $svc_x ) = @_;
{ svcpart => $svcpart };
diff --git a/httemplate/edit/svc_phone.cgi b/httemplate/edit/svc_phone.cgi
index 958558b46..109fba228 100644
--- a/httemplate/edit/svc_phone.cgi
+++ b/httemplate/edit/svc_phone.cgi
@@ -1,7 +1,13 @@
<% include( 'elements/svc_Common.html',
'name' => 'Phone number',
'table' => 'svc_phone',
- 'fields' => [qw( countrycode phonenum pin )],
+ 'fields' => [ 'countrycode',
+ { field => 'phonenum',
+ type => 'select-did',
+ label => 'Phone number',
+ },
+ 'pin',
+ ],
'labels' => {
'countrycode' => 'Country code',
'phonenum' => 'Phone number',
diff --git a/httemplate/elements/input-text.html b/httemplate/elements/input-text.html
new file mode 100644
index 000000000..9db064348
--- /dev/null
+++ b/httemplate/elements/input-text.html
@@ -0,0 +1,44 @@
+<% $opt{'prefix'} %><INPUT TYPE = "<% $opt{type} || 'text' %>"
+ NAME = "<% $opt{field} %>"
+ ID = "<% $opt{id} %>"
+ VALUE = "<% $value |h %>"
+ <% $size %>
+ <% $maxlength %>
+ <% $style %>
+ <% $opt{disabled} %>
+ <% $onchange %>
+ ><% $opt{'postfix'} %>
+<%init>
+
+my %opt = @_;
+
+my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value};
+
+my $onchange = $opt{'onchange'}
+ ? 'onChange="'. $opt{'onchange'}. '(this)"'
+ : '';
+
+my $size = $opt{'size'}
+ ? 'SIZE="'. $opt{'size'}. '"'
+ : '';
+
+my $maxlength = $opt{'maxlength'}
+ ? 'MAXLENGTH="'. $opt{'maxlength'}. '"'
+ : '';
+
+$opt{'disabled'} = &{ $opt{'disabled'} }( \%opt )
+ if ref($opt{'disabled'}) eq 'CODE';
+$opt{'disabled'} = 'DISABLED'
+ if $opt{'disabled'} && $opt{'disabled'} !~ /disabled/i; # uuh... yeah?
+
+my @style = ();
+
+push @style, 'text-align: '. $opt{'text-align'}
+ if $opt{'text-align'};
+
+push @style, 'background-color: #dddddd'
+ if $opt{'disabled'};
+
+my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
+
+</%init>
diff --git a/httemplate/elements/select-areacode.html b/httemplate/elements/select-areacode.html
new file mode 100644
index 000000000..aa2d73b65
--- /dev/null
+++ b/httemplate/elements/select-areacode.html
@@ -0,0 +1,91 @@
+<% include('/elements/xmlhttp.html',
+ 'url' => $p.'misc/areacodes.cgi',
+ 'subs' => [ $opt{'prefix'}. 'get_areacodes' ],
+ )
+%>
+
+<SCRIPT TYPE="text/javascript">
+
+ function opt(what,value,text) {
+ var optionName = new Option(text, value, false, false);
+ var length = what.length;
+ what.options[length] = optionName;
+ }
+
+ function <% $opt{'prefix'} %>state_changed(what, callback) {
+
+ what.form.<% $opt{'prefix'} %>areacode.disabled = 'disabled';
+ what.form.<% $opt{'prefix'} %>areacode.style.display = 'none';
+ var areacodewait = document.getElementById('<% $opt{'prefix'} %>areacodewait');
+ areacodewait.style.display = '';
+ var areacodeerror = document.getElementById('<% $opt{'prefix'} %>areacodeerror');
+ areacodeerror.style.display = 'none';
+
+ what.form.<% $opt{'prefix'} %>exchange.disabled = 'disabled';
+ what.form.<% $opt{'prefix'} %>phonenum.disabled = 'disabled';
+
+ state = what.options[what.selectedIndex].value;
+
+ function <% $opt{'prefix'} %>update_areacodes(areacodes) {
+
+ // blank the current areacode
+ for ( var i = what.form.<% $opt{'prefix'} %>areacode.length; i >= 0; i-- )
+ what.form.<% $opt{'prefix'} %>areacode.options[i] = null;
+ // blank the current exchange too
+ for ( var i = what.form.<% $opt{'prefix'} %>exchange.length; i >= 0; i-- )
+ what.form.<% $opt{'prefix'} %>exchange.options[i] = null;
+ opt(what.form.<% $opt{'prefix'} %>exchange, '', 'Select city / exchange');
+ // 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 ($opt{empty}) {
+ opt(what.form.<% $opt{'prefix'} %>areacode, '', '<% $opt{empty} %>');
+% }
+
+ // add the new areacodes
+ var areacodeArray = eval('(' + areacodes + ')' );
+ for ( var s = 0; s < areacodeArray.length; s++ ) {
+ var areacodeLabel = areacodeArray[s];
+ if ( areacodeLabel == "" )
+ areacodeLabel = '(n/a)';
+ opt(what.form.<% $opt{'prefix'} %>areacode, areacodeArray[s], areacodeLabel);
+ }
+
+ areacodewait.style.display = 'none';
+ if ( areacodeArray.length >= 1 ) {
+ what.form.<% $opt{'prefix'} %>areacode.disabled = '';
+ what.form.<% $opt{'prefix'} %>areacode.style.display = '';
+ } else {
+ var areacodeerror = document.getElementById('<% $opt{'prefix'} %>areacodeerror');
+ areacodeerror.style.display = '';
+ }
+
+ //run the callback
+ if ( callback != null )
+ callback();
+ }
+
+ // go get the new areacodes
+ <% $opt{'prefix'} %>get_areacodes( state, <% $opt{'svcpart'} %>, <% $opt{'prefix'} %>update_areacodes );
+
+ }
+
+</SCRIPT>
+
+<DIV ID="areacodewait" STYLE="display:none"><IMG SRC="<%$fsurl%>images/wait-orange.gif"> <B>Finding area codes</B></DIV>
+
+<DIV ID="areacodeerror" STYLE="display:none"><IMG SRC="<%$fsurl%>images/cross.png"> <B>Select a different state</B></DIV>
+
+<SELECT NAME="<% $opt{'prefix'} %>areacode" onChange="<% $opt{'prefix'} %>areacode_changed(this); <% $opt{'onchange'} %>" <% $opt{'disabled'} %>>
+ <OPTION VALUE="">Select area code</OPTION>
+</SELECT>
+
+<%init>
+
+my %opt = @_;
+
+$opt{disabled} = 'disabled' unless exists $opt{disabled};
+
+</%init>
diff --git a/httemplate/elements/select-did.html b/httemplate/elements/select-did.html
new file mode 100644
index 000000000..999274fea
--- /dev/null
+++ b/httemplate/elements/select-did.html
@@ -0,0 +1,80 @@
+<%doc>
+
+Example:
+
+ include('/elements/select-did.html',
+ 'field' => 'phonenum',
+ 'svcpart' => 5,
+ );
+
+</%doc>
+% if ( $use_selector ) {
+
+ <TABLE>
+
+ <TR>
+ <TD>
+ <% include('/elements/select-state.html',
+ 'country' => $country,
+ 'empty' => 'Select state',
+ )
+ %>
+ </TD>
+ <TD>
+ <% include('/elements/select-areacode.html',
+ 'svcpart' => $svcpart,
+ 'empty' => 'Select area code',
+ )
+ %>
+ </TD>
+ <TD>
+ <% include('/elements/select-exchange.html',
+ 'svcpart' => $svcpart,
+ 'empty' => 'Select exchange',
+ )
+ %>
+ </TD>
+ <TD>
+ <% include('/elements/select-phonenum.html',
+ 'svcpart' => $svcpart,
+ 'empty' => 'Select phone number',
+ )
+ %>
+ </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>
+
+% } else {
+
+ <% include( '/elements/input-text.html', %opt, 'type'=>'text' ) %>
+
+% }
+<%init>
+
+my %opt = @_;
+
+my $conf = new FS::Conf;
+my $country = $conf->config('countrydefault') || 'US';
+
+#XXX make sure this comes through on errors too
+my $svcpart = $opt{'object'}->svcpart;
+
+my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } );
+die "unknown svcpart $svcpart" unless $part_svc;
+
+my @exports = $part_svc->part_export_did;
+if ( scalar(@exports) > 1 ) {
+ die "more than one DID-providing export attached to svcpart $svcpart";
+}
+
+my $use_selector = scalar(@exports) ? 1 : 0;
+
+</%init>
diff --git a/httemplate/elements/select-exchange.html b/httemplate/elements/select-exchange.html
new file mode 100644
index 000000000..012e7c6b7
--- /dev/null
+++ b/httemplate/elements/select-exchange.html
@@ -0,0 +1,86 @@
+<% include('/elements/xmlhttp.html',
+ 'url' => $p.'misc/exchanges.cgi',
+ 'subs' => [ $opt{'prefix'}. 'get_exchanges' ],
+ )
+%>
+
+<SCRIPT TYPE="text/javascript">
+
+ function opt(what,value,text) {
+ var optionName = new Option(text, value, false, false);
+ var length = what.length;
+ what.options[length] = optionName;
+ }
+
+ function <% $opt{'prefix'} %>areacode_changed(what, callback) {
+
+ what.form.<% $opt{'prefix'} %>exchange.disabled = 'disabled';
+ what.form.<% $opt{'prefix'} %>exchange.style.display = 'none';
+ var exchangewait = document.getElementById('<% $opt{'prefix'} %>exchangewait');
+ exchangewait.style.display = '';
+ var exchangeerror = document.getElementById('<% $opt{'prefix'} %>exchangeerror');
+ exchangeerror.style.display = 'none';
+
+ what.form.<% $opt{'prefix'} %>phonenum.disabled = 'disabled';
+
+ areacode = what.options[what.selectedIndex].value;
+
+ function <% $opt{'prefix'} %>update_exchanges(exchanges) {
+
+ // blank the current exchange
+ for ( var i = what.form.<% $opt{'prefix'} %>exchange.length; i >= 0; i-- )
+ what.form.<% $opt{'prefix'} %>exchange.options[i] = null;
+ // 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 ($opt{empty}) {
+ opt(what.form.<% $opt{'prefix'} %>exchange, '', '<% $opt{empty} %>');
+% }
+
+ // add the new exchanges
+ var exchangeArray = eval('(' + exchanges + ')' );
+ for ( var s = 0; s < exchangeArray.length; s++ ) {
+ var exchangeLabel = exchangeArray[s];
+ if ( exchangeLabel == "" )
+ exchangeLabel = '(n/a)';
+ opt(what.form.<% $opt{'prefix'} %>exchange, exchangeArray[s], exchangeLabel);
+ }
+
+ exchangewait.style.display = 'none';
+ if ( exchangeArray.length >= 1 ) {
+ what.form.<% $opt{'prefix'} %>exchange.disabled = '';
+ what.form.<% $opt{'prefix'} %>exchange.style.display = '';
+ } else {
+ var exchangeerror = document.getElementById('<% $opt{'prefix'} %>exchangeerror');
+ exchangeerror.style.display = '';
+ }
+
+ //run the callback
+ if ( callback != null )
+ callback();
+ }
+
+ // go get the new exchanges
+ <% $opt{'prefix'} %>get_exchanges( areacode, <% $opt{'svcpart'} %>, <% $opt{'prefix'} %>update_exchanges );
+
+ }
+
+</SCRIPT>
+
+<DIV ID="exchangewait" STYLE="display:none"><IMG SRC="<%$fsurl%>images/wait-orange.gif"> <B>Finding cities / exchanges</B></DIV>
+
+<DIV ID="exchangeerror" STYLE="display:none"><IMG SRC="<%$fsurl%>images/cross.png"> <B>Select a different area code</B></DIV>
+
+<SELECT NAME="<% $opt{'prefix'} %>exchange" onChange="<% $opt{'prefix'} %>exchange_changed(this); <% $opt{'onchange'} %>" <% $opt{'disabled'} %>>
+ <OPTION VALUE="">Select city / exchange</OPTION>
+</SELECT>
+
+<%init>
+
+my %opt = @_;
+
+$opt{disabled} = 'disabled' unless exists $opt{disabled};
+
+</%init>
diff --git a/httemplate/elements/select-phonenum.html b/httemplate/elements/select-phonenum.html
new file mode 100644
index 000000000..99ddafc42
--- /dev/null
+++ b/httemplate/elements/select-phonenum.html
@@ -0,0 +1,84 @@
+<% include('/elements/xmlhttp.html',
+ 'url' => $p.'misc/phonenums.cgi',
+ 'subs' => [ $opt{'prefix'}. 'get_phonenums' ],
+ )
+%>
+
+<SCRIPT TYPE="text/javascript">
+
+ function opt(what,value,text) {
+ var optionName = new Option(text, value, false, false);
+ var length = what.length;
+ what.options[length] = optionName;
+ }
+
+ function <% $opt{'prefix'} %>exchange_changed(what, callback) {
+
+ what.form.<% $opt{'prefix'} %>phonenum.disabled = 'disabled';
+ what.form.<% $opt{'prefix'} %>phonenum.style.display = 'none';
+ var phonenumwait = document.getElementById('<% $opt{'prefix'} %>phonenumwait');
+ phonenumwait.style.display = '';
+ var phonenumerror = document.getElementById('<% $opt{'prefix'} %>phonenumerror');
+ phonenumerror.style.display = 'none';
+
+ exchange = what.options[what.selectedIndex].value;
+
+ function <% $opt{'prefix'} %>update_phonenums(phonenums) {
+
+ // blank the current phonenum
+ for ( var i = what.form.<% $opt{'prefix'} %>phonenum.length; i >= 0; i-- )
+ what.form.<% $opt{'prefix'} %>phonenum.options[i] = null;
+
+% if ($opt{empty}) {
+ opt(what.form.<% $opt{'prefix'} %>phonenum, '', '<% $opt{empty} %>');
+% }
+
+ // add the new phonenums
+ var phonenumArray = eval('(' + phonenums + ')' );
+ for ( var s = 0; s < phonenumArray.length; s++ ) {
+ var phonenumLabel = phonenumArray[s];
+ if ( phonenumLabel == "" )
+ phonenumLabel = '(n/a)';
+ opt(what.form.<% $opt{'prefix'} %>phonenum, phonenumArray[s], phonenumLabel);
+ }
+
+ //var phonenumFormLabel = document.getElementById('<% $opt{'prefix'} %>phonenumlabel');
+
+ what.form.<% $opt{'prefix'} %>phonenum.disabled = '';
+
+ phonenumwait.style.display = 'none';
+ if ( phonenumArray.length >= 1 ) {
+ what.form.<% $opt{'prefix'} %>phonenum.disabled = '';
+ what.form.<% $opt{'prefix'} %>phonenum.style.display = '';
+ } else {
+ var phonenumerror = document.getElementById('<% $opt{'prefix'} %>phonenumerror');
+ phonenumerror.style.display = '';
+ }
+
+ //run the callback
+ if ( callback != null )
+ callback();
+ }
+
+ // go get the new phonenums
+ <% $opt{'prefix'} %>get_phonenums( exchange, <% $opt{'svcpart'} %>, <% $opt{'prefix'} %>update_phonenums );
+
+ }
+
+</SCRIPT>
+
+<DIV ID="phonenumwait" STYLE="display:none"><IMG SRC="<%$fsurl%>images/wait-orange.gif"> <B>Finding phone numbers</B></DIV>
+
+<DIV ID="phonenumerror" STYLE="display:none"><IMG SRC="<%$fsurl%>images/cross.png"> <B>Select a different city/exchange</B></DIV>
+
+<SELECT NAME="<% $opt{'prefix'} %>phonenum" onChange="<% $opt{'prefix'} %>phonenum_changed(this); <% $opt{'onchange'} %>" <% $opt{'disabled'} %>>
+ <OPTION VALUE="">Select phone number</OPTION>
+</SELECT>
+
+<%init>
+
+my %opt = @_;
+
+$opt{disabled} = 'disabled' unless exists $opt{disabled};
+
+</%init>
diff --git a/httemplate/elements/select-state.html b/httemplate/elements/select-state.html
new file mode 100644
index 000000000..4f1c056b5
--- /dev/null
+++ b/httemplate/elements/select-state.html
@@ -0,0 +1,24 @@
+<SELECT NAME="<% $opt{'prefix'} %>state" onChange="<% $opt{'prefix'} %>state_changed(this); <% $opt{'onchange'} %>" <% $opt{'disabled'} %>>
+
+% if ($opt{empty}) {
+ <OPTION VALUE=""<% $opt{state} eq '' ? ' SELECTED' : '' %>><% $opt{empty} %>
+% }
+
+% foreach my $state ( keys %states ) {
+
+ <OPTION VALUE="<% $state %>"<% $state eq $opt{'state'} ? ' SELECTED' : '' %>><% $states{$state} || '(n/a)' %>
+
+% }
+
+
+</SELECT>
+
+<%init>
+my %opt = @_;
+foreach my $opt (qw( county state country prefix onchange disabled empty )) {
+ $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_});
+}
+
+tie my %states, 'Tie::IxHash', states_hash( $opt{'country'} );
+</%init>
+
diff --git a/httemplate/elements/tr-input-text.html b/httemplate/elements/tr-input-text.html
index f71f2f7fb..14f1425df 100644
--- a/httemplate/elements/tr-input-text.html
+++ b/httemplate/elements/tr-input-text.html
@@ -1,19 +1,6 @@
<% include('tr-td-label.html', @_ ) %>
- <TD <% $cell_style %>>
-
- <% $opt{'prefix'} %><INPUT TYPE = "<% $opt{type} || 'text' %>"
- NAME = "<% $opt{field} %>"
- ID = "<% $opt{id} %>"
- VALUE = "<% $value |h %>"
- <% $size %>
- <% $maxlength %>
- <% $style %>
- <% $opt{disabled} %>
- <% $onchange %>
- ><% $opt{'postfix'} %>
-
- </TD>
+ <TD <% $cell_style %>><% include('input-text.html', @_ ) %></TD>
</TR>
@@ -21,35 +8,6 @@
my %opt = @_;
-my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value};
-
-my $onchange = $opt{'onchange'}
- ? 'onChange="'. $opt{'onchange'}. '(this)"'
- : '';
-
-my $size = $opt{'size'}
- ? 'SIZE="'. $opt{'size'}. '"'
- : '';
-
-my $maxlength = $opt{'maxlength'}
- ? 'MAXLENGTH="'. $opt{'maxlength'}. '"'
- : '';
-
-$opt{'disabled'} = &{ $opt{'disabled'} }( \%opt )
- if ref($opt{'disabled'}) eq 'CODE';
-$opt{'disabled'} = 'DISABLED'
- if $opt{'disabled'} && $opt{'disabled'} !~ /disabled/i; # uuh... yeah?
-
-my @style = ();
-
-push @style, 'text-align: '. $opt{'text-align'}
- if $opt{'text-align'};
-
-push @style, 'background-color: #dddddd'
- if $opt{'disabled'};
-
-my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
-
my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
</%init>
diff --git a/httemplate/elements/tr-select-did.html b/httemplate/elements/tr-select-did.html
new file mode 100644
index 000000000..29c5bb7dd
--- /dev/null
+++ b/httemplate/elements/tr-select-did.html
@@ -0,0 +1,23 @@
+<% include('tr-td-label.html', @_ ) %>
+
+% if ( $opt{'curr_value'} ne '' ) {
+
+ <TD BGCOLOR="#dddddd" <% $cell_style %>><% $opt{'formatted_value'} || $opt{'curr_value'} || $opt{'value'} |h %></TD>
+
+% } else {
+
+ <TD <% $cell_style %>>
+ <% include('/elements/select-did.html', %opt ) %>
+ </TD>
+
+% }
+
+</TR>
+
+<%init>
+
+my %opt = @_;
+
+my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
+
+</%init>
diff --git a/httemplate/images/wait-orange.gif b/httemplate/images/wait-orange.gif
new file mode 100644
index 000000000..92c7f3476
--- /dev/null
+++ b/httemplate/images/wait-orange.gif
Binary files differ
diff --git a/httemplate/misc/areacodes.cgi b/httemplate/misc/areacodes.cgi
new file mode 100644
index 000000000..69c9573c3
--- /dev/null
+++ b/httemplate/misc/areacodes.cgi
@@ -0,0 +1,24 @@
+%# [ <% join(', ', map { qq("$_") } @areacodes) %> ]
+<% objToJson(\@areacodes) %>
+<%init>
+
+my( $state, $svcpart ) = $cgi->param('arg');
+
+my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } );
+die "unknown svcpart $svcpart" unless $part_svc;
+
+my @exports = $part_svc->part_export_did;
+if ( scalar(@exports) > 1 ) {
+ die "more than one DID-providing export attached to svcpart $svcpart";
+} elsif ( ! @exports ) {
+ die "no DID providing export attached to svcpart $svcpart";
+}
+my $export = $exports[0];
+
+my $something = $export->get_dids('state'=>$state);
+
+#warn Dumper($something);
+
+my @areacodes = @{ $something };
+
+</%init>
diff --git a/httemplate/misc/exchanges.cgi b/httemplate/misc/exchanges.cgi
new file mode 100644
index 000000000..f5860cff2
--- /dev/null
+++ b/httemplate/misc/exchanges.cgi
@@ -0,0 +1,24 @@
+%# [ <% join(', ', map { qq("$_") } @exchanges) %> ]
+<% objToJson(\@exchanges) %>
+<%init>
+
+my( $areacode, $svcpart ) = $cgi->param('arg');
+
+my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } );
+die "unknown svcpart $svcpart" unless $part_svc;
+
+my @exports = $part_svc->part_export_did;
+if ( scalar(@exports) > 1 ) {
+ die "more than one DID-providing export attached to svcpart $svcpart";
+} elsif ( ! @exports ) {
+ die "no DID providing export attached to svcpart $svcpart";
+}
+my $export = $exports[0];
+
+my $something = $export->get_dids('areacode'=>$areacode);
+
+#warn Dumper($something);
+
+my @exchanges = @{ $something };
+
+</%init>
diff --git a/httemplate/misc/phonenums.cgi b/httemplate/misc/phonenums.cgi
new file mode 100644
index 000000000..2ed0f617d
--- /dev/null
+++ b/httemplate/misc/phonenums.cgi
@@ -0,0 +1,29 @@
+%# [ <% join(', ', map { qq("$_") } @exchanges) %> ]
+<% objToJson(\@exchanges) %>
+<%init>
+
+my( $exchangestring, $svcpart ) = $cgi->param('arg');
+
+$exchangestring =~ /\((\d{3})-(\d{3})-XXXX\)\s*$/i
+ or die "unparsable exchange: $exchangestring";
+my( $areacode, $exchange ) = ( $1, $2 );
+my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } );
+die "unknown svcpart $svcpart" unless $part_svc;
+
+my @exports = $part_svc->part_export_did;
+if ( scalar(@exports) > 1 ) {
+ die "more than one DID-providing export attached to svcpart $svcpart";
+} elsif ( ! @exports ) {
+ die "no DID providing export attached to svcpart $svcpart";
+}
+my $export = $exports[0];
+
+my $something = $export->get_dids('areacode'=>$areacode,
+ 'exchange'=>$exchange,
+ );
+
+#warn Dumper($something);
+
+my @exchanges = @{ $something };
+
+</%init>