From patchwork Mon Mar 6 17:04:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 6668 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4PVlLC3S8Cz3wfc for ; Mon, 6 Mar 2023 17:04:35 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4PVlL830dtzkg; Mon, 6 Mar 2023 17:04:32 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4PVlL81PrHz2yPS; Mon, 6 Mar 2023 17:04:32 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4PVlL54zYVz2xMT for ; Mon, 6 Mar 2023 17:04:29 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4PVlL45F0LzbV; Mon, 6 Mar 2023 17:04:28 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1678122268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=EdqQ4gD7xFgZPcq38pdwiLBvJXarqmNUfNUe0SQy2G4=; b=FIJYvC2EjiobtwGLcweY9DOHgGjZpVDskyWjnexzWW2brNNRwZx4LRajJh6mQxB/aRgoC+ bhj/2tDdcbkp6PDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1678122268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=EdqQ4gD7xFgZPcq38pdwiLBvJXarqmNUfNUe0SQy2G4=; b=tV+4GdH/fjHCrHUXFFyFD/EcK6WgCXyq00WpZvlxvqunALaSsHZ9bKgZBJc3MfXbW49/Id Lvr1Cov8gkFO6Us7dE6Z3QcvwiuE8rm1dRApAvnZzw21v8n/QGgKGzTRCWjxaJOjdg2XYx D9NDQ3ehvhQZzkNh0T8CMTxslxDXryzA1pNs8Jfa1kypfVNO20AqHy5gF0Xu4Z/xHJb9FW 7yXxO5QWVKw5URxjhn7cU8HLA2sdEgQaN3S6h485zvhEB6DdMiwmLwL/Q2cYp9yHzHT5zH zOPtcn+v03JrDgV/RvefAhw0BPTXKrKBbh+UD4syuoa6UdQosE24xW541JycPw== From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH 1/2] dhcp.cgi: Update to naming of variables in css section Date: Mon, 6 Mar 2023 18:04:23 +0100 Message-Id: <20230306170424.3447723-1-adolf.belka@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" - 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 copies of the same colour for rows, cells, columns etc I have simplified the variable names to just the colour. They can then be used in whatever situation is wanted. The rest 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 => 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 = 150; $Header::errormessage = ''; $Header::extraHead = < - .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; } - .cell-red { + .red { background-color: red; } 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) { } if ($dhcpsettings{'KEY1'} eq $key) { - print ""; + print ""; } elsif ($key % 2) { - print ""; + print ""; } else { - print ""; + print ""; } print <"; - $col="class='row-colouryellow'"; + $col="class='colouryellow'"; } elsif ($key % 2) { print ""; - $col="class='row-color20'"; + $col="class='color20'"; } else { print ""; - $col="class='row-color22'"; + $col="class='color22'"; } my $TAG0 = ''; my $TAG1 = ''; @@ -1100,10 +1100,10 @@ foreach my $line (@current2) { $TAG3 = ''; } if ($ipoutside{$temp[1]} > 0) { - $TAG4 = "class='cell-orange'" if ($dhcpsettings{'KEY2'} ne $key); + $TAG4 = "class='orange'" if ($dhcpsettings{'KEY2'} ne $key); } if ($ipinrange{$temp[1]} > 0) { - $TAG4 = "class='cell-red'" if ($dhcpsettings{'KEY2'} ne $key); + $TAG4 = "class='red'" if ($dhcpsettings{'KEY2'} ne $key); } print <     - $Lang::tr{'ip address outside subnets'} + $Lang::tr{'ip address outside subnets'}    - $Lang::tr{'dhcp fixed ip address in dynamic range'} + $Lang::tr{'dhcp fixed ip address in dynamic range'}     $dup