Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.
  • Loading branch information...
commit 4548b67538086db7e95d3758c2001cae59501d33 1 parent f2c918d
@sminnee sminnee authored
Showing with 33 additions and 22 deletions.
  1. +33 −22 admin/code/LeftAndMain.php
View
55 admin/code/LeftAndMain.php
@@ -153,6 +153,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
*/
protected $responseNegotiator;
@@ -327,28 +336,30 @@ public function init() {
HTMLEditorField::include_js();
- Requirements::combine_files(
- 'leftandmain.js',
- 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',
- FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Preview.js',
- FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js',
- FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.FieldHelp.js',
- FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.TreeDropdownField.js',
- ),
- Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang', true, true),
- Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lang', true, true)
- ))
- );
+ $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.Content.js',
+ FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.EditForm.js',
+ FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Menu.js',
+ FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Preview.js',
+ FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js',
+ FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.FieldHelp.js',
+ FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.TreeDropdownField.js',
+ ),
+ 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()) {
Please sign in to comment.
Something went wrong with that request. Please try again.