From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: development@lists.ipfire.org Subject: Re: [PATCH v2 1/3] webinterface: Add links to the configuration wiki Date: Wed, 20 Oct 2021 15:29:19 +0100 Message-ID: <31061822-6DFA-42B1-A030-70C53E72594D@ipfire.org> In-Reply-To: <6609ef74-0d11-9b4f-fa8b-47d869c5fa55@leo-andres.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4708211970122224948==" List-Id: --===============4708211970122224948== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hello, I think the function is the place where it should be. Reviewed-by: Michael Tremer -Michael > On 19 Oct 2021, at 21:27, Leo Hofmann wrote: >=20 > Hi Bernhard, >=20 > Am 06.10.2021 um 11:23 schrieb Bernhard Bitsch: >> Hi, >>=20 >> I've just included the file into my system. >> There are no problems. >> So a new patch with this file can start the formal verification and test p= rocess. >>=20 >> The original patch has some flaws ( function name, location in source ) I = will comment in an extra answer. >=20 > Have you had time to collect the issues yet? I'd like to continue working o= n them. >=20 > Best regards, > Leo >=20 >>=20 >> Regards, >> Bernhard >>=20 >> Am 06.10.2021 um 05:18 schrieb Jon Murphy: >>> Leo, >>>=20 >>> This should be complete. But I don't know how to test. >>>=20 >>> Jon >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>> On Oct 4, 2021, at 10:40 PM, Jon Murphy wrote: >>>>=20 >>>> Here is a quick template to get started: >>>>=20 >>>> >>>>=20 >>>>=20 >>>>=20 >>>> I'll keep going tomorrow. >>>>=20 >>>>=20 >>>> Jon >>>>=20 >>>>=20 >>>>=20 >>>>> On Oct 4, 2021, at 12:42 PM, Leo Hofmann wrot= e: >>>>>=20 >>>>> Hi all, >>>>>=20 >>>>> @Bernhard, Thank you again for testing this patch! >>>>>=20 >>>>> @Jon, This is the file format of the manualpages configuration: >>>>>=20 >>>>> [cgi basename]=3D[path/to/page] >>>>>=20 >>>>> For example: >>>>>=20 >>>>>> BASE_URL=3Dhttps://wiki.ipfire.org >>>>>> index=3Dconfiguration/system/startpage >>>>>=20 >>>>> Results in "index.cgi" linking to "https://wiki.ipfire.org/configuratio= n/system/startpage". >>>>> Please note that the path does not start with a slash, because the get_= manualpage_url function always adds one between the base url and the path. >>>>>=20 >>>>> Unfortunately, I couldn't figure out how to include all this in the ins= taller and I need help with that. >>>>> So I would suggest we wait until this has been approved and integrated. >>>>>=20 >>>>> Regards, >>>>> Leo >>>>>=20 >>>>> Am 28.09.2021 um 14:55 schrieb Bernhard Bitsch: >>>>>> Reviewed-by: Bernhard Bitsch >>>>>> Tested-by: Bernhard Bitsch >>>>>>=20 >>>>>> Am 28.09.2021 um 13:09 schrieb Leo-Andres Hofmann: >>>>>>> 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. >>>>>>>=20 >>>>>>> Signed-off-by: Leo-Andres Hofmann >>>>>>> --- >>>>>>> config/cfgroot/header.pl | 20 ++++++++++++++++= +++ >>>>>>> config/cfgroot/manualpages | 7 +++++++ >>>>>>> html/html/themes/ipfire/include/css/style.css | 13 ++++++++++++ >>>>>>> html/html/themes/ipfire/include/functions.pl | 17 +++++++++++++++- >>>>>>> 4 files changed, 56 insertions(+), 1 deletion(-) >>>>>>> create mode 100644 config/cfgroot/manualpages >>>>>>>=20 >>>>>>> diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl >>>>>>> index 79accbe8a..e97f90d67 100644 >>>>>>> --- a/config/cfgroot/header.pl >>>>>>> +++ b/config/cfgroot/header.pl >>>>>>> @@ -91,7 +91,11 @@ if ( -d "/var/ipfire/langs/${language}/" ) { >>>>>>> }; >>>>>>> }; >>>>>>> +### Initialize user manual >>>>>>> +my %manualpages =3D (); >>>>>>> +&General::readhash("${General::swroot}/main/manualpages", \%manualpa= ges); >>>>>>> +### 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) =3D @_; >>>>>>> + >>>>>>> + # 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; >>>>>>> +} >>>>>>> diff --git a/config/cfgroot/manualpages b/config/cfgroot/manualpages >>>>>>> new file mode 100644 >>>>>>> index 000000000..e5ab1a13c >>>>>>> --- /dev/null >>>>>>> +++ b/config/cfgroot/manualpages >>>>>>> @@ -0,0 +1,7 @@ >>>>>>> +# User manual base URL (without trailing slash) >>>>>>> +BASE_URL=3Dhttps://wiki.ipfire.org >>>>>>> + >>>>>>> +# Assign manual page URL path to CGI file ([cgi basename]=3D[path/to= /page]) >>>>>>> +index=3Dconfiguration/system/startpage >>>>>>> +pppsetup=3Dconfiguration/system/dial >>>>>>> +qos=3Dconfiguration/services/qos >>>>>>> diff --git a/html/html/themes/ipfire/include/css/style.css b/html/htm= l/themes/ipfire/include/css/style.css >>>>>>> index b92f476c4..661773675 100644 >>>>>>> --- a/html/html/themes/ipfire/include/css/style.css >>>>>>> +++ b/html/html/themes/ipfire/include/css/style.css >>>>>>> @@ -169,6 +169,19 @@ iframe { >>>>>>> margin-bottom: 1em; >>>>>>> } >>>>>>> +#main_header > * { >>>>>>> + display: inline-block; >>>>>>> + vertical-align: baseline; >>>>>>> +} >>>>>>> + >>>>>>> +#main_header > span { >>>>>>> + margin-left: 0.8em; >>>>>>> +} >>>>>>> + >>>>>>> +#main_header img { >>>>>>> + padding: 0; >>>>>>> +} >>>>>>> + >>>>>>> #footer { >>>>>>> height: 2.5em; >>>>>>> margin-bottom: 1em; >>>>>>> diff --git a/html/html/themes/ipfire/include/functions.pl b/html/html= /themes/ipfire/include/functions.pl >>>>>>> index 9f12bbe59..18931428e 100644 >>>>>>> --- a/html/html/themes/ipfire/include/functions.pl >>>>>>> +++ b/html/html/themes/ipfire/include/functions.pl >>>>>>> @@ -170,7 +170,22 @@ END >>>>>>> print <>>>>>>
>>>>>>>
>>>>>>> -

$title

>>>>>>> +
>>>>>>> +

$title

>>>>>>> +END >>>>>>> +; >>>>>>> + >>>>>>> +# Print user manual link >>>>>>> +my $manual_url =3D &Header::get_manualpage_url($scriptName); >>>>>>> +if($manual_url) { >>>>>>> + print <>>>>>> + =3D"$Lang::tr{'online >>>>>>> +END >>>>>>> +; >>>>>>> +} >>>>>>> + >>>>>>> +print <>>>>>> +
>>>>>>> END >>>>>>> ; >>>>>>> } >>>>>>>=20 >>>>=20 >>>=20 --===============4708211970122224948==--