? sites/all/modules/devel
? sites/all/modules/devel-7.x-1.x-dev.tar.gz
? sites/all/modules/devel-7.x-1.x-dev.tar.gz.1
? 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.106
diff -u -p -r1.106 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	17 Jun 2010 13:44:45 -0000	1.106
+++ modules/taxonomy/taxonomy.admin.inc	13 Jul 2010 20:33:49 -0000
@@ -284,7 +284,9 @@ function taxonomy_overview_terms($form, 
   // An array of the terms to be displayed on this page.
   $current_page = array();
 
+  $delta = 0;
   $term_deltas = array();
+  $tids = array(0 => '');
   $tree = taxonomy_get_tree($vocabulary->vid);
   $term = current($tree);
   do {
@@ -292,6 +294,8 @@ function taxonomy_overview_terms($form, 
     if (empty($term)) {
       break;
     }
+    $tids[$term->tid] = t('@term (@tid)', array('@term' => $term->name, '@tid' => $term->tid));
+    $delta++;
     // Count entries before the current page.
     if ($page && ($page * $page_increment) > $before_entries && !isset($back_step)) {
       $before_entries++;
@@ -382,16 +386,24 @@ function taxonomy_overview_terms($form, 
         '#type' => 'hidden',
         '#value' => $term->tid
       );
+      $term_tids = $tids;
+      unset($term_tids[$term->tid]);
       $form[$key]['parent'] = array(
-        '#type' => 'hidden',
+        '#type' => 'select',
         // Yes, default_value on a hidden. It needs to be changeable by the javascript.
         '#default_value' => $term->parent,
+        '#options' => $term_tids,
       );
       $form[$key]['depth'] = array(
         '#type' => 'hidden',
         // Same as above, the depth is modified by javascript, so it's a default_value.
         '#default_value' => $term->depth,
       );
+      $form[$key]['weight'] = array(
+        '#type' => 'weight',
+        '#delta' => $delta,
+        '#default_value' => $term->weight,
+      );
     }
     $form[$key]['edit'] = array('#type' => 'link', '#title' => t('edit'), '#href' => 'taxonomy/term/' . $term->tid . '/edit', '#options' => array('query' => drupal_get_destination()));
   }
@@ -446,8 +458,8 @@ function taxonomy_overview_terms_submit(
     return;
   }
 
-  $order = array_flip(array_keys($form_state['input'])); // Get the $_POST order.
-  $form_state['values'] = array_merge($order, $form_state['values']); // Update our original form with the new order.
+  // Sort term order based on weight.
+  uasort($form_state['values'], 'drupal_sort_weight');
 
   $vocabulary = $form['#vocabulary'];
   $hierarchy = 0; // Update the current hierarchy type as we go.
@@ -556,12 +568,13 @@ function theme_taxonomy_overview_terms($
 
   // Add drag and drop if parent fields are present in the form.
   if ($form['#parent_fields']) {
-    drupal_add_tabledrag('taxonomy', 'match', 'parent', 'term-parent', 'term-parent', 'term-id', FALSE);
+    drupal_add_tabledrag('taxonomy', 'match', 'parent', 'term-parent', 'term-parent', 'term-id', TRUE);
     drupal_add_tabledrag('taxonomy', 'depth', 'group', 'term-depth', NULL, NULL, FALSE);
     drupal_add_js(drupal_get_path('module', 'taxonomy') . '/taxonomy.js');
     drupal_add_js(array('taxonomy' => array('backStep' => $back_step, 'forwardStep' => $forward_step)), 'setting');
     drupal_add_css(drupal_get_path('module', 'taxonomy') . '/taxonomy.css');
   }
+  drupal_add_tabledrag('taxonomy', 'order', 'sibling', 'term-weight');
 
   $errors = form_get_errors() != FALSE ? form_get_errors() : array();
   $rows = array();
@@ -575,10 +588,12 @@ function theme_taxonomy_overview_terms($
         $term['tid']['#attributes']['class'] = array('term-id');
         $term['parent']['#attributes']['class'] = array('term-parent');
         $term['depth']['#attributes']['class'] = array('term-depth');
-        $row[0] .= drupal_render($term['parent']) . drupal_render($term['tid']) . drupal_render($term['depth']);
+        $row[0] .= drupal_render($term['tid']) . drupal_render($term['depth']);
+        $row[] = drupal_render($term['parent']);
       }
+      $term['weight']['#attributes']['class'] = array('term-weight');
+      $row[] = drupal_render($term['weight']);
       $row[] = drupal_render($term['edit']);
-
       $row = array('data' => $row);
       $rows[$key] = $row;
     }
@@ -619,7 +634,7 @@ function theme_taxonomy_overview_terms($
     $rows[] = array(array('data' => $form['#empty_text'], 'colspan' => '2'));
   }
 
-  $header = array(t('Name'), t('Operations'));
+  $header = array(t('Name'), t('Parent'), t('Weight'), t('Operations'));
   $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'taxonomy')));
   $output .= drupal_render_children($form);
   $output .= theme('pager', array('tags' => NULL));
