Index: openacs-4/packages/news-aggregator/news-aggregator.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/news-aggregator.info,v diff -u -r1.13.2.3 -r1.13.2.4 --- openacs-4/packages/news-aggregator/news-aggregator.info 4 Jan 2006 16:51:21 -0000 1.13.2.3 +++ openacs-4/packages/news-aggregator/news-aggregator.info 14 Jan 2006 23:27:58 -0000 1.13.2.4 @@ -8,14 +8,14 @@ f na - + Guan Yang Michael Steigman Read news sources from your website. - 2006-01-04 + 2006-01-13 The news aggregator periodically reads a set of news sources, in one of several XML-based formats, finds the new bits, and displays them in reverse-chronological order on a single page. - + Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/news-aggregator/todo'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-packages-create.sql,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-packages-create.sql 1 Jun 2004 10:59:18 -0000 1.2 +++ openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-packages-create.sql 14 Jan 2006 23:27:59 -0000 1.2.2.1 @@ -136,7 +136,6 @@ varchar, -- description varchar, -- last_modified boolean, -- listed_p - integer, -- package_id integer, -- creation_user varchar -- creation_ip ) returns integer as ' @@ -148,9 +147,8 @@ p_description alias for $5; p_last_modified alias for $6; p_listed_p alias for $7; - p_package_id alias for $8; - p_creation_user alias for $9; - p_creation_ip alias for $10; + p_creation_user alias for $8; + p_creation_ip alias for $9; v_source_id integer; begin v_source_id := acs_object__new ( @@ -159,7 +157,7 @@ current_timestamp, p_creation_user, p_creation_ip, - p_package_id + null ); insert into na_sources ( @@ -182,12 +180,6 @@ p_listed_p ); - PERFORM acs_permission__grant_permission( - v_source_id, - p_creation_user, - ''admin'' - ); - return v_source_id; end;' language 'plpgsql'; Index: openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-tables-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-tables-create.sql,v diff -u -r1.2.2.2 -r1.2.2.3 --- openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-tables-create.sql 4 Jan 2006 16:48:04 -0000 1.2.2.2 +++ openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-tables-create.sql 14 Jan 2006 23:27:59 -0000 1.2.2.3 @@ -209,6 +209,7 @@ package_id integer constraint na_user_preferences_pid_fk references apm_packages(package_id) + on delete cascade constraint na_user_preferences_pid_nn not null, constraint na_user_prefs_pk primary key (user_id, package_id) Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/news-aggregator/sql/postgresql/upgrade/upgrade-0.9.7-0.9.8.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/news-aggregator/tcl/aggregator-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/aggregator-procs-postgresql.xql,v diff -u -r1.2.2.1 -r1.2.2.2 --- openacs-4/packages/news-aggregator/tcl/aggregator-procs-postgresql.xql 28 Dec 2005 17:55:43 -0000 1.2.2.1 +++ openacs-4/packages/news-aggregator/tcl/aggregator-procs-postgresql.xql 14 Jan 2006 23:27:59 -0000 1.2.2.2 @@ -17,10 +17,10 @@ select s.source_id, s.link, + su.show_description_p, s.description, s.title, to_char(i.creation_date, 'YYYY-MM-DD HH24:MI:SS') as last_scanned, - to_char(i.creation_date, 'YYYY-MM-DD HH24') as sort_date, s.feed_url, i.item_id, i.title as item_title, @@ -31,6 +31,7 @@ i.original_guid as item_original_guid, i.permalink_p as item_permalink_p, i.author as item_author, + to_char(i.pub_date at time zone 'UTC', 'YYYY-MM-DD') as sort_date, to_char(i.pub_date at time zone 'UTC', 'YYYY-MM-DD HH24:MI:SS') as item_pub_date, s.last_modified from ( @@ -42,7 +43,7 @@ where a.package_id = :package_id and a.aggregator_id = :aggregator_id $items_purges - order by i.item_id desc + order by item_pub_date desc limit $sql_limit Index: openacs-4/packages/news-aggregator/tcl/aggregator-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/aggregator-procs.tcl,v diff -u -r1.1.1.1.2.3 -r1.1.1.1.2.4 --- openacs-4/packages/news-aggregator/tcl/aggregator-procs.tcl 2 Jan 2006 20:49:46 -0000 1.1.1.1.2.3 +++ openacs-4/packages/news-aggregator/tcl/aggregator-procs.tcl 14 Jan 2006 23:27:59 -0000 1.1.1.1.2.4 @@ -384,8 +384,8 @@ if { [string equal $package_id ""] } { set package_id [ad_conn package_id] } - if { [string equal $user_id ""] } { - set user_id [ad_conn user_id] + if { [string equal $creation_user ""] } { + set creation_user [ad_conn user_id] } if { [string equal $creation_ip ""] } { set creation_ip [ad_conn peeraddr] @@ -396,7 +396,7 @@ # find app group and assign correct privileges # (public = viewable by subsite members) set app_group [application_group::group_id_from_package_id \ - -package_id [ad_conn subsite_id] + -package_id [ad_conn subsite_id]] if { !$public_p } { permission::toggle_inherit -object_id $aggregator_id foreach priv {read write create} { @@ -409,6 +409,7 @@ -object_id $aggregator_id -privilege $priv } } + return $aggregator_id } ad_proc -public news_aggregator::aggregator::delete { Index: openacs-4/packages/news-aggregator/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/apm-callback-procs.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/news-aggregator/tcl/apm-callback-procs.tcl 28 Dec 2005 18:40:38 -0000 1.1.2.2 +++ openacs-4/packages/news-aggregator/tcl/apm-callback-procs.tcl 14 Jan 2006 23:27:59 -0000 1.1.2.3 @@ -16,7 +16,8 @@ news_aggregator::aggregator::delete -aggregator_id $aggregator_id } - db_foreach select_instance_sources {} { + # delete any dangling sources + db_foreach select_unused_sources {} { news_aggregator::source::delete -source_id $source_id } } @@ -46,5 +47,24 @@ } } } + 0.9.7 0.9.8 { + db_foreach get_sources { + select source_id + from na_sources + } { + + db_dml clear_context_id { + update acs_objects + set context_id = null + where object_id = :source_id + } + + db_dml clear_perms { + delete from acs_permissions + where object_id = :source_id + } + + } + } } } Index: openacs-4/packages/news-aggregator/tcl/apm-callback-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/Attic/apm-callback-procs.xql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/news-aggregator/tcl/apm-callback-procs.xql 28 Dec 2005 17:55:43 -0000 1.1.2.1 +++ openacs-4/packages/news-aggregator/tcl/apm-callback-procs.xql 14 Jan 2006 23:27:59 -0000 1.1.2.2 @@ -2,7 +2,7 @@ - + select a.aggregator_id from acs_objects o, na_aggregators a @@ -11,13 +11,12 @@ - + - select s.source_id - from acs_objects o, na_sources s - where s.source_id = o.object_id - and o.context_id = :package_id + select s.source_id from na_sources s where source_id not in ( + select distinct source_id from na_subscriptions + ) - \ No newline at end of file + Index: openacs-4/packages/news-aggregator/tcl/news-aggregator-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/news-aggregator-init.tcl,v diff -u -r1.1.1.1 -r1.1.1.1.2.1 --- openacs-4/packages/news-aggregator/tcl/news-aggregator-init.tcl 20 Mar 2004 11:04:39 -0000 1.1.1.1 +++ openacs-4/packages/news-aggregator/tcl/news-aggregator-init.tcl 14 Jan 2006 23:27:59 -0000 1.1.1.1.2.1 @@ -1 +1,5 @@ +# update sources every 15 mins ad_schedule_proc -thread t 900 news_aggregator::source::update_all +# delete old items every day +ad_schedule_proc -thread t 86400 news_aggregator::items_cleanup +# time interval for both scheduled procs should be site-wide parameter Index: openacs-4/packages/news-aggregator/tcl/news-aggregator-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/Attic/news-aggregator-procs-postgresql.xql,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/news-aggregator/tcl/news-aggregator-procs-postgresql.xql 27 Feb 2005 17:07:20 -0000 1.5 +++ openacs-4/packages/news-aggregator/tcl/news-aggregator-procs-postgresql.xql 14 Jan 2006 23:27:59 -0000 1.5.2.1 @@ -50,9 +50,16 @@ - + - delete from na_items where date + interval '2 month' < now() + delete + from na_items + where item_id not in (select item_id + from na_saved_items) + and item_id < (select min(aggregator_bottom) + from na_aggregators) + and creation_date < current_timestamp - '180 days' :: interval +-- delete from na_items where date + interval '2 month' < now() Index: openacs-4/packages/news-aggregator/tcl/news-aggregator-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/news-aggregator-procs.tcl,v diff -u -r1.9.2.3 -r1.9.2.4 --- openacs-4/packages/news-aggregator/tcl/news-aggregator-procs.tcl 2 Jan 2006 20:41:33 -0000 1.9.2.3 +++ openacs-4/packages/news-aggregator/tcl/news-aggregator-procs.tcl 14 Jan 2006 23:27:59 -0000 1.9.2.4 @@ -67,3 +67,25 @@ return $to_return } +ad_proc -private news_aggregator::items_cleanup {} { + Clean out old items +} { + db_dml vacuum {} +} + +ad_proc -private news_aggregator::chunk_updated { updated_day } { + Clean out old items +} { + set days [expr $updated_day / 1440] + switch $days { + 0 { + return "Today" + } + 1 { + return "Yesterday" + } + default { + return "$days Days Ago" + } + } +} \ No newline at end of file Index: openacs-4/packages/news-aggregator/tcl/source-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/source-procs-postgresql.xql,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/news-aggregator/tcl/source-procs-postgresql.xql 2 Jan 2006 20:49:46 -0000 1.6.2.1 +++ openacs-4/packages/news-aggregator/tcl/source-procs-postgresql.xql 14 Jan 2006 23:27:59 -0000 1.6.2.2 @@ -45,12 +45,11 @@ select na_source__new ( :source_id, :feed_url, - :link, + :link, :title, :description, - :last_modified, + :last_modified, '1', - :package_id, :user_id, :creation_ip ) Index: openacs-4/packages/news-aggregator/tcl/source-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/source-procs.tcl,v diff -u -r1.6.2.4 -r1.6.2.5 --- openacs-4/packages/news-aggregator/tcl/source-procs.tcl 2 Jan 2006 20:36:48 -0000 1.6.2.4 +++ openacs-4/packages/news-aggregator/tcl/source-procs.tcl 14 Jan 2006 23:27:59 -0000 1.6.2.5 @@ -13,7 +13,6 @@ ad_proc -public news_aggregator::source::new { -feed_url:required -user_id:required - -package_id:required {-aggregator_id ""} -array:boolean } { Index: openacs-4/packages/news-aggregator/tcl/subscription-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/Attic/subscription-procs.xql,v diff -u -r1.2.2.1 -r1.2.2.2 --- openacs-4/packages/news-aggregator/tcl/subscription-procs.xql 2 Jan 2006 20:40:16 -0000 1.2.2.1 +++ openacs-4/packages/news-aggregator/tcl/subscription-procs.xql 14 Jan 2006 23:27:59 -0000 1.2.2.2 @@ -36,4 +36,32 @@ + + + insert into na_subscriptions ( + aggregator_id, + source_id, + creation_date + ) values ( + :copy_to, + :source_id, + current_timestamp + ) + + + + + + insert into na_subscriptions ( + aggregator_id, + source_id, + creation_date + ) values ( + :aggregator_id, + :source_id, + current_timestamp + ) + + + Index: openacs-4/packages/news-aggregator/www/aggregator-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/Attic/aggregator-add.adp,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/news-aggregator/www/aggregator-add.adp 28 Dec 2005 17:55:43 -0000 1.1.2.1 +++ openacs-4/packages/news-aggregator/www/aggregator-add.adp 14 Jan 2006 23:27:59 -0000 1.1.2.2 @@ -3,4 +3,4 @@ @context@

