Index: webform.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.install,v
retrieving revision 1.40.2.23
diff -u -p -r1.40.2.23 webform.install
--- webform.install	6 Jan 2011 18:34:59 -0000	1.40.2.23
+++ webform.install	7 Jan 2011 17:14:26 -0000
@@ -92,6 +92,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'),
   );
@@ -1277,6 +1284,17 @@ function webform_update_6323() {
 }
 
 /**
+ * Add a field for determining the storage model for submissions.
+ */
+function webform_update_6324() {
+  $ret = array();
+  if (!db_column_exists('webform', 'storage_model')) {
+    db_add_field($ret, 'webform', 'storage_model', array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => 'database', 'initial' => 'database'));
+  }
+  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.74
diff -u -p -r1.196.2.74 webform.module
--- webform.module	6 Jan 2011 18:34:59 -0000	1.196.2.74
+++ webform.module	7 Jan 2011 17:14:26 -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,
@@ -2058,38 +2059,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.5
diff -u -p -r1.10.2.5 webform.pages.inc
--- includes/webform.pages.inc	6 Jan 2011 18:35:00 -0000	1.10.2.5
+++ includes/webform.pages.inc	7 Jan 2011 17:14:26 -0000
@@ -112,7 +112,6 @@ function webform_configure_form(&$form_s
     '#default_value' => $node->webform['submit_interval'],
     '#parents' => array('submit_interval'),
   );
-
   $form['submission']['status'] = array(
     '#type' => 'radios',
     '#title' => t('Status of this form'),
@@ -121,6 +120,23 @@ function webform_configure_form(&$form_s
     '#parents' => array('status'),
     '#options' => array(1 => t('Open'), 0 => t('Closed')),
   );
+
+  // 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 */
@@ -272,6 +288,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'];
Index: includes/webform.report.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/includes/webform.report.inc,v
retrieving revision 1.16.2.10
diff -u -p -r1.16.2.10 webform.report.inc
--- includes/webform.report.inc	29 Sep 2010 18:38:19 -0000	1.16.2.10
+++ includes/webform.report.inc	7 Jan 2011 17:14:26 -0000
@@ -159,7 +159,9 @@ function theme_webform_results_submissio
  * Preprocess function for webform-results-submissions.tpl.php
  */
 function template_preprocess_webform_results_submissions(&$vars) {
-  $vars['node'] = $vars['element']['#node'];
+  $node = $vars['element']['#node'];
+  $vars['node'] = $node;
+  $vars['storage_model'] = $node->webform['storage_model'];
   $vars['submissions'] = $vars['element']['#submissions'];
   $vars['table'] = $vars['element']['table'];
   $vars['total_count'] = $vars['element']['#total_count'];
Index: templates/webform-results-submissions.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/templates/webform-results-submissions.tpl.php,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 webform-results-submissions.tpl.php
--- templates/webform-results-submissions.tpl.php	8 Sep 2010 02:56:07 -0000	1.1.2.2
+++ templates/webform-results-submissions.tpl.php	7 Jan 2011 17:14:26 -0000
@@ -23,7 +23,13 @@ drupal_add_css(drupal_get_path('module',
   <?php print theme('webform_results_per_page', $total_count, $pager_count); ?>
   <?php print theme('table', $table['#header'], $table['#rows']); ?>
 <?php else: ?>
-  <?php print t('There are no submissions for this form. <a href="!url">View this form</a>.', array('!url' => url('node/' . $node->nid))); ?>
+  <?php if ($storage_model == 'database'): ?>
+    <?php print t('There are no submissions for this form. <a href="!url">View this form</a>.', array('!url' => url('node/' . $node->nid))); ?>
+  <?php elseif ($storage_model == 'none'): ?>
+    <?php print t('This form does not store results. <a href="!url">View this form</a>.', array('!url' => url('node/' . $node->nid))); ?>
+  <?php else: ?>
+    <?php print t('This form does not store results locally. <a href="!url">View this form</a>.', array('!url' => url('node/' . $node->nid))); ?>
+  <?php endif; ?>
 <?php endif; ?>
 
 
