From: Michael Tremer Date: Wed, 10 Apr 2024 12:26:43 +0000 (+0200) Subject: ovpnmain.cgi: Unify the error message box X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bc9064f69b973793d77a44d80a7028baf006a403;p=people%2Fms%2Fipfire-2.x.git ovpnmain.cgi: Unify the error message box Signed-off-by: Michael Tremer --- diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl index 43718015e..f61c5f731 100644 --- a/config/cfgroot/header.pl +++ b/config/cfgroot/header.pl @@ -366,7 +366,9 @@ sub openbox { my $title = shift; - print "
\n"; + my @classes = ("section", "is-box", @_); + + print "
\n"; # Show the title if ($title) { @@ -381,6 +383,26 @@ sub closebox { print "
"; } +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 "
    \n"; + foreach my $error (@errors) { + print "
  • $error
  • \n"; + } + print "
\n"; + + # Close the box again + &closebox(); +} + sub graph($) { my $title = shift; diff --git a/doc/language_issues.de b/doc/language_issues.de index 61ab6f05c..e317edd17 100644 --- a/doc/language_issues.de +++ b/doc/language_issues.de @@ -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 diff --git a/doc/language_issues.en b/doc/language_issues.en index 136b4b460..9d0e7bcb8 100644 --- a/doc/language_issues.en +++ b/doc/language_issues.en @@ -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 diff --git a/doc/language_issues.es b/doc/language_issues.es index 5a38bbe00..43faf70c4 100644 --- a/doc/language_issues.es +++ b/doc/language_issues.es @@ -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 diff --git a/doc/language_issues.fr b/doc/language_issues.fr index e98af2a75..9be156f68 100644 --- a/doc/language_issues.fr +++ b/doc/language_issues.fr @@ -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 diff --git a/doc/language_issues.it b/doc/language_issues.it index 8e16c0f04..560a9d3d5 100644 --- a/doc/language_issues.it +++ b/doc/language_issues.it @@ -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 diff --git a/doc/language_issues.nl b/doc/language_issues.nl index 804e19175..98cca14e0 100644 --- a/doc/language_issues.nl +++ b/doc/language_issues.nl @@ -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 diff --git a/doc/language_issues.pl b/doc/language_issues.pl index 9833159c3..d0b285b8d 100644 --- a/doc/language_issues.pl +++ b/doc/language_issues.pl @@ -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 diff --git a/doc/language_issues.ru b/doc/language_issues.ru index 77c1f66cf..df33457e9 100644 --- a/doc/language_issues.ru +++ b/doc/language_issues.ru @@ -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 diff --git a/doc/language_issues.tr b/doc/language_issues.tr index c2b3e19d1..50245d2f8 100644 --- a/doc/language_issues.tr +++ b/doc/language_issues.tr @@ -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 diff --git a/doc/language_missings b/doc/language_missings index c9b3ce789..9b879fe6f 100644 --- a/doc/language_missings +++ b/doc/language_missings @@ -80,6 +80,7 @@ < no entries < notes < okay +< oops something went wrong < optional < ovpn ciphers < ovpn crypto settings @@ -155,6 +156,7 @@ < 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 @@ -201,6 +203,7 @@ < g.dtm < g.lite < hostile networks total +< oops something went wrong < ovpn ciphers < ovpn crypto settings < ovpn dhcp settings @@ -579,6 +582,7 @@ < one month < one week < one year +< oops something went wrong < open connections < openvpn cert expires soon < openvpn cert has expired @@ -1147,6 +1151,7 @@ < one month < one week < one year +< oops something went wrong < open connections < openvpn cert expires soon < openvpn cert has expired @@ -2020,6 +2025,7 @@ < one month < one week < one year +< oops something went wrong < open connections < openvpn cert expires soon < openvpn cert has expired @@ -3043,6 +3049,7 @@ < one month < one week < one year +< oops something went wrong < open connections < openvpn cert expires soon < openvpn cert has expired @@ -3588,6 +3595,7 @@ < not affected < not validating < okay +< oops something went wrong < open connections < openvpn cert expires soon < openvpn cert has expired diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 10ef584e4..12a3f0988 100755 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -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 "$errormessage"; - print " "; - &Header::closebox(); - } + + # Show any errors + &Header::errorbox($errormessage); + &Header::openbox('100%', 'LEFT', "$Lang::tr{'generate root/host certificates'}:"); print < @@ -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 "$errormessage\n"; - print " \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 "$errormessage\n"; - print " \n"; - &Header::closebox(); - } + # Show any errors and warnings + &Header::errorbox($errormessage); if ($warnmessage) { &Header::openbox('100%', 'LEFT', $Lang::tr{'warning messages'}); diff --git a/html/html/themes/ipfire/include/css/style.css b/html/html/themes/ipfire/include/css/style.css index ee614cb0b..24ef00e4d 100644 --- a/html/html/themes/ipfire/include/css/style.css +++ b/html/html/themes/ipfire/include/css/style.css @@ -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); diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index f93e70e90..9180f9cb6 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -1951,6 +1951,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',