User:Revansx/Session Notification of Renewal

This script is aimed at wikis using a 3rd party identity provider provided via an immutable session header. Specifically, CA Policy Agent.


 * The problem this script solves is when the 3rd party immutable session provider sets a 15 minute timer on session expiration due to client inactivity.. which happens all the time when people spend more than 15 minutes editing a page without saving.. when the session expires.. the CA Policy agent forces a redirect to renew the session, but for edit pages with pending edits, the pending edits get lost.

Localsettings.php code
This "hook-based extension" is needed to create the html pop-up div as the page is rendered. It is created with a default setting of "display:none" and "visibility:hidden" so that it is invisible upon the page initially loading. Mediawiki:Common.js is used to set the timer that reveals it after a certain amount of time has elapsed. $wgHooks['BeforePageDisplay'][] = 'zMySessionNotifyDiv'; $wgHooks['onArticleViewHeader'][] = 'zMySessionNotifyDiv'; function zMySessionNotifyDiv( OutputPage &$out, Skin &$skin ) { $out->addHTML(" --- Attention ---  It has been a while since this page communicated with the server. If you have not yet saved, you should CLICK HERE to extend your session BEFORE attempting to save your work.  "); return $out; }
 * 1) Session Expiration Notification Addon

renew.php code
a utility page placed somewhere on your webserver server Renew the session

This page was generated simply for the purpose of renewing the session. It will attempt to automatically close in 3 seconds. If the browser asks you if you want to close the page, please say "yes". Once closed, you should be returned to your work in the Wiki and you should close the session expiration notification dialog box.

function closeWindow { setTimeout(function { window.close; }, 500); }window.onload = closeWindow;