Index: openacs-4/packages/sloan-bboard/sql/oracle/bboard-packages.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/sloan-bboard/sql/oracle/bboard-packages.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/sloan-bboard/sql/oracle/bboard-packages.sql 23 Feb 2002 16:23:51 -0000 1.3 +++ openacs-4/packages/sloan-bboard/sql/oracle/bboard-packages.sql 25 Feb 2002 13:29:56 -0000 1.4 @@ -171,6 +171,16 @@ message_id in bboard_messages_all.message_id%TYPE ); + function new_p ( + message_id in bboard_messages_all.message_id%TYPE, + user_id in users.user_id%TYPE + ) return char; + + procedure mark_read ( + message_id in bboard_messages_all.message_id%TYPE, + user_id in users.user_id%TYPE + ); + end bboard_message; / show errors @@ -691,6 +701,64 @@ acs_message.delete(message_id); end remove; + + function new_p ( + message_id in bboard_messages_all.message_id%TYPE, + user_id in users.user_id%TYPE + ) return char + is + v_track_new char(1); + v_user_has_viewed_p char(1); + v_newness_threshhold date; + v_message_date date; + begin + -- figure out if this forum tracks individual messages + select track_new_postings_p into v_track_new from bboard_forums where forum_id = (select forum_id from bboard_forum_message_map where message_id= new_p.message_id); + + -- if it does, check if the user has viewed the message + if v_track_new ='t' then + v_user_has_viewed_p:= 'f'; + + select 't' into v_user_has_viewed_p from dual where exists + (select 1 from bboard_message_user_map where message_id= new_p.message_id and user_id= new_p.user_id); + + return v_user_has_viewed_p; + end if; + + -- otherwise, look up the user preference parameter for newness + -- currently hacked, cause no preference mechanism + select second_to_last_visit into v_newness_threshhold + from users where user_id= new_p.user_id; + + -- calculate if the message is new according to the preference + select sent_date into v_message_date from acs_messages + where message_id= new_p.message_id; + + if (v_message_date > v_newness_threshhold) then + return 't'; + else + return 'f'; + end if; + end new_p; + + procedure mark_read ( + message_id in bboard_messages_all.message_id%TYPE, + user_id in users.user_id%TYPE + ) + is + v_track_new char(1); + begin + -- figure out if this forum tracks individual messages + select track_new_postings_p into v_track_new from bboard_forums where forum_id = (select forum_id from bboard_forum_message_map where message_id= mark_read.message_id); + + -- if it doesn't, stop here + if v_track_new = 't' then + insert into bboard_message_user_map + (message_id, user_id, view_date) values + (message_id, user_id, sysdate); + end if; + end mark_read; + end bboard_message; / show errors Index: openacs-4/packages/sloan-bboard/tcl/bboard-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/sloan-bboard/tcl/bboard-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/sloan-bboard/tcl/bboard-procs.tcl 24 Feb 2002 22:19:39 -0000 1.3 +++ openacs-4/packages/sloan-bboard/tcl/bboard-procs.tcl 25 Feb 2002 13:29:56 -0000 1.4 @@ -904,6 +904,16 @@ return "full" } +ad_proc -public bboard_forum_name { +} { + return "Bboard" +} + +ad_proc -public bboard_forum_name_plural { +} { + return "Bboards" +} + ad_proc -public bboard_alert_from_address { } { Returns an appropriate from address for bboard alerts. Index: openacs-4/packages/sloan-bboard/www/forum-entry.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/sloan-bboard/www/forum-entry.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/sloan-bboard/www/forum-entry.adp 23 Feb 2002 16:23:52 -0000 1.2 +++ openacs-4/packages/sloan-bboard/www/forum-entry.adp 25 Feb 2002 13:29:56 -0000 1.3 @@ -11,7 +11,7 @@ - Forum Type: + <%= [bboard_forum_name] %> Type: