Index: webform.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.install,v
retrieving revision 1.40.2.22
diff -u -p -r1.40.2.22 webform.install
--- webform.install	18 Oct 2010 08:08:59 -0000	1.40.2.22
+++ webform.install	14 Nov 2010 05:28:09 -0000
@@ -85,6 +85,13 @@ function webform_schema() {
         'not null' => TRUE,
         'default' => -1,
       ),
+      'storage_model' => array(
+        'description' => 'The method for storing submissions. Defaults to "database".',
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => 'database',
+      ),
     ),
     'primary key' => array('nid'),
   );
@@ -1259,6 +1266,16 @@ function webform_update_6322() {
 }
 
 /**
+ * Add a field for determining the storage model for submissions.
+ */
+function webform_update_6323() {
+  $ret = array();
+  db_add_field($ret, 'webform', 'storage_model', array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => 'database'));
+  update_sql("UPDATE {webform} SET storage_model = 'database' WHERE storage_model = ''");
+  return $ret;
+}
+
+/**
  * Recursively delete all files and folders in the specified filepath, then
  * delete the containing folder.
  *
Index: webform.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.module,v
retrieving revision 1.196.2.69
diff -u -p -r1.196.2.69 webform.module
--- webform.module	5 Nov 2010 01:05:50 -0000	1.196.2.69
+++ webform.module	14 Nov 2010 05:28:09 -0000
@@ -1007,6 +1007,7 @@ function webform_node_defaults() {
     'confirmation' => '',
     'confirmation_format' => FILTER_FORMAT_DEFAULT,
     'redirect_url' => '<confirmation>',
+    'storage_model' => 'database',
     'teaser' => 0,
     'block' => 0,
     'allow_draft' => 0,
@@ -2045,38 +2046,45 @@ function webform_client_form_submit($for
     'data' => webform_submission_data($node, $form_state['values']['submitted']),
   );
 
-  // Save the submission to the database.
-  if (empty($form_state['values']['details']['sid'])) {
-    // No sid was found thus insert it in the dataabase.
-    $form_state['values']['details']['sid'] = webform_submission_insert($node, $submission);
-    $form_state['values']['details']['is_new'] = TRUE;
-
-    // Set a cookie including the server's submission time.
-    // The cookie expires in the length of the interval plus a day to compensate for different timezones.
-    if (variable_get('webform_use_cookies', 0)) {
-      $cookie_name = 'webform-' . $node->nid;
-      $time = time();
-      setcookie($cookie_name . '[' . $time . ']', $time, $time + $node->webform['submit_interval'] + 86400);
-    }
-
-    // Save session information about this submission for anonymous users,
-    // allowing them to access or edit their submissions.
-    if (!$user->uid && user_access('access own webform submissions')) {
-      $_SESSION['webform_submission'][$form_state['values']['details']['sid']] = $node->nid;
+  // Check the storage_model
+  if ('database' == $node->webform['storage_model']) {
+    // Save the submission to the database.
+    if (empty($form_state['values']['details']['sid'])) {
+      // No sid was found thus insert it in the dataabase.
+      $form_state['values']['details']['sid'] = webform_submission_insert($node, $submission);
+      $form_state['values']['details']['is_new'] = TRUE;
+  
+      // Set a cookie including the server's submission time.
+      // The cookie expires in the length of the interval plus a day to compensate for different timezones.
+      if (variable_get('webform_use_cookies', 0)) {
+        $cookie_name = 'webform-' . $node->nid;
+        $time = time();
+        setcookie($cookie_name . '[' . $time . ']', $time, $time + $node->webform['submit_interval'] + 86400);
+      }
+  
+      // Save session information about this submission for anonymous users,
+      // allowing them to access or edit their submissions.
+      if (!$user->uid && user_access('access own webform submissions')) {
+        $_SESSION['webform_submission'][$form_state['values']['details']['sid']] = $node->nid;
+      }
     }
+    else {
+      // Sid was found thus update the existing sid in the database.
+      $submission->sid = $form_state['values']['details']['sid'];
+      webform_submission_update($node, $submission);
+      $form_state['values']['details']['is_new'] = FALSE;
+    }
+  
+    $sid = $form_state['values']['details']['sid'];
   }
-  else {
-    // Sid was found thus update the existing sid in the database.
-    $submission->sid = $form_state['values']['details']['sid'];
-    webform_submission_update($node, $submission);
-    $form_state['values']['details']['is_new'] = FALSE;
-  }
-
-  $sid = $form_state['values']['details']['sid'];
 
   // Check if this form is sending an email.
   if (!$is_draft && !$form_state['values']['details']['finished']) {
-    $submission = webform_get_submission($node->nid, $sid, TRUE);
+    // If we're storing the submission in the database, add it to the submissions static cache.
+    // Otherwise, the existing $submissions object will be used.
+    if ('database' == $node->webform['storage_model']) {
+      $submission = webform_get_submission($node->nid, $sid, TRUE);
+    }
 
     // Create a themed message for mailing.
     foreach ($node->webform['emails'] as $eid => $email) {
Index: includes/webform.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/includes/webform.pages.inc,v
retrieving revision 1.10.2.4
diff -u -p -r1.10.2.4 webform.pages.inc
--- includes/webform.pages.inc	17 Oct 2010 18:53:09 -0000	1.10.2.4
+++ includes/webform.pages.inc	14 Nov 2010 05:28:09 -0000
@@ -113,6 +113,24 @@ function webform_configure_form(&$form_s
     '#parents' => array('submit_interval'),
   );
 
+  // Storage option settings.
+  $form['submission']['storage'] = array(
+    '#type' => 'item',
+    '#title' => t('Storage Model'),
+    '#theme' => 'webform_advanced_storage_form',
+    '#description' => t('Chose the storage model for this webform.  Default is to store the submissions in the main Drupal database. Choose "None" if you do not want to store submissions.'),
+  );
+  $form['submission']['storage']['storage_model'] = array(
+    '#type' => 'select',
+    '#options' => array(
+      'database' => t('Database'),
+      'none' => t('None')
+    ),
+    '#default_value' => $node->webform['storage_model'],
+    '#parents' => array('storage_model'),
+  );
+
+
   /* End Edit Form */
 
   /* Start per-role submission control */
@@ -261,6 +279,9 @@ function webform_configure_form_submit($
     $node->webform['submit_limit'] = $form_state['values']['submit_limit'];
     $node->webform['submit_interval'] = $form_state['values']['submit_interval'];
   }
+  
+  // Set the storage model.
+  $node->webform['storage_model'] = $form_state['values']['storage_model'];
 
   // Set submit notice.
   $node->webform['submit_notice'] = $form_state['values']['submit_notice'];
