Index: openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-oracle.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-oracle.xql 28 Aug 2003 09:41:55 -0000 1.4 +++ openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-oracle.xql 8 Dec 2003 05:23:42 -0000 1.5 @@ -22,6 +22,12 @@ + + + posted_date = sysdate + + + begin Index: openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-postgresql.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-postgresql.xql 29 Sep 2003 08:05:42 -0000 1.5 +++ openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-postgresql.xql 8 Dec 2003 05:23:42 -0000 1.6 @@ -21,6 +21,12 @@ + + + posted_date = current_timestamp + + + select weblogger_channel__new ( 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 {}] +} Index: openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.xql 28 Aug 2003 09:41:55 -0000 1.2 +++ openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.xql 8 Dec 2003 05:23:42 -0000 1.3 @@ -2,6 +2,27 @@ + + + select package_id from pinds_blog_entries + where entry_id = :entry_id + + + + + + select draft_p from pinds_blog_entries where entry_id = :entry_id + + + + + + update pinds_blog_entries + set [join $set_clauses ", "] + where entry_id = :entry_id + + + select w.channel_id @@ -65,4 +86,17 @@ + + + + select p.package_id + from apm_packages p, acs_object_party_privilege_map perm + where p.package_key = 'lars-blogger' + and p.package_id = perm.object_id + and perm.privilege = 'create' + and perm.party_id = :user_id + + + + Index: openacs-4/packages/lars-blogger/www/entry-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-edit.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/lars-blogger/www/entry-edit.tcl 19 Oct 2003 20:25:03 -0000 1.8 +++ openacs-4/packages/lars-blogger/www/entry-edit.tcl 8 Dec 2003 05:23:42 -0000 1.9 @@ -119,35 +119,15 @@ } else { permission::require_write_permission -object_id $entry_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 { select draft_p from pinds_blog_entries where entry_id = :entry_id } ] - - # 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 { *SQL* } - - # 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 - } - - lars_blog_flush_cache $package_id + lars_blog_entry_edit \ + -entry_id $entry_id \ + -title $title \ + -title_url $title_url \ + -category_id $category_id \ + -content $content \ + -content_format $content_format \ + -entry_date $entry_date \ + -draft_p $draft_p } if { [empty_string_p $return_url] } { Index: openacs-4/packages/lars-blogger/www/entry-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-edit.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/lars-blogger/www/entry-edit.xql 13 Oct 2003 07:41:13 -0000 1.4 +++ openacs-4/packages/lars-blogger/www/entry-edit.xql 8 Dec 2003 05:23:42 -0000 1.5 @@ -34,12 +34,4 @@ - - - update pinds_blog_entries - set [join $set_clauses ", "] - where entry_id = :entry_id - - -