summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-12-09 23:39:52 -0600
committerJonathan Prykop <jonathan@freeside.biz>2015-12-15 23:39:43 -0600
commitedf68fde8ea6c36084ef6fe6a481f0d9502b116b (patch)
treed0c64c7e68fba88cd417ecac2f66969e858d0ac6 /httemplate/edit
parent39c1e4dfed3d006882084c2d677715e4de861e2e (diff)
RT#39115: View SNMP info on svc_broadband service
Diffstat (limited to 'httemplate/edit')
-rw-r--r--httemplate/edit/elements/part_export/broadband_snmp.html8
-rw-r--r--httemplate/edit/elements/part_export/broadband_snmp_get.html77
2 files changed, 82 insertions, 3 deletions
diff --git a/httemplate/edit/elements/part_export/broadband_snmp.html b/httemplate/edit/elements/part_export/broadband_snmp.html
index ebb765dee..b4d57edd5 100644
--- a/httemplate/edit/elements/part_export/broadband_snmp.html
+++ b/httemplate/edit/elements/part_export/broadband_snmp.html
@@ -11,7 +11,7 @@
<& /elements/tr-input-text.html,
label => 'Community',
field => 'community',
- curr_value => $part_export->option('community'),
+ curr_value => $part_export->option('community') || $opt{'export_info'}->{'options'}->{'community'}->{'default'},
&>
<& /elements/tr-checkbox.html,
label => 'Send IP address changes to new address',
@@ -30,7 +30,7 @@ function open_select_mib(obj) {
nd(1); // if there's already one open, close it
var rownum = obj.rownum;
var curr_oid = obj.form.elements['oid' + rownum].value || '';
- var url = '<%$fsurl%>/elements/select-mib-popup.html?' +
+ var url = '<%$fsurl%>misc/select-mib-popup.html?' +
'callback=receive_mib;' +
'arg=' + rownum +
';curr_value=' + curr_oid;
@@ -45,8 +45,10 @@ function open_select_mib(obj) {
function receive_mib(obj, rownum) {
//console.log(JSON.stringify(obj));
// we don't really need the numeric OID or any of the other properties
- document.getElementById('oid'+rownum).value = obj.fullname;
+ var oidfield = document.getElementById('oid'+rownum);
+ oidfield.value = obj.fullname;
document.getElementById('datatype'+rownum).value = obj.type;
+ oidfield.onchange(); //should be same as datatype, only need to run one
}
</script>
diff --git a/httemplate/edit/elements/part_export/broadband_snmp_get.html b/httemplate/edit/elements/part_export/broadband_snmp_get.html
new file mode 100644
index 000000000..8b8717c29
--- /dev/null
+++ b/httemplate/edit/elements/part_export/broadband_snmp_get.html
@@ -0,0 +1,77 @@
+<%doc>
+Quite a bit of false laziness with edit/elements/part_export/broadband_snmp.html
+</%doc>
+<& head.html, %opt &>
+<INPUT TYPE="hidden" NAME="options" VALUE="snmp_community,snmp_version,snmp_timeout">
+<& /elements/tr-select.html,
+ label => 'SNMP version',
+ field => 'snmp_version',
+ options => [ '1', '2c' ],
+ curr_value => $part_export->option('version')
+&>
+<& /elements/tr-input-text.html,
+ label => 'Community',
+ field => 'snmp_community',
+ curr_value => $part_export->option('community') || $opt{'export_info'}->{'options'}->{'snmp_community'}->{'default'},
+&>
+<& /elements/tr-input-text.html,
+ label => 'Timeout (seconds)',
+ field => 'snmp_timeout',
+ curr_value => $part_export->option('timeout') || $opt{'export_info'}->{'options'}->{'snmp_timeout'}->{'default'},
+&>
+</TABLE>
+<script type="text/javascript">
+function open_select_mib_get(obj) {
+ nd(1); // if there's already one open, close it
+ var rownum = obj.rownum;
+ var curr_oid = obj.form.elements['snmp_oid' + rownum].value || '';
+ var url = '<%$fsurl%>misc/select-mib-popup.html?' +
+ 'callback=receive_mib_get;' +
+ 'arg=' + rownum +
+ ';curr_value=' + curr_oid;
+ overlib(
+ OLiframeContent(url, 550, 450, '<% $popup_name %>', 0, 'auto'),
+ CAPTION, 'Select MIB object', STICKY, AUTOSTATUSCAP,
+ MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK,
+ BGCOLOR, '#333399', CGCOLOR, '#333399',
+ CLOSETEXT, 'Close'
+ );
+}
+function receive_mib_get(obj, rownum) {
+ var oidfield = document.getElementById('snmp_oid'+rownum);
+ oidfield.value = obj.fullname;
+ oidfield.onchange();
+}
+</script>
+
+<table bgcolor="#cccccc" border=0 cellspacing=3>
+<TR><TH>Object ID</TH></TR>
+<TR id="broadband_snmp_get_template">
+ <TD>
+ <INPUT NAME="oid" ID="oid" SIZE="54">
+ <INPUT TYPE="button" VALUE="..." ID="openselector" onclick="open_select_mib_get(this)">
+ </TD>
+</TR>
+<& /elements/auto-table.html,
+ template_row => 'broadband_snmp_get_template',
+ fieldorder => ['oid'],
+ data => \@data,
+ table => 'snmp',
+&>
+<INPUT TYPE="hidden" NAME="multi_options" VALUE="snmp_oid">
+<& foot.html, %opt &>
+<%init>
+my %opt = @_;
+
+my $part_export = $opt{part_export} || FS::part_export->new;
+
+my @oids = split("\n", $part_export->option('snmp_oid'));
+
+my @data;
+while (@oids) {
+ my @thisrow = (shift(@oids));
+ push @data, \@thisrow if grep length($_), @thisrow;
+}
+
+my $popup_name = 'popup-'.time."-$$-".rand() * 2**32;
+</%init>