Index: form_builder.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/form_builder.info,v
retrieving revision 1.2
diff -u -p -r1.2 form_builder.info
--- form_builder.info	14 May 2009 05:21:17 -0000	1.2
+++ form_builder.info	5 Oct 2009 07:50:13 -0000
@@ -1,6 +1,16 @@
 ; $Id: form_builder.info,v 1.2 2009/05/14 05:21:17 quicksketch Exp $
 name = Form builder
 description = Form building framework.
-dependencies[] = jquery_ui
 dependencies[] = options_element
-core = 6.x
+core = 7.x
+files[] = form_builder.module
+files[] = includes/form_builder.cache.inc
+files[] = includes/form_builder.admin.inc
+files[] = includes/form_builder.properties.inc
+files[] = includes/form_builder.api.inc
+files[] = modules/node.inc
+files[] = modules/menu.inc
+files[] = modules/path.inc
+files[] = modules/poll.inc
+files[] = modules/taxonomy.inc
+files[] = modules/upload.inc
Index: form_builder.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/form_builder.install,v
retrieving revision 1.1
diff -u -p -r1.1 form_builder.install
--- form_builder.install	3 Dec 2008 19:32:22 -0000	1.1
+++ form_builder.install	5 Oct 2009 07:50:13 -0000
@@ -6,6 +6,10 @@
  */
 function form_builder_install() {
   drupal_install_schema('form_builder');
+  db_query('DELETE FROM {registry_file}');
+  db_query('DELETE FROM {registry}');
+  db_query('DELETE FROM {cache_registry}');
+  registry_rebuild();
 }
 
 /**
@@ -43,7 +47,7 @@ function form_builder_requirements($phas
 function form_builder_schema() {
   $schema = array();
 
-  $schema['form_builder_cache'] = array(
+  $schema['cache_form_builder'] = array(
     'fields' => array(
       'sid' => array(
         'type' => 'varchar',
@@ -81,3 +85,12 @@ function form_builder_schema() {
 
   return $schema;
 }
+
+/**
+ * Rename the cache table so that it's coherent.
+ */
+function form_builder_update_1() {
+  $ret = array();
+  db_rename_table($ret, 'form_builder_cache', 'cache_form_builder');
+  return $ret;
+}
Index: form_builder.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/form_builder.js,v
retrieving revision 1.18
diff -u -p -r1.18 form_builder.js
--- form_builder.js	29 Jun 2009 17:02:33 -0000	1.18
+++ form_builder.js	5 Oct 2009 07:50:13 -0000
@@ -1,11 +1,14 @@
 // $Id: form_builder.js,v 1.18 2009/06/29 17:02:33 quicksketch Exp $
 
