From mboxrd@z Thu Jan  1 00:00:00 1970
From: Jon Murphy <jcmurphy26@gmail.com>
To: development@lists.ipfire.org
Subject: Re: [PATCH v2 1/3] webinterface: Add links to the configuration wiki
Date: Tue, 05 Oct 2021 22:18:03 -0500
Message-ID: <EF1E94CD-2332-489F-902E-9DEF6638F5AF@gmail.com>
In-Reply-To: <522E436D-37B4-449B-8ADF-C320DF0FB2D6@gmail.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============6272774373150046769=="
List-Id: <development.lists.ipfire.org>

--===============6272774373150046769==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Leo,

This should be complete.  But I don't know how to test.

Jon





> On Oct 4, 2021, at 10:40 PM, Jon Murphy <jcmurphy26(a)gmail.com> wrote:
>=20
> Here is a quick template to get started:
>=20
> <manualpages>
>=20
>=20
>=20
> I'll keep going tomorrow.
>=20
>=20
> Jon
>=20
>=20
>=20
>> On Oct 4, 2021, at 12:42 PM, Leo Hofmann <hofmann(a)leo-andres.de> wrote:
>>=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/configuration/s=
ystem/startpage".
>> Please note that the path does not start with a slash, because the get_man=
ualpage_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 instal=
ler 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 <bbitsch(a)ipfire.org>
>>> Tested-by: Bernhard Bitsch <bbitsch(a)ipfire.org>
>>>=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 <hofmann(a)leo-andres.de>
>>>> ---
>>>>  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", \%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 emp=
ty 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/pa=
ge])
>>>> +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/html/t=
hemes/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/th=
emes/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 <<END
>>>>      <div class=3D"bigbox fixed">
>>>>          <div id=3D"main_inner" class=3D"fixed">
>>>> -            <h1>$title</h1>
>>>> +            <div id=3D"main_header">
>>>> +                <h1>$title</h1>
>>>> +END
>>>> +;
>>>> +
>>>> +# Print user manual link
>>>> +my $manual_url =3D &Header::get_manualpage_url($scriptName);
>>>> +if($manual_url) {
>>>> +    print <<END
>>>> +                <span><a href=3D"$manual_url" title=3D"$Lang::tr{'onlin=
e help en'}" target=3D"_blank"><img src=3D"/images/help-browser.png" alt=3D"$=
Lang::tr{'online help en'}"></a></span>
>>>> +END
>>>> +;
>>>> +}
>>>> +
>>>> +print <<END
>>>> +            </div>
>>>>  END
>>>>  ;
>>>>  }
>>>>=20
>=20


--===============6272774373150046769==
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="manualpages.bin"
MIME-Version: 1.0

IyBBc3NpZ24gbWFudWFsIHBhZ2UgVVJMIHBhdGggdG8gQ0dJIGZpbGUgKFtjZ2kgYmFzZW5hbWVd
PVtwYXRoL3RvL3BhZ2VdKSAKCkJBU0VfVVJMPWh0dHBzOi8vd2lraS5pcGZpcmUub3JnCmluZGV4
PWNvbmZpZ3VyYXRpb24vc3lzdGVtL3N0YXJ0cGFnZQoKIwlTeXN0ZW0gbWVudQppbmRleD1jb25m
aWd1cmF0aW9uL3N5c3RlbS9zdGFydHBhZ2UgCm1haWw9Y29uZmlndXJhdGlvbi9zeXN0ZW0vbWFp
bF9zZXJ2aWNlIApyZW1vdGU9Y29uZmlndXJhdGlvbi9zeXN0ZW0vc3NoIApiYWNrdXA9Y29uZmln
dXJhdGlvbi9zeXN0ZW0vYmFja3VwIApndWk9Y29uZmlndXJhdGlvbi9zeXN0ZW0vdXNlcmludGVy
ZmFjZSAKZmlyZWluZm89ZmlyZWluZm8gCnZ1bG5lcmFiaWxpdGllcz1jb25maWd1cmF0aW9uL3N5
c3RlbS92dWxuZXJhYmlsaXRpZXMgCnNodXRkb3duPWNvbmZpZ3VyYXRpb24vc3lzdGVtL3NodXRk
b3duIApjcmVkaXRzPWNvbmZpZ3VyYXRpb24vc3lzdGVtL2NyZWRpdHMKCiMJU3RhdHVzIG1lbnUK
c3lzdGVtPWNvbmZpZ3VyYXRpb24vc3RhdHVzL3N5c3RlbQptZW1vcnk9Y29uZmlndXJhdGlvbi9z
dGF0dXMvbWVtb3J5CnNlcnZpY2VzPWNvbmZpZ3VyYXRpb24v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