torrus, RT10574
authorlevinse <levinse>
Fri, 28 Jan 2011 02:49:15 +0000 (02:49 +0000)
committerlevinse <levinse>
Fri, 28 Jan 2011 02:49:15 +0000 (02:49 +0000)
httemplate/misc/nms-add_iface.html [new file with mode: 0644]
torrus/perllib/Torrus/Renderer/HTML.pm
torrus/templates/default-dir.html

diff --git a/httemplate/misc/nms-add_iface.html b/httemplate/misc/nms-add_iface.html
new file mode 100644 (file)
index 0000000..ab4cb17
--- /dev/null
@@ -0,0 +1,24 @@
+Adding interface <B><% $iface %></B> for <B><% $host %></B>
+<BR>
+
+<FORM NAME="nms-add_iface" ACTION="<% popurl(1) %>process/nms-add_iface.html" METHOD=POST>
+Torrus Service Id
+<% include('/elements/input-text.html',
+                   'field' => 'serviceid',
+         )
+%>
+<BR>
+<INPUT TYPE="submit" NAME="submit" ID="submit_nms-add_iface" VALUE="Add Interface">
+</FORM>
+
+<%init>
+
+# XXX: access rights, disable/enable submit button, something's wrong with style
+
+my $host = $cgi->param('host'); 
+die 'invalid host' unless $host =~ /^[0-9.a-zA-Z\-]+$/;
+
+my $iface = $cgi->param('iface');
+die 'invalid iface' unless $iface =~ /^[0-9A-Za-z_]+$/;
+
+</%init>
index 4dde8e0..d4a2a13 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.4 2011-01-25 03:15:03 ivan Exp $
+# $Id: HTML.pm,v 1.5 2011-01-28 02:49:15 levinse Exp $
 # Stanislav Sinyagin <ssinyagin@yahoo.com>
 
 package Torrus::Renderer::HTML;
@@ -119,6 +119,23 @@ sub render_html
         'freesideFooter' => sub { return $self->freesideFooter(); },
         'freesideComponent' => sub { return $self->freesideComponent(@_); },
         'uri_escape'        => sub { return uri_escape(@_); },
+       'matches'        => sub { return $_[0] =~ $_[1]; },
+       'popup_link'     => sub {  
+                                  my $type = shift;
+
+                                  if($type eq 'nms-add_iface.html') {
+                                      my $host = shift;
+                                      my $iface = shift;
+                                       return
+                                           $self->freesideComponent('/elements/popup_link.html',
+                                               'action' => "/freeside/misc/".
+                                                       $type."?host=$host;iface=$iface",
+                                                'label' => 'Monitor for billing',
+                                                'actionlabel' => 'Monitor interface',
+                                           );
+                                  }
+                                  '';
+                               },
 
     };
     
index 4b653be..fe13a9b 100644 (file)
@@ -1,8 +1,13 @@
 [% PROCESS 'html-incblocks.txt' %]
+[% thepath=path(token) %]
 [% INCLUDE htmlstart title=xmlnorm(nodeParam(token,'comment')) printpath=1 %]
 
 [% INCLUDE legend %]
 
+[% IF matches(thepath,'Interface_Counters/$') %]
+   [% freesideComponent('/elements/init_overlib.html') %]
+[% END %]
+
 <P>Directories you can jump to:</P>
 <DIV CLASS="Listing">
 [%   hasLeaves = 0; hasSubtrees = 0;
@@ -39,6 +44,9 @@
       <A HREF="[%url(child)%]"[%urlTitle%]>[% nodeName(child) %]</A>
       [% hidden ? '</EM>':'';
          thisIsAlias ? '</EM>':''; %]
+      [% IF matches(thepath,'Interface_Counters/$') %]
+        [% popup_link('nms-add_iface.html',nodeName(parent(token)),uri_escape(nodeName(child))) %]
+      [% END %]
     </SPAN>
        [% IF comment %]
     <SPAN CLASS="NodeDescr">