]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
ids.cgi: Sort elements in providers dropdown menu.
authorStefan Schantl <stefan.schantl@ipfire.org>
Mon, 5 Apr 2021 05:11:04 +0000 (07:11 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 19 Dec 2021 12:23:44 +0000 (13:23 +0100)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/ids.cgi

index 8ee16930a3bceedc56a98187311207d111d24b57..0f039c33c3da39e7fddbaf8bef45414926d18fe3 100644 (file)
@@ -1748,10 +1748,23 @@ END
                                        }
 
                                        print "<select name='PROVIDER' id='PROVIDER' $disabled>\n";
+                                               # Temporary hash to store the provier names and their handles.
+                                               my %tmphash = ();
+
                                                # Loop through the array of ruleset providers.
-                                               foreach my $provider (@ruleset_providers) {
+                                               foreach my $handle (@ruleset_providers) {
                                                        # Get the provider name.
-                                                       my $provider_name = &get_provider_name($provider);
+                                                       my $name = &get_provider_name($handle);
+
+                                                       # Add the grabbed provider  name and handle to the
+                                                       # temporary hash.
+                                                       $tmphash{$name} = "$handle";
+                                               }
+
+                                               # Sort and loop through the temporary hash.
+                                               foreach my $provider_name ( sort keys %tmphash ) {
+                                                       # Grab the provider handle.
+                                                       my $provider = $tmphash{$provider_name};
 
                                                        # Pre-select the provider if one is given.
                                                        if (($used_providers{$cgiparams{'ID'}}[0] eq "$provider") || ($cgiparams{'PROVIDER'} eq "$provider")) {