diff -u /home/dopry/drupal-modules/naggregator/naggregator.module naggregator/naggregator.module
--- /home/dopry/drupal-modules/naggregator/naggregator.module	2005-08-09 02:01:28.000000000 -0400
+++ naggregator/naggregator.module	2005-08-10 00:40:42.275274432 -0400
@@ -1,6 +1,22 @@
 <?php
 // $Id: naggregator.module,v 1.3 2005/06/21 14:41:52 ber Exp $
 
+/* changes against 4.6:
+	-setup per feed node_options for automatically loaded feed items
+	-recognizes default node_options set in node/configure/types for 
+	   default item node_options when adding a new feed.
+	-fixed feed title display in  naggregator_admin feeds 
+		removed check_plain in l() since l does it anyway.
+	-move feed list above add form in admin/naggregator
+	-forgot a few but it seems to still work.
+
+   todo:
+   	-fix per feed items_comments settings.
+	dopry, 8/10/05
+	
+*/
+
+
 function naggregator_help($section) {
   switch ($section) {
     case 'admin/modules#description':
@@ -9,10 +25,10 @@
       $output = "<p>This is an alternative version of the aggregate module that comes with Drupal.</p>";
       $output = "<p>Read the INSTALL file carefully, installation of this module is not trivial.</p><p>The main advantage of the naggregator module suite is that RSS items are stored as first class nodes. That means that they can be promoted to home page, queued, commented upon, etc.</p>";
       $output = "<p>Further, RSS item nodes inherit the taxonomy terms that are assigned to their corrosponding feed.</p>";
-      $output = "<p>This rich tagging of items with taxonomy tags creates interesting opportunities for pages consisting of composite feeds from various sites and even composite RSS feeds from multiple sites.</p>"
+      $output = "<p>This rich tagging of items with taxonomy tags creates interesting opportunities for pages consisting of composite feeds from various sites and even composite RSS feeds from multiple sites.</p>";
       $output = "When reposting bugs, please include this veriosn and date \$Date: 2005/06/21 14:41:52 $ \$Revision: 1.3 $";
       return t($output);
-   case "admin/settigns/naggregator":
+   case "admin/settings/naggregator":
       $output = "<p>This page is designed for creation and administration of news feeds. Here you can add new feeds, modify individual settings, and update the content contained in each feed.</p>";
       $output .= "<p>In order to add a feed, you will need to enter the URL and click the \"Add feed\" button. If you wish to update the feed when you add it, simply leave the \"Do initial refresh\" checkbox checked. If you uncheck this box, the feed will not be initialized until you first click \"Refresh.\" If you wish to modify the default settings for feeds, you can do so via the ". l("feed defaults page", "admin/settings/feed").". Alternatively, you can modify the settings for each individual feed by clicking the \"administer\" link on this page.</p>";
       $output .= "<p>If your feed is working correctly, the number of news items that have been sucessfully fetched will then become visible in the items column of the feed overview. Note that most sites request a courtesy time between refreshes so their servers are not overloaded. Please be aware of this and set your feed refreshes accordingly.</p>";
@@ -83,16 +99,16 @@
   }
   elseif ($node->type == 'naggregator-feed') {
     $data = serialize($main_fields);
-    db_query("INSERT INTO {feed} (nid, url, refresh, link, expire, promote, comments) VALUES('%d', '%s', '%d', '%s', '%d', '%d', '%d')", $node->nid, $node->url, $node->refresh, $node->link, $node->expire, $node->items_promote, $node->items_comment);
+    db_query("INSERT INTO {feed} (nid, url, refresh, link, expire, items_status, items_promote, items_comments, items_moderate,items_sticky) VALUES('%d', '%s', '%d', '%s', '%d', '%d', '%d', '%d', '%d','%d')", $node->nid, $node->url, $node->refresh, $node->link, $node->expire, $node->items_status, $node->items_promote, $node->items_comment, $node->items_moderate,$node->items_sticky);
   }
 }
 
 function naggregator_update($node) {
   if ($node->type == 'naggregator-item') {
-    db_query("UPDATE {item} SET parent = '%d', link = '%s', guid = '%s', promote = '%s', comments = '%s' WHERE nid = '%d'", $node->parent, $node->link, $node->guid, $node->items_promote, $node->items_comment, $node->nid);
+    db_query("UPDATE {item} SET parent = '%d', link = '%s', guid = '%s' WHERE nid = '%d'", $node->parent, $node->link, $node->guid,  $node->nid);
   }
   elseif($node->type == 'naggregator-feed') {
-    db_query("UPDATE {feed} SET url = '%s', refresh = '%d', link = '%s', expire = '%d', promote = '%d', comments = '%d' WHERE nid = '%d'", $node->url, $node->refresh, $node->link, $node->expire, $node->items_promote, $node->items_comment, $node->nid);
+    db_query("UPDATE {feed} SET url = '%s', refresh = '%d', link = '%s', expire = '%d', items_status = '%d', items_promote = '%d', items_comments = '%d', items_moderate = '%d', items_sticky = '%d' WHERE nid = '%d'", $node->url, $node->refresh, $node->link, $node->expire, $node->items_statud, $node->items_promote, $node->items_comment, $node->items_moderate, $node->items_sticky, $node->nid);
   }
 }
 
