diff options
| author | Mark Wells <mark@freeside.biz> | 2014-12-28 23:26:26 -0800 |
|---|---|---|
| committer | Mark Wells <mark@freeside.biz> | 2014-12-28 23:26:39 -0800 |
| commit | a52edcc909e5873a2c8790ce33b03917d6e1d29c (patch) | |
| tree | d1ead7d87e2b60d6eef4787852eb58dac1c52700 /httemplate/elements/tr-select-sip_server.html | |
| parent | 7e07d384748a5d0c5307fd711e4af520bf3b3802 (diff) | |
voip.ms export, #31834
Diffstat (limited to 'httemplate/elements/tr-select-sip_server.html')
| -rw-r--r-- | httemplate/elements/tr-select-sip_server.html | 48 |
1 files changed, 48 insertions, 0 deletions
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> |
