Configuring Custom Functionality

Openspace allows you to call your own customized scripts when various events are triggered in Openspace. For example, you may want users to log into a third-party system before automatically logging into Openspace or you may want them to be redirected to a customized URL when logging out of Openspace.

Note: If you are redirecting to a URL when logging out of Openspace and you press F5 (Refresh) then some browsers (specifically, Chrome) may prevent the new window from opening. This is because some browsers do not allow a new window to be opened when they are in the process of reloading the original URL. Therefore, it is not recommended that you refresh your browser when logging out of Openspace.

To achieve this, Openspace has provided a script called callouts.js that you can edit to call your customized scripts. The script is located in CONFIG_HOME\tibcohost\adminenvironment-bpmenvironment-adminservername\datan\host\plugins\com.tibco.openspace.login_n\resources\callouts\callouts.js. See Openspace Configuration Overview for more information about the config.properties file.

There are four properties that allow you to configure when the callouts.js script is run. The script is automatically run when one or more of the properties are enabled. The properties are stored in the config.properties file.

The four properties are:
  • hook.onLoadOpenspace. The script runs when Openspace loads.
  • hook.onLoginOpenspace. The script runs when a user logs in to Openspace.
  • hook.onLogoutOpenspace. The script runs when a user logs out of Openspace.
  • hook.onUnLoadOpenspace. The script runs when Openspace is unloading.
Note: There is also a hook.onCollateStrings property. Please see Configuring Sort Order for more information.
An example of the callouts.js script is shown below:
// Copyright© 2005-2013, TIBCO Software Inc

	function onLoadOpenspace()
	{
		if(document.getElementById) {
        	window.alert = function(txt) {
				// override window.alert() and instead do INFO level log in Openspace
				openspaceLog(txt);	// can also use openspaceLogN(txt,level); where level 4==WARN, 2==ERROR, 1==FATAL, 8==INFO, 16=DEBUG, 32==TRACE  etc.   		
        	}
        }
       
        window.alert("a) javascript onLoadOpenspace");
	}
				
	function onLoginOpenspace(user)
	{
		window.alert("b) javascript onLoginOpenspace " + user);
	}
	
	function onLogoutOpenspace()
	{
		window.alert("c) javascript onLogoutOpenspace" );
	}
	
	function onUnLoadOpenspace(timedOut, sessionInvalidated, urlReload)
	{
		window.alert("d) javascript onUnLoadOpenspace timedOut=" + timedOut + " sessionInvalidated=" + sessionInvalidated + " urlReload=" + urlReload );
		
		return urlReload;
	}
			
	function onCollateStrings(locale, a, b, context)
	{
		var result = "0";
		
		var ret = a.localeCompare(b);
		
		if (ret < 0)
		{
			result = "-1";
		}
		else
		{
			if( ret > 0)
			{
				result = "1";
			}
		}
		window.alert("e) javascript onCollateStrings (" + context + ") locale=" + locale + " a=" + a + " b=" + b+" result="+result );
		
		return result;
	}
Note: TIBCO recommends that you take a backup of the config.properties file before amending it.

Procedure

  1. Open the config.properties file in a text editor.
  2. Uncomment and amend the hook properties. Initially, all the hook properties are commented out and set to false. Depending on which hook property you want, amend false to true to enable it.
    For example, if you wanted your users to be redirected to www.tibco.com when they are logging out of Openspace, the hook.onLogoutOpenspace property should be amended as follows: hook.onLogoutOpenspace=true.
    Note: By default, the callouts are logged as INFO messages in the Logger Gadget.
  3. Save and close the config.properties file.
  4. Log out and log back into TIBCO Openspace for the changes to take effect.