### Eclipse Workspace Patch 1.0
#P drupal_test_7
Index: modules/field/theme/field.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/theme/field.css,v
retrieving revision 1.2
diff -u -r1.2 field.css
--- modules/field/theme/field.css	5 Feb 2009 03:42:58 -0000	1.2
+++ modules/field/theme/field.css	7 Feb 2009 14:42:01 -0000
@@ -1,32 +1,38 @@
 /* $Id: field.css,v 1.2 2009/02/05 03:42:58 webchick Exp $ */
 
-/* Node display */
+/* Field display */
 .field .field-label,
 .field .field-label-inline,
 .field .field-label-inline-first {
-  font-weight:bold;
+  font-weight: bold;
 }
 .field .field-label-inline,
 .field .field-label-inline-first {
-  display:inline;
+  display: inline;
 }
 .field .field-label-inline {
-  visibility:hidden;
+  visibility: hidden;
 }
 
-.node-form .field-multiple-table td.field-multiple-drag {
-  width:30px;
-  padding-right:0;
+form .field-multiple-table {
+  margin: 0;
 }
-.node-form .field-multiple-table td.field-multiple-drag a.tabledrag-handle{
-  padding-right:.5em;
+form .field-multiple-table th.field-label {
+  padding-left: 0;
+}
+form .field-multiple-table td.field-multiple-drag {
+  width: 30px;
+  padding-right: 0;
+}
+form .field-multiple-table td.field-multiple-drag a.tabledrag-handle{
+  padding-right: .5em;
 }
 
-.node-form .field-add-more .form-submit{
-  margin:0;
+form .field-add-more-submit {
+  margin: .5em 0 0;
 }
 
 .node-form .number {
-  display:inline;
-  width:auto;
-}
+  display: inline;
+  width: auto;
+}
\ No newline at end of file
Index: modules/field/field.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.module,v
retrieving revision 1.2
diff -u -r1.2 field.module
--- modules/field/field.module	5 Feb 2009 01:21:16 -0000	1.2
+++ modules/field/field.module	7 Feb 2009 14:42:01 -0000
@@ -107,6 +107,7 @@
 function field_init() {
   module_load_include('inc', 'field', 'field.crud');
   module_load_include('inc', 'field', 'field.autoload');
+  drupal_add_css(drupal_get_path('module', 'field') . '/theme/field.css');
 }
 
 /**
Index: modules/field/field.form.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.form.inc,v
retrieving revision 1.2
diff -u -r1.2 field.form.inc
--- modules/field/field.form.inc	5 Feb 2009 03:42:57 -0000	1.2
+++ modules/field/field.form.inc	7 Feb 2009 14:42:01 -0000
@@ -132,12 +132,17 @@
   $title = check_plain(t($instance['label']));
   $description = field_filter_xss(t($instance['description']));
 
+  $bundle_name_url_css = str_replace('_', '-', $instance['bundle']);
+  $field_name_url_css = str_replace('_', '-', $field_name);
+
   $form_element = array(
     '#theme' => 'field_multiple_value_form',
     '#multiple' => $field['cardinality'],
     '#title' => $title,
     '#required' => $instance['required'],
     '#description' => $description,
+    '#prefix' => '<div id="' . $field_name_url_css . '-wrapper">',
+    '#suffix' => '</div>',
   );
 
   $function = $instance['widget']['module'] . '_field_widget';
@@ -146,6 +151,7 @@
       if ($element = $function($form, $form_state, $field, $instance, $items, $delta)) {
         $multiple = $field['cardinality'] > 1 || $field['cardinality'] == FIELD_CARDINALITY_UNLIMITED;
         $defaults = array(
+          // For multiple fields, title and description are handled by the wrapping table.
           '#title' => $multiple ? '' : $title,
           '#description' => $multiple ? '' : $description,
           '#required' => $delta == 0 && $instance['required'],
@@ -156,14 +162,14 @@
           '#bundle' => $instance['bundle'],
         );
 
-        // Add an input field for the delta (drag-n-drop reordering), which will
-        // be hidden by tabledrag js behavior.
+        // Input field for the delta (drag-n-drop reordering).
         if ($multiple) {
-          // We name the element '_weight' to avoid clashing with column names
-          // defined by field modules.
+          // We name the element '_weight' to avoid clashing with elements
+          // defined by widget.
           $element['_weight'] = array(
             '#type' => 'weight',
-            '#delta' => $max, // this 'delta' is the 'weight' element's property
+             // Note: this 'delta' is the FAPI 'weight' element's property.
+            '#delta' => $max,
             '#default_value' => isset($items[$delta]['_weight']) ? $items[$delta]['_weight'] : $delta,
             '#weight' => 100,
           );
@@ -188,8 +194,8 @@
         // Submit callback for disabled JavaScript.
         '#submit' => array('field_add_more_submit'),
         '#ahah' => array(
-          'path' => 'field/js_add_more/' . $bundle_name_url_str . '/' . $field_name_url_str,
-          'wrapper' => $field_name_url_str . '-items',
+          'path' => 'field/js_add_more/' . $bundle_name_url_css . '/' . $field_name_url_css,
+          'wrapper' => $field_name_url_css . '-wrapper',
           'method' => 'replace',
           'effect' => 'fade',
         ),
@@ -197,12 +203,8 @@
         // the relevant field using these entries.
         '#field_name' => $field_name,
         '#bundle' => $instance['bundle'],
+        '#attributes' => array('class' => 'field-add-more-submit'),
       );
-
-      // Add wrappers for the fields and 'more' button.
-      $form_element['#prefix'] = '<div class="clear-block" id="' . $field_name_url_str . '-add-more-wrapper"><div id="' . $field_name_url_str . '-items">';
-      $form_element[$field_name . '_add_more']['#prefix'] = '<div class="field-add-more">';
-      $form_element[$field_name . '_add_more']['#suffix'] =  '</div></div></div>';
     }
   }
   return $form_element;
@@ -224,8 +226,9 @@
 
     $header = array(
       array(
-        'data' => t('!title: !required', array('!title' => $element['#title'], '!required' => $required)),
-        'colspan' => 2
+        'data' => '<label>' . t('!title: !required', array('!title' => $element['#title'], '!required' => $required)) . "</label>",
+        'colspan' => 2,
+        'class' => 'field-label',
       ),
       t('Order'),
     );
@@ -235,7 +238,10 @@
     // preview or failed validation)
     $items = array();
     foreach (element_children($element) as $key) {
-      if ($key !== $element['#field_name'] . '_add_more') {
+      if ($key === $element['#field_name'] . '_add_more') {
+        $add_more_button = &$element[$key];
+      }
+      else {
         $items[] = &$element[$key];
       }
     }
@@ -256,9 +262,11 @@
       );
     }
 
+    $output = '<div class="form-item">';
     $output .= theme('table', $header, $rows, array('id' => $table_id, 'class' => 'field-multiple-table'));
     $output .= $element['#description'] ? '<div class="description">' . $element['#description'] . '</div>' : '';
-    $output .= drupal_render($element[$element['#field_name'] . '_add_more']);
+    $output .= '<div class="clear-block">' . drupal_render($add_more_button) . '</div>';
+    $output .= '</div>';
 
     drupal_add_tabledrag($table_id, 'order', 'sibling', $order_class);
   }
@@ -390,10 +398,11 @@
   foreach ($form_path as $key) {
     $field_form = $field_form[$key];
   }
-  // We add a div around the new field to receive the ahah effect.
-  $field_form[$delta]['#prefix'] = '<div class="ahah-new-field">' . (isset($field_form[$delta]['#prefix']) ? $field_form[$delta]['#prefix'] : '');
+  // Add a div around the new field to receive the ahah effect.
+  $field_form[$delta]['#prefix'] = '<div class="ahah-new-content">' . (isset($field_form[$delta]['#prefix']) ? $field_form[$delta]['#prefix'] : '');
   $field_form[$delta]['#suffix'] = (isset($field_form[$delta]['#suffix']) ? $field_form[$delta]['#suffix'] : '') . '</div>';
-  // TODO : this causes duplication of the wrapping divs
+  // Prevent duplicate wrapper.
+  unset($field_form['#prefix'], $field_form['#suffix']);
 
   // If a newly inserted widget contains AHAH behaviors, they normally won't
   // work because AHAH doesn't know about those - it just attaches to the exact
