Re-design access control page to use tabs
authorJamie Cameron <jcameron@webmin.com>
Fri, 23 Nov 2007 23:15:38 +0000 (23:15 +0000)
committerJamie Cameron <jcameron@webmin.com>
Fri, 23 Nov 2007 23:15:38 +0000 (23:15 +0000)
18 files changed:
squid/CHANGELOG
squid/acl.cgi
squid/acl_save.cgi
squid/delete_http_accesses.cgi
squid/delete_http_reply_accesses.cgi
squid/delete_icp_accesses.cgi
squid/edit_acl.cgi
squid/edit_ext.cgi
squid/http_access.cgi
squid/http_access_save.cgi
squid/http_reply_access.cgi
squid/http_reply_access_save.cgi
squid/icp_access.cgi
squid/icp_access_save.cgi
squid/move_http.cgi
squid/move_http_reply.cgi
squid/move_icp.cgi
squid/save_ext.cgi

index 09af7db..830bf65 100644 (file)
@@ -18,3 +18,4 @@ Added support for Squid 2.6, including the new logformat and access_log directiv
 Fixed transparent proxy setup in Squid 2.6.
 ---- Changes since 1.380 ----
 Added support for editing proxy reply restrictions, thanks to Steve Williams.
+Re-design the Access Control page to use tabs, to better split up the lists of ACLs, HTTP and ICP restrictions.
index 71ec510..9f3f5ff 100755 (executable)
@@ -350,6 +350,6 @@ print "<input type=submit value=$text{'acl_buttsave'}>\n";
 if (!$in{'type'}) { print "<input type=submit value=$text{'acl_buttdel'} name=delete>\n"; }
 print "</form>\n";
 
-&ui_print_footer("edit_acl.cgi", $text{'acl_return'},
-       "", $text{'index_return'});
+&ui_print_footer("edit_acl.cgi?mode=acls", $text{'acl_return'},
+                "", $text{'index_return'});
 
