mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 19:23:24 +02:00
webinterface: Add links to the configuration wiki
This patch adds a little "help" icon to the page header. If a manual entry exists for a configuration page, the icon appears and offers a quick way to access the wiki. Wiki pages can be configured in the "manualpages" file. Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de> Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org> Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
committed by
Peter Müller
parent
0ad924b1c1
commit
b0323d1946
@@ -91,7 +91,11 @@ if ( -d "/var/ipfire/langs/${language}/" ) {
|
||||
};
|
||||
};
|
||||
|
||||
### Initialize user manual
|
||||
my %manualpages = ();
|
||||
&General::readhash("${General::swroot}/main/manualpages", \%manualpages);
|
||||
|
||||
### Load selected language and theme functions
|
||||
require "${swroot}/langs/en.pl";
|
||||
require "${swroot}/langs/${language}.pl";
|
||||
eval `/bin/cat /srv/web/ipfire/html/themes/ipfire/include/functions.pl`;
|
||||
@@ -553,3 +557,19 @@ sub colorize {
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
# Get user manual URL for the specified configuration page, returns empty if no entry is configured
|
||||
sub get_manualpage_url() {
|
||||
my ($cgi_page) = @_;
|
||||
|
||||
# Ensure base url is configured
|
||||
return unless($manualpages{'BASE_URL'});
|
||||
|
||||
# Return URL
|
||||
if($cgi_page && defined($manualpages{$cgi_page})) {
|
||||
return "$manualpages{'BASE_URL'}/$manualpages{$cgi_page}";
|
||||
}
|
||||
|
||||
# No manual page configured, return nothing
|
||||
return;
|
||||
}
|
||||
|
||||
7
config/cfgroot/manualpages
Normal file
7
config/cfgroot/manualpages
Normal file
@@ -0,0 +1,7 @@
|
||||
# User manual base URL (without trailing slash)
|
||||
BASE_URL=https://wiki.ipfire.org
|
||||
|
||||
# Assign manual page URL path to CGI file ([cgi basename]=[path/to/page])
|
||||
index=configuration/system/startpage
|
||||
pppsetup=configuration/system/dial
|
||||
qos=configuration/services/qos
|
||||
Reference in New Issue
Block a user