missing commit from nms auto-addition fixdes, RT#15536
[freeside.git] / httemplate / misc / process / nms-add_router.html
index a77d897..c3b42a8 100644 (file)
@@ -1,4 +1,7 @@
-<% header('Router added') %>
+<& /elements/header-popup.html, 'Router added' &>
+  <SCRIPT TYPE="text/javascript">
+    window.top.location.reload();
+  </SCRIPT>
 </BODY></HTML>
 <%init>
 
@@ -6,12 +9,13 @@ die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('Configure network monitoring');
 
 my $host = $cgi->param('host'); 
-die 'invalid host' unless $host =~ /^[0-9.a-zA-Z\-]+$/;
+errorpage_popup('invalid host') unless $host =~ /^[0-9.a-zA-Z\-]+$/;
 
 my $community = $cgi->param('community'); 
-die 'invalid SNMP community string' unless $community =~ /^[0-9.a-zA-Z\-]*$/;
+errorpage_popup('invalid SNMP community string') unless $community =~ /^[0-9.a-zA-Z\-]*$/;
 
 my $nms = new FS::NetworkMonitoringSystem;
-$nms->add_router($host,$community);
+my $error = $nms->add_router($host,$community);
+errorpage_popup($error) if $error;
 
 </%init>