? cck_diff.patch
? images
? js
? includes/translations
? includes/panels/content_types/translations
? includes/views/translations
? includes/views/handlers/translations
? modules/content_multigroup/content_multigroup.admin.inc
? modules/content_multigroup/content_multigroup.css
? modules/content_multigroup/content_multigroup.info
? modules/content_multigroup/content_multigroup.install
? modules/content_multigroup/content_multigroup.module
? modules/content_multigroup/content_multigroup.node_form.inc
? modules/content_multigroup/content_multigroup.node_view.inc
? modules/content_multigroup/panels
? modules/content_multigroup/translations
? modules/content_multigroup/views
? modules/fieldgroup/panels/content_types/translations
? modules/nodereference/panels/relationships/translations
? modules/userreference/panels/relationships/translations
Index: content.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/Attic/content.install,v
retrieving revision 1.85.2.33
diff -u -p -r1.85.2.33 content.install
--- content.install 14 Jul 2009 22:17:05 -0000 1.85.2.33
+++ content.install 11 Aug 2010 20:17:54 -0000
@@ -1,5 +1,5 @@
t('!title: !required', array('!title' => $element['#title'], '!required' => $required)),
'colspan' => 2
),
- t('Order'),
+ array('data' => t('Order'), 'class' => 'content-multiple-weight-header'),
);
+ if ($field['multiple'] == 1) {
+ $header[] = array('data' => ''. t('Remove') .'', 'class' => 'content-multiple-remove-header');
+ }
$rows = array();
// Sort items according to '_weight' (needed when the form comes back after
@@ -505,24 +517,31 @@ function theme_content_multiple_values($
$items = array();
foreach (element_children($element) as $key) {
if ($key !== $element['#field_name'] .'_add_more') {
- $items[] = &$element[$key];
+ $items[$element[$key]['#delta']] = &$element[$key];
}
}
- usort($items, '_content_sort_items_value_helper');
+ uasort($items, '_content_sort_items_value_helper');
// Add the items as table rows.
- foreach ($items as $key => $item) {
+ foreach ($items as $delta => $item) {
$item['_weight']['#attributes']['class'] = $order_class;
$delta_element = drupal_render($item['_weight']);
+ if ($field['multiple'] == 1) {
+ $remove_element = drupal_render($item['_remove']);
+ }
$cells = array(
array('data' => '', 'class' => 'content-multiple-drag'),
drupal_render($item),
array('data' => $delta_element, 'class' => 'delta-order'),
);
- $rows[] = array(
- 'data' => $cells,
- 'class' => 'draggable',
- );
+ $row_class = 'draggable';
+ if ($field['multiple'] == 1) {
+ if (!empty($item['_remove']['#default_value'])) {
+ $row_class .= ' content-multiple-removed-row';
+ }
+ $cells[] = array('data' => $remove_element, 'class' => 'content-multiple-remove-cell');
+ }
+ $rows[] = array('data' => $cells, 'class' => $row_class);
}
$output .= theme('table', $header, $rows, array('id' => $table_id, 'class' => 'content-multiple-table'));
@@ -530,6 +549,7 @@ function theme_content_multiple_values($
$output .= drupal_render($element[$element['#field_name'] .'_add_more']);
drupal_add_tabledrag($table_id, 'order', 'sibling', $order_class);
+ drupal_add_js(drupal_get_path('module', 'content') .'/js/content.node_form.js');
}
else {
foreach (element_children($element) as $key) {
@@ -686,12 +706,14 @@ function content_associate_fields($modul
function content_field($op, &$node, $field, &$items, $teaser, $page) {
switch ($op) {
case 'validate':
- // TODO: here we could validate that the number of multiple data is correct ?
- // We're controlling the number of fields to fill out and saving empty
- // ones if a specified number is requested, so no reason to do any validation
- // here right now, but if later create a method to indicate whether
- // 'required' means all values must be filled out, we can come back
- // here and check that they're not empty.
+ // If the field is configured for multiple values and these are handled
+ // by content module, we need to filter out items flagged for removal and
+ // count non-empty items to enforce field requirement settings.
+ if ($field['multiple'] >= 1 && content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_CORE) {
+ module_load_include('inc', 'content', 'includes/content.node_form');
+ // Note that the $teaser argument for nodeapi('validate') is the $form.
+ content_multiple_value_nodeapi_validate($node, $field, $items, $teaser);
+ }
break;
case 'presave':
@@ -722,7 +744,7 @@ function content_field($op, &$node, $fie
$items = _content_sort_items($field, $items);
}
- // Filter out empty values.
+ // Filter out items flagged for removal.
$items = content_set_empty($field, $items);
break;
@@ -730,14 +752,14 @@ function content_field($op, &$node, $fie
case 'view':
$addition = array();
- // Previewed nodes bypass the 'presave' op, so we need to some massaging.
- if ($node->build_mode == NODE_BUILD_PREVIEW && content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_CORE) {
+ // Previewed nodes bypass the 'presave' op, so we need to do some massaging.
+ if ($node->build_mode == NODE_BUILD_PREVIEW) {
if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_CORE) {
// Reorder items to account for drag-n-drop reordering.
$items = _content_sort_items($field, $items);
}
- // Filter out empty values.
+ // Filter out items flagged for removal.
$items = content_set_empty($field, $items);
}
@@ -776,10 +798,10 @@ function content_field($op, &$node, $fie
);
// Fill-in items.
- foreach ($items as $delta => $item) {
+ foreach (array_keys($items) as $weight => $delta) {
$element['items'][$delta] = array(
- '#item' => $item,
- '#weight' => $delta,
+ '#item' => $items[$delta],
+ '#weight' => $weight,
);
}
@@ -888,7 +910,7 @@ function content_field($op, &$node, $fie
}
/**
- * Helper function to filter out empty values.
+ * Helper function to filter out items flagged for removal.
*
* On order to keep marker rows in the database, the function ensures
* that the right number of 'all columns NULL' values is kept.
@@ -899,20 +921,22 @@ function content_field($op, &$node, $fie
* returns filtered and adjusted item array
*/
function content_set_empty($field, $items) {
- // Filter out empty values.
+ // Prepare an empty item.
+ $empty = array();
+ foreach (array_keys($field['columns']) as $column) {
+ $empty[$column] = NULL;
+ }
+
+ // Filter out items flagged for removal.
$filtered = array();
$function = $field['module'] .'_content_is_empty';
foreach ((array) $items as $delta => $item) {
- if (!$function($item, $field)) {
- $filtered[] = $item;
+ if (empty($item['_remove'])) {
+ $filtered[] = ($function($item, $field) ? $empty : $item);
}
}
// Make sure we store the right number of 'empty' values.
- $empty = array();
- foreach (array_keys($field['columns']) as $column) {
- $empty[$column] = NULL;
- }
$pad = $field['multiple'] > 1 ? $field['multiple'] : 1;
$filtered = array_pad($filtered, $pad, $empty);
@@ -927,7 +951,7 @@ function _content_sort_items($field, $it
if ($field['multiple'] >= 1 && isset($items[0]['_weight'])) {
usort($items, '_content_sort_items_helper');
foreach ($items as $delta => $item) {
- if (is_array($items[$delta])) {
+ if (is_array($item) && isset($item['_weight'])) {
unset($items[$delta]['_weight']);
}
}
@@ -1008,7 +1032,27 @@ function content_storage($op, $node) {
if (!isset($additions[$field_name])) {
$additions[$field_name] = array();
}
- $additions[$field_name][] = $item;
+
+ // Preserve deltas when loading items from database.
+ if (isset($row['delta'])) {
+ // Make sure multiple value fields have consecutive deltas.
+ if ($row['delta'] > 0 && !isset($additions[$field_name][$row['delta']-1])) {
+ $empty = array();
+ foreach (array_keys($db_info['columns']) as $column) {
+ $empty[$column] = NULL;
+ }
+ $next_delta = !empty($additions[$field_name]) ? (max(array_keys($additions[$field_name])) + 1) : 0;
+ for ($delta = $next_delta; $delta < $row['delta']; $delta++) {
+ if (!isset($additions[$field_name][$delta])) {
+ $additions[$field_name][$delta] = $empty;
+ }
+ }
+ }
+ $additions[$field_name][$row['delta']] = $item;
+ }
+ else {
+ $additions[$field_name][] = $item;
+ }
}
}
}
@@ -1065,14 +1109,34 @@ function content_storage($op, $node) {
if ($op == 'update') {
db_query('DELETE FROM {'. $db_info['table'] .'} WHERE vid = %d', $node->vid);
}
+ // Collect records for non-empty items.
+ $function = $field['module'] .'_content_is_empty';
+ $records = array();
foreach ($node->$field['field_name'] as $delta => $item) {
+ if (!$function($item, $field)) {
+ $record = array();
+ foreach ($db_info['columns'] as $column => $attributes) {
+ $record[$attributes['column']] = $item[$column];
+ }
+ $record['nid'] = $node->nid;
+ $record['vid'] = $node->vid;
+ $record['delta'] = $delta;
+ $records[] = $record;
+ }
+ }
+ // If there was no non-empty item, insert delta 0 with NULL values.
+ if (empty($records)) {
$record = array();
foreach ($db_info['columns'] as $column => $attributes) {
- $record[$attributes['column']] = $item[$column];
+ $record[$attributes['column']] = NULL;
}
$record['nid'] = $node->nid;
$record['vid'] = $node->vid;
- $record['delta'] = $delta;
+ $record['delta'] = 0;
+ $records[] = $record;
+ }
+ // Insert the collected records for this field into database.
+ foreach ($records as $record) {
content_write_record($db_info['table'], $record);
}
}
@@ -2479,14 +2543,14 @@ function content_content_extra_fields($t
'label' => t('Publishing options'),
'description' => t('Node module form.'),
'weight' => 25,
- );
+ );
if (module_exists('comment')) {
$extra['comment_settings'] = array(
'label' => t('Comment settings'),
'description' => t('Comment module form.'),
'weight' => 30
);
- }
+ }
if (module_exists('locale') && variable_get("language_content_type_$type_name", 0)) {
$extra['language'] = array(
'label' => t('Language'),
Index: includes/content.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/includes/Attic/content.admin.inc,v
retrieving revision 1.181.2.76
diff -u -p -r1.181.2.76 content.admin.inc
--- includes/content.admin.inc 2 Nov 2009 21:21:24 -0000 1.181.2.76
+++ includes/content.admin.inc 11 Aug 2010 20:17:54 -0000
@@ -1,5 +1,5 @@
count($filled_items))
- ? $current_item_count - 1
- : $current_item_count;
+ case 1:
+ $deltas = array_keys($items);
+ $current_item_count = max(1, (isset($form_state['item_count'][$field_name]) ? $form_state['item_count'][$field_name] : count($deltas)));
+ $max = (!empty($deltas) ? max($deltas) : -1);
+ while (count($deltas) < $current_item_count) {
+ $max++;
+ $deltas[] = $max;
+ }
break;
+
default:
$max = $field['multiple'] - 1;
+ $deltas = range(0, $max);
break;
}
@@ -181,12 +183,12 @@ function content_multiple_value_form(&$f
);
$function = $field['widget']['module'] .'_widget';
- for ($delta = 0; $delta <= $max; $delta++) {
+ foreach ($deltas as $delta) {
if ($element = $function($form, $form_state, $field, $items, $delta)) {
$defaults = array(
'#title' => ($field['multiple'] >= 1) ? '' : $title,
'#description' => ($field['multiple'] >= 1) ? '' : $description,
- '#required' => $delta == 0 && $field['required'],
+ '#required' => ($field['multiple'] == 0 ? $field['required'] : FALSE),
'#weight' => $delta,
'#delta' => $delta,
'#columns' => array_keys($field['columns']),
@@ -207,10 +209,28 @@ function content_multiple_value_form(&$f
);
}
+ // Add a checkbox to allow users remove a single delta item.
+ // See content_set_empty() and theme_content_multiple_values().
+ if ($field['multiple'] == 1) {
+ // We name the element '_remove' to avoid clashing with column names
+ // defined by field modules.
+ $element['_remove'] = array(
+ '#type' => 'checkbox',
+ '#attributes' => array('class' => 'content-multiple-remove-checkbox'),
+ '#default_value' => isset($items[$delta]['_remove']) ? $items[$delta]['_remove'] : 0,
+ );
+ }
+
$form_element[$delta] = array_merge($element, $defaults);
}
}
+ // Add an #after_build callback to prevent validation of fields that are
+ // flagged for removal and enforce field requirement settings.
+ if ($field['multiple'] >= 1) {
+ $form_element['#after_build'] = array('content_multiple_value_after_build_proxy');
+ }
+
// Add AHAH add more button, if not working with a programmed form.
if ($field['multiple'] == 1 && empty($form['#programmed'])) {
// Make sure the form is cached so ahah can work.
@@ -243,12 +263,134 @@ function content_multiple_value_form(&$f
$form_element['#prefix'] = '
';
$form_element['#suffix'] = '
';
$form_element[$field_name .'_add_more']['#prefix'] = '';
- $form_element[$field_name .'_add_more']['#suffix'] = '
';
+ $form_element[$field_name .'_add_more']['#suffix'] = '';
}
return $form_element;
}
/**
+ * After build callback for multiple value fields.
+ */
+function content_multiple_value_after_build($elements, &$form_state) {
+ $items_map = array();
+
+ foreach (element_children($elements) as $delta) {
+ // Find delta items for this field when the form if being processed for validation.
+ if (isset($elements[$delta]) && $elements[$delta] && is_numeric($delta) && !empty($elements[$delta]['#needs_validation'])) {
+
+ // Find items that have been flagged for removal.
+ if (isset($elements[$delta]['_remove']) && !empty($elements[$delta]['_remove']['#value'])) {
+
+ // Update the value in the #post attribute of the elements.
+ $post = &$elements[$delta]['#post'];
+ foreach ($elements[$delta]['#parents'] as $name) {
+ $post = &$post[$name];
+ }
+ $post = array('_weight' => $elements[$delta]['_weight']['#value'], '_remove' => 1);
+
+ // Alter the value of this element and children recursively.
+ content_multiple_value_after_build_recursive($elements[$delta], $elements[$delta]['#post']);
+
+ $items_map[$delta] = TRUE;
+ }
+ else {
+ $items_map[$delta] = FALSE;
+ }
+ }
+ }
+
+ // If the multiple values field is required, then make sure there's at
+ // least one item not flagged for removal. This is necessary to point
+ // the user to the correct form element when the validation error is
+ // issued from content_multiple_value_nodeapi_validate().
+ $items_count = count($items_map);
+ if (!empty($elements['#required']) && $items_count > 0) {
+ // If the number of removed items is equal to the total number of
+ // items, then we'll reset the '_remove' flag of the first item, and
+ // that will be used to point the user when the required field error
+ // is issued by content_multiple_value_nodeapi_validate().
+ if ($items_count == count(array_filter($items_map))) {
+ $delta = key($items_map);
+ if (isset($elements[$delta]['_remove'])) {
+ $elements[$delta]['_remove']['#value'] = 0;
+ }
+ }
+ }
+
+ return $elements;
+}
+
+/**
+ * Helper function to deal with items flagged for removal recursively.
+ */
+function content_multiple_value_after_build_recursive(&$elements, $post) {
+ foreach (element_children($elements) as $key) {
+ if (isset($elements[$key]) && $elements[$key] && !in_array($key, array('_weight', '_remove', '_error_element'))) {
+ // Recurse through all children elements.
+ content_multiple_value_after_build_recursive($elements[$key], $post);
+ }
+ }
+
+ // Remove values for items flagged for removal.
+ if (isset($elements['#value'])) {
+ $elements['#value'] = NULL;
+ form_set_value($elements, NULL, $form_state);
+ $elements['#post'] = $post;
+ }
+}
+
+/**
+ * Implementation of nodeapi('validate') for multiple value fields
+ * managed by content module itself.
+ */
+function content_multiple_value_nodeapi_validate(&$node, $field, &$items, $form) {
+ $field_name = $field['field_name'];
+
+ // Getting the field structure from the form allows other modules alter
+ // field properties such as the required attribute.
+ $field = $form['#field_info'][$field_name];
+
+ // Get rid of the add more items element.
+ unset($items[$field_name .'_add_more']);
+
+ // Reorder items to account for drag-n-drop reordering.
+ $items = _content_sort_items($field, $items);
+
+ // Create a copy of the items before filtering those that are flagged
+ // for removal. We need this copy later to obtain the error element.
+ $items_copy = $items;
+
+ // Filter out items flagged for removal.
+ $items = content_set_empty($field, $items);
+
+ // Enforce field requirement settings.
+ if ($field['required'] && empty($node->_content_ignore_required_fields[$field_name]) && content_access('edit', $field, NULL, $node)) {
+ // Count non-empty items.
+ $count = 0;
+ $function = $field['module'] .'_content_is_empty';
+ foreach ($items as $item) {
+ if (!$function($item, $field)) {
+ $count++;
+ }
+ }
+ // The field is required so we expect at least one non-empty item.
+ if ($count == 0) {
+ // Try to guess the element path in the form from the first item that
+ // is not flagged for removal. Defaults to first item.
+ $error_element_index = 0;
+ foreach ($items_copy as $index => $item) {
+ if (empty($item['_remove'])) {
+ $error_element_index = $index;
+ break;
+ }
+ }
+ $error_element = isset($items_copy[$error_element_index]) && is_array($items_copy[$error_element_index]) && isset($items_copy[$error_element_index]['_error_element']) ? $items_copy[$error_element_index]['_error_element'] : '';
+ form_set_error($error_element, t('%name field is required.', array('%name' => t($field['widget']['label']))));
+ }
+ }
+}
+
+/**
* Submit handler to add more choices to a content form. This handler is used when
* JavaScript is not available. It makes changes to the form state and the
* entire form is rebuilt during the page reload.
@@ -265,7 +407,6 @@ function content_add_more_submit($form,
}
}
-
/**
* Menu callback for AHAH addition of new empty widgets.
*/
@@ -314,11 +455,13 @@ function content_add_more_js($type_name_
unset($form_state['values'][$field_name][$field['field_name'] .'_add_more']);
foreach ($_POST[$field_name] as $delta => $item) {
$form_state['values'][$field_name][$delta]['_weight'] = $item['_weight'];
+ $form_state['values'][$field_name][$delta]['_remove'] = isset($item['_remove']) ? $item['_remove'] : 0;
}
$form_state['values'][$field_name] = _content_sort_items($field, $form_state['values'][$field_name]);
$_POST[$field_name] = _content_sort_items($field, $_POST[$field_name]);
// Build our new form element for the whole field, asking for one more element.
+ $delta = max(array_keys($_POST[$field_name])) + 1;
$form_state['item_count'] = array($field_name => count($_POST[$field_name]) + 1);
$form_element = content_field_form($form, $form_state, $field);
// Let other modules alter it.
@@ -338,7 +481,6 @@ function content_add_more_js($type_name_
// Build the new form against the incoming $_POST values so that we can
// render the new element.
- $delta = max(array_keys($_POST[$field_name])) + 1;
$_POST[$field_name][$delta]['_weight'] = $delta;
$form_state = array('submitted' => FALSE);
$form += array(
Index: includes/content.rules.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/includes/Attic/content.rules.inc,v
retrieving revision 1.1.2.7
diff -u -p -r1.1.2.7 content.rules.inc
--- includes/content.rules.inc 23 Dec 2009 17:33:25 -0000 1.1.2.7
+++ includes/content.rules.inc 11 Aug 2010 20:17:54 -0000
@@ -1,5 +1,5 @@
"$like '%%%s%%'",
- 'equals' => "= '%s'",
+ 'equals' => "= '%s'",
'starts_with' => "$like '%s%%'",
+ );
+
+ $match_clauses = array(
+ 'contains' => "LIKE '%%%s%%'",
+ 'equals' => "= '%s'",
+ 'starts_with' => "LIKE '%s%%'",
);
$clause = isset($match_clauses[$options['match']]) ? $match_clauses[$options['match']] : $match_clauses['contains'];
$alias = $this->view->query->ensure_table($options['table']);
Index: includes/views/handlers/content_plugin_style_php_array_ac.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/includes/views/handlers/Attic/content_plugin_style_php_array_ac.inc,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 content_plugin_style_php_array_ac.inc
--- includes/views/handlers/content_plugin_style_php_array_ac.inc 4 Nov 2009 15:31:28 -0000 1.1.2.3
+++ includes/views/handlers/content_plugin_style_php_array_ac.inc 11 Aug 2010 20:17:54 -0000
@@ -1,5 +1,5 @@
'Nodereference autocomplete',
'page callback' => 'nodereference_autocomplete',
'access callback' => 'nodereference_autocomplete_access',
- 'access arguments' => array(2),
+ 'access arguments' => array(2),
'type' => MENU_CALLBACK
);
return $items;
@@ -182,8 +182,8 @@ function nodereference_field_settings($o
* Implementation of hook_field().
*/
function nodereference_field($op, &$node, $field, &$items, $teaser, $page) {
- static $sanitized_nodes = array();
-
+ static $sanitized_nodes = array();
+
switch ($op) {
// When preparing a translation, load any translations of existing references.
case 'prepare translation':
@@ -270,7 +270,7 @@ function nodereference_field($op, &$node
}
}
}
- return $items;
+ return $items;
}
}
@@ -322,7 +322,7 @@ function theme_nodereference_formatter_d
if (!$element['#item']['safe']['status']) {
$output = ' '. t('(Unpublished)') ." $output";
}
- }
+ }
return $output;
}
@@ -953,9 +953,9 @@ function _nodereference_potential_refere
return $references;
}
- /**
+/**
* Check access to the menu callback of the autocomplete widget.
- *
+ *
* Check for both 'edit' and 'view' access in the unlikely event
* a user has edit but not view access.
*/
Index: modules/nodereference/panels/relationships/node_from_noderef.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/modules/nodereference/panels/relationships/Attic/node_from_noderef.inc,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 node_from_noderef.inc
--- modules/nodereference/panels/relationships/node_from_noderef.inc 20 Jul 2009 17:34:17 -0000 1.1.2.3
+++ modules/nodereference/panels/relationships/node_from_noderef.inc 11 Aug 2010 20:17:54 -0000
@@ -1,5 +1,5 @@
t('Empty deltas'),
+ 'description' => t('Test leaving empty values on a multivalue field and then removing them.'),
+ 'group' => t('CCK'),
+ );
+ }
+
+ function setUp() {
+ parent::setUp();
+ $this->loginWithPermissions();
+ $this->acquireContentTypes(1);
+ }
+
+ function testEmptyTextField() {
+ // Create a content type with a multivalue text field.
+ $type = $this->content_types[0];
+ $type_url = str_replace('_', '-', $type->type);
+ $value1 = $this->randomName(5);
+ $value2 = $this->randomName(5);
+ $value3 = $this->randomName(5);
+ $field = $this->createFieldText(array('text_processing' => 0, 'multiple' => 1));
+ $field_name = $field['field_name'];
+
+ // Create a node with three values set.
+ $edit = array(
+ 'title' => $this->randomName(20),
+ 'body' => $this->randomName(20),
+ 'type' => $type->name,
+ );
+ $edit[$field_name][0]['value'] = $value1;
+ $edit[$field_name][1]['value'] = $value2;
+ $edit[$field_name][2]['value'] = $value3;
+ $node = $this->drupalCreateNode($edit);
+ $max_delta = max(array_keys($node->{$field_name}));
+ $this->assertEqual($max_delta, 2, 'Three values saved, highest delta is 2');
+ $this->drupalGet('node/'. $node->nid);
+ $this->assertText($value1, 'First value displayed');
+ $this->assertText($value2, 'Second value displayed');
+ $this->assertText($value3, 'Third value displayed');
+
+ // Set second value to an empty string.
+ $node->{$field_name}[1]['value'] = '';
+ node_save($node);
+ $node = node_load($node->nid, NULL, TRUE);
+ $this->assertIdentical($node->{$field_name}[1]['value'], NULL, 'Second value is empty');
+ $max_delta = max(array_keys($node->{$field_name}));
+ $this->assertEqual($max_delta, 2, 'Three values saved, highest delta is 2');
+ $this->drupalGet('node/'. $node->nid);
+ $this->assertText($value1, 'First value displayed');
+ $this->assertNoText($value2, 'Second value not displayed');
+ $this->assertText($value3, 'Third value displayed');
+
+ // Remove the second value.
+ $node->{$field_name}[1]['_remove'] = 1;
+ node_save($node);
+ $node = node_load($node->nid, NULL, TRUE);
+ $this->assertEqual($node->{$field_name}[1]['value'], $value3, 'Third value has moved to delta 1');
+ $max_delta = max(array_keys($node->{$field_name}));
+ $this->assertEqual($max_delta, 1, 'Two values saved, highest delta is 1');
+ $this->drupalGet('node/'. $node->nid);
+ $this->assertText($value1, 'First value displayed');
+ $this->assertNoText($value2, 'Second value not displayed');
+ $this->assertText($value3, 'Third value displayed');
+ }
+}
Index: theme/content-admin-field-overview-form.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/theme/Attic/content-admin-field-overview-form.tpl.php,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 content-admin-field-overview-form.tpl.php
--- theme/content-admin-field-overview-form.tpl.php 26 Jun 2009 18:02:45 -0000 1.1.2.6
+++ theme/content-admin-field-overview-form.tpl.php 11 Aug 2010 20:17:55 -0000
@@ -1,5 +1,5 @@
Index: theme/content-field.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/theme/Attic/content-field.tpl.php,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 content-field.tpl.php
--- theme/content-field.tpl.php 11 Sep 2009 09:20:37 -0000 1.1.2.6
+++ theme/content-field.tpl.php 11 Aug 2010 20:17:55 -0000
@@ -1,5 +1,5 @@
$field['widget']['label'], 'type' => $field['type'], 'widget' => $field['widget']['type']);
}
drupal_add_js(array('contentWidgetTypes' => content_widget_type_options(), 'contentFields' => $js_fields), 'setting');
- drupal_add_js(drupal_get_path('module', 'content') .'/content.js');
+ drupal_add_js(drupal_get_path('module', 'content') .'/js/content.admin.js');
}
/**