Index: openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.tcl 27 Jan 2003 16:19:15 -0000 1.8 +++ openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.tcl 28 Aug 2003 09:41:55 -0000 1.9 @@ -9,6 +9,7 @@ {-entry_id:required} {-package_id:required} {-title:required} + {-title_url ""} {-content:required} {-content_format:required} {-entry_date:required} @@ -19,15 +20,91 @@ set creation_user [ad_conn user_id] set creation_ip [ns_conn peeraddr] - set entry_id [db_exec_plsql entry_add { *SQL* }] + db_transaction { + # Create the entry + set entry_id [db_exec_plsql entry_add {}] + lars_blog_flush_cache $package_id + } - lars_blog_flush_cache $package_id + # If publish directly, fire off notifications and ping weblogs.com + if { [string equal $draft_p "f"] } { + lars_blogger::entry::publish \ + -entry_id $entry_id \ + -package_id $package_id \ + -no_update + } return $entry_id } +ad_proc lars_blog_setup_feed { + -user:boolean + {-package_id ""} +} { + if { [empty_string_p $package_id] } { + set package_id [ad_conn package_id] + } + + set timeout [expr 30*60] + set channel_title [lars_blog_name] + set creation_user [ad_conn user_id] + set creation_ip [ns_conn peeraddr] + + if { !$user_p } { + if { [parameter::get -parameter "package_rss_feed_p" -default 1]} { + + # check whether there's been a channel setup for this instance + set summary_context_id [db_string select_instance_channel {} -default {}] + + if { [empty_string_p $summary_context_id] } { + # Setup a channel for this instance + set summary_context_id [db_exec_plsql create_instance_channel {}] + } + + # check whether there's been a feed setup for this instance + set exists_instance_feed_p [db_string exists_instance_feed_p {}] + + if { [string equal $exists_instance_feed_p "0"] } { + # Setup an RSS feed for this instance + set channel_link [lars_blog_public_package_url] + + set subscr_id [db_exec_plsql create_subscr {}] + db_dml update_subscr {} + + # Run it now + rss_gen_report $subscr_id + } + } + } else { + if {[parameter::get -parameter "user_rss_feed_p" -default 0]} { + # check whether there's been a channel setup for this instance + set summary_context_id [db_string select_user_channel {} -default {}] + if { [empty_string_p $summary_context_id] } { + # Setup a channel for this instance + set summary_context_id [db_exec_plsql create_user_channel {}] + } + + # check whether there's been a feed setup for this user + set exists_user_feed_p [db_string exists_user_feed_p {}] + set screen_name [db_string screen_name {}] + + if { [string equal $exists_user_feed_p "0"] && ![empty_string_p $screen_name] } { + # Setup an RSS feed for the user + set channel_link "[lars_blog_public_package_url]user/$screen_name/" + + set subscr_id [db_exec_plsql create_subscr {}] + db_dml update_subscr {} + + # Run it now + rss_gen_report $subscr_id + } + } + } +} + + ad_proc -private lars_blog_get_as_string_mem { package_id admin_p