Index: openacs-4/packages/lars-blogger/tcl/rss-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/rss-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/tcl/rss-procs.tcl 30 Nov 2002 17:37:17 -0000 1.3 +++ openacs-4/packages/lars-blogger/tcl/rss-procs.tcl 28 Aug 2003 09:41:55 -0000 1.4 @@ -6,22 +6,29 @@ } ad_proc -private lars_blog__rss_datasource { - package_id + summary_context_id } { This procedure implements the "datasource" operation of the RssGenerationSubscriber service contract. @author Lars Pind (lars@pinds.com) } { - set package_url [lars_blog_public_package_url -package_id $package_id] - set blog_title [db_string package_name { *SQL* }] + db_transaction { + + db_1row select_package_id_user_id {} + + set package_url [lars_blog_public_package_url -package_id $package_id] + + set blog_title [db_string package_name {}] - set blog_url "[ad_url]$package_url" - + set blog_url "[ad_url]$package_url" + + } + set column_array(channel_title) $blog_title set column_array(channel_description) $blog_title - set column_array(channel_pubDate) [db_string now { *SQL* }] + set column_array(channel_pubDate) [db_string now {}] set column_array(version) 1.00 @@ -42,7 +49,14 @@ set items [list] set counter 0 - db_foreach blog_rss_items { *SQL* } { + + if { [empty_string_p $user_id] } { + set statement "blog_rss_items" + } else { + set statement "user_blog_rss_items" + } + + db_foreach $statement {} { set TZoffset [format "%+03d:%02d" $tzoffset_hour $tzoffset_minute] set entry_url "[ad_url]${package_url}archive/${entry_archive_url}#blog-entry-$entry_id" @@ -77,21 +91,20 @@ } ad_proc -private lars_blog__rss_lastUpdated { - package_id + summary_context_id } { Returns the time that the last blog entry was posted, in Unix time. Returns 0 otherwise. @author Lars Pind (lars@pinds.com) } { - db_0or1row get_last_update { - select coalesce (date_part('epoch', - max(posted_date::timestamp with time zone) - ),0) as last_update - from pinds_blog_entries - where package_id = :package_id - and draft_p = 'f' - and deleted_p = 'f' + + db_1row select_package_id_user_id {} + + if { [empty_string_p $user_id] } { + db_0or1row get_last_update {} + } else { + db_0or1row get_last_user_update {} } return $last_update