@page_title;noquote@

- \ No newline at end of file + Index: openacs-4/packages/news-aggregator/www/aggregator-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/Attic/aggregator-add.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/news-aggregator/www/aggregator-add.tcl 1 Jan 2006 19:44:38 -0000 1.1.2.2 +++ openacs-4/packages/news-aggregator/www/aggregator-add.tcl 14 Jan 2006 23:27:59 -0000 1.1.2.3 @@ -4,7 +4,6 @@ @author Simon Carstensen @cvs-id $Id$ } { - aggregator_id:integer,notnull,optional {return_url ""} } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/news-aggregator/www/aggregator-edit.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/news-aggregator/www/aggregator-edit.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/news-aggregator/www/aggregator.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/aggregator.adp,v diff -u -r1.2.2.2 -r1.2.2.3 --- openacs-4/packages/news-aggregator/www/aggregator.adp 4 Jan 2006 05:31:08 -0000 1.2.2.2 +++ openacs-4/packages/news-aggregator/www/aggregator.adp 14 Jan 2006 23:27:59 -0000 1.2.2.3 @@ -1,12 +1,5 @@ - - -@page_title@ -@context@ aggregator.aggregator_name -

-Edit attributes for this aggregator: -

Index: openacs-4/packages/news-aggregator/www/aggregator.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/aggregator.tcl,v diff -u -r1.4.2.3 -r1.4.2.4 --- openacs-4/packages/news-aggregator/www/aggregator.tcl 4 Jan 2006 05:31:08 -0000 1.4.2.3 +++ openacs-4/packages/news-aggregator/www/aggregator.tcl 14 Jan 2006 23:27:59 -0000 1.4.2.4 @@ -18,11 +18,7 @@ -privilege write } -set page_title "Edit Aggregator Info" -array set ag_info [news_aggregator::aggregator::aggregator_info -aggregator_id $aggregator_id] -set context [list [list "." "$ag_info(aggregator_name)"] "$page_title"] - -ad_form -name aggregator -select_query_name select_aggregator -form { +ad_form -name aggregator -action aggregator -select_query_name select_aggregator -form { {aggregator_id:integer(hidden),key} {aggregator_name:text {label "Name"} Index: openacs-4/packages/news-aggregator/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/index.adp,v diff -u -r1.12.2.6 -r1.12.2.7 --- openacs-4/packages/news-aggregator/www/index.adp 4 Jan 2006 05:35:34 -0000 1.12.2.6 +++ openacs-4/packages/news-aggregator/www/index.adp 14 Jan 2006 23:27:59 -0000 1.12.2.7 @@ -1,8 +1,8 @@ @page_title@ @context@ - @@ -18,10 +18,10 @@

- You can hit the Purge button to clean out the page. Clicking the Save button will prevent an item from being purged. + You can hit the Purge button to clean out the page. Clicking the Save button will prevent an item from being purged. - Click the Blog button to post the item to a weblog (you will have a choice of weblogs to post to). + Click the Blog button to post the item to a weblog (you will have a choice of weblogs to post to). @@ -38,9 +38,9 @@

@@ -53,38 +53,60 @@ - -

- @items.title@ #news-aggregator.updated_x_time_ago# + +
+ @items.title;noquote@, from @items.chunk_updated@ @items.pub_date@
-
- -
- - @items.item_title@ - + +
+ +
+ + @items.item_title;noquote@ @items.pub_date@ + +
+
Posted: @items.pub_time@ + + # + +
+ @items.content;noquote@ +
+ + + Save + + + Unsave + + + + Blog + +
-
Posted: @items.pub_date@ - - # - -
- @items.content;noquote@ -
- + + +
+ + @items.item_title;noquote@ + Posted: @items.pub_time@  + + # +   + Save Unsave - - - Blog - -
-
+
+ + Blog +
+ Index: openacs-4/packages/news-aggregator/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/index.tcl,v diff -u -r1.9.2.5 -r1.9.2.6 --- openacs-4/packages/news-aggregator/www/index.tcl 1 Jan 2006 19:44:38 -0000 1.9.2.5 +++ openacs-4/packages/news-aggregator/www/index.tcl 14 Jan 2006 23:27:59 -0000 1.9.2.6 @@ -42,6 +42,7 @@ -public_p 0 \ -creation_user $user_id \ -creation_ip [ad_conn peeraddr]] + news_aggregator::aggregator::set_user_default -user_id $user_id \ -package_id $package_id -aggregator_id $aggregator_id @@ -168,7 +169,10 @@ item_blog_url technorati_url item_guid_link + pub_sort_date + chunk_updated pub_date + pub_time } items items $items_query { if { $enable_purge_p } { # Top is the first item @@ -211,17 +215,18 @@ } else { set item_guid_link $item_link } - - set diff [news_aggregator::last_scanned -diff [expr [expr [clock seconds] - [clock scan $last_scanned]] / 60]] + set multiple_sources [expr [db_string count "select count(*) from na_subscriptions where aggregator_id = :aggregator_id"] > 1] + #set diff [news_aggregator::last_scanned -diff [expr [expr [clock seconds] - [clock scan $last_scanned]] / 60]] set source_url [export_vars -base source {source_id}] set technorati_url "http://www.technorati.com/cosmos/links.html?url=$link&sub=Get+Link+Cosmos" - set localtime [clock scan [lc_time_utc_to_local $item_pub_date] -gmt 1] - set utctime [clock scan $item_pub_date -gmt 1] - if { $utctime > [clock scan "1 day ago" -gmt 1] } { - set pub_date [clock format $utctime -format "%I:%M %p"] + set localtime [clock scan [lc_time_utc_to_local $item_pub_date]] + set pub_date [clock scan [clock format $localtime -format "%Y-%m-%d 00:00:00"]] + set chunk_updated [news_aggregator::chunk_updated [expr [expr [clock seconds] - $pub_date] / 60]] + if { $pub_date > [clock scan "2 days ago" -gmt 1] } { + set pub_time [clock format $localtime -format "%I:%M %p"] } else { - set pub_date [clock format $utctime -format "%d %b %Y %I:%M %p"] + set pub_time [clock format $localtime -format "%d %b %Y %I:%M %p"] } if { [string equal $write_p "1"] } { Index: openacs-4/packages/news-aggregator/www/subscriptions-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/subscriptions-postgresql.xql,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/news-aggregator/www/subscriptions-postgresql.xql 20 Mar 2004 11:12:29 -0000 1.3 +++ openacs-4/packages/news-aggregator/www/subscriptions-postgresql.xql 14 Jan 2006 23:27:59 -0000 1.3.2.1 @@ -11,6 +11,8 @@ s.link, s.description, s.updates, + su.aggregator_id, + su.show_description_p, to_char(s.last_scanned, 'YYYY-MM-DD HH24:MI') as last_scanned, to_char(s.last_modified_stamp, 'YYYY-MM-DD HH24:MI') as last_modified from na_sources s join ( Index: openacs-4/packages/news-aggregator/www/subscriptions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/subscriptions.tcl,v diff -u -r1.7.2.3 -r1.7.2.4 --- openacs-4/packages/news-aggregator/www/subscriptions.tcl 4 Jan 2006 16:50:30 -0000 1.7.2.3 +++ openacs-4/packages/news-aggregator/www/subscriptions.tcl 14 Jan 2006 23:27:59 -0000 1.7.2.4 @@ -94,10 +94,12 @@ last_modified { label "Last Update" } - updates { - label "Updates" - html {align center} - } + show_description_p { + label "Titles Only?" + display_template { +
NoYes toggle
+ } + } feed_url { label "Source" display_template { @@ -133,8 +135,9 @@ set package_url [ad_conn package_url] -db_multirow -extend {xml_graphics_url} sources sources {} { +db_multirow -extend { xml_graphics_url toggle_show_desc_url } sources sources {} { set xml_graphics_url "${package_url}graphics/xml.gif" + set toggle_show_desc_url [export_vars -base toggle-show-description { aggregator_id source_id }] } set other_feeds [list [list "Select Feed" ""]] @@ -172,7 +175,6 @@ -feed_url $feed_url \ -aggregator_id $aggregator_id \ -user_id $user_id \ - -package_id $package_id \ -array] if { $channel_array eq "0" } { ad_returnredirect -message "The feed $feed_url has an error." Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/news-aggregator/www/toggle-show-description.tcl'. Fisheye: No comparison available. Pass `N' to diff?