index 48df240..0ee78f1 100755 (executable)
@@ -246,5 +246,5 @@ else {
 &unlock_file($config{'squid_conf'});
 &webmin_log($in{'delete'} ? 'delete' : $acl ? 'modify' : 'create',
            'acl', $logacl->{'values'}->[0], \%in);
-&redirect("edit_acl.cgi");
+&redirect("edit_acl.cgi?mode=acls");
 
index 8f2bc05..1ac5cf9 100755 (executable)
@@ -24,5 +24,5 @@ foreach $d (sort { $b <=> $c } @d) {
 &flush_file_lines();
 &unlock_file($config{'squid_conf'});
 &webmin_log("delete", "https", scalar(@d));
-&redirect("edit_acl.cgi");
+&redirect("edit_acl.cgi?mode=http");
 
index acc7814..b9cffa9 100644 (file)
@@ -24,4 +24,4 @@ foreach $d (sort { $b <=> $c } @d) {
 &flush_file_lines();
 &unlock_file($config{'squid_conf'});
 &webmin_log("delete", "http_replies", scalar(@d));
-&redirect("edit_acl.cgi");
+&redirect("edit_acl.cgi?mode=reply");
index 4a5ce13..6b01366 100755 (executable)
@@ -24,5 +24,5 @@ foreach $d (sort { $b <=> $c } @d) {
 &flush_file_lines();
 &unlock_file($config{'squid_conf'});
 &webmin_log("delete", "icps", scalar(@d));
-&redirect("edit_acl.cgi");
+&redirect("edit_acl.cgi?mode=icp");
 
index deadeff..9de18bc 100755 (executable)
@@ -3,17 +3,26 @@
 # Display a list of all ACLs and restrictions using them
 
 require './squid-lib.pl';
+&ReadParse();
 $access{'actrl'} || &error($text{'eacl_ecannot'});
 &ui_print_header(undef, $text{'eacl_header'}, "", "edit_acl", 0, 0, 0, &restart_button());
-
 $conf = &get_config();
-print "<table border cellpadding=5 width=100%><tr>\n";
-print "<td rowspan=2 valign=top width=50%>\n";
+
+# Start tabs for various ACL settings
+$prog = "edit_acl.cgi";
+@tabs = ( [ "acls", $text{'eacl_acls'}, $prog."?mode=acls" ],
+         [ "http", $text{'eacl_pr'}, $prog."?mode=http" ],
+         [ "icp", $text{'eacl_icpr'}, $prog."?mode=icp" ] );
+if ($squid_version >= 2.5) {
+       push(@tabs, [ "external", $text{'eacl_ext'}, $prog."?mode=external" ],
+                   [ "reply", $text{'eacl_replypr'}, $prog."?mode=reply" ] );
+       }
+print &ui_tabs_start(\@tabs, "mode", $in{'mode'} || "acls", 1);
 
 # List all defined access control directives
+print &ui_tabs_start_tab("mode", "acls");
 @acl = &find_config("acl", $conf);
 if (@acl) {
-       print &ui_subheading($text{'eacl_acls'});
        print &ui_columns_start([ $text{'eacl_name'},
                                  $text{'eacl_type'},
                                  $text{'eacl_match'} ], 100);
@@ -43,13 +52,12 @@ foreach $t (sort { $acl_types{$a} cmp $acl_types{$b} } keys %acl_types) {
        print "<option value=$t>$acl_types{$t}\n";
        }
 print "</select></form>\n";
-
-print "</td><td valign=top width=50%>\n";
+print &ui_tabs_end_tab();
 
 # List all HTTP restrictions, based on ACLs
+print &ui_tabs_start_tab("mode", "http");
 @http = &find_config("http_access", $conf);
 if (@http) {
-       print &ui_subheading($text{'eacl_pr'});
        @tds = ( "width=5", "width=10%", undef, "width=32" );
        print &ui_form_start("delete_http_accesses.cgi", "post");
        print "<a href=http_access.cgi?new=1>$text{'eacl_addpr'}</a><br>\n";
@@ -97,14 +105,66 @@ else {
        print "<b>$text{'eacl_nopr'}</b><p>\n";
        print "<a href=http_access.cgi?new=1>$text{'eacl_addpr'}</a><br>\n";
        }
+print &ui_tabs_end_tab();
 
-print "</td></tr><tr><td valign=top width=50%>\n";
+# List all ICP restrictions, based on ACLs
+print &ui_tabs_start_tab("mode", "icp");
+@icp = &find_config("icp_access", $conf);
+if (@icp) {
+       print &ui_form_start("delete_icp_accesses.cgi", "post");
+       @tds = ( "width=5", "width=10%", undef, "width=32" );
+       print "<a href=icp_access.cgi?new=1>$text{'eacl_addicpr'}</a><br>\n";
+       print &ui_columns_start([ "",
+                                 $text{'eacl_act'},
+                                 $text{'eacl_acls1'},
+                                 $text{'eacl_move'} ], 100, 0, \@tds);
+       $ic = 0;
+       foreach $i (@icp) {
+               @v = @{$i->{'values'}};
+               if ($v[0] eq "allow") {
+                       $v[0] = $text{'eacl_allow'};
+                       }
+               else {
+                       $v[0] = $text{'eacl_deny'};
+                       }
+               local @cols;
+               push(@cols, "<a href=\"icp_access.cgi?index=$i->{'index'}\">".
+                           "$v[0]</a>");
+               push(@cols, &html_escape(join(' ', @v[1..$#v])));
+               local $mover;
+               if ($hc != @icp-1) {
+                       $mover .= "<a href=\"move_icp.cgi?$hc+1\">".
+                                 "<img src=images/down.gif border=0></a>";
+                       }
+               else {
+                       $mover .= "<img src=images/gap.gif>";
+                       }
+               if ($hc != 0) {
+                       $mover .= "<a href=\"move_icp.cgi?$hc+-1\">".
+                                 "<img src=images/up.gif border=0></a>";
+                       }
+               else {
+                       $mover .= "<img src=images/gap.gif>";
+                       }
+               push(@cols, $mover);
+               print &ui_checked_columns_row(\@cols, \@tds, "d",$i->{'index'});
+               $ic++;
+               }
+       print &ui_columns_end();
+       print "<a href=icp_access.cgi?new=1>$text{'eacl_addicpr'}</a><br>\n";
+       print &ui_form_end([ [ "delete", $text{'eacl_hdelete'} ] ]);
+       }
+else {
+       print "<b>$text{'eacl_noicpr'}</b><p>\n";
+       print "<a href=icp_access.cgi?new=1>$text{'eacl_addicpr'}</a><br>\n";
+       }
+print &ui_tabs_end_tab();
 
 # List all HTTP REPLY restrictions, based on ACLs
 if ($squid_version >= 2.5) {
+       print &ui_tabs_start_tab("mode", "reply");
        @http_reply = &find_config("http_reply_access", $conf);
        if (@http_reply) {
-               print &ui_subheading($text{'eacl_replypr'});
                @tds = ( "width=5", "width=10%", undef, "width=32" );
                print &ui_form_start("delete_http_reply_accesses.cgi", "post");
                print "<a href=http_reply_access.cgi?new=1>$text{'eacl_addpr'}</a><br>\n";
@@ -152,68 +212,12 @@ if ($squid_version >= 2.5) {
                print "<b>$text{'eacl_noprr'}</b><p>\n";
                print "<a href=http_reply_access.cgi?new=1>$text{'eacl_addprr'}</a><br>\n";
                }
+       print &ui_tabs_end_tab();
        }
 
-print "</td></tr><tr><td valign=top width=50%>\n";
-
-# List all ICP restrictions, based on ACLs
-@icp = &find_config("icp_access", $conf);
-if (@icp) {
-       print &ui_subheading($text{'eacl_icpr'});
-       print &ui_form_start("delete_icp_accesses.cgi", "post");
-       @tds = ( "width=5", "width=10%", undef, "width=32" );
-       print "<a href=icp_access.cgi?new=1>$text{'eacl_addicpr'}</a><br>\n";
-       print &ui_columns_start([ "",
-                                 $text{'eacl_act'},
-                                 $text{'eacl_acls1'},
-                                 $text{'eacl_move'} ], 100, 0, \@tds);
-       $ic = 0;
-       foreach $i (@icp) {
-               @v = @{$i->{'values'}};
-               if ($v[0] eq "allow") {
-                       $v[0] = $text{'eacl_allow'};
-                       }
-               else {
-                       $v[0] = $text{'eacl_deny'};
-                       }
-               local @cols;
-               push(@cols, "<a href=\"icp_access.cgi?index=$i->{'index'}\">".
-                           "$v[0]</a>");
-               push(@cols, &html_escape(join(' ', @v[1..$#v])));
-               local $mover;
-               if ($hc != @icp-1) {
-                       $mover .= "<a href=\"move_icp.cgi?$hc+1\">".
-                                 "<img src=images/down.gif border=0></a>";
-                       }
-               else {
-                       $mover .= "<img src=images/gap.gif>";
-                       }
-               if ($hc != 0) {
-                       $mover .= "<a href=\"move_icp.cgi?$hc+-1\">".
-                                 "<img src=images/up.gif border=0></a>";
-                       }
-               else {
-                       $mover .= "<img src=images/gap.gif>";
-                       }
-               push(@cols, $mover);
-               print &ui_checked_columns_row(\@cols, \@tds, "d",$i->{'index'});
-               $ic++;
-               }
-       print &ui_columns_end();
-       print "<a href=icp_access.cgi?new=1>$text{'eacl_addicpr'}</a><br>\n";
-       print &ui_form_end([ [ "delete", $text{'eacl_hdelete'} ] ]);
-       }
-else {
-       print "<b>$text{'eacl_noicpr'}</b><p>\n";
-       print "<a href=icp_access.cgi?new=1>$text{'eacl_addicpr'}</a><br>\n";
-       }
-
-print "</td></tr>\n";
-
 if ($squid_version >= 2.5) {
        # Show table of external ACL types
-       print "<tr> <td colspan=2>\n";
-       print &ui_subheading($text{'eacl_ext'});
+       print &ui_tabs_start_tab("mode", "external");
        @ext = &find_config("external_acl_type", $conf);
        if (@ext) {
                print &ui_columns_start([ $text{'eacl_cname'},
@@ -234,10 +238,10 @@ if ($squid_version >= 2.5) {
                print "<b>$text{'eacl_noext'}</b><p>\n";
                }
        print "<a href=edit_ext.cgi?new=1>$text{'eacl_addext'}</a>\n";
-       print "</td> </tr>\n";
+       print &ui_tabs_end_tab();
        }
 
-print "</table><p>\n";
+print &ui_tabs_end(1);
 
 &ui_print_footer("", $text{'eacl_return'});
 
index 43f2e63..b5888cf 100755 (executable)
@@ -53,5 +53,5 @@ print "<input type=submit name=delete value='$text{'delete'}'>\n"
        if (!$in{'new'});
 print "</form>\n";
 
-&ui_print_footer("edit_acl.cgi", $text{'acl_return'});
+&ui_print_footer("edit_acl.cgi?mode=external", $text{'acl_return'});
 
index 94a6fdd..080d7e0 100755 (executable)
@@ -60,6 +60,6 @@ if (@http) {
        }
 print "</form>\n";
 
-&ui_print_footer("edit_acl.cgi", $text{'ahttp_return'},
-       "", $text{'index_return'});
+&ui_print_footer("edit_acl.cgi?mode=http", $text{'ahttp_return'},
+                "", $text{'index_return'});
 
index 83c6ef4..5a8f7f5 100755 (executable)
@@ -30,5 +30,5 @@ else {
 &flush_file_lines();
 &unlock_file($config{'squid_conf'});
 &webmin_log($in{'delete'} ? 'delete' : $http ? 'modify' : 'create', "http");
-&redirect("edit_acl.cgi");
+&redirect("edit_acl.cgi?mode=http");
 
index 52b8d71..af0c30b 100644 (file)
@@ -60,6 +60,6 @@ if (@http) {
        }
 print "</form>\n";
 
-&ui_print_footer("edit_acl.cgi", $text{'ahttp_return'},
-       "", $text{'index_return'});
+&ui_print_footer("edit_acl.cgi?mode=reply", $text{'ahttp_return'},
+                "", $text{'index_return'});
 
index 8f229b7..42db573 100644 (file)
@@ -30,5 +30,5 @@ else {
 &flush_file_lines();
 &unlock_file($config{'squid_conf'});
 &webmin_log($in{'delete'} ? 'delete' : $http ? 'modify' : 'create', "http");
-&redirect("edit_acl.cgi");
+&redirect("edit_acl.cgi?mode=reply");
 
index 7587f89..3eb34aa 100755 (executable)
@@ -60,6 +60,6 @@ if (@icp) {
        }
 print "</form>\n";
 
-&ui_print_footer("edit_acl.cgi", $text{'aicp_return'},
-       "", $text{'index_return'});
+&ui_print_footer("edit_acl.cgi?mode=icp", $text{'aicp_return'},
+                "", $text{'index_return'});
 
index 954b8fa..8d328e2 100755 (executable)
@@ -30,5 +30,5 @@ else {
 &flush_file_lines();
 &unlock_file($config{'squid_conf'});
 &webmin_log($in{'delete'} ? 'delete' : $icp ? 'modify' : 'create', "icp");
-&redirect("edit_acl.cgi");
+&redirect("edit_acl.cgi?mode=icp");
 
index 25ff6c2..1c23223 100755 (executable)
@@ -17,4 +17,4 @@ $https[$newpos]->{'values'} = $oldv;
 &flush_file_lines();
 &unlock_file($config{'squid_conf'});
 &webmin_log("move", "http");
-&redirect("edit_acl.cgi");
+&redirect("edit_acl.cgi?mode=http");
index 80c7e57..e116cdc 100644 (file)
@@ -17,4 +17,4 @@ $http_relies[$newpos]->{'values'} = $oldv;
 &flush_file_lines();
 &unlock_file($config{'squid_conf'});
 &webmin_log("move", "http");
-&redirect("edit_acl.cgi");
+&redirect("edit_acl.cgi?mode=reply");
index 5cd0df8..0401e62 100755 (executable)
@@ -17,4 +17,4 @@ $icps[$newpos]->{'values'} = $oldv;
 &flush_file_lines();
 &unlock_file($config{'squid_conf'});
 &webmin_log("move", "icp");
-&redirect("edit_acl.cgi");
+&redirect("edit_acl.cgi?mode=icp");
index 115aea7..27c710b 100755 (executable)
@@ -65,5 +65,5 @@ else {
 &unlock_file($config{'squid_conf'});
 &webmin_log($in{'delete'} ? 'delete' : $ext ? 'modify' : 'create',
            'ext', $logext->{'values'}->[0]);
-&redirect("edit_acl.cgi");
+&redirect("edit_acl.cgi?mode=external");