4 <INPUT TYPE="hidden" NAME="options" VALUE="community,version,ip_addr_change_to_new,timeout">
5 <& /elements/tr-select.html,
6 label => 'SNMP version',
8 options => [ '', 'v1', 'v2c' ],
9 labels => { v1 => '1', v2c => '2c' },
10 curr_value => $part_export->option('version') &>
11 <& /elements/tr-input-text.html,
14 curr_value => $curr_value->{'community'},
16 <& /elements/tr-checkbox.html,
17 label => 'Send IP address changes to new address',
18 field => 'ip_addr_change_to_new',
20 curr_value => $part_export->option('ip_addr_change_to_new'),
22 <& /elements/tr-input-text.html,
23 label => 'Timeout (seconds)',
25 curr_value => $part_export->option('timeout'),
28 <script type="text/javascript">
29 function open_select_mib(obj) {
30 nd(1); // if there's already one open, close it
31 var rownum = obj.rownum;
32 var curr_oid = obj.form.elements['oid' + rownum].value || '';
33 var url = '<%$fsurl%>misc/select-mib-popup.html?' +
34 'callback=receive_mib;' +
36 ';curr_value=' + curr_oid;
38 OLiframeContent(url, 550, 450, '<% $popup_name %>', 0, 'auto'),
39 CAPTION, 'Select MIB object', STICKY, AUTOSTATUSCAP,
40 MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK,
41 BGCOLOR, '#333399', CGCOLOR, '#333399',
45 function receive_mib(obj, rownum) {
46 //console.log(JSON.stringify(obj));
47 // we don't really need the numeric OID or any of the other properties
48 var oidfield = document.getElementById('oid'+rownum);
49 oidfield.value = obj.fullname;
50 document.getElementById('datatype'+rownum).value = obj.type;
51 oidfield.onchange(); //should be same as datatype, only need to run one
55 <table bgcolor="#cccccc" border=0 cellspacing=3>
64 <SELECT NAME="action">
65 % foreach ('', qw(insert delete replace suspend unsuspend)) {
66 <OPTION VALUE="<%$_%>"><%$_%></OPTION>
71 <INPUT NAME="oid" ID="oid" SIZE="54">
72 <INPUT TYPE="button" VALUE="..." ID="openselector" onclick="open_select_mib(this)">
75 <INPUT TYPE="text" NAME="datatype" ID="datatype">
78 <INPUT NAME="value" ID="value" SIZE="30">
81 <& /elements/auto-table.html,
82 template_row => 'mytemplate',
83 fieldorder => ['action', 'oid', 'datatype', 'value'],
86 <INPUT TYPE="hidden" NAME="multi_options" VALUE="action,oid,datatype,value">
90 my $part_export = $opt{part_export} || FS::part_export->new;
92 $curr_value->{'community'} = ($opt{'part_export'} && $opt{'part_export'}->exportnum)
93 ? $part_export->option('community')
94 : $opt{'export_info'}->{'options'}->{'community'}->{'default'};
96 my @actions = split("\n", $part_export->option('action'));
97 my @oids = split("\n", $part_export->option('oid'));
98 my @types = split("\n", $part_export->option('datatype'));
99 my @values = split("\n", $part_export->option('value'));
102 while (@actions or @oids or @values) {
103 my @thisrow = (shift(@actions), shift(@oids), shift(@types), shift(@values));
104 push @data, \@thisrow if grep length($_), @thisrow;
107 my $popup_name = 'popup-'.time."-$$-".rand() * 2**32;