? 872564_empty_blocks.patch
Index: context.core.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/context/Attic/context.core.inc,v
retrieving revision 1.1.2.3.2.20.2.26
diff -u -p -r1.1.2.3.2.20.2.26 context.core.inc
--- context.core.inc	30 Jul 2010 18:15:36 -0000	1.1.2.3.2.20.2.26
+++ context.core.inc	4 Aug 2010 16:35:15 -0000
@@ -40,7 +40,7 @@ function context_theme() {
     'file' => 'context_reaction_block.theme.inc',
   );
   $items['context_block_editable_region'] = array(
-    'arguments' => array('region' => '', 'blocks' => array()),
+    'arguments' => array('region' => '', 'blocks' => array(), 'editable' => FALSE),
     'path' => drupal_get_path('module', 'context') . '/theme',
     'template' => 'context-block-editable-region',
     'file' => 'context_reaction_block.theme.inc',
Index: plugins/context_reaction_block.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/context/plugins/Attic/context_reaction_block.inc,v
retrieving revision 1.1.2.31
diff -u -p -r1.1.2.31 context_reaction_block.inc
--- plugins/context_reaction_block.inc	30 Jul 2010 15:00:33 -0000	1.1.2.31
+++ plugins/context_reaction_block.inc	4 Aug 2010 16:35:15 -0000
@@ -193,12 +193,38 @@ class context_reaction_block extends con
       return $this->render_ajax($_GET['context_block']);
     }
     if ($this->is_enabled_region($region)) {
-      return theme('context_block_editable_region', $region, $this->block_list($region));
+      return theme('context_block_editable_region', $region, $this->block_list($region), $this->is_editable());
     }
     return '';
   }
 
   /**
+   * Determine whether inline editing requirements are met and that the current
+   * user may edit.
+   */
+  protected function is_editable($reset = FALSE) {
+    // Check requirements.
+    // Generally speaking, it does not make sense to allow anonymous users to
+    // edit a context inline. Though it may be possible to save (and restore)
+    // an edited context to an anonymous user's cookie or session, it's an
+    // edge case and probably not something we want to encourage anyway.
+    static $editable;
+    if (!isset($editable) || $reset) {
+      global $user;
+      if (module_exists('jquery_ui') && $user->uid) {
+        $editable = TRUE;
+        jquery_ui_add(array('ui.draggable', 'ui.droppable', 'ui.sortable'));
+        drupal_add_js(drupal_get_path('module', 'context') .'/plugins/context_reaction_block.js');
+        drupal_add_css(drupal_get_path('module', 'context') .'/plugins/context_reaction_block.css');
+      }
+      else {
+        $editable = FALSE;
+      }
+    }
+    return $editable;
+  }
+
+  /**
    * Return a list of enabled regions for which blocks should be built.
    * Split out into a separate method for easy overrides in extending classes.
    */
@@ -245,7 +271,11 @@ class context_reaction_block extends con
       if (!empty($build_queue[$region])) {
         foreach ($build_queue[$region] as $block) {
           $block = $this->build_block($block);
-          $context_blocks[$region][] = $block;
+          // Only include blocks with content unless inline editing is enabled
+          // (in which case all blocks should be included).
+          if (!empty($block->content) || $this->is_editable()) {
+            $context_blocks[$region][] = $block;
+          }
         }
       }
     }
Index: theme/context_reaction_block.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/context/theme/Attic/context_reaction_block.theme.inc,v
retrieving revision 1.1.2.10
diff -u -p -r1.1.2.10 context_reaction_block.theme.inc
--- theme/context_reaction_block.theme.inc	30 Jul 2010 15:00:33 -0000	1.1.2.10
+++ theme/context_reaction_block.theme.inc	4 Aug 2010 16:35:15 -0000
@@ -100,35 +100,15 @@ function template_preprocess_context_blo
  * Preprocessor for theme('context_block_editable_region').
  */
 function template_preprocess_context_block_editable_region(&$vars) {
-  // Check requirements.
-  // Generally speaking, it does not make sense to allow anonymous users to
-  // edit a context inline. Though it may be possible to save (and restore)
-  // an edited context to an anonymous user's cookie or session, it's an
-  // edge case and probably not something we want to encourage anyway.
-  static $requirements;
-  if (!isset($requirements)) {
-    global $user;
-    if (module_exists('jquery_ui') && $user->uid) {
-      $requirements = TRUE;
-      jquery_ui_add(array('ui.draggable', 'ui.droppable', 'ui.sortable'));
-      drupal_add_js(drupal_get_path('module', 'context') .'/plugins/context_reaction_block.js');
-      drupal_add_css(drupal_get_path('module', 'context') .'/plugins/context_reaction_block.css');
-    }
-    else {
-      $requirements = FALSE;
-    }
-  }
-
-  // Killswitch flag allowing other preprocessors to abort editable regions entirely.
-  $vars['editable'] = $requirements;
+  if (!empty($vars['editable'])) {
+    // Show when empty?
+    $vars['show_always'] = variable_get('context_ui_show_empty_regions', FALSE);
 
-  // Show when empty?
-  $vars['show_always'] = variable_get('context_ui_show_empty_regions', false);
-
-  // Provide the user-friendly name of the region
-  global $theme_key;
-  $regions = system_region_list($theme_key);
-  $vars['region_description'] = isset($regions[$vars['region']]) ? $regions[$vars['region']] : $vars['region'];
+    // Provide the user-friendly name of the region
+    global $theme_key;
+    $regions = system_region_list($theme_key);
+    $vars['region_description'] = isset($regions[$vars['region']]) ? $regions[$vars['region']] : $vars['region'];
+  }
 }
 
 /**
