Fix ui_text_color to be unambiguous

This commit is contained in:
Ilia Rostovtsev
2021-02-13 16:56:42 +03:00
parent de93a7fda6
commit a24416e92d
3 changed files with 11 additions and 22 deletions

View File

@ -40,13 +40,13 @@ sub list_system_info
my $mask = &html_escape($a->{'netmask'}) || $text{'ifcs_nonetmask'};
my $broad = &html_escape($a->{'broadcast'}) || "";
my $status =
$a->{'up'} ? ui_text_color($text{'ifcs_act'}, 'success', 1) : ui_text_color($text{'ifcs_down'}, 'danger', 1);
$a->{'up'} ? &ui_text_color($text{'ifcs_act'}, 'success') : &ui_text_color($text{'ifcs_down'}, 'danger');
$open = 1 if (!$a->{'up'});
$html_rows .= ui_columns_row([$name, $type, $speed, $ip, $ipv6, $mask, $broad, $status]);
$html_rows .= &ui_columns_row([$name, $type, $speed, $ip, $ipv6, $mask, $broad, $status]);
}
$html_start = ui_columns_start(
$html_start = &ui_columns_start(
[ucwords($text{'ifcs_name'}),
ucwords($text{'ifcs_type'}),
$is_speed && ucwords($text{'ifcs_speed'}),
@ -56,7 +56,7 @@ sub list_system_info
ucwords($text{'ifcs_broad'}),
ucwords($text{'ifcs_act'}),
]);
$html_end .= ui_columns_end();
$html_end .= &ui_columns_end();
$html = ($html_start . $html_rows . $html_end) if ($html_rows);
}
return (

0
nohup.out Normal file
View File

View File

@ -2460,28 +2460,17 @@ Returns HTML for a text string, with its color determined by $type.
sub ui_text_color
{
my ($text, $type, $class) = @_;
my ($rv, $color);
my ($text, $type) = @_;
my ($color);
if (defined (&theme_ui_text_color)) {
return &theme_ui_text_color(@_);
}
if ($type eq "success") { $color = "3c763d"; }
elsif ($type eq "info") { $color = "31708f"; }
elsif ($type eq "warn") { $color = "8a6d3b"; }
elsif ($type eq "danger") { $color = "a94442"; }
my $style;
$style = " style=\"color: #$color\"" if (!$class);
if ($class) {
my $c = $class == 1 ? 'text' : $class;
$class = "$c-$type";
}
$rv .= "<span class='ui_text_color text_type_$type $class'$style>$text</span>\n";
return $rv;
if ($type eq "success") { $color = "#3c763d"; }
elsif ($type eq "info") { $color = "#31708f"; }
elsif ($type eq "warn") { $color = "#8a6d3b"; }
elsif ($type eq "danger") { $color = "#a94442"; }
return "<span class=\"ui_text_color text_type_$type\" style=\"color: $color\">$text</span>\n";
}
=head2 ui_alert_box(msg, type)