Customising Themes via a Script

Friday, 1 September 2017 by Paul Hammond

The finPOWER Connect Cloud theme can now be customised via a Script.

This allows different colours and/ or logos to be defined based on the signed in User, e.g., a Dealer or Broker-based theme.

Our online demo lets you check out the latest build of finPOWER Connect Cloud.

NOTE: This is regularly updated to show new features and may not match screenshots shown in this article.

Overview

A central theme can be defined for finPOWER Connect Cloud via the finPOWER Connect Cloud Configuration form in finPOWER Connect.

This allows a Main and Contrast colour to be defined and also a Logo image that is used on the Sign-In form and, optionally, in the header area when signed in.

However, there was no way to define a custom theme, for example, based upon a Branch User or a Dealer or Broker employee being signed in.

Theme Modification Script

A new "Other" page is available from the finPOWER Connect Cloud Configuration form, Theme section.

This allows a Script to be defined that can modify the theme:

Cloud Configuration Form, Theme, Other page

The Script can be used to modify the theme based on either:

  • The User currently signed in.
  • The URL for the sign-in page.
    • This allows a custom URL to be provided to Users and means that a custom theme can be applied without the need to know the identity of the currently signed in User.

Sample Script

The following example modifies the theme based on both the signed in User and, in the case of the sign-in page, the URL:

Public Function Main(source As Object,
                     headerInfo As finCloudConnectFormHeaderInfo,
                     requestInfo As finScriptRequestInfo) As Boolean

  ' Assume Success
  Main = True

  ' Handle
  Select source.GetType()
    Case GetType(finCloudConnectTheme)
      ' Theme
      Main_Theme(DirectCast(source, finCloudConnectTheme), requestInfo)
  End Select

End Function

''' <summary>
'''  Theme.
''' </summary>
Public Sub Main_Theme(theme As finCloudConnectTheme,
                      requestInfo As finScriptRequestInfo)

  Dim n As Integer
  Dim BranchId As String

  If Len(requestInfo.AuthenticatedUserId) = 0 Then
    ' ----------
    ' Login page
    ' ----------
    ' Find Branch
    ' NOTE: Take the query part of the URL as being a Branch Id
    n = instrrev(requestInfo.PageUrl, "?")
    If n <> 0 Then
      BranchId = Mid(requestInfo.PageUrl, n + 1)
    End If

    ' Branch Theme
    With theme
      Select Case UCase(BranchId)
        Case "HO"
          .MainColourBackground = "red"

        Case "NAP"
          .MainColourBackground = "yellow"
      End Select
    End With
  Else
    ' -----------
    ' Application
    ' -----------
    ' User Theme
    With theme
      Select UCase(finBL.CurrentUser.UserId)
        Case "ADMIN"
          .MainColourBackground = "#FFFF00"

        Case "PH"
          .MainColourBackground = "orange"
      End Select
    End With
  End If

End Sub