From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH 1/2] dhcp.cgi: Update to naming of variables in css section Date: Mon, 06 Mar 2023 18:04:23 +0100 Message-ID: <20230306170424.3447723-1-adolf.belka@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4700370554318983364==" List-Id: --===============4700370554318983364== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable - After looking at other .cgi files I realised that I had named the variables= based on their dhcp usage only. However colouryellow or color20 etc can be used not= only in a row but also in a cell or a column. Rather than ending up with multiple co= pies of the same colour for rows, cells, columns etc I have simplified the variable na= mes to just the colour. They can then be used in whatever situation is wanted. The res= t of the cgi code will give the view of what structure the colour is being applied to. - This will limit the number of different css variables defined in the header= .pl file Tested-by: Adolf Belka Signed-off-by: Adolf Belka --- config/cfgroot/header.pl | 10 +++++----- html/cgi-bin/dhcp.cgi | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) mode change 100644 =3D> 100755 html/cgi-bin/dhcp.cgi diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl index cd56e574f..e4d917161 100644 --- a/config/cfgroot/header.pl +++ b/config/cfgroot/header.pl @@ -43,19 +43,19 @@ $Header::viewsize =3D 150; $Header::errormessage =3D ''; $Header::extraHead =3D < - .row-color20 { + .color20 { background-color: $color{'color20'}; } - .row-color22 { + .color22 { background-color: $color{'color22'}; } - .row-colouryellow { + .colouryellow { background-color: $Header::colouryellow; } - .cell-orange { + .orange { background-color: orange; }=09 - .cell-red { + .red { background-color: red; } =09 diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi old mode 100644 new mode 100755 index 28b00215c..f45703f0b --- a/html/cgi-bin/dhcp.cgi +++ b/html/cgi-bin/dhcp.cgi @@ -844,11 +844,11 @@ foreach my $line (@current1) { } =20 if ($dhcpsettings{'KEY1'} eq $key) { - print ""; + print ""; } elsif ($key % 2) { - print ""; + print ""; } else { - print ""; + print ""; } =20 print <"; - $col=3D"class=3D'row-colouryellow'"; + $col=3D"class=3D'colouryellow'"; } elsif ($key % 2) { print ""; - $col=3D"class=3D'row-color20'"; + $col=3D"class=3D'color20'"; } else { print ""; - $col=3D"class=3D'row-color22'"; + $col=3D"class=3D'color22'"; } my $TAG0 =3D ''; my $TAG1 =3D ''; @@ -1100,10 +1100,10 @@ foreach my $line (@current2) { $TAG3 =3D ''; } if ($ipoutside{$temp[1]} > 0) { - $TAG4 =3D "class=3D'cell-orange'" if ($dhcpsettings{'KEY2'} ne $key); + $TAG4 =3D "class=3D'orange'" if ($dhcpsettings{'KEY2'} ne $key); } if ($ipinrange{$temp[1]} > 0) {=20 - $TAG4 =3D "class=3D'cell-red'" if ($dhcpsettings{'KEY2'} ne $key); + $TAG4 =3D "class=3D'red'" if ($dhcpsettings{'KEY2'} ne $key); } =20 print <     - $Lang::tr{'ip address outside subnets'} + $Lang::tr{'ip address outside subnets'}    - $Lang::tr{'dhcp fixed ip address in dyna= mic range'} + $Lang::tr{'dhcp fixed ip address in dynamic r= ange'}     $dup --=20 2.39.2 --===============4700370554318983364==--