GC-BBoard

part of the ArsDigita Community System by Tzu-Mainn Chen

The Big Idea

At arsDigita, one of the more frequent requests is for a threaded bulletin board. Unfortunately, the current bboard module has difficulty supporting threaded messages; furthermore, the module as a whole is somewhat clunky, having been one of the first to be developed. ACS 4.0 will contain an updated bboard that will meet current requirements; however, it has not yet been released, and many clients want a threaded bboard now.

When this issue came up for USLaw, Michael Yoon proposed a quick-and-dirty solution: implement bboard functionality using the general-comments module (hence gc-bboard), thus making development simpler and more supportable by pre-existing ACS code.

Under the Hood

The data model is not extensive, as the major chunk is pre-written in general comments. The one addition to general_comments is a boolean intended to mark a comment as part of a bboard or not. This allows for easier querying.

alter table general_comments add (bboard_p char(1) default 'f' check(bboard_p in ('t','f')));

create index gc_comment_date_idx on general_comments(comment_date);
create index gc_show_p_idx on general_comments(bboard_p, approved_p);
create index gc_comment_on_what_ids_idx on general_comments(comment_id, on_what_id);

create or replace view gc_bboard_messages
as select * from general_comments where bboard_p = 't';

The major new table is gc_bboard_topics:

-- NEW TABLES

create sequence gc_bboard_topics_id_seq;

create table gc_bboard_topics (
	topic_id   	integer primary key,
	name		varchar(100) unique not null,
	active_p 	char(1) default 'f' check(active_p in ('t','f')),
	max_bboard_display_depth integer default 2,
	max_bboard_display_messages integer default 10,
	creation_user	references users,
	creation_date   date default sysdate,
	creation_ip	varchar(50),
	group_id	references user_groups,
	auto_subscribe_p char(1) default 'f' check (auto_subscribe_p in ('t', 'f'))
);

-- denormalization to make the topic of each comment easily accessible
create table gc_comment_topic_map (
	comment_id	references general_comments,
	topic_id	references gc_bboard_topics,
	primary key(comment_id, topic_id)
);
The two essential procedures are gc_bboard_message_add and gc_bboard_message_list. gc_bboard_message_add inserts a message into the system, using ad_general_comment_add; it also takes the exact same arguments, plus topic_id and an optional subscribe_p (for alerts; more on that later). gc_bboard_message_list returns a Tcl list-of-lists of bboard message information in an order intended to allow for easy processing into HTML. gc_bboard_message_list takes thes following arguments:

Scope and Permissioning

Scope is limited to public vs. group; it's only handled on the topic level by setting group_id.

Permissioning is handled with general_permissions.

Message Display

The current gc_bboard display format for users is a horrible amalagation of USLaw and Sloan requests. The original format can still be found through the admin pages.

Administration

Group administration allows administrators to add topics, toggle message approval, edit messages, delete message branches, and play with permissions.

Site-wide administration allows site-wide admins to add topics.

Message Alerts

A series of mapping tables allows alerts to be sent whenever a new message is created. Alerts can be based on: Alerts are sent through a scheduled proc, gc_send_bboard_alerts.

A group bboard has to option to autosubscribe new members - this is toggled in the bboard admin page.

Reply Through Email

This feature allows users to reply to a bboard posting by sending an email. The process is exactly like that which is used for the ticket tracker (gc_bboard_email_process in gc_bboard_email_procs.tcl is directly modified from ticket_email_process in ticket-email.tcl). Thus, to set this feature up, you need to: Since there are likely to be many, many problems along the way, here are some useful links:

Future Plans

. . . and then scrap it all, 'cuz ACS 4.0 is coming, bigger and badder than ever!
tzumainn@arsdigita.com