Index: uc_signup.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_signup/uc_signup.module,v
retrieving revision 1.30
diff -u -p -r1.30 uc_signup.module
--- uc_signup.module	8 Aug 2009 16:36:35 -0000	1.30
+++ uc_signup.module	12 Aug 2009 03:02:04 -0000
@@ -18,13 +18,22 @@ function uc_signup_menu() {
     'page arguments' => array('uc_signup_settings_form'),
     'title' => 'Ubercart Signup settings',
   );
-  $items['uc_signup/attendees'] = array(
+  $items['uc_signup/attendees/emails'] = array(
     'access arguments' => array('view own orders'),
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('uc_signup_attendees_form'),
-    'title' => 'Attendee Information',
+    'page arguments' => array('uc_signup_attendees_form', 2),
+    'title' => 'Attendee E-mail Addresses',
     'type' => MENU_CALLBACK,
   );
+  
+  $items['uc_signup/attendees/profiles'] = array(
+    'access arguments' => array('view own orders'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('uc_signup_attendees_form', 2),
+    'title' => 'Attendee Contact Information',
+    'type' => MENU_CALLBACK,
+  );
+  
   return $items;
 }
 
@@ -43,12 +52,6 @@ function uc_signup_theme() {
 }
 
 function uc_signup_attendees_form_validate($form, &$form_state) {
-  if ($form_state['clicked_button']['#value'] == t('Previous step')) {
-    switch ($form_state['storage']['step']) {
-      case 'profiles':
-        $form_state['storage']['step'] = 'emails';
-    }
-  }
 
   if ($form_state['storage']['step'] == 'emails') {
     foreach ($form_state['values'] as $key => $value) {
@@ -116,17 +119,10 @@ function uc_signup_attendees_form_emails
     '#type' => 'submit',
     '#value' => t('Next step'),
   );
-  drupal_set_title(t("Attendee Email addresses"));
+  
   return $form;
 }
 function uc_signup_attendees_form_submit($form, &$form_state) {
-  if ($form_state['clicked_button']['#value'] == t('Previous step')) {
-    switch ($form_state['storage']['step']) {
-      case 'profiles':
-        $form_state['storage']['step'] = 'emails';
-        return $form;
-    }
-  }
 
   foreach ($form_state['values'] as $key => $value) {
     if (is_numeric($key)) {
@@ -143,10 +139,11 @@ function uc_signup_attendees_form_submit
   }
 
   if ($form_state['storage']['step'] == 'emails') {
-    $form_state['storage']['step'] = 'profiles';
+    unset($form_state['storage']); 
+    $form_state['redirect'] = 'uc_signup/attendees/profiles';
   }
 }
-function uc_signup_attendees_form(&$form_state = NULL) {
+function uc_signup_attendees_form(&$form_state = NULL, $menu_path = NULL) {
   // We have to disable page chaching so that this form works properly for anonymous users.
   $_SERVER['REQUEST_METHOD'] = 'post';
   $GLOBALS['config']['cache'] = FALSE;
@@ -169,9 +166,9 @@ function uc_signup_attendees_form(&$form
     $form_state['storage']['uc_signup'] = $_SESSION['uc_signup'];
   }
 
-  if (!empty($form_state['storage']['step'])) {
+  if (!empty($menu_path) && ($menu_path == 'profiles' || $menu_path == 'emails')) {
     // The form step has been set in the submission hanlder. The user may have pressed the 'previous' button.
-    $function = 'uc_signup_attendees_form_'. $form_state['storage']['step'];
+    $function = 'uc_signup_attendees_form_'. $menu_path;
     return $function($form_state, $events);
   }
   // Yes, there are signup enabled nodes in the cart.
@@ -256,17 +253,16 @@ function uc_signup_attendees_form_profil
       );
     }
   }
-  // TODO: get these in the right order.
+
+  $form['back'] = array(
+    '#type' => 'markup',
+    '#value' => l(t("Previous step"), 'uc_signup/attendees/emails'),
+  );
   $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Next step'),
   );
-  $form['back'] = array(
-    '#type' => 'button',
-    '#value' => t("Previous step"),
-  );
 
-  drupal_set_title(t('Attendee Contact Information'));
   return $form;
 }
 
@@ -515,7 +511,7 @@ function uc_signup_attendees_pane($op, $
           $signups = TRUE;
         }
         if ($signups && (empty($_SESSION['uc_signup']['nids'][$product->nid]) || count($_SESSION['uc_signup']['nids'][$product->nid]) < $product->qty)) {
-          drupal_goto('uc_signup/attendees');
+          drupal_goto('uc_signup/attendees/emails');
         }
       }
       $mails = array();
