~ubuntu-branches/ubuntu/quantal/netams/quantal

« back to all changes in this revision

Viewing changes to cgi-bin/admin/policy.cgi

  • Committer: Bazaar Package Importer
  • Author(s): Alexander GQ Gerasiov
  • Date: 2010-07-24 16:37:01 UTC
  • mfrom: (2.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100724163701-rni105xlqseqe26h
Tags: 3.4.5-2
* debian/Rules.make: Add -lcrypto to fix FTBFS with binutils-gold.
* debian/netams.postinst: Fix some sed magic in netams.conf
  processing.
* debian/control: Standards version updated.
* Vietnamese translation added. Closes: #576026. Thanks to Clytie
  Siddall.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/perl -w
2
2
#
3
 
# $Id: policy.cgi,v 1.10 2008-01-02 13:29:35 anton Exp $
 
3
# $Id: policy.cgi,v 1.12 2010-01-20 08:27:28 anton Exp $
4
4
 
5
5
$url="policy.cgi";
6
6
require "netams.cgi";
34
34
        }
35
35
        
36
36
        netams_send("show policy");
37
 
        $result=netams_read(); @p=split("\n", $result); shift @p;
38
 
        $num_policies=@p; $result.=$num_policies."\n";
39
 
 
40
 
        $p4 =  "<input type=hidden name=oid value=''><table border=1 cellpadding=3 cellspacing=0 width=100%><tr bgcolor=#e0e0e0><td colspan=2><b>$L_exist_pol</b></td></tr>\n";
41
 
 
42
 
        for ($i=0; $i<$num_policies; $i++) {
43
 
                $m=$p[$i];
44
 
                @m1=split(/ +/, $m);
45
 
                $pol_name{$m1[0]}=$m1[2];
46
 
                $pol_tgt{$m1[0]}=substr($m, 33);
47
 
                $result .="$m1[0] -- $m1[2] -- ".$pol_tgt{$m1[0]}."\n"; 
48
 
 
49
 
                $p4 .= "<tr><td bgcolor=#d0d0d0 align=center><u>$m1[0]</u></td>";
50
 
                $p4 .= "<td><u>$L_pol_name:</u><input type=text size=8 name=name_$m1[0] value=\"$m1[2]\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
51
 
                $p4 .= "<u>$L_pol_rule:</u> <input type=text name=tgt_$m1[0] value=\"".$pol_tgt{$m1[0]}."\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
52
 
                $p4 .= "<input type=hidden name=action value=update>";
53
 
                $p4 .= "<input type=submit value=\"$L_Btn_set\" name=set onclick='admintool.oid.value=\"$m1[0]\";'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
54
 
                $p4 .= "<input type=submit value=\"$L_Btn_delete\" name=delete onclick='admintool.oid.value=\"$m1[0]\";'></td></tr>";
 
37
        #   OID    |            NAME | PARAMS              
 
38
        #   03044D |              ip | target: proto ip
 
39
        @res=netams_readarray(); 
 
40
        $result.="policy count: ".(scalar(@res)-1)."\n";
 
41
        $p4 .=  "<input type=hidden name=oid value=''><table border=1 cellpadding=3 cellspacing=0 width=100%><tr bgcolor=#e0e0e0><td colspan=2><b>$L_exist_pol</b></td></tr>\n";
 
42
        foreach (@res)
 
43
        {
 
44
                $result." $_\n";
 
45
                #@p=split("\s+|\s+", $_); shift @p;
 
46
                #$num_policies=scalar(@p); #$result.="policy count: $num_policies\n";
 
47
 
 
48
                #for ($i=0; $i<$num_policies; $i++)
 
49
                #{
 
50
                        #$m=$p[$i];
 
51
                        @m1=split(/\s+\|\s+/, $_);
 
52
                if (@m1[0]!~m|OID|)
 
53
                {
 
54
                        $pol_name{$m1[0]}=$m1[1];
 
55
                        $pol_tgt{$m1[0]}=$m1[2];
 
56
                        $result .="<dl><dt>oid: $m1[0]<dd>name: $pol_name{$m1[0]}<dd>target: $pol_tgt{$m1[0]}</dl>\n"; 
 
57
                        $p4 .= "<tr><td bgcolor=#d0d0d0 align=center><u>$m1[0]</u></td>";
 
58
                        $p4 .= "<td><u>$L_pol_name:</u><input type=text size=8 name=name_$m1[0] value=\"$pol_name{$m1[0]}\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
 
59
                        $p4 .= "<u>$L_pol_rule:</u> <input type=text name=tgt_$m1[0] value=\"".$pol_tgt{$m1[0]}."\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
 
60
                        $p4 .= "<input type=hidden name=action value=update>";
 
61
                        $p4 .= "<input type=submit value=\"$L_Btn_set\" name=set onclick='admintool.oid.value=\"$m1[0]\";'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
 
62
                        $p4 .= "<input type=submit value=\"$L_Btn_delete\" name=delete onclick='admintool.oid.value=\"$m1[0]\";'></td></tr>";
 
63
                }
 
64
                #}
55
65
        }
56
66
 
57
67
        $p4 .= "<tr bgcolor=#e0e0e0><td colspan=2><b>$L_add_pol</b></td></tr>\n";