Index: signup.module
===================================================================
RCS file: /home/dww/drupal/.cvs_repo/drupal/modules/signup/signup.module,v
retrieving revision 1.10
diff -u -F^f -r1.10 signup.module
--- signup.module	3 Feb 2006 07:46:17 -0000	1.10
+++ signup.module	3 Feb 2006 08:41:34 -0000
@@ -158,6 +158,11 @@ function signup_menu($may_cache) {
     $items[] = array('path' => 'admin/signup/conflict_detail', 'title' => t('conflict detail'),
         'callback' => 'signup_conflict_detail', 'access' => $access,
         'type' => MENU_LOCAL_TASK);
+    $items[] = array('path' => 'admin/signup/closed_events',
+                     'title' => t('closed events'),
+                     'callback' => 'signup_admin_closed',
+                     'access' => $access, 'type' => MENU_LOCAL_TASK,
+                     'weight' => -9);
 
     //user signup callbacks
     $items[] = array('path' => 'signup', 'access' => TRUE, 'type' => MENU_CALLBACK, 'callback' => 'signup_user_signup');
@@ -166,6 +171,9 @@ function signup_menu($may_cache) {
 
     //close signup callback
     $items[] = array('path' => 'closesignup', 'access' => TRUE, 'type' => MENU_CALLBACK, 'callback' => 'signup_close_signup');
+
+    //open signup callback
+    $items[] = array('path' => 'opensignup', 'access' => TRUE, 'type' => MENU_CALLBACK, 'callback' => 'signup_open_signup');
   } else {
 
     //if it's a signup event, then put in a signup tab
@@ -417,9 +425,37 @@ function signup_nodeapi(&$node, $op, $ar
  * @ingroup signup_callback
  */
 function signup_admin_page() {
+  _signup_admin_helper( 'open' );
+}
+
+
+/**
+ * Callback function for generating page for viewing (and reopening)
+ * closed signups
+ * @ingroup signup_callback
+ */
+function signup_admin_closed() {
+  _signup_admin_helper( 'closed' );
+}
+
 
+/**
+ * Since there are two nearly identical tabs in the admin/signup
+ * world, one for viewing open events (with a link to close them) and
+ * one for viewing closed events (with a link to open them), all the
+ * underlying code is basically the same except 3 minor changes.  so,
+ * this function implements the real work, and just decides what to 
+ * do based on the argument it is given.
+ * @ingroup signup_internal
+ */
+function _signup_admin_helper( $type ) {
   $output = '';
-  drupal_set_title(t('Signups'));
+
+  if ($type == 'open') {
+    drupal_set_title(t('Signups'));
+  } else {
+    drupal_set_title(t('Closed Signups'));
+  }
 
   //tests for optional support of event.module
   $_EVENT = module_exist('event');
@@ -439,8 +475,13 @@ function signup_admin_page() {
   //pull all open signup nodes, and start the creation of the table
   $sql = "SELECT n.title, n.nid$event_select, COUNT(*) AS count FROM
           {signup_log} s_l INNER JOIN {node} n INNER JOIN {signup} s
-          ON n.nid = s.nid AND s.nid = s_l.nid$event_join
-          WHERE s.completed = 0 GROUP BY n.nid";
+          ON n.nid = s.nid AND s.nid = s_l.nid$event_join";
+  if ($type == 'open') {
+    $sql .= " WHERE s.completed = 0";
+  } else {
+    $sql .= " WHERE s.completed = 1";
+  }
+  $sql .= " GROUP BY n.nid";
   $sql .= tablesort_sql($header);
   $result = pager_query($sql, 25);
 
@@ -454,14 +495,24 @@ function signup_admin_page() {
     }
     $row[] = l(check_plain($signup_event->title), "node/$signup_event->nid");
     $row[] = $signup_event->count;
-    $row[] = l(t('View Signups'), "node/$signup_event->nid/signups") .'<br>'. l(t('Close Event'),
-      "closesignup/$signup_event->nid");
+    $op_links = l(t('View Signups'), "node/$signup_event->nid/signups");
+    $op_links .= '<br>';
+    if ($type == 'open') {
+      $op_links .= l(t('Close Event'), "closesignup/$signup_event->nid");
+    } else {
+      $op_links .= l(t('Open Event'), "opensignup/$signup_event->nid");
+    }
+    $row[] = $op_links; 
     $rows[] = $row;
   }
-  $output .= theme('table', $header, $rows);
-  $pager = theme('pager', NULL, 25, 0, tablesort_pager());
-  if (!empty($pager)) {
-    $output .= $pager;
+  if (count($rows)) {
+    $output .= theme('table', $header, $rows);
+    $pager = theme('pager', NULL, 25, 0, tablesort_pager());
+    if (!empty($pager)) {
+      $output .= $pager;
+    }
+  } else {
+    $output = "<h4>No " . $type . " events</h4>";
   }
   print theme('page', $output);
 }
@@ -504,7 +555,7 @@ function signup_open_signup($nid, $cron 
   //open the specified node for signups, and head back to the admin/signup page if it's not a cron task
   db_query("UPDATE {signup} SET completed = 0 WHERE nid = %d", $nid);
   if ($cron == 'no') {
-    drupal_goto('admin/signup');
+    drupal_goto('admin/signup/closed_events');
   }
 }
 
@@ -566,6 +617,7 @@ function signup_conflict_summary() {
   print theme('page', $output);
 }
 
+
 /**
  * Prints the settings page under admin/setttings/signup
  * @ingroup signup_callback
