%doc>
Quite a bit of false laziness with edit/elements/part_export/broadband_snmp.html
%doc>
<& head.html, %opt &>
<& /elements/tr-select.html,
label => 'SNMP version',
field => 'snmp_version',
options => [ '1', '2c' ],
curr_value => $curr_value->{'snmp_version'}
&>
<& /elements/tr-input-text.html,
label => 'Community',
field => 'snmp_community',
curr_value => $curr_value->{'snmp_community'},
&>
<& /elements/tr-input-text.html,
label => 'Timeout (seconds)',
field => 'snmp_timeout',
curr_value => $curr_value->{'snmp_timeout'},
&>
Object Name | Object ID |
|
|
<& /elements/auto-table.html,
template_row => 'broadband_snmp_get_template',
fieldorder => ['oid_name','oid'],
data => \@data,
table => 'snmp',
&>
<& foot.html, %opt &>
<%init>
my %opt = @_;
my $part_export = $opt{part_export} || FS::part_export->new;
my $curr_value = {};
foreach my $field ( qw(snmp_version snmp_community snmp_timeout) ) {
$curr_value->{$field} = ($opt{'part_export'} && $opt{'part_export'}->exportnum)
? $part_export->option($field)
: $opt{'export_info'}->{'options'}->{$field}->{'default'};
}
my @oids = split("\n", $part_export->option('snmp_oid'));
my @oid_names = split("\n", $part_export->option('snmp_oid_name'));
my @data;
while (@oids) {
my @thisrow = (shift(@oids));
my $name = shift(@oid_names);
push @data, [$name, \@thisrow] if grep length($_), @thisrow;
}
my $popup_name = 'popup-'.time."-$$-".rand() * 2**32;
%init>