SAP Portal: handle portal idle user timeout

[This post comes from the SDN wiki page I wrote back in May, 2008]

Abstract

The question has been asked many times. Some solutions came out in the SDN forums, but a few matched correctly the problem.

I’d like to share my solution which works great. This solution is a javascript one, which is located in the banner of the portal (masthead).

Solution

Simply edit the banner par file (com.sap.portal.navigation.masthead.par.bak) by applying the following:

  1. Create a javascript/ directory in the [PAR structure].
  2. Add the file idleTimeoutHandler.js in this directory: this is the idle-timeout-handling javascript file.
  3. Add the file disconnect.html in the main directory: this is the HTML popup.
  4. Edit the file PORTAL-INF/jsp/HeaderiView.jsp in order to call the timeout handler.

Known limitations

This solution has some limitations. Among them, the most embarassing one is the fact that the timeout timer is only reseted by subscribed events. Unchanged, it only resets the timer on navigation changes:

EPCM.subscribeEvent("urn:com.sapportals:navigation", "Navigate", pop);

If you want to add events for resetting the timer, you’ll have to add this type of lines:

EPCM.subscribeEvent("urn:com.company.my:myservice1", "OnChange", pop);
EPCM.subscribeEvent("urn:com.company.my:myservice2", "OnRequest", pop);
//etc.

Expected result

After being idle on the portal for some time, you shoud obtain a popup like the following:

Idle popup

Hope you’ll find it usable!