Index: ad.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ad/ad.module,v
retrieving revision 1.2.2.29.2.83.2.16.2.22
diff -u -p -r1.2.2.29.2.83.2.16.2.22 ad.module
--- ad.module	8 May 2009 04:45:22 -0000	1.2.2.29.2.83.2.16.2.22
+++ ad.module	12 Jun 2009 19:57:54 -0000
@@ -701,6 +701,7 @@ function ad_form(&$node, &$form_state) {
       ? FALSE : TRUE,
   );
 
+  $date_popup_available = module_exists('date_popup');
   if ((isset($node->nid) && ad_permission($node->nid, 'manage status')) ||
       user_access('administer advertisements')) {
     $form['schedule']['current'] = array(
@@ -716,6 +717,14 @@ function ad_form(&$node, &$form_state) {
       '#default_value' => isset($node->autoactivate) && $node->autoactivate > 0 ? format_date((int)$node->autoactivate, 'custom', 'F j, Y H:i') : 0,
       '#description' => t('You can specify a date and time for this advertisement to be automatically activated.  The advertisement needs to be in an <em>approved</em> state before it can be automatically activated.  If you prefer to activate the advertisement immediately, leave this field empty.')
     );
+    if ($date_popup_available) {
+      // add date_popup functionality
+      $form['schedule']['autoactivate'] = array(
+        '#type' => 'date_popup',
+        '#date_format' => 'F j, Y H:i',
+        '#default_value' => isset($node->autoactivate) && $node->autoactivate > 0 ? array(date('Y-m-d H:i:s', (int)$node->autoactivate)) : array(),
+      ) + $form['schedule']['autoactivate'];
+    }
   }
 
   if (user_access('administer advertisements')) {
@@ -727,6 +736,14 @@ function ad_form(&$node, &$form_state) {
       '#default_value' => isset($node->autoexpire) && $node->autoexpire > 0 ? format_date((int)$node->autoexpire, 'custom', 'F j, Y H:i') : 0,
       '#description' => t('You can specify a date and time for this advertisement to be automatically expired.  If you don\'t want the advertisement to expire, leave this field empty.')
     );
+    if ($date_popup_available) {
+      // add date_popup functionality
+      $form['schedule']['autoexpire'] = array(
+        '#type' => 'date_popup',
+        '#date_format' => 'F j, Y H:i',
+        '#default_value' => isset($node->autoexpire) && $node->autoexpire > 0 ? array(date('Y-m-d H:i:s', (int)$node->autoexpire)) : array(),
+      ) + $form['schedule']['autoexpire'];
+    }
     $form['schedule']['maxviews'] = array(
       '#type' => 'textfield',
       '#title' => t('Maximum impressions'),
