Revision: 6931
          http://ipcop.svn.sourceforge.net/ipcop/?rev=6931&view=rev
Author:   dotzball
Date:     2013-02-16 15:51:35 +0000 (Sat, 16 Feb 2013)
Log Message:
-----------
Sort roadwarrior ip list.

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

Modified: ipcop/trunk/html/cgi-bin/openvpn.cgi
===================================================================
--- ipcop/trunk/html/cgi-bin/openvpn.cgi        2013-02-16 15:12:12 UTC (rev 
6930)
+++ ipcop/trunk/html/cgi-bin/openvpn.cgi        2013-02-16 15:51:35 UTC (rev 
6931)
@@ -1641,10 +1641,21 @@
     <td colspan='3'><select name='ROADWARRIORIP'>
 END
         ;
-        # TODO: sort on IP addresses
-        foreach my $rwip (sort keys %roadwarriorips) {
-            print "<option value='$rwip' $roadwarriorips{$rwip} 
>$rwip</option>";
-            }
+
+        my @rwipsunsorted =  keys %roadwarriorips;
+        my @rwips = sort {
+            my @a = $a =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
+            my @b = $b =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
+            $a[0] <=> $b[0]
+            || $a[1] <=> $b[1]
+            || $a[2] <=> $b[2]
+            || $a[3] <=> $b[3]
+
+        } @rwipsunsorted;
+
+        foreach my $rwip (@rwips) {
+            print "<option value='$rwip' $roadwarriorips{$rwip} 
>$rwip</option>\n";
+        }
         print <<END
         </select></td>
 </tr><tr>

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


------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, 
is your hub for all things parallel software development, from weekly thought 
leadership blogs to news, videos, case studies, tutorials, tech docs, 
whitepapers, evaluation guides, and opinion stories. Check out the most 
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to