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;

View File

@@ -964,6 +964,7 @@ WARNING: untranslated string: log drop hostile in = Log dropped packets FROM hos
WARNING: untranslated string: log drop hostile out = Log dropped packets TO hostile networks
WARNING: untranslated string: netbios nameserver daemon = NetBIOS Nameserver Daemon
WARNING: untranslated string: no entries = No entries at the moment.
WARNING: untranslated string: oops something went wrong = Oops, something went wrong...
WARNING: untranslated string: optional = Optional
WARNING: untranslated string: ovpn roadwarrior server = OpenVPN Roadwarrior Server
WARNING: untranslated string: pakfire invalid tree = Invalid repository selected

View File

@@ -1407,6 +1407,7 @@ WARNING: untranslated string: online help en = Online help (in english)
WARNING: untranslated string: only digits allowed in holdoff field = Only digits allowed in holdoff field
WARNING: untranslated string: only digits allowed in max retries field = Only digits allowed in max retries field.
WARNING: untranslated string: only digits allowed in the idle timeout = Only digits allowed in the idle timeout.
WARNING: untranslated string: oops something went wrong = Oops, something went wrong...
WARNING: untranslated string: open connections = Open Connections
WARNING: untranslated string: openssl produced an error = OpenSSL produced an error
WARNING: untranslated string: openvpn cert expires soon = Expires Soon

View File

@@ -1023,6 +1023,7 @@ WARNING: untranslated string: load average = Load Average
WARNING: untranslated string: log drop hostile in = Log dropped packets FROM hostile networks
WARNING: untranslated string: log drop hostile out = Log dropped packets TO hostile networks
WARNING: untranslated string: no data = unknown string
WARNING: untranslated string: oops something went wrong = Oops, something went wrong...
WARNING: untranslated string: openvpn cert expires soon = Expires Soon
WARNING: untranslated string: openvpn cert has expired = Expired
WARNING: untranslated string: ovpn roadwarrior server = OpenVPN Roadwarrior Server

View File

@@ -971,6 +971,7 @@ WARNING: untranslated string: guardian service = unknown string
WARNING: untranslated string: hostile networks total = Total Hostile Networks
WARNING: untranslated string: ids provider eol = (EOL)
WARNING: untranslated string: load average = Load Average
WARNING: untranslated string: oops something went wrong = Oops, something went wrong...
WARNING: untranslated string: ovpn roadwarrior server = OpenVPN Roadwarrior Server
WARNING: untranslated string: pakfire ago = ago.
WARNING: untranslated string: processors = Processors

View File

@@ -1209,6 +1209,7 @@ WARNING: untranslated string: one hour = One Hour
WARNING: untranslated string: one month = One Month
WARNING: untranslated string: one week = One Week
WARNING: untranslated string: one year = One Year
WARNING: untranslated string: oops something went wrong = Oops, something went wrong...
WARNING: untranslated string: open connections = Open Connections
WARNING: untranslated string: openvpn cert expires soon = Expires Soon
WARNING: untranslated string: openvpn cert has expired = Expired

View File

@@ -1233,6 +1233,7 @@ WARNING: untranslated string: one hour = One Hour
WARNING: untranslated string: one month = One Month
WARNING: untranslated string: one week = One Week
WARNING: untranslated string: one year = One Year
WARNING: untranslated string: oops something went wrong = Oops, something went wrong...
WARNING: untranslated string: open connections = Open Connections
WARNING: untranslated string: openvpn cert expires soon = Expires Soon
WARNING: untranslated string: openvpn cert has expired = Expired

View File

@@ -1387,6 +1387,7 @@ WARNING: untranslated string: one hour = One Hour
WARNING: untranslated string: one month = One Month
WARNING: untranslated string: one week = One Week
WARNING: untranslated string: one year = One Year
WARNING: untranslated string: oops something went wrong = Oops, something went wrong...
WARNING: untranslated string: open connections = Open Connections
WARNING: untranslated string: openvpn cert expires soon = Expires Soon
WARNING: untranslated string: openvpn cert has expired = Expired

View File

@@ -1383,6 +1383,7 @@ WARNING: untranslated string: one hour = One Hour
WARNING: untranslated string: one month = One Month
WARNING: untranslated string: one week = One Week
WARNING: untranslated string: one year = One Year
WARNING: untranslated string: oops something went wrong = Oops, something went wrong...
WARNING: untranslated string: open connections = Open Connections
WARNING: untranslated string: openvpn cert expires soon = Expires Soon
WARNING: untranslated string: openvpn cert has expired = Expired

View File

@@ -1126,6 +1126,7 @@ WARNING: untranslated string: no data = unknown string
WARNING: untranslated string: no entries = No entries at the moment.
WARNING: untranslated string: not affected = Not Affected
WARNING: untranslated string: not validating = Not validating
WARNING: untranslated string: oops something went wrong = Oops, something went wrong...
WARNING: untranslated string: open connections = Open Connections
WARNING: untranslated string: openvpn cert expires soon = Expires Soon
WARNING: untranslated string: openvpn cert has expired = Expired

View File

@@ -78,6 +78,7 @@
< no entries
< notes
< okay
< oops something went wrong
< optional
< ovpn roadwarrior server
< quick control
@@ -137,6 +138,7 @@
< load average
< log drop hostile in
< log drop hostile out
< oops something went wrong
< openvpn cert expires soon
< openvpn cert has expired
< ovpn roadwarrior server
@@ -168,6 +170,7 @@
< ids provider eol
< ids unsupported provider
< load average
< oops something went wrong
< ovpn roadwarrior server
< processors
< reg_file_data_sampling
@@ -531,6 +534,7 @@
< one month
< one week
< one year
< oops something went wrong
< open connections
< openvpn cert expires soon
< openvpn cert has expired
@@ -1084,6 +1088,7 @@
< one month
< one week
< one year
< oops something went wrong
< open connections
< openvpn cert expires soon
< openvpn cert has expired
@@ -1943,6 +1948,7 @@
< one month
< one week
< one year
< oops something went wrong
< open connections
< openvpn cert expires soon
< openvpn cert has expired
@@ -2953,6 +2959,7 @@
< one month
< one week
< one year
< oops something went wrong
< open connections
< openvpn cert expires soon
< openvpn cert has expired
@@ -3484,6 +3491,7 @@
< not affected
< not validating
< okay
< oops something went wrong
< open connections
< openvpn cert expires soon
< openvpn cert has expired

View File

@@ -1931,12 +1931,10 @@ END
&Header::showhttpheaders();
&Header::openpage($Lang::tr{'ovpn'}, 1, '');
&Header::openbigbox('100%', 'LEFT', '', '');
if ($errormessage) {
&Header::openbox('100%', 'LEFT', $Lang::tr{'error messages'});
print "<class name='base'>$errormessage";
print "&nbsp;</class>";
&Header::closebox();
}
# Show any errors
&Header::errorbox($errormessage);
&Header::openbox('100%', 'LEFT', "$Lang::tr{'generate root/host certificates'}:");
print <<END;
<form method='post' enctype='multipart/form-data'>
@@ -2699,13 +2697,12 @@ ADV_ERROR:
&Header::showhttpheaders();
&Header::openpage($Lang::tr{'status ovpn'}, 1, '');
&Header::openbigbox('100%', 'LEFT', '', $errormessage);
if ($errormessage) {
&Header::openbox('100%', 'LEFT', $Lang::tr{'error messages'});
print "<class name='base'>$errormessage\n";
print "&nbsp;</class>\n";
&Header::closebox();
}
&Header::openbox('100%', 'LEFT', $Lang::tr{'advanced server'});
# Show any errors
&Header::errorbox($errormessage);
&Header::opensection();
print <<END;
<form method='post' enctype='multipart/form-data'>
<table width='100%' border=0>
@@ -5205,12 +5202,8 @@ END
&Header::openpage($Lang::tr{'status ovpn'}, 1, '');
&Header::openbigbox('100%', 'LEFT', '', $errormessage);
if ($errormessage) {
&Header::openbox('100%', 'LEFT', $Lang::tr{'error messages'});
print "<class name='base'>$errormessage\n";
print "&nbsp;</class>\n";
&Header::closebox();
}
# Show any errors and warnings
&Header::errorbox($errormessage);
if ($cryptoerror) {
&Header::openbox('100%', 'LEFT', $Lang::tr{'crypto error'});

View File

@@ -194,6 +194,15 @@ section.is-box {
border: 1px solid var(--color-grey);
}
section.is-error {
color: var(--color-red);
border: 1px solid var(--color-red);
}
section.is-error ul {
margin-bottom: 0 !important;
}
section .title {
margin-bottom: 1rem;
border-bottom: 1px solid var(--color-grey);

View File

@@ -1953,6 +1953,7 @@
'only digits allowed in max retries field' => 'Only digits allowed in max retries field.',
'only digits allowed in the idle timeout' => 'Only digits allowed in the idle timeout.',
'only red' => 'Only RED',
'oops something went wrong' => 'Oops, something went wrong...',
'open connections' => 'Open Connections',
'open to all' => 'Override external access to ALL',
'openssl produced an error' => 'OpenSSL produced an error',