torrus, add router UI, RT10574
authorlevinse <levinse>
Sat, 5 Feb 2011 06:32:36 +0000 (06:32 +0000)
committerlevinse <levinse>
Sat, 5 Feb 2011 06:32:36 +0000 (06:32 +0000)
httemplate/misc/nms-add_router.html [new file with mode: 0644]
httemplate/misc/process/nms-add_iface.html
httemplate/misc/process/nms-add_router.html [new file with mode: 0644]
torrus/perllib/Torrus/Renderer/HTML.pm
torrus/templates/default-dir.html

diff --git a/httemplate/misc/nms-add_router.html b/httemplate/misc/nms-add_router.html
new file mode 100644 (file)
index 0000000..35ef7bf
--- /dev/null
@@ -0,0 +1,17 @@
+<% header('Add Router') %>
+
+<FORM NAME="nms-add_iface" ACTION="<% popurl(1) %>process/nms-add_router.html" METHOD=POST>
+Router Hostname/IP 
+<% include('/elements/input-text.html',
+                   'field' => 'host',
+         )
+%>
+<BR>
+<INPUT TYPE="submit" NAME="submit" ID="submit_nms-add_router" VALUE="Add Router">
+</FORM>
+
+<%init>
+
+# XXX: access rights, disable/enable submit button, something's wrong with style
+
+</%init>
index ffc70d9..04d6095 100644 (file)
@@ -13,9 +13,6 @@ die 'invalid iface' unless $iface =~ /^[0-9A-Za-z_\-.\\\/ ]+$/;
 my $serviceid = $cgi->param('serviceid');
 die 'invalid serviceid' unless $serviceid =~ /^[0-9A-Za-z_\-.\\\/ ]+$/;
   
-my $conf = new FS::Conf;
-my $system = $conf->config('network_monitoring_system');
-
 my $nms = new FS::NetworkMonitoringSystem;
 $nms->add_interface($host,$iface,$serviceid);
 
diff --git a/httemplate/misc/process/nms-add_router.html b/httemplate/misc/process/nms-add_router.html
new file mode 100644 (file)
index 0000000..bc437d2
--- /dev/null
@@ -0,0 +1,13 @@
+<% header('Router added') %>
+</BODY></HTML>
+<%init>
+
+# XXX: access rights
+
+my $host = $cgi->param('host'); 
+die 'invalid host' unless $host =~ /^[0-9.a-zA-Z\-]+$/;
+
+my $nms = new FS::NetworkMonitoringSystem;
+$nms->add_router($host);
+
+</%init>
index d4a2a13..4001bae 100644 (file)
@@ -14,7 +14,7 @@
 #  along with this program; if not, write to the Free Software
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
 
-# $Id: HTML.pm,v 1.5 2011-01-28 02:49:15 levinse Exp $
+# $Id: HTML.pm,v 1.6 2011-02-05 06:32:36 levinse Exp $
 # Stanislav Sinyagin <ssinyagin@yahoo.com>
 
 package Torrus::Renderer::HTML;
@@ -134,6 +134,15 @@ sub render_html
                                                 'actionlabel' => 'Monitor interface',
                                            );
                                   }
+                                  elsif($type eq 'nms-add_router.html') {
+                                       return
+                                           $self->freesideComponent('/elements/popup_link.html',
+                                               'action' => "/freeside/misc/$type",
+                                                'label' => 'Add Router',
+                                                'actionlabel' => 'Add Router',
+                                           );
+                                  }
+
                                   '';
                                },
 
index 91e6e44..db18212 100644 (file)
@@ -7,6 +7,10 @@
 [% IF matches(thepath,'Interface_Counters/$') %]
    [% freesideComponent('/elements/init_overlib.html') %]
 [% END %]
+[% IF matches(thepath,'Routers/$') %]
+   [% freesideComponent('/elements/init_overlib.html') %]
+   [% popup_link('nms-add_router.html') %]
+[% END %]
 
 <P>Directories you can jump to:</P>
 <DIV CLASS="Listing">