--- feedmanager.module	2007-01-04 01:56:33.000000000 +0000
+++ feedmanager.module.mod	2007-04-26 07:26:45.000000000 +0000
@@ -224,107 +224,135 @@ function feedmanager_perm() {
 /**
  * Generate a form to add/edit feed sources.
  */
+
+/** added by Chris Herberte for 5.x port. **/ 
+
 function feedmanager_form_feed($edit = array()) {
   $op = arg(2);
-    
   switch($op) {
     case 'edit':
-      $form['title'] = array('#type' => 'textfield',
-        '#title' => t('Title'),
-        '#default_value' => $edit['title'],
-        '#maxlength' => 64,
-        '#description' => t('The name of the feed; typically the name of the web site you syndicate content from.'),
-        '#required' => TRUE,
-      );
-    
-      $form['url'] = array('#type' => 'textfield',
-        '#title' => t('URL'),
-        '#default_value' => $edit['url'],
-        '#size' => 100,
-        '#description' => t('The fully-qualified URL of the feed.'),
-        '#attributes' => array('readonly' => 'readonly')
-      );
-      
-      $form['description'] = array('#type' => 'textarea',
-        '#title' => t('Description'),
-        '#default_value' => $edit['description'],
-        '#rows' => 5,
-        '#description' => t('As supplied by the RSS feed.'),
-      );
-    
-      $period = array(0 => t('never')) + drupal_map_assoc(array(300, 900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval');
-      if ($edit['refresh'] == -1) {
-        $edit['refresh'] = 3600;
-      }
-      $form['refresh'] = array('#type' => 'select',
-        '#title' => t('Update interval'),
-        '#default_value' => $edit['refresh'],
-        '#options' => $period,
-        '#description' => t('The refresh interval indicating how often you want to update this feed. Requires %cron.', array('%cron' => l('crontab', 'admin/settings') )),
-      );
-    
-      $period = array(0 => t('never')) + drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
-      $form['expires'] = array(
-        '#type' => 'select',
-        '#title' => t('Discard news items older than'),
-        '#default_value' => $edit['expires'],
-        '#options' => $period,
-        '#description' => t('Older news items will be automatically discarded.  Requires %cron.', array('%cron' => l('crontab', 'admin/settings') ))
-      );
-   
-      // Handling of categories:
-      $form += feedmanager_freetag($edit);
+      $output .= drupal_get_form('feedmanager_form_feed_edit', $edit);
+	  break;
     
-      $form['advanced'] = array(
-        '#type' => 'fieldset',
-        '#title' => t('Advanced'),
-        '#description' => t('These settings are specific to the type of feed processor you have selected.'),
-        '#collapsible' => TRUE,
-        '#collapsed' => FALSE,
-        '#tree' => TRUE
-      );
-    
-      $form['advanced']['update_items'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Update news items'),
-        '#description' => t('If the same news item is found in the feed on the next update the contents will overwrite the previous version stored here.'),
-        '#default_value' => $edit['update_items'] ? $edit['update_items'] : FALSE,
-      );
-    
-      $form['advanced']['processor'] = array('#type' => 'value', '#value' => $edit['processor']);
-    
-      $form['advanced']['stripads'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Strip Adverts'),
-        '#description' => t('Strip out ads from certain advertisers, namely Pheedo, Google AdSense, and certain types of Doubleclick ads.'),
-        '#default_value' => $edit['stripads'] ? $edit['stripads'] : TRUE,
-      );
+    case 'add':
+	  $output .= drupal_get_form('feedmanager_form_feed_add', $edit);
       break;
+  }
+  return $output;
+}
+
+/**
+ * Feed add form 
+ */
+function feedmanager_form_feed_add($edit = array()) {
+  $form['url'] = array('#type' => 'textfield',
+    '#title' => t('URL'),
+    '#default_value' => $edit['url'],
+    '#size' => 100,
+    '#description' => t('The fully-qualified URL of the feed.'),
+    '#required' => TRUE,
+  );
       
-    case 'add':
-      $form['url'] = array('#type' => 'textfield',
-        '#title' => t('URL'),
-        '#default_value' => $edit['url'],
-        '#size' => 100,
-        '#description' => t('The fully-qualified URL of the feed.'),
-        '#required' => TRUE,
-      );
+  // We set feeds to not update until they have been edited
+  $form['refresh'] = array('#type' => 'value', '#value' => -1);
       
-      // We set feeds to not update until they have been edited
-      $form['refresh'] = array('#type' => 'value', '#value' => -1);
+  $processors = module_invoke_all('feedapi', $feed, 'processor_name');
+  $form['processor'] = array(
+    '#type' => 'select',
+    '#title' => t('Processor'),
+    '#description' => t("Each feed can have it's items generated by a different processor. This allows you to generate different types of content per feed - such as nodes or traditional aggregator items. Re-edit the feed to see processor specific settings."),
+    '#options' => $processors,
+    '#default_value' => $edit['processor'],
+    '#size' => 1,
+    '#required' => TRUE,
+  );
+
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Submit'),
+    '#weight' => 35,
+  );
+  
+  return $form;
+}
+
+/**
+ * Feed edit form
+ */
+function feedmanager_form_feed_edit($edit = array()) {
+  $form['title'] = array('#type' => 'textfield',
+    '#title' => t('Title'),
+    '#default_value' => $edit['title'],
+    '#maxlength' => 64,
+    '#description' => t('The name of the feed; typically the name of the web site you syndicate content from.'),
+    '#required' => TRUE
+  );
+    
+  $form['url'] = array('#type' => 'textfield',
+    '#title' => t('URL'),
+    '#default_value' => $edit['url'],
+    '#size' => 100,
+    '#description' => t('The fully-qualified URL of the feed.'),
+    '#attributes' => array('readonly' => 'readonly')
+  );
       
-      $processors = module_invoke_all('feedapi', $feed, 'processor_name');
-      $form['processor'] = array(
-        '#type' => 'select',
-        '#title' => t('Processor'),
-        '#description' => t("Each feed can have it's items generated by a different processor. This allows you to generate different types of content per feed - such as nodes or traditional aggregator items. Re-edit the feed to see processor specific settings."),
-        '#options' => $processors,
-        '#default_value' => $edit['processor'],
-        '#size' => 1,
-        '#required' => TRUE,
-      );
-      break;
+  $form['description'] = array('#type' => 'textarea',
+    '#title' => t('Description'),
+    '#default_value' => $edit['description'],
+    '#rows' => 5,
+    '#description' => t('As supplied by the RSS feed.')
+  );
+    
+  $period = array(0 => t('never')) + drupal_map_assoc(array(300, 900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval');
+  
+  if ($edit['refresh'] == -1) {
+    $edit['refresh'] = 3600;
   }
+
+  $form['refresh'] = array('#type' => 'select',
+    '#title' => t('Update interval'),
+    '#default_value' => $edit['refresh'],
+    '#options' => $period,
+    '#description' => t('The refresh interval indicating how often you want to update this feed. Requires %cron.', array('%cron' => l('crontab', 'admin/settings') )),
+  );
+    
+  $period = array(0 => t('never')) + drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
+
+  $form['expires'] = array(
+    '#type' => 'select',
+    '#title' => t('Discard news items older than'),
+    '#default_value' => $edit['expires'],
+    '#options' => $period,
+    '#description' => t('Older news items will be automatically discarded.  Requires %cron.', array('%cron' => l('crontab', 'admin/settings') ))
+  );
+   
+  // Handling of categories:
+  $form += feedmanager_freetag($edit);
+    
+  $form['advanced'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Advanced'),
+    '#description' => t('These settings are specific to the type of feed processor you have selected.'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+    '#tree' => TRUE
+  );
+    
+  $form['advanced']['update_items'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Update news items'),
+    '#description' => t('If the same news item is found in the feed on the next update the contents will overwrite the previous version stored here.'),
+    '#default_value' => $edit['update_items'] ? $edit['update_items'] : FALSE,
+  );
+    
+  $form['advanced']['processor'] = array('#type' => 'value', '#value' => $edit['processor']);
+    
+  $form['advanced']['stripads'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Strip Adverts'),
+    '#description' => t('Strip out ads from certain advertisers, namely Pheedo, Google AdSense, and certain types of Doubleclick ads.'),
+    '#default_value' => $edit['stripads'] ? $edit['stripads'] : TRUE,
+  );
   
   $form['submit'] = array(
     '#type'          => 'submit',
@@ -337,10 +365,11 @@ function feedmanager_form_feed($edit = a
     $form['fid'] = array('#type' => 'value', '#value' => $edit['fid']);
   }
 
-  return drupal_get_form('feedmanager_form_feed_'.$op, $form);
+  return $form;
 }
 
 
+
 /**
  * Provides a freetagging form element.
  *
