3 # Display entries from a policy file for editing
5 require './ipsec-lib.pl';
7 &ui_print_header(undef, $text{'policy_desc_'.$in{'policy'}} ||
8 &text('policy_desc', $in{'policy'}), "");
10 # Show explanation of this policy
11 print $text{'policy_longdesc_'.$in{'policy'}} ||
12 &text('policy_longdesc', $in{'policy'}),"<p>\n";
13 print "<form action=save_policy.cgi method=post>\n";
14 print "<input type=hidden name=policy value='$in{'policy'}'>\n";
16 @policies = &read_policy($in{'policy'});
17 $mode = !@policies ? 0 :
18 @policies == 1 && $policies[0] eq "0.0.0.0/0" ? 1 : 2;
20 printf "<input type=radio name=mode value=%s %s> %s\n",
21 $m, $mode == $m ? "checked" : "", $text{'policy_mode'.$m};
25 # Show a table of networks
26 print "<table border>\n";
27 print "<tr $tb> <td><b>$text{'policy_net'}</b></td> ",
28 "<td><b>$text{'policy_mask'}</b></td> </tr>\n";
30 foreach $p ($mode == 2 ? @policies : ( ), "", "") {
31 local ($n, $m) = split(/\//, $p);
33 print "<td><input name=net_$i size=20 value='$n'></td>\n";
34 print "<td><input name=mask_$i size=5 value='$m'></td>\n";
39 print "<input type=submit value='$text{'save'}'></form>\n";
41 &ui_print_footer("", $text{'index_return'});