mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 10:35:53 +02:00
functions.pl: add missing sub routine for wireguard.cgi
wireguard.cgi calls errorbox and opensection/closesection, but they are missing from header.pl. ipfire had functons.pl removed and moved subroutines to header.pl and added errorbox in header.pl. to keep the change minimum so not affect other features, add errorbox and opensection/closesection in functions.pl Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
This commit is contained in:
@@ -265,3 +265,41 @@ sub openbox {
|
||||
sub closebox {
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
sub errorbox($) {
|
||||
my @errors = grep { $_ ne "" } @_;
|
||||
|
||||
# Do nothing if there are no errors
|
||||
return unless (@errors);
|
||||
|
||||
# Open a new box
|
||||
&openbox('100%', 'left', "Oops something went wrong");
|
||||
|
||||
# Print all error messages
|
||||
print "<ul>\n";
|
||||
foreach my $error (@errors) {
|
||||
print "<li>$error</li>\n";
|
||||
}
|
||||
print "</ul>\n";
|
||||
|
||||
# Close the box again
|
||||
&closebox();
|
||||
}
|
||||
|
||||
# Sections
|
||||
|
||||
sub opensection($) {
|
||||
my $title = shift;
|
||||
|
||||
# Open the section
|
||||
print "<section class=\"section\">";
|
||||
|
||||
# Show the title if set
|
||||
if ($title) {
|
||||
print " <h2 class=\"title\">${title}</h2>\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub closesection() {
|
||||
print "</section>";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user