? scheduler_i137802.patch
Index: scheduler.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/scheduler.install,v
retrieving revision 1.3.2.1
diff -u -p -r1.3.2.1 scheduler.install
--- scheduler.install	26 Jul 2006 05:48:15 -0000	1.3.2.1
+++ scheduler.install	6 May 2007 23:01:53 -0000
@@ -47,3 +47,17 @@ function scheduler_update_2() {
 
   return $ret;
 }
+
+function scheduler_update_3() {
+  $r = db_query("SELECT name, value FROM {variable} WHERE name LIKE 'scheduler_%'");
+  if ($r && db_num_rows($r) > 0) {
+    $len = strlen('scheduler_');
+    while ($row = db_fetch_array($r)) {
+      $part = substr($row['name'], $len);
+      db_query("INSERT INTO {variable} SET name = '%s', value = '%s'", 'scheduler_on_'. $part, $row['value']);
+      db_query("INSERT INTO {variable} SET name = '%s', value = '%s'", 'scheduler_off_'. $part, $row['value']);
+      db_query("DELETE FROM {variable} WHERE name = '%s'", $row['name']);
+    }
+  }
+}
+
Index: scheduler.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/scheduler.module,v
retrieving revision 1.37.2.11
diff -u -p -r1.37.2.11 scheduler.module
--- scheduler.module	15 Nov 2006 21:13:51 -0000	1.37.2.11
+++ scheduler.module	6 May 2007 23:01:53 -0000
@@ -25,18 +25,28 @@ function scheduler_perm() {
 function scheduler_form_alter($form_id, &$form) {
   //allow scheduling on a per-node-type basis
   if (isset($form['type']) && $form['type']['#value'] .'_node_settings' == $form_id) {
-    $form['workflow']['scheduler_'. $form['type']['#value']] = array(
+    $form['workflow']['scheduler'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Scheduled (un)publishing'),
+      '#description' => t('Check these boxes to enable scheduled (un)publishing for this node type.')
+    );
+  
+    $form['workflow']['scheduler']['scheduler_on_'. $form['type']['#value']] = array(
+      '#type' => 'checkbox', 
+      '#title' => t('Enable scheduled publishing'),
+      '#default_value' => variable_get('scheduler_on_'. $form['type']['#value'], 0),
+    );
+    $form['workflow']['scheduler']['scheduler_off_'. $form['type']['#value']] = array(
       '#type' => 'checkbox', 
-      '#title' => t('Enable scheduled (un)publishing'), 
-      '#default_value' => variable_get('scheduler_'. $form['type']['#value'], 0),
-      '#description' => t('Check this box to enable scheduled (un)publishing for this node type.')
+      '#title' => t('Enable scheduled unpublishing'),
+      '#default_value' => variable_get('scheduler_off_'. $form['type']['#value'], 0),
     );
   }
  
   else if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
     if (user_access('schedule (un)publishing of nodes')) {
       // if scheduling has been enabled for this node type
-      if (variable_get('scheduler_'. $form['type']['#value'], 0) == 1) {
+      if (variable_get('scheduler_on_'. $form['type']['#value'], 0) == 1 || variable_get('scheduler_off_'. $form['type']['#value'], 0) == 1) {
         
         //use JScalendar picker for dates if the module exists and is enabled
         $jscalendar = FALSE;
@@ -62,31 +72,35 @@ function scheduler_form_alter($form_id, 
           '#collapsed' => ($defaults->publish_on != 0 || $defaults->unpublish_on != 0) ? FALSE: TRUE,
           '#weight' => 35
         );
-        
-        $form['scheduler_settings']['publish_on'] = array(
-          '#type' => 'textfield', 
-          '#title' => t('Publish on'), 
-          '#maxlength' => 25,
-          //we subtract the time zone to show the user the correct time they entered
-          //and below that we show the timezone to adjust this time by
-          //we store the adjusted timezone value in the database for cron
-          '#default_value' => $defaults->publish_on ? date('Y-m-d H:i:s', $defaults->publish_on - $defaults->timezone) : '',
-          '#description' => t('Format: %time. Leave blank to publish on the time of form submission.', array('%time' => date('Y-m-d H:i:s'))),
-          '#attributes' => $jscalendar ? array('class' => 'jscalendar') : array()
-        );
-        
-        $form['scheduler_settings']['unpublish_on'] = array(
-          '#type' => 'textfield', 
-          '#title' => t('Unpublish on'), 
-          '#maxlength' => 25, 
-          //we subtract the time zone to show the user the correct time they entered
-          //and below that we show the timezone to adjust this time by
-          //we store the adjusted timezone value in the database for cron
-          '#default_value' => $defaults->unpublish_on ? date('Y-m-d H:i:s', $defaults->unpublish_on - $defaults->timezone) : '',
-          '#description' => t('Format: %time. Leave blank to not unpublish this node.', array('%time' => date('Y-m-d H:i:s'))),
-          '#attributes' => $jscalendar ? array('class' => 'jscalendar') : array()
-        );
-        
+
+        if (variable_get('scheduler_on_'. $form['type']['#value'], 0) == 1) {
+          $form['scheduler_settings']['publish_on'] = array(
+            '#type' => 'textfield', 
+            '#title' => t('Publish on'), 
+            '#maxlength' => 25,
+            //we subtract the time zone to show the user the correct time they entered
+            //and below that we show the timezone to adjust this time by
+            //we store the adjusted timezone value in the database for cron
+            '#default_value' => $defaults->publish_on ? date('Y-m-d H:i:s', $defaults->publish_on - $defaults->timezone) : '',
+            '#description' => t('Format: %time. Leave blank to publish on the time of form submission.', array('%time' => date('Y-m-d H:i:s'))),
+            '#attributes' => $jscalendar ? array('class' => 'jscalendar') : array()
+          );
+        }
+
+        if (variable_get('scheduler_off_'. $form['type']['#value'], 0) == 1) {
+          $form['scheduler_settings']['unpublish_on'] = array(
+            '#type' => 'textfield', 
+            '#title' => t('Unpublish on'), 
+            '#maxlength' => 25, 
+            //we subtract the time zone to show the user the correct time they entered
+            //and below that we show the timezone to adjust this time by
+            //we store the adjusted timezone value in the database for cron
+            '#default_value' => $defaults->unpublish_on ? date('Y-m-d H:i:s', $defaults->unpublish_on - $defaults->timezone) : '',
+            '#description' => t('Format: %time. Leave blank to not unpublish this node.', array('%time' => date('Y-m-d H:i:s'))),
+            '#attributes' => $jscalendar ? array('class' => 'jscalendar') : array()
+          );
+        }
+
         //default to user timezone, if not specified, default to system wide timezone
         global $user;
         $zones = _system_zonelist();
