? 1011334-exposed_form-sql.patch
? 20101008-drupal-views-6.x-2.x-dev-admin_inc-undocumented_break-779668-D6__3.patch
? 318944-table_error.patch
? 468484-views-use_relationship.patch
? 497936-profile-fieldnames-have-dashes-reversed.txt
? 522318-views-display_description-human_name_1.patch
? 591302.5.patch
? 608926-theme-views-nodate.patch
? 627378-docu.patch
? 669636_0.patch
? 738792-disable-delete.patch
? 751308-translatable-d6_0_0.patch
? 759082-foreach.patch
? 783514-views_break_string.patch
? 783798-fix-group_by-sort.patch
? 808016-views-field_date-description.patch
? 816354-comment_0.patch
? 833220-form_error-fix.patch
? 833790-fix-click-sort-on-formula-fields_0_0.patch
? 868990-set-use-pager-now-gone-in-views-3_0.patch
? 898990-term-vid_limit-error.patch
? 909332-grid-css-columns_1.patch
? 909886-any-option-showing-up-incorrectly.patch
? 910256-pager-exposed-all.patch
? 940316-fix-theme-information.patch
? 946368-argument_default_user-fix-3.x_0.patch
? 948360-css.patch
? 978864_add_area_item.patch
? 979046-views_access-2.patch
? 983460-table-default_sort-7.patch
? 983460-table-default_sort.patch
? _983606.views_.tabs_on_export_results-D6.patch
? ajax-patch-current-state.patch
? patches
? preserve_tags_0.patch
? views-1001542.patch
? views-600742.patch
? views-817360.patch
? views-date-field-time-hence.patch
? views-date_now_form_validation-dev.patch
? views-field_handler_rel-607942-11.patch
? views-links-2.patch
? views-relationship-fix_0.patch
? views-translation-language-sort.patch
? views_display_20100727.patch
? modules/node/views-make-link-3.0-V2.patch
Index: plugins/views_plugin_display.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/plugins/views_plugin_display.inc,v
retrieving revision 1.27.4.48
diff -u -p -r1.27.4.48 views_plugin_display.inc
--- plugins/views_plugin_display.inc	27 Dec 2010 16:29:52 -0000	1.27.4.48
+++ plugins/views_plugin_display.inc	4 Jan 2011 19:39:24 -0000
@@ -1412,15 +1412,69 @@ class views_plugin_display extends views
         $form['#help_topic'] = 'analyze-theme';
 
         if (isset($_POST['theme'])) {
-          $this->view->theme = $_POST['theme'];
+          $this->theme = $_POST['theme'];
         }
-        elseif (empty($this->view->theme)) {
-          $this->view->theme = variable_get('theme_default', 'garland');
+        elseif (empty($this->theme)) {
+          $this->theme = variable_get('theme_default', 'bartik');
         }
 
-        global $custom_theme;
-        $custom_theme = $this->view->theme;
-        drupal_theme_initialize();
+        if (isset($GLOBALS['theme']) && $GLOBALS['theme'] == $this->theme) {
+          $this->theme_registry = theme_get_registry();
+          $theme_engine = $GLOBALS['theme_engine'];
+        }
+        else {
+          $themes = list_themes();
+          $theme = $themes[$this->theme];
+
+          // Find all our ancestor themes and put them in an array.
+          $base_theme = array();
+          $ancestor = $this->theme;
+          while ($ancestor && isset($themes[$ancestor]->base_theme)) {
+            $ancestor = $themes[$ancestor]->base_theme;
+            $base_theme[] = $themes[$ancestor];
+          }
+
+          // This code is copied directly from _drupal_theme_initialize()
+          $theme_engine = NULL;
+
+          // Initialize the theme.
+          if (isset($theme->engine)) {
+            // Include the engine.
+            include_once DRUPAL_ROOT . '/' . $theme->owner;
+
+            $theme_engine = $theme->engine;
+            if (function_exists($theme_engine . '_init')) {
+              foreach ($base_theme as $base) {
+                call_user_func($theme_engine . '_init', $base);
+              }
+              call_user_func($theme_engine . '_init', $theme);
+            }
+          }
+          else {
+            // include non-engine theme files
+            foreach ($base_theme as $base) {
+              // Include the theme file or the engine.
+              if (!empty($base->owner)) {
+                include_once DRUPAL_ROOT . '/' . $base->owner;
+              }
+            }
+            // and our theme gets one too.
+            if (!empty($theme->owner)) {
+              include_once DRUPAL_ROOT . '/' . $theme->owner;
+            }
+          }
+          $this->theme_registry = _theme_load_registry($theme, $base_theme, $theme_engine);
+        }
+
+        // If there's a theme engine involved, we also need to know its extension
+        // so we can give the proper filename.
+        $this->theme_extension = '.tpl.php';
+        if (isset($theme_engine)) {
+          $extension_function = $theme_engine . '_extension';
+          if (function_exists($extension_function)) {
+            $this->theme_extension = $extension_function();
+          }
+        }
 
         $funcs = array();
         // Get theme functions for the display. Note that some displays may
@@ -1489,7 +1543,7 @@ class views_plugin_display extends views
         $form['box']['theme'] = array(
           '#type' => 'select',
           '#options' => $options,
-          '#default_value' => $this->view->theme,
+          '#default_value' => $this->theme,
         );
 
         $form['box']['change'] = array(
@@ -1704,17 +1758,8 @@ class views_plugin_display extends views
    * Format a list of theme templates for output by the theme info helper.
    */
   function format_themes($themes) {
-    $registry = theme_get_registry();
-
-    // Run through the theme engine variables, if necessary
-    global $theme_engine;
-    $extension = '.tpl.php';
-    if (isset($theme_engine)) {
-      $extension_function = $theme_engine . '_extension';
-      if (function_exists($extension_function)) {
-        $extension = $extension_function();
-      }
-    }
+    $registry = $this->theme_registry;
+    $extension = $this->theme_extension;
 
     $output = '';
     $picked = FALSE;
