summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-12-28 23:26:26 -0800
committerMark Wells <mark@freeside.biz>2014-12-28 23:26:39 -0800
commita52edcc909e5873a2c8790ce33b03917d6e1d29c (patch)
treed1ead7d87e2b60d6eef4787852eb58dac1c52700 /httemplate/elements
parent7e07d384748a5d0c5307fd711e4af520bf3b3802 (diff)
voip.ms export, #31834
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/select-did.html24
-rw-r--r--httemplate/elements/tr-select-sip_server.html48
2 files changed, 60 insertions, 12 deletions
diff --git a/httemplate/elements/select-did.html b/httemplate/elements/select-did.html
index c39603156..8a91d7a61 100644
--- a/httemplate/elements/select-did.html
+++ b/httemplate/elements/select-did.html
@@ -81,18 +81,18 @@ Example:
% # if/when other folks need an areacode-less DID selector that goes
% # directly from state to region
- <TD VALIGN="top">
- <% include('/elements/select.html',
- 'field' => 'phonenum_state',
- 'id' => 'phonenum_state',
- 'options' => [ '', @{ $export->get_dids } ],
- 'labels' => { '' => 'Select province' },
- 'onchange' => 'phonenum_state_changed(this);',
- 'disabled' => ( $manual_checked ? 1 : 0 ),
- )
- %>
- <BR><FONT SIZE="-1" ID="phonenum_state_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>Province</FONT>
- </TD>
+ <TD VALIGN="top">
+ <% include('/elements/select.html',
+ 'field' => 'phonenum_state',
+ 'id' => 'phonenum_state',
+ 'options' => [ '', @{ $export->get_dids } ],
+ 'labels' => { '' => 'Select province' },
+ 'onchange' => 'phonenum_state_changed(this);',
+ 'disabled' => ( $manual_checked ? 1 : 0 ),
+ )
+ %>
+ <BR><FONT SIZE="-1" ID="phonenum_state_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>Province</FONT>
+ </TD>
<TD VALIGN="top">
<% include('/elements/select-region.html',
diff --git a/httemplate/elements/tr-select-sip_server.html b/httemplate/elements/tr-select-sip_server.html
new file mode 100644
index 000000000..8df1b6288
--- /dev/null
+++ b/httemplate/elements/tr-select-sip_server.html
@@ -0,0 +1,48 @@
+% if ( $columnflag eq 'F' ) {
+<& fixed.html, %opt &>
+% } elsif ( $use_selector ) {
+% my $servers = $exports[0]->get_sip_servers;
+% # pretty simple selector, they're all just hostnames/IP addresses
+<& tr-select.html,
+ %opt,
+ options => $servers,
+&>
+% } else {
+<& tr-input-text.html, %opt &>
+% }
+</TR>
+
+<%init>
+
+my %opt = @_;
+my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
+
+$opt{'field'} ||= 'sip_server';
+
+#false laziness w/select-did.html
+#XXX make sure this comes through on errors too
+my $svcpart = $opt{'svcpart'}
+ || $opt{'object'}->svcpart
+ || $opt{'object'}->cust_svc->svcpart;
+
+my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } );
+die "unknown svcpart $svcpart" unless $part_svc;
+
+my $columnflag;
+my $psc = $part_svc->part_svc_column($opt{'field'});
+if ( $psc ) {
+ $columnflag = $psc->columnflag;
+}
+
+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 = 0;
+
+if ( $exports[0] and $exports[0]->can('get_sip_servers') ) {
+ $use_selector = 1;
+}
+
+</%init>