Index: openacs-4/packages/lars-blogger/lars-blogger.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/lars-blogger.info,v diff -u -r1.22 -r1.23 --- openacs-4/packages/lars-blogger/lars-blogger.info 8 Oct 2003 16:05:25 -0000 1.22 +++ openacs-4/packages/lars-blogger/lars-blogger.info 16 Oct 2003 23:10:44 -0000 1.23 @@ -7,15 +7,15 @@ f f - + Lars Pind Simon Carstensen Write your own web log 2003-06-10 Collaboraid Manages multiple weblogs for your wbsite. - + Index: openacs-4/packages/lars-blogger/tcl/entry-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/entry-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/lars-blogger/tcl/entry-procs.tcl 1 Oct 2003 19:12:05 -0000 1.7 +++ openacs-4/packages/lars-blogger/tcl/entry-procs.tcl 16 Oct 2003 23:10:45 -0000 1.8 @@ -22,21 +22,6 @@ } } -ad_proc -public lars_blogger::entry::require_write_permission { - {-entry_id:required} -} { - permission::require_permission -object_id $entry_id -privilege write - - set admin_p [permission::permission_p -privilege "admin" -object_id $entry_id] - - if { !$admin_p && [ad_conn user_id] != [db_string creation_user {}] } { - ad_return_forbidden "Permission Denied" "
- You don't have permission to modify this entry. -
" - ad_script_abort - } -} - ad_proc -public lars_blogger::entry::publish { {-entry_id:required} {-package_id ""} @@ -72,6 +57,35 @@ } +ad_proc -public lars_blogger::entry::draft { + {-entry_id:required} +} { + Mark a blog entry as drafted +} { + permission::require_write_permission -object_id $entry_id + db_dml delete { + update pinds_blog_entries + set draft_p = 't' + where entry_id = :entry_id + } + lars_blog_flush_cache +} + +ad_proc -public lars_blogger::entry::delete { + {-entry_id:required} +} { + Delete a blog entry +} { + permission::require_write_permission -object_id $entry_id + db_dml delete { + update pinds_blog_entries + set deleted_p = 't' + where entry_id = :entry_id + } + lars_blog_flush_cache +} + + ad_proc -public lars_blogger::entry::htmlify { -array:required } { @@ -170,4 +184,4 @@ upvar $multirow $multirow db_multirow $multirow get_comments "" -} \ No newline at end of file +} Index: openacs-4/packages/lars-blogger/www/blog.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/blog.adp,v diff -u -r1.14 -r1.15 --- openacs-4/packages/lars-blogger/www/blog.adp 29 Sep 2003 11:32:53 -0000 1.14 +++ openacs-4/packages/lars-blogger/www/blog.adp 16 Oct 2003 23:10:45 -0000 1.15 @@ -17,9 +17,9 @@
- - - + + +
@@ -33,7 +33,7 @@ » Archive
- + » Add entry Index: openacs-4/packages/lars-blogger/www/blog.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/blog.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/lars-blogger/www/blog.tcl 29 Sep 2003 11:03:31 -0000 1.13 +++ openacs-4/packages/lars-blogger/www/blog.tcl 16 Oct 2003 23:10:45 -0000 1.14 @@ -18,7 +18,7 @@ set package_id [ad_conn package_id] } -set write_p [permission::permission_p -object_id $package_id -privilege write] +set create_p [permission::permission_p -object_id $package_id -privilege read] if { ![info exists category_id] } { set blog_category_id {} @@ -115,21 +115,21 @@ set arr_category_name(0) None set arr_category_short_name(0) none -db_foreach categories { *SQL* } { +db_foreach categories {} { set arr_category_name($category_id) $name set arr_category_short_name($category_id) $short_name } if { [empty_string_p $blog_user_id] } { - db_multirow -extend {category_name category_short_name} blog all_blogs { *SQL* } { + db_multirow -extend {category_name category_short_name} blog all_blogs {} { if { [string length $blog_category_id] && $category_id != $blog_category_id } {continue} set category_name "$arr_category_name($category_id)" set category_short_name $arr_category_short_name($category_id) } set archive_url "${package_url}archive/" } else { - db_multirow -extend {category_name category_short_name} blog blog { *SQL* } { + db_multirow -extend {category_name category_short_name} blog blog {} { if { [string length $blog_category_id] && $category_id != $blog_category_id } {continue} set category_name "$arr_category_name($category_id)" set category_short_name $arr_category_short_name($category_id) Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/lars-blogger/www/drafts-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/lars-blogger/www/drafts-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/lars-blogger/www/drafts.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/drafts.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/www/drafts.adp 27 Sep 2003 17:14:24 -0000 1.3 +++ openacs-4/packages/lars-blogger/www/drafts.adp 16 Oct 2003 23:10:45 -0000 1.4 @@ -2,39 +2,7 @@ @page_title@ @context@ - - No draft entries. - - - - - - -
- - - - - - - - - - - - - -
DateContentAction
@draft_entries.entry_date_pretty@ - @draft_entries.title@ - @draft_entries.content@ - - Preview - Publish - Edit - Delete -
-
-
+

» Add entry Index: openacs-4/packages/lars-blogger/www/drafts.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/drafts.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/www/drafts.tcl 28 Aug 2003 09:41:55 -0000 1.2 +++ openacs-4/packages/lars-blogger/www/drafts.tcl 16 Oct 2003 23:10:45 -0000 1.3 @@ -6,22 +6,70 @@ set package_id [ad_conn package_id] set user_id [ad_conn user_id] -if { [ad_permission_p $package_id admin] } { +set page_title "Draft Entries" + +set context [list $page_title] + +set elements [list] +lappend elements edit { + label {} + sub_class narrow + display_template { + + } + link_url_eval {[export_vars -base entry-edit { entry_id { return_url [ad_return_url] } }]} + link_html { title "Edit entry" } +} +lappend elements entry_date { + label "Date" + display_col entry_date_pretty +} + +if { [permission::permission_p -object_id $package_id -privilege write] } { set statement "all_draft_entries" + lappend elements creation_user { + label "Author" + display_template {@entries.first_names@ @entries.last_name@} + link_url_eval {[acs_community_member_url -user_id $creation_user]} + } } else { set statement "draft_entries" } -set page_title "Draft Entries" +lappend elements content { + label "Entry" + link_url_eval {[export_vars -base one-entry { entry_id { return_url [ad_return_url] } }]} + link_html { title "Preview entry" } +} +lappend elements publish { + label {Publish} + sub_class narrow + display_template { + Publish + } + link_url_eval {[export_vars -base entry-publish { entry_id { return_url [ad_return_url] } }]} + link_html { title "Publish entry" } + html { align center } +} +lappend elements delete { + label {} + sub_class narrow + display_template { + + } + link_url_eval {[export_vars -base entry-delete { entry_id { return_url [ad_return_url] } }]} + link_html { title "Delete entry" } +} -set context [list $page_title] -db_multirow -extend { edit_url publish_url delete_url preview_url } draft_entries $statement {} { - set return_url "[ad_conn url][ad_decode [ad_conn query] "" "" "?[ad_conn query]"]" - set edit_url "[ad_conn package_url]entry-edit?[export_vars { entry_id return_url }]" - set delete_url "[ad_conn package_url]entry-delete?[export_vars { entry_id return_url }]" - set preview_url "[ad_conn package_url]one-entry?[export_vars { entry_id return_url }]" - set publish_url "[ad_conn package_url]entry-publish?[export_vars { entry_id return_url }]" +template::list::create \ + -name entries \ + -multirow entries \ + -elements $elements + +db_multirow -extend { entry_date_pretty edit_url publish_url delete_url preview_url } entries $statement {} { + set entry_date_pretty [lc_time_fmt $entry_date_ansi "%q"] + set content [string_truncate -len 80 $content] } set entry_add_url "entry-edit" Index: openacs-4/packages/lars-blogger/www/drafts.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/drafts.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/www/drafts.xql 28 Aug 2003 09:41:55 -0000 1.2 +++ openacs-4/packages/lars-blogger/www/drafts.xql 16 Oct 2003 23:10:45 -0000 1.3 @@ -2,17 +2,46 @@ + + + select e.entry_id, + to_char(e.entry_date, 'YYYY-MM-DD HH24:MI:SS') as entry_date_ansi, + e.title, + e.content, + o.creation_user, + u.first_names, + u.last_name + from pinds_blog_entries e, + acs_objects o, + all_users u + where e.package_id = :package_id + and e.draft_p = 't' + and e.deleted_p = 'f' + and o.object_id = e.entry_id + and u.user_id = o.creation_user + and o.creation_user = :user_id + order by e.entry_date desc, e.posted_date desc + + + - select entry_id, - to_char(entry_date, 'YYYY-MM-DD') as entry_date_pretty, - title, - content - from pinds_blog_entries - where package_id = :package_id - and draft_p = 't' - and deleted_p = 'f' - order by entry_date desc, posted_date desc + select e.entry_id, + to_char(e.entry_date, 'YYYY-MM-DD HH24:MI:SS') as entry_date_ansi, + e.title, + e.content, + o.creation_user, + u.first_names, + u.last_name + from pinds_blog_entries e, + acs_objects o, + all_users u + where e.package_id = :package_id + and e.draft_p = 't' + and e.deleted_p = 'f' + and o.object_id = e.entry_id + and u.user_id = o.creation_user + order by e.entry_date desc, e.posted_date desc Index: openacs-4/packages/lars-blogger/www/entry-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-chunk.adp,v diff -u -r1.13 -r1.14 --- openacs-4/packages/lars-blogger/www/entry-chunk.adp 1 Oct 2003 19:12:05 -0000 1.13 +++ openacs-4/packages/lars-blogger/www/entry-chunk.adp 16 Oct 2003 23:10:45 -0000 1.14 @@ -27,7 +27,7 @@ Posted by @blog.poster_first_names@ @blog.poster_last_name@ at @blog.posted_time_pretty@ - +      Edit - Index: openacs-4/packages/lars-blogger/www/entry-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-chunk.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/lars-blogger/www/entry-chunk.tcl 1 Oct 2003 19:12:05 -0000 1.9 +++ openacs-4/packages/lars-blogger/www/entry-chunk.tcl 16 Oct 2003 23:10:45 -0000 1.10 @@ -42,6 +42,8 @@ set blog(publish_url) "${package_url}entry-publish?[export_vars { entry_id return_url }]" set blog(revoke_url) "${package_url}entry-revoke?[export_vars { entry_id return_url }]" +set blog(write_p) [permission::write_permission_p -object_id $blog(entry_id) -creation_user $blog(user_id)] + if { [empty_string_p $screen_name] } { set blog(entry_archive_url) "${package_url}one-entry?[export_vars { entry_id }]" } else { Index: openacs-4/packages/lars-blogger/www/entry-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-delete.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/www/entry-delete.tcl 28 Aug 2003 09:41:55 -0000 1.2 +++ openacs-4/packages/lars-blogger/www/entry-delete.tcl 16 Oct 2003 23:10:45 -0000 1.3 @@ -1,15 +1,8 @@ ad_page_contract {} { entry_id:integer - {return_url ""} + {return_url "."} } -lars_blogger::entry::require_write_permission -entry_id $entry_id +lars_blogger::entry::delete -entry_id $entry_id -db_dml delete { - update pinds_blog_entries - set deleted_p = 't' - where entry_id = :entry_id -} - - ad_returnredirect $return_url Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/lars-blogger/www/entry-delete.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/lars-blogger/www/entry-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/Attic/entry-edit-oracle.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/www/entry-edit-oracle.xql 28 Aug 2003 09:41:55 -0000 1.2 +++ openacs-4/packages/lars-blogger/www/entry-edit-oracle.xql 16 Oct 2003 23:10:45 -0000 1.3 @@ -3,12 +3,6 @@ oracle8.1.6 - - - select to_char(sysdate, 'YYYY-MM-DD') from dual - - - posted_date = sysdate Index: openacs-4/packages/lars-blogger/www/entry-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/Attic/entry-edit-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/www/entry-edit-postgresql.xql 28 Aug 2003 09:41:55 -0000 1.2 +++ openacs-4/packages/lars-blogger/www/entry-edit-postgresql.xql 16 Oct 2003 23:10:45 -0000 1.3 @@ -3,12 +3,6 @@ postgresql7.1 - - - select to_char(current_timestamp, 'YYYY-MM-DD') - - - posted_date = current_timestamp 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.5 -r1.6 --- openacs-4/packages/lars-blogger/www/entry-edit.tcl 13 Oct 2003 07:41:13 -0000 1.5 +++ openacs-4/packages/lars-blogger/www/entry-edit.tcl 16 Oct 2003 23:10:45 -0000 1.6 @@ -6,10 +6,10 @@ } # Must be logged in -ad_maybe_redirect_for_registration +auth::require_login -# Must have write privilege -permission::require_permission -object_id [ad_conn package_id] -privilege write +# Must have create on the package +permission::require_permission -object_id [ad_conn package_id] -privilege create # If we're in DisplayUserP mode, the user must have a screen name setup if { [parameter::get -parameter "DisplayUsersP" -default 0] } { @@ -28,7 +28,7 @@ set package_id [ad_conn package_id] -set today [db_string today { *SQL* }] +set today [clock format [clock seconds] -format "%Y-%m-%d"] form create entry -cancel_url [ad_decode $return_url "" "." $return_url] @@ -73,9 +73,9 @@ } else { set insert_or_update update - lars_blogger::entry::require_write_permission -entry_id $entry_id + permission::require_write_permission -object_id $entry_id - db_1row entry { *SQL* } + db_1row entry {} element set_value entry title $title element set_value entry title_url $title_url @@ -121,7 +121,7 @@ -entry_date $entry_date \ -draft_p "$draft_p" } else { - lars_blogger::entry::require_write_permission -entry_id $entry_id + permission::require_write_permission -object_id $entry_id set set_clauses { "title = :title" Index: openacs-4/packages/lars-blogger/www/entry-publish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-publish.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/www/entry-publish.tcl 28 Aug 2003 09:41:55 -0000 1.2 +++ openacs-4/packages/lars-blogger/www/entry-publish.tcl 16 Oct 2003 23:10:45 -0000 1.3 @@ -1,9 +1,9 @@ ad_page_contract {} { entry_id:integer - {return_url "index"} + {return_url "."} } -lars_blogger::entry::require_write_permission -entry_id $entry_id +permission::require_write_permission -object_id $entry_id lars_blogger::entry::publish \ -entry_id $entry_id \ Index: openacs-4/packages/lars-blogger/www/entry-revoke.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-revoke.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/www/entry-revoke.tcl 28 Aug 2003 09:41:55 -0000 1.2 +++ openacs-4/packages/lars-blogger/www/entry-revoke.tcl 16 Oct 2003 23:10:45 -0000 1.3 @@ -1,12 +1,8 @@ ad_page_contract {} { entry_id:integer - {return_url "index"} + {return_url "."} } -db_dml update_entry { *SQL* } +lars_blogger::entry::draft -entry_id $entry_id ad_returnredirect $return_url -ns_conn close - -# Flush cache -lars_blog_flush_cache Index: openacs-4/packages/lars-blogger/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/index.adp,v diff -u -r1.19 -r1.20 --- openacs-4/packages/lars-blogger/www/index.adp 29 Sep 2003 19:41:23 -0000 1.19 +++ openacs-4/packages/lars-blogger/www/index.adp 16 Oct 2003 23:10:45 -0000 1.20 @@ -29,7 +29,7 @@ No bloggers here. - +

» Add entry
@@ -116,7 +116,7 @@ - + Actions @@ -134,7 +134,7 @@   - + Index: openacs-4/packages/lars-blogger/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/index.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/lars-blogger/www/index.tcl 13 Oct 2003 08:07:04 -0000 1.13 +++ openacs-4/packages/lars-blogger/www/index.tcl 16 Oct 2003 23:10:45 -0000 1.14 @@ -52,7 +52,7 @@ } -set write_p [permission::permission_p -object_id $package_id -privilege write] +set create_p [permission::permission_p -object_id $package_id -privilege read] set admin_p [permission::permission_p -object_id $package_id -privilege admin] set display_users_p [parameter::get -parameter "DisplayUsersP" -default 0] Index: openacs-4/packages/lars-blogger/www/one-entry.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/one-entry.adp,v diff -u -r1.12 -r1.13 --- openacs-4/packages/lars-blogger/www/one-entry.adp 29 Sep 2003 11:32:53 -0000 1.12 +++ openacs-4/packages/lars-blogger/www/one-entry.adp 16 Oct 2003 23:10:45 -0000 1.13 @@ -16,6 +16,6 @@ - + Index: openacs-4/packages/lars-blogger/www/one-entry.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/one-entry.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/lars-blogger/www/one-entry.tcl 29 Sep 2003 11:32:53 -0000 1.9 +++ openacs-4/packages/lars-blogger/www/one-entry.tcl 16 Oct 2003 23:10:45 -0000 1.10 @@ -1,6 +1,6 @@ ad_page_contract {} { entry_id:integer - {return_url ""} + {return_url {[ad_return_url]}} } -properties { context_bar title_html @@ -13,16 +13,14 @@ set package_id [ad_conn package_id] -set write_p [permission::permission_p -object_id $package_id -privilege write] - -if { [empty_string_p $return_url] } { - set return_url "[ad_conn url]?[ad_conn query]" -} - set show_poster_p [ad_parameter "ShowPosterP" "" "1"] lars_blogger::entry::get -entry_id $entry_id -array blog +if { [template::util::is_true $blog(draft_p)] } { + permission::require_write_permission -object_id $entry_id -creation_user $blog(user_id) -action "view" +} + set page_title $blog(title) if {![exists_and_not_null screen_name]} { Index: openacs-4/packages/lars-blogger/www/doc/index.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/doc/index.html,v diff -u -r1.4 -r1.5 --- openacs-4/packages/lars-blogger/www/doc/index.html 28 Aug 2003 09:41:56 -0000 1.4 +++ openacs-4/packages/lars-blogger/www/doc/index.html 16 Oct 2003 23:10:46 -0000 1.5 @@ -27,7 +27,7 @@

Install the package on your system, mount a new instance somewhere - on the site map, make sure you have write permission on the + on the site map, make sure you have create permission on the instance, and then visit the URL where you mounted it. Now you can add your first blog entry.

@@ -91,7 +91,7 @@ The package fully supports multiple instances. You can mount several instances in your site map, and they'll stay properly isolated from each other. Alternatively you can let multiple users post to one - instance by granting write permissions. Mounting Weblogger under, say, + instance by granting create permissions. Mounting Weblogger under, say, /blog, you will have /blog/user/screenname displaying the entries of one user and /blog displaying either a list of all bloggers (this is done by setting the parameter DisplayUsersP to 1) or all entries posted to the @@ -101,10 +101,19 @@

Contents in your blog entries are assumed to be full-blooded ADP-ified HTML, so don't give people access to post a blog (i.e. grant - write permissions on the instance) unless you trust them. This also means + create permissions on the instance) unless you trust them. This also means that if you've added custom ADP tags, those are also available to you in your blog.

+

Permissions

+ +
    +
  • 'read' means people can read entries.
  • +
  • 'create' means people can create entries and edit/publish/draft/delete their own entries.
  • +
  • 'write' means people can edit/draft/publish/delete all entries in the package instance.
  • +
  • 'admin' means people can define categories, etc.
  • +
+

weblogs.com update ping

@@ -168,6 +177,9 @@

  • + 1.0 Added support for categories, cleaned up permissions handling, styled with stylesheets, trackback support.
  • + +
  • 0.9.2 Added parameters to control the number of entries shown on the front page (July 10, 2003)