Editing the BlueMind Homepage
Introduction
By default, BlueMind lets you customize the logo on the home page.
To replace the default homepage by a customized page, you have to write an HPS extension.
The procedure shown here is just 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.
Installation prerequisites
A test installation of BlueMind in the latest available version.
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.
Initializing 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
Log in 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 and Bundle-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
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.
This template must contain in section <body> the code of the original authentication form. The section of the template has to contain the authentication form's original code – the latest version of this code can be found on the login.xml page of our git repository.
- From
<#if authErrorMsg??>to</#if>(tags included) - The actual form's part of the code: from
<form>to</form>(tags included)
In addition, the template's </body> tag has to be preceded by:
${jsRuntime}
Resources
Your home page resources - such as images, CSS sheets... -- have to be placed into the web-resourcespage.
You can reference the resources from this repository into the HTML code. For example, 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. 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://gitlab.bluemind.net/bluemind-public/bluemind/-/tree/master/ui/webmodules/net.bluemind.webmodules.loginapp/web-resources.
Building and installing the extension
Log in as the root user 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 at: 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 template file templates/login.xml, as well as add or remove resources in the web-resources folder.