Revision: 6498
          http://ipcop.svn.sourceforge.net/ipcop/?rev=6498&view=rev
Author:   dotzball
Date:     2012-03-20 05:46:18 +0000 (Tue, 20 Mar 2012)
Log Message:
-----------
Reorder blacklist categories.

Modified Paths:
--------------
    ipcop/trunk/html/cgi-bin/urlfilter.cgi

Modified: ipcop/trunk/html/cgi-bin/urlfilter.cgi
===================================================================
--- ipcop/trunk/html/cgi-bin/urlfilter.cgi      2012-03-19 06:39:19 UTC (rev 
6497)
+++ ipcop/trunk/html/cgi-bin/urlfilter.cgi      2012-03-20 05:46:18 UTC (rev 
6498)
@@ -1281,14 +1281,29 @@
         ;
     }
     else {
-        for ($n = 0; $n <= @categories; $n = $n + $i) {
-            for ($i = 0; $i <= 3; $i++) {
-                if ($i eq 0) {
-                    print "<tr>\n";
-                }
-                if (($n + $i) < @categories) {
-                    my $name = $categories[$n+$i];
-                    my $category = $filtergroups[$n+$i];
+
+        my $count = @categories;
+
+        my $quaterCount = 0;
+
+        # if count is a multiple of four its easy, if it is not a multiple we 
have to tricks a bit
+        if($count % 4 == 0) {
+            $quaterCount = $count / 4;
+        }
+        else {
+            $quaterCount = ($count + 4 - ($count % 4) ) / 4;
+        }
+
+        for (my $row = 0; $row < $quaterCount; $row++) {
+            print "<tr>\n";
+
+            for (my $col = 0; $col <= 3; $col++) {
+                my $id = ($quaterCount * $col) + $row;
+
+                if(defined($categories[$id])) {
+                    my $name = $categories[$id];
+                    my $category = $filtergroups[$id];
+
                     my $checked = '';
                     if(defined($filtersettings{$category}) && 
$filtersettings{$category} eq 'on') {
                         $checked = "checked='checked'";
@@ -1296,10 +1311,12 @@
                     print "<td width='15%'>$name:<\/td>\n";
                     print "<td width='10%'><input type='checkbox' 
name='$category' $checked /></td>\n";
                 }
-                if ($i eq 3) {
-                    print "<\/tr>\n";
+                else
+                {
+                    print "<td width='25%' colspan='2'></td>\n";
                 }
             }
+            print "<\/tr>\n";
         }
     }
     print <<END

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to