@@ -112,20 +128,24 @@
 
 function naggregator_load($node) {
   if ($node->type == 'naggregator-item') {
-    $node = db_fetch_object(db_query(db_rewrite_sql("SELECT * FROM {item} WHERE nid = '%d'"), $node->nid));
+    $item = db_fetch_object(db_query(db_rewrite_sql("SELECT * FROM {item} WHERE nid = '%d'"), $node->nid));
     $node->feed = node_load(array("nid"=>$item->parent));
-    $node->name = $node->feed->creator ? $node->feed->creator : $node->feed->title;
-    return $node;
-  }
-  elseif ($node->type == 'naggregator-feed') {
-    $promote = $node->promote;
-    $node = db_fetch_object(db_query("SELECT * FROM {feed} WHERE nid = '%d'", $node->nid));
-    
-    $node->items_promote = $feed->promote;
-    $node->items_comment = $feed->comments;
-    $node->promote = $promote;
-    return $node;
+    $node->name = $item->feed->creator ? $item->feed->creator : $item->feed->title;
+  } elseif ($node->type == 'naggregator-feed') {
+  //DOPRY: Should this compare above be dropped since drupal *should* only send requests for 
+  //nodes of type naggregator-feed or naggregator-item here.
+    $feed = db_fetch_object(db_query("SELECT * FROM {feed} WHERE nid = '%d'", $node->nid));
+    $node->items_status = $feed->items_status;
+    $node->items_moderate = $feed->items_moderate;
+    $node->items_promote = $feed->items_promote;
+    $node->items_comment = $feed->items_comments;
+    $node->items_sticky = $feed->items_sticky;
+    $node->expire = $feed->expire;
+    $node->refresh = $feed->refresh;
+    $node->url = $feed ->url;
+    $node->link = $feed->link;
   }
+  return $node;
 }
 
 function naggregator_view(&$node, $teaser = 0, $page = 0) {
@@ -134,15 +154,11 @@
     $node->body = $node->teaser;
   }
   elseif ($node->type == 'naggregator-feed') {
-
     $result = pager_query(db_rewrite_sql("SELECT n.nid FROM {node} n, {item} i WHERE (n.nid = i.nid) AND (n.status = 1) AND (parent = '". $node->nid ."') ORDER BY i.weight DESC, n.created DESC"), ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)), 0);
-
     $output = theme("feed_header", $node);
-    
     while ($item = db_fetch_object($result)) {
       $output .= theme("feed_item", node_load(array("nid" => $item->nid)));
     }
-
     $output .= theme("pager", "", ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)), 0);
     $node->body = $output;
   }
