Index: webform.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.module,v
retrieving revision 1.208
diff -u -r1.208 webform.module
--- webform.module 26 Mar 2010 03:04:06 -0000 1.208
+++ webform.module 27 Mar 2010 04:59:26 -0000
@@ -847,8 +847,6 @@
'submit_text' => $node->webform['submit_text'],
'submit_limit' => $node->webform['submit_limit'],
'submit_interval' => $node->webform['submit_interval'],
- 'additional_validate' => $node->webform['additional_validate'],
- 'additional_submit' => $node->webform['additional_submit'],
))
->execute();
@@ -924,8 +922,6 @@
'submit_text' => '',
'submit_limit' => -1,
'submit_interval' => -1,
- 'additional_validate' => '',
- 'additional_submit' => '',
'roles' => array(1, 2),
'emails' => array(),
'components' => array(),
@@ -1302,8 +1298,8 @@
$form['#action'] = url('node/' . $node->nid);
}
- $form['#submit'][] = 'webform_client_form_submit';
- $form['#validate'][] = 'webform_client_form_validate';
+ $form['#submit'] = array('webform_client_form_pages', 'webform_client_form_submit');
+ $form['#validate'] = array('webform_client_form_validate');
if (is_array($node->webform['components']) && !empty($node->webform['components'])) {
// Prepare a new form array.
@@ -1591,23 +1587,6 @@
// Run all #element_validate and #required checks. These are skipped initially
// by setting #validated = TRUE on all components when they are added.
_webform_client_form_validate($form, $form_state);
-
- // TODO: Remove additional validation (and submission) handling entirely? This
- // is a terrible hack where we need to flatten the submission for validation
- // but then restore the tree version so that the submit handling functions.
- if (trim($node->webform['additional_validate'])) {
- // Flatten trees within the submission.
- $form_state['values']['submitted_tree'] = $form_state['values']['submitted'];
- $form_state['values']['submitted'] = _webform_client_form_submit_flatten($node, $form_state['values']['submitted']);
-
- // Support for Drupal 5 validation code.
- $form_values =& $form_state['values'];
- // We use eval here (rather than drupal_eval) because the user needs access to local variables.
- eval('?>' . $node->webform['additional_validate']);
-
- // Restore the original form state so that the submit handler can reflatten.
- $form_state['values']['submitted'] = $form_state['values']['submitted_tree'];
- }
}
/**
@@ -1680,10 +1659,10 @@
}
}
-function webform_client_form_submit($form, &$form_state) {
- global $user, $base_url;
- module_load_include('inc', 'webform', 'includes/webform.submissions');
-
+/**
+ * Handle the processing of pages and conditional logic.
+ */
+function webform_client_form_pages($form, &$form_state) {
$node = node_load($form_state['values']['details']['nid']);
// Move special settings to storage.
@@ -1785,17 +1764,19 @@
// Flatten trees within the submission.
$form_state['values']['submitted_tree'] = $form_state['values']['submitted'];
$form_state['values']['submitted'] = _webform_client_form_submit_flatten($node, $form_state['values']['submitted']);
+}
- // Perform additional submit processing.
- if (trim($node->webform['additional_submit'])) {
- // Support for Drupal 5 validation code.
- $form_values =& $form_state['values'];
- // We use eval here (rather than drupal_eval) because the user needs access to local variables.
- eval('?>' . $node->webform['additional_submit']);
- }
+/**
+ * Submit handler for saving the form values and sending e-mails.
+ */
+function webform_client_form_submit($form, &$form_state) {
+ module_load_include('inc', 'webform', 'includes/webform.submissions');
+ global $user;
+
+ $node = node_load($form_state['values']['details']['nid']);
// Check if user is submitting as a draft.
- $is_draft = (int) ($form_state['values']['op'] == $draft_op);
+ $is_draft = $form_state['values']['op'] == t('Save Draft');
// Create a submission object.
$submission = (object) array(
Index: webform.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.install,v
retrieving revision 1.44
diff -u -r1.44 webform.install
--- webform.install 16 Mar 2010 00:11:59 -0000 1.44
+++ webform.install 27 Mar 2010 04:59:24 -0000
@@ -76,16 +76,6 @@
'not null' => TRUE,
'default' => -1,
),
- 'additional_validate' => array(
- 'description' => 'PHP code for additional functionality when validating a form.',
- 'type' => 'text',
- 'not null' => TRUE,
- ),
- 'additional_submit' => array(
- 'description' => 'PHP code for additional functionality when submitting a form.',
- 'type' => 'text',
- 'not null' => TRUE,
- ),
),
'primary key' => array('nid'),
);
Index: includes/webform.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/includes/webform.pages.inc,v
retrieving revision 1.12
diff -u -r1.12 webform.pages.inc
--- includes/webform.pages.inc 10 Mar 2010 04:02:07 -0000 1.12
+++ includes/webform.pages.inc 27 Mar 2010 04:59:26 -0000
@@ -145,36 +145,6 @@
'#default_value' => $node->webform['submit_text'],
'#description' => t('By default the submit button on this form will have the label Submit. Enter a new title here to override the default.'),
);
- if (user_access('use PHP for additional processing')) {
- $form['advanced']['additional_validate'] = array(
- '#type' => 'textarea',
- '#title' => t('Additional Validation'),
- '#description' => t('Enter PHP code to perform additional validation for this form. Include the <?php ?> tags. $form and $form_state are available variables. If validation fails, use the form_set_error function to prevent the form from being submitted. Use the same syntax as a _validate function used in the Forms API.'),
- '#default_value' => $node->webform['additional_validate'],
- '#cols' => 40,
- '#rows' => 10,
- );
-
- $form['advanced']['additional_submit'] = array(
- '#type' => 'textarea',
- '#title' => t('Additional Processing'),
- '#description' => t('Enter PHP code to perform additional processing for this form (after the validation). Include the <?php ?> tags. $form and $form_state are available variables, use the same syntax as a _submit function used in the Forms API.'),
- '#default_value' => $node->webform['additional_submit'],
- '#cols' => 40,
- '#rows' => 10,
- );
- }
- else {
- $form['advanced']['additional_validate'] = array(
- '#type' => 'value',
- '#value' => $node->webform['additional_validate'],
- );
-
- $form['advanced']['additional_submit'] = array(
- '#type' => 'value',
- '#value' => $node->webform['additional_submit'],
- );
- }
/* End Advanced Settings Form */
$form['submit'] = array(
@@ -249,10 +219,6 @@
// Set submit button text.
$node->webform['submit_text'] = $form_state['values']['submit_text'];
- // Set additional validation and submission code.
- $node->webform['additional_validate'] = $form_state['values']['additional_validate'];
- $node->webform['additional_submit'] = $form_state['values']['additional_submit'];
-
node_save($node);
drupal_set_message(t('The form settings have been updated.'));
Index: tests/webform.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/tests/webform.test,v
retrieving revision 1.6
diff -u -r1.6 webform.test
--- tests/webform.test 8 Mar 2010 01:04:42 -0000 1.6
+++ tests/webform.test 27 Mar 2010 04:59:26 -0000
@@ -611,8 +611,6 @@
'submit_limit' => '-1',
'submit_interval' => '-1',
'submit_notice' => '1',
- 'additional_validate' => '',
- 'additional_submit' => '',
'roles' => array('1', '2'),
'components' => array(),
'emails' => array(),