Introduction
By default, BlueMind lets you customize the homepage logo.
To replace the default homepage by a customized page, you have to write an HPS extension.
The process shown here is just as an example.
After an update, you may have to adapt it to the new BlueMind version.
If this extension is present in your installation, we strongly recommend that you test its behavior on a pre-production platform using the version of BlueMind you are planning to use in production.
Prerequisite
A test installation of BlueMind in the latest available version (3.5.7 minimum).
Principle
To edit the BlueMind homepage and replace it by your own custom version, you have to write an HPS extension that will overload the official homepage's template and resources.
Initialising the extension
Naming the extension
You have to give your extension a name. This name can use the [a-z] characters and "." (period).
In this document, we've chosen to name the extension my.sample.loginpage, make sure you replace it by the name you have chosen for your extension.
Creating a structure for the extension
Connect as the root user on the BlueMind test installation, then:
Run the following commands:
mkdir /root/my.sample.loginpage cd /root/my.sample.loginpage mkdir META-INF templates web-resources
Create a file named
/root/my.sample.loginpage/META-INF/MANIFEST.MF,
with the following content:Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: my.sample.loginpage Bundle-SymbolicName: my.sample.loginpage Bundle-Version: 1.0.0 Bundle-Vendor: bluemind.net Fragment-Host: net.bluemind.webmodules.loginapp Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Remember to adapt the
Bundle-Name
andBundle-SymbolicName
lines according to the name you have chosen for your extension.
Defining your homepage
The homepage essentially contains two types of data:
- the page's HTML code in a template
- the page's resources (images, CSS...)
HTML Code
The page's HTML code has to be put into the file named templates/login.xml
. BlueMind will analyze this template file and dynamically populate it with data.
The <body>
section of the template has to contain the authentication form's original code – the latest version of this code can be found on la the login.xml page of our git repository. Copy the following sections:
- From
<#if authErrorMsg??>
to</#if>
(including tags) - The actual form's part of the code: from
<form>
to</form>
(including tags)
In addition, the template's </body>
tag has to be preceded by:
${jsRuntime}
Resources
Homepage resources -- images, CSS sheets... -- have to be placed into the web-resources
page.
You can reference the resources from this repository into the HTML code. E.g. to insert the web-resources/sample.jpg
resource from the templates/login.xml
template:
<img src="sample.jpg>Sample image</img>
If you create a folder structure, use the relative notation to reference the folders, always with web-resources
as the root folder. E.g. for a CSS sheet in /web-ressources/css/style.css
:
<link rel="stylesheet" href="css/style.css" />
Note: the folder structure doesn't start with '/', which would point to the website's root.
You can find default resources in our git repository: https://forge.bluemind.net/stash/projects/BM/repos/bluemind-public/browse/ui/webmodules/net.bluemind.webmodules.loginapp/web-resources?at=refs%2Fheads%2Frelease%2F3.5
Building and installing the extension
Log in as root on the BlueMind test installation, then:
Build the extension:
cd /root/my.sample.loginpage /usr/lib/jvm/bm-jdk/bin/jar cvfm /root/my.sample.loginpage_1.0.0.jar META-INF/MANIFEST.MF .
Install the extension:
cd /usr/share/bm-hps/extensions mkdir my.sample.loginpage mv /root/my.sample.loginpage_1.0.0.jar my.sample.loginpage/
Restart the HPS service:
/etc/init.d/bm-hps stop rm -rf /var/lib/bm-hps /etc/init.d/bm-hps start
Then log into BlueMind, your custom homepage should be displayed instead of the standard BlueMind homepage.
If your homepage isn't displayed, force-refresh your browser by holding the shift key while reloading the page.
Using your web browser in private mode also helps prevent possible cache issues.
Notes
Example
The code for the my.sample.loginpage plugin described in this documentation is available on the website: https://github.com/bluemind-net/loginapp-plugin-sample/tree/master/my.sample.loginpage
To test it:
- Download the extension here: https://github.com/bluemind-net/loginapp-plugin-sample/raw/master/build/my.sample.loginpage_1.0.0.jar
- Refer to steps 2 and 3 of the Building and installing the extension paragraph.
The contents of the extension can be edited using software that supports the zip compression format (e.g. winzip).
You can replace the templates/login.xml
template file, and add or delete resources in the web-resources
folder.