diff options
author | levinse <levinse> | 2011-02-07 05:20:41 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-02-07 05:20:41 +0000 |
commit | 8c37ba9a0caeffdbe133968750f5b4d1e7b7fb69 (patch) | |
tree | faa7322e969cc71cdeae57b2eaf619689e28d3eb /torrus | |
parent | 3a4bf42c4385863ea83423b279b39ff6e650f79d (diff) |
torrus, UI, RT10574
Diffstat (limited to 'torrus')
-rw-r--r-- | torrus/perllib/Torrus/Freeside.pm | 7 | ||||
-rw-r--r-- | torrus/perllib/Torrus/Renderer/HTML.pm | 19 | ||||
-rw-r--r-- | torrus/templates/default-dir.html | 29 |
3 files changed, 46 insertions, 9 deletions
diff --git a/torrus/perllib/Torrus/Freeside.pm b/torrus/perllib/Torrus/Freeside.pm index 359d544f0..239f55f1a 100644 --- a/torrus/perllib/Torrus/Freeside.pm +++ b/torrus/perllib/Torrus/Freeside.pm @@ -5,6 +5,7 @@ use warnings; #Freeside use FS::Mason qw( mason_interps ); +use FS::NetworkMonitoringSystem; my $outbuf; my( $fs_interp, $rt_interp ) = mason_interps('standalone', 'outbuf'=>\$outbuf); @@ -59,5 +60,11 @@ sub freesideComponent { } +sub load_nms { + my $self = shift; + my $nms = new FS::NetworkMonitoringSystem; + $nms; +} + 1; diff --git a/torrus/perllib/Torrus/Renderer/HTML.pm b/torrus/perllib/Torrus/Renderer/HTML.pm index 4001baeed..657f66f00 100644 --- a/torrus/perllib/Torrus/Renderer/HTML.pm +++ b/torrus/perllib/Torrus/Renderer/HTML.pm @@ -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.6 2011-02-05 06:32:36 levinse Exp $ +# $Id: HTML.pm,v 1.7 2011-02-07 05:20:41 levinse Exp $ # Stanislav Sinyagin <ssinyagin@yahoo.com> package Torrus::Renderer::HTML; @@ -120,12 +120,29 @@ sub render_html 'freesideComponent' => sub { return $self->freesideComponent(@_); }, 'uri_escape' => sub { return uri_escape(@_); }, 'matches' => sub { return $_[0] =~ $_[1]; }, + 'load_nms' => sub { return $self->load_nms; }, + 'get_serviceids' => sub { my $nms = shift; + my $router = shift; + return $nms->get_router_serviceids($router); + }, 'popup_link' => sub { my $type = shift; if($type eq 'nms-add_iface.html') { my $host = shift; my $iface = shift; + my $nms = shift; + my $serviceids = shift; + my $svc_port = ''; + + $svc_port = $nms->find_svc($serviceids->{$iface}) + if($serviceids && $serviceids->{$iface}); + + if($svc_port) { + my $url = $Torrus::Freeside::FSURL."/view/svc_port.cgi?".$svc_port->svcnum; + return "<A HREF='$url'>View Service</A>"; + } + return $self->freesideComponent('/elements/popup_link.html', 'action' => "/freeside/misc/". diff --git a/torrus/templates/default-dir.html b/torrus/templates/default-dir.html index db1821260..7eec26744 100644 --- a/torrus/templates/default-dir.html +++ b/torrus/templates/default-dir.html @@ -4,13 +4,26 @@ [% INCLUDE legend %] -[% 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 %] +[% + IF matches(thepath,'Interface_Counters/$'); + freesideComponent('/elements/init_overlib.html'); + nms = load_nms(); + router = nodeName(parent(token)); + serviceids = get_serviceids(nms,router); + END; + IF matches(thepath,'Interface_Counters/.*?/$'); + nms = load_nms(); + router = nodeName(parent(parent(token))); + serviceids = get_serviceids(nms,router); + + # HACK! this doesn't do what you think it does... + popup_link('nms-add_iface.html',router,uri_escape(nodeName(token)),nms,serviceids); + 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"> @@ -50,7 +63,7 @@ thisIsAlias ? '</EM>':''; %] [% IF matches(thepath,'Interface_Counters/$') %] <FONT SIZE="-1"> - [% popup_link('nms-add_iface.html',nodeName(parent(token)),uri_escape(nodeName(child))) %] + [% popup_link('nms-add_iface.html',router,uri_escape(nodeName(child)),nms,serviceids) %] </FONT> [% END %] </SPAN> |