Index: text.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/text.module,v
retrieving revision 1.51
diff -u -r1.51 text.module
--- text.module	12 Mar 2007 19:43:45 -0000	1.51
+++ text.module	8 Jul 2007 01:18:58 -0000
@@ -53,7 +53,7 @@
       $form['advanced_options']['allowed_values_php'] = array(
         '#type' => 'textarea',
         '#title' => t('Code'),
-        '#default_value' => $field['allowed_values_php'],
+        '#default_value' => isset($field['allowed_values_php']) ? $field['allowed_values_php'] : '',
         '#rows' => 6,
         '#description' => t('Advanced Usage Only: PHP code that returns a keyed array of allowed values. Should not include &lt;?php ?&gt; delimiters. If this field is filled out, the array returned by this code will override the allowed values list above.'),
       );
@@ -67,13 +67,13 @@
         'value' => array('type' => 'varchar', 'not null' => TRUE, 'default' => "''", 'sortable' => TRUE),
         'format' => array('type' => 'int', 'length' => 10, 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
       );
-      if ($field['max_length'] == 0 || $field['max_length'] > 255) {
+      if (empty($field['max_length']) || $field['max_length'] > 255) {
         $columns['value']['type'] = 'longtext';
       }
       else {
         $columns['value']['length'] = $field['max_length'];
       }
-      if ($field['text_processing'] == 0) {
+      if (empty($field['text_processing'])) {
         unset($columns['format']);
       }
       return $columns;
@@ -120,7 +120,7 @@
           }
         }
       }
