2 Quite a bit of false laziness with edit/elements/part_export/broadband_snmp.html
5 <INPUT TYPE="hidden" NAME="options" VALUE="snmp_community,snmp_version,snmp_timeout">
6 <& /elements/tr-select.html,
7 label => 'SNMP version',
8 field => 'snmp_version',
9 options => [ '1', '2c' ],
10 curr_value => $curr_value->{'snmp_version'}
12 <& /elements/tr-input-text.html,
14 field => 'snmp_community',
15 curr_value => $curr_value->{'snmp_community'},
17 <& /elements/tr-input-text.html,
18 label => 'Timeout (seconds)',
19 field => 'snmp_timeout',
20 curr_value => $curr_value->{'snmp_timeout'},
23 <script type="text/javascript">
24 function open_select_mib_get(obj) {
25 nd(1); // if there's already one open, close it
26 var rownum = obj.rownum;
27 var curr_oid = obj.form.elements['snmp_oid' + rownum].value || '';
28 var url = '<%$fsurl%>misc/select-mib-popup.html?' +
29 'callback=receive_mib_get;' +
31 ';curr_value=' + curr_oid;
33 OLiframeContent(url, 550, 450, '<% $popup_name %>', 0, 'auto'),
34 CAPTION, 'Select MIB object', STICKY, AUTOSTATUSCAP,
35 MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK,
36 BGCOLOR, '#333399', CGCOLOR, '#333399',
40 function receive_mib_get(obj, rownum) {
41 var oidfield = document.getElementById('snmp_oid'+rownum);
42 oidfield.value = obj.fullname;
47 <table bgcolor="#cccccc" border=0 cellspacing=3>
48 <TR><TH>Object Name</TH><TH>Object ID</TH></TR>
49 <TR id="broadband_snmp_get_template">
51 <INPUT NAME="oid_name" ID="oid_name" SIZE="25">
54 <INPUT NAME="oid" ID="oid" SIZE="54">
55 <INPUT TYPE="button" VALUE="..." ID="openselector" onclick="open_select_mib_get(this)">
58 <& /elements/auto-table.html,
59 template_row => 'broadband_snmp_get_template',
60 fieldorder => ['oid_name','oid'],
64 <INPUT TYPE="hidden" NAME="multi_options" VALUE="snmp_oid,snmp_oid_name">
69 my $part_export = $opt{part_export} || FS::part_export->new;
72 foreach my $field ( qw(snmp_version snmp_community snmp_timeout) ) {
73 $curr_value->{$field} = ($opt{'part_export'} && $opt{'part_export'}->exportnum)
74 ? $part_export->option($field)
75 : $opt{'export_info'}->{'options'}->{$field}->{'default'};
78 my @oids = split("\n", $part_export->option('snmp_oid'));
79 my @oid_names = split("\n", $part_export->option('snmp_oid_name'));
83 my @thisrow = (shift(@oids));
84 my $name = shift(@oid_names);
85 push @data, [$name, \@thisrow] if grep length($_), @thisrow;
88 my $popup_name = 'popup-'.time."-$$-".rand() * 2**32;