I'm impressed with the aggregator2 module, but it lacks one feature that is currently available in the existing aggregator module: the ability to display a headlines page for each feed. It lets administrators enable a BLOCK for each feed, but not a headlines PAGE.

I've written some code that should do the trick and am attaching it here as a patch.

Comments

ahwayakchih’s picture

Sounds interesting, but i can't download it (looks like Drupal.org's settings don't allow downloading of .module extensions). Could You upload it zipped?

sheldon rampton’s picture

StatusFileSize
new2.81 KB

Here's the same file with the extension .patch at the end rather than at the beginning.

blogfuse’s picture

Awesome work! It seems to work great, but I'll test some more. Is there any way that only the feed items that are new since the users last visit are displayed? Also, maybe the ability to mark items as read would be helpful too. Much like a news reader like Bloglines, or MyYahoo.

ahwayakchih’s picture

Thanks for patch!

To say the truth i'm against idea to add special "listing" pages to each module. It should be done somehow by Drupal core.
But looks like users want it now :) so...

What would You say about writing additional module for that? Small module which generates page. Maybe with additional setting to allow admin to select how to list items: only titles or whole teasers.
It could also export special "sources" block, instead of adding items to menu by default.

I'd like it more as additional module because, for example, i use taxonomy to group items and feeds together. So on my site i don't need special page for that.

sheldon rampton’s picture

ahwayakchih wrote:

"To say the truth i'm against idea to add special "listing" pages to each module. It should be done somehow by Drupal core."

This is never going to happen with the news feeds from aggregator2.module. How would Drupal core know that aggregator2 uses sources to create news feeds, and then know how to list those feeds? Drupal core already provides a way to list nodes by node type, but how would it know how to list feeds by feed ID (fid), which is a data field that has been created by aggregator2 very specifically for its own purposes?

The aggregator module that currently comes included as Drupal core does include listings of feeds selected by "source" as well as by "category." I like the fact that aggregator2 uses Drupal taxonomies instead of the "category" feature in aggregator. This provides an adequate (and in several ways more flexible and powerful) way of duplicating aggregegator's functionality for listing by category. However, your module currently doesn't provide any equivalent way of listing by source. The reason I downloaded and started testing your module is that the description seemed to suggest that I could use it as a replacement for the standard aggregator module, because "None of the standard RSS aggregation and display has been removed -- only extended and/or made more flexible." In fact, however, the ability to list items grouped by feed has been removed. My patch adds that functionality to your module and makes it more suitable as a full replacement for the standard aggregator module.

ahwayakchih also wrote: "What would You say about writing additional module for that? Small module which generates page."

The patch that I submitted contains most of the code you would need to create a separate additional module. If you want to use it that way, go ahead, but I'm not going to write and maintain it myself. I have several other modules that I've created and am therefore responsible for maintaining, and I don't have the time to take on responsibility for being the public administrator of yet another. I'm happy to provide you with the code patch, which you are free to use or not use as you please, but I'm not able to take on the additional responsibility of managing another Drupal module.

From the point of view of good software design, moreover, I think the functionality added by my patch belongs in your module rather than in a separate module. My code doesn't provide any standalone functionality. It requires aggregator2 to work at all, and only adds one feature to your module. I think it would be cumbersome for website administrators if they needed to download and install a separate module just to add that one feature. And if there are other people like yourself who don't want this particular feature, they can use admin/menu to disable the feed listings that my patch enables.

Of course, aggregator2 is your module, so please do what you think is best.

ahwayakchih’s picture

This is never going to happen with the news feeds from aggregator2.module. How would Drupal core know that aggregator2 uses sources to create news feeds, and then know how to list those feeds? Drupal core already provides a way to list nodes by node type, but how would it know how to list feeds by feed ID (fid), which is a data field that has been created by aggregator2 very specifically for its own purposes?

