Index: openacs.org-dev/www/templates/homepage-index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/www/templates/homepage-index.tcl,v diff -u -r1.2 -r1.3 --- openacs.org-dev/www/templates/homepage-index.tcl 22 Jul 2002 09:26:27 -0000 1.2 +++ openacs.org-dev/www/templates/homepage-index.tcl 22 Jul 2002 20:28:25 -0000 1.3 @@ -15,6 +15,7 @@ pa:onerow news_items:multirow feature_items:multirow + forum_posts:multirow n_news_items:onevalue n_feature_items:onevalue n_forum_posts:onevalue @@ -23,9 +24,12 @@ ## config for the three call-out boxes set n_news_items 2 set n_feature_items 3 -set n_forum_posts 4 -set max_post_age_days 40 +set n_forum_posts 5 +set max_post_age_days 14 +#set news_items_limit [expr $n_news_items + 1] +#set feature_items_limit [expr $n_feature_items + 1] +set forum_posts_limit [expr $n_forum_posts + 1] etp::get_page_attributes @@ -61,25 +65,61 @@ # and b.forum_id = f.forum_id # and f.bboard_id = 2369 # order by sent_date desc -# limit $n_forum_posts +# limit $forum_posts_limit #" +# This is the "forums" version (olah) +# I must ask Don how this can be cached... +db_multirow forum_posts messages_select " + select fm.message_id, + fm.subject as title, + fm.user_id, + fm.forum_id, + person__name(fm.user_id) as user_name, +-- fm.posting_date, + forums_forum__name(fm.forum_id) as forum_name, + to_char(posting_date,'MM/DD/YY') as sent_date_no_time, + to_char(posting_date,'HH24:MM') as sent_time, +-- to_char(acs_objects.last_modified, 'Mon DD YYYY HH24:MI:SS') as last_modified, + (select count(*) + from forums_messages_approved fm1 + where fm1.forum_id = fm.forum_id + and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages, + + case when length(fm.content) > 100 then + substring(fm.content, 0, 100) || '...' + else + fm.content + end + as content + + from forums_messages_approved fm + , forums_forums ff +-- , acs_objects + where fm.forum_id = ff.forum_id + and fm.parent_id is null + and ff.package_id = 3928 +-- and fm.message_id = acs_objects.object_id + order by fm.posting_date desc + limit $forum_posts_limit +" + #Warning! lazy hardcode of package id! # this presents only non-expired news items #set where "sysdate() between to_date(attributes.release_date, 'YYYY-MM-DD') # and to_date(attributes.archive_date, 'YYYY-MM-DD')" -##set orderby "to_date(attributes.release_date, 'YYYY-MM-DD') desc" +#set orderby "to_date(attributes.release_date, 'YYYY-MM-DD') desc" # this limits the query to the desired number of items... # ... plus one, so that we can use maxrows and rowcount # in the adp to present a "more..." link if appropriate # (maxrows without limiting the query could be performance killer) -#set news_limit [expr $n_news_items + 1] +set news_limit [expr $n_news_items + 1] set feature_limit [expr $n_feature_items + 1] # speaking of performance, when this is live these @@ -88,9 +128,9 @@ #etp::get_content_items -where $where -orderby $orderby \ -# -limit $news_limit \ -# -package_id 2494 -result_name news_items \ -# release_date archive_date + -limit $news_limit \ + -package_id 2494 -result_name news_items \ + release_date archive_date etp::get_content_items -package_id 4053 -limit $feature_limit \