]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
ids.cgi: Prevent from chainging the provider when editing an existing
authorStefan Schantl <stefan.schantl@ipfire.org>
Thu, 1 Apr 2021 13:48:44 +0000 (15:48 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 19 Dec 2021 12:23:42 +0000 (13:23 +0100)
one.

This commit locks the dropdown menu for selecting a provider, in case
an existing one should be edited.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/ids.cgi

index c13a4874c3f9c1ca963cea67fa6be3549d4ee9e2..ec92c0f9673430f6884c79ca690819095a1a820a 100644 (file)
@@ -1621,9 +1621,21 @@ print <<END
                        <tr>
                                <td width='40%'>
                                        <input type='hidden' name='ID' value='$cgiparams{'ID'}'>
-                                       <select name='PROVIDER' id='PROVIDER'>
 END
 ;
+                                       # Value to allow disabling the dropdown menu.
+                                       my $disabled;
+
+                                       # Check if we are in edit mode.
+                                       if ($cgiparams{'PROVIDERS'} eq "$Lang::tr{'edit'}") {
+                                               $disabled = "disabled";
+
+                                               # Add hidden input with the provider because the disable select does not provider
+                                               # this.
+                                               print "<input type='hidden' name='PROVIDER' value='$used_providers{$cgiparams{'ID'}}[0]'>\n";
+                                       }
+
+                                       print "<select name='PROVIDER' id='PROVIDER' $disabled>\n";
                                                # Loop through the array of ruleset providers.
                                                foreach my $provider (@ruleset_providers) {
                                                        # Get the provider name.