cvs diff: Diffing .
Index: signup.module
===================================================================
RCS file: /home/dww/drupal/.cvs_repo/drupal/modules/signup/signup.module,v
retrieving revision 1.11
diff -u -F^f -r1.11 signup.module
--- signup.module	3 Feb 2006 08:51:57 -0000	1.11
+++ signup.module	3 Feb 2006 09:38:49 -0000
@@ -110,7 +110,7 @@ function signup_cron() {
 
     //loop through the results, calling the event closing function
     while ($signup = db_fetch_object($result)) {
-      signup_close_signup($signup->nid, $cron = 'yes');
+      _signup_close_signup($signup->nid);
     }
   }
 }
@@ -170,10 +170,10 @@ function signup_menu($may_cache) {
     'callback' => 'signup_user_schedule');
 
     //close signup callback
-    $items[] = array('path' => 'closesignup', 'access' => TRUE, 'type' => MENU_CALLBACK, 'callback' => 'signup_close_signup');
+    $items[] = array('path' => 'closesignup', 'access' => TRUE, 'type' => MENU_CALLBACK, 'callback' => 'signup_close_signup_link');
 
     //open signup callback
-    $items[] = array('path' => 'opensignup', 'access' => TRUE, 'type' => MENU_CALLBACK, 'callback' => 'signup_open_signup');
+    $items[] = array('path' => 'opensignup', 'access' => TRUE, 'type' => MENU_CALLBACK, 'callback' => 'signup_open_signup_link');
   } else {
 
     //if it's a signup event, then put in a signup tab
@@ -533,30 +533,42 @@ function signup_cancel_signup($uid, $nid
 
 
 /**
- * Callback function for closing signups
- * @ingroup signup_callback
+ * Helper method for closing signups
+ * @ingroup signup_internal
  */
-function signup_close_signup($nid, $cron = 'no') {
-
-  //close the specified node for signups, and head back to the admin/signup page if it's not a cron task
+function _signup_close_signup($nid) {
+  //close the specified node for signups
   db_query("UPDATE {signup} SET completed = 1 WHERE nid = %d", $nid);
-  if ($cron == 'no') {
-    drupal_goto('admin/signup');
-  }
 }
 
 
 /**
- * Callback function for opening signups
+ * Callback function for opening signups via a link in the admin tables
  * @ingroup signup_callback
  */
-function signup_open_signup($nid, $cron = 'no') {
+function signup_close_signup_link($nid) {
+  _signup_close_signup($nid);
+  drupal_goto('admin/signup');
+}
 
-  //open the specified node for signups, and head back to the admin/signup page if it's not a cron task
+
+/**
+ * Helper method for opening signups
+ * @ingroup signup_internal
+ */
+function _signup_open_signup($nid) {
+  //open the specified node for signups
   db_query("UPDATE {signup} SET completed = 0 WHERE nid = %d", $nid);
-  if ($cron == 'no') {
-    drupal_goto('admin/signup/closed_events');
-  }
+}
+
+
+/**
+ * Callback function for opening signups via a link in the admin tables
+ * @ingroup signup_callback
+ */
+function signup_open_signup_link($nid) {
+  _signup_open_signup($nid);
+  drupal_goto('admin/signup/closed_events');
 }
 
 
@@ -697,14 +709,6 @@ function signup_user_signup() {
     case t('Cancel Signup'):
       signup_cancel_signup($edit['uid'], $edit['nid']);
       break;
-
-    case t('Open Signups'):
-      signup_open_signup($edit['nid']);
-      break;  
-
-    case t('Close Signups'):
-      signup_close_signup($edit['nid']);
-      break;  
   }
 
   //send the user back to the same page, or to node if it's not available
@@ -726,6 +730,20 @@ function signup_user_signup() {
  */
 function signup_user_signups_form($node) {
 
+  $op = $_POST['op'];
+
+  switch ($op) {
+    case t('Open Signups'):
+      _signup_open_signup($node->nid);
+      drupal_goto(url("node/$node->nid/signups"));
+      break;  
+
+    case t('Close Signups'):
+      _signup_close_signup($node->nid);
+      drupal_goto(url("node/$node->nid/signups"));
+      break;  
+  }
+
   $output = "<h1>" . check_plain($node->title) . "</h1>";
 
   // first see signups have already been closed for this node, and if
@@ -734,15 +752,12 @@ function signup_user_signups_form($node)
   $ctrl_row = array();
   if ($node->signup_completed) {
     $ctrl_row[] = array( t('Signups <b>closed</b> for this event'), 
-                         form(form_hidden('nid', $node->nid) .
-                            form_submit(t('Open Signups')), 'post',
-                              url('signup', drupal_get_destination())) );
-
+                         form(form_submit(t('Open Signups')), 'post',
+                              url("node/$node->nid/signups")) );
   } else {
-    $ctrl_row[] = array( t('Signups <b>open</b> for this event'), 
-                         form(form_hidden('nid', $node->nid) .
-                            form_submit(t('Close Signups')), 'post',
-                              url('signup', drupal_get_destination())) );
+    $ctrl_row[] = array( t('Signups <b>open</b> for this event'),
+                         form(form_submit(t('Close Signups')), 'post',
+                              url("node/$node->nid/signups")) );
   }
   $output .= '<br/>';
   $output .= theme('table', NULL, $ctrl_row);
cvs diff: Diffing po
