Index: openacs-4/packages/forums/forums.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/forums.info,v diff -u -r1.36 -r1.37 --- openacs-4/packages/forums/forums.info 15 May 2007 20:14:38 -0000 1.36 +++ openacs-4/packages/forums/forums.info 22 May 2007 09:42:08 -0000 1.37 @@ -7,15 +7,15 @@ f f - + OpenACS Online discussion forums. 2007-03-04 OpenACS This online discussion board software is the successor of the original bboard package. The biggest improvement is a scalable datamodel. Forums supports threaded and flat view, moderation, a stand alone search function as well as integration with the OpenACS search package and integration with the notifications package for email alerts. It also supports reply via email. 0 - + @@ -34,6 +34,7 @@ + Index: openacs-4/packages/forums/catalog/forums.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/catalog/forums.de_DE.ISO-8859-1.xml,v diff -u -r1.18 -r1.19 --- openacs-4/packages/forums/catalog/forums.de_DE.ISO-8859-1.xml 15 May 2007 20:14:38 -0000 1.18 +++ openacs-4/packages/forums/catalog/forums.de_DE.ISO-8859-1.xml 22 May 2007 09:42:08 -0000 1.19 @@ -81,6 +81,7 @@ Verwalten Forum verwalten: Verwalten/Moderieren + alle als gelesen markieren Beitrags-ID Moderieren Moderiert Index: openacs-4/packages/forums/catalog/forums.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/catalog/forums.en_US.ISO-8859-1.xml,v diff -u -r1.35 -r1.36 --- openacs-4/packages/forums/catalog/forums.en_US.ISO-8859-1.xml 15 May 2007 20:14:38 -0000 1.35 +++ openacs-4/packages/forums/catalog/forums.en_US.ISO-8859-1.xml 22 May 2007 09:42:08 -0000 1.36 @@ -97,6 +97,7 @@ Manage Manage Forum: Manage/Moderate + mark all as read Message ID Subject Moderate Index: openacs-4/packages/forums/lib/forums/forums-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/Attic/forums-chunk-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/forums/lib/forums/forums-chunk-postgresql.xql 13 Jan 2005 13:58:15 -0000 1.2 +++ openacs-4/packages/forums/lib/forums/forums-chunk-postgresql.xql 22 May 2007 09:42:08 -0000 1.3 @@ -8,7 +8,7 @@ select forums_forums_enabled.*, approved_thread_count as n_threads, to_char(last_post, 'YYYY-MM-DD HH24:MI:SS') as last_post_ansi, - case when last_post > (now() - interval '1 day') then 't' else 'f' end as new_p + $unread_or_new_query from forums_forums_enabled where forums_forums_enabled.package_id = :package_id and ( Index: openacs-4/packages/forums/lib/forums/forums-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/forums-chunk.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/forums/lib/forums/forums-chunk.tcl 8 Apr 2005 08:28:08 -0000 1.6 +++ openacs-4/packages/forums/lib/forums/forums-chunk.tcl 22 May 2007 09:42:08 -0000 1.7 @@ -18,6 +18,19 @@ set table_bgcolor [parameter::get -parameter table_bgcolor] set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] +set useReadingInfo [forum::use_ReadingInfo_p] +if { $useReadingInfo } { + set unread_or_new_query { + approved_thread_count-COALESCE((SELECT forums_reading_info_user.threads_read WHERE + forums_reading_info_user.forum_id=forums_forums_enabled.forum_id AND forums_reading_info_user.user_id=:user_id),0) + as count_unread + } +} else { + set unread_or_new_query { + case when last_post > (now() - interval '1 day') then 't' else 'f' end as new_p + } +} + set actions [list] if { $admin_p } { lappend actions [_ forums.New_Forum] "admin/forum-new" {} @@ -28,18 +41,30 @@ -name forums \ -actions $actions \ -no_data [_ forums.No_Forums] \ + -pass_properties useReadingInfo \ -elements { name { label {\#forums.Forum_Name\#} link_url_col forum_view_url display_template { + + + + + @forums.name@ + + (@forums.count_unread@) + + + @forums.name@ + } } charter { Index: openacs-4/packages/forums/lib/forums/forums-history-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/forums-history-chunk.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/forums/lib/forums/forums-history-chunk.tcl 15 May 2007 20:14:39 -0000 1.3 +++ openacs-4/packages/forums/lib/forums/forums-history-chunk.tcl 22 May 2007 09:42:08 -0000 1.4 @@ -15,16 +15,21 @@ set table_bgcolor [parameter::get -parameter table_bgcolor] set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] +# provide screen_name functionality +set screen_name [db_string select_screen_name { select screen_name from users where user_id = :user_id}] +set useScreenNameP [parameter::get -parameter "UseScreenNameP" -default 0] + template::list::create \ -html {width 50%} \ -name persons \ -multirow persons \ -key message_id \ + -pass_properties {useScreenNameP screen_name} \ -elements { name { label "\#forums.User\#" html {align left} - display_template {@persons.first_names@ @persons.last_name@} + display_template {@screen_name@@persons.first_names@ @persons.last_name@} } num_msg { label "\#forums.Number_of_Posts\#" @@ -36,10 +41,6 @@ } } -# provide screen_name functionality -set screen_name [db_string select_screen_name { select screen_name from users where user_id = :user_id}] -set useScreenNameP [parameter::get -parameter "UseScreenNameP" -default 0] - db_multirow persons select_users_wrote_post {} if {[exists_and_not_null alt_template]} { Index: openacs-4/packages/forums/lib/message/post.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/post.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/forums/lib/message/post.tcl 15 May 2007 20:14:39 -0000 1.12 +++ openacs-4/packages/forums/lib/message/post.tcl 22 May 2007 09:42:08 -0000 1.13 @@ -176,6 +176,16 @@ # DRB: Black magic cache flush call which will disappear when list builder is # rewritten to paginate internally rather than use the template paginator. cache flush "messages,forum_id=$forum_id*" + +if { [forum::use_ReadingInfo_p] } { + # remove reading info for this thread for all users (mark it unread) + set db_antwort [db_string forums_reading_info__remove_msg { + select forums_reading_info__remove_msg ( + :parent_id + ); + }] +} + if {[empty_string_p $parent_id]} { set redirect_url "[ad_conn package_url]message-view?message_id=$message_id" Index: openacs-4/packages/forums/lib/message/threads-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/Attic/threads-chunk-postgresql.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/forums/lib/message/threads-chunk-postgresql.xql 15 May 2007 20:14:40 -0000 1.4 +++ openacs-4/packages/forums/lib/message/threads-chunk-postgresql.xql 22 May 2007 09:42:08 -0000 1.5 @@ -26,9 +26,9 @@ fm.state, $replies as n_messages, to_char(fm.last_child_post, 'YYYY-MM-DD HH24:MI:SS') as last_child_post_ansi, - case when fm.last_child_post > (now() - interval '1 day') then 't' else 'f' end as new_p, - u.screen_name - from forums_messages_approved fm, + u.screen_name, + $unread_or_new_query + from forums_messages_approved fm $unread_join, users u where fm.forum_id = :forum_id and fm.user_id = u.user_id Index: openacs-4/packages/forums/lib/message/threads-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/threads-chunk.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/forums/lib/message/threads-chunk.tcl 15 May 2007 20:14:40 -0000 1.8 +++ openacs-4/packages/forums/lib/message/threads-chunk.tcl 22 May 2007 09:42:08 -0000 1.9 @@ -6,10 +6,27 @@ @cvs-id $Id$ } +if {![info exists flush_p]} {set flush_p 0} + +set user_id [ad_verify_and_get_user_id] # Get forum data forum::get -forum_id $forum_id -array forum +set useReadingInfo [forum::use_ReadingInfo_p] +if { $useReadingInfo } { + set unread_or_new_query { + case when fi.reading_date is null then 't' else 'f' end as unread_p + } + set unread_join { + left join forums_reading_info fi on fm.message_id=fi.root_message_id and fi.user_id = :user_id + } +} else { + set unread_or_new_query { + case when fm.last_child_post > (now() - interval '1 day') then 't' else 'f' end as new_p + } + set unread_join "" +} if {![info exists base_url]} { set base_url "" } @@ -48,21 +65,34 @@ lappend actions [_ forums.ManageModerate] [export_vars -base "${base_url}moderate/forum" { forum_id }] [_ forums.ManageModerate] } +lappend actions [_ forums.mark_all_as_read] [export_vars -base "${base_url}mark_all_readed" { forum_id }] {} + template::list::create \ -name messages \ -multirow messages \ -page_size $page_size \ + -page_flush_p $flush_p \ -page_query_name messages_select_paginate \ - -pass_properties {moderate_p} \ + -pass_properties {moderate_p useReadingInfo} \ -actions $actions \ -elements { subject { label "#forums.Subject#" link_url_col message_url link_html {title "\#forums.goto_thread_subject\#"} display_template { - @messages.subject@ + + + @messages.subject@ + @messages.subject@ + + + + @messages.subject@ + + @messages.subject@ + } } state_pretty { Index: openacs-4/packages/forums/sql/postgresql/forums-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/forums/sql/postgresql/forums-create.sql 28 Aug 2003 09:41:54 -0000 1.2 +++ openacs-4/packages/forums/sql/postgresql/forums-create.sql 22 May 2007 09:42:09 -0000 1.3 @@ -25,3 +25,7 @@ -- Search \i forums-sc-create.sql + +-- Reading info +\i forums-reading-info-create.sql + Index: openacs-4/packages/forums/sql/postgresql/forums-reading-info-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-reading-info-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/sql/postgresql/forums-reading-info-create.sql 22 May 2007 09:43:45 -0000 1.1 @@ -0,0 +1,225 @@ +create table forums_reading_info ( + root_message_id integer + constraint forum_read_parent_id_fk + references forums_messages (message_id) + on delete cascade, + user_id integer + constraint forums_read_user_id_fk + references users(user_id) + constraint forums_read_user_id_nn + not null, + reading_date timestamp + default current_timestamp + constraint forum_read_datetime_nn + not null, + primary key forums_reading_info_pk (root_message_id,user_id), +); +create index forums_reading_info_user_index on forums_reading_info (user_id); +create index forums_reading_info_forum_message_index on forums_reading_info (root_message_id); + +create table forums_reading_info_user ( + forum_id integer + constraint forums_read_forum_id_fk + references forums_forums (forum_id) on delete cascade, + user_id integer + constraint forums_read_user_id_fk + references users(user_id) on delete cascade + constraint forums_read_user_id_nn + not null, + threads_read integer + default 0 + not null, + primary key forums_reading_info_user_pk (forum_id,user_id), +); + + +-- remove reading_info for thread (upon new message, upon message deletion, or state change) +create or replace function forums_reading_info__remove_msg (integer) +returns integer as ' +declare + p_message_id alias for $1; + v_forum_id integer; + v_reading RECORD; +begin + select forum_id from forums_messages where message_id = p_message_id into v_forum_id; + for v_reading in select user_id + from forums_reading_info + where root_message_id = p_message_id + loop + delete from forums_reading_info + where root_message_id = p_message_id and + user_id = v_reading.user_id; + UPDATE forums_reading_info_user SET threads_read=threads_read-1 WHERE forum_id= v_forum_id and user_id = v_reading.user_id; + end loop; + + return 0; +end; +' language 'plpgsql'; + + +-- mark_all_read: +create or replace function forums_reading_info__user_add_forum (integer,integer) +returns integer as ' +declare + p_forum_id alias for $1; + p_user_id alias for $2; + v_message RECORD; + v_read_p RECORD; +begin + for v_message in select message_id + from forums_messages_approved + where forum_id = p_forum_id + and parent_id is null + loop + select into v_read_p * from forums_reading_info where user_id = p_user_id and root_message_id = v_message.message_id; + if NOT FOUND + then + insert into forums_reading_info + (root_message_id,user_id) + values + (v_message.message_id,p_user_id); + end if; + end loop; + delete from forums_reading_info_user where forum_id = p_forum_id and user_id = p_user_id; + insert into forums_reading_info_user (forum_id,user_id,threads_read) VALUES (p_forum_id,p_user_id,(select approved_thread_count from forums_forums where forum_id = p_forum_id)); + return 0; +end; +' language 'plpgsql'; + +-- mark message read for user +create or replace function forums_reading_info__user_add_msg (integer,integer) +returns integer as ' +declare + p_root_message_id alias for $1; + p_user_id alias for $2; + v_read_p RECORD; + v_forum_id integer; + v_exists boolean; +begin + select forum_id from forums_messages where message_id = p_root_message_id into v_forum_id; + select into v_read_p * from forums_reading_info where user_id = p_user_id and root_message_id = p_root_message_id; + if NOT FOUND + then + insert into forums_reading_info + (root_message_id,user_id) + values + (p_root_message_id,p_user_id); + SELECT EXISTS(SELECT 1 FROM forums_reading_info_user WHERE forum_id=v_forum_id AND user_id=p_user_id) INTO v_exists; + if v_exists = true then + UPDATE forums_reading_info_user SET threads_read=threads_read+1 WHERE forum_id=v_forum_id AND user_id=p_user_id; + else + INSERT INTO forums_reading_info_user(forum_id,user_id,threads_read) VALUES (v_forum_id,p_user_id,1); + end if; + end if; + + return 0; +end; +' language 'plpgsql'; + +-- move thread to other forum +create or replace function forums_message__move_update_reading_info (integer,integer,integer) +returns integer as ' +declare + p_message_id alias for $1; + p_old_forum_id alias for $2; + p_new_forum_id alias for $3; + v_message record; + v_users record; + v_read_p record; + v_threads integer; +begin + raise notice ''updating for message %'', p_message_id; + for v_users in select user_id from forums_reading_info where root_message_id = p_message_id + loop + raise notice ''updating for user %'', v_users.user_id; + -- down the number of threads read in old forum + update forums_reading_info_user set threads_read = threads_read - 1 + where forum_id = p_old_forum_id and user_id = v_users.user_id; + -- up the number of thread read in new forum + select count(*) into v_threads from forums_reading_info_user + where forum_id = p_new_forum_id and user_id = v_users.user_id; + if v_threads = 0 then + insert into forums_reading_info_user (forum_id,user_id,threads_read) + values (p_new_forum_id,v_users.user_id,1); + else + update forums_reading_info_user set threads_read = threads_read + 1 + where forum_id = p_new_forum_id and user_id = v_users.user_id; + end if; + end loop; + + return 1; + +end;' language 'plpgsql'; + + +-- move thread to other thread +create or replace function forums_message__move_thread_thread_update_reading_info (integer,integer, integer) +returns integer as ' +declare + p_source_message_id alias for $1; + p_source_forum_id alias for $2; + p_target_message_id alias for $3; + v_target_forum_id integer; + v_users record; +begin + select forum_id from forums_messages where message_id = p_target_message_id into v_target_forum_id; + -- for all users that have read target, but not the source, remove target_info + for v_users in select user_id from forums_reading_info fri where root_message_id = p_target_message_id and not exists(select 1 from forums_reading_info where root_message_id = p_source_message_id and user_id = fri.user_id) + loop + delete from forums_reading_info where root_message_id = p_target_message_id and user_id = v_users.user_id; + -- down the number of threads read in target forum + update forums_reading_info_user set threads_read = threads_read - 1 + where forum_id = v_target_forum_id and user_id = v_users.user_id; + end loop; + -- for all users that have read source, down the nummber of thread in source forum and remove reading info four source message since it no longer is root_message_id + for v_users in select user_id from forums_reading_info where root_message_id = p_source_message_id + loop + delete from forums_reading_info where root_message_id = p_source_message_id and user_id = v_users.user_id; + update forums_reading_info_user set threads_read = threads_read - 1 + where forum_id = p_source_forum_id and user_id = v_users.user_id; + end loop; + return 1; + +end;' language 'plpgsql'; + +-- move message to other thread +create or replace function forums_message__move_thread_update_reading_info (integer,integer,integer) +returns integer as ' +declare + p_source_message_id alias for $1; + p_source_old_root_message_id alias for $2; + p_target_message_id alias for $3; + v_target_forum_id integer; + v_users record; +begin + select forum_id from forums_messages where message_id = p_target_message_id into v_target_forum_id; + raise notice ''v_target_forum_id %'', v_target_forum_id; + -- for all users that have read target, but not the source, remove target_info + for v_users in select user_id from forums_reading_info fri where root_message_id = p_target_message_id and not exists(select 1 from forums_reading_info where root_message_id = p_source_old_root_message_id and user_id = fri.user_id) + loop + delete from forums_reading_info where root_message_id = p_target_message_id and user_id = v_users.user_id; + -- down the number of threads read in target forum + update forums_reading_info_user set threads_read = threads_read - 1 + where forum_id = v_target_forum_id and user_id = v_users.user_id; + end loop; + return 1; + +end;' language 'plpgsql'; + + +-- recount reading_info_user from reading_info +create or replace function forums_message__repair_reading_info () +returns integer as ' +declare +v_users record; +begin +delete from forums_reading_info_user; +for v_users in +select user_id,(select forum_id from forums_messages where message_id = root_message_id) as forum_id, count(root_message_id) as threads_read from forums_reading_info group by forum_id,user_id +loop +insert into forums_reading_info_user (forum_id,user_id,threads_read) +values +(v_users.forum_id,v_users.user_id,v_users.threads_read); +end loop; +return 1; +end;' language 'plpgsql'; \ No newline at end of file Index: openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.3d5-1.3d6.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.3d5-1.3d6.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.3d5-1.3d6.sql 22 May 2007 09:43:45 -0000 1.1 @@ -0,0 +1 @@ +\i forums-reading-info-create.sql \ No newline at end of file Index: openacs-4/packages/forums/tcl/forums-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-procs.tcl,v diff -u -r1.21 -r1.22 --- openacs-4/packages/forums/tcl/forums-procs.tcl 8 Aug 2006 21:26:52 -0000 1.21 +++ openacs-4/packages/forums/tcl/forums-procs.tcl 22 May 2007 09:42:09 -0000 1.22 @@ -163,3 +163,10 @@ } { db_dml update_forum_disabled_p {} } + +ad_proc -public forum::use_ReadingInfo_p {} { + # this depends on site-wide package parameters implemented in openacs core + # http://openacs.org/bugtracker/openacs/patch?patch%5fnumber=845 + # return [parameter::get_from_package_key -package_key forums -parameter UseReadingInfo] + return 0 +} \ No newline at end of file Index: openacs-4/packages/forums/tcl/messages-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/messages-procs.tcl,v diff -u -r1.37 -r1.38 --- openacs-4/packages/forums/tcl/messages-procs.tcl 15 May 2007 20:14:40 -0000 1.37 +++ openacs-4/packages/forums/tcl/messages-procs.tcl 22 May 2007 09:42:09 -0000 1.38 @@ -268,6 +268,15 @@ callback forum::message_delete -package_id [ad_conn package_id] -message_id $message_id } + if { [forum::use_ReadingInfo_p] && [expr { [db_string is_root "select parent_id from forums_messages where message_id = :message_id"] == "" } ] } { + set db_antwort [db_string forums_reading_info__remove_msg { + select forums_reading_info__remove_msg ( + :message_id + ); + }] + } + + # Remove the notifications notification::request::delete_all -object_id $message_id Index: openacs-4/packages/forums/www/forum-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/forum-view.adp,v diff -u -r1.33 -r1.34 --- openacs-4/packages/forums/www/forum-view.adp 15 May 2007 20:14:40 -0000 1.33 +++ openacs-4/packages/forums/www/forum-view.adp 22 May 2007 09:42:09 -0000 1.34 @@ -18,5 +18,5 @@ @notification_chunk;noquote@

- + Index: openacs-4/packages/forums/www/forum-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/forum-view.tcl,v diff -u -r1.27 -r1.28 --- openacs-4/packages/forums/www/forum-view.tcl 8 Aug 2006 21:26:53 -0000 1.27 +++ openacs-4/packages/forums/www/forum-view.tcl 22 May 2007 09:42:09 -0000 1.28 @@ -9,6 +9,7 @@ } -query { forum_id:integer,notnull {orderby "last_child_post,desc"} + {flush_p 0} page:optional } Index: openacs-4/packages/forums/www/mark_all_readed.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/mark_all_readed.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/www/mark_all_readed.tcl 22 May 2007 09:43:45 -0000 1.1 @@ -0,0 +1,21 @@ +ad_page_contract { + + one forum view + + @author Andreas Benisch (andreas.benisch@wu-wien.ac.at) + @creation-date 2004-09-06 + +} { + forum_id:integer,notnull +} + + set user_id [ad_verify_and_get_user_id] + set db_antwort [db_string forums_reading_info__user_add_forum { + select forums_reading_info__user_add_forum ( + :forum_id, + :user_id + ); + }] + + +ad_returnredirect forum-view?forum_id=$forum_id \ No newline at end of file Index: openacs-4/packages/forums/www/message-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-view.tcl,v diff -u -r1.35 -r1.36 --- openacs-4/packages/forums/www/message-view.tcl 15 May 2007 20:14:40 -0000 1.35 +++ openacs-4/packages/forums/www/message-view.tcl 22 May 2007 09:42:09 -0000 1.36 @@ -80,6 +80,17 @@ set notification_chunk "" } +if { [forum::use_ReadingInfo_p] && [string equal $message(state) approved] } { + set msg_id $message(root_message_id) + set user_id [ad_verify_and_get_user_id] + set db_antwort [db_string forums_reading_info__user_add_msg { + select forums_reading_info__user_add_msg ( + :msg_id, + :user_id + ); + }] +} + set context [list [list "./forum-view?forum_id=$message(forum_id)" "$message(forum_name)"]] if {![empty_string_p $message(parent_id)]} { lappend context [list "./message-view?message_id=$message(root_message_id)" "$message(root_subject)"] Index: openacs-4/packages/forums-portlet/www/forums-portlet-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums-portlet/www/Attic/forums-portlet-postgresql.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/forums-portlet/www/forums-portlet-postgresql.xql 13 Jan 2005 13:58:18 -0000 1.4 +++ openacs-4/packages/forums-portlet/www/forums-portlet-postgresql.xql 22 May 2007 09:42:09 -0000 1.5 @@ -12,7 +12,7 @@ where site_nodes.object_id = forums_forums.package_id) as url, forums_forums.forum_id, forums_forums.name, - case when last_modified > (cast(current_timestamp as date)- 1) then 't' else 'f' end as new_p + $unread_or_new_query from forums_forums_enabled forums_forums, acs_objects where acs_objects.object_id = forums_forums.forum_id and Index: openacs-4/packages/forums-portlet/www/forums-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums-portlet/www/forums-portlet.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/forums-portlet/www/forums-portlet.tcl 4 Mar 2007 20:17:03 -0000 1.13 +++ openacs-4/packages/forums-portlet/www/forums-portlet.tcl 22 May 2007 09:42:09 -0000 1.14 @@ -34,13 +34,37 @@ set user_id [ad_conn user_id] -template::list::create -name forums -multirow forums -key forum_id -html {width 100%} -pass_properties { +set useReadingInfo [forum::use_ReadingInfo_p] +if { $useReadingInfo } { + set unread_or_new_query { + approved_thread_count-COALESCE((SELECT forums_reading_info_user.threads_read WHERE + forums_reading_info_user.forum_id=forums_forums_enabled.forum_id AND forums_reading_info_user.user_id=:user_id),0) + as count_unread + } +} else { + set unread_or_new_query { + case when last_modified > (cast(current_timestamp as date)- 1) then 't' else 'f' end as new_p + } +} + +template::list::create -name forums -multirow forums -key forum_id -pass_properties { + useReadingInfo } -elements { item { label "" display_template { @forums.parent_name@
+ + + + + » @forums.name@ + + (@forums.count_unread@) + + + » @forums.name@ @@ -50,6 +74,8 @@ » @forums.name@
+
+
} }