--- cck_fieldgroup_tabs.module.orig	2009-08-25 17:53:03.555571800 +0200
+++ cck_fieldgroup_tabs.module	2009-08-27 13:03:49.656250000 +0200
@@ -6,54 +6,6 @@
  * Add tabs display option for CCK fieldgroups.
  */
 
-/**
- * Implementation of hook_menu().
- */
-function cck_fieldgroup_tabs_menu() {
-  $items = array();
-  $items['admin/settings/cck-fieldgroup-tabs'] = array(
-    'title' => 'CCK Fieldgroup Tabs',
-    'description' => 'Configuration for CCK fieldgroup tabs',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('cck_fieldgroup_tabs_admin_settings'),
-    'access arguments' => array('administer site configuration'),
-  );
-  return $items;
-}
-
-/**
- * Admin settings.
- */
-function cck_fieldgroup_tabs_admin_settings() {
-  $form = array();
-  $form['cck_fieldset_basics'] = array('#type' => 'fieldset', '#title' => t('Basics Tab Info'));
-  $form['cck_fieldset_basics']['cck_fieldset_tabs_residual'] = array(
-    '#type' => 'radios',
-    '#title' => t('Basics tab'),
-    '#description' => t('Enable this option to give nodes with tabs a new tab containing all fields (e.g., node title and body) not already on a tab.'),
-    '#options' => array(t('Disabled'), t('Enabled')),
-    '#default_value' => variable_get('cck_fieldset_tabs_residual', 0),
-  );
-  $form['cck_fieldset_basics']['cck_fieldset_tabs_residual_weight'] = array(
-    '#type' => 'weight',
-    '#delta' => 30,
-    '#title' => t('Basics Tab weight'),
-    '#description' => t('Enter a weight for the "Basics" tab.'),
-    '#default_value' => variable_get('cck_fieldset_tabs_residual_weight', -20),
-  );
-  $form['cck_fieldset_titles'] = array('#type' => 'fieldset', '#title' => t('Basics Tab Titles'));
-  foreach (node_get_types() as $type => $object) {
-    $form['cck_fieldset_titles']['cck_fieldset_tabs_residual_title_'.$type] = array(
-      '#type' => 'textfield',
-      '#title' => t('%type', array('%type' => $object->name)),
-      '#default_value' => variable_get('cck_fieldset_tabs_residual_title_'.$type, t('Basics')),
-    );
-  }
-
-  $form = system_settings_form($form);
-  return $form;
-}
-
 /*
  * Implementation of hook_form_alter().
  */
@@ -78,6 +30,35 @@ function cck_fieldgroup_tabs_form_alter(
   else if ($form_id == 'fieldgroup_group_edit_form') {
     $form['settings']['form']['style']['#options']['tabs'] = t('tabs');
   }
+  elseif ($form_id == 'node_type_form' && $form['#node_type']->type && !$form['#programmed']) {
+    $form += cck_fieldgroup_tabs_node_type_form($form['#node_type']->type);
+  }  
+}
+
+function cck_fieldgroup_tabs_node_type_form($node_type) {
+  $form = array();
+  $form['cck_fieldgroup_tabs'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('CCK Fieldgroup Tabs'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#description' => t('CCK Fielgroup Tabs with residual fields not in fieldgroup tabs in a Basics Tab'),
+  );
+  $form['cck_fieldgroup_tabs']['cck_fieldset_tabs_residual_title'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Name of Default Basic Tab'),
+    '#description' => t('Leave blank to keep top level form elements like title and body outside of a Basic Tabs.'),
+    '#default_value' => variable_get('cck_fieldset_tabs_residual_title_' . $node_type, ''),
+  );
+  $form['cck_fieldgroup_tabs']['cck_fieldset_tabs_residual_weight'] = array(
+    '#type' => 'weight',
+    '#delta' => 30,
+    '#title' => t('Basics Tab weight'),
+    '#description' => t('Enter a weight for the "Basics" tab.'),
+    '#default_value' => variable_get('cck_fieldset_tabs_residual_weight_'. $node_type, -20),
+  );
+
+  return $form;
 }
 
 /*
@@ -110,14 +91,13 @@ function cck_fieldgroup_tabs_pre_render(
       }
     }
     $node_type = $form['type']['#value'];
-    if (isset($form['fieldgroup_tabs']) && variable_get('cck_fieldset_tabs_residual', FALSE)) {
+    if (isset($form['fieldgroup_tabs']) && variable_get('cck_fieldset_tabs_residual_title_'. $node_type, FALSE)) {
       // Add residual content to a tab if desired.
-      $title = t(variable_get('cck_fieldset_tabs_residual_title_' . $node_type, variable_get('cck_fieldset_tabs_residual_title', t('Basics'))));
       $residual = array(
         '#type' => 'tabpage',
         // Pass the value through t() if needed.
-        '#title' =>  t($title != t('Basics') ? $title : 'Basics'),
-        '#weight' => variable_get('cck_fieldset_tabs_residual_weight', -20),
+        '#title' =>  t(variable_get('cck_fieldset_tabs_residual_title_'. $node_type, '')),
+        '#weight' => variable_get('cck_fieldset_tabs_residual_weight_'. $node_type, -20),
       );
       foreach (element_children($form) as $key) {
         // Skip the buttons so that they are below the tabset. Don't process
@@ -172,11 +152,10 @@ function cck_fieldgroup_tabs_nodeapi(&$n
       }
       if (isset($node->content['fieldgroup_tabs'])) {
         // Add residual content to a tab if desired.
-        if (variable_get('cck_fieldset_tabs_residual', FALSE)) {
-          $title = t(variable_get('cck_fieldset_tabs_residual_title_' . $node_type, variable_get('cck_fieldset_tabs_residual_title', t('Basics'))));
+        if (variable_get('cck_fieldset_tabs_residual_title_'. $node->type, FALSE)) {
           $residual = array(
             '#type' => 'tabpage',
-            '#title' =>  t($title != t('Basics') ? $title : 'Basics'),
+            '#title' =>  t(variable_get('cck_fieldset_tabs_residual_title_'. $node->type, '')),
             '#weight' => variable_get('cck_fieldset_tabs_residual_weight', -20),
           );
           foreach (element_children($node->content) as $key) {
