* [PATCH 1/5] fwhosts.cgi: Show in which firewall rule objects are being used
@ 2025-06-23 17:16 Michael Tremer
2025-06-23 17:16 ` [PATCH 2/5] fwhosts.cgi: Remove whitespace issues Michael Tremer
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Michael Tremer @ 2025-06-23 17:16 UTC (permalink / raw)
To: development; +Cc: dietzmann, Michael Tremer
From: Peer Dietzmann <dietzmann@brecht-schule.hamburg>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
doc/language_issues.en | 1 +
doc/language_issues.es | 1 +
doc/language_issues.fr | 1 +
doc/language_issues.it | 1 +
doc/language_issues.nl | 1 +
doc/language_issues.pl | 1 +
doc/language_issues.ru | 1 +
doc/language_issues.tr | 1 +
doc/language_missings | 7 +
html/cgi-bin/fwhosts.cgi | 368 +++++++++++++++++++++++++++++++++++++--
langs/de/cgi-bin/de.pl | 1 +
langs/en/cgi-bin/en.pl | 1 +
12 files changed, 375 insertions(+), 10 deletions(-)
diff --git a/doc/language_issues.en b/doc/language_issues.en
index 996572456..7d72fa99b 100644
--- a/doc/language_issues.en
+++ b/doc/language_issues.en
@@ -78,6 +78,7 @@ WARNING: untranslated string: TOS rule = TOS rule
WARNING: untranslated string: The class number does not match the specified interface. = The class number does not match the specified interface.
WARNING: untranslated string: The destination IP address is invalid. = The destination IP address is invalid.
WARNING: untranslated string: The source IP address is invalid. = The source IP address is invalid.
+WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: WakeOnLan = Wake On Lan
WARNING: untranslated string: a ca certificate with this name already exists = A CA certificate with this name already exists.
WARNING: untranslated string: a connection with this common name already exists = A connection with this common name already exists.
diff --git a/doc/language_issues.es b/doc/language_issues.es
index 68836302a..e90acf9d9 100644
--- a/doc/language_issues.es
+++ b/doc/language_issues.es
@@ -980,6 +980,7 @@ WARNING: translation string unused: zoneconf val vlan tag range error
WARNING: translation string unused: zoneconf val zoneslave amount error
WARNING: untranslated string: Captive ACTIVATE = unknown string
WARNING: untranslated string: Captive clients = unknown string
+WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: ca name must only contain characters and spaces = unknown string
WARNING: untranslated string: dns servers = DNS Servers
WARNING: untranslated string: enable disable client = unknown string
diff --git a/doc/language_issues.fr b/doc/language_issues.fr
index 80341a1c3..db91be7fe 100644
--- a/doc/language_issues.fr
+++ b/doc/language_issues.fr
@@ -959,6 +959,7 @@ WARNING: translation string unused: zoneconf val vlan amount assignment error
WARNING: translation string unused: zoneconf val vlan tag assignment error
WARNING: translation string unused: zoneconf val vlan tag range error
WARNING: translation string unused: zoneconf val zoneslave amount error
+WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: allowed subnets = Allowed Subnets
WARNING: untranslated string: bypassed = Bypassed
WARNING: untranslated string: ca name must only contain characters and spaces = unknown string
diff --git a/doc/language_issues.it b/doc/language_issues.it
index 4ec3545ba..facb0c256 100644
--- a/doc/language_issues.it
+++ b/doc/language_issues.it
@@ -932,6 +932,7 @@ WARNING: untranslated string: Captive vouchervalid = Allowed time for this coupo
WARNING: untranslated string: Captive wrong type = Uploaded file has wrong filetype
WARNING: untranslated string: MTU settings = MTU settings:
WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
+WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: access point name = Access Point Name
WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
WARNING: untranslated string: access point name is required = Access Point Name is required
diff --git a/doc/language_issues.nl b/doc/language_issues.nl
index 56c6dadf6..40710c698 100644
--- a/doc/language_issues.nl
+++ b/doc/language_issues.nl
@@ -932,6 +932,7 @@ WARNING: untranslated string: Captive vouchervalid = Allowed time for this coupo
WARNING: untranslated string: Captive wrong type = Uploaded file has wrong filetype
WARNING: untranslated string: MTU settings = MTU settings:
WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
+WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: access point name = Access Point Name
WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
WARNING: untranslated string: access point name is required = Access Point Name is required
diff --git a/doc/language_issues.pl b/doc/language_issues.pl
index 6ccb0a497..ef464100c 100644
--- a/doc/language_issues.pl
+++ b/doc/language_issues.pl
@@ -848,6 +848,7 @@ WARNING: untranslated string: MB read = MB read
WARNING: untranslated string: MB written = MB written
WARNING: untranslated string: MTU settings = MTU settings:
WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
+WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: access point name = Access Point Name
WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
WARNING: untranslated string: access point name is required = Access Point Name is required
diff --git a/doc/language_issues.ru b/doc/language_issues.ru
index 8a689daa7..d4f669b1b 100644
--- a/doc/language_issues.ru
+++ b/doc/language_issues.ru
@@ -843,6 +843,7 @@ WARNING: untranslated string: MB read = MB read
WARNING: untranslated string: MB written = MB written
WARNING: untranslated string: MTU settings = MTU settings:
WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
+WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: access point name = Access Point Name
WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
WARNING: untranslated string: access point name is required = Access Point Name is required
diff --git a/doc/language_issues.tr b/doc/language_issues.tr
index e79fe1388..f557f9a04 100644
--- a/doc/language_issues.tr
+++ b/doc/language_issues.tr
@@ -925,6 +925,7 @@ WARNING: translation string unused: year-graph
WARNING: translation string unused: yearly firewallhits
WARNING: untranslated string: Captive clients = unknown string
WARNING: untranslated string: Captive delete logo = Delete Logo
+WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: access point name = Access Point Name
WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
WARNING: untranslated string: access point name is required = Access Point Name is required
diff --git a/doc/language_missings b/doc/language_missings
index cd005f45a..8487c8a26 100644
--- a/doc/language_missings
+++ b/doc/language_missings
@@ -128,6 +128,7 @@
< dns servers
< ids provider eol
< online
+< Unused
############################################################################
# Checking cgi-bin translations for language: fr #
############################################################################
@@ -181,6 +182,7 @@
< system time
< timeformat
< total
+< Unused
< upload fcdsl.o
< warning
< wg
@@ -720,6 +722,7 @@
< unblock all
< uncheck all
< unlimited
+< Unused
< update ruleset
< updxlrtr passive mode
< uplink bit rate
@@ -1356,6 +1359,7 @@
< unblock all
< uncheck all
< unlimited
+< Unused
< update ruleset
< updxlrtr passive mode
< uplink bit rate
@@ -2398,6 +2402,7 @@
< unblock all
< uncheck all
< unlimited
+< Unused
< update ruleset
< updxlrtr passive mode
< updxlrtr sources
@@ -3486,6 +3491,7 @@
< unblock all
< uncheck all
< unlimited
+< Unused
< update ruleset
< updxlrtr passive mode
< updxlrtr sources
@@ -3975,6 +3981,7 @@
< traffic stat title
< transfers
< transport mode does not support vti
+< Unused
< update ruleset
< updxlrtr passive mode
< user management
diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi
index e92ef6853..6b4e22159 100644
--- a/html/cgi-bin/fwhosts.cgi
+++ b/html/cgi-bin/fwhosts.cgi
@@ -1932,7 +1932,7 @@ sub viewtablenet
}else{
print<<END;
<table width='100%' cellspacing='0' class='tbl'>
- <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
+ <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
END
}
my $count=0;
@@ -1952,7 +1952,14 @@ END
}
my $colnet="$customnetwork{$key}[1]/".&General::subtocidr($customnetwork{$key}[2]);
my $netcount=&getnetcount($customnetwork{$key}[0]);
- print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col>$netcount x</td>";
+ my $netusedin=&getusedin($customnetwork{$key}[0]);
+ my $htmlparttouse="";
+ if ($netusedin) {
+ $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$netusedin' title='$netusedin'>";
+ } else {
+ $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='Unused' title='Unused'>";
+ }
+ print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col>$netcount x</td><td>$htmlparttouse</td>";
print<<END;
<td width='1%' $col><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
<input type='hidden' name='ACTION' value='editnet'>
@@ -2086,7 +2093,7 @@ sub viewtablehost
}else{
print<<END;
<table width='100%' cellspacing='0' class='tbl'>
- <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
+ <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
END
}
my $count=0;
@@ -2106,7 +2113,14 @@ END
$customhost{$key}[4]=~s/\s+//g;
my $hostcount=0;
$hostcount=&gethostcount($customhost{$key}[0]);
- print"<td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >".&getcolor($ip)."</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col>$hostcount x</td>";
+ my $hostusedin=&getusedin($customhost{$key}[0]);
+ my $htmlparttouse="";
+ if ($hostusedin) {
+ $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$hostusedin' title='$hostusedin'>";
+ } else {
+ $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='Unused' title='Unused'>";
+ }
+ print"<td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >".&getcolor($ip)."</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col>$hostcount x</td><td>$htmlparttouse</td>";
print<<END;
<td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
<input type='hidden' name='ACTION' value='edithost' />
@@ -2182,7 +2196,13 @@ sub viewtablegrp
print "<br><b><u>$grpname</u></b> ";
print " <b>$Lang::tr{'remark'}:</b>  $remark   " if ($remark ne '');
my $netgrpcount=&getnetcount($grpname);
- print "<b>$Lang::tr{'used'}:</b> $netgrpcount x";
+ print "<b>$Lang::tr{'used'}:</b> $netgrpcount x ";
+ my $groupusedin=&getusedin($grpname);
+ if ($groupusedin) {
+ print "<input type='image' align='top' src='/images/info.gif' alt='$groupusedin' title='$groupusedin'>";
+ } else {
+ print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
+ }
if($netgrpcount == '0')
{
print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='grp_name' value='$grpname' ><input type='hidden' name='ACTION' value='delgrp'></form>";
@@ -2320,8 +2340,13 @@ sub viewtablelocationgrp
# Get group count.
my $locationgrpcount=&getlocationcount($grpname);
- print "<b>$Lang::tr{'used'}:</b> $locationgrpcount x";
-
+ my $locationusedin=&getlocusedin($grpname);
+ print "<b>$Lang::tr{'used'}:</b> $locationgrpcount x ";
+ if ($locationusedin) {
+ print "<input type='image' align='top' src='/images/info.gif' alt='$locationusedin' title='$locationusedin'>";
+ } else {
+ print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
+ }
# Only display delete icon, if the group is not used by a firewall rule.
if($locationgrpcount == '0') {
print"<form method='post' style='display:inline'>\n";
@@ -2442,7 +2467,7 @@ sub viewtableservice
&General::readhasharray("$fwconfigout", \%fwout);
print<<END;
<table width='100%' cellspacing='0' class='tbl'>
- <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th width='3%'></th></tr>
+ <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th></th><th width='3%'></th></tr>
END
my $col='';
foreach my $key (sort { ncmp($customservice{$a}[0],$customservice{$b}[0])} keys %customservice)
@@ -2463,10 +2488,17 @@ END
END
#Neuer count
$srvcount=&getsrvcount($customservice{$key}[0]);
+ my $serviceusedin=&getsrvusedin($customservice{$key}[0]);
+ my $htmlparttouse="";
+ if ($serviceusedin) {
+ $htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$serviceusedin' title='$serviceusedin'>";
+ } else {
+ $htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
+ }
if($customservice{$key}[3] eq 'All ICMP-Types'){print $Lang::tr{'fwdfw all icmp'};}
elsif($customservice{$key}[3] ne 'BLANK'){print $customservice{$key}[3];}
print<<END;
- </td><td align='center' $col>$srvcount x</td>
+ </td><td align='center' $col>$srvcount x</td><td>$htmlparttouse</td>
<td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' /><input type='hidden' name='ACTION' value='editservice' />
<input type='hidden' name='SRV_NAME' value='$customservice{$key}[0]' />
<input type='hidden' name='SRV_PORT' value='$customservice{$key}[1]' />
@@ -2538,7 +2570,13 @@ sub viewtableservicegrp
if($count >0){print"</table>";$count=1;}
print "<br><b><u>$grpname</u></b> ";
print "<b>$Lang::tr{'remark'}:</b> $remark " if ($remark ne '');
- print " <b>$Lang::tr{'used'}:</b> $grpcount x";
+ print " <b>$Lang::tr{'used'}:</b> $grpcount x ";
+ my $srvgrpusedin=&getsrvusedin($customservicegrp{$key}[0]);
+ if ($srvgrpusedin) {
+ print "<input type='image' align='top' src='/images/info.gif' alt='$srvgrpusedin' title='$srvgrpusedin'>";
+ } else {
+ print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
+ }
if($grpcount == '0')
{
print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='SRVGRP_NAME' value='$grpname' ><input type='hidden' name='ACTION' value='delservicegrp'></form>";
@@ -2811,6 +2849,106 @@ sub getlocationcount
}
return $counter;
}
+sub getlocusedin
+{
+ my $groupname=shift;
+ my $titletext="";
+
+ # Location groups are stored as "group:groupname" in the
+ # firewall settings files.
+ my $searchstring = join(':', "group",$groupname);
+
+ #Count services used in firewall - config
+ my $fwfwtext="";
+ # first set title if found
+ foreach my $key1 (keys %fwfwd) {
+ if($fwfwd{$key1}[4] eq $searchstring){
+ $fwfwtext = "$Lang::tr{'firewall rules'}:";
+ }
+ if($fwfwd{$key1}[6] eq $searchstring){
+ $fwfwtext = "$Lang::tr{'firewall rules'}:";
+ }
+ }
+ # then add rule numbers
+ my @fwfwrules = ();
+ foreach my $key1 (keys %fwfwd) {
+ if($fwfwd{$key1}[4] eq $searchstring){
+ push(@fwfwrules, $key1);
+ }
+ if($fwfwd{$key1}[6] eq $searchstring){
+ push(@fwfwrules, $key1);
+ }
+ }
+ my @fwfwarraysorted = sort { $a <=> $b } @fwfwrules;
+ foreach my $rule (@fwfwarraysorted)
+ {
+ $fwfwtext .= "
- $rule";
+ }
+ #Count services used in firewall - input
+ my $fwintext="";
+ foreach my $key2 (keys %fwinp) {
+ if($fwinp{$key2}[4] eq $searchstring){
+ $fwintext = "$Lang::tr{'incoming firewall access'}:";
+ }
+ if($fwinp{$key2}[6] eq $searchstring){
+ $fwintext = "$Lang::tr{'incoming firewall access'}:";
+ }
+ }
+ my @fwinrules = ();
+ foreach my $key2 (keys %fwinp) {
+ if($fwinp{$key2}[4] eq $searchstring){
+ push(@fwinrules, $key2);
+ }
+ if($fwinp{$key2}[6] eq $searchstring){
+ push(@fwinrules, $key2);
+ }
+ }
+ my @fwinarraysorted = sort { $a <=> $b } @fwinrules;
+ foreach my $rule (@fwinarraysorted)
+ {
+ $fwintext .= "
- $rule";
+ }
+ #Count services used in firewall - outgoing
+ my $fwouttext="";
+ foreach my $key3 (keys %fwout) {
+ if($fwout{$key3}[4] eq $searchstring){
+ $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
+ }
+ if($fwout{$key3}[6] eq $searchstring){
+ $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
+ }
+ }
+ my @fwoutrules = ();
+ foreach my $key3 (keys %fwout) {
+ if($fwout{$key3}[4] eq $searchstring){
+ push(@fwoutrules, $key3);
+ }
+ if($fwout{$key3}[6] eq $searchstring){
+ push(@fwoutrules, $key3);
+ }
+ }
+ my @fwoutarraysorted = sort { $a <=> $b } @fwoutrules;
+ foreach my $rule (@fwoutarraysorted)
+ {
+ $fwouttext .= "
- $rule";
+ }
+ if ($fwfwtext) {
+ $titletext .= "$fwfwtext"
+ }
+ if ($fwintext) {
+ if ($titletext) {
+ $titletext .= "
 "
+ }
+ $titletext .= "$fwintext"
+ }
+ if ($fwouttext) {
+ if ($titletext) {
+ $titletext .= "
 "
+ }
+ $titletext .= "$fwouttext"
+ }
+ return $titletext;
+}
sub getnetcount
{
my $searchstring=shift;
@@ -2850,6 +2988,122 @@ sub getnetcount
}
return $srvcounter;
}
+sub getusedin
+{
+ my $searchstring=shift;
+ my $titletext="";
+ my $groups=();
+ my $rules=();
+
+ #Count services used in Network/Host group
+ my $servicegrouptext="";
+ foreach my $key (keys %customgrp) {
+ if($customgrp{$key}[2] eq $searchstring){
+ $servicegrouptext = "$Lang::tr{'fwhost cust grp'}:";
+ }
+ }
+ foreach my $key (keys %customgrp) {
+ if($customgrp{$key}[2] eq $searchstring){
+ $servicegrouptext .= "
- $customgrp{$key}[0]";
+ }
+ }
+ #Count services used in firewall - config
+ my $fwfwtext="";
+ # first set title if found
+ foreach my $key1 (keys %fwfwd) {
+ if($fwfwd{$key1}[4] eq $searchstring){
+ $fwfwtext = "$Lang::tr{'firewall rules'}:";
+ }
+ if($fwfwd{$key1}[6] eq $searchstring){
+ $fwfwtext = "$Lang::tr{'firewall rules'}:";
+ }
+ }
+ # then add rule numbers
+ my @fwfwrules = ();
+ foreach my $key1 (keys %fwfwd) {
+ if($fwfwd{$key1}[4] eq $searchstring){
+ push(@fwfwrules, $key1);
+ }
+ if($fwfwd{$key1}[6] eq $searchstring){
+ push(@fwfwrules, $key1);
+ }
+ }
+ my @fwfwarraysorted = sort { $a <=> $b } @fwfwrules;
+ foreach my $rule (@fwfwarraysorted)
+ {
+ $fwfwtext .= "
- $rule";
+ }
+ #Count services used in firewall - input
+ my $fwintext="";
+ foreach my $key2 (keys %fwinp) {
+ if($fwinp{$key2}[4] eq $searchstring){
+ $fwintext = "$Lang::tr{'incoming firewall access'}:";
+ }
+ if($fwinp{$key2}[6] eq $searchstring){
+ $fwintext = "$Lang::tr{'incoming firewall access'}:";
+ }
+ }
+ my @fwinrules = ();
+ foreach my $key2 (keys %fwinp) {
+ if($fwinp{$key2}[4] eq $searchstring){
+ push(@fwinrules, $key2);
+ }
+ if($fwinp{$key2}[6] eq $searchstring){
+ push(@fwinrules, $key2);
+ }
+ }
+ my @fwinarraysorted = sort { $a <=> $b } @fwinrules;
+ foreach my $rule (@fwinarraysorted)
+ {
+ $fwintext .= "
- $rule";
+ }
+ #Count services used in firewall - outgoing
+ my $fwouttext="";
+ foreach my $key3 (keys %fwout) {
+ if($fwout{$key3}[4] eq $searchstring){
+ $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
+ }
+ if($fwout{$key3}[6] eq $searchstring){
+ $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
+ }
+ }
+ my @fwoutrules = ();
+ foreach my $key3 (keys %fwout) {
+ if($fwout{$key3}[4] eq $searchstring){
+ push(@fwoutrules, $key3);
+ }
+ if($fwout{$key3}[6] eq $searchstring){
+ push(@fwoutrules, $key3);
+ }
+ }
+ my @fwoutarraysorted = sort { $a <=> $b } @fwoutrules;
+ foreach my $rule (@fwoutarraysorted)
+ {
+ $fwouttext .= "
- $rule";
+ }
+ if ($servicegrouptext) {
+ $titletext .= "$servicegrouptext"
+ }
+ if ($fwfwtext) {
+ if ($titletext) {
+ $titletext .= "
 "
+ }
+ $titletext .= "$fwfwtext"
+ }
+ if ($fwintext) {
+ if ($titletext) {
+ $titletext .= "
 "
+ }
+ $titletext .= "$fwintext"
+ }
+ if ($fwouttext) {
+ if ($titletext) {
+ $titletext .= "
 "
+ }
+ $titletext .= "$fwouttext"
+ }
+ return $titletext
+}
sub getsrvcount
{
my $searchstring=shift;
@@ -2880,6 +3134,100 @@ sub getsrvcount
}
return $srvcounter;
}
+sub getsrvusedin
+{
+ my $searchstring=shift;
+ my $titletext="";
+ #Count services used in servicegroups
+ my $servicegrouptext="";
+ foreach my $key (keys %customservicegrp) {
+ if($customservicegrp{$key}[2] eq $searchstring){
+ $servicegrouptext = "$Lang::tr{'outgoing firewall access'}:";
+ }
+ }
+ foreach my $key (keys %customservicegrp) {
+ if($customservicegrp{$key}[2] eq $searchstring){
+ $servicegrouptext .= "
- $customservicegrp{$key}[0]";
+ }
+ }
+ my $fwfwtext="";
+ # first set title if found
+ foreach my $key1 (keys %fwfwd) {
+ if($fwfwd{$key1}[15] eq $searchstring){
+ $fwfwtext = "$Lang::tr{'firewall rules'}:";
+ }
+ }
+ # then add rule numbers
+ my @fwfwrules = ();
+ foreach my $key1 (keys %fwfwd) {
+ if($fwfwd{$key1}[15] eq $searchstring){
+ push(@fwfwrules, $key1);
+ }
+ }
+ my @fwfwarraysorted = sort { $a <=> $b } @fwfwrules;
+ foreach my $rule (@fwfwarraysorted)
+ {
+ $fwfwtext .= "
- $rule";
+ }
+ #Count services used in firewall - input
+ my $fwintext="";
+ foreach my $key2 (keys %fwinp) {
+ if($fwinp{$key2}[15] eq $searchstring){
+ $fwintext = "$Lang::tr{'incoming firewall access'}:";
+ }
+ }
+ my @fwinrules = ();
+ foreach my $key2 (keys %fwinp) {
+ if($fwinp{$key2}[15] eq $searchstring){
+ push(@fwinrules, $key2);
+ }
+ }
+ my @fwinarraysorted = sort { $a <=> $b } @fwinrules;
+ foreach my $rule (@fwinarraysorted)
+ {
+ $fwintext .= "
- $rule";
+ }
+ #Count services used in firewall - outgoing
+ my $fwouttext="";
+ foreach my $key3 (keys %fwout) {
+ if($fwout{$key3}[15] eq $searchstring){
+ $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
+ }
+ }
+ my @fwoutrules = ();
+ foreach my $key3 (keys %fwout) {
+ if($fwout{$key3}[15] eq $searchstring){
+ push(@fwoutrules, $key3);
+ }
+ }
+ my @fwoutarraysorted = sort { $a <=> $b } @fwoutrules;
+ foreach my $rule (@fwoutarraysorted)
+ {
+ $fwouttext .= "
- $rule";
+ }
+ if ($servicegrouptext ne '') {
+ $titletext .= "$servicegrouptext";
+ }
+ if ($fwfwtext ne '') {
+ if ($titletext) {
+ $titletext .= "
 ";
+ }
+ $titletext .= "$fwfwtext";
+ }
+ if ($fwintext ne '') {
+ if ($titletext) {
+ $titletext .= "
 ";
+ }
+ $titletext .= "$fwintext";
+ }
+ if ($fwouttext) {
+ if ($titletext ne '') {
+ $titletext .= "
 ";
+ }
+ $titletext .= "$fwouttext";
+ }
+ return $titletext
+}
sub deletefromgrp
{
my $target=shift;
diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl
index 53d6903ae..130227910 100644
--- a/langs/de/cgi-bin/de.pl
+++ b/langs/de/cgi-bin/de.pl
@@ -122,6 +122,7 @@
'The class number does not match the specified interface.' => 'Die Klassennummer passt nicht zum angegebenen Interface.',
'The destination IP address is invalid.' => 'Die Ziel-IP-Adresse ist ungültig.',
'The source IP address is invalid.' => 'Die Quell-IP-Adresse ist ungültig.',
+'Unused' => 'Unbenutzt',
'Utilization on' => 'Auslastung auf',
'Verbose' => 'Verbose',
'WakeOnLan' => 'Wake On LAN',
diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
index ef7d75ce7..e76ca878c 100644
--- a/langs/en/cgi-bin/en.pl
+++ b/langs/en/cgi-bin/en.pl
@@ -120,6 +120,7 @@
'The class number does not match the specified interface.' => 'The class number does not match the specified interface.',
'The destination IP address is invalid.' => 'The destination IP address is invalid.',
'The source IP address is invalid.' => 'The source IP address is invalid.',
+'Unused' => 'Unused',
'Utilization on' => 'Utilization on',
'Verbose' => 'Verbose:',
'WakeOnLan' => 'Wake On Lan',
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/5] fwhosts.cgi: Remove whitespace issues
2025-06-23 17:16 [PATCH 1/5] fwhosts.cgi: Show in which firewall rule objects are being used Michael Tremer
@ 2025-06-23 17:16 ` Michael Tremer
2025-06-23 17:16 ` [PATCH 3/5] fwhosts.cgi: Don't show anything if a host/group is unused Michael Tremer
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Michael Tremer @ 2025-06-23 17:16 UTC (permalink / raw)
To: development; +Cc: dietzmann, Michael Tremer
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
html/cgi-bin/fwhosts.cgi | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi
index 6b4e22159..4e9c7f04d 100644
--- a/html/cgi-bin/fwhosts.cgi
+++ b/html/cgi-bin/fwhosts.cgi
@@ -1956,7 +1956,7 @@ END
my $htmlparttouse="";
if ($netusedin) {
$htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$netusedin' title='$netusedin'>";
- } else {
+ } else {
$htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='Unused' title='Unused'>";
}
print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col>$netcount x</td><td>$htmlparttouse</td>";
@@ -2117,7 +2117,7 @@ END
my $htmlparttouse="";
if ($hostusedin) {
$htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$hostusedin' title='$hostusedin'>";
- } else {
+ } else {
$htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='Unused' title='Unused'>";
}
print"<td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >".&getcolor($ip)."</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col>$hostcount x</td><td>$htmlparttouse</td>";
@@ -2199,8 +2199,8 @@ sub viewtablegrp
print "<b>$Lang::tr{'used'}:</b> $netgrpcount x ";
my $groupusedin=&getusedin($grpname);
if ($groupusedin) {
- print "<input type='image' align='top' src='/images/info.gif' alt='$groupusedin' title='$groupusedin'>";
- } else {
+ print "<input type='image' align='top' src='/images/info.gif' alt='$groupusedin' title='$groupusedin'>";
+ } else {
print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
}
if($netgrpcount == '0')
@@ -2343,8 +2343,8 @@ sub viewtablelocationgrp
my $locationusedin=&getlocusedin($grpname);
print "<b>$Lang::tr{'used'}:</b> $locationgrpcount x ";
if ($locationusedin) {
- print "<input type='image' align='top' src='/images/info.gif' alt='$locationusedin' title='$locationusedin'>";
- } else {
+ print "<input type='image' align='top' src='/images/info.gif' alt='$locationusedin' title='$locationusedin'>";
+ } else {
print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
}
# Only display delete icon, if the group is not used by a firewall rule.
@@ -2492,7 +2492,7 @@ END
my $htmlparttouse="";
if ($serviceusedin) {
$htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$serviceusedin' title='$serviceusedin'>";
- } else {
+ } else {
$htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
}
if($customservice{$key}[3] eq 'All ICMP-Types'){print $Lang::tr{'fwdfw all icmp'};}
@@ -2573,8 +2573,8 @@ sub viewtableservicegrp
print " <b>$Lang::tr{'used'}:</b> $grpcount x ";
my $srvgrpusedin=&getsrvusedin($customservicegrp{$key}[0]);
if ($srvgrpusedin) {
- print "<input type='image' align='top' src='/images/info.gif' alt='$srvgrpusedin' title='$srvgrpusedin'>";
- } else {
+ print "<input type='image' align='top' src='/images/info.gif' alt='$srvgrpusedin' title='$srvgrpusedin'>";
+ } else {
print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
}
if($grpcount == '0')
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/5] fwhosts.cgi: Don't show anything if a host/group is unused
2025-06-23 17:16 [PATCH 1/5] fwhosts.cgi: Show in which firewall rule objects are being used Michael Tremer
2025-06-23 17:16 ` [PATCH 2/5] fwhosts.cgi: Remove whitespace issues Michael Tremer
@ 2025-06-23 17:16 ` Michael Tremer
2025-06-23 17:16 ` [PATCH 4/5] fwhosts.cgi: Move the tooltip into the usage counter Michael Tremer
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Michael Tremer @ 2025-06-23 17:16 UTC (permalink / raw)
To: development; +Cc: dietzmann, Michael Tremer
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
html/cgi-bin/fwhosts.cgi | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi
index 4e9c7f04d..69970a840 100644
--- a/html/cgi-bin/fwhosts.cgi
+++ b/html/cgi-bin/fwhosts.cgi
@@ -1956,8 +1956,6 @@ END
my $htmlparttouse="";
if ($netusedin) {
$htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$netusedin' title='$netusedin'>";
- } else {
- $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='Unused' title='Unused'>";
}
print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col>$netcount x</td><td>$htmlparttouse</td>";
print<<END;
@@ -2117,8 +2115,6 @@ END
my $htmlparttouse="";
if ($hostusedin) {
$htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$hostusedin' title='$hostusedin'>";
- } else {
- $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='Unused' title='Unused'>";
}
print"<td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >".&getcolor($ip)."</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col>$hostcount x</td><td>$htmlparttouse</td>";
print<<END;
@@ -2200,8 +2196,6 @@ sub viewtablegrp
my $groupusedin=&getusedin($grpname);
if ($groupusedin) {
print "<input type='image' align='top' src='/images/info.gif' alt='$groupusedin' title='$groupusedin'>";
- } else {
- print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
}
if($netgrpcount == '0')
{
@@ -2344,8 +2338,6 @@ sub viewtablelocationgrp
print "<b>$Lang::tr{'used'}:</b> $locationgrpcount x ";
if ($locationusedin) {
print "<input type='image' align='top' src='/images/info.gif' alt='$locationusedin' title='$locationusedin'>";
- } else {
- print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
}
# Only display delete icon, if the group is not used by a firewall rule.
if($locationgrpcount == '0') {
@@ -2492,8 +2484,6 @@ END
my $htmlparttouse="";
if ($serviceusedin) {
$htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$serviceusedin' title='$serviceusedin'>";
- } else {
- $htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
}
if($customservice{$key}[3] eq 'All ICMP-Types'){print $Lang::tr{'fwdfw all icmp'};}
elsif($customservice{$key}[3] ne 'BLANK'){print $customservice{$key}[3];}
@@ -2574,8 +2564,6 @@ sub viewtableservicegrp
my $srvgrpusedin=&getsrvusedin($customservicegrp{$key}[0]);
if ($srvgrpusedin) {
print "<input type='image' align='top' src='/images/info.gif' alt='$srvgrpusedin' title='$srvgrpusedin'>";
- } else {
- print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
}
if($grpcount == '0')
{
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/5] fwhosts.cgi: Move the tooltip into the usage counter
2025-06-23 17:16 [PATCH 1/5] fwhosts.cgi: Show in which firewall rule objects are being used Michael Tremer
2025-06-23 17:16 ` [PATCH 2/5] fwhosts.cgi: Remove whitespace issues Michael Tremer
2025-06-23 17:16 ` [PATCH 3/5] fwhosts.cgi: Don't show anything if a host/group is unused Michael Tremer
@ 2025-06-23 17:16 ` Michael Tremer
2025-06-25 16:40 ` Adolf Belka
2025-06-23 17:16 ` [PATCH 5/5] langs: Remove the unused "Unused" translation string Michael Tremer
2025-06-25 16:25 ` [PATCH 1/5] fwhosts.cgi: Show in which firewall rule objects are being used Adolf Belka
4 siblings, 1 reply; 10+ messages in thread
From: Michael Tremer @ 2025-06-23 17:16 UTC (permalink / raw)
To: development; +Cc: dietzmann, Michael Tremer
This will clutter the page less as we don't have any good icon sets.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
html/cgi-bin/fwhosts.cgi | 42 +++++++++++-----------------------------
1 file changed, 11 insertions(+), 31 deletions(-)
diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi
index 69970a840..953f81e5f 100644
--- a/html/cgi-bin/fwhosts.cgi
+++ b/html/cgi-bin/fwhosts.cgi
@@ -1932,7 +1932,7 @@ sub viewtablenet
}else{
print<<END;
<table width='100%' cellspacing='0' class='tbl'>
- <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
+ <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
END
}
my $count=0;
@@ -1953,11 +1953,7 @@ END
my $colnet="$customnetwork{$key}[1]/".&General::subtocidr($customnetwork{$key}[2]);
my $netcount=&getnetcount($customnetwork{$key}[0]);
my $netusedin=&getusedin($customnetwork{$key}[0]);
- my $htmlparttouse="";
- if ($netusedin) {
- $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$netusedin' title='$netusedin'>";
- }
- print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col>$netcount x</td><td>$htmlparttouse</td>";
+ print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col><span title='$netusedin'>$netcount x</span></td>";
print<<END;
<td width='1%' $col><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
<input type='hidden' name='ACTION' value='editnet'>
@@ -2091,7 +2087,7 @@ sub viewtablehost
}else{
print<<END;
<table width='100%' cellspacing='0' class='tbl'>
- <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
+ <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
END
}
my $count=0;
@@ -2112,12 +2108,9 @@ END
my $hostcount=0;
$hostcount=&gethostcount($customhost{$key}[0]);
my $hostusedin=&getusedin($customhost{$key}[0]);
- my $htmlparttouse="";
- if ($hostusedin) {
- $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$hostusedin' title='$hostusedin'>";
- }
- print"<td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >".&getcolor($ip)."</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col>$hostcount x</td><td>$htmlparttouse</td>";
- print<<END;
+ my $color = &getcolor($ip);
+ print <<END;
+ <td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >$color</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col><span title="$hostusedin">$hostcount x</span></td>
<td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
<input type='hidden' name='ACTION' value='edithost' />
<input type='hidden' name='HOSTNAME' value='$customhost{$key}[0]' />
@@ -2192,11 +2185,8 @@ sub viewtablegrp
print "<br><b><u>$grpname</u></b> ";
print " <b>$Lang::tr{'remark'}:</b>  $remark   " if ($remark ne '');
my $netgrpcount=&getnetcount($grpname);
- print "<b>$Lang::tr{'used'}:</b> $netgrpcount x ";
my $groupusedin=&getusedin($grpname);
- if ($groupusedin) {
- print "<input type='image' align='top' src='/images/info.gif' alt='$groupusedin' title='$groupusedin'>";
- }
+ print "<b>$Lang::tr{'used'}:</b> <span title='$groupusedin'>$netgrpcount x</span>";
if($netgrpcount == '0')
{
print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='grp_name' value='$grpname' ><input type='hidden' name='ACTION' value='delgrp'></form>";
@@ -2335,10 +2325,7 @@ sub viewtablelocationgrp
# Get group count.
my $locationgrpcount=&getlocationcount($grpname);
my $locationusedin=&getlocusedin($grpname);
- print "<b>$Lang::tr{'used'}:</b> $locationgrpcount x ";
- if ($locationusedin) {
- print "<input type='image' align='top' src='/images/info.gif' alt='$locationusedin' title='$locationusedin'>";
- }
+ print "<b>$Lang::tr{'used'}:</b> <span title='$locationusedin'>$locationgrpcount x</span>";
# Only display delete icon, if the group is not used by a firewall rule.
if($locationgrpcount == '0') {
print"<form method='post' style='display:inline'>\n";
@@ -2459,7 +2446,7 @@ sub viewtableservice
&General::readhasharray("$fwconfigout", \%fwout);
print<<END;
<table width='100%' cellspacing='0' class='tbl'>
- <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th></th><th width='3%'></th></tr>
+ <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th width='3%'></th></tr>
END
my $col='';
foreach my $key (sort { ncmp($customservice{$a}[0],$customservice{$b}[0])} keys %customservice)
@@ -2481,14 +2468,10 @@ END
#Neuer count
$srvcount=&getsrvcount($customservice{$key}[0]);
my $serviceusedin=&getsrvusedin($customservice{$key}[0]);
- my $htmlparttouse="";
- if ($serviceusedin) {
- $htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$serviceusedin' title='$serviceusedin'>";
- }
if($customservice{$key}[3] eq 'All ICMP-Types'){print $Lang::tr{'fwdfw all icmp'};}
elsif($customservice{$key}[3] ne 'BLANK'){print $customservice{$key}[3];}
print<<END;
- </td><td align='center' $col>$srvcount x</td><td>$htmlparttouse</td>
+ </td><td align='center' $col><span title='$serviceusedin'>$srvcount x</span></td>
<td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' /><input type='hidden' name='ACTION' value='editservice' />
<input type='hidden' name='SRV_NAME' value='$customservice{$key}[0]' />
<input type='hidden' name='SRV_PORT' value='$customservice{$key}[1]' />
@@ -2560,11 +2543,8 @@ sub viewtableservicegrp
if($count >0){print"</table>";$count=1;}
print "<br><b><u>$grpname</u></b> ";
print "<b>$Lang::tr{'remark'}:</b> $remark " if ($remark ne '');
- print " <b>$Lang::tr{'used'}:</b> $grpcount x ";
my $srvgrpusedin=&getsrvusedin($customservicegrp{$key}[0]);
- if ($srvgrpusedin) {
- print "<input type='image' align='top' src='/images/info.gif' alt='$srvgrpusedin' title='$srvgrpusedin'>";
- }
+ print " <b>$Lang::tr{'used'}:</b> <span title='$srvgrpusedin'>$grpcount x</span>";
if($grpcount == '0')
{
print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='SRVGRP_NAME' value='$grpname' ><input type='hidden' name='ACTION' value='delservicegrp'></form>";
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/5] langs: Remove the unused "Unused" translation string
2025-06-23 17:16 [PATCH 1/5] fwhosts.cgi: Show in which firewall rule objects are being used Michael Tremer
` (2 preceding siblings ...)
2025-06-23 17:16 ` [PATCH 4/5] fwhosts.cgi: Move the tooltip into the usage counter Michael Tremer
@ 2025-06-23 17:16 ` Michael Tremer
2025-06-25 16:25 ` [PATCH 1/5] fwhosts.cgi: Show in which firewall rule objects are being used Adolf Belka
4 siblings, 0 replies; 10+ messages in thread
From: Michael Tremer @ 2025-06-23 17:16 UTC (permalink / raw)
To: development; +Cc: dietzmann, Michael Tremer
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
doc/language_issues.en | 1 -
doc/language_issues.es | 1 -
doc/language_issues.fr | 1 -
doc/language_issues.it | 1 -
doc/language_issues.nl | 1 -
doc/language_issues.pl | 1 -
doc/language_issues.ru | 1 -
doc/language_issues.tr | 1 -
doc/language_missings | 7 -------
langs/de/cgi-bin/de.pl | 1 -
langs/en/cgi-bin/en.pl | 1 -
11 files changed, 17 deletions(-)
diff --git a/doc/language_issues.en b/doc/language_issues.en
index 7d72fa99b..996572456 100644
--- a/doc/language_issues.en
+++ b/doc/language_issues.en
@@ -78,7 +78,6 @@ WARNING: untranslated string: TOS rule = TOS rule
WARNING: untranslated string: The class number does not match the specified interface. = The class number does not match the specified interface.
WARNING: untranslated string: The destination IP address is invalid. = The destination IP address is invalid.
WARNING: untranslated string: The source IP address is invalid. = The source IP address is invalid.
-WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: WakeOnLan = Wake On Lan
WARNING: untranslated string: a ca certificate with this name already exists = A CA certificate with this name already exists.
WARNING: untranslated string: a connection with this common name already exists = A connection with this common name already exists.
diff --git a/doc/language_issues.es b/doc/language_issues.es
index e90acf9d9..68836302a 100644
--- a/doc/language_issues.es
+++ b/doc/language_issues.es
@@ -980,7 +980,6 @@ WARNING: translation string unused: zoneconf val vlan tag range error
WARNING: translation string unused: zoneconf val zoneslave amount error
WARNING: untranslated string: Captive ACTIVATE = unknown string
WARNING: untranslated string: Captive clients = unknown string
-WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: ca name must only contain characters and spaces = unknown string
WARNING: untranslated string: dns servers = DNS Servers
WARNING: untranslated string: enable disable client = unknown string
diff --git a/doc/language_issues.fr b/doc/language_issues.fr
index db91be7fe..80341a1c3 100644
--- a/doc/language_issues.fr
+++ b/doc/language_issues.fr
@@ -959,7 +959,6 @@ WARNING: translation string unused: zoneconf val vlan amount assignment error
WARNING: translation string unused: zoneconf val vlan tag assignment error
WARNING: translation string unused: zoneconf val vlan tag range error
WARNING: translation string unused: zoneconf val zoneslave amount error
-WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: allowed subnets = Allowed Subnets
WARNING: untranslated string: bypassed = Bypassed
WARNING: untranslated string: ca name must only contain characters and spaces = unknown string
diff --git a/doc/language_issues.it b/doc/language_issues.it
index facb0c256..4ec3545ba 100644
--- a/doc/language_issues.it
+++ b/doc/language_issues.it
@@ -932,7 +932,6 @@ WARNING: untranslated string: Captive vouchervalid = Allowed time for this coupo
WARNING: untranslated string: Captive wrong type = Uploaded file has wrong filetype
WARNING: untranslated string: MTU settings = MTU settings:
WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
-WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: access point name = Access Point Name
WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
WARNING: untranslated string: access point name is required = Access Point Name is required
diff --git a/doc/language_issues.nl b/doc/language_issues.nl
index 40710c698..56c6dadf6 100644
--- a/doc/language_issues.nl
+++ b/doc/language_issues.nl
@@ -932,7 +932,6 @@ WARNING: untranslated string: Captive vouchervalid = Allowed time for this coupo
WARNING: untranslated string: Captive wrong type = Uploaded file has wrong filetype
WARNING: untranslated string: MTU settings = MTU settings:
WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
-WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: access point name = Access Point Name
WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
WARNING: untranslated string: access point name is required = Access Point Name is required
diff --git a/doc/language_issues.pl b/doc/language_issues.pl
index ef464100c..6ccb0a497 100644
--- a/doc/language_issues.pl
+++ b/doc/language_issues.pl
@@ -848,7 +848,6 @@ WARNING: untranslated string: MB read = MB read
WARNING: untranslated string: MB written = MB written
WARNING: untranslated string: MTU settings = MTU settings:
WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
-WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: access point name = Access Point Name
WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
WARNING: untranslated string: access point name is required = Access Point Name is required
diff --git a/doc/language_issues.ru b/doc/language_issues.ru
index d4f669b1b..8a689daa7 100644
--- a/doc/language_issues.ru
+++ b/doc/language_issues.ru
@@ -843,7 +843,6 @@ WARNING: untranslated string: MB read = MB read
WARNING: untranslated string: MB written = MB written
WARNING: untranslated string: MTU settings = MTU settings:
WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
-WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: access point name = Access Point Name
WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
WARNING: untranslated string: access point name is required = Access Point Name is required
diff --git a/doc/language_issues.tr b/doc/language_issues.tr
index f557f9a04..e79fe1388 100644
--- a/doc/language_issues.tr
+++ b/doc/language_issues.tr
@@ -925,7 +925,6 @@ WARNING: translation string unused: year-graph
WARNING: translation string unused: yearly firewallhits
WARNING: untranslated string: Captive clients = unknown string
WARNING: untranslated string: Captive delete logo = Delete Logo
-WARNING: untranslated string: Unused = Unused
WARNING: untranslated string: access point name = Access Point Name
WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
WARNING: untranslated string: access point name is required = Access Point Name is required
diff --git a/doc/language_missings b/doc/language_missings
index 8487c8a26..cd005f45a 100644
--- a/doc/language_missings
+++ b/doc/language_missings
@@ -128,7 +128,6 @@
< dns servers
< ids provider eol
< online
-< Unused
############################################################################
# Checking cgi-bin translations for language: fr #
############################################################################
@@ -182,7 +181,6 @@
< system time
< timeformat
< total
-< Unused
< upload fcdsl.o
< warning
< wg
@@ -722,7 +720,6 @@
< unblock all
< uncheck all
< unlimited
-< Unused
< update ruleset
< updxlrtr passive mode
< uplink bit rate
@@ -1359,7 +1356,6 @@
< unblock all
< uncheck all
< unlimited
-< Unused
< update ruleset
< updxlrtr passive mode
< uplink bit rate
@@ -2402,7 +2398,6 @@
< unblock all
< uncheck all
< unlimited
-< Unused
< update ruleset
< updxlrtr passive mode
< updxlrtr sources
@@ -3491,7 +3486,6 @@
< unblock all
< uncheck all
< unlimited
-< Unused
< update ruleset
< updxlrtr passive mode
< updxlrtr sources
@@ -3981,7 +3975,6 @@
< traffic stat title
< transfers
< transport mode does not support vti
-< Unused
< update ruleset
< updxlrtr passive mode
< user management
diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl
index 130227910..53d6903ae 100644
--- a/langs/de/cgi-bin/de.pl
+++ b/langs/de/cgi-bin/de.pl
@@ -122,7 +122,6 @@
'The class number does not match the specified interface.' => 'Die Klassennummer passt nicht zum angegebenen Interface.',
'The destination IP address is invalid.' => 'Die Ziel-IP-Adresse ist ungültig.',
'The source IP address is invalid.' => 'Die Quell-IP-Adresse ist ungültig.',
-'Unused' => 'Unbenutzt',
'Utilization on' => 'Auslastung auf',
'Verbose' => 'Verbose',
'WakeOnLan' => 'Wake On LAN',
diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
index e76ca878c..ef7d75ce7 100644
--- a/langs/en/cgi-bin/en.pl
+++ b/langs/en/cgi-bin/en.pl
@@ -120,7 +120,6 @@
'The class number does not match the specified interface.' => 'The class number does not match the specified interface.',
'The destination IP address is invalid.' => 'The destination IP address is invalid.',
'The source IP address is invalid.' => 'The source IP address is invalid.',
-'Unused' => 'Unused',
'Utilization on' => 'Utilization on',
'Verbose' => 'Verbose:',
'WakeOnLan' => 'Wake On Lan',
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/5] fwhosts.cgi: Show in which firewall rule objects are being used
2025-06-23 17:16 [PATCH 1/5] fwhosts.cgi: Show in which firewall rule objects are being used Michael Tremer
` (3 preceding siblings ...)
2025-06-23 17:16 ` [PATCH 5/5] langs: Remove the unused "Unused" translation string Michael Tremer
@ 2025-06-25 16:25 ` Adolf Belka
4 siblings, 0 replies; 10+ messages in thread
From: Adolf Belka @ 2025-06-25 16:25 UTC (permalink / raw)
To: Michael Tremer, dietzmann; +Cc: IPFire: Development-List
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
I initially tested the whole of the patch set but then I could not figure out where the firewall rule info was to be found.
Then I tested out only this first patch on its own and saw the i in a blue circle icon and then when I held my mouse over that for a second or so it showed the info.
I like the additional info that has been provided with this. That will be useful to have.
I will do a separate feedback to patch 4/5.
On 23/06/2025 19:16, Michael Tremer wrote:
> From: Peer Dietzmann <dietzmann@brecht-schule.hamburg>
>
> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
> ---
> doc/language_issues.en | 1 +
> doc/language_issues.es | 1 +
> doc/language_issues.fr | 1 +
> doc/language_issues.it | 1 +
> doc/language_issues.nl | 1 +
> doc/language_issues.pl | 1 +
> doc/language_issues.ru | 1 +
> doc/language_issues.tr | 1 +
> doc/language_missings | 7 +
> html/cgi-bin/fwhosts.cgi | 368 +++++++++++++++++++++++++++++++++++++--
> langs/de/cgi-bin/de.pl | 1 +
> langs/en/cgi-bin/en.pl | 1 +
> 12 files changed, 375 insertions(+), 10 deletions(-)
>
> diff --git a/doc/language_issues.en b/doc/language_issues.en
> index 996572456..7d72fa99b 100644
> --- a/doc/language_issues.en
> +++ b/doc/language_issues.en
> @@ -78,6 +78,7 @@ WARNING: untranslated string: TOS rule = TOS rule
> WARNING: untranslated string: The class number does not match the specified interface. = The class number does not match the specified interface.
> WARNING: untranslated string: The destination IP address is invalid. = The destination IP address is invalid.
> WARNING: untranslated string: The source IP address is invalid. = The source IP address is invalid.
> +WARNING: untranslated string: Unused = Unused
> WARNING: untranslated string: WakeOnLan = Wake On Lan
> WARNING: untranslated string: a ca certificate with this name already exists = A CA certificate with this name already exists.
> WARNING: untranslated string: a connection with this common name already exists = A connection with this common name already exists.
> diff --git a/doc/language_issues.es b/doc/language_issues.es
> index 68836302a..e90acf9d9 100644
> --- a/doc/language_issues.es
> +++ b/doc/language_issues.es
> @@ -980,6 +980,7 @@ WARNING: translation string unused: zoneconf val vlan tag range error
> WARNING: translation string unused: zoneconf val zoneslave amount error
> WARNING: untranslated string: Captive ACTIVATE = unknown string
> WARNING: untranslated string: Captive clients = unknown string
> +WARNING: untranslated string: Unused = Unused
> WARNING: untranslated string: ca name must only contain characters and spaces = unknown string
> WARNING: untranslated string: dns servers = DNS Servers
> WARNING: untranslated string: enable disable client = unknown string
> diff --git a/doc/language_issues.fr b/doc/language_issues.fr
> index 80341a1c3..db91be7fe 100644
> --- a/doc/language_issues.fr
> +++ b/doc/language_issues.fr
> @@ -959,6 +959,7 @@ WARNING: translation string unused: zoneconf val vlan amount assignment error
> WARNING: translation string unused: zoneconf val vlan tag assignment error
> WARNING: translation string unused: zoneconf val vlan tag range error
> WARNING: translation string unused: zoneconf val zoneslave amount error
> +WARNING: untranslated string: Unused = Unused
> WARNING: untranslated string: allowed subnets = Allowed Subnets
> WARNING: untranslated string: bypassed = Bypassed
> WARNING: untranslated string: ca name must only contain characters and spaces = unknown string
> diff --git a/doc/language_issues.it b/doc/language_issues.it
> index 4ec3545ba..facb0c256 100644
> --- a/doc/language_issues.it
> +++ b/doc/language_issues.it
> @@ -932,6 +932,7 @@ WARNING: untranslated string: Captive vouchervalid = Allowed time for this coupo
> WARNING: untranslated string: Captive wrong type = Uploaded file has wrong filetype
> WARNING: untranslated string: MTU settings = MTU settings:
> WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
> +WARNING: untranslated string: Unused = Unused
> WARNING: untranslated string: access point name = Access Point Name
> WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
> WARNING: untranslated string: access point name is required = Access Point Name is required
> diff --git a/doc/language_issues.nl b/doc/language_issues.nl
> index 56c6dadf6..40710c698 100644
> --- a/doc/language_issues.nl
> +++ b/doc/language_issues.nl
> @@ -932,6 +932,7 @@ WARNING: untranslated string: Captive vouchervalid = Allowed time for this coupo
> WARNING: untranslated string: Captive wrong type = Uploaded file has wrong filetype
> WARNING: untranslated string: MTU settings = MTU settings:
> WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
> +WARNING: untranslated string: Unused = Unused
> WARNING: untranslated string: access point name = Access Point Name
> WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
> WARNING: untranslated string: access point name is required = Access Point Name is required
> diff --git a/doc/language_issues.pl b/doc/language_issues.pl
> index 6ccb0a497..ef464100c 100644
> --- a/doc/language_issues.pl
> +++ b/doc/language_issues.pl
> @@ -848,6 +848,7 @@ WARNING: untranslated string: MB read = MB read
> WARNING: untranslated string: MB written = MB written
> WARNING: untranslated string: MTU settings = MTU settings:
> WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
> +WARNING: untranslated string: Unused = Unused
> WARNING: untranslated string: access point name = Access Point Name
> WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
> WARNING: untranslated string: access point name is required = Access Point Name is required
> diff --git a/doc/language_issues.ru b/doc/language_issues.ru
> index 8a689daa7..d4f669b1b 100644
> --- a/doc/language_issues.ru
> +++ b/doc/language_issues.ru
> @@ -843,6 +843,7 @@ WARNING: untranslated string: MB read = MB read
> WARNING: untranslated string: MB written = MB written
> WARNING: untranslated string: MTU settings = MTU settings:
> WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
> +WARNING: untranslated string: Unused = Unused
> WARNING: untranslated string: access point name = Access Point Name
> WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
> WARNING: untranslated string: access point name is required = Access Point Name is required
> diff --git a/doc/language_issues.tr b/doc/language_issues.tr
> index e79fe1388..f557f9a04 100644
> --- a/doc/language_issues.tr
> +++ b/doc/language_issues.tr
> @@ -925,6 +925,7 @@ WARNING: translation string unused: year-graph
> WARNING: translation string unused: yearly firewallhits
> WARNING: untranslated string: Captive clients = unknown string
> WARNING: untranslated string: Captive delete logo = Delete Logo
> +WARNING: untranslated string: Unused = Unused
> WARNING: untranslated string: access point name = Access Point Name
> WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
> WARNING: untranslated string: access point name is required = Access Point Name is required
> diff --git a/doc/language_missings b/doc/language_missings
> index cd005f45a..8487c8a26 100644
> --- a/doc/language_missings
> +++ b/doc/language_missings
> @@ -128,6 +128,7 @@
> < dns servers
> < ids provider eol
> < online
> +< Unused
> ############################################################################
> # Checking cgi-bin translations for language: fr #
> ############################################################################
> @@ -181,6 +182,7 @@
> < system time
> < timeformat
> < total
> +< Unused
> < upload fcdsl.o
> < warning
> < wg
> @@ -720,6 +722,7 @@
> < unblock all
> < uncheck all
> < unlimited
> +< Unused
> < update ruleset
> < updxlrtr passive mode
> < uplink bit rate
> @@ -1356,6 +1359,7 @@
> < unblock all
> < uncheck all
> < unlimited
> +< Unused
> < update ruleset
> < updxlrtr passive mode
> < uplink bit rate
> @@ -2398,6 +2402,7 @@
> < unblock all
> < uncheck all
> < unlimited
> +< Unused
> < update ruleset
> < updxlrtr passive mode
> < updxlrtr sources
> @@ -3486,6 +3491,7 @@
> < unblock all
> < uncheck all
> < unlimited
> +< Unused
> < update ruleset
> < updxlrtr passive mode
> < updxlrtr sources
> @@ -3975,6 +3981,7 @@
> < traffic stat title
> < transfers
> < transport mode does not support vti
> +< Unused
> < update ruleset
> < updxlrtr passive mode
> < user management
> diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi
> index e92ef6853..6b4e22159 100644
> --- a/html/cgi-bin/fwhosts.cgi
> +++ b/html/cgi-bin/fwhosts.cgi
> @@ -1932,7 +1932,7 @@ sub viewtablenet
> }else{
> print<<END;
> <table width='100%' cellspacing='0' class='tbl'>
> - <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
> + <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
> END
> }
> my $count=0;
> @@ -1952,7 +1952,14 @@ END
> }
> my $colnet="$customnetwork{$key}[1]/".&General::subtocidr($customnetwork{$key}[2]);
> my $netcount=&getnetcount($customnetwork{$key}[0]);
> - print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col>$netcount x</td>";
> + my $netusedin=&getusedin($customnetwork{$key}[0]);
> + my $htmlparttouse="";
> + if ($netusedin) {
> + $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$netusedin' title='$netusedin'>";
> + } else {
> + $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='Unused' title='Unused'>";
> + }
> + print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col>$netcount x</td><td>$htmlparttouse</td>";
> print<<END;
> <td width='1%' $col><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
> <input type='hidden' name='ACTION' value='editnet'>
> @@ -2086,7 +2093,7 @@ sub viewtablehost
> }else{
> print<<END;
> <table width='100%' cellspacing='0' class='tbl'>
> - <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
> + <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
> END
> }
> my $count=0;
> @@ -2106,7 +2113,14 @@ END
> $customhost{$key}[4]=~s/\s+//g;
> my $hostcount=0;
> $hostcount=&gethostcount($customhost{$key}[0]);
> - print"<td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >".&getcolor($ip)."</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col>$hostcount x</td>";
> + my $hostusedin=&getusedin($customhost{$key}[0]);
> + my $htmlparttouse="";
> + if ($hostusedin) {
> + $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$hostusedin' title='$hostusedin'>";
> + } else {
> + $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='Unused' title='Unused'>";
> + }
> + print"<td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >".&getcolor($ip)."</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col>$hostcount x</td><td>$htmlparttouse</td>";
> print<<END;
> <td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
> <input type='hidden' name='ACTION' value='edithost' />
> @@ -2182,7 +2196,13 @@ sub viewtablegrp
> print "<br><b><u>$grpname</u></b> ";
> print " <b>$Lang::tr{'remark'}:</b>  $remark   " if ($remark ne '');
> my $netgrpcount=&getnetcount($grpname);
> - print "<b>$Lang::tr{'used'}:</b> $netgrpcount x";
> + print "<b>$Lang::tr{'used'}:</b> $netgrpcount x ";
> + my $groupusedin=&getusedin($grpname);
> + if ($groupusedin) {
> + print "<input type='image' align='top' src='/images/info.gif' alt='$groupusedin' title='$groupusedin'>";
> + } else {
> + print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
> + }
> if($netgrpcount == '0')
> {
> print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='grp_name' value='$grpname' ><input type='hidden' name='ACTION' value='delgrp'></form>";
> @@ -2320,8 +2340,13 @@ sub viewtablelocationgrp
>
> # Get group count.
> my $locationgrpcount=&getlocationcount($grpname);
> - print "<b>$Lang::tr{'used'}:</b> $locationgrpcount x";
> -
> + my $locationusedin=&getlocusedin($grpname);
> + print "<b>$Lang::tr{'used'}:</b> $locationgrpcount x ";
> + if ($locationusedin) {
> + print "<input type='image' align='top' src='/images/info.gif' alt='$locationusedin' title='$locationusedin'>";
> + } else {
> + print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
> + }
> # Only display delete icon, if the group is not used by a firewall rule.
> if($locationgrpcount == '0') {
> print"<form method='post' style='display:inline'>\n";
> @@ -2442,7 +2467,7 @@ sub viewtableservice
> &General::readhasharray("$fwconfigout", \%fwout);
> print<<END;
> <table width='100%' cellspacing='0' class='tbl'>
> - <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th width='3%'></th></tr>
> + <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th></th><th width='3%'></th></tr>
> END
> my $col='';
> foreach my $key (sort { ncmp($customservice{$a}[0],$customservice{$b}[0])} keys %customservice)
> @@ -2463,10 +2488,17 @@ END
> END
> #Neuer count
> $srvcount=&getsrvcount($customservice{$key}[0]);
> + my $serviceusedin=&getsrvusedin($customservice{$key}[0]);
> + my $htmlparttouse="";
> + if ($serviceusedin) {
> + $htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$serviceusedin' title='$serviceusedin'>";
> + } else {
> + $htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
> + }
> if($customservice{$key}[3] eq 'All ICMP-Types'){print $Lang::tr{'fwdfw all icmp'};}
> elsif($customservice{$key}[3] ne 'BLANK'){print $customservice{$key}[3];}
> print<<END;
> - </td><td align='center' $col>$srvcount x</td>
> + </td><td align='center' $col>$srvcount x</td><td>$htmlparttouse</td>
> <td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' /><input type='hidden' name='ACTION' value='editservice' />
> <input type='hidden' name='SRV_NAME' value='$customservice{$key}[0]' />
> <input type='hidden' name='SRV_PORT' value='$customservice{$key}[1]' />
> @@ -2538,7 +2570,13 @@ sub viewtableservicegrp
> if($count >0){print"</table>";$count=1;}
> print "<br><b><u>$grpname</u></b> ";
> print "<b>$Lang::tr{'remark'}:</b> $remark " if ($remark ne '');
> - print " <b>$Lang::tr{'used'}:</b> $grpcount x";
> + print " <b>$Lang::tr{'used'}:</b> $grpcount x ";
> + my $srvgrpusedin=&getsrvusedin($customservicegrp{$key}[0]);
> + if ($srvgrpusedin) {
> + print "<input type='image' align='top' src='/images/info.gif' alt='$srvgrpusedin' title='$srvgrpusedin'>";
> + } else {
> + print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
> + }
> if($grpcount == '0')
> {
> print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='SRVGRP_NAME' value='$grpname' ><input type='hidden' name='ACTION' value='delservicegrp'></form>";
> @@ -2811,6 +2849,106 @@ sub getlocationcount
> }
> return $counter;
> }
> +sub getlocusedin
> +{
> + my $groupname=shift;
> + my $titletext="";
> +
> + # Location groups are stored as "group:groupname" in the
> + # firewall settings files.
> + my $searchstring = join(':', "group",$groupname);
> +
> + #Count services used in firewall - config
> + my $fwfwtext="";
> + # first set title if found
> + foreach my $key1 (keys %fwfwd) {
> + if($fwfwd{$key1}[4] eq $searchstring){
> + $fwfwtext = "$Lang::tr{'firewall rules'}:";
> + }
> + if($fwfwd{$key1}[6] eq $searchstring){
> + $fwfwtext = "$Lang::tr{'firewall rules'}:";
> + }
> + }
> + # then add rule numbers
> + my @fwfwrules = ();
> + foreach my $key1 (keys %fwfwd) {
> + if($fwfwd{$key1}[4] eq $searchstring){
> + push(@fwfwrules, $key1);
> + }
> + if($fwfwd{$key1}[6] eq $searchstring){
> + push(@fwfwrules, $key1);
> + }
> + }
> + my @fwfwarraysorted = sort { $a <=> $b } @fwfwrules;
> + foreach my $rule (@fwfwarraysorted)
> + {
> + $fwfwtext .= "
- $rule";
> + }
> + #Count services used in firewall - input
> + my $fwintext="";
> + foreach my $key2 (keys %fwinp) {
> + if($fwinp{$key2}[4] eq $searchstring){
> + $fwintext = "$Lang::tr{'incoming firewall access'}:";
> + }
> + if($fwinp{$key2}[6] eq $searchstring){
> + $fwintext = "$Lang::tr{'incoming firewall access'}:";
> + }
> + }
> + my @fwinrules = ();
> + foreach my $key2 (keys %fwinp) {
> + if($fwinp{$key2}[4] eq $searchstring){
> + push(@fwinrules, $key2);
> + }
> + if($fwinp{$key2}[6] eq $searchstring){
> + push(@fwinrules, $key2);
> + }
> + }
> + my @fwinarraysorted = sort { $a <=> $b } @fwinrules;
> + foreach my $rule (@fwinarraysorted)
> + {
> + $fwintext .= "
- $rule";
> + }
> + #Count services used in firewall - outgoing
> + my $fwouttext="";
> + foreach my $key3 (keys %fwout) {
> + if($fwout{$key3}[4] eq $searchstring){
> + $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
> + }
> + if($fwout{$key3}[6] eq $searchstring){
> + $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
> + }
> + }
> + my @fwoutrules = ();
> + foreach my $key3 (keys %fwout) {
> + if($fwout{$key3}[4] eq $searchstring){
> + push(@fwoutrules, $key3);
> + }
> + if($fwout{$key3}[6] eq $searchstring){
> + push(@fwoutrules, $key3);
> + }
> + }
> + my @fwoutarraysorted = sort { $a <=> $b } @fwoutrules;
> + foreach my $rule (@fwoutarraysorted)
> + {
> + $fwouttext .= "
- $rule";
> + }
> + if ($fwfwtext) {
> + $titletext .= "$fwfwtext"
> + }
> + if ($fwintext) {
> + if ($titletext) {
> + $titletext .= "
 "
> + }
> + $titletext .= "$fwintext"
> + }
> + if ($fwouttext) {
> + if ($titletext) {
> + $titletext .= "
 "
> + }
> + $titletext .= "$fwouttext"
> + }
> + return $titletext;
> +}
> sub getnetcount
> {
> my $searchstring=shift;
> @@ -2850,6 +2988,122 @@ sub getnetcount
> }
> return $srvcounter;
> }
> +sub getusedin
> +{
> + my $searchstring=shift;
> + my $titletext="";
> + my $groups=();
> + my $rules=();
> +
> + #Count services used in Network/Host group
> + my $servicegrouptext="";
> + foreach my $key (keys %customgrp) {
> + if($customgrp{$key}[2] eq $searchstring){
> + $servicegrouptext = "$Lang::tr{'fwhost cust grp'}:";
> + }
> + }
> + foreach my $key (keys %customgrp) {
> + if($customgrp{$key}[2] eq $searchstring){
> + $servicegrouptext .= "
- $customgrp{$key}[0]";
> + }
> + }
> + #Count services used in firewall - config
> + my $fwfwtext="";
> + # first set title if found
> + foreach my $key1 (keys %fwfwd) {
> + if($fwfwd{$key1}[4] eq $searchstring){
> + $fwfwtext = "$Lang::tr{'firewall rules'}:";
> + }
> + if($fwfwd{$key1}[6] eq $searchstring){
> + $fwfwtext = "$Lang::tr{'firewall rules'}:";
> + }
> + }
> + # then add rule numbers
> + my @fwfwrules = ();
> + foreach my $key1 (keys %fwfwd) {
> + if($fwfwd{$key1}[4] eq $searchstring){
> + push(@fwfwrules, $key1);
> + }
> + if($fwfwd{$key1}[6] eq $searchstring){
> + push(@fwfwrules, $key1);
> + }
> + }
> + my @fwfwarraysorted = sort { $a <=> $b } @fwfwrules;
> + foreach my $rule (@fwfwarraysorted)
> + {
> + $fwfwtext .= "
- $rule";
> + }
> + #Count services used in firewall - input
> + my $fwintext="";
> + foreach my $key2 (keys %fwinp) {
> + if($fwinp{$key2}[4] eq $searchstring){
> + $fwintext = "$Lang::tr{'incoming firewall access'}:";
> + }
> + if($fwinp{$key2}[6] eq $searchstring){
> + $fwintext = "$Lang::tr{'incoming firewall access'}:";
> + }
> + }
> + my @fwinrules = ();
> + foreach my $key2 (keys %fwinp) {
> + if($fwinp{$key2}[4] eq $searchstring){
> + push(@fwinrules, $key2);
> + }
> + if($fwinp{$key2}[6] eq $searchstring){
> + push(@fwinrules, $key2);
> + }
> + }
> + my @fwinarraysorted = sort { $a <=> $b } @fwinrules;
> + foreach my $rule (@fwinarraysorted)
> + {
> + $fwintext .= "
- $rule";
> + }
> + #Count services used in firewall - outgoing
> + my $fwouttext="";
> + foreach my $key3 (keys %fwout) {
> + if($fwout{$key3}[4] eq $searchstring){
> + $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
> + }
> + if($fwout{$key3}[6] eq $searchstring){
> + $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
> + }
> + }
> + my @fwoutrules = ();
> + foreach my $key3 (keys %fwout) {
> + if($fwout{$key3}[4] eq $searchstring){
> + push(@fwoutrules, $key3);
> + }
> + if($fwout{$key3}[6] eq $searchstring){
> + push(@fwoutrules, $key3);
> + }
> + }
> + my @fwoutarraysorted = sort { $a <=> $b } @fwoutrules;
> + foreach my $rule (@fwoutarraysorted)
> + {
> + $fwouttext .= "
- $rule";
> + }
> + if ($servicegrouptext) {
> + $titletext .= "$servicegrouptext"
> + }
> + if ($fwfwtext) {
> + if ($titletext) {
> + $titletext .= "
 "
> + }
> + $titletext .= "$fwfwtext"
> + }
> + if ($fwintext) {
> + if ($titletext) {
> + $titletext .= "
 "
> + }
> + $titletext .= "$fwintext"
> + }
> + if ($fwouttext) {
> + if ($titletext) {
> + $titletext .= "
 "
> + }
> + $titletext .= "$fwouttext"
> + }
> + return $titletext
> +}
> sub getsrvcount
> {
> my $searchstring=shift;
> @@ -2880,6 +3134,100 @@ sub getsrvcount
> }
> return $srvcounter;
> }
> +sub getsrvusedin
> +{
> + my $searchstring=shift;
> + my $titletext="";
> + #Count services used in servicegroups
> + my $servicegrouptext="";
> + foreach my $key (keys %customservicegrp) {
> + if($customservicegrp{$key}[2] eq $searchstring){
> + $servicegrouptext = "$Lang::tr{'outgoing firewall access'}:";
> + }
> + }
> + foreach my $key (keys %customservicegrp) {
> + if($customservicegrp{$key}[2] eq $searchstring){
> + $servicegrouptext .= "
- $customservicegrp{$key}[0]";
> + }
> + }
> + my $fwfwtext="";
> + # first set title if found
> + foreach my $key1 (keys %fwfwd) {
> + if($fwfwd{$key1}[15] eq $searchstring){
> + $fwfwtext = "$Lang::tr{'firewall rules'}:";
> + }
> + }
> + # then add rule numbers
> + my @fwfwrules = ();
> + foreach my $key1 (keys %fwfwd) {
> + if($fwfwd{$key1}[15] eq $searchstring){
> + push(@fwfwrules, $key1);
> + }
> + }
> + my @fwfwarraysorted = sort { $a <=> $b } @fwfwrules;
> + foreach my $rule (@fwfwarraysorted)
> + {
> + $fwfwtext .= "
- $rule";
> + }
> + #Count services used in firewall - input
> + my $fwintext="";
> + foreach my $key2 (keys %fwinp) {
> + if($fwinp{$key2}[15] eq $searchstring){
> + $fwintext = "$Lang::tr{'incoming firewall access'}:";
> + }
> + }
> + my @fwinrules = ();
> + foreach my $key2 (keys %fwinp) {
> + if($fwinp{$key2}[15] eq $searchstring){
> + push(@fwinrules, $key2);
> + }
> + }
> + my @fwinarraysorted = sort { $a <=> $b } @fwinrules;
> + foreach my $rule (@fwinarraysorted)
> + {
> + $fwintext .= "
- $rule";
> + }
> + #Count services used in firewall - outgoing
> + my $fwouttext="";
> + foreach my $key3 (keys %fwout) {
> + if($fwout{$key3}[15] eq $searchstring){
> + $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
> + }
> + }
> + my @fwoutrules = ();
> + foreach my $key3 (keys %fwout) {
> + if($fwout{$key3}[15] eq $searchstring){
> + push(@fwoutrules, $key3);
> + }
> + }
> + my @fwoutarraysorted = sort { $a <=> $b } @fwoutrules;
> + foreach my $rule (@fwoutarraysorted)
> + {
> + $fwouttext .= "
- $rule";
> + }
> + if ($servicegrouptext ne '') {
> + $titletext .= "$servicegrouptext";
> + }
> + if ($fwfwtext ne '') {
> + if ($titletext) {
> + $titletext .= "
 ";
> + }
> + $titletext .= "$fwfwtext";
> + }
> + if ($fwintext ne '') {
> + if ($titletext) {
> + $titletext .= "
 ";
> + }
> + $titletext .= "$fwintext";
> + }
> + if ($fwouttext) {
> + if ($titletext ne '') {
> + $titletext .= "
 ";
> + }
> + $titletext .= "$fwouttext";
> + }
> + return $titletext
> +}
> sub deletefromgrp
> {
> my $target=shift;
> diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl
> index 53d6903ae..130227910 100644
> --- a/langs/de/cgi-bin/de.pl
> +++ b/langs/de/cgi-bin/de.pl
> @@ -122,6 +122,7 @@
> 'The class number does not match the specified interface.' => 'Die Klassennummer passt nicht zum angegebenen Interface.',
> 'The destination IP address is invalid.' => 'Die Ziel-IP-Adresse ist ungültig.',
> 'The source IP address is invalid.' => 'Die Quell-IP-Adresse ist ungültig.',
> +'Unused' => 'Unbenutzt',
> 'Utilization on' => 'Auslastung auf',
> 'Verbose' => 'Verbose',
> 'WakeOnLan' => 'Wake On LAN',
> diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
> index ef7d75ce7..e76ca878c 100644
> --- a/langs/en/cgi-bin/en.pl
> +++ b/langs/en/cgi-bin/en.pl
> @@ -120,6 +120,7 @@
> 'The class number does not match the specified interface.' => 'The class number does not match the specified interface.',
> 'The destination IP address is invalid.' => 'The destination IP address is invalid.',
> 'The source IP address is invalid.' => 'The source IP address is invalid.',
> +'Unused' => 'Unused',
> 'Utilization on' => 'Utilization on',
> 'Verbose' => 'Verbose:',
> 'WakeOnLan' => 'Wake On Lan',
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] fwhosts.cgi: Move the tooltip into the usage counter
2025-06-23 17:16 ` [PATCH 4/5] fwhosts.cgi: Move the tooltip into the usage counter Michael Tremer
@ 2025-06-25 16:40 ` Adolf Belka
2025-06-25 16:52 ` Michael Tremer
0 siblings, 1 reply; 10+ messages in thread
From: Adolf Belka @ 2025-06-25 16:40 UTC (permalink / raw)
To: Michael Tremer; +Cc: IPFire: Development-List, dietzmann
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
I actually found the i in a blue circle icon very helpful for this. I was able to figure out where I should place my mouse pointer for the info.
With this patch applied, which was the first way I tested it, I had no idea where to place the mouse pointer as nothing looked different to the existing situation. I did try placing it over the usage counter a couple of times but obviously not for long enough in my first tries as I never saw anything get shown.
Reading the title of this patch more carefully I went back and now held the mouse pointer over the usage counter and waited for 1 to 2 seconds and now the info was shown. Typically I found it takes a minimum of 1 second and sometimes around 1.5 seconds before anything is shown and first time around I was obviously not waiting long enough at any one location.
If the usage counter is to stay as the location to place the mouse pointer onto for the info then I think this will need to be explained very clearly in the wiki documentation otherwise users might not discover this useful function directly on the WUI page.
On 23/06/2025 19:16, Michael Tremer wrote:
> This will clutter the page less as we don't have any good icon sets.
>
> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
> ---
> html/cgi-bin/fwhosts.cgi | 42 +++++++++++-----------------------------
> 1 file changed, 11 insertions(+), 31 deletions(-)
>
> diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi
> index 69970a840..953f81e5f 100644
> --- a/html/cgi-bin/fwhosts.cgi
> +++ b/html/cgi-bin/fwhosts.cgi
> @@ -1932,7 +1932,7 @@ sub viewtablenet
> }else{
> print<<END;
> <table width='100%' cellspacing='0' class='tbl'>
> - <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
> + <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
> END
> }
> my $count=0;
> @@ -1953,11 +1953,7 @@ END
> my $colnet="$customnetwork{$key}[1]/".&General::subtocidr($customnetwork{$key}[2]);
> my $netcount=&getnetcount($customnetwork{$key}[0]);
> my $netusedin=&getusedin($customnetwork{$key}[0]);
> - my $htmlparttouse="";
> - if ($netusedin) {
> - $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$netusedin' title='$netusedin'>";
> - }
> - print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col>$netcount x</td><td>$htmlparttouse</td>";
> + print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col><span title='$netusedin'>$netcount x</span></td>";
> print<<END;
> <td width='1%' $col><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
> <input type='hidden' name='ACTION' value='editnet'>
> @@ -2091,7 +2087,7 @@ sub viewtablehost
> }else{
> print<<END;
> <table width='100%' cellspacing='0' class='tbl'>
> - <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
> + <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
> END
> }
> my $count=0;
> @@ -2112,12 +2108,9 @@ END
> my $hostcount=0;
> $hostcount=&gethostcount($customhost{$key}[0]);
> my $hostusedin=&getusedin($customhost{$key}[0]);
> - my $htmlparttouse="";
> - if ($hostusedin) {
> - $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$hostusedin' title='$hostusedin'>";
> - }
> - print"<td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >".&getcolor($ip)."</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col>$hostcount x</td><td>$htmlparttouse</td>";
> - print<<END;
> + my $color = &getcolor($ip);
> + print <<END;
> + <td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >$color</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col><span title="$hostusedin">$hostcount x</span></td>
> <td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
> <input type='hidden' name='ACTION' value='edithost' />
> <input type='hidden' name='HOSTNAME' value='$customhost{$key}[0]' />
> @@ -2192,11 +2185,8 @@ sub viewtablegrp
> print "<br><b><u>$grpname</u></b> ";
> print " <b>$Lang::tr{'remark'}:</b>  $remark   " if ($remark ne '');
> my $netgrpcount=&getnetcount($grpname);
> - print "<b>$Lang::tr{'used'}:</b> $netgrpcount x ";
> my $groupusedin=&getusedin($grpname);
> - if ($groupusedin) {
> - print "<input type='image' align='top' src='/images/info.gif' alt='$groupusedin' title='$groupusedin'>";
> - }
> + print "<b>$Lang::tr{'used'}:</b> <span title='$groupusedin'>$netgrpcount x</span>";
> if($netgrpcount == '0')
> {
> print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='grp_name' value='$grpname' ><input type='hidden' name='ACTION' value='delgrp'></form>";
> @@ -2335,10 +2325,7 @@ sub viewtablelocationgrp
> # Get group count.
> my $locationgrpcount=&getlocationcount($grpname);
> my $locationusedin=&getlocusedin($grpname);
> - print "<b>$Lang::tr{'used'}:</b> $locationgrpcount x ";
> - if ($locationusedin) {
> - print "<input type='image' align='top' src='/images/info.gif' alt='$locationusedin' title='$locationusedin'>";
> - }
> + print "<b>$Lang::tr{'used'}:</b> <span title='$locationusedin'>$locationgrpcount x</span>";
> # Only display delete icon, if the group is not used by a firewall rule.
> if($locationgrpcount == '0') {
> print"<form method='post' style='display:inline'>\n";
> @@ -2459,7 +2446,7 @@ sub viewtableservice
> &General::readhasharray("$fwconfigout", \%fwout);
> print<<END;
> <table width='100%' cellspacing='0' class='tbl'>
> - <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th></th><th width='3%'></th></tr>
> + <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th width='3%'></th></tr>
> END
> my $col='';
> foreach my $key (sort { ncmp($customservice{$a}[0],$customservice{$b}[0])} keys %customservice)
> @@ -2481,14 +2468,10 @@ END
> #Neuer count
> $srvcount=&getsrvcount($customservice{$key}[0]);
> my $serviceusedin=&getsrvusedin($customservice{$key}[0]);
> - my $htmlparttouse="";
> - if ($serviceusedin) {
> - $htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$serviceusedin' title='$serviceusedin'>";
> - }
> if($customservice{$key}[3] eq 'All ICMP-Types'){print $Lang::tr{'fwdfw all icmp'};}
> elsif($customservice{$key}[3] ne 'BLANK'){print $customservice{$key}[3];}
> print<<END;
> - </td><td align='center' $col>$srvcount x</td><td>$htmlparttouse</td>
> + </td><td align='center' $col><span title='$serviceusedin'>$srvcount x</span></td>
> <td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' /><input type='hidden' name='ACTION' value='editservice' />
> <input type='hidden' name='SRV_NAME' value='$customservice{$key}[0]' />
> <input type='hidden' name='SRV_PORT' value='$customservice{$key}[1]' />
> @@ -2560,11 +2543,8 @@ sub viewtableservicegrp
> if($count >0){print"</table>";$count=1;}
> print "<br><b><u>$grpname</u></b> ";
> print "<b>$Lang::tr{'remark'}:</b> $remark " if ($remark ne '');
> - print " <b>$Lang::tr{'used'}:</b> $grpcount x ";
> my $srvgrpusedin=&getsrvusedin($customservicegrp{$key}[0]);
> - if ($srvgrpusedin) {
> - print "<input type='image' align='top' src='/images/info.gif' alt='$srvgrpusedin' title='$srvgrpusedin'>";
> - }
> + print " <b>$Lang::tr{'used'}:</b> <span title='$srvgrpusedin'>$grpcount x</span>";
> if($grpcount == '0')
> {
> print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='SRVGRP_NAME' value='$grpname' ><input type='hidden' name='ACTION' value='delservicegrp'></form>";
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] fwhosts.cgi: Move the tooltip into the usage counter
2025-06-25 16:40 ` Adolf Belka
@ 2025-06-25 16:52 ` Michael Tremer
2025-06-26 12:08 ` [EXTERN] " Peer Dietzmann
0 siblings, 1 reply; 10+ messages in thread
From: Michael Tremer @ 2025-06-25 16:52 UTC (permalink / raw)
To: Adolf Belka; +Cc: IPFire: Development-List, dietzmann
Hello Adolf,
Thank you for the feedback.
It is indeed not obvious. On the other hand, the large icon is not really a solution either in my opinion. It is simply too large and distracting for a feature that won’t be used *that* much.
I would however love some visual hint, but I cannot really think of anything between the two options that we have for now.
-Michael
> On 25 Jun 2025, at 17:40, Adolf Belka <adolf.belka@ipfire.org> wrote:
>
> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
>
> I actually found the i in a blue circle icon very helpful for this. I was able to figure out where I should place my mouse pointer for the info.
>
> With this patch applied, which was the first way I tested it, I had no idea where to place the mouse pointer as nothing looked different to the existing situation. I did try placing it over the usage counter a couple of times but obviously not for long enough in my first tries as I never saw anything get shown.
>
> Reading the title of this patch more carefully I went back and now held the mouse pointer over the usage counter and waited for 1 to 2 seconds and now the info was shown. Typically I found it takes a minimum of 1 second and sometimes around 1.5 seconds before anything is shown and first time around I was obviously not waiting long enough at any one location.
>
> If the usage counter is to stay as the location to place the mouse pointer onto for the info then I think this will need to be explained very clearly in the wiki documentation otherwise users might not discover this useful function directly on the WUI page.
>
>
> On 23/06/2025 19:16, Michael Tremer wrote:
>> This will clutter the page less as we don't have any good icon sets.
>> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
>> ---
>> html/cgi-bin/fwhosts.cgi | 42 +++++++++++-----------------------------
>> 1 file changed, 11 insertions(+), 31 deletions(-)
>> diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi
>> index 69970a840..953f81e5f 100644
>> --- a/html/cgi-bin/fwhosts.cgi
>> +++ b/html/cgi-bin/fwhosts.cgi
>> @@ -1932,7 +1932,7 @@ sub viewtablenet
>> }else{
>> print<<END;
>> <table width='100%' cellspacing='0' class='tbl'>
>> - <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
>> + <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
>> END
>> }
>> my $count=0;
>> @@ -1953,11 +1953,7 @@ END
>> my $colnet="$customnetwork{$key}[1]/".&General::subtocidr($customnetwork{$key}[2]);
>> my $netcount=&getnetcount($customnetwork{$key}[0]);
>> my $netusedin=&getusedin($customnetwork{$key}[0]);
>> - my $htmlparttouse="";
>> - if ($netusedin) {
>> - $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$netusedin' title='$netusedin'>";
>> - }
>> - print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col>$netcount x</td><td>$htmlparttouse</td>";
>> + print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col><span title='$netusedin'>$netcount x</span></td>";
>> print<<END;
>> <td width='1%' $col><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
>> <input type='hidden' name='ACTION' value='editnet'>
>> @@ -2091,7 +2087,7 @@ sub viewtablehost
>> }else{
>> print<<END;
>> <table width='100%' cellspacing='0' class='tbl'>
>> - <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
>> + <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
>> END
>> }
>> my $count=0;
>> @@ -2112,12 +2108,9 @@ END
>> my $hostcount=0;
>> $hostcount=&gethostcount($customhost{$key}[0]);
>> my $hostusedin=&getusedin($customhost{$key}[0]);
>> - my $htmlparttouse="";
>> - if ($hostusedin) {
>> - $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$hostusedin' title='$hostusedin'>";
>> - }
>> - print"<td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >".&getcolor($ip)."</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col>$hostcount x</td><td>$htmlparttouse</td>";
>> - print<<END;
>> + my $color = &getcolor($ip);
>> + print <<END;
>> + <td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >$color</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col><span title="$hostusedin">$hostcount x</span></td>
>> <td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
>> <input type='hidden' name='ACTION' value='edithost' />
>> <input type='hidden' name='HOSTNAME' value='$customhost{$key}[0]' />
>> @@ -2192,11 +2185,8 @@ sub viewtablegrp
>> print "<br><b><u>$grpname</u></b> ";
>> print " <b>$Lang::tr{'remark'}:</b>  $remark   " if ($remark ne '');
>> my $netgrpcount=&getnetcount($grpname);
>> - print "<b>$Lang::tr{'used'}:</b> $netgrpcount x ";
>> my $groupusedin=&getusedin($grpname);
>> - if ($groupusedin) {
>> - print "<input type='image' align='top' src='/images/info.gif' alt='$groupusedin' title='$groupusedin'>";
>> - }
>> + print "<b>$Lang::tr{'used'}:</b> <span title='$groupusedin'>$netgrpcount x</span>";
>> if($netgrpcount == '0')
>> {
>> print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='grp_name' value='$grpname' ><input type='hidden' name='ACTION' value='delgrp'></form>";
>> @@ -2335,10 +2325,7 @@ sub viewtablelocationgrp
>> # Get group count.
>> my $locationgrpcount=&getlocationcount($grpname);
>> my $locationusedin=&getlocusedin($grpname);
>> - print "<b>$Lang::tr{'used'}:</b> $locationgrpcount x ";
>> - if ($locationusedin) {
>> - print "<input type='image' align='top' src='/images/info.gif' alt='$locationusedin' title='$locationusedin'>";
>> - }
>> + print "<b>$Lang::tr{'used'}:</b> <span title='$locationusedin'>$locationgrpcount x</span>";
>> # Only display delete icon, if the group is not used by a firewall rule.
>> if($locationgrpcount == '0') {
>> print"<form method='post' style='display:inline'>\n";
>> @@ -2459,7 +2446,7 @@ sub viewtableservice
>> &General::readhasharray("$fwconfigout", \%fwout);
>> print<<END;
>> <table width='100%' cellspacing='0' class='tbl'>
>> - <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th></th><th width='3%'></th></tr>
>> + <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th width='3%'></th></tr>
>> END
>> my $col='';
>> foreach my $key (sort { ncmp($customservice{$a}[0],$customservice{$b}[0])} keys %customservice)
>> @@ -2481,14 +2468,10 @@ END
>> #Neuer count
>> $srvcount=&getsrvcount($customservice{$key}[0]);
>> my $serviceusedin=&getsrvusedin($customservice{$key}[0]);
>> - my $htmlparttouse="";
>> - if ($serviceusedin) {
>> - $htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$serviceusedin' title='$serviceusedin'>";
>> - }
>> if($customservice{$key}[3] eq 'All ICMP-Types'){print $Lang::tr{'fwdfw all icmp'};}
>> elsif($customservice{$key}[3] ne 'BLANK'){print $customservice{$key}[3];}
>> print<<END;
>> - </td><td align='center' $col>$srvcount x</td><td>$htmlparttouse</td>
>> + </td><td align='center' $col><span title='$serviceusedin'>$srvcount x</span></td>
>> <td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' /><input type='hidden' name='ACTION' value='editservice' />
>> <input type='hidden' name='SRV_NAME' value='$customservice{$key}[0]' />
>> <input type='hidden' name='SRV_PORT' value='$customservice{$key}[1]' />
>> @@ -2560,11 +2543,8 @@ sub viewtableservicegrp
>> if($count >0){print"</table>";$count=1;}
>> print "<br><b><u>$grpname</u></b> ";
>> print "<b>$Lang::tr{'remark'}:</b> $remark " if ($remark ne '');
>> - print " <b>$Lang::tr{'used'}:</b> $grpcount x ";
>> my $srvgrpusedin=&getsrvusedin($customservicegrp{$key}[0]);
>> - if ($srvgrpusedin) {
>> - print "<input type='image' align='top' src='/images/info.gif' alt='$srvgrpusedin' title='$srvgrpusedin'>";
>> - }
>> + print " <b>$Lang::tr{'used'}:</b> <span title='$srvgrpusedin'>$grpcount x</span>";
>> if($grpcount == '0')
>> {
>> print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='SRVGRP_NAME' value='$grpname' ><input type='hidden' name='ACTION' value='delservicegrp'></form>";
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [EXTERN] Re: [PATCH 4/5] fwhosts.cgi: Move the tooltip into the usage counter
2025-06-25 16:52 ` Michael Tremer
@ 2025-06-26 12:08 ` Peer Dietzmann
2025-06-26 15:13 ` Adam Gibbons
0 siblings, 1 reply; 10+ messages in thread
From: Peer Dietzmann @ 2025-06-26 12:08 UTC (permalink / raw)
To: Michael Tremer, Adolf Belka; +Cc: IPFire: Development-List
Hello Michael, Hello Adolf,
it was actually a bit hard to find a working solution to place this
information somewhere. I scrolled through all the icons IPFire has
"built in" and thought that a blue i icon would lead the user to think
"oh what's this? What information can I get there?". When hovering then
over the icon all necessary information is directly displayed without
any button or box or anything which would require additional code and
styling. Thereby all other icons are clickable I think there is no
additional documentation required, the users will find it on their own.
But I am also fine with Michael's solution.
--
Best regards
Peer
On 25.06.25 18:52, Michael Tremer wrote:
> Hello Adolf,
>
> Thank you for the feedback.
>
> It is indeed not obvious. On the other hand, the large icon is not really a solution either in my opinion. It is simply too large and distracting for a feature that won’t be used *that* much.
>
> I would however love some visual hint, but I cannot really think of anything between the two options that we have for now.
>
> -Michael
>
>> On 25 Jun 2025, at 17:40, Adolf Belka <adolf.belka@ipfire.org> wrote:
>>
>> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
>>
>> I actually found the i in a blue circle icon very helpful for this. I was able to figure out where I should place my mouse pointer for the info.
>>
>> With this patch applied, which was the first way I tested it, I had no idea where to place the mouse pointer as nothing looked different to the existing situation. I did try placing it over the usage counter a couple of times but obviously not for long enough in my first tries as I never saw anything get shown.
>>
>> Reading the title of this patch more carefully I went back and now held the mouse pointer over the usage counter and waited for 1 to 2 seconds and now the info was shown. Typically I found it takes a minimum of 1 second and sometimes around 1.5 seconds before anything is shown and first time around I was obviously not waiting long enough at any one location.
>>
>> If the usage counter is to stay as the location to place the mouse pointer onto for the info then I think this will need to be explained very clearly in the wiki documentation otherwise users might not discover this useful function directly on the WUI page.
>>
>>
>> On 23/06/2025 19:16, Michael Tremer wrote:
>>> This will clutter the page less as we don't have any good icon sets.
>>> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
>>> ---
>>> html/cgi-bin/fwhosts.cgi | 42 +++++++++++-----------------------------
>>> 1 file changed, 11 insertions(+), 31 deletions(-)
>>> diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi
>>> index 69970a840..953f81e5f 100644
>>> --- a/html/cgi-bin/fwhosts.cgi
>>> +++ b/html/cgi-bin/fwhosts.cgi
>>> @@ -1932,7 +1932,7 @@ sub viewtablenet
>>> }else{
>>> print<<END;
>>> <table width='100%' cellspacing='0' class='tbl'>
>>> - <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
>>> + <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
>>> END
>>> }
>>> my $count=0;
>>> @@ -1953,11 +1953,7 @@ END
>>> my $colnet="$customnetwork{$key}[1]/".&General::subtocidr($customnetwork{$key}[2]);
>>> my $netcount=&getnetcount($customnetwork{$key}[0]);
>>> my $netusedin=&getusedin($customnetwork{$key}[0]);
>>> - my $htmlparttouse="";
>>> - if ($netusedin) {
>>> - $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$netusedin' title='$netusedin'>";
>>> - }
>>> - print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col>$netcount x</td><td>$htmlparttouse</td>";
>>> + print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col><span title='$netusedin'>$netcount x</span></td>";
>>> print<<END;
>>> <td width='1%' $col><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
>>> <input type='hidden' name='ACTION' value='editnet'>
>>> @@ -2091,7 +2087,7 @@ sub viewtablehost
>>> }else{
>>> print<<END;
>>> <table width='100%' cellspacing='0' class='tbl'>
>>> - <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
>>> + <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
>>> END
>>> }
>>> my $count=0;
>>> @@ -2112,12 +2108,9 @@ END
>>> my $hostcount=0;
>>> $hostcount=&gethostcount($customhost{$key}[0]);
>>> my $hostusedin=&getusedin($customhost{$key}[0]);
>>> - my $htmlparttouse="";
>>> - if ($hostusedin) {
>>> - $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$hostusedin' title='$hostusedin'>";
>>> - }
>>> - print"<td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >".&getcolor($ip)."</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col>$hostcount x</td><td>$htmlparttouse</td>";
>>> - print<<END;
>>> + my $color = &getcolor($ip);
>>> + print <<END;
>>> + <td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >$color</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col><span title="$hostusedin">$hostcount x</span></td>
>>> <td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
>>> <input type='hidden' name='ACTION' value='edithost' />
>>> <input type='hidden' name='HOSTNAME' value='$customhost{$key}[0]' />
>>> @@ -2192,11 +2185,8 @@ sub viewtablegrp
>>> print "<br><b><u>$grpname</u></b> ";
>>> print " <b>$Lang::tr{'remark'}:</b>  $remark   " if ($remark ne '');
>>> my $netgrpcount=&getnetcount($grpname);
>>> - print "<b>$Lang::tr{'used'}:</b> $netgrpcount x ";
>>> my $groupusedin=&getusedin($grpname);
>>> - if ($groupusedin) {
>>> - print "<input type='image' align='top' src='/images/info.gif' alt='$groupusedin' title='$groupusedin'>";
>>> - }
>>> + print "<b>$Lang::tr{'used'}:</b> <span title='$groupusedin'>$netgrpcount x</span>";
>>> if($netgrpcount == '0')
>>> {
>>> print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='grp_name' value='$grpname' ><input type='hidden' name='ACTION' value='delgrp'></form>";
>>> @@ -2335,10 +2325,7 @@ sub viewtablelocationgrp
>>> # Get group count.
>>> my $locationgrpcount=&getlocationcount($grpname);
>>> my $locationusedin=&getlocusedin($grpname);
>>> - print "<b>$Lang::tr{'used'}:</b> $locationgrpcount x ";
>>> - if ($locationusedin) {
>>> - print "<input type='image' align='top' src='/images/info.gif' alt='$locationusedin' title='$locationusedin'>";
>>> - }
>>> + print "<b>$Lang::tr{'used'}:</b> <span title='$locationusedin'>$locationgrpcount x</span>";
>>> # Only display delete icon, if the group is not used by a firewall rule.
>>> if($locationgrpcount == '0') {
>>> print"<form method='post' style='display:inline'>\n";
>>> @@ -2459,7 +2446,7 @@ sub viewtableservice
>>> &General::readhasharray("$fwconfigout", \%fwout);
>>> print<<END;
>>> <table width='100%' cellspacing='0' class='tbl'>
>>> - <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th></th><th width='3%'></th></tr>
>>> + <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th width='3%'></th></tr>
>>> END
>>> my $col='';
>>> foreach my $key (sort { ncmp($customservice{$a}[0],$customservice{$b}[0])} keys %customservice)
>>> @@ -2481,14 +2468,10 @@ END
>>> #Neuer count
>>> $srvcount=&getsrvcount($customservice{$key}[0]);
>>> my $serviceusedin=&getsrvusedin($customservice{$key}[0]);
>>> - my $htmlparttouse="";
>>> - if ($serviceusedin) {
>>> - $htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$serviceusedin' title='$serviceusedin'>";
>>> - }
>>> if($customservice{$key}[3] eq 'All ICMP-Types'){print $Lang::tr{'fwdfw all icmp'};}
>>> elsif($customservice{$key}[3] ne 'BLANK'){print $customservice{$key}[3];}
>>> print<<END;
>>> - </td><td align='center' $col>$srvcount x</td><td>$htmlparttouse</td>
>>> + </td><td align='center' $col><span title='$serviceusedin'>$srvcount x</span></td>
>>> <td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' /><input type='hidden' name='ACTION' value='editservice' />
>>> <input type='hidden' name='SRV_NAME' value='$customservice{$key}[0]' />
>>> <input type='hidden' name='SRV_PORT' value='$customservice{$key}[1]' />
>>> @@ -2560,11 +2543,8 @@ sub viewtableservicegrp
>>> if($count >0){print"</table>";$count=1;}
>>> print "<br><b><u>$grpname</u></b> ";
>>> print "<b>$Lang::tr{'remark'}:</b> $remark " if ($remark ne '');
>>> - print " <b>$Lang::tr{'used'}:</b> $grpcount x ";
>>> my $srvgrpusedin=&getsrvusedin($customservicegrp{$key}[0]);
>>> - if ($srvgrpusedin) {
>>> - print "<input type='image' align='top' src='/images/info.gif' alt='$srvgrpusedin' title='$srvgrpusedin'>";
>>> - }
>>> + print " <b>$Lang::tr{'used'}:</b> <span title='$srvgrpusedin'>$grpcount x</span>";
>>> if($grpcount == '0')
>>> {
>>> print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='SRVGRP_NAME' value='$grpname' ><input type='hidden' name='ACTION' value='delservicegrp'></form>";
--
Mit freundlichem Gruß
Peer Dietzmann
Brecht-IT | Administration und Support
Brecht-Schule Hamburg GmbH
Norderstrasse 163-165 | 20097 Hamburg
Tel.: +49 40 21 11 12 - 37 | Fax: +49 40 21 11 12 - 20
E-Mail: dietzmann@brecht-schule.hamburg | www.brecht-schule.hamburg
Diese Email enthält ggfs. vertrauliche und/oder rechtlich geschützte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese Email irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Email.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Email ist nicht gestattet.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [EXTERN] Re: [PATCH 4/5] fwhosts.cgi: Move the tooltip into the usage counter
2025-06-26 12:08 ` [EXTERN] " Peer Dietzmann
@ 2025-06-26 15:13 ` Adam Gibbons
0 siblings, 0 replies; 10+ messages in thread
From: Adam Gibbons @ 2025-06-26 15:13 UTC (permalink / raw)
To: development, Peer Dietzmann, Michael Tremer, Adolf Belka
Cc: IPFire: Development-List
[-- Attachment #1: Type: text/plain, Size: 12434 bytes --]
Hi all.
I _think_ this could be accomplished by using an emoji instead.
This one might be a good option: https://emojipedia.org/information
I believe the unicode sequence for it is "U+2139 U+FE0F"
But there are obviously many other emojis to choose from which might be more appropriate.
Thanks,
Adam
On 26 June 2025 13:08:54 BST, Peer Dietzmann <dietzmann@brecht-schule.hamburg> wrote:
>Hello Michael, Hello Adolf,
>
>it was actually a bit hard to find a working solution to place this information somewhere. I scrolled through all the icons IPFire has "built in" and thought that a blue i icon would lead the user to think "oh what's this? What information can I get there?". When hovering then over the icon all necessary information is directly displayed without any button or box or anything which would require additional code and styling. Thereby all other icons are clickable I think there is no additional documentation required, the users will find it on their own.
>
>But I am also fine with Michael's solution.
>
>--
>
>Best regards
>
>Peer
>
>On 25.06.25 18:52, Michael Tremer wrote:
>> Hello Adolf,
>>
>> Thank you for the feedback.
>>
>> It is indeed not obvious. On the other hand, the large icon is not really a solution either in my opinion. It is simply too large and distracting for a feature that won’t be used *that* much.
>>
>> I would however love some visual hint, but I cannot really think of anything between the two options that we have for now.
>>
>> -Michael
>>
>>> On 25 Jun 2025, at 17:40, Adolf Belka <adolf.belka@ipfire.org> wrote:
>>>
>>> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
>>>
>>> I actually found the i in a blue circle icon very helpful for this. I was able to figure out where I should place my mouse pointer for the info.
>>>
>>> With this patch applied, which was the first way I tested it, I had no idea where to place the mouse pointer as nothing looked different to the existing situation. I did try placing it over the usage counter a couple of times but obviously not for long enough in my first tries as I never saw anything get shown.
>>>
>>> Reading the title of this patch more carefully I went back and now held the mouse pointer over the usage counter and waited for 1 to 2 seconds and now the info was shown. Typically I found it takes a minimum of 1 second and sometimes around 1.5 seconds before anything is shown and first time around I was obviously not waiting long enough at any one location.
>>>
>>> If the usage counter is to stay as the location to place the mouse pointer onto for the info then I think this will need to be explained very clearly in the wiki documentation otherwise users might not discover this useful function directly on the WUI page.
>>>
>>>
>>> On 23/06/2025 19:16, Michael Tremer wrote:
>>>> This will clutter the page less as we don't have any good icon sets.
>>>> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
>>>> ---
>>>> html/cgi-bin/fwhosts.cgi | 42 +++++++++++-----------------------------
>>>> 1 file changed, 11 insertions(+), 31 deletions(-)
>>>> diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi
>>>> index 69970a840..953f81e5f 100644
>>>> --- a/html/cgi-bin/fwhosts.cgi
>>>> +++ b/html/cgi-bin/fwhosts.cgi
>>>> @@ -1932,7 +1932,7 @@ sub viewtablenet
>>>> }else{
>>>> print<<END;
>>>> <table width='100%' cellspacing='0' class='tbl'>
>>>> - <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
>>>> + <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
>>>> END
>>>> }
>>>> my $count=0;
>>>> @@ -1953,11 +1953,7 @@ END
>>>> my $colnet="$customnetwork{$key}[1]/".&General::subtocidr($customnetwork{$key}[2]);
>>>> my $netcount=&getnetcount($customnetwork{$key}[0]);
>>>> my $netusedin=&getusedin($customnetwork{$key}[0]);
>>>> - my $htmlparttouse="";
>>>> - if ($netusedin) {
>>>> - $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$netusedin' title='$netusedin'>";
>>>> - }
>>>> - print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col>$netcount x</td><td>$htmlparttouse</td>";
>>>> + print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col><span title='$netusedin'>$netcount x</span></td>";
>>>> print<<END;
>>>> <td width='1%' $col><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
>>>> <input type='hidden' name='ACTION' value='editnet'>
>>>> @@ -2091,7 +2087,7 @@ sub viewtablehost
>>>> }else{
>>>> print<<END;
>>>> <table width='100%' cellspacing='0' class='tbl'>
>>>> - <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
>>>> + <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
>>>> END
>>>> }
>>>> my $count=0;
>>>> @@ -2112,12 +2108,9 @@ END
>>>> my $hostcount=0;
>>>> $hostcount=&gethostcount($customhost{$key}[0]);
>>>> my $hostusedin=&getusedin($customhost{$key}[0]);
>>>> - my $htmlparttouse="";
>>>> - if ($hostusedin) {
>>>> - $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$hostusedin' title='$hostusedin'>";
>>>> - }
>>>> - print"<td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >".&getcolor($ip)."</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col>$hostcount x</td><td>$htmlparttouse</td>";
>>>> - print<<END;
>>>> + my $color = &getcolor($ip);
>>>> + print <<END;
>>>> + <td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >$color</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col><span title="$hostusedin">$hostcount x</span></td>
>>>> <td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
>>>> <input type='hidden' name='ACTION' value='edithost' />
>>>> <input type='hidden' name='HOSTNAME' value='$customhost{$key}[0]' />
>>>> @@ -2192,11 +2185,8 @@ sub viewtablegrp
>>>> print "<br><b><u>$grpname</u></b> ";
>>>> print " <b>$Lang::tr{'remark'}:</b>  $remark   " if ($remark ne '');
>>>> my $netgrpcount=&getnetcount($grpname);
>>>> - print "<b>$Lang::tr{'used'}:</b> $netgrpcount x ";
>>>> my $groupusedin=&getusedin($grpname);
>>>> - if ($groupusedin) {
>>>> - print "<input type='image' align='top' src='/images/info.gif' alt='$groupusedin' title='$groupusedin'>";
>>>> - }
>>>> + print "<b>$Lang::tr{'used'}:</b> <span title='$groupusedin'>$netgrpcount x</span>";
>>>> if($netgrpcount == '0')
>>>> {
>>>> print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='grp_name' value='$grpname' ><input type='hidden' name='ACTION' value='delgrp'></form>";
>>>> @@ -2335,10 +2325,7 @@ sub viewtablelocationgrp
>>>> # Get group count.
>>>> my $locationgrpcount=&getlocationcount($grpname);
>>>> my $locationusedin=&getlocusedin($grpname);
>>>> - print "<b>$Lang::tr{'used'}:</b> $locationgrpcount x ";
>>>> - if ($locationusedin) {
>>>> - print "<input type='image' align='top' src='/images/info.gif' alt='$locationusedin' title='$locationusedin'>";
>>>> - }
>>>> + print "<b>$Lang::tr{'used'}:</b> <span title='$locationusedin'>$locationgrpcount x</span>";
>>>> # Only display delete icon, if the group is not used by a firewall rule.
>>>> if($locationgrpcount == '0') {
>>>> print"<form method='post' style='display:inline'>\n";
>>>> @@ -2459,7 +2446,7 @@ sub viewtableservice
>>>> &General::readhasharray("$fwconfigout", \%fwout);
>>>> print<<END;
>>>> <table width='100%' cellspacing='0' class='tbl'>
>>>> - <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th></th><th width='3%'></th></tr>
>>>> + <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th width='3%'></th></tr>
>>>> END
>>>> my $col='';
>>>> foreach my $key (sort { ncmp($customservice{$a}[0],$customservice{$b}[0])} keys %customservice)
>>>> @@ -2481,14 +2468,10 @@ END
>>>> #Neuer count
>>>> $srvcount=&getsrvcount($customservice{$key}[0]);
>>>> my $serviceusedin=&getsrvusedin($customservice{$key}[0]);
>>>> - my $htmlparttouse="";
>>>> - if ($serviceusedin) {
>>>> - $htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$serviceusedin' title='$serviceusedin'>";
>>>> - }
>>>> if($customservice{$key}[3] eq 'All ICMP-Types'){print $Lang::tr{'fwdfw all icmp'};}
>>>> elsif($customservice{$key}[3] ne 'BLANK'){print $customservice{$key}[3];}
>>>> print<<END;
>>>> - </td><td align='center' $col>$srvcount x</td><td>$htmlparttouse</td>
>>>> + </td><td align='center' $col><span title='$serviceusedin'>$srvcount x</span></td>
>>>> <td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' /><input type='hidden' name='ACTION' value='editservice' />
>>>> <input type='hidden' name='SRV_NAME' value='$customservice{$key}[0]' />
>>>> <input type='hidden' name='SRV_PORT' value='$customservice{$key}[1]' />
>>>> @@ -2560,11 +2543,8 @@ sub viewtableservicegrp
>>>> if($count >0){print"</table>";$count=1;}
>>>> print "<br><b><u>$grpname</u></b> ";
>>>> print "<b>$Lang::tr{'remark'}:</b> $remark " if ($remark ne '');
>>>> - print " <b>$Lang::tr{'used'}:</b> $grpcount x ";
>>>> my $srvgrpusedin=&getsrvusedin($customservicegrp{$key}[0]);
>>>> - if ($srvgrpusedin) {
>>>> - print "<input type='image' align='top' src='/images/info.gif' alt='$srvgrpusedin' title='$srvgrpusedin'>";
>>>> - }
>>>> + print " <b>$Lang::tr{'used'}:</b> <span title='$srvgrpusedin'>$grpcount x</span>";
>>>> if($grpcount == '0')
>>>> {
>>>> print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='SRVGRP_NAME' value='$grpname' ><input type='hidden' name='ACTION' value='delservicegrp'></form>";
>
>--
>Mit freundlichem Gruß
>Peer Dietzmann
>
>Brecht-IT | Administration und Support
>
>Brecht-Schule Hamburg GmbH
>Norderstrasse 163-165 | 20097 Hamburg
>Tel.: +49 40 21 11 12 - 37 | Fax: +49 40 21 11 12 - 20
>E-Mail: dietzmann@brecht-schule.hamburg | www.brecht-schule.hamburg
>
>Diese Email enthält ggfs. vertrauliche und/oder rechtlich geschützte Informationen.
>Wenn Sie nicht der richtige Adressat sind oder diese Email irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Email.
>Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Email ist nicht gestattet.
>
>
[-- Attachment #2: Type: text/html, Size: 14026 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-06-26 15:13 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-23 17:16 [PATCH 1/5] fwhosts.cgi: Show in which firewall rule objects are being used Michael Tremer
2025-06-23 17:16 ` [PATCH 2/5] fwhosts.cgi: Remove whitespace issues Michael Tremer
2025-06-23 17:16 ` [PATCH 3/5] fwhosts.cgi: Don't show anything if a host/group is unused Michael Tremer
2025-06-23 17:16 ` [PATCH 4/5] fwhosts.cgi: Move the tooltip into the usage counter Michael Tremer
2025-06-25 16:40 ` Adolf Belka
2025-06-25 16:52 ` Michael Tremer
2025-06-26 12:08 ` [EXTERN] " Peer Dietzmann
2025-06-26 15:13 ` Adam Gibbons
2025-06-23 17:16 ` [PATCH 5/5] langs: Remove the unused "Unused" translation string Michael Tremer
2025-06-25 16:25 ` [PATCH 1/5] fwhosts.cgi: Show in which firewall rule objects are being used Adolf Belka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox