]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
ovpnmain.cgi: Unify the error message box
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 10 Apr 2024 12:26:43 +0000 (14:26 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 10 Apr 2024 12:29:02 +0000 (14:29 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
14 files changed:
config/cfgroot/header.pl
doc/language_issues.de
doc/language_issues.en
doc/language_issues.es
doc/language_issues.fr
doc/language_issues.it
doc/language_issues.nl
doc/language_issues.pl
doc/language_issues.ru
doc/language_issues.tr
doc/language_missings
html/cgi-bin/ovpnmain.cgi
html/html/themes/ipfire/include/css/style.css
langs/en/cgi-bin/en.pl

index 43718015e0f2210fa73fbc8a991ddb71e336c35d..f61c5f7316aeb63721dec9d715cfb23ab06a8fd2 100644 (file)
@@ -366,7 +366,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) {
@@ -381,6 +383,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;
 
index 61ab6f05c6d37753ae4ba569b25ef7a3cbb7d387..e317edd17961fb14056a8d21e36de7c74688fc9c 100644 (file)
@@ -988,6 +988,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 ciphers = Ciphers
 WARNING: untranslated string: ovpn crypto settings = Cryptographic Settings
index 136b4b46059c7b13aa4b689b851968baf92cdb77..9d0e7bcb895b0607c29a8dc7d264ec847f99b605 100644 (file)
@@ -1401,6 +1401,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
index 5a38bbe0028a93a4270954726ef540435081679f..43faf70c492856aadfcb4779a26c7b04ed581c03 100644 (file)
@@ -1049,6 +1049,7 @@ WARNING: untranslated string: load average = unknown string
 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 ciphers = Ciphers
index e98af2a75a3ff523d3fef55a880efdb7f8f62ae7..9be156f684d8aa0faebf02572de8760cbd9c896e 100644 (file)
@@ -995,6 +995,7 @@ WARNING: untranslated string: guardian no entries = unknown string
 WARNING: untranslated string: guardian service = unknown string
 WARNING: untranslated string: hostile networks total = Total Hostile Networks
 WARNING: untranslated string: load average = unknown string
+WARNING: untranslated string: oops something went wrong = Oops, something went wrong...
 WARNING: untranslated string: ovpn ciphers = Ciphers
 WARNING: untranslated string: ovpn crypto settings = Cryptographic Settings
 WARNING: untranslated string: ovpn dhcp settings = DHCP Settings
index 8e16c0f0441d1cb9e34cd19cbaec47b85df495aa..560a9d3d5165464f69c8b39732f2650a140302a7 100644 (file)
@@ -1229,6 +1229,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
index 804e19175cc6c1ec77c1f7b5fd9c8f34cc46722c..98cca14e0cf0db0534b846e7abf2ae0f10f39019 100644 (file)
@@ -1251,6 +1251,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
index 9833159c3a1f10d05c1d687c49178de2f96d9ce2..d0b285b8dd41fc6fd80c6768353e206aa5ffbd18 100644 (file)
@@ -1396,6 +1396,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
index 77c1f66cfbf8c2d18a951675efb7162baecc564d..df33457e9ec2673d974aaf18f754b8f3a8b891f8 100644 (file)
@@ -1395,6 +1395,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
index c2b3e19d11fef457454f7eaaf5c73d1c9419f8de..50245d2f85f5a9101cc2cd2c6caec36c3d546ac2 100644 (file)
@@ -1147,6 +1147,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
index c9b3ce789075e8a35f1c2c25b56bcf5707c295f9..9b879fe6f9c8f986606d285cb0bd98c0e174d562 100644 (file)
@@ -80,6 +80,7 @@
 < no entries
 < notes
 < okay
+< oops something went wrong
 < optional
 < ovpn ciphers
 < ovpn crypto settings
 < invalid ip or hostname
 < log drop hostile in
 < log drop hostile out
+< oops something went wrong
 < openvpn cert expires soon
 < openvpn cert has expired
 < ovpn ciphers
 < g.dtm
 < g.lite
 < hostile networks total
+< oops something went wrong
 < ovpn ciphers
 < ovpn crypto settings
 < ovpn dhcp settings
 < one month
 < one week
 < one year
+< oops something went wrong
 < open connections
 < openvpn cert expires soon
 < openvpn cert has expired
 < one month
 < one week
 < one year
+< oops something went wrong
 < open connections
 < openvpn cert expires soon
 < openvpn cert has expired
 < one month
 < one week
 < one year
+< oops something went wrong
 < open connections
 < openvpn cert expires soon
 < openvpn cert has expired
 < one month
 < one week
 < one year
+< oops something went wrong
 < open connections
 < openvpn cert expires soon
 < openvpn cert has expired
 < not affected
 < not validating
 < okay
+< oops something went wrong
 < open connections
 < openvpn cert expires soon
 < openvpn cert has expired
index 10ef584e4e3839823e7f56996f00280cc924efa6..12a3f0988e8d9d86ae4f0802dc3b9b1cc9fbbd68 100755 (executable)
@@ -2037,12 +2037,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'>
@@ -2755,12 +2753,9 @@ 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();
-    }
+
+       # Show any errors
+       &Header::errorbox($errormessage);
 
     &Header::opensection();
 
@@ -5077,12 +5072,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 ($warnmessage) {
                &Header::openbox('100%', 'LEFT', $Lang::tr{'warning messages'});
index ee614cb0b028af744bc020d57bcafc0ecd8b3ed0..24ef00e4d01bcd2395e539b780a0b4453237da96 100644 (file)
@@ -198,6 +198,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);
index f93e70e9012a08a3f0d0097f5f95adc4c6b1d88d..9180f9cb6c31f1fb9eec04236f7e287f0ac5a666 100644 (file)
 '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',