Index: webform.module =================================================================== RCS file: /cvs/drupal/contributions/modules/webform/webform.module,v retrieving revision 1.113.2.70.2.65 diff -u -r1.113.2.70.2.65 webform.module --- webform.module 6 Sep 2008 20:51:35 -0000 1.113.2.70.2.65 +++ webform.module 8 Sep 2008 06:56:03 -0000 @@ -926,7 +926,7 @@ } // Render the form and generate the output. - $form = drupal_get_form('webform_client_form_'. $node->nid, $node, $submission, $enabled, $preview); + $form = drupal_get_form('webform_client_form_'. $node->nid, $node, $submission, $enabled, $preview, NULL, $teaser); $output = theme('webform_view', $node, $teaser, $page, $form, $enabled); // Remove the surrounding
tag if this is a preview. @@ -1169,7 +1169,7 @@ * Note: The position of this parameter depends on all other parameters being * specified when using drupal_get_form(). */ -function webform_client_form(&$node, $submission, $enabled, $preview, $form_values = NULL) { +function webform_client_form(&$node, $submission, $enabled, $preview, $form_values = NULL, $teaser = 0) { include_once(drupal_get_path('module', 'webform') .'/webform_components.inc'); webform_load_components(); @@ -1223,6 +1223,11 @@ ); } + $form['teaser'] = array( + '#type' => 'value', + '#value' => $teaser, + ); + // Add a theme function for this form. $form['#theme'] = 'webform_form_'. $node->nid; @@ -1232,7 +1237,7 @@ // Set the form action to the node ID in case this is being displayed on the // teaser, subsequent pages should be on the node page directly. - if (arg(2) != 'submission') { + if (!$teaser && arg(2) != 'submission') { $form['#action'] = url('node/'. $node->nid); } @@ -1614,9 +1619,13 @@ $path = preg_replace('/^internal:/', '', $node->webform['confirmation']); $redirect = array(trim($path), 'sid='. $sid); } - else { + elseif (!$form_values['teaser']) { $redirect = array('node/'. $node->nid .'/done', 'sid='. $sid); } + else { + drupal_set_message(t('Thank you, your submission has been received.')); + $redirect = NULL; + } return $redirect; }