-      if ($field['max_length'] > 0) {
+      if (isset($field['max_length'])) {
         foreach ($items as $delta => $data) {
           $error_field = $field['field_name'] .']['. $delta .'][value';
           if (strlen($data['value']) > $field['max_length']) {
@@ -180,8 +180,9 @@
       $text = $item['value'];
   }
 
+  // TODO : undefined index text_processing / format on node preview
   if ($field['text_processing']) {
-    return check_markup($text, $item['format'], is_null($node) || isset($node->in_preview));
+    return check_markup($text, $item['format'], is_null($node) || $node->build_mode == NODE_BUILD_PREVIEW);
   }
   else {
     return check_plain($text);
@@ -211,7 +212,7 @@
       $form['rows'] = array(
         '#type' => 'textfield',
         '#title' => t('Rows'),
-        '#default_value' => $widget['rows'] ? $widget['rows'] : 1,
+        '#default_value' => isset($widget['rows']) ? $widget['rows'] : 1,
         '#required' => TRUE,
       );
       return $form;
@@ -237,19 +238,20 @@
 
       $form[$field['field_name']] = array('#tree' => TRUE);
 
+      $rows = isset($field['widget']['rows']) ? $field['widget']['rows'] : 1;
       if ($field['multiple']) {
         $form[$field['field_name']]['#type'] = 'fieldset';
         $form[$field['field_name']]['#description'] = t($field['widget']['description']);
         $delta = 0;
         foreach ($items as $data) {
           if ($data['value']) {
-            if ($field['widget']['rows'] == 1) {
+            if ($rows == 1) {
               $form[$field['field_name']][$delta]['value'] = array(
                 '#type' => 'textfield',
                 '#title' => ($delta == 0) ? t($field['widget']['label']) : '',
                 '#default_value' => $data['value'],
                 '#required' => ($delta == 0) ? $field['required'] : FALSE,
-                '#maxlength' => $field['max_length'] ? $field['max_length'] : NULL,
+                '#maxlength' => isset($field['max_length']) ? $field['max_length'] : NULL,
                 '#weight' => $field['widget']['weight'],
               );
             }
@@ -259,24 +261,25 @@
                 '#title' => ($delta == 0) ? t($field['widget']['label']) : '',
                 '#default_value' => $data['value'],
                 '#required' => ($delta == 0) ? $field['required'] : FALSE,
-                '#rows' => $field['widget']['rows'],
+                '#rows' => $rows,
                 '#weight' => $field['widget']['weight'],
               );
             }
-            if ($field['text_processing']) {
+            if (!empty($field['text_processing'])) {
+              $format = $data['format'];
               $form[$field['field_name']][$delta]['format'] = filter_form($data['format'], $form[$field['field_name']][$delta]['value']['#weight'] + 1, array($field['field_name'], $delta, 'format'));
             }
             $delta++;
           }
         }
         foreach (range($delta, $delta + 2) as $delta) {
-          if ($field['widget']['rows'] == 1) {
+          if ($rows == 1) {
             $form[$field['field_name']][$delta]['value'] = array(
               '#type' => 'textfield',
               '#title' => ($delta == 0) ? t($field['widget']['label']) : '',
               '#default_value' => '',
               '#required' => ($delta == 0) ? $field['required'] : FALSE,
-              '#maxlength' => $field['max_length'] ? $field['max_length'] : NULL,
+              '#maxlength' => isset($field['max_length']) ? $field['max_length'] : NULL,
               '#weight' => $field['widget']['weight'],
             );
           }
@@ -286,24 +289,25 @@
               '#title' => ($delta == 0) ? t($field['widget']['label']) : '',
               '#default_value' => '',
               '#required' => ($delta == 0) ? $field['required'] : FALSE,
-              '#rows' => $field['widget']['rows'],
+              '#rows' => $rows,
               '#weight' => $field['widget']['weight'],
             );
           }
-          if ($field['text_processing']) {
-            $form[$field['field_name']][$delta]['format'] = filter_form($items[$delta]['format'], $form[$field['field_name']][$delta]['value']['#weight'] + 1, array($field['field_name'], $delta, 'format'));
+          if (!empty($field['text_processing'])) {
+            $format = FILTER_FORMAT_DEFAULT;
+            $form[$field['field_name']][$delta]['format'] = filter_form($format, $form[$field['field_name']][$delta]['value']['#weight'] + 1, array($field['field_name'], $delta, 'format'));
           }
         }
       }
       else {
-        if ($field['widget']['rows'] == 1) {
+        if ($rows == 1) {
           $form[$field['field_name']][0]['value'] = array(
             '#type' => 'textfield',
             '#title' => t($field['widget']['label']),
             '#default_value' => isset($items[0]['value']) ? $items[0]['value'] : '',
             '#required' => $field['required'],
             '#description' => t($field['widget']['description']),
-            '#maxlength' => $field['max_length'] ? $field['max_length'] : NULL,
+            '#maxlength' => isset($field['max_length']) ? $field['max_length'] : NULL,
             '#weight' => $field['widget']['weight'],
           );
         }
@@ -313,13 +317,14 @@
             '#title' => t($field['widget']['label']),
             '#default_value' => $items[0]['value'],
             '#required' => $field['required'],
-            '#rows' => $field['widget']['rows'],
+            '#rows' => $rows,
             '#description' => t($field['widget']['description']),
             '#weight' => $field['widget']['weight'],
           );
         }
-        if ($field['text_processing']) {
-          $form[$field['field_name']][0]['format'] = filter_form($items[0]['format'], $form[$field['field_name']][0]['value']['#weight'] + 1, array($field['field_name'], 0, 'format'));
+        if (!empty($field['text_processing'])) {
+          $format = isset($items[0]['format']) ? $items[0]['format'] : FILTER_FORMAT_DEFAULT;
+          $form[$field['field_name']][0]['format'] = filter_form($format , $form[$field['field_name']][0]['value']['#weight'] + 1, array($field['field_name'], 0, 'format'));
         }
       }
       return $form;
@@ -341,12 +346,13 @@
 function text_allowed_values($field) {
   static $allowed_values;
 
-  if ($allowed_values[$field['field_name']]) {
+  if (isset($allowed_values[$field['field_name']])) {
     return $allowed_values[$field['field_name']];
   }
 
   $allowed_values[$field['field_name']] = array();
-  if ($field['allowed_values_php']) {
+
+  if (isset($field['allowed_values_php'])) {
     ob_start();
     $result = eval($field['allowed_values_php']);
     if (is_array($result)) {
@@ -354,8 +360,8 @@
     }
     ob_end_clean();
   }
-  if (!$allowed_values[$field['field_name']]) {
 
+  if (empty($allowed_values[$field['field_name']]) && isset($field['allowed_values'])) {
     $list = explode("\n", $field['allowed_values']);
     $list = array_map('trim', $list);
     $list = array_filter($list, 'strlen');
Index: content.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/content.module,v
retrieving revision 1.133
diff -u -r1.133 content.module
--- content.module	7 Jul 2007 00:52:13 -0000	1.133
+++ content.module	8 Jul 2007 01:46:35 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: content.module,v 1.133 2007/07/07 00:52:13 yched Exp $
+// $Id: content.module,v 1.132 2007/07/06 12:30:50 karens Exp $
 
 /**
  * @file
@@ -97,15 +97,19 @@
     foreach ($content_type['fields'] as $field) {
       $field_name = $field['field_name'];
       $items['admin/content/types/'. $type_url_str .'/fields/'. $field_name] = array(
-        'title' => $field['widget']['label'],
         'page callback' => 'drupal_get_form',
         'page arguments' => array('_content_admin_field', $type_name, $field_name),
+        'access arguments' => array('administer content types'),
         'file' => 'content_admin.inc',
         'file path' => drupal_get_path('module', 'content'),
-        'access arguments' => array('administer content types'),
         'type' => MENU_CALLBACK,
       );
-      $items['admin/content/types/'. $type_url_str .'/fields/'. $field_name .'/remove'] = array(
+      // menu.inc deals with up to 6 parts in menu paths (MENU_MAX_PARTS),
+      // so we have to remove one part for the 'remove' callback.
+      // Maybe we could remove it for the 'edit' callback above as well for consistency ?
+      // (it's ok since they're both pure MENU_CALLBACK, no hierarchy involved)
+      // Fieldgroup paths will be affected as well...
+      $items['admin/content/types/'. $type_url_str .'/'. $field_name .'/remove_field'] = array(
         'title' => 'Remove field',
         'page callback' => 'drupal_get_form',
         'page arguments' => array('_content_admin_field_remove', $type_name, $field_name),
@@ -124,22 +128,22 @@
  */
 function content_theme() {
   return array(
-    'content_field' => array(
+    'field' => array(
       'arguments' => array('node', 'field', 'items', 'teaser', 'page'),
-      ),
+    ),
     'content_admin_field_overview_form' => array(
       'arguments' => array('form'),
-      ),
+    ),
     'content_admin_display_overview_form' => array(
       'arguments' => array('form'),
-      ),
+    ),
     'content_admin_field_add_new_field_widget_type' => array(
       'arguments' => array('form'),
-      ),
+    ),
     'content_view_multiple_field' => array(
       'arguments' => array('items', 'field', 'data'),
-      ),
-    );
+    ),
+  );
 }
 
 /**
@@ -272,7 +276,7 @@
  * Generate field render arrays.
  */
 function content_view(&$node, $teaser = FALSE, $page = FALSE) {
-  if (isset($node->in_preview) && $node->in_preview) {
+  if ($node->build_mode == NODE_BUILD_PREVIEW) {
     _content_widget_invoke('process form values', $node);
   }
   $content = _content_field_view($node, $teaser, $page);
Index: content_admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/content_admin.inc,v
retrieving revision 1.69
diff -u -r1.69 content_admin.inc
--- content_admin.inc	7 Jul 2007 00:52:13 -0000	1.69
+++ content_admin.inc	8 Jul 2007 01:44:54 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: content_admin.inc,v 1.69 2007/07/07 00:52:13 yched Exp $
+// $Id: content_admin.inc,v 1.68 2007/07/06 12:30:50 karens Exp $
 
 /**
  * @file
@@ -55,10 +55,10 @@
   $dummy_node->name = '';
   $form_state = array();
   $dummy_form = array();
-  $dummy_form = node_form($form_state, $dummy_form);
+  $dummy_form = node_form($form_state, $dummy_node);
   foreach (module_implements('form_alter') as $module) {
     $function = $module .'_form_alter';
-    $function($dummy_form, $form_state, $dummy_form['#id']);
+    $function($dummy_form, $form_state, $dummy_node->type .'_node_form');
   }
 
   // Move group fields into a 'fields' subgroup to make them easier to identify.
@@ -94,8 +94,9 @@
 
     // Limiting weight to < 10 will keep workflow and submit elements from being added to the overview table.
     // They're outside the weight range allowed for CCK fields, so won't interfere with field placement.
+    // Currently the 'menu' fieldset is at weight -2, so add a special check for that one.
 
-    if (is_array($value) && (isset($value['#weight']) || $key == 'body_filter') && $value['#weight'] <= 10) {
+    if (is_array($value) && (isset($value['#weight']) || $key == 'body_filter') && $key != 'menu' && $value['#weight'] <= 10) {
 
       // if this item is a group, insert group info into table, then add all the group fields below it
       if (substr($key, 0, 6) == 'group_' && isset($form['#groups'])) {
@@ -119,7 +120,7 @@
           $row['weights']   = 'form-field-weights';
           $row['groups']    = 'form-field-groups';
           $row['configure'] = l(t('configure'), 'admin/content/types/'. $type['url_str'] .'/fields/'. $field_name);
-          $row['remove']    = l(t('remove'), 'admin/content/types/'. $type['url_str'] .'/fields/'. $field_name .'/remove');
+          $row['remove']    = l(t('remove'), 'admin/content/types/'. $type['url_str'] .'/'. $field_name .'/remove');
           $group_form[$field['widget']['weight']][] = array($field_name => $row);
 
           $form['field-weights'][$field_name] = array('#type' => 'weight', '#default_value' => $field['widget']['weight']);
@@ -737,6 +738,8 @@
   $widget_types = _content_widget_types();
   $widget_type = $widget_types[$field['widget']['type']];
 
+  drupal_set_title($field['widget']['label']);
+
   $form = array();
   $form['widget'] = array(
     '#type' => 'fieldset',
@@ -792,7 +795,7 @@
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
     );
-    $default_value = is_array($field['widget']['default_value']) ? $field['widget']['default_value'] : array();
+    $default_value = isset($field['widget']['default_value']) ? $field['widget']['default_value'] : array();
     $module = $widget_types[$field['widget']['type']]['module'];
     $function = $module .'_widget';
     if (function_exists($function)) {
@@ -824,7 +827,7 @@
     $form['widget']['default_value_fieldset']['advanced_options']['default_value_php'] = array(
       '#type' => 'textarea',
       '#title' => t('Code'),
-      '#default_value' => $field['widget']['default_value_php'],
+      '#default_value' => isset($field['widget']['default_value_php']) ? $field['widget']['default_value_php'] : '',
       '#rows' => 6,
       '#tree' => TRUE,
       '#description' => t('Advanced Usage Only: PHP code that returns a default value. Should not include &lt;?php ?&gt; delimiters.<br/>If this field is filled out, the value returned by this code will override any value in the textfield above.<br/>Expected format : @sample.', array('@sample' => $sample)),
@@ -922,15 +925,15 @@
       else {
         $default_value = $return;
         $is_code = TRUE;
-        form_set_value(array('#parents' => array('default_value_php')), $php);
-        form_set_value(array('#parents' => array('default_value')), array());
+        form_set_value(array('#parents' => array('default_value_php')), $php, $form_state);
+        form_set_value(array('#parents' => array('default_value')), array(), $form_state);
       }
     }
     else {
       $default_value = $form_values['default_value_widget'][$field['field_name']];
       $is_code = FALSE;
-      form_set_value(array('#parents' => array('default_value_php')), '');
-      form_set_value(array('#parents' => array('default_value')), $default_value);
+      form_set_value(array('#parents' => array('default_value_php')), '', $form_state);
+      form_set_value(array('#parents' => array('default_value')), $default_value, $form_state);
     }
     if (isset($default_value)) {
       $node = array();
@@ -946,7 +949,7 @@
         $widget_function('validate', $node, $field, $default_value);
         $widget_function('process form values', $node, $field, $default_value);
         // The widget processing may have altered the value, save it to be sure.
-        form_set_value(array('#parents' => array('default_value')), $default_value);
+        form_set_value(array('#parents' => array('default_value')), $default_value, $form_state);
       }
       if (function_exists($field_function)) {
         $field_function('validate', $node, $field, $default_value, NULL, NULL);
@@ -967,7 +970,7 @@
 /**
  * Save a field's settings after editing.
  */
-function _content_admin_field_($form, &$form_state) {
+function _content_admin_field_submit($form, &$form_state) {
   $form_values = $form_state['values'];
 
   $type = content_types($form_values['type_name']);
@@ -1030,7 +1033,7 @@
   }
   content_alter_db_field($prev_field, $prev_columns, $new_field, $new_columns);
 
-  return 'admin/content/types/'. $type['url_str'] .'/fields';
+  $form_state['redirect'] = 'admin/content/types/'. $type['url_str'] .'/fields';
 }
 
 /**
@@ -1307,7 +1310,7 @@
         $type = $mappings[$type];
       }
       else {
-        watchdog('database', t('No PostgreSQL mapping found for %type data type.', array('%type' => $type)), WATCHDOG_WARNING);
+        watchdog('database', 'No PostgreSQL mapping found for %type data type.', array('%type' => $type), WATCHDOG_WARNING);
       }
       if ($type != 'varchar') {
         unset($attributes['length']);
@@ -1404,7 +1407,7 @@
         $type = $mappings[$type];
       }
       else {
-        watchdog('database', t('No PostgreSQL mapping found for %type data type.', array('%type' => $type)), WATCHDOG_WARNING);
+        watchdog('database', 'No PostgreSQL mapping found for %type data type.', array('%type' => $type), WATCHDOG_WARNING);
       }
       if ($type != 'varchar') {
         unset($attributes['length']);
Index: content_copy.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/content_copy.module,v
retrieving revision 1.8
diff -u -r1.8 content_copy.module
--- content_copy.module	7 Jul 2007 00:52:13 -0000	1.8
+++ content_copy.module	7 Jul 2007 00:41:28 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: content_copy.module,v 1.8 2007/07/07 00:52:13 yched Exp $
+// $Id: content_copy.module,v 1.7 2007/03/30 15:18:46 yched Exp $
 
 /**
  *  @file
Index: field.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/field.php,v
retrieving revision 1.13
diff -u -r1.13 field.php
--- field.php	1 Mar 2007 00:21:25 -0000	1.13
+++ field.php	8 Jul 2007 01:13:16 -0000
@@ -279,7 +279,7 @@
     return '';
   }
   if ($field['text_processing']) {
-    $text = check_markup($item['value'], $item['format'], is_null($node) || isset($node->in_preview));
+    $text = check_markup($item['value'], $item['format'], is_null($node) || $node->build_mode == NODE_BUILD_PREVIEW);
   }
   else {
     $text = check_plain($item['value']);
Index: fieldgroup.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/fieldgroup.module,v
retrieving revision 1.33
diff -u -r1.33 fieldgroup.module
--- fieldgroup.module	7 Jul 2007 00:52:13 -0000	1.33
+++ fieldgroup.module	7 Jul 2007 00:40:35 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: fieldgroup.module,v 1.33 2007/07/07 00:52:13 yched Exp $
+// $Id: fieldgroup.module,v 1.32 2007/07/06 12:30:50 karens Exp $
 
 /**
  * @file
