NEW: Add LeftAndMain.session_keepalive_ping config option.

The Session-keepalive ping that is built into LeftAndMain (i.e. all of the CMS admin) can now be
turned off.  The main reason you would want to do this is if you have enabled Session.timeout,
and you want users to be locked out of the CMS after a period.
This commit is contained in:
Sam Minnee 2013-05-31 16:27:30 +12:00
parent f2c918dc45
commit 4548b67538

View File

@ -152,6 +152,15 @@ class LeftAndMain extends Controller implements PermissionProvider {
*/
private static $extra_requirements_themedCss = array();
/**
* If true, call a keepalive ping every 5 minutes from the CMS interface,
* to ensure that the session never dies.
*
* @config
* @var boolean
*/
private static $session_keepalive_ping = true;
/**
* @var PjaxResponseNegotiator
*/
@ -327,16 +336,13 @@ class LeftAndMain extends Controller implements PermissionProvider {
HTMLEditorField::include_js();
Requirements::combine_files(
'leftandmain.js',
array_unique(array_merge(
$leftAndMainIncludes = array_unique(array_merge(
array(
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Layout.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.ActionTabSet.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Panel.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Tree.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Ping.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Content.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.EditForm.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Menu.js',
@ -347,8 +353,13 @@ class LeftAndMain extends Controller implements PermissionProvider {
),
Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang', true, true),
Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lang', true, true)
))
);
));
if($this->config()->session_keepalive_ping) {
$leftAndMainIncludes[] = FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Ping.js';
}
Requirements::combine_files('leftandmain.js', $leftAndMainIncludes);
// TODO Confuses jQuery.ondemand through document.write()
if (Director::isDev()) {