Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.55
diff -u -p -r1.55 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	20 Jun 2009 18:32:04 -0000	1.55
+++ modules/taxonomy/taxonomy.admin.inc	27 Jun 2009 16:19:12 -0000
@@ -677,7 +677,8 @@ function taxonomy_form_term(&$form_state
     'description' => '',
     'vocabulary_machine_name' => $vocabulary->machine_name,
     'tid' => NULL,
-    'weight' => 0,
+    // Using empty string for simulating empty user input.
+    'weight' => '',
   );
 
   // Take into account multi-step rebuilding.
@@ -760,8 +761,8 @@ function taxonomy_form_term(&$form_state
     '#title' => t('Weight'),
     '#size' => 6,
     '#default_value' => $edit['weight'],
-    '#description' => t('Terms are displayed in ascending order by weight.'),
-    '#required' => TRUE);
+    '#description' => t('Terms are displayed in ascending order by weight. When left empty, the term will be appended to the end of the term list.'),
+    '#required' => FALSE);
   $form['vid'] = array(
     '#type' => 'value',
     '#value' => $vocabulary->vid);
@@ -793,8 +794,8 @@ function taxonomy_form_term_validate($fo
   field_attach_form_validate('taxonomy_term', (object) $form_state['values'], $form, $form_state);
 
   // Ensure numeric values.
-  if (isset($form_state['values']['weight']) && !is_numeric($form_state['values']['weight'])) {
-    form_set_error('weight', t('Weight value must be numeric.'));
+  if (isset($form_state['values']['weight']) && !(is_numeric($form_state['values']['weight']) || $form_state['values']['weight'] === "")) {
+    form_set_error('weight', t('Weight value must be numeric or left empty.'));
   }
 }
 
@@ -823,6 +824,20 @@ function taxonomy_form_term_submit($form
 
   $term = taxonomy_form_term_submit_builder($form, $form_state);
 
+  // Term with empty weight is appended to the end by setting its weight to
+  // "maximum weight + 1".
+  if ($term->weight === "") {
+    // Fetch the max weight.
+    $max_weight = db_query("SELECT MAX(weight) FROM {taxonomy_term_data} WHERE vid = :vid", array(':vid' => $term->vid))->fetchField();
+    // No terms available in vocabulary, set weight to 0.
+    if ($max_weight == NULL) {
+      $term->weight = 0;
+    }
+    // Terms available, set weight to max + 1.
+    else {
+      $term->weight = $max_weight + 1;
+    }
+  }
   $status = taxonomy_term_save($term);
   switch ($status) {
     case SAVED_NEW:
