Skip to content

Commit

Permalink
Add ability to customize the title of the WebGUI. Override the enviro…
Browse files Browse the repository at this point in the history
…nment variable 'OMV_WEBGUI_TITLE' to do that. The following placeholder are supported: '{{fqdn}}' and '{{prdname}}'.

Signed-off-by: Volker Theile <votdev@gmx.de>
(cherry picked from commit cad3806)
  • Loading branch information
votdev committed Apr 30, 2020
1 parent c9efedc commit 55f8194
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions deb/openmediavault/debian/changelog
Expand Up @@ -3,6 +3,9 @@ openmediavault (5.4.3-1) stable; urgency=low
* Issue #689: Network MTU value doesn't get applied.
* Enhance storage host driver detection. This will fix a SMART issue
related to HPSA HBA.
* Add ability to customize the title of the WebGUI. Override the
environment variable 'OMV_WEBGUI_TITLE' to do that. The following
placeholder are supported: '{{fqdn}}' and '{{prdname}}'

-- Volker Theile <volker.theile@openmediavault.org> Wed, 29 Apr 2020 08:07:24 +0200

Expand Down
Expand Up @@ -235,11 +235,17 @@ EOF;
* @return The page title string.
*/
protected function getTitle() {
$prd = new \OMV\ProductInfo();
$title = sprintf("%s %s", $prd->getName(), gettext("control panel"));
try {
$fqdn = \OMV\System\Net\Dns::getFqdn();
$title = sprintf("%s - %s", $title, $fqdn);
$prd = new \OMV\ProductInfo();
$map = [
"{{fqdn}}" => \OMV\System\Net\Dns::getFqdn(),
"{{prdname}}" => $prd->getName()
];
$title = \OMV\Environment::get("OMV_WEBGUI_TITLE",
"{{prdname}} control panel - {{fqdn}}");
foreach ($map as $mapk => $mapv) {
$title = str_replace($mapk, $mapv, $title);
}
} catch(\Exception $e) {
// Nothing to do here.
}
Expand Down

1 comment on commit 55f8194

@abunavas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thank you

Please sign in to comment.