? .git
? .gitignore
Index: region_manager.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/region_manager/region_manager.admin.inc,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 region_manager.admin.inc
--- region_manager.admin.inc	4 Jul 2009 00:15:25 -0000	1.1.2.6
+++ region_manager.admin.inc	22 Aug 2009 13:48:26 -0000
@@ -19,12 +19,7 @@ function region_manager_settings_form() 
     '#default_value' => variable_get('region_manager_block_name', 'Block'),
   );
 
-  $form = system_settings_form($form);
-
-  // Uncomment and update the callback to override the default system settings submit handler.
-  // $form['#submit'] = array('_settings_form_submit');
-
-  return $form;
+  return system_settings_form($form);
 }
 
 /**
Index: region_manager.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/region_manager/region_manager.module,v
retrieving revision 1.1.2.13
diff -u -p -r1.1.2.13 region_manager.module
--- region_manager.module	4 Jul 2009 00:15:25 -0000	1.1.2.13
+++ region_manager.module	22 Aug 2009 13:48:26 -0000
@@ -27,22 +27,17 @@ define('REGION_MANAGER_STORAGE_OVERRIDE'
  * Implementation of hook_help().
  */
 function region_manager_help($path, $arg) {
-  global $theme_info;
-
   switch ($path) {
     case 'admin/settings/region_manager/regions':
       return t('Please select for each theme which regions you would like to have region manager available on.');
 
     case 'admin/build/region_manager/%/%':
-      if (empty($theme_info)) {
-        init_theme();
-      }
-
+      $theme_key = $arg[3];
       $region = $arg[4];
       $path = _region_manager_path_name($_REQUEST['destination']);
 
       $t_args = array(
-        '@region' => $theme_info->info['regions'][$region],
+        '@region' => region_manager_region_title($theme_key, $region),
         '%path' => _region_manager_path_name($path),
         '@nodeblock' => function_exists('nodeblock_block') ? ' create new,' : '',
         '@block' => _region_manager_block_name(),
@@ -57,21 +52,25 @@ function region_manager_help($path, $arg
  */
 function region_manager_init() {
   if (user_access('manage regions')) {
-    global $theme_key;
-
-    init_theme();
-
     // Add css and js.
     $path = drupal_get_path('module', 'region_manager');
     drupal_add_css($path .'/region_manager.css');
+  }
+}
+
+/**
+ * Implementation of hook_preprocess_page().
+ */
+function region_manager_preprocess_page(&$vars) {
+  if (user_access('manage regions')) {
+    global $theme_key;
 
     // Add the menus.
     $regions = variable_get('region_manager_regions_'. $theme_key, array());
     if (!empty($regions)) {
       foreach($regions as $region => $value) {
         if ($value && (!function_exists('visibility_api_visible') || visibility_api_visible($theme_key .':'. $region, 'region_manager'))) {
-          $menu = theme('region_manager_region_menu', $theme_key, $region);
-          drupal_set_content($region, $menu);
+          $vars[$region] = theme('region_manager_region_menu', $theme_key, $region) . $vars[$region];
         }
       }
     }
@@ -259,7 +258,7 @@ function region_manager_form_alter(&$for
  */
 function region_manager_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
   if ($op == 'insert' && function_exists('nodeblock_block') && $node->region_manager) {
-    _block_rehash();
+    _region_manager_block_rehash($node->region_manager['theme_key']);
     db_query("UPDATE {blocks} SET status = 1,  region = '%s', visibility = 1, pages = '%s' WHERE module = 'nodeblock' AND delta = '%s' AND theme = '%s'", $node->region_manager['region'], $node->region_manager['path'], $node->nid, $node->region_manager['theme_key']);
   }
 }
Index: region_manager.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/region_manager/region_manager.pages.inc,v
retrieving revision 1.1.2.10
diff -u -p -r1.1.2.10 region_manager.pages.inc
--- region_manager.pages.inc	21 May 2009 21:56:34 -0000	1.1.2.10
+++ region_manager.pages.inc	22 Aug 2009 13:48:26 -0000
@@ -23,15 +23,31 @@ define('RM_BLOCK_DISABLED', 'disabled');
  * @return
  *   The HTML output of the page.
  */
-function region_manager_manage($theme_key, $region) {
+function region_manager_manage($key, $region) {
+  global $theme_key;
+
   $output = '';
 
   // Fetch and sort blocks
-  $blocks = region_manager_blocks_load_all($theme_key, $region);
+  $blocks = region_manager_blocks_load_all($key, $region);
 
   module_load_include('inc', 'block', 'block.admin');
+
+  // If we're setting blocks for a theme different than the active theme,
+  // we need to temporarily override the global $theme_key var for
+  // _block_compare to work properly.
+  if ($theme_key != $key) {
+    $orig_theme = $theme_key;
+    $theme_key = $key;
+  }
+
   usort($blocks, '_block_compare');
 
+  // Now reset the $theme_key back if it was changed.
+  if ($orig_theme) {
+    $theme_key = $orig_theme;
+  }
+
   $output .= drupal_get_form('region_manager_manage_form', $blocks, $theme_key, $region);
 
   return $output;
@@ -239,7 +255,7 @@ function region_manager_manage_form_subm
  * @see theme_region_manager_manage_form()
  */
 function template_preprocess_region_manager_manage_form(&$vars) {
-  global $theme_key;
+  $theme_key = $vars['form']['#region_manager']['theme_key'];
 
   $block_states = $vars['block_states'] = $vars['form']['#block_states'];
   $vars['state_prefix'] = $vars['state_suffix'] = array();