@@ -150,10 +166,11 @@
 
 function naggregator_settings() {
   $expires = array(0 => t("Never"), 604800 => t("One week"), 1209600 => t("Two weeks"), 2419200 => t("Four weeks"),7257600 => t("3 Months"),14515200 =>t("6 Months"),31449600 => t("One Year"));
-
+  
   $output .= form_textfield(t("Update interval"), "feed_refresh", variable_get("feed_refresh", "60"), 10, 10, t("The refresh interval indicating how often you want to update this feed, in minutes.  Requires crontab."));
   $output .= form_select(t("Items expire in"), "feed_expire", variable_get("feed_expire", "2419200"), $expires, t("Indicate wether items from this feed should be automatically deleted."));
-  $output .= form_select(t("Auto-promotion of news item is"), "feed_items_promote", variable_get("feed_items_promote", "0"), array(t("Disabled"), t("Enabled")));
+
+  //DOPRY: Ber, is this moderate the same as the node option 'In moderation queue'?
   if (module_exist("queue")) {
     $output .= form_select(t("Moderation of news item"), "feed_items_moderate", variable_get("feed_items_moderate", "0"), array(("Disabled"), t("Enabled")));
   }
@@ -198,10 +215,11 @@
   $node->title = $title;
   $node->teaser = $body;
   $node->body = $body;
-  $node->status = 1;
+  $node->status = $feed->items_status;
   $node->moderate = $feed->items_moderate;
   $node->comment = $feed->items_comment;
   $node->promote = $feed->items_promote;
+  $node->sticky  = $feed->items_sticky;
   $node->revision = 0;
   $node->guid = $guid;
   $node->link = $link;
@@ -306,7 +324,7 @@
   }
 
   if ($op == "sources") {
-    $result = db_query("SELECT nid FROM {node} WHERE (status = '1') AND (type = \"naggregator-feed\") ORDER BY title");
+    $result = db_query("SELECT nid FROM {node} n WHERE (status = '1') AND (type = \"naggregator-feed\") ORDER BY title");
     while ($source = db_fetch_object($result)) {
       $sources[] = $source->nid;
     }
@@ -316,17 +334,15 @@
 
 function naggregator_link($type, $node = 0, $teaser = 0) {
   global $user;
-
-  if ($teaser && $node->type == "naggregator-item") {
-    $links[] = l(t("feed"), "node/$node->parent", array("title" => t("Read more news from this feed.")));
-  }
-  elseif ($node->link && $node->type == "naggregator-item") {
-    $links[] = "<a href=\"$node->link\" title=\"visit $node->title\">";
+  if ($node->type == "naggregator-item") {
+        $links[] = l(t("feed"), "node/$node->parent", array("title" => t("Read more news from this feed.")));
+        if ($node->link != '' && $node->type == "naggregator-item") {
+            $links[] = "<a href=\"$node->link\" title=\"visit $node->title\">Original Article</a>";
+        }
   }
   elseif ($teaser && ($node->type == "naggregator-feed")) {
     $links[] = l(t("read more"), "node/$node->nid", array("title" => t("Read more news from this feed.")));
   }
-
   return $links ? $links : array();
 }
 
@@ -335,7 +351,7 @@
 }
 
 function naggregator_page_latest() {
-  $result = pager_query(db_rewrite_sql("SELECT nid FROM {node} WHERE type = 'naggregator-item' ORDER BY created DESC, nid DESC"), variable_get("default_nodes_main", 10), 0);
+  $result = pager_query(db_rewrite_sql("SELECT nid FROM {node} n WHERE type = 'naggregator-item' ORDER BY created DESC, nid DESC"), variable_get("default_nodes_main", 10), 0);
 
   while ($naggregator_node = db_fetch_object($result)) {
     $output .= theme("naggregator_latestitem", node_load(array("nid" => $naggregator_node->nid)));
@@ -368,7 +384,7 @@
 }
 
 function naggregator_page_sources() {
-  $result = pager_query(db_rewrite_sql("SELECT nid FROM {node} WHERE type = 'naggregator-feed' ORDER BY title, created"), variable_get("default_nodes_main", 10), 0);
+  $result = pager_query(db_rewrite_sql("SELECT nid FROM {node} n WHERE type = 'naggregator-feed' ORDER BY title, created"), variable_get("default_nodes_main", 10), 0);
 
   while ($naggregator_source = db_fetch_object($result)) {
     $output .= theme("naggregator_source", node_load(array("nid" => $naggregator_source->nid)));
@@ -453,7 +469,21 @@
     $output .= form_textarea(t("Description"), "body", $node->body, 55, 10, t("Phrase or sentence describing the channel."));
     $output .= form_textfield(t("Update interval"), "refresh", $node->refresh, 10, 10, t("The refresh interval indicating how often you want to update this feed, in minutes.  Requires crontab."));
     $output .= form_select(t("Items expire in"), "expire", $node->expire ? $node->expire : 0, $expires, t("Indicate wether items from this feed should be automatically deleted."));
-    $output .= form_select(t("Auto-promotion of news item is"), "items_promote", $node->items_promote, array(t("Disabled"), t("Enabled")));
+
+//put options here
+  $item_options = variable_get('node_options_naggregator-item',array(''));
+  $options .= form_checkbox(t('Published'), 'items_status', 1, isset($edit->items_status) ? $edit->items_status : in_array('status', $item_options));
+  $options .= form_checkbox(t('In moderation queue'), 'items_moderate', 1, isset($edit->moderate) ? $edit->items_moderate : in_array('moderate', $item_options));
+  $options .= form_checkbox(t('Promoted to front page'), 'items_promote', 1, isset($edit->promote) ? $edit->items_promote : in_array('promote', $item_options));
+  $options .= form_checkbox(t('Sticky at top of lists'), 'items_sticky', 1, isset($edit->sticky) ? $edit->items_sticky : in_array('sticky', $item_options));
+
+  $add_form .= '<div class="options">';
+  $add_form .= form_group(t('Default Item Options for Feed.'), $options);
+  $add_form .= "</div>\n";
+  $add_form .= form_submit(t("Add feed"), "edit[op]");
+ 
+  $output .= $add_form;
+  
     if (module_exist('comment')) {
       $output .= form_select(t("Allow user comments on news items"), "items_comment", $node->items_comment, array(("Disabled"), t("Read only"), t("Read-write")));
     }
@@ -483,6 +513,7 @@
   return theme("box", $node->title, $output);
 }
 
+//DOPRY todo add link display.
 function theme_feed_item($item) {
   return theme("node", $item, 0);
 }
@@ -637,14 +668,24 @@
         break;
     }
   }
-  
+ 
+ 
   $add_form = form_textfield(t("URL"), "url", $edit["url"], 50, 255, t("The URL to the RSS/RDF file"));
   $add_form .= form_checkbox(t("Automatically refresh"), "update", 1, 1);
   if (function_exists("taxonomy_node_form")) {
     $add_form .= implode("", taxonomy_node_form("feed", $node));
   }
+ 
+  $item_options = variable_get('node_options_naggregator-item',array(''));
+  $options .= form_checkbox(t('Published'), 'items_status', 1, isset($edit->items_status) ? $edit->items_status : in_array('status', $item_options));
+  $options .= form_checkbox(t('In moderation queue'), 'items_moderate', 1, isset($edit->moderate) ? $edit->items_moderate : in_array('moderate', $item_options));
+  $options .= form_checkbox(t('Promoted to front page'), 'items_promote', 1, isset($edit->promote) ? $edit->items_promote : in_array('promote', $item_options));
+  $options .= form_checkbox(t('Sticky at top of lists'), 'items_sticky', 1, isset($edit->sticky) ? $edit->items_sticky : in_array('sticky', $item_options));
+
+  $add_form .= '<div class="options">';
+  $add_form .= form_group(t('Default Item Options for Feed.'), $options);
+  $add_form .= "</div>\n";
   $add_form .= form_submit(t("Add feed"), "edit[op]");
-  $output .= form($add_form, "post", url("admin/naggregator"));
 
   $header = array(t("title"), t("items"), t("last update"), array("data" => t("operations"), "colspan" => 2));
   
@@ -654,7 +695,7 @@
     $refresh = form_hidden("nid", "$feed->nid");
     $refresh .= form_submit(t("Refresh"), "edit[op]");
     $rows[] = array(
-        l(check_plain($feed->title), "node/$feed->nid", array("title" => t("View this news feed."))),
+        l($feed->title, "node/$feed->nid", array("title" => t("View this news feed."))),
         $feed->numitems,
         format_interval(time() - $feed->changed),
         l(t("administer"), "node/$feed->nid/edit", array("title" => t("administer this news feed."))),
@@ -662,13 +703,14 @@
         );
   }
   $output .= theme("table", $header, $rows);
