? boxes_onepage.patch
Index: boxes.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boxes/boxes.admin.inc,v
retrieving revision 1.5.2.2
diff -u -p -r1.5.2.2 boxes.admin.inc
--- boxes.admin.inc	21 Jun 2010 19:30:07 -0000	1.5.2.2
+++ boxes.admin.inc	1 Jul 2010 15:24:14 -0000
@@ -4,8 +4,39 @@
 /**
  * Generate form for creating new boxes.
  */
-function boxes_add_form($form_state, $plugin_key) {
-  $form = boxes_box_form(boxes_create($plugin_key));
+function boxes_add() {
+  drupal_add_js(drupal_get_path('module', 'boxes') . '/boxes.js');
+  $output = '';
+  $options = array();
+  ctools_include('plugins');
+  $plugins = ctools_get_plugins('boxes', 'plugins');
+  foreach ($plugins as $key => $info) {
+    if (isset($info['title'])) {
+      $options[$key] = $info['title'];
+    }
+  }
+  foreach ($plugins as $key => $info) {
+    if (isset($info['title'])) {
+      $options[$key] = $info['title'];
+      $output .= drupal_get_form('boxes_add_form_' . $key, $key, $options);
+    }
+  }
+  return drupal_render($select) . $output;
+}
+
+/**
+ * Boxes add form.
+ */
+function boxes_add_form($form_state, $type, $options) {
+  $form = boxes_box_form(boxes_create($type));
+  $form['type'] = array(
+    '#type' => 'select',
+    '#title' => t('Box Type'),
+    '#options' => $options,
+    '#weight' => -20,
+    '#default_value' => $type,
+    '#attributes' => array('class' => 'boxes-type-select'),
+  );
   $form['delta'] = array(
     '#type' => 'textfield',
     '#title' => t('Machine name'),
@@ -38,10 +69,16 @@ function boxes_validate_delta($element, 
  * Submit handler for box_add_form.
  */
 function boxes_add_form_submit($form, &$form_state) {
-  $box = boxes_create($form_state['values']['plugin_key'], $form_state['values']);
-  $box->save();
-  drupal_set_message(t('%name has been created.', array('%name' => $box->description)));
-  $form_state['redirect'] = 'admin/build/block';
+  if (!isset($form_state['storage']['type'])) {
+    $form_state['storage']['type'] = $form_state['values']['type'];
+  }
+  else {
+    $box = boxes_create($form_state['storage']['type'], $form_state['values']);
+    $box->save();
+    drupal_set_message(t('%name has been created.', array('%name' => $box->description)));
+    $form_state['redirect'] = 'admin/build/block';
+    unset($form_state['storage']['type']);
+  }
 }
 
 /**
Index: boxes.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boxes/boxes.js,v
retrieving revision 1.2
diff -u -p -r1.2 boxes.js
--- boxes.js	19 Feb 2010 19:21:52 -0000	1.2
+++ boxes.js	1 Jul 2010 15:24:14 -0000
@@ -1,5 +1,16 @@
 // $Id: boxes.js,v 1.2 2010/02/19 19:21:52 yhahn Exp $
 Drupal.behaviors.boxes = function(context) {
+  $('.boxes-type-select').each(function() {
+    // Preserve initial value
+    var value = $(this).val();
+    $(this).bind('change', function() {
+      $(this).parents('form').hide()
+          .parent().children('form[id=boxes-add-form-' + $(this).val().replace(/_/g, '-') + ']').show().end().end()
+          .end()
+        .val(value);
+    });
+  }).parents('form').filter(':not(:first)').hide();
+
   // Unwrap the AHAH call contents as ahah.js replaces the *contents* of the
   // wrapper, not the wrapper itself.
   if ($(context).is('div') && $('div.block-boxes', context).size() > 0) {
Index: boxes.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boxes/boxes.module,v
retrieving revision 1.10.2.6
diff -u -p -r1.10.2.6 boxes.module
--- boxes.module	22 Jun 2010 15:17:05 -0000	1.10.2.6
+++ boxes.module	1 Jul 2010 15:24:14 -0000
@@ -6,20 +6,14 @@
  */
 function boxes_menu() {
   $items = array();
-  ctools_include('plugins');
-  $plugins = ctools_get_plugins('boxes', 'plugins');
-  foreach ($plugins as $key => $info) {
-    if (isset($info['title'])) {
-      $items['admin/build/block/box-add/'. $key] = array(
-        'title' => 'Add '. strtolower($info['title']),
-        'page callback' => 'drupal_get_form',
-        'page arguments' => array('boxes_add_form', 4),
-        'access arguments' => array('administer blocks'),
-        'type' => MENU_LOCAL_TASK,
-        'file' => 'boxes.admin.inc',
-      );
-    }
-  }
+
+  $items['admin/build/block/box-add'] = array(
+    'title' => 'Add box',
+    'page callback' => 'boxes_add',
+    'access arguments' => array('administer blocks'),
+    'type' => MENU_LOCAL_TASK,
+    'file' => 'boxes.admin.inc',
+  );
   $items['admin/build/block/configure/boxes/%boxes/delete'] = array(
     'title' => 'Delete box',
     'page callback' => 'drupal_get_form',
@@ -81,6 +75,16 @@ function boxes_forms($form_id) {
       'callback' => 'boxes_box_inline_form',
     );
   }
+  elseif (strpos($form_id, 'boxes_add_form_') === 0) {
+    $plugins = ctools_get_plugins('boxes', 'plugins');
+    foreach ($plugins as $key => $info) {
+      if (isset($info['title'])) {
+        $forms['boxes_add_form_' . $key] = array(
+          'callback' => 'boxes_add_form',
+        );
+      }
+    }
+  }
   return $forms;
 
 }