It could use solution similar to db_rewrite_sql(). OR make node_page_default() function (or it's clone) more generic, where one of args would be SQL query :).

The reason I downloaded and started testing your module is that the description seemed to suggest that I could use it as a replacement for the standard aggregator module, because "None of the standard RSS aggregation and display has been removed -- only extended and/or made more flexible." In fact, however, the ability to list items grouped by feed has been removed. My patch adds that functionality to your module and makes it more suitable as a full replacement for the standard aggregator module.

I agree with You on that part (ie. about missing aggregator2/sources url). I've added page in CVS. I used node_page_default() function as base to make it show full node teasers like in common node listing (or taxonomy based listing).
Instead of adding menu item to user's menu i added block generation with last 10 updated feeds and link to aggregator2/sources page (listing all sources).

I'm happy to provide you with the code patch, which you are free to use or not use as you please, but I'm not able to take on the additional responsibility of managing another Drupal module.

I was thinking about "minimodule" thing like it was done with autotaxonomy by Mike Carter. He wrote first thing, and i keep it maintained (but he also is welcome to provide additional changes of course :).
But thanks for patch anyway :)

From the point of view of good software design, moreover, I think the functionality added by my patch belongs in your module rather than in a separate module. My code doesn't provide any standalone functionality. It requires aggregator2 to work at all, and only adds one feature to your module.

Sorry, but i think You're exaggerating on this. First, "good software design" can be viewed/understood completly different by different people ;) I think good design is the one which is modular, with each part more or less easy to replace or remove.
Aggregator2 does work without such page - it may be harder to select items by feed, but that doesn't mean that module doesn't work. Please remember that main functionality of aggregator is to aggregate nodes, and AFAIK it does that very well.

In any case, if You'll have some free time and would like to test new CVS version it would be great!
Thanks again for Your interest and help :)

sheldon rampton’s picture

ahwayakchih wrote: "Sorry, but i think You're exaggerating on this. First, "good software design" can be viewed/understood completly different by different people ;) I think good design is the one which is modular, with each part more or less easy to replace or remove."

I agree that "good software design" can be understood differently by different people, and maybe we'll just have to agree to disagree on this point. However, if "good design" is one in which "each part is more or less easy to replace or remove," I think using a separate module to list aggregator2 sources makes replacing or removing parts harder rather than easier. For the sake of discussion, let's suppose that the mini-module that lists aggregatator2 sources is named "aggregator2_sourcelist.module." Anyone who wants to use it would need to first have aggregator2 installed, and if they installed aggregator2_sourcelist.module by itself, all they'd get would be an error. If at some later point they decide to disable aggregator2, they'd also have to disable aggregator2_sourcelist. That would be harder, in my opinion, than simply enabling or disabling the sources menu when they're configuring the module.

Anyway, that's my opinion, and you may well disagree. I'll take a look at your CVS changes and let you know if I have any comments.

ahwayakchih’s picture

Anyone who wants to use it would need to first have aggregator2 installed, and if they installed aggregator2_sourcelist.module by itself, all they'd get would be an error.

No module, even if it depends on other should show errors, do wrong things, in such case. It has to check if other things are in place (just a simple function_exists() call is enough). So at worst case it would just show message that it can't show anything because there's no data. And only to administrator - so he/she know it doesn't make sense to use this module without other one (similarly to taxonomy and node modules - no sense in using taxonomy if there's no node module. or even any other "node based" module).

If at some later point they decide to disable aggregator2, they'd also have to disable aggregator2_sourcelist. That would be harder, in my opinion, than simply enabling or disabling the sources menu when they're configuring the module.

Hmm... disabling two modules is unchecking two checkboxes on the same page. It's more or less the same count of clicks as with menu (or even less because disabling menu item and it's children has to be done one by one AFAIK). That's in case You disable aggregator2.module. If You want to disable only sources page then You have to uncheck one checkbox on modules page, or disable all menu items on menu page.

Anyway, that's my opinion, and you may well disagree. I'll take a look at your CVS changes and let you know if I have any comments.

Ok, thanks! :)

ahwayakchih’s picture

One more thing about menus. If user wants to diable aggregator.module than yes, it's simpler if sources page is inside that module. But its simpler only by one click on modules page :).

ahwayakchih’s picture

Status: Needs review » Closed (fixed)

Sources page was added. Probably will be moved to separate module later.