### Eclipse Workspace Patch 1.0
#P drupal
Index: modules/taxonomy/taxonomy.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.test,v
retrieving revision 1.76
diff -u -r1.76 taxonomy.test
--- modules/taxonomy/taxonomy.test	6 Apr 2010 05:44:07 -0000	1.76
+++ modules/taxonomy/taxonomy.test	20 Apr 2010 00:30:32 -0000
@@ -985,3 +985,86 @@
     $this->assertEqual(strcmp($generated['[term:name]'], $term2->name), 0, t('Unsanitized token generated properly.'));
   }
 }
+
+/*
+ * Tests that the theme switches to the admin theme when adding OR editing a taxonomy term.
+ */
+class TaxonomyAdminThemeSwitch extends TaxonomyWebTestCase {
+  protected $privileged_user;
+  private $admin_theme;
+  private $default_theme;
+  private $vocabulary;
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Taxonomy admin theme switcher',
+      'description' => 'Changes the admin theme and verifies when creating and editing the term, the admin theme selected is used.',
+      'group' => 'Taxonomy',
+    );
+  }
+
+  public function setUp() {
+    //load up our extra module in inject the current theme into a meta tag for easy extraction.
+    parent::setUp('taxonomy_test_theme_detection');
+    //create a user with the appropriate access to add/edit taxonomy terms and the ability to administer themes.
+    $web_user = $this->drupalCreateUser(array('administer themes', 'administer taxonomy'));
+    $this->drupalLogin($web_user);
+  }
+
+  public function testAdminTheme() {
+    $this->changeAdminTheme();
+    $this->vocabulary = $this->createVocabulary();
+    //verify the add form for a taxonomy term
+    $this->verifyTaxonomyPage('add', 'admin/structure/taxonomy/'. $this->vocabulary->machine_name .'/add');
+    //verify the edit form for a taxonomy term
+    $term = $this->createTerm($this->vocabulary);
+    $this->verifyTaxonomyPage('edit', 'taxonomy/term/'. $term->tid .'/edit');
+  }
+
+  private function verifyTaxonomyPage($op, $path) {
+    $page = $this->drupalGet($path);
+    //lets extract the meta tag with our theme and check the value.
+    $rendered_theme = $this->extractTheme($page);
+    if ($rendered_theme != $this->admin_theme) {
+      $this->fail(t('Failed to change the admin theme when on the @op page.', array('@op' => $op)));
+    }
+  }
+
+  /**
+   * Changes the admin theme if the admin theme is the same as the current theme.  We do this to make sure that the
+   * theme does in fact change for the taxonomy add/edit pages.
+   */
+  private function changeAdminTheme() {
+    //we need to make sure the default theme != the admin theme so we can in fact verify the theme does change.
+    $this->default_theme = variable_get('theme_default', 'garland');
+    $this->admin_theme = variable_get('admin_theme', 'seven');
+
+    if ($this->default_theme == $this->admin_theme) {
+      $this->verbose('We are changing our Admin Theme from the default theme to verify it switches.');
+      //we need to change the theme
+      //if the default theme is seven lets make the admin theme garland if not default to seven.
+      if ($this->default_theme == 'seven') {
+        variable_set('admin_theme', 'garland');
+        $this->admin_theme = 'garland';
+      }
+      else {
+        variable_set('admin_theme', 'seven');
+        $this->admin_theme = 'seven';
+      }
+    }
+  }
+
+  /**
+   * Parses the page HTML output and finds the meta tag with the name theme.
+   * 
+   * @return value of the current theme rendered or FALSE.
+   */
+  private function extractTheme($page) {
+    preg_match("/<meta name=\"theme\" content=\"(.*)\" \/>/i", $page, $matches);
+    if(isset($matches[1])) {
+      return $matches[1];
+    }
+    $this->fail(t('Did not find the value of the current theme.  Possible reason is the taxonomy_test_theme_detection module was not inititalized.'));
+    return FALSE;
+  }
+}
\ No newline at end of file
Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.585
diff -u -r1.585 taxonomy.module
--- modules/taxonomy/taxonomy.module	10 Apr 2010 16:37:19 -0000	1.585
+++ modules/taxonomy/taxonomy.module	20 Apr 2010 00:30:32 -0000
@@ -280,6 +280,10 @@
     'page arguments' => array('taxonomy_form_term', 2),
     'access callback' => 'taxonomy_term_edit_access',
     'access arguments' => array(2),
+    // Adding a taxonomy term is within the "admin" path, so it uses the admin
+    // theme. Editing a term should use the same theme as adding one.
+    'theme callback' => 'variable_get',
+    'theme arguments' => array('admin_theme'),
     'type' => MENU_LOCAL_TASK,
     'weight' => 10,
     'file' => 'taxonomy.admin.inc',
@@ -338,6 +342,19 @@
 }
 
 /**
+ * Implements hook_admin_paths().
+ */
+function taxonomy_admin_paths() {
+  // Adding a taxonomy term is within the "admin/*" path, so it's an admin path
+  // via system.module. Editing a term should have the same "administrative"
+  // status as adding one.
+  $paths = array(
+    'taxonomy/term/*/edit' => TRUE,
+  );
+  return $paths;
+}
+
+/**
  * Return edit access for a given term.
  */
 function taxonomy_term_edit_access($term) {
Index: modules/taxonomy/tests/taxonomy_test_theme_detection.module
===================================================================
RCS file: modules/taxonomy/tests/taxonomy_test_theme_detection.module
diff -N modules/taxonomy/tests/taxonomy_test_theme_detection.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/taxonomy/tests/taxonomy_test_theme_detection.module	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,20 @@
+<?php
+// $Id$ 
+
+/**
+ * @file
+ * Alters the drupal head by adding a meta tag that contains the current theme being rendered for the page.
+ * /
+
+/**
+ * Implmentation of hook_html_head_alter().
+ */
+function taxonomy_test_theme_detection_html_head_alter(&$elements) {
+  global $theme;
+  //lets add our theme as a meta tag so we can retrieve it during our testing.
+  $elements['system_meta_theme'] = array(
+    '#type' => 'html_tag',
+    '#tag' => 'meta',
+    '#attributes' => array('name' => 'theme', 'content' => $theme)
+  );
+}
Index: modules/taxonomy/tests/taxonomy_test_theme_detection.info
===================================================================
RCS file: modules/taxonomy/tests/taxonomy_test_theme_detection.info
diff -N modules/taxonomy/tests/taxonomy_test_theme_detection.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/taxonomy/tests/taxonomy_test_theme_detection.info	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,8 @@
+; $Id
+name = Taxonomy Test Theme Detection
+description = Detects the current theme and adds a meta tag to the page.
+package = Testing
+version = VERSION
+core = 7.x
+files[] = taxonomy_test_theme_detection.module
+hidden = TRUE