+  $output .= form($add_form, "post", url("admin/naggregator"));
   print theme('page', $output);
 }
 
 function naggregator_get_feeds() {
   $nodes = array("0" => "<none>");
 
-  $result = db_query(db_rewrite_sql("SELECT nid, title FROM {node} WHERE (status = '1') AND (type = \"naggregator-feed\") ORDER BY title"));
+  $result = db_query(db_rewrite_sql("SELECT nid, title FROM {node} n WHERE (status = '1') AND (type = \"naggregator-feed\") ORDER BY title"));
   while ($row = db_fetch_object($result)) {
     $nodes[$row->nid] = $row->title;
   }
@@ -678,6 +720,8 @@
 
 function naggregator_add_from_url($url, $taxonomy, $refresh = 0) {
   global $user;
+  global $edit;
+  $edit = $_POST[edit];
   $tmp_feed = NULL;
 
   if (!valid_url($url, TRUE)) {
@@ -710,9 +754,11 @@
         "creator" => $info->creator,
         "refresh" => variable_get("feed_refresh", "60"),
         "expire" => variable_get("feed_expire", "2419200"),
-        "items_promote" => variable_get("feed_items_promote", "0"),
-        "items_moderate" => variable_get("feed_items_moderate", "0"),
-        "items_comment" => variable_get("feed_items_comment", "0")
+	"items_status" => $edit[items_status],
+        "items_promote" => $edit[items_promote],
+        "items_moderate" => $edit[items_moderate],
+        "items_comment" => $edit[items_comment],
+	"items_sticky" => $edit[items_sticky]
         );
     $node = node_validate($fields, $error);
 
@@ -745,7 +791,7 @@
 
 function naggregator_block($op = "list", $delta = 0) {
   if ($op == "list") {
-    $feeds = db_query("SELECT nid, title FROM {node} WHERE (status = '1') AND (type = \"naggregator-feed\") ORDER BY nid");
+    $feeds = db_query("SELECT nid, title FROM {node} n WHERE (status = '1') AND (type = \"naggregator-feed\") ORDER BY nid");
     $num = 0;
     while ($feed = db_fetch_object($feeds)) {
       $block[$num]["info"] = t($feed->title);
@@ -755,7 +801,7 @@
   }
   else {
     if (user_access("access news feeds")) {
-      $nid = array_shift(db_fetch_array(db_query("SELECT nid, title FROM {node} WHERE (status = '1') AND (type = \"naggregator-feed\") ORDER BY nid LIMIT $delta, 1")));
+      $nid = array_shift(db_fetch_array(db_query("SELECT nid, title FROM {node} n WHERE (status = '1') AND (type = \"naggregator-feed\") ORDER BY nid LIMIT $delta, 1")));
       $feed = node_load(array("nid" => $nid));
       $items = db_query("SELECT n.nid, n.title FROM {node} n, {item} i WHERE (n.nid = i.nid) AND (i.parent = '%s') ORDER BY i.weight DESC, n.created DESC, n.title LIMIT 10", $nid);
       $block["subject"] = t($feed->title);
diff -u /home/dopry/drupal-modules/naggregator/naggregator.mysql naggregator/naggregator.mysql
--- /home/dopry/drupal-modules/naggregator/naggregator.mysql	2005-08-09 02:02:19.000000000 -0400
+++ naggregator/naggregator.mysql	2005-08-10 00:22:37.565175432 -0400
@@ -15,6 +15,13 @@
   link varchar(255) NOT NULL default '',
   data text,
   expire int(10) NOT NULL default '0',
+  items_status tinyint(4) NOT NULL default '0',
+  items_promote tinyint(4) NOT NULL default '0',
+  items_comments tinyint(4) NOT NULL default '0',
+  items_moderate tinyint(4) NOT NULL default '0',
+  items_sticky tinyint(4) NOT NULL default '0',
+
+
   PRIMARY KEY  (nid),
   KEY link (link),
   KEY url (url)
