Index: workflow_ng/modules/workflow_ng_content_forms.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/workflow_ng/workflow_ng/modules/Attic/workflow_ng_content_forms.inc,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 workflow_ng_content_forms.inc
--- workflow_ng/modules/workflow_ng_content_forms.inc	4 Jan 2008 23:20:11 -0000	1.1.2.1
+++ workflow_ng/modules/workflow_ng_content_forms.inc	8 Jul 2008 08:34:25 -0000
@@ -49,3 +49,55 @@
   //returns the needed settings
   return array('field' => $form_values['field']);
 }
+
+/**
+ * Action "populate a field" configuration form.
+ */
+function workflow_ng_action_populate_field_form($settings = array(), $argument_info) {
+  $options = content_fields();
+  $fields = array_keys($options);
+  $fields = array_combine($fields, $fields);
+  $form = array();
+  $form['field_name'] = array(
+    '#type' => 'select',
+    '#title' => t('Field'),
+    '#options' => $fields,
+    '#default_value' => $settings['field_name'],
+    '#description' => t('Select the machine-name of the field.'), 
+    '#required' => TRUE,
+  );
+  $sample = 'array(
+  0 => array(\'value\' => value for value),
+  // You\'ll usually want to stop here. Provide more values
+  // if you want your \'default value\' to be multi-valued :
+  1 => array(\'value\' => value for value),
+  2 => ...
+);
+
+Example: 
+return array(0 => array(\'value\' => 10));';
+  
+    $form['default_value_php'] = array(
+      '#type' => 'textarea',
+      '#title' => t('Value'),
+      '#default_value' => $settings['default_value_php'],
+      '#rows' => 6,
+      '#tree' => TRUE,
+      '#description' => t('PHP code that returns a default value. Should not include &lt;?php ?&gt; delimiters. Expected format :<pre>!sample</pre>Using !link_devel\'s \'devel load\' tab on a %type content page might help you figure out the expected format.', array('!sample' => $sample, '!link_devel' => l('devel.module', 'http://www.drupal.org/project/devel'), '%type' => $type_name)),
+      '#required' => TRUE,
+    );
+  
+  return $form;
+}
+
+function workflow_ng_action_populate_field_validate($form_id, $form_values, $form) {
+  // Add values required by _content_admin_field_validate validation.
+  $field = content_fields($form_values['field_name']);
+  $form_values['type_name'] = $field['type_name'];
+  // Validate PHP format.
+  _content_admin_field_validate($form_id, $form_values, $form);
+}
+
+function workflow_ng_action_populate_field_submit($form_id, $form_values) {
+  return array('field_name' => $form_values['field_name'], 'default_value_php' => $form_values['default_value_php']);
+}
Index: workflow_ng/modules/workflow_ng_content.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/workflow_ng/workflow_ng/modules/Attic/workflow_ng_content.inc,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 workflow_ng_content.inc
--- workflow_ng/modules/workflow_ng_content.inc	2 Mar 2008 15:52:22 -0000	1.1.2.2
+++ workflow_ng/modules/workflow_ng_content.inc	8 Jul 2008 08:34:24 -0000
@@ -12,7 +12,7 @@
     'cck_workflow_ng_forms' => array(
       'file' => 'workflow_ng_content_forms.inc',
       'file path' => drupal_get_path('module', 'workflow_ng'). '/modules/',
-    ),
+  ),
   );
 }
 
@@ -44,6 +44,14 @@
       ),
       '#module' => 'CCK',
     );
+    $info['workflow_ng_action_populate_field'] = array(
+      '#label' => t('Populate a field'),
+      '#arguments' => array(
+        'node' => array('#entity' => 'node', '#label' => t('Content')),
+      ),
+      '#description' => 'Populate a CCK field with a PHP-returned value. You should make sure that the used field exists in the given content type.',
+      '#module' => 'CCK',
+    );
   }
   return $info;
 }
@@ -60,3 +68,21 @@
     return array('#new arguments' => array('referenced_node' => node_load(array('nid' => $nid))));
   }
 }
+
+/**
+ * Action: populate a field.
+ */
+function workflow_ng_action_populate_field($node, $settings) {
+  //Get information about the field.
+  $field = content_fields($settings['field_name'], $node->type);
+
+  // Taken from function content_default_value().
+  ob_start();
+  $result = eval($settings['default_value_php']);
+  ob_end_clean();
+  
+  if (!empty($field) && is_array($result)) {
+    $node->$settings['field_name'] = $result;
+    return array('node' => $node);      
+  }
+}
