Index: quicktabs.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/quicktabs/quicktabs.css,v
retrieving revision 1.6.2.2
diff -u -p -r1.6.2.2 quicktabs.css
--- quicktabs.css	29 Nov 2008 06:09:43 -0000	1.6.2.2
+++ quicktabs.css	3 Dec 2008 13:10:27 -0000
@@ -118,12 +118,21 @@ ul.quicktabs_tabs li {
 
 /* Misc */
 
-td.qt-tab-bvid input.form-submit {
+td.qt-tab-view-content input.form-submit {
   display: none;
 }
 
-td.qt-tab-bvid div.form-item {
-  clear: both;
+td.qt-tab-title, td.qt-tab-type {
+  width: 150px;
+}
+
+td.qt-tab-block-content, td.qt-tab-view-content, td.qt-tab-node-content {
+  height: 120px;
+}
+
+td.qt-tab-view-content div.form-item {
+  padding-right: 15px;
+  float: left;
 }
 
 body.quicktabs_iframe ul#simplemenu {
Index: quicktabs.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/quicktabs/quicktabs.install,v
retrieving revision 1.4.2.1
diff -u -p -r1.4.2.1 quicktabs.install
--- quicktabs.install	29 Nov 2008 06:09:43 -0000	1.4.2.1
+++ quicktabs.install	3 Dec 2008 16:36:18 -0000
@@ -60,10 +60,71 @@ function quicktabs_uninstall() {
   }
 }
 
+/**
+ * Add ajax column.
+ */
 function quicktabs_update_1() {
   $ret = array();
   db_add_field($ret, 'quicktabs', 'ajax', array('description' => t('Whether this is an ajax views block'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
   return $ret;
 }
 
+/**
+ * Update the tabs to the new format.
+ */
+function quicktabs_update_6002() {
+  $ret = array();
+  module_load_include('inc', 'quicktabs', 'includes/admin');
+  $result = db_query('SELECT qtid FROM {quicktabs}');
+
+  while ($row = db_fetch_object($result)) {
+    $quicktabs = quicktabs_load($row->qtid);
+    foreach ($quicktabs['tabs'] as $key => $tab) {
+      $newtab = array();
+      $newtab['type'] = $tab['type'];
+      $newtab['weight'] = $tab['weight'];
+      $newtab['title'] = $tab['title'];
+      switch ($tab['type']) {
+        case 'view':
+          if (isset($tab['vid'])) {
+            // This is in new format already, don't change.
+            $newtab['vid']= $tab['vid'];
+          }
+          else {
+            if ($quicktabs['ajax']) {
+              $newtab['vid'] = $tab['bnid'];
+            }
+            else {
+              $newtab['vid'] = $tab['bvid'];
+            }
+          }
+          $newtab['display'] = $tab['display'];
+          $newtab['args'] = $tab['args'];
+          break;
+        case 'block':
+          if (isset($tab['bid'])) {
+            // This is in new format already, don't change.
+            $newtab['bid']= $tab['bid'];
+          }
+          else {
+            $newtab['bid'] = $tab['bvid'];
+          }
+          $newtab['hide_title'] = $tab['hide_title'];
+          break;
+        case 'node':
+          if (isset($tab['nid'])) {
+            // This is in new format already, don't change.
+            $newtab['nid'] = $tab['nid'];
+          }
+          else {
+            $newtab['nid'] = $tab['bnid'];
+          }
+          break;
+      }
+      $quicktabs['tabs'][$key] = $newtab;
+    }
+    quicktabs_updateblock($quicktabs);
+  }
+  return $ret;
+}
 
Index: quicktabs.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/quicktabs/quicktabs.module,v
retrieving revision 1.10.2.10
diff -u -p -r1.10.2.10 quicktabs.module
--- quicktabs.module	3 Dec 2008 07:19:21 -0000	1.10.2.10
+++ quicktabs.module	3 Dec 2008 16:40:11 -0000
@@ -67,15 +67,6 @@ function quicktabs_menu() {
       'page callback' => 'quicktabs_new',
       'type' => MENU_LOCAL_TASK,
     );
-    $items['admin/build/quicktabs/ajax/add'] = array(
-      'title' => 'New QT AJAX block',
-      'file' => 'includes/admin.inc',
-      'access arguments' => array('create quicktabs block'),
-      'page callback' => 'quicktabs_new',
-      'page arguments' => array(TRUE),
-      'weight' => 1,
-      'type' => MENU_LOCAL_TASK,
-    );
     $items['admin/build/quicktabs/delete/%quicktabs'] = array(
       'title' => 'Delete QT block',
       'file' => 'includes/admin.inc',
@@ -140,6 +131,7 @@ function quicktabs_block($op = 'list', $
 
   switch ($op) {
     case 'list':
+      $blocks = array();
       $jqueryblocks = array();
       $result = db_query('SELECT * FROM {quicktabs}');
       while ($row = db_fetch_object($result)) {
@@ -268,7 +260,7 @@ function quicktabs_ajax_render($tabs, $d
 function quicktabs_ajax_node($nid) {
   $tabpage = array(
     'type' => 'node',
-    'bnid' => $nid,
+    'nid' => $nid,
   );
   $output = quicktabs_render_tabpage($tabpage);
   print drupal_to_js(array('status' => TRUE, 'data' => $output));
@@ -280,7 +272,7 @@ function quicktabs_ajax_node($nid) {
 function quicktabs_ajax_block($bid, $hide_title) {
   $tabpage = array(
     'type' => 'block',
-    'bvid' => $bid,
+    'bid' => $bid,
     'hide_title' => $hide_title,
   );
 
@@ -313,17 +305,23 @@ function theme_quicktabs_tabs($tabs, $aj
 
     if ($ajax) {
       $qtpath = 'quicktabs_'. $delta . '='. $i;
-      if ($tab['type'] == 'view') {
+      switch ($tab['type']) {
+      case 'view':
         if (module_exists('views')) {
           if ($tab['args'] != '') {
             $argstring = '-'. str_replace(',', '|', $tab['args']);
           } else {
             $argstring = '';
           }
-          $id = 'view-'. $delta .'-'. $i .'-'. $tab['bnid'] .'-'. $tab['display'] . $argstring;
+          $id = 'view-'. $delta .'-'. $i .'-'. $tab['vid'] .'-'. $tab['display'] . $argstring;
         }
-      } else {
-        $id = 'node-'. $delta .'-'. $i .'-'. $tab['bnid'];
+        break;
+      case 'node':
+        $id = 'node-'. $delta .'-'. $i .'-'. $tab['nid'];
+        break;
+      case 'block':
+        $id = 'block-'. $delta .'-'. $i .'-'. $tab['bid'] .'-'. $tab['hide_title'];
+        break;
       }
       $output .= '<li'. drupal_attributes(array('class' => $class)) .'"><a href="'. $path . $qtpath .'" class="qt_ajax_tabs" id="'. $id .'">'. $tab['title'] .'</a></li>';
     } else {
@@ -420,16 +418,9 @@ function quicktabs_load($qtid) {
  */
 function quicktabs_render_tabpage($tab) {
   $output = '';
-  // the id key is different depending on the qt type
-  if (isset($tab['bvid'])) {
-    $id = 'bvid';
-  }
-  else {
-    $id = 'bnid';
-  }
   switch ($tab['type']) {
     case 'view':
-      if (isset($tab[$id])) {
+      if (isset($tab['vid'])) {
         if (module_exists('views')) {
           $args = array();
           if ($tab['args'] != '') {
@@ -438,7 +429,7 @@ function quicktabs_render_tabpage($tab) 
               $args[] = trim($arg);
             }
           }
-          $func_args = array_merge(array($tab[$id], $tab['display']), $args);
+          $func_args = array_merge(array($tab['vid'], $tab['display']), $args);
           $output = call_user_func_array('views_embed_view', $func_args);
         }
         else {
@@ -448,10 +439,10 @@ function quicktabs_render_tabpage($tab) 
       break;
 
     case 'block':
-      if (isset($tab[$id])) {
-        $pos = strpos($tab['bvid'], '_delta_');
-        $blockmodule = substr($tab[$id], 0, $pos);
-        $blockdelta = substr($tab[$id], $pos + 7);
+      if (isset($tab['bid'])) {
+        $pos = strpos($tab['bid'], '_delta_');
+        $blockmodule = substr($tab['bid'], 0, $pos);
+        $blockdelta = substr($tab['bid'], $pos + 7);
         $block = (object) module_invoke($blockmodule, 'block', 'view', $blockdelta);
         if (isset($block->content)) {
           $block->module = $blockmodule;
@@ -461,8 +452,8 @@ function quicktabs_render_tabpage($tab) 
       }
 
     case 'node':
-      if (isset($tab[$id])) {
-        $node = node_load($tab[$id]);
+      if (isset($tab['nid'])) {
+        $node = node_load($tab['nid']);
         if (!empty($node)) {
           $output = theme('node', $node);
         }
cvs diff: Diffing includes
Index: includes/admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/quicktabs/includes/Attic/admin.inc,v
retrieving revision 1.1.2.10
diff -u -p -r1.1.2.10 admin.inc
--- includes/admin.inc	3 Dec 2008 07:39:04 -0000	1.1.2.10
+++ includes/admin.inc	3 Dec 2008 16:44:13 -0000
@@ -24,31 +24,28 @@ function quicktabs_list() {
 }
 
 
-function quicktabs_new($ajax = FALSE) {
+function quicktabs_new() {
+  $quicktabs['formtype'] = 'new';
   drupal_add_js(drupal_get_path('module', 'quicktabs') .'/js/quicktabs_form.js');
   drupal_add_css(drupal_get_path('module', 'quicktabs') .'/quicktabs.css');
-  if (!$ajax) {
-    return drupal_get_form('quicktabs_form');
-  } else {
-    return drupal_get_form('quicktabs_aj_form');
-  }
+  return drupal_get_form('quicktabs_form', $quicktabs);
 }
 
 /**
  * build the Quick Tabs (normal) creation and edit form
  */
-function quicktabs_form($form_state = NULL, $quicktabs = NULL) {
+function quicktabs_form($form_state, $quicktabs) {
   // Add our JS file, which has some Drupal core JS overrides, and ensures ahah behaviours get re-attached
   drupal_add_js(drupal_get_path('module', 'quicktabs') . '/js/quicktabs_ahah.js', 'module', 'footer');
 
-  $form = _qt_admin_main_form($form_state, $quicktabs, FALSE);
+  $form = _qt_admin_main_form($form_state, $quicktabs);
 
   $formtype = $quicktabs['formtype'];
   if ($formtype == 'edit') {
 
     $form['qtid'] = array(
       '#type' => 'hidden',
-      '#value' => $quicktabs['qtid']
+      '#value' => isset($quicktabs['qtid']) ? $quicktabs['qtid'] : 0,
     );
   }
 
@@ -68,88 +65,23 @@ function quicktabs_form($form_state = NU
 
   // Add the current tabs to the form.
   for ($delta = 0; $delta < $qt_count; $delta++) {
-
-    $weight = isset($tabcontent[$delta]['tabweight']) ? $tabcontent[$delta]['tabweight'] : $delta-10;
-    $title = isset($tabcontent[$delta]['tabtext']) ? $tabcontent[$delta]['tabtext'] : '';
-    $type = isset($tabcontent[$delta]['tabtype']) ? $tabcontent[$delta]['tabtype'] : 'block';
-    $bid = isset($tabcontent[$delta]['bid']) ? $tabcontent[$delta]['bid'] : NULL;
-    $hide_title = isset($tabcontent[$delta]['hide_title']) ? $tabcontent[$delta]['hide_title'] : 1;
-    $vid = isset($tabcontent[$delta]['vid']) ? $tabcontent[$delta]['vid'] : 'default';
-    $args = isset($tabcontent[$delta]['args']) ? $tabcontent[$delta]['args'] : NULL;
-    $display = isset($tabcontent[$delta]['display']) ? $tabcontent[$delta]['display'] : 'default';
-    $details = array(
-      'delta' => $delta,
-      'weight' => $weight,
-      'title' => $title,
-      'type' => $type,
-      'bid' => $bid,
-      'hide_title' => $hide_title,
-      'vid' => $vid,
-      'args' => $args,
-      'display' => $display,
-    );
-    $form['qt_wrapper']['tabs'][$delta] = _quicktabs_form($details, FALSE);
+    $details = isset($tabcontent[$delta]) ? $tabcontent[$delta] : array();
+    $details['delta'] = $delta;
+    $form['qt_wrapper']['tabs'][$delta] = _quicktabs_form($details);
   }
 
   return $form;
 }
 
+// @todo: remove this comment block. it is left only to make the patch readable.
 /**
  * build the Quick Tabs (ajax) creation and edit form
  */
-function quicktabs_aj_form($form_state = NULL, $quicktabs = NULL) {
-  // Add our JS file, which has some Drupal core JS overrides, and ensures ahah behaviours get re-attached
-  drupal_add_js(drupal_get_path('module', 'quicktabs') . '/js/quicktabs_ahah.js', 'footer');
-
-  $form = _qt_admin_main_form($form_state, $quicktabs, TRUE);
-
-  $formtype = $quicktabs['formtype'];
-  if ($formtype == 'edit') {
-
-    $form['qtid'] = array(
-      '#type' => 'hidden',
-      '#value' => $quicktabs['qtid']
-    );
-  }
-
-  $tabcontent = $quicktabs['tabs'];
-
-  if (isset($form_state['qt_count'])) {
-    $qt_count = $form_state['qt_count'];
-  }
-  else {
-    $qt_count = max(2, empty($tabcontent) ? 2 : count($tabcontent));
-  }
-
-  // Add the current tabs to the form.
-  for ($delta = 0; $delta < $qt_count; $delta++) {
-
-    $weight = isset($tabcontent[$delta]['tabweight']) ? $tabcontent[$delta]['tabweight'] : $delta-10;
-    $title = isset($tabcontent[$delta]['tabtext']) ? $tabcontent[$delta]['tabtext'] : '';
-    $type = isset($tabcontent[$delta]['tabtype']) ? $tabcontent[$delta]['tabtype'] : 'node';
-    $nid = isset($tabcontent[$delta]['nid']) ? $tabcontent[$delta]['nid'] : NULL;
-    $vid = isset($tabcontent[$delta]['vid']) ? $tabcontent[$delta]['vid'] : 'default';
-    $args = isset($tabcontent[$delta]['args']) ? $tabcontent[$delta]['args'] : NULL;
-    $display = isset($tabcontent[$delta]['display']) ? $tabcontent[$delta]['display'] : 'default';
-    $details = array(
-      'delta' => $delta,
-      'weight' => $weight,
-      'title' => $title,
-      'type' => $type,
-      'nid' => $nid,
-      'vid' => $vid,
-      'args' => $args,
-      'display' => $display,
-    );
-    $form['qt_wrapper']['tabs'][$delta] = _quicktabs_form($details, TRUE);
-  }
-  return $form;
-}
 
 /*
  * The main section of admin page.
  */
-function _qt_admin_main_form($form_state = NULL, &$quicktabs = NULL, $ajax = FALSE) {
+function _qt_admin_main_form($form_state, &$quicktabs) {
   $form['#cache'] = TRUE;
 
   // the contents of $quicktabs will either come from the db or from $form_state
@@ -161,8 +93,20 @@ function _qt_admin_main_form($form_state
   '#title' => t('Block Title'),
   '#type' => 'textfield',
   '#description' => t('The title of the whole block'),
-  '#default_value' => ($quicktabs['title'] ? $quicktabs['title'] : ''),
-  '#weight' => -5
+  '#default_value' => (isset($quicktabs['title']) ? $quicktabs['title'] : ''),
+  '#weight' => -6
+  );
+
+  $form['ajax'] = array(
+    '#type' => 'radios',
+    '#title' => t('Ajax'),
+    '#options' => array(
+      TRUE => t('Yes') .': '. t('Tabpages will be loaded at tab click.'),
+      FALSE => t('No') .': '. t('Tabpages will be loaded at page load.'),
+    ),
+    '#default_value' => isset($quicktabs['ajax']) ? $quicktabs['ajax'] : 0,
+    '#description' => t('Choose how the tabpages shoud be loaded.'),
+    '#weight' => -5,
   );
 
   // Add a wrapper for the tabs and Add Another Tab button.
@@ -174,6 +118,7 @@ function _qt_admin_main_form($form_state
   );
 
   $form['qt_wrapper']['tabs'] = array(
+    '#tree' => TRUE,
     '#prefix' => '<div id="quicktabs-tabs">',
     '#suffix' => '</div>',
     '#theme' => 'qt_tabs',
@@ -222,65 +167,38 @@ function _qt_admin_main_form($form_state
 /*
  * Build one row (one tabpage) on the QT admin form.
  */
-function _quicktabs_form($details, $ajax = FALSE) {
+function _quicktabs_form(array $details) {
   $form['#tree'] = TRUE;
   $delta = $details['delta'];
 
-  // We'll manually set the #parents property of these fields so that
-  // their values appear in the $form_state['values']['tabs'] array.
-  $form['tabweight'] = array(
+  $form['weight'] = array(
     '#type' => 'weight',
-    '#default_value' => $details['weight'],
-    '#parents' => array('tabs', $delta, 'tabweight'),
+    '#default_value' => isset($details['weight']) ? $details['weight'] : $delta-10,
   );
 
-  $form['tabtext'] = array(
+  $form['title'] = array(
     '#type' => 'textfield',
     '#size' => '10',
     '#title' => t('Tab @n', array('@n' => ($delta + 1))),
-    '#default_value' => $details['title'],
-    '#parents' => array('tabs', $delta, 'tabtext'),
+    '#default_value' => isset($details['title']) ? $details['title'] : '',
   );
 
+  $tabtypes = array(
+    'block' => t('Block'),
+    'node' => t('Node'),
+   );
+
   if (module_exists('views')) {
     $views = quicktabs_get_views();
-    if (!$ajax) {
-      $blocks = quicktabs_get_blocks();
-
-      $form['type_options'] = array(
-      '#type' => 'value',
-      '#value' => array(
-      'block' => 'block',
-      'view' => 'view',
-      )
-      );
-    }
-    else {
-      $nodes = quicktabs_get_nodes();
-
-      $form['type_options'] = array(
-      '#type' => 'value',
-      '#value' => array(
-      'node' => 'node',
-      'view' => 'view',
-      )
-      );
-    }
-    $form['tabtype'] = array(
-    '#type' => 'radios',
-    '#options' => $form['type_options']['#value'],
-    '#title' => t('Tab Content'),
-    '#default_value' => $details['type'],
-    '#parents' => array('tabs', $delta, 'tabtype'),
-    );
     $views_keys = array_keys($views);
-    $selected_view = ($details['vid'] ? ($details['vid'] == 'default' ? $views_keys[0] : ($details['type'] != 'view' ? $views_keys[0] : $details['vid'])) : $views_keys[0]);
-    $form['vid'] = array(
+    $tabtypes['view'] = t('View');
+
+    $selected_view = (isset($details['vid']) ? $details['vid'] : (isset($views_keys[0]) ? $views_keys[0] : ''));
+    $form['view']['vid'] = array(
     '#type' => 'select',
     '#options' => $views,
     '#default_value' => $selected_view,
     '#title' => t('Select a view'),
-    '#parents' => array('tabs', $delta, 'vid'),
     '#ahah' => array(
       'path' => 'quicktabs/ahah/',
       'wrapper' => 'quicktabs-tabs',
@@ -288,62 +206,55 @@ function _quicktabs_form($details, $ajax
       'event' => 'change',
       ),
     );
-    $form['args'] = array(
+    $form['view']['args'] = array(
     '#type' => 'textfield',
     '#title' => 'arguments',
     '#size' => '10',
     '#required' => false,
-    '#default_value' => $details['args'],
+    '#default_value' => isset($details['args']) ? $details['args'] : '',
     '#description' => t('Provide a comma separated list of arguments to pass to the view.'),
-    '#parents' => array('tabs', $delta, 'args')
     );
 
-    $form['display'] = array(
+    $form['view']['display'] = array(
     '#type' => 'select',
     '#title' => 'display',
     '#options' => _quicktabs_get_views_displays($selected_view),
-    '#default_value' => $details['display'],
+    '#default_value' => isset($details['display']) ? $details['display'] : '',
     '#description' => t('Choose a display for your view.'),
-    '#parents' => array('tabs', $delta, 'display')
     );
-    $form['get_displays'] = array(
+    $form['view']['get_displays'] = array(
     '#type' => 'submit',
     '#value' => 'vdisp_'. $delta,
-    '#parents' => array('tabs', $delta, 'get_displays'),
     '#submit' => array('qt_get_displays_submit'),
     );
-  } else {
-    $form['tabtype'] = array(
-      '#type' => 'hidden',
-      '#title' => t('Type for tab @n', array('@n' => ($delta + 1))),
-      '#value' => $details['type'],
-      '#parents' => array('tabs', $delta, 'tabtype'),
-    );
   }
-  if (!$ajax) {
-    $form['bid'] = array(
+
+    $form['block']['bid'] = array(
       '#type' => 'select',
-      '#options' => $blocks,
-      '#default_value' => $details['bid'],
+      '#options' => quicktabs_get_blocks(),
+      '#default_value' => isset($details['bid']) ? $details['bid'] : '',
       '#title' => t('Select a block'),
-      '#parents' => array('tabs', $delta, 'bid'),
     );
-    $form['hide_title'] = array(
+    $form['block']['hide_title'] = array(
       '#type' => 'checkbox',
       '#title' => t('Hide the title of this block'),
-      '#default_value' => $details['hide_title'],
-      '#parents' => array('tabs', $delta, 'hide_title'),
+      '#default_value' => isset($details['hide_title']) ? $details['hide_title'] : '',
     );
-  }
-  else {
-    $form['nid'] = array(
+
+    $form['node']['nid'] = array(
       '#type' => 'select',
-      '#options' => $nodes,
-      '#default_value' => $details['nid'],
+      '#options' => quicktabs_get_nodes(),
+      '#default_value' => isset($details['nid']) ? $details['nid'] : '',
       '#title' => t('Select a node'),
-      '#parents' => array('tabs', $delta, 'nid'),
     );
-  }
+
+  $form['type'] = array(
+    '#type' => 'radios',
+    '#options' => $tabtypes,
+    '#title' => t('Tab Content'),
+    '#default_value' => isset($details['type']) ? $details['type'] : 'block',
+  );
+
   return $form;
 }
 
@@ -359,21 +270,24 @@ function theme_qt_tabs($form) {
   $headers = array(
     t('Tab Title'),
     t('Weight'),
-    module_exists('views') ? t('Tab type') : '',
+    t('Tab type'),
     t('Content'),
   );
 
   foreach (element_children($form) as $key) {
     // No need to print the field title every time.
-    unset($form[$key]['tabtext']['#title'], $form[$key]['tabtype']['#title']);
-    $form[$key]['tabweight']['#attributes']['class'] = 'qt-tabs-weight';
+    unset($form[$key]['title']['#title'], $form[$key]['type']['#title']);
+    $form[$key]['weight']['#attributes']['class'] = 'qt-tabs-weight';
     // Build the table row.
     $row = array(
       'data' => array(
-        array('data' => drupal_render($form[$key]['tabtext']), 'class' => 'qt-tab-title'),
-        array('data' => drupal_render($form[$key]['tabweight']), 'class' => 'qt-tab-weight'),
-        module_exists('views') ? array('data' => drupal_render($form[$key]['tabtype']), 'class' => 'qt-tab-type') : array('data' => '', 'class' => 'qt-tabtype-hidden'),
-        array('data' => ($form[$key]['bid'] ? drupal_render($form[$key]['bid']) . drupal_render($form[$key]['hide_title']) : drupal_render($form[$key]['nid'])) . (module_exists('views') ? drupal_render($form[$key]['vid']) . drupal_render($form[$key]['args']) . drupal_render($form[$key]['limit']) . drupal_render($form[$key]['display']) . drupal_render($form[$key]['get_displays']) : ''), 'class' => 'qt-tab-bvid'),
+        array('data' => drupal_render($form[$key]['title']), 'class' => 'qt-tab-title'),
+        array('data' => drupal_render($form[$key]['weight']), 'class' => 'qt-tab-weight'),
+        array('data' => drupal_render($form[$key]['type']), 'class' => 'qt-tab-type'),
+        // tab content (only 1 tab content (block, node or view) will be displayed. see: quicktabs_form.js)
+        array('data' => drupal_render($form[$key]['block']), 'class' => 'qt-tab-block-content'),
+        array('data' => (module_exists('views') ? drupal_render($form[$key]['view']) : ''), 'class' => 'qt-tab-view-content'),
+        array('data' => drupal_render($form[$key]['node']), 'class' => 'qt-tab-node-content'),
       ),
       'class' => 'draggable',
     );
@@ -398,7 +312,7 @@ function theme_qt_tabs($form) {
 function qt_more_tabs_submit($form, &$form_state) {
   unset($form_state['submit_handlers']);
   form_execute_handlers('submit', $form, $form_state);
-  $quicktabs = $form_state['values'];
+  $quicktabs = _quicktabs_convert_form_to_quicktabs($form_state);
   $form_state['quicktabs'] = $quicktabs;
   $form_state['rebuild'] = TRUE;
   if ($form_state['values']['tabs_more']) {
@@ -418,7 +332,7 @@ function qt_more_tabs_submit($form, &$fo
 function qt_remove_tab_submit($form, &$form_state) {
   unset($form_state['submit_handlers']);
   form_execute_handlers('submit', $form, $form_state);
-  $quicktabs = $form_state['values'];
+  $quicktabs = _quicktabs_convert_form_to_quicktabs($form_state);
   $form_state['quicktabs'] = $quicktabs;
   $form_state['rebuild'] = TRUE;
   unset($form['qt_wrapper']['tabs'][0]);
@@ -438,7 +352,7 @@ function qt_remove_tab_submit($form, &$f
 function qt_get_displays_submit($form, &$form_state) {
   unset($form_state['submit_handlers']);
   form_execute_handlers('submit', $form, $form_state);
-  $quicktabs = $form_state['values'];
+  $quicktabs = _quicktabs_convert_form_to_quicktabs($form_state);
   $form_state['quicktabs'] = $quicktabs;
   $form_state['rebuild'] = TRUE;
   return $quicktabs;
@@ -483,8 +397,8 @@ function quicktabs_form_validate($form, 
         form_set_error('', t('At least one tab should be created.'));
       }
       foreach ($form_state['values']['tabs'] as $j => $tab) {
-        if (empty($tab['tabtext'])) {
-          form_set_error('tabs]['. $j .'][tabtext', t('You must give each tab a title.'));
+        if (empty($tab['title'])) {
+          form_set_error('tabs]['. $j .'][title', t('You must give each tab a title.'));
         }
       }
     }
@@ -497,79 +411,14 @@ function quicktabs_form_validate($form, 
 function quicktabs_form_submit($form, &$form_state) {
   // We don't want it to submit when we're just adding or removing tabs.
   if ($form_state['clicked_button']['#id'] == 'edit-submit-form') {
-    $formvalues_tabs = array();
-    foreach ($form_state['values']['tabs'] as $j => $tab) {
-      $formvalues_tabs[] = array(
-      'title' => $form_state['values']['tabs'][$j]['tabtext'],
-      'type' => $form_state['values']['tabs'][$j]['tabtype'],
-      'bvid' => ($form_state['values']['tabs'][$j]['tabtype'] == 'block' ? $form_state['values']['tabs'][$j]['bid'] : $form_state['values']['tabs'][$j]['vid']),
-      'hide_title' => ($form_state['values']['tabs'][$j]['tabtype'] == 'block' ? $form_state['values']['tabs'][$j]['hide_title'] : 0),
-      'weight' => $form_state['values']['tabs'][$j]['tabweight'],
-      'args' => ($form_state['values']['tabs'][$j]['tabtype'] == 'block' ? '' : $form_state['values']['tabs'][$j]['args']),
-      'display' => ($form_state['values']['tabs'][$j]['tabtype'] == 'block' ? '' : $form_state['values']['tabs'][$j]['display']),
-      );
-    }
-    $fullcontent = array(
-      'blocktitle' => $form_state['values']['title'],
-      'blockcontent' => $formvalues_tabs,
-    );
+    $quicktabs = _quicktabs_convert_form_to_quicktabs($form_state);
 
-    if ($form_state['values']['qtid']) {
-      $qtid = $form_state['values']['qtid'];
-      quicktabs_updateblock($qtid, $fullcontent);
+    if ($quicktabs['qtid'] > 0) {
+      quicktabs_updateblock($quicktabs);
       $msg = t('Your Quick Tabs block has been updated.');
     }
     else {
-      quicktabs_createblock($fullcontent);
-      $msg = t('Your Quick Tabs block has been created and can now be enabled.');
-    }
-    drupal_set_message($msg);
-    drupal_goto('admin/build/quicktabs');
-  }
-}
-
-function quicktabs_aj_form_validate($form, &$form_state) {
-  // we don't want it to validate when we're just adding or removing tabs
-  if ($form_state['values']['op'] == t('Save')) {
-    if (empty($form_state['values']['title'])) {
-      form_set_error('title', t('You must give your Quick Tabs block a title.'));
-    }
-    else {
-      foreach ($form_state['values']['tabs'] as $j => $tab) {
-        if (empty($tab['tabtext'])) {
-          form_set_error('tabs]['. $j .'][tabtext', t('You must give each tab a title.'));
-        }
-      }
-    }
-  }
-}
-
-function quicktabs_aj_form_submit($form, $form_state) {
-  // we don't want it to submit when we're just adding or removing tabs
-  if ($form_state['values']['op'] == t('Save')) {
-    $formvalues_tabs = array();
-    foreach ($form_state['values']['tabs'] as $j => $tab) {
-      $formvalues_tabs[] = array(
-      'title' => $form_state['values']['tabs'][$j]['tabtext'],
-      'type' => $form_state['values']['tabs'][$j]['tabtype'],
-      'bnid' => ($form_state['values']['tabs'][$j]['tabtype'] == 'node' ? $form_state['values']['tabs'][$j]['nid'] : $form_state['values']['tabs'][$j]['vid']),
-      'weight' => $form_state['values']['tabs'][$j]['tabweight'],
-      'args' => ($form_state['values']['tabs'][$j]['type'] == 'node' ? '' : $form_state['values']['tabs'][$j]['args']),
-      'display' => ($form_state['values']['tabs'][$j]['type'] == 'node' ? '' : $form_state['values']['tabs'][$j]['display']),
-      );
-    }
-    $fullcontent = array(
-      'blocktitle' => $form_state['values']['title'],
-      'blockcontent' => $formvalues_tabs,
-    );
-
-    if ($form_state['values']['qtid']) {
-      $qtid = $form_state['values']['qtid'];
-      quicktabs_updateblock($qtid, $fullcontent);
-      $msg = t('Your Quick Tabs block has been updated.');
-    }
-    else {
-      quicktabs_createblock($fullcontent, TRUE);
+      quicktabs_createblock($quicktabs);
       $msg = t('Your Quick Tabs block has been created and can now be enabled.');
     }
     drupal_set_message($msg);
@@ -580,50 +429,28 @@ function quicktabs_aj_form_submit($form,
 /**
  * Insert db record.
  */
-function quicktabs_createblock($fullcontent, $ajax = FALSE) {
-  $qtid = db_last_insert_id('quicktabs', 'qtid');
-  $title = $fullcontent['blocktitle'];
-  $tabs = serialize($fullcontent['blockcontent']);
-  db_query("INSERT INTO {quicktabs} (qtid, ajax, title, tabs) VALUES(%d, %d, '%s', '%s')", $qtid, $ajax, $title, $tabs);
+function quicktabs_createblock($quicktabs) {
+  $quicktabs['tabs'] = serialize($quicktabs['tabs']);
+  db_query("INSERT INTO {quicktabs} (ajax, title, tabs) VALUES(%d, '%s', '%s')", $quicktabs['ajax'], $quicktabs['title'], $quicktabs['tabs']);
 }
 
 /**
  * Update db record.
  */
-function quicktabs_updateblock($qtid, $fullcontent) {
-  $title = $fullcontent['blocktitle'];
-  $tabs = serialize($fullcontent['blockcontent']);
-  db_query("UPDATE {quicktabs} SET title='%s', tabs='%s' WHERE qtid=%d", $title, $tabs, $qtid);
+function quicktabs_updateblock($quicktabs) {
+  $quicktabs['tabs'] = serialize($quicktabs['tabs']);
+  db_query("UPDATE {quicktabs} SET ajax = %d, title = '%s', tabs = '%s' WHERE qtid = %d", $quicktabs['ajax'], $quicktabs['title'], $quicktabs['tabs'], $quicktabs['qtid']);
 }
 
 /**
  * Edit Quick Tabs block.
  */
 function quicktabs_block_edit(array $quicktabs) {
-    foreach ($quicktabs['tabs'] as $key => $tab) {
-      $formtabs[] = array(
-        'tabweight' => $tab['weight'],
-        'tabtext' => $tab['title'],
-        'tabtype' => $tab['type'],
-        'bid' => ($quicktabs['ajax'] == 0 ? ($tab['type'] == 'block' ? $tab['bvid'] : NULL) : NULL),
-        'hide_title' => ($quicktabs['ajax'] == 0 ? ($tab['type'] == 'block' ? $tab['hide_title'] : NULL) : NULL),
-        'nid' => ($quicktabs['ajax'] == 1 ? ($tab['type'] == 'node' ? $tab['bnid'] : NULL) : NULL),
-        'vid' => $tab['type'] == 'view' ? ($quicktabs['ajax'] == 0 ? $tab['bvid'] : $tab['bnid']) : NULL,
-        'args' => $tab['type'] == 'view' ? $tab['args'] : NULL,
-        'display' => $tab['type'] == 'view' ? $tab['display'] : NULL,
-      );
-    }
-
-    $quicktabs['tabs'] = $formtabs;
     $quicktabs['formtype'] = 'edit';
 
     drupal_add_js(drupal_get_path('module', 'quicktabs') .'/js/quicktabs_form.js');
     drupal_add_css(drupal_get_path('module', 'quicktabs') .'/quicktabs.css');
-    if ($quicktabs['ajax'] == 0) {
       $output = drupal_get_form('quicktabs_form', $quicktabs);
-    } else {
-      $output = drupal_get_form('quicktabs_aj_form', $quicktabs);
-    }
     return $output;
 }
 
@@ -833,4 +660,32 @@ function quicktabs_get_nodes() {
     $nodes[$key] = $row->title;
   }
   return $nodes;
-}
\ No newline at end of file
+}
+
+/**
+ * Helper function to convert the data on admin form into quicktabs presentation.
+ */
+function _quicktabs_convert_form_to_quicktabs($form_state) {
+  $formvalues_tabs = array();
+  if (isset($form_state['values']['tabs'])) {
+    foreach ($form_state['values']['tabs'] as $j => $tab) {
+      $formvalues_tabs[$j] = $tab[$tab['type']];
+      $formvalues_tabs[$j]['title'] = $tab['title'];
+      $formvalues_tabs[$j]['weight'] = $tab['weight'];
+      $formvalues_tabs[$j]['type'] = $tab['type'];
+    }
+  }
+  $quicktabs = array(
+    'title' => $form_state['values']['title'],
+    'ajax' => $form_state['values']['ajax'],
+    'tabs' => $formvalues_tabs,
+  );
+
+  if (isset($form_state['values']['qtid'])) {
+    $quicktabs['qtid'] = $form_state['values']['qtid'];
+  }
+  else {
+    $quicktabs['qtid'] = 0;
+  }
+  return $quicktabs;
+}
cvs diff: Diffing js
Index: js/quicktabs.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/quicktabs/js/quicktabs.js,v
retrieving revision 1.3.2.1
diff -u -p -r1.3.2.1 quicktabs.js
--- js/quicktabs.js	26 Nov 2008 06:12:25 -0000	1.3.2.1
+++ js/quicktabs.js	3 Dec 2008 13:24:47 -0000
@@ -21,12 +21,14 @@ var quicktabsClick = function() {
   if ( $(this).hasClass('qt_ajax_tabs') ) {
     var viewDetails = this.id.split('-');
     var $container = $('div#quicktabs_ajax_container_' + viewDetails[1]);
-    if (viewDetails[0] == 'node') {
+    switch (viewDetails[0]) {
+    case 'node':
       $.get(Drupal.settings.basePath + 'quicktabs/ajax/node/' + viewDetails[3], null, function(data){
         var result = Drupal.parseJson(data);
         $container.html(result['data']);
       });
-    } else {
+      break;
+    case 'view':
       var target;
       target = $('div#quicktabs_ajax_container_' + viewDetails[1] + ' > div');
       var ajax_path = Drupal.settings.views.ajax_path;
@@ -64,6 +66,13 @@ var quicktabsClick = function() {
       //  var result = Drupal.parseJson(data);
       //  $container.html(result['data']);
       //});
+      break;
+    case 'block':
+      $.get(Drupal.settings.basePath + 'quicktabs/ajax/block/' + viewDetails[3] + '/' + viewDetails[4], null, function(data){
+        var result = Drupal.parseJson(data);
+        $container.html(result['data']);
+      });
+      break;
     }
   } else {
     $(this).parents('.quicktabs_wrapper').find('div.quicktabs').hide();
Index: js/quicktabs_form.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/quicktabs/js/quicktabs_form.js,v
retrieving revision 1.5.2.1
diff -u -p -r1.5.2.1 quicktabs_form.js
--- js/quicktabs_form.js	26 Nov 2008 06:12:25 -0000	1.5.2.1
+++ js/quicktabs_form.js	3 Dec 2008 12:09:03 -0000
@@ -1,48 +1,38 @@
 Drupal.quicktabsShowHide = function() {
-  if (this.value == 'block' || this.value == 'node') {
-    $(this).parents('tr')
-    .find('div.form-item :input[name*="vid"]').parent().hide();
-    $(this).parents('tr')
-    .find('div.form-item :input[name*="args"]').parent().hide();
-    $(this).parents('tr')
-    .find('div.form-item :input[name*="display"]').parent().hide();  
-    $(this).parents('tr')
-    .find('div.form-item :input[name*="bid"]').parent().show();    
-    $(this).parents('tr')
-    .find('div.form-item :input[name*="hide_title"]').parent().show();
-    $(this).parents('tr')
-    .find('div.form-item :input[name*="nid"]').parent().show(); 
- } else {
-    $(this).parents('tr')
-    .find('div.form-item :input[name*="nid"]').parent().hide(); 
-    $(this).parents('tr')
-    .find('div.form-item :input[name*="bid"]').parent().hide();
-    $(this).parents('tr')
-    .find('div.form-item :input[name*="hide_title"]').parent().hide(); 
-    $(this).parents('tr')
-    .find('div.form-item :input[name*="vid"]').parent().show();
-    $(this).parents('tr')
-    .find('div.form-item :input[name*="args"]').parent().show(); 
-    $(this).parents('tr')
-    .find('div.form-item :input[name*="display"]').parent().show();  
+  switch (this.value) {
+    case 'block':
+      $(this).parents('tr')
+      .find('td.qt-tab-block-content').show();
+      $(this).parents('tr')
+      .find('td.qt-tab-node-content').hide();
+      $(this).parents('tr')
+      .find('td.qt-tab-view-content').hide();
+      break;
 
- }
+    case 'node':
+      $(this).parents('tr')
+      .find('td.qt-tab-block-content').hide();
+      $(this).parents('tr')
+      .find('td.qt-tab-node-content').show();
+      $(this).parents('tr')
+      .find('td.qt-tab-view-content').hide();
+      break;
+
+    case 'view':
+      $(this).parents('tr')
+      .find('td.qt-tab-block-content').hide();
+      $(this).parents('tr')
+      .find('td.qt-tab-node-content').hide();
+      $(this).parents('tr')
+      .find('td.qt-tab-view-content').show();
+      break;
+  }
 };
 
 Drupal.behaviors.quicktabsform = function(context) {
-  $('#quicktabs-form tr, #quicktabs-aj-form tr').not('.quicktabs-form-processed').addClass('quicktabs-form-processed').each(function(){
+  $('#quicktabs-form tr').not('.quicktabs-form-processed').addClass('quicktabs-form-processed').each(function(){
     var currentRow = $(this);
-    $(':input[name*="tabtype"]:checked', this).each(function(){
-      if(this.value == 'block' || this.value == 'node') {
-        currentRow.find('div.form-item :input[name*="vid"]').parent().hide();
-        currentRow.find('div.form-item :input[name*="args"]').parent().hide();
-        currentRow.find('div.form-item :input[name*="display"]').parent().hide(); 
-      } else {
-        currentRow.find('div.form-item :input[name*="bid"]').parent().hide();
-        currentRow.find('div.form-item :input[name*="hide_title"]').parent().hide();
-        currentRow.find('div.form-item :input[name*="nid"]').parent().hide();
-      }
-    });
-    currentRow.find('div.form-item :input[name*="tabtype"]').bind('click', Drupal.quicktabsShowHide);
+    currentRow.find('div.form-item :input[name*="type"]').bind('click', Drupal.quicktabsShowHide);
+    $(':input[name*="type"]:checked', this).trigger('click');
   })
 };
\ No newline at end of file