+(function($) {
+
 /**
  * @file form_builder.js
  * Provide enhancements to the form building user interface.
  */
 
-Drupal.behaviors.formBuilderElement = function(context) {
+Drupal.behaviors.formBuilderElement = {
+  attach: function(context) {
   var $wrappers = $('div.form-builder-wrapper', context);
   var $elements = $('div.form-builder-element', context);
 
@@ -42,12 +45,14 @@ Drupal.behaviors.formBuilderElement = fu
 
   // Disable field functionality on click.
   $elements.find('input, textarea').bind('mousedown', Drupal.formBuilder.disableField);
+  }
 };
 
 /**
  * Behavior to disable preview fields and instead open up the configuration.
  */
-Drupal.behaviors.formBuilderFields = function(context) {
+Drupal.behaviors.formBuilderFields = {
+  attach: function(context) {
   // Bind a function to all elements to update the preview on change.
   var $configureForm = $('#form-builder-field-configure');
 
@@ -60,12 +65,14 @@ Drupal.behaviors.formBuilderFields = fun
     .filter(':not(.form-builder-field-keyup)')
     .addClass('form-builder-field-keyup')
     .bind('keyup', Drupal.formBuilder.elementPendingChange);
+  }
 }
 
 /**
  * Behavior for the entire form builder. Add drag and drop to elements.
  */
-Drupal.behaviors.formBuilder = function(context) {
+Drupal.behaviors.formBuilder = {
+  attach: function(context) {
   $('#form-builder', context).sortable({
     items: 'div.form-builder-wrapper',
     handle: 'div.form-builder-title-bar, div.form-builder-element',
@@ -87,19 +94,21 @@ Drupal.behaviors.formBuilder = function(
   function createHelper(e, $el) {
     return $el.clone().get(0);
   }
+  }
 };
 
 /**
  * Behavior that renders fieldsets as tabs within the field configuration form.
  */
-Drupal.behaviors.formBuilderTabs = function(context) {
+Drupal.behaviors.formBuilderTabs = {
+  attach: function(context) {
   var $fieldsets = $('fieldset.form-builder-group:not(.form-builer-tabs-processed)', context);
   var $close = $('<a class="close" href="#">' + Drupal.t('Close') + '</a>');
   var $tabs;
   var tabs = '';
 
   // Convert fieldsets to tabs.
-  tabs = '<ul class="form-builder-tabs tabs clear-block">';
+  tabs = '<ul class="form-builder-tabs tabs clearfix">';
   $fieldsets.children('legend').each(function() {
     tabs += '<li>' + this.innerHTML + '</li>';
     $(this).remove();
@@ -129,33 +138,39 @@ Drupal.behaviors.formBuilderTabs = funct
 
   // Add guard class.
   $fieldsets.addClass('form-builer-tabs-processed');
+  }
 };
 
 /**
  * Submit the delete form via AJAX or close the form with the cancel link.
  */
-Drupal.behaviors.formBuilderDeleteConfirmation = function(context) {
+Drupal.behaviors.formBuilderDeleteConfirmation = {
+  attach: function(context) {
   $confirmForm = $('form.confirmation');
   if ($confirmForm.size()) {
     $confirmForm.submit(Drupal.formBuilder.deleteField);
     $confirmForm.find('a').click(Drupal.formBuilder.clickCancel);
   }
+  }
 }
 
 /**
  * Keeps record of if a mouse button is pressed.
  */
-Drupal.behaviors.formBuilderMousePress = function(context) {
+Drupal.behaviors.formBuilderMousePress = {
+  attach: function(context) {
   if (context == document) {
     $('body').mousedown(function() { Drupal.formBuilder.mousePressed = 1; });
     $('body').mouseup(function() { Drupal.formBuilder.mousePressed = 0; });
   }
+  }
 }
 
 /**
  * Scrolls the add new field block with the window.
  */
-Drupal.behaviors.formBuilderBlockScroll = function(context) {
+Drupal.behaviors.formBuilderBlockScroll = {
+  attach: function(context) {
   var $list = $('ul.form-builder-fields', context);
 
   if ($list.size()) {
@@ -191,13 +206,15 @@ Drupal.behaviors.formBuilderBlockScroll 
 
     $(window).scroll(scrollTimeout);
   }
+  }
 }
 
 /**
  * Behavior for the Add a field block.
  * @param {Object} context
  */
-Drupal.behaviors.formBuilderNewField = function(context) {
+Drupal.behaviors.formBuilderNewField = {
+  attach: function(context) {
   var $list = $('ul.form-builder-fields', context);
 
   if ($list.size()) {
@@ -208,12 +225,13 @@ Drupal.behaviors.formBuilderNewField = f
       scroll: true,
       scrollSensitivity: 50,
       containment: 'body',
-      connectToSortable: ['#form-builder'],
+      connectToSortable: '#form-builder',
       start: Drupal.formBuilder.startPaletteDrag,
       stop: Drupal.formBuilder.stopPaletteDrag,
       change: Drupal.formBuilder.checkFieldsets
     });
   }
+  }
 }
 
 Drupal.formBuilder = {
@@ -257,7 +275,7 @@ Drupal.formBuilder.removeHover = functio
 
 /**
  * Click handler for fields.
- * 
+ *
  * Note this is applied to both the entire field and to the labels within the
  * field, as they have special browser behavior that needs to be overridden.
  */
@@ -308,7 +326,7 @@ Drupal.formBuilder.editField = function(
       type: 'GET',
       dataType: 'json',
       data: 'js=1',
-      success: Drupal.formBuilder.displayForm,
+      success: Drupal.formBuilder.displayForm
     });
   };
 
@@ -373,7 +391,7 @@ Drupal.formBuilder.elementChange = funct
   if (!Drupal.formBuilder.updatingElement) {
     $(this).parents('form:first').ajaxSubmit({
       success: Drupal.formBuilder.updateElement,
-      dataType: 'json',
+      dataType: 'json'
     });
   }
 
@@ -536,7 +554,7 @@ Drupal.formBuilder.stopDrag = function(e
       type: 'GET',
       dataType: 'json',
       data: 'js=1&element_id=' + name,
-      success: Drupal.formBuilder.addElement,
+      success: Drupal.formBuilder.addElement
     });
 
     $(element).replaceWith($ajaxPlaceholder);
@@ -729,3 +747,5 @@ Drupal.formBuilder.fixTableDragTabs = fu
     }
   }
 }
+
+})(jQuery);
\ No newline at end of file
Index: form_builder.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/form_builder.module,v
retrieving revision 1.13
diff -u -p -r1.13 form_builder.module
--- form_builder.module	20 Jun 2009 06:18:15 -0000	1.13
+++ form_builder.module	5 Oct 2009 08:55:19 -0000
@@ -20,7 +20,6 @@ function form_builder_menu() {
     'page callback' => 'form_builder_add_page',
     'access callback' => 'form_builder_menu_field_access',
     'access arguments' => array('add', 4, 5, 6),
-    'file' => 'includes/form_builder.admin.inc',
     'type' => MENU_CALLBACK,
   );
 
@@ -30,7 +29,6 @@ function form_builder_menu() {
     'page callback' => 'form_builder_configure_page',
     'access callback' => 'form_builder_menu_field_access',
     'access arguments' => array('configure', 4, 5, 6),
-    'file' => 'includes/form_builder.admin.inc',
     'type' => MENU_CALLBACK,
   );
 
@@ -40,7 +38,6 @@ function form_builder_menu() {
     'page callback' => 'form_builder_remove_page',
     'access callback' => 'form_builder_menu_field_access',
     'access arguments' => array('remove', 4, 5, 6),
-    'file' => 'includes/form_builder.admin.inc',
     'type' => MENU_CALLBACK,
   );
 
@@ -50,7 +47,6 @@ function form_builder_menu() {
     'page callback' => 'form_builder_field_json',
     'access callback' => 'form_builder_menu_field_access',
     'access arguments' => array('view', 4, 5, 6),
-    'file' => 'includes/form_builder.admin.inc',
     'type' => MENU_CALLBACK,
   );
 
@@ -132,6 +128,12 @@ function form_builder_block($op = 'list'
  * Access callback for field configuration, viewing, addition, and deletion.
  */
 function form_builder_menu_field_access($op, $form_type, $form_id, $element_id) {
+  if (empty($form_type) || empty($form_id) || empty($element_id)) {
+    // If called by menu API to check access, we should not try and check
+    // with fake data, which ends up in PHP errors. 
+    return;
+  }
+  
   module_load_include('inc', 'form_builder', 'includes/form_builder.api');
   module_load_include('inc', 'form_builder', 'includes/form_builder.cache');
   $element = form_builder_cache_field_load($form_type, $form_id, $element_id);
@@ -355,4 +357,24 @@ function form_validate_url(&$element, &$
   if (valid_url($element['#value'], isset($element['#absolute_url']) ? $element['#absolute_url'] : TRUE)) {
     form_error($element, t('The %title field value must be a valid URL.', array('%title' => $element['#title'])));
   }
-}
\ No newline at end of file
+}
+
+/**
+ * Implementation of hook_registry_files_alter().
+ *
+ * Reassign formbuilder include files to their respective modules.
+ * Required to make module_invoke() type of calls working.
+ */
+function form_builder_registry_files_alter(&$files, $module_cache) {
+  $module_files = file_scan_directory(drupal_get_path('module', 'form_builder') . '/modules', '!^.*\.inc$!');
+  foreach ($module_files as $path => $file) {
+    $files[$file->uri]['module'] = $file->name;
+  }
+}
+
+/**
+ * Implement hook_flush_caches().
+ */
+function form_builder_flush_caches() {
+  return array('cache_form_builder');
+}
Index: examples/form_builder_examples.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/examples/form_builder_examples.info,v
retrieving revision 1.1
diff -u -p -r1.1 form_builder_examples.info
--- examples/form_builder_examples.info	3 Dec 2008 19:32:23 -0000	1.1
+++ examples/form_builder_examples.info	5 Oct 2009 07:50:13 -0000
@@ -1,5 +1,6 @@
 ; $Id: form_builder_examples.info,v 1.1 2008/12/03 19:32:23 quicksketch Exp $
 name = Form builder examples
 description = Form builder support for CCK, Webform, and Profile modules.
-core = 6.x
-dependencies[] = form_builder
\ No newline at end of file
+core = 7.x
+dependencies[] = form_builder
+files[] = form_builder_examples.module
\ No newline at end of file
Index: examples/form_builder_examples.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/examples/form_builder_examples.module,v
retrieving revision 1.10
diff -u -p -r1.10 form_builder_examples.module
--- examples/form_builder_examples.module	15 Jan 2009 19:04:34 -0000	1.10
+++ examples/form_builder_examples.module	5 Oct 2009 08:54:49 -0000
@@ -16,8 +16,6 @@ function form_builder_examples_menu() {
     'title' => 'Form builder example',
     'page callback' => 'form_builder_interface',
     'page arguments' => array('example', 'sample'),
-    'file' => 'includes/form_builder.admin.inc',
-    'file path' => drupal_get_path('module', 'form_builder'),
     'access arguments' => array('access content'),
     'type' => MENU_NORMAL_ITEM,
   );
@@ -26,8 +24,6 @@ function form_builder_examples_menu() {
     'title' => 'Edit',
     'page callback' => 'form_builder_interface',
     'page arguments' => array('example', 'sample'),
-    'file' => 'includes/form_builder.admin.inc',
-    'file path' => drupal_get_path('module', 'form_builder'),
     'access arguments' => array('access content'),
     'type' => MENU_DEFAULT_LOCAL_TASK,
   );
Index: includes/form_builder.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/includes/form_builder.admin.inc,v
retrieving revision 1.14
diff -u -p -r1.14 form_builder.admin.inc
--- includes/form_builder.admin.inc	20 Jun 2009 06:18:15 -0000	1.14
+++ includes/form_builder.admin.inc	5 Oct 2009 08:55:03 -0000
@@ -28,9 +28,9 @@ function form_builder_interface($form_ty
     form_builder_cache_save($form_type, $form_id, $form);
   }
 
-  $output = '';
-  $output .= drupal_get_form('form_builder_preview', $form, $form_type, $form_id);
-  $output .= drupal_get_form('form_builder_positions', $form, $form_type, $form_id);
+  $output = array();
+  $output[] = drupal_get_form('form_builder_preview', $form, $form_type, $form_id);
+  $output[] = drupal_get_form('form_builder_positions', $form, $form_type, $form_id);
 
   return $output;
 }
@@ -105,11 +105,11 @@ function form_builder_configure_page($fo
         'formType' => $form_type,
         'formId' => $form_id,
         'elementId' => $element_id,
-        'html' => $output,
+        'html' => drupal_render($output),
         'errors' => form_get_errors(),
         'messages' => theme('status_messages'),
       );
-  
+
       drupal_json($data);
       exit();
     }
@@ -130,7 +130,7 @@ function form_builder_remove_page($form_
       'formType' => $form_type,
       'formId' => $form_id,
       'elementId' => $element_id,
-      'html' => $output,
+      'html' => drupal_render($output),
       'messages' => theme('status_messages'),
     );
 
@@ -156,6 +156,11 @@ function form_builder_preview(&$form_sta
 
   // Add a pre_render to the entire form itself.
   $form['#pre_render'][] = 'form_builder_pre_render_form';
+
+  // Save the original form theming so that we can call it later.
+  if (!empty($form['#theme'])) {
+    $form['#theme-original'] = $form['#theme'];
+  }
   $form['#theme'] = 'form_builder_preview';
 
   return $form;
@@ -255,12 +260,18 @@ function form_builder_positions_submit(&
 function theme_form_builder_preview($form) {
   global $theme;
 
-  jquery_ui_add(array('ui.draggable', 'ui.droppable', 'ui.sortable'));
-  drupal_add_js('misc/jquery.form.js');
+  // Add required jQuery UI elements.
+  drupal_add_js('misc/ui/ui.core.js', array('weight' => JS_LIBRARY + 5));
+  drupal_add_js('misc/ui/ui.draggable.js', array('weight' => JS_LIBRARY + 6));
+  drupal_add_js('misc/ui/ui.droppable.js', array('weight' => JS_LIBRARY + 7));
+  drupal_add_js('misc/ui/ui.sortable.js', array('weight' => JS_LIBRARY + 8));
+
+  drupal_add_js('misc/jquery.form.js', array('weight' => JS_LIBRARY));
   drupal_add_js(drupal_get_path('module', 'form_builder') .'/form_builder.js');
   // TODO: This JS file should be loaded dynamically as needed.
   drupal_add_js(drupal_get_path('module', 'options_element') .'/options_element.js');
   drupal_add_js('misc/tabledrag.js');
+  drupal_add_js('misc/form.js', array('weight' => JS_LIBRARY + 1));
   drupal_add_js('misc/collapse.js');
   drupal_add_js(array('formBuilder' => array('emptyFieldset' => theme('form_builder_empty_fieldset'))), 'setting');
   drupal_add_css(drupal_get_path('module', 'form_builder') .'/form_builder.css');
@@ -268,7 +279,7 @@ function theme_form_builder_preview($for
 
   // Check if the Form Builder block is enabled.
   // Otherwise make our own columns.
-  $block_enabled = db_result(db_query("SELECT status FROM {blocks} WHERE module = 'form_builder' AND theme = '%s'", $theme));
+  $block_enabled = db_result(db_query("SELECT status FROM {block} WHERE module = 'form_builder' AND theme = '%s'", $theme));
 
   if ($block_enabled && ($theme == 'garland' || $theme == 'minnelli')) {
     drupal_add_css(drupal_get_path('module', 'form_builder') .'/form_builder.garland.css', 'theme');
@@ -287,6 +298,11 @@ function theme_form_builder_preview($for
   }
   $output .= '<div id="form-builder">';
   $output .= '<h3>' . t('Form preview') . '</h3>';
+
+  // Reset the original form theming, but allow form_builder implementations to
+  // alter the form output.
+  $form['#theme'] = isset($form['#theme-original']) ? $form['#theme-original'] : NULL;
+
   $output .= drupal_render($form);
   $output .= '</div>';
   $output .= '</div>';
@@ -381,7 +397,7 @@ function theme_form_builder_field_palett
   $output .= '<div id="form-builder-field-palette">';
   foreach ($lists as $group => $list) {
     unset($list['#weight']);
-    $output .= theme('item_list', $list, (count($lists) > 1) ? $groups[$group]['title'] : t('Add a field'), 'ul', array('class' => 'form-builder-fields clear-block'));
+    $output .= theme('item_list', $list, (count($lists) > 1) ? $groups[$group]['title'] : t('Add a field'), 'ul', array('class' => 'form-builder-fields clearfix'));
   }
   $output .= '</div>';
 
@@ -452,6 +468,7 @@ function form_builder_preview_prepare(&$
       $form[$key]['#form_builder']['form_type'] = $form_type;
       $form[$key]['#form_builder']['form_id'] = $form_id;
       $form[$key]['#form_builder']['parent_id'] = $parent_id;
+
       $parent_id = $form[$key]['#form_builder']['element_id'];
     }
 
@@ -484,10 +501,10 @@ function form_builder_field_configure($f
     }
   }
 
-  $form['#form_type'] = $form_type;
-  $form['#form_id'] = $form_id;
-  $form['#element_id'] = $element_id;
-  $form['#element'] = $element;
+  $form['#_edit_form_type'] = $form_type;
+  $form['#_edit_form_id'] = $form_id;
+  $form['#_edit_element_id'] = $element_id;
+  $form['#_edit_element'] = $element;
 
   $form['form_builder_submit'] = array(
     '#type' => 'submit',
@@ -530,20 +547,20 @@ function theme_form_builder_field_config
           '#attributes' => array('class' => 'form-builder-group'),
         );
       }
-  
+
       $form[$group .'_property_group'][$key] = $form[$key];
       unset($form[$key]);
     }
   }
 
-  return drupal_render($form);
+  return drupal_render_children($form);
 }
 
 function form_builder_field_configure_submit(&$form, &$form_state) {
-  $form_type = $form['#form_type'];
-  $form_id = $form['#form_id'];
-  $element_id = $form['#element_id'];
-  $element = $form['#element'];
+  $form_type = $form['#_edit_form_type'];
+  $form_id = $form['#_edit_form_id'];
+  $element_id = $form['#_edit_element_id'];
+  $element = $form['#_edit_element'];
 
   // Allow each element to do any necessary submission handling.
   foreach (form_builder_get_element_properties($form_type, $element['#form_builder']['element_type']) as $property => $property_settings) {
@@ -558,7 +575,7 @@ function form_builder_field_configure_su
 
   // Allow the element to be updated in a hard-coded fashion by altering the
   // $form['#element'] item. Using this approach skips the property check.
-  $element = $form['#element'];
+  $element = $form['#_edit_element'];
 
   // Update the field according to the settings in $form_state['values'].
   $saveable = form_builder_get_saveable_properties($form_type, $element);
@@ -599,9 +616,9 @@ function form_builder_field_remove($form
   $element = form_builder_cache_field_load($form_type, $form_id, $element_id);
 
   $form = array();
-  $form['#form_type'] = $form_type;
-  $form['#form_id'] = $form_id;
-  $form['#element_id'] = $element_id;
+  $form['#_edit_form_type'] = $form_type;
+  $form['#_edit_form_id'] = $form_id;
+  $form['#_edit_element_id'] = $element_id;
 
   $quesion = t('Remove the field %title?', array('%title' => $element['#title']));
   $path = isset($_GET['destination']) ? $_GET['destination'] : NULL;
@@ -612,9 +629,9 @@ function form_builder_field_remove($form
 }
 
 function form_builder_field_remove_submit(&$form, &$form_state) {
-  $form_type = $form['#form_type'];
-  $form_id = $form['#form_id'];
-  $element_id = $form['#element_id'];
+  $form_type = $form['#_edit_form_type'];
+  $form_id = $form['#_edit_form_id'];
+  $element_id = $form['#_edit_element_id'];
 
   // Update the form builder cache.
   form_builder_cache_field_delete($form_type, $form_id, $element_id);
@@ -636,14 +653,19 @@ function form_builder_field_render($form
 
   // Load the current state of the form and prepare it for rendering.
   $form = form_builder_cache_load($form_type, $form_id);
-  $form_state = array('submitted' => FALSE);
-  $form = drupal_retrieve_form('form_builder_preview', $form_state, $form, $form_type, $form_id);
+  if (!$form) {
+    $form = form_builder_load_form($form_type, $form_id);
+    form_builder_cache_save($form_type, $form_id, $form);
+  }
+  $form_state = array('submitted' => FALSE, 'args' => array($form, $form_type, $form_id));
+  $form = drupal_retrieve_form('form_builder_preview', $form_state);
   drupal_prepare_form('form_builder_preview', $form, $form_state);
   $form['#post'] = array();
   $form = form_builder('form_builder_preview', $form, $form_state);
 
   // Get only the element wanted and render it.
   $element = form_builder_get_element($form, $element_id);
+
   $content = drupal_render($element);
 
   $prefix = isset($element['#prefix']) ? $element['#prefix'] : '';
Index: includes/form_builder.cache.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/includes/form_builder.cache.inc,v
retrieving revision 1.3
diff -u -p -r1.3 form_builder.cache.inc
--- includes/form_builder.cache.inc	14 May 2009 05:07:03 -0000	1.3
+++ includes/form_builder.cache.inc	5 Oct 2009 07:50:13 -0000
@@ -23,7 +23,7 @@ function form_builder_cache_load($form_t
   }
 
   if (!isset($data) && isset($form_type) && isset($form_id)) {
-    $data = db_result(db_query("SELECT data FROM {form_builder_cache} WHERE type = '%s' AND form_id = '%s' AND sid = '%s'", $form_type, $form_id, $sid));
+    $data = db_result(db_query("SELECT data FROM {cache_form_builder} WHERE type = '%s' AND form_id = '%s' AND sid = '%s'", $form_type, $form_id, $sid));
 
     if ($data) {
       $data = unserialize($data);
@@ -40,10 +40,10 @@ function form_builder_cache_save($form_t
   $sid = isset($sid) ? $sid : session_id();
 
   if (form_builder_cache_load($form_type, $form_id, $sid)) {
-    $result = db_query("UPDATE {form_builder_cache} SET data = '%s', updated = %d WHERE type = '%s' AND form_id = '%s' AND sid = '%s'", serialize($form), time(), $form_type, $form_id, $sid);
+    $result = db_query("UPDATE {cache_form_builder} SET data = '%s', updated = %d WHERE type = '%s' AND form_id = '%s' AND sid = '%s'", serialize($form), time(), $form_type, $form_id, $sid);
   }
   else {
-    $result = db_query("INSERT INTO {form_builder_cache} (sid, type, form_id, updated, data) VALUES ('%s', '%s', '%s', %d, '%s')", $sid, $form_type, $form_id, time(), serialize($form));
+    $result = db_query("INSERT INTO {cache_form_builder} (sid, type, form_id, updated, data) VALUES ('%s', '%s', '%s', %d, '%s')", $sid, $form_type, $form_id, time(), serialize($form));
   }
 
   // Ensure caches are fresh for any retrievals made this request.
@@ -55,7 +55,7 @@ function form_builder_cache_save($form_t
 function form_builder_cache_delete($form_type, $form_id, $sid = NULL) {
   $sid = isset($sid) ? $sid : session_id();
 
-  return db_query("DELETE FROM {form_builder_cache} WHERE type = '%s' AND form_id = '%s' AND sid = '%s'", $form_type, $form_id, $sid);
+  return db_query("DELETE FROM {cache_form_builder} WHERE type = '%s' AND form_id = '%s' AND sid = '%s'", $form_type, $form_id, $sid);
 }
 
 /**
@@ -67,7 +67,7 @@ function form_builder_cache_delete($form
 function form_builder_cache_purge($expire_threshold = NULL) {
   $expire_threshold = isset($expire_threshold) ? $expire_threshold : ini_get('session.cache_expire');
 
-  return db_query("DELETE FROM {form_builder_cache} WHERE updated < %d", time() - $expire_threshold);
+  return db_query("DELETE FROM {cache_form_builder} WHERE updated < %d", time() - $expire_threshold);
 }
 
 /**
Index: modules/node.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/modules/node.inc,v
retrieving revision 1.2
diff -u -p -r1.2 node.inc
--- modules/node.inc	16 Jan 2009 23:06:08 -0000	1.2
+++ modules/node.inc	5 Oct 2009 08:27:44 -0000
@@ -23,8 +23,9 @@ function node_form_edit($type) {
 
   drupal_set_message(t('This is a form preview. Click on a field to edit its properties.'), 'warning');
 
-  $output = form_builder_interface('node', $type->type);
-  $output .= drupal_get_form('node_form_builder_save_form', $type);
+  $output = array();
+  $output[] = form_builder_interface('node', $type->type);
+  $output[] = drupal_get_form('node_form_builder_save_form', $type);
   return $output;
 }
 
@@ -91,7 +92,7 @@ function node_form_builder_save_form($fo
 
       $form['buttons']['cancel'] = array(
         '#type' => 'markup',
-        '#value' => l('Cancel', 'admin/content/node-type/' . str_replace('_', '-', $type->type) . '/fields'),
+        '#value' => l('Cancel', 'admin/build/node-type/' . str_replace('_', '-', $type->type) . '/fields'),
       );
 
       $form['reviewed'] = array(
@@ -130,7 +131,7 @@ function node_form_builder_save_form_sub
   $type = $form_state['values']['type'];
 
   if (!isset($form_state['values']['reviewed'])) {
-    $form_state['redirect'] = 'admin/content/node-type/' . str_replace('_', '-', $type->type) .'/fields/confirm';
+    $form_state['redirect'] = 'admin/build/node-type/' . str_replace('_', '-', $type->type) .'/fields/confirm';
     return;
   }
 
@@ -148,7 +149,7 @@ function node_form_builder_save_form_sub
   }
 
   drupal_set_message(t('The changes to the %type content type form have been saved.', array('%type' => $type->name)));
-  $form_state['redirect'] = 'admin/content/node-type/' . str_replace('_', '-', $type->type);
+  $form_state['redirect'] = 'admin/build/node-type/' . str_replace('_', '-', $type->type);
 
 }
 
@@ -191,7 +192,7 @@ function node_form_builder_types() {
     'palette_group' => 'special',
   );
 
-  $body_form = node_body_field($node, $settings['body_field']['label'], $settings['body_field']['min_word_count']);
+  /*$body_form = node_body_field($node, $settings['body_field']['label'], $settings['body_field']['min_word_count']);
   $body_form['#weight'] = $settings['body_field']['weight'];
   $body_form['#body_settings'] = $settings['body_field'];
   $fields['body_field'] = array(
@@ -202,7 +203,7 @@ function node_form_builder_types() {
     'default' => $body_form,
     'unique' => TRUE,
     'palette_group' => 'special',
-  );
+  );*/
 
   $revision_fieldset = node_revision_fieldset($node, $settings['revision_information']);
   $revision_fieldset['#weight'] = $settings['revision_information']['weight'];
@@ -417,7 +418,7 @@ function node_form_builder_load($form_ty
     $form['#node_generic_fields'] = array();
     foreach (element_children($form) as $key) {
       $element = $form[$key];
-      if (!isset($element['#form_builder']) && (!empty($element['#tree']) || (isset($element['#type']) && !in_array($element['#type'], array('value', 'hidden', 'markup', 'token', 'button', 'submit'))))) {
+      if (!isset($element['#form_builder']) && (!empty($element['#tree']) || (isset($element['#type']) && !in_array($element['#type'], array('value', 'hidden', 'markup', 'token', 'button', 'submit', 'vertical_tabs', 'horizontal_tabs'))))) {
         $form[$key]['#form_builder'] = array(
           'element_id' => $key,
           'element_type' => 'generic_field',
@@ -735,19 +736,21 @@ function node_get_form_settings($node_ty
   if (!isset($form_settings[$node_type])) {
     // Get settings from the node form settings table.
     $form_settings[$node_type] = array();
-    $result = db_query("SELECT * FROM {node_form_settings} WHERE type = '%s'", $node_type);
-    while ($settings = db_fetch_object($result)) {
+		$result = db_select('node_form_settings', 'nfs', array('fetch' => PDO::FETCH_ASSOC))
+		  ->fields('nfs')
+			->condition('nfs.type', $node_type)
+			->execute();
+    foreach ($result as $settings) {
       $form_settings[$node_type][$settings->field] = unserialize($settings->settings);
       $form_settings[$node_type][$settings->field]['module'] = $settings->module;
     }
 
     // Get settings from the node type table.
-    $type = node_get_types('type', $node_type);
+    $type = node_type_get_type($node_type);
     $form_settings[$node_type]['title']['enabled'] = $type->has_title ? TRUE : FALSE;
     $form_settings[$node_type]['title']['label'] = isset($type->title_label) ? $type->title_label : '';
     $form_settings[$node_type]['body_field']['enabled'] = $type->has_body ? TRUE : FALSE;
     $form_settings[$node_type]['body_field']['label'] = isset($type->body_label) ? $type->body_label : '';
-    $form_settings[$node_type]['body_field']['min_word_count'] = $type->min_word_count;
 
     // Merge default settings from modules.
     foreach (module_implements('node_form_default_settings') as $module) {
@@ -788,7 +791,7 @@ function node_set_form_settings($node_ty
 
   // Special cases for node type settings.
   if ($field == 'body_field') {
-    $type = node_get_types('type', $node_type);
+    $type = node_type_get_type($node_type);
     $type->has_body = $settings['enabled'];
     $type->body_label = $settings['label'];
     $type->min_word_count = $settings['min_word_count'];
@@ -797,7 +800,7 @@ function node_set_form_settings($node_ty
     menu_rebuild();
   }
   if ($field == 'title') {
-    $type = node_get_types('type', $node_type);
+    $type = node_type_get_type($node_type);
     $type->has_title = $settings['enabled'];
     $type->title_label = $settings['label'];
     node_type_save($type);
Index: modules/upload.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/modules/upload.inc,v
retrieving revision 1.1
diff -u -p -r1.1 upload.inc
--- modules/upload.inc	20 Jan 2009 20:05:03 -0000	1.1
+++ modules/upload.inc	5 Oct 2009 07:50:13 -0000
@@ -162,7 +162,7 @@ function upload_fieldset($node, $upload_
       $form['#description'] .= ' '. t('Please contact the site administrator.');
     }
   }
-  else {
+  elseif (drupal_function_exists('_upload_form')) {
     $form['wrapper'] += _upload_form($node);
   }
 
Index: modules/node/form_builder_node.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/modules/node/form_builder_node.info,v
retrieving revision 1.1
diff -u -p -r1.1 form_builder_node.info
--- modules/node/form_builder_node.info	16 Jan 2009 23:06:08 -0000	1.1
+++ modules/node/form_builder_node.info	5 Oct 2009 07:50:13 -0000
@@ -1,5 +1,7 @@
 ; $Id: form_builder_node.info,v 1.1 2009/01/16 23:06:08 quicksketch Exp $
 name = Form builder Node UI
 description = Form builder enhancements for node module.
-core = 6.x
+core = 7.x
 dependencies[] = form_builder
+files[] = form_builder_node.install
+files[] = form_builder_node.module
\ No newline at end of file
Index: modules/node/form_builder_node.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/modules/node/form_builder_node.module,v
retrieving revision 1.2
diff -u -p -r1.2 form_builder_node.module
--- modules/node/form_builder_node.module	20 Jan 2009 20:05:02 -0000	1.2
+++ modules/node/form_builder_node.module	5 Oct 2009 07:50:13 -0000
@@ -15,18 +15,16 @@
 function form_builder_node_menu() {
   $items = array();
 
-  foreach (node_get_types('types', NULL, TRUE) as $type) {
+  foreach (node_type_get_types('types') as $type) {
     $type_url_str = str_replace('_', '-', $type->type);
-    $items['admin/content/node-type/'. $type_url_str .'/fields'] = array(
+    $items['admin/build/node-type/'. $type_url_str .'/fields'] = array(
       'title' => 'Fields',
       'page callback' => 'node_form_edit',
       'page arguments' => array($type),
       'access arguments' => array('administer content types'),
-      'file' => 'node.pages.inc',
-      'file path' => drupal_get_path('module', 'node'),
       'type' => MENU_LOCAL_TASK,
     );
-    $items['admin/content/node-type/'. $type_url_str .'/fields/confirm'] = array(
+    $items['admin/build/node-type/'. $type_url_str .'/fields/confirm'] = array(
       'title' => 'Confirm field changes',
       'page callback' => 'drupal_get_form',
       'page arguments' => array('node_form_builder_save_form', $type, TRUE),
@@ -46,7 +44,7 @@ function form_builder_node_menu() {
  */
 function form_builder_node_init() {
   // Pull in all the module include files.
-  $files = file_scan_directory(drupal_get_path('module', 'form_builder') . '/modules', '^.*\.inc$');
+  $files = file_scan_directory(drupal_get_path('module', 'form_builder') . '/modules', '!^.*\.inc$!');
   foreach ($files as $path => $file) {
     include_once($path);
   }
@@ -70,35 +68,4 @@ function form_builder_node_form_alter(&$
   if (function_exists('node_node_form_alter')) {
     node_node_form_alter($form, $form_state, $form_id);
   }
-}
-
-/**
- * Implementation of hook_theme_registry_alter().
- */
-function form_builder_node_theme_registry_alter(&$theme_registry) {
-  if ($theme_registry['node_form']['function'] == 'theme_node_form') {
-    $theme_registry['node_form']['function'] = 'theme_form_builder_node_form';
-  }
-}
-
-/**
- * Theme function for the node form that doesn't have hard-coded rendering.
- */
-function theme_form_builder_node_form($form) {
-  $output = "\n<div class=\"node-form\">\n";
-
-  $buttons = drupal_render($form['buttons']);
-
-  // Everything gets rendered here except the submit buttons.
-  $output .= "  <div class=\"standard\">\n";
-  $output .= drupal_render($form);
-  $output .= "  </div>\n";
-
-  // The submit buttons.
-  $output .= $buttons;
-
-  $output .= "</div>\n";
-
-  return $output;
-
-}
+}
\ No newline at end of file
Index: options_element/options_element.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/options_element/options_element.info,v
retrieving revision 1.1
diff -u -p -r1.1 options_element.info
--- options_element/options_element.info	3 Dec 2008 19:32:23 -0000	1.1
+++ options_element/options_element.info	5 Oct 2009 07:50:13 -0000
@@ -1,4 +1,5 @@
 ; $Id: options_element.info,v 1.1 2008/12/03 19:32:23 quicksketch Exp $
 name = Options element
 description = A custom form element for entering the options in select lists, radios, or checkboxes.
-core = 6.x
+core = 7.x
+files[] = options_element.module
\ No newline at end of file
Index: options_element/options_element.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/form_builder/options_element/options_element.js,v
retrieving revision 1.8
diff -u -p -r1.8 options_element.js
--- options_element/options_element.js	13 Jan 2009 03:39:56 -0000	1.8
+++ options_element/options_element.js	5 Oct 2009 07:50:13 -0000
@@ -1,14 +1,18 @@
 // $Id: options_element.js,v 1.8 2009/01/13 03:39:56 quicksketch Exp $
 
+(function($) {
+
 /**
  * @file
  * Add JavaScript behaviors for the "options" form element type.
  */
-Drupal.behaviors.optionsElement = function(context) {
+Drupal.behaviors.optionsElement = {
+  attach: function(context) {
   $('div.form-options:not(.options-element-processed)', context).each(function() {
     $(this).addClass('options-element-processed');
     new Drupal.optionsElement(this);
   });
+  }
 };
 
 /**
@@ -35,7 +39,7 @@ Drupal.optionsElement = function(element
   this.keyChangeWarning = Drupal.t('Custom keys have been specified in this list. Removing these custom keys may change way data is stored. Are you sure you wish to remove these custom keys?');
 
   // Setup new DOM elements containing the actual options widget.
-  this.optionsElement = $('<div></div>').get(0); // Temporary DOM object. 
+  this.optionsElement = $('<div></div>').get(0); // Temporary DOM object.
   this.optionsToggleElement = $(Drupal.theme('optionsElementToggle')).get(0);
 
   // Add the options widget and toggle elements to the page.
@@ -112,7 +116,7 @@ Drupal.optionsElement.prototype.updateWi
         limit: 0,
         relationship: 'self',
         source: 'option-depth',
-        target: 'option-depth',
+        target: 'option-depth'
       }
     }
   };
@@ -126,7 +130,7 @@ Drupal.optionsElement.prototype.updateWi
         limit: 1,
         relationship: 'parent',
         source: 'option-key',
-        target: 'option-parent',
+        target: 'option-parent'
       }
     };
   }
@@ -638,3 +642,5 @@ Drupal.theme.tableDragChangedMarker = fu
 Drupal.theme.tableDragChangedWarning = function() {
   return ' ';
 }
+
+})(jQuery);
\ No newline at end of file
