? .DS_Store
? drupal_common_theme_00.patch
? drupal_common_theme_01.patch
? vocabulary_form_cleanup_08.patch
? vocabulary_form_cleanup_09.patch
? modules/.DS_Store
? profiles/.DS_Store
? sites/.DS_Store
? sites/default/files
? sites/default/settings.php
Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.63
diff -u -p -r1.63 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	20 Jul 2009 18:51:34 -0000	1.63
+++ modules/taxonomy/taxonomy.admin.inc	3 Aug 2009 21:40:06 -0000
@@ -97,38 +97,22 @@ function theme_taxonomy_overview_vocabul
 }
 
 /**
- * Display form for adding and editing vocabularies.
+ * Add and edit vocabularies.
+ *
+ * @param $vocabulary
+ *   A vocabulary object when editing it.
  *
  * @ingroup forms
  * @see taxonomy_form_vocabulary_submit()
  */
-function taxonomy_form_vocabulary(&$form_state, $edit = array()) {
+function taxonomy_form_vocabulary(&$form_state, $vocabulary = NULL) {
   drupal_add_js(drupal_get_path('module', 'taxonomy') . '/vocabulary.js');
-  if (!is_array($edit)) {
-    $edit = (array)$edit;
-  }
-  $edit += array(
-    'name' => '',
-    'machine_name' => '',
-    'description' => '',
-    'help' => '',
-    'nodes' => array(),
-    'hierarchy' => 0,
-    'relations' => 0,
-    'tags' => 0,
-    'multiple' => 0,
-    'required' => 0,
-    'weight' => 0,
-  );
-  $form['#vocabulary'] = (object) $edit;
-  // Check whether we need a deletion confirmation form.
-  if (isset($form_state['confirm_delete']) && isset($form_state['values']['vid'])) {
-    return taxonomy_vocabulary_confirm_delete($form_state, $form_state['values']['vid']);
-  }
+
+  $form['#vocabulary'] = $vocabulary;
   $form['name'] = array(
     '#type' => 'textfield',
     '#title' => t('Name'),
-    '#default_value' => $edit['name'],
+    '#default_value' => $vocabulary ? $vocabulary->name : NULL,
     '#maxlength' => 255,
     '#required' => TRUE,
     '#field_suffix' => ' <small id="vocabulary-name-suffix">&nbsp;</small>',
@@ -136,7 +120,7 @@ function taxonomy_form_vocabulary(&$form
   $form['machine_name'] = array(
     '#type' => 'textfield',
     '#title' => t('Machine readable name'),
-    '#default_value' => $edit['machine_name'],
+    '#default_value' => $vocabulary ? $vocabulary->machine_name : NULL,
     '#maxlength' => 255,
     '#description' => t('The unique machine readable name for this vocabulary, used for theme templates, can only contain lowercase letters, numbers and underscores.'),
     '#required' => TRUE,
@@ -145,18 +129,18 @@ function taxonomy_form_vocabulary(&$form
     '#type' => 'textfield',
     '#title' => t('Help text'),
     '#maxlength' => 255,
-    '#default_value' => $edit['help'],
-    '#description' => t('Instructions to present to the user when selecting terms, e.g., <em>"Enter a comma separated list of words"</em>.'),
+    '#default_value' => $vocabulary ? $vocabulary->help : NULL,
+    '#description' => t('Instructions to present to the user when selecting terms, e.g., %example', array('%example' => t('Enter a comma-separated list of words to describe your content.'))),
   );
   $form['description'] = array(
     '#type' => 'textfield',
     '#title' => t('Description'),
-    '#default_value' => $edit['description'],
+    '#default_value' => $vocabulary ? $vocabulary->description : NULL,
   );
   $form['nodes'] = array(
     '#type' => 'checkboxes',
     '#title' => t('Apply to content types'),
-    '#default_value' => $edit['nodes'],
+    '#default_value' => $vocabulary ? $vocabulary->nodes : array(),
     '#options' => array_map('check_plain', node_type_get_names()),
   );
   $form['settings'] = array(
@@ -167,19 +151,19 @@ function taxonomy_form_vocabulary(&$form
   $form['settings']['tags'] = array(
     '#type' => 'checkbox',
     '#title' => t('Tags'),
-    '#default_value' => $edit['tags'],
+    '#default_value' => $vocabulary ? $vocabulary->name : NULL,
     '#description' => t('Terms are created by users when submitting posts by typing a comma separated list.'),
   );
   $form['settings']['multiple'] = array(
     '#type' => 'checkbox',
     '#title' => t('Multiple select'),
-    '#default_value' => $edit['multiple'],
+    '#default_value' => $vocabulary ? $vocabulary->multiple : NULL,
     '#description' => t('Allows posts to have more than one term from this vocabulary (always true for tags).'),
   );
   $form['settings']['required'] = array(
     '#type' => 'checkbox',
     '#title' => t('Required'),
-    '#default_value' => $edit['required'],
+    '#default_value' => $vocabulary ? $vocabulary->required : NULL,
     '#description' => t('At least one term in this vocabulary must be selected when submitting a post.'),
   );
   // Set the hierarchy to "multiple parents" by default. This simplifies the
@@ -193,18 +177,25 @@ function taxonomy_form_vocabulary(&$form
     '#type' => 'value',
     '#value' => '1',
   );
-
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
-  if (isset($edit['vid'])) {
-    $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
-    $form['vid'] = array('#type' => 'value', '#value' => $edit['vid']);
-    $form['module'] = array('#type' => 'value', '#value' => $edit['module']);
+  $form['actions'] = array(
+    '#prefix' => '<div class="container-inline">',
+    '#suffix' => '</div>',
+  );
+  $form['actions']['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Save'),
+  );
+  if ($vocabulary) {
+    $form['actions']['delete'] = array(
+      '#markup' => l(t('Delete'), 'admin/structure/taxonomy/' . $vocabulary->vid . '/delete'),
+    );
   }
+
   return $form;
 }
 
 /**
- * Validation handler for the vocabulary form.
+ * Validation handler for taxonomy_form_vocabulary().
  *
  * @see taxonomy_form_vocabulary()
  */
@@ -220,29 +211,25 @@ function taxonomy_form_vocabulary_valida
     // Do not allow duplicate machine names.
     $vocabularies = taxonomy_get_vocabularies();
     foreach ($vocabularies as $vocabulary) {
-      if ($machine_name == $vocabulary->machine_name && (!isset($form_state['values']['vid']) || $vocabulary->vid != $form_state['values']['vid'])) {
+      if ($machine_name == $vocabulary->machine_name && (!isset($form['#vocabulary']->vid) || $vocabulary->vid != $form['#vocabulary']->vid)) {
         form_set_error('machine_name', t('This machine-readable name is already in use by another vocabulary and must be unique.'));
       }
     }
   }
 }
+
 /**
- * Accept the form submission for a vocabulary and save the results.
+ * Submit handler for taxonomy_form_vocabulary().
  */
 function taxonomy_form_vocabulary_submit($form, &$form_state) {
-  $old_vocabulary = $form['#vocabulary'];
-  if ($form_state['clicked_button']['#value'] == t('Delete')) {
-    // Rebuild the form to confirm vocabulary deletion.
-    $form_state['rebuild'] = TRUE;
-    $form_state['confirm_delete'] = TRUE;
-    return;
-  }
-  // Fix up the nodes array to remove unchecked nodes.
-  $form_state['values']['nodes'] = array_filter($form_state['values']['nodes']);
-  $vocabulary = (object) $form_state['values'];
-  if ($vocabulary->machine_name != $old_vocabulary->machine_name) {
-    field_attach_rename_bundle($old_vocabulary->machine_name, $vocabulary->machine_name);
+  $vocabulary_old = $form['#vocabulary'];
+  $vocabulary = (object) ($form_state['values'] += (array) $vocabulary_old);
+  $vocabulary->nodes = array_filter($vocabulary->nodes);
+
+  if ($vocabulary->machine_name != $vocabulary_old->machine_name) {
+    field_attach_rename_bundle($vocabulary_old->machine_name, $vocabulary->machine_name);
   }
+
   switch (taxonomy_vocabulary_save($vocabulary)) {
     case SAVED_NEW:
       drupal_set_message(t('Created new vocabulary %name.', array('%name' => $vocabulary->name)));
@@ -254,9 +241,7 @@ function taxonomy_form_vocabulary_submit
       break;
   }
 
-  $form_state['vid'] = $vocabulary->vid;
   $form_state['redirect'] = 'admin/structure/taxonomy';
-  return;
 }
 
 /**
@@ -893,76 +878,36 @@ function taxonomy_term_confirm_parents(&
 }
 
 /**
- * Form builder for the term delete form.
- *
- * @ingroup forms
- * @see taxonomy_term_confirm_delete_submit()
- */
-function taxonomy_term_confirm_delete(&$form_state, $tid) {
-  $term = taxonomy_term_load($tid);
-
-  $form['type'] = array('#type' => 'value', '#value' => 'term');
-  $form['name'] = array('#type' => 'value', '#value' => $term->name);
-  $form['tid'] = array('#type' => 'value', '#value' => $tid);
-  $form['vocabulary_machine_name'] = array('#type' => 'value', '#value' => $term->vocabulary_machine_name);
-  $form['delete'] = array('#type' => 'value', '#value' => TRUE);
-  return confirm_form($form,
-                  t('Are you sure you want to delete the term %title?',
-                  array('%title' => $term->name)),
-                  'admin/structure/taxonomy',
-                  t('Deleting a term will delete all its children if there are any. This action cannot be undone.'),
-                  t('Delete'),
-                  t('Cancel'));
-}
-
-/**
- * Submit handler to delete a term after confirmation.
- *
- * @see taxonomy_term_confirm_delete()
- */
-function taxonomy_term_confirm_delete_submit($form, &$form_state) {
-  taxonomy_term_delete($form_state['values']['tid']);
-  taxonomy_check_vocabulary_hierarchy($form['#vocabulary'], $form_state['values']);
-  drupal_set_message(t('Deleted term %name.', array('%name' => $form_state['values']['name'])));
-  watchdog('taxonomy', 'Deleted term %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE);
-  $form_state['redirect'] = 'admin/structure/taxonomy';
-  return;
-}
-
-/**
- * Form builder for the vocabulary delete confirmation form.
+ * Display a confirmation form for deleting a vocabulary.
  *
- * @ingroup forms
  * @see taxonomy_vocabulary_confirm_delete_submit()
  */
-function taxonomy_vocabulary_confirm_delete(&$form_state, $vid) {
-  $vocabulary = taxonomy_vocabulary_load($vid);
-
-  $form['#id'] = 'taxonomy_vocabulary_confirm_delete';
-  $form['type'] = array('#type' => 'value', '#value' => 'vocabulary');
-  $form['vid'] = array('#type' => 'value', '#value' => $vid);
-  $form['name'] = array('#type' => 'value', '#value' => $vocabulary->name);
-  $form['#submit'] = array('taxonomy_vocabulary_confirm_delete_submit');
+function taxonomy_vocabulary_confirm_delete(&$form_state, $vocabulary) {
+  $form['vid'] = array(
+    '#type' => 'value',
+    '#value' => $vocabulary->vid,
+  );
   return confirm_form($form,
-                  t('Are you sure you want to delete the vocabulary %title?',
-                  array('%title' => $vocabulary->name)),
-                  'admin/structure/taxonomy',
-                  t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'),
-                  t('Delete'),
-                  t('Cancel'));
+    t('Are you sure you want to delete vocabulary %title?',
+    array('%title' => $vocabulary->name)),
+    'admin/content/taxonomy',
+    t('Deleting this vocabulary will delete all its terms. This action cannot be undone.'),
+    t('Delete'),
+    t('Cancel')
+  );
 }
 
 /**
- * Submit handler to delete a vocabulary after confirmation.
+ * Submit handler for taxonomy_vocabulary_confirm_delete().
  *
  * @see taxonomy_vocabulary_confirm_delete()
  */
 function taxonomy_vocabulary_confirm_delete_submit($form, &$form_state) {
-  $status = taxonomy_vocabulary_delete($form_state['values']['vid']);
-  drupal_set_message(t('Deleted vocabulary %name.', array('%name' => $form_state['values']['name'])));
-  watchdog('taxonomy', 'Deleted vocabulary %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE);
+  $vocabulary = taxonomy_vocabulary_load($form_state['values']['vid']);
+  $status = taxonomy_vocabulary_delete($vocabulary->vid);
+  drupal_set_message(t('Deleted vocabulary %name.', array('%name' => $vocabulary->name)));
+  watchdog('taxonomy', 'Deleted vocabulary %name.', array('%name' => $vocabulary->name), WATCHDOG_NOTICE);
   $form_state['redirect'] = 'admin/structure/taxonomy';
-  return;
 }
 
 /**
Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.492
diff -u -p -r1.492 taxonomy.module
--- modules/taxonomy/taxonomy.module	2 Aug 2009 15:44:08 -0000	1.492
+++ modules/taxonomy/taxonomy.module	3 Aug 2009 21:40:07 -0000
@@ -245,6 +245,14 @@ function taxonomy_menu() {
     'weight' => -20,
   );
 
+  $items['admin/structure/taxonomy/%taxonomy_vocabulary/delete'] = array(
+    'title' => 'Delete vocabulary',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('taxonomy_vocabulary_confirm_delete', 3),
+    'access arguments' => array('administer taxonomy'),
+    'type' => MENU_CALLBACK,
+  );
+
   $items['admin/structure/taxonomy/%taxonomy_vocabulary/list'] = array(
     'title' => 'List terms',
     'page callback' => 'drupal_get_form',
