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.13 -r1.14 --- openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.tcl 21 Oct 2003 20:31:06 -0000 1.13 +++ openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.tcl 8 Dec 2003 05:23:42 -0000 1.14 @@ -38,6 +38,60 @@ return $entry_id } +ad_proc -public lars_blog_entry_edit { + {-entry_id:required} + {-title:required} + {-title_url ""} + {-category_id ""} + {-content:required} + {-content_format:required} + {-entry_date:required} + {-draft_p:required} +} { + Edit the blog entry and then optionally perform notifications + and RSS operations if the blog was a draft before and now is + being published. + + @return entry_id of edited entry + + @author Vinod Kurup vinod@kurup.com + @creation-date 2003-10-04 +} { + # can't just use ad_conn package_id since the + # request may be coming via XML-RPC + set package_id [db_string package_id {}] + + set set_clauses { + "title = :title" + "title_url = :title_url" + "category_id = :category_id" + "content = :content" + "content_format = :content_format" + "entry_date = to_date(:entry_date, 'YYYY-MM-DD')" + "draft_p = :draft_p" + } + + set org_draft_p [db_string org_draft_p {}] + + # Is this a publish? + if { [string equal $draft_p "t"] && [string equal $org_draft_p "f"] } { + # set the posted_date to now + lappend set_clauses [db_map now] + } + + db_dml update_entry {} + + # Is this a publish? + if { [string equal $draft_p "t"] && [string equal $org_draft_p "f"] } { + # do notifications + lars_blogger::entry::do_notifications -entry_id $entry_id + # and ping weblogs.com + lars_blog_weblogs_com_update_ping -package_id $package_id + } + + lars_blog_flush_cache $package_id +} + ad_proc lars_blog_setup_feed { -user:boolean {-package_id ""} @@ -192,3 +246,15 @@ } return [parameter::get -package_id $package_id -parameter "StylesheetURL" -default "/resources/lars-blogger/lars-blogger.css"] } + +ad_proc -public lars_blog_list_user_blogs { + user_id +} { + Return list of package_ids of blogs on which user has 'create' permission + + @param user_id user_id + @return list of package_id + @author Vinod Kurup +} { + return [db_list blog_list {}] +}