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.8.2.10 -r1.8.2.11 --- openacs-4/packages/lars-blogger/lars-blogger.info 1 Jul 2003 13:28:25 -0000 1.8.2.10 +++ openacs-4/packages/lars-blogger/lars-blogger.info 10 Jul 2003 09:47:46 -0000 1.8.2.11 @@ -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. - + @@ -24,6 +24,9 @@ + + + Index: openacs-4/packages/lars-blogger/www/blog-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/blog-oracle.xql,v diff -u -r1.2.2.4 -r1.2.2.5 --- openacs-4/packages/lars-blogger/www/blog-oracle.xql 1 Jul 2003 13:28:26 -0000 1.2.2.4 +++ openacs-4/packages/lars-blogger/www/blog-oracle.xql 10 Jul 2003 09:47:46 -0000 1.2.2.5 @@ -11,7 +11,7 @@ - entry_date > sysdate - 30 + entry_date > sysdate - :num_days @@ -40,9 +40,10 @@ where e.entry_id = o.object_id and p.person_id = o.creation_user and package_id = :package_id - and $date_clause + [ad_decode $date_clause "" "" "and $date_clause"] and draft_p = 'f' and deleted_p = 'f' + [ad_decode $limit "" "" "and rownum <= $limit"] order by entry_date desc, posted_date desc @@ -70,10 +71,12 @@ persons p where e.entry_id = o.object_id and p.person_id = o.creation_user + and o.creation_user = :blog_user_id and package_id = :package_id - and $date_clause + [ad_decode $date_clause "" "" "and $date_clause"] and draft_p = 'f' and deleted_p = 'f' + [ad_decode $limit "" "" "and rownum <= $limit"] order by entry_date desc, posted_date desc Index: openacs-4/packages/lars-blogger/www/blog-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/blog-postgresql.xql,v diff -u -r1.3.2.4 -r1.3.2.5 --- openacs-4/packages/lars-blogger/www/blog-postgresql.xql 13 Jun 2003 09:15:01 -0000 1.3.2.4 +++ openacs-4/packages/lars-blogger/www/blog-postgresql.xql 10 Jul 2003 09:47:46 -0000 1.3.2.5 @@ -11,7 +11,7 @@ - entry_date > current_timestamp - interval '30 days' + entry_date > current_timestamp - interval '$num_days days' @@ -38,10 +38,11 @@ acs_objects o on (o.object_id = e.entry_id) join persons p on (p.person_id = o.creation_user) where package_id = :package_id - and $date_clause + [ad_decode $date_clause "" "" "and $date_clause"] and draft_p = 'f' and deleted_p = 'f' order by entry_date desc, posted_date desc + [ad_decode $limit "" "" "limit $limit"] @@ -63,16 +64,16 @@ from general_comments gc, cr_revisions cr where gc.object_id = entry_id and content_item__get_live_revision(gc.comment_id) = cr.revision_id) as num_comments - from users u, pinds_blog_entries e join + from pinds_blog_entries e join acs_objects o on (o.object_id = e.entry_id) join persons p on (p.person_id = o.creation_user) where package_id = :package_id - and u.user_id = o.creation_user - and u.screen_name = :screen_name - and $date_clause + and o.creation_user = :blog_user_id + [ad_decode $date_clause "" "" "and $date_clause"] and draft_p = 'f' and deleted_p = 'f' order by entry_date desc, posted_date desc + [ad_decode $limit "" "" "limit $limit"] 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.8.2.6 -r1.8.2.7 --- openacs-4/packages/lars-blogger/www/blog.tcl 1 Jul 2003 13:28:26 -0000 1.8.2.6 +++ openacs-4/packages/lars-blogger/www/blog.tcl 10 Jul 2003 09:47:46 -0000 1.8.2.7 @@ -22,18 +22,54 @@ if { ![info exists screen_name] } { set screen_name "" + set blog_user_id {} +} else { + set blog_user_id [cc_screen_name_user $screen_name] } -if { ![info exists type] } { - set type "current" -} +# TODO: +# - Upgrade the installed package to get the latest parameters +# - Test on PG and Oracle + +set max_num_entries [parameter::get \ + -package_id $package_id \ + -parameter MaxNumEntriesOnFrontPage \ + -default {}] + +set min_num_entries [parameter::get \ + -package_id $package_id \ + -parameter MinNumEntriesOnFrontPage \ + -default {}] + +set num_days [parameter::get \ + -package_id $package_id \ + -parameter NumDaysOnFrontPage \ + -default {}] + + + switch -exact $type { archive { set date_clause "[db_map date_clause_archive]" + set limit {} } + current { + set date_clause {} + set limit {} + + if { ![empty_string_p $max_num_entries] && $max_num_entries != 0 } { + # MaxNumEntriesOnFrontPage parameter is set, which means we should limit to that + set limit $max_num_entries + } + + if { ![empty_string_p $num_days] && $num_days != 0 } { + # NumDaysOnFrontPage parameter is set, which means we should limit to that + set date_clause [db_map date_clause_default] + } + } default { - set date_clause "[db_map date_clause_default]" + error "Only knows of type 'archive' or 'current'" } } @@ -49,18 +85,30 @@ set blog_url {} } -set count 0 - -if { ![exists_and_not_null screen_name] } { +# Check that the date limit is not limiting us to show less than min_num_entries entries +if { ![string equal $type "archive"] && \ + ![empty_string_p $min_num_entries] && $min_num_entries != 0 && \ + ![empty_string_p $num_days] && $num_days != 0 + } { + if { [empty_string_p $blog_user_id] } { + set num_entries [db_string num_entries_by_date_all {}] + } else { + set num_entries [db_string num_entries_by_date {}] + } + if { $num_entries < $min_num_entries } { + # Eliminate date clause, and set the limit to the minimum number of entries + set date_clause {} + set limit $min_num_entries + } +} + +if { [empty_string_p $blog_user_id] } { db_multirow blog all_blogs { *SQL* } set archive_url "${package_url}archive/" - } else { - db_multirow blog blog { *SQL* } set archive_url "${package_url}user/$screen_name/archive/" - } set arrow_url "${package_url}graphics/arrow-box.gif" Index: openacs-4/packages/lars-blogger/www/blog.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/blog.xql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/lars-blogger/www/blog.xql 16 Mar 2003 14:06:33 -0000 1.1.2.1 +++ openacs-4/packages/lars-blogger/www/blog.xql 10 Jul 2003 09:47:46 -0000 1.1.2.2 @@ -1,7 +1,7 @@ - + select count(entry_id) from pinds_blog_entries e @@ -12,4 +12,18 @@ + + + select count(entry_id) + from pinds_blog_entries e, + acs_objects i + where e.package_id = :package_id + and o.object_id = e.entry_id + and o.creation_user = :blog_user_id + and $date_clause + and draft_p = 'f' + and deleted_p = 'f' + + + 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.1.2.3 -r1.1.2.4 --- openacs-4/packages/lars-blogger/www/entry-edit.tcl 3 Jul 2003 18:37:04 -0000 1.1.2.3 +++ openacs-4/packages/lars-blogger/www/entry-edit.tcl 10 Jul 2003 09:47:46 -0000 1.1.2.4 @@ -31,7 +31,7 @@ set today [db_string today { *SQL* }] set today_html [ad_quotehtml $today] -form create entry -cancel_url $return_url +form create entry -cancel_url [ad_decode $return_url "" "." $return_url] element create entry title -label "Title" -datatype text -html { size 50 } element create entry title_url -label "Title URL (optional)" -datatype text -html { size 50 } -optional 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.1.2.6 -r1.1.2.7 --- openacs-4/packages/lars-blogger/www/doc/index.html 13 Jun 2003 09:15:02 -0000 1.1.2.6 +++ openacs-4/packages/lars-blogger/www/doc/index.html 10 Jul 2003 09:47:46 -0000 1.1.2.7 @@ -167,7 +167,11 @@

Version History

    -
  • +
  • + 0.9.2 Added parameters to control the number of entries shown + on the front page (July 10, 2003) +
  • +
  • 0.9 Added support for multiple users. (June 10, 2003)