From 3a02a1bce4190ce0d94883709e0a6c362bcb0af3 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Wed, 9 Dec 2015 23:39:52 -0600 Subject: RT#39115: View SNMP info on svc_broadband service --- httemplate/misc/select-mib-popup.html | 186 +++++++++++++++++++++++++ httemplate/misc/xmlhttp-broadband_snmp_get.cgi | 35 +++++ 2 files changed, 221 insertions(+) create mode 100644 httemplate/misc/select-mib-popup.html create mode 100644 httemplate/misc/xmlhttp-broadband_snmp_get.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/select-mib-popup.html b/httemplate/misc/select-mib-popup.html new file mode 100644 index 000000000..f95ce2b97 --- /dev/null +++ b/httemplate/misc/select-mib-popup.html @@ -0,0 +1,186 @@ +<& /elements/header-popup.html &> + + + + + + + + + + + + + + + + + + + + + + + + + +
Module:
Object:
+ +
Module:
Data type:
+ +
+<& /elements/xmlhttp.html, + url => $p.'misc/xmlhttp-mib-browse.html', + subs => [qw( search get_module_list )], +&> + +<& /elements/footer.html &> +<%init> +my $callback = 'alert("(no callback defined)" + selected_mib.stringify)'; +$cgi->param('callback') =~ /^(\w+)$/; +if ( $1 ) { + # construct the JS function call expresssion + $callback = 'window.parent.' . $1 . '(selected_mib'; + foreach ($cgi->param('arg')) { + # pass-through arguments + /^(\w+)$/ or next; + $callback .= ",'$1'"; + } + $callback .= ')'; +} + + diff --git a/httemplate/misc/xmlhttp-broadband_snmp_get.cgi b/httemplate/misc/xmlhttp-broadband_snmp_get.cgi new file mode 100644 index 000000000..a6f926722 --- /dev/null +++ b/httemplate/misc/xmlhttp-broadband_snmp_get.cgi @@ -0,0 +1,35 @@ +<%doc> +Requires arg $svcnum. Returns JSON-encoded realtime snmp results +for configured broadband_snmp_get exports. + +<% encode_json(\@result) %>\ +<%init> + +# access/agent permissions lifted from /view/elements/svc_Common.html + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); + +my %arg = $cgi->param('arg'); +my $svc = qsearchs({ + 'select' => 'svc_broadband.*', + 'table' => 'svc_broadband', + 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '. + ' LEFT JOIN cust_pkg USING ( pkgnum ) '. + ' LEFT JOIN cust_main USING ( custnum ) ', + 'hashref' => { 'svcnum' => $arg{'svcnum'} }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null_right' => 'View/link unlinked services' + ), +}) or die "Unknown svcnum ".$arg{'svcnum'}." in svc_broadband table\n"; + +my @part_export = $svc->cust_svc->part_svc->part_export('broadband_snmp_get'); + +my @result; +foreach my $part_export (@part_export) { + push @result, $part_export->snmp_results($svc); +} + + + + -- cgit v1.2.1