From f32dad672278b11f3a1096ec1720e1c6badfbafe Mon Sep 17 00:00:00 2001 From: Elliott Foster Date: Wed, 22 Feb 2012 09:53:04 -0600 Subject: [PATCH 1/2] #9 by @deviantintegral and @pwolanin --- includes/common.inc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/includes/common.inc b/includes/common.inc index a969a311d3d..3d46f4f7bd5 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -2218,6 +2218,15 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer ), 'inline' => array(), ); + // We never cache authenticated user pages, so if they are logged in we + // allow setting of the has_js cookie so batch API functions use the JS + // version. + // user_is_anonymous() is not used here because it is unavailable during + // installation. + // @see user_is_anonymous() + if (!empty($GLOBALS['user']->uid) || isset($GLOBALS['menu_admin'])) { + $javascript['footer']['inline'][] = array('code' => "document.cookie = 'has_js=1; path=/';", 'defer' => TRUE); + } } if (isset($scope) && !isset($javascript[$scope])) { From d27e70c13ea39c2a6acf607707b028f2a840b069 Mon Sep 17 00:00:00 2001 From: Elliott Foster Date: Wed, 22 Feb 2012 10:06:22 -0600 Subject: [PATCH 2/2] Update check for ['menu_admin'] since isset() would have returned TRUE if it was set to FALSE. --- includes/common.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/common.inc b/includes/common.inc index 3d46f4f7bd5..4253faf8d4e 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -2224,7 +2224,7 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer // user_is_anonymous() is not used here because it is unavailable during // installation. // @see user_is_anonymous() - if (!empty($GLOBALS['user']->uid) || isset($GLOBALS['menu_admin'])) { + if (!empty($GLOBALS['user']->uid) || !empty($GLOBALS['menu_admin'])) { $javascript['footer']['inline'][] = array('code' => "document.cookie = 'has_js=1; path=/';", 'defer' => TRUE); } }