Index: captcha.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/captcha.admin.inc,v
retrieving revision 1.32
diff -u -r1.32 captcha.admin.inc
--- captcha.admin.inc	27 Oct 2009 16:11:17 -0000	1.32
+++ captcha.admin.inc	11 Jun 2010 15:40:04 -0000
@@ -60,11 +60,11 @@
   );
   $form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'] = array();
   $captcha_type_options = _captcha_available_challenge_types();
-  // TODO: make a wrapper for this query to make it a bit cleaner?
-  $result = db_query("SELECT * FROM {captcha_points} ORDER BY form_id");
-  while ($captcha_point = db_fetch_object($result)) {
-    $form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id] = array();
-    $form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id]['form_id'] = array(
+
+  $captcha_points = captcha_get_catcha_points();
+  foreach ($captcha_points as $captcha_point) {
+    $elem = array();
+    $elem['form_id'] = array(
       '#value' => $captcha_point->form_id,
     );
     // Select widget for CAPTCHA type.
@@ -77,17 +77,25 @@
     else {
       $captcha_type = 'none';
     }
-    $form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id]['captcha_type'] = array(
+    $elem['captcha_type'] = array(
       '#type' => 'select',
       '#default_value' => $captcha_type,
       '#options' => $captcha_type_options,
     );
     // Additional operations.
-    $form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id]['operations'] = array(
-      '#value' => implode(", ", array(
-        l(t('delete'), "admin/user/captcha/captcha/captcha_point/{$captcha_point->form_id}/delete"),
-      ))
-    );
+    $ops = array();
+    if (module_exists('ctools') && $captcha_point->export_type & EXPORT_IN_CODE) {
+      if ($captcha_point->export_type & EXPORT_IN_DATABASE) {
+        $ops[] = l(t('revert'), "admin/user/captcha/captcha/captcha_point/{$captcha_point->form_id}/delete");
+      }
+      // TODO Disable exported points.
+    }
+    else {
+      $ops[] = l(t('delete'), "admin/user/captcha/captcha/captcha_point/{$captcha_point->form_id}/delete");
+    }
+    $elem['operations'] = array('#value' => implode(", ", $ops));
+
+    $form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id] = $elem;
   }
 
   // Form items for new form_id.
Index: captcha.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/captcha.inc,v
retrieving revision 1.11.2.2
diff -u -r1.11.2.2 captcha.inc
--- captcha.inc	19 May 2010 06:14:31 -0000	1.11.2.2
+++ captcha.inc	11 Jun 2010 15:40:04 -0000
@@ -52,11 +52,18 @@
  *   or in the form 'captcha/Math'.
  */
 function captcha_get_form_id_setting($form_id, $symbolic=FALSE) {
-  $result = db_query("SELECT module, type FROM {captcha_points} WHERE form_id = '%s'", $form_id);
-  if (!$result) {
-    return NULL;
+  if (module_exists('ctools')) {
+    ctools_include('export');
+    $captcha_point = array_pop(ctools_export_load_object('captcha_points', 'names', array($form_id)));
   }
-  $captcha_point = db_fetch_object($result);
+  else {
+    $result = db_query("SELECT module, type FROM {captcha_points} WHERE form_id = '%s'", $form_id);
+    if (!$result) {
+      return NULL;
+    }
+    $captcha_point = db_fetch_object($result);
+  }
+
   if (!$captcha_point) {
     $captcha_point = NULL;
   }
@@ -79,7 +86,25 @@
   return $captcha_point;
 }
 
-
+/**
+ * Helper function to load all captcha points.
+ *
+ * @return array of all captcha_points
+ */
+function captcha_get_catcha_points() {
+  if (module_exists('ctools')) {
+    ctools_include('export');
+    $captcha_points = ctools_export_load_object('captcha_points', 'all');
+  }
+  else {
+    $captcha_points = array();
+    $result = db_query("SELECT * FROM {captcha_points} ORDER BY form_id");
+    while ($captcha_point = db_fetch_object($result)) {
+      $captcha_points[] = $captcha_point;
+    }
+  }
+  return $captcha_points;
+}
 /**
  * Helper function for generating a new CAPTCHA session.
  *
Index: captcha.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/captcha.install,v
retrieving revision 1.11.2.1
diff -u -r1.11.2.1 captcha.install
--- captcha.install	1 Jun 2010 21:39:22 -0000	1.11.2.1
+++ captcha.install	11 Jun 2010 15:40:04 -0000
@@ -8,6 +8,18 @@
   // Table for positions and types of the challenges.
   $schema['captcha_points'] = array(
     'description' => 'This table describes which challenges should be added to which forms.',
+    'export' => array(
+      'key' => 'form_id',
+      'identifier' => 'captcha',
+      'default hook' => 'captcha_default_points',  // Function hook name.
+      'status' => 'mark_status',
+      'api' => array(
+        'owner' => 'captcha',
+        'api' => 'captcha',  // Base name for api include files.
+        'minimum_version' => 1,
+        'current_version' => 1,
+      ),
+    ),
     'fields' => array(
       'form_id' => array(
         'description' => 'The form_id of the form to add a CAPTCHA to.',
