ovpnmain.cgi: Unify the error message box

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2024-04-10 14:26:43 +02:00
parent 1ab0b00940
commit 9f3c37ab0c
14 changed files with 62 additions and 20 deletions

View File

@@ -368,7 +368,9 @@ sub openbox {
my $title = shift;
print "<section class=\"section is-box\">\n";
my @classes = ("section", "is-box", @_);
print "<section class=\"@classes\">\n";
# Show the title
if ($title) {
@@ -383,6 +385,26 @@ sub closebox {
print "</section>";
}
sub errorbox($) {
my @errors = grep { $_ ne "" } @_;
# Do nothing if there are no errors
return unless (@errors);
# Open a new box
&openbox('100%', 'left', $Lang::tr{'oops something went wrong'}, "is-error");
# Print all error messages
print "<ul>\n";
foreach my $error (@errors) {
print "<li>$error</li>\n";
}
print "</ul>\n";
# Close the box again
&closebox();
}
sub graph($) {
my $title = shift;