Index: openacs-4/packages/forums/forums.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/forums.info,v diff -u -r1.25 -r1.25.2.1 --- openacs-4/packages/forums/forums.info 11 Dec 2003 21:40:04 -0000 1.25 +++ openacs-4/packages/forums/forums.info 22 Jun 2004 16:53:38 -0000 1.25.2.1 @@ -7,14 +7,14 @@ f f - + OpenACS Online discussion forums. 2003-11-10 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. - + Index: openacs-4/packages/forums/lib/message/edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/edit.tcl,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/forums/lib/message/edit.tcl 17 Dec 2003 15:45:29 -0000 1.1 +++ openacs-4/packages/forums/lib/message/edit.tcl 22 Jun 2004 16:53:41 -0000 1.1.2.1 @@ -18,13 +18,15 @@ forums::form::message message if {[form is_valid message]} { - template::form get_values message message_id subject content html_p + template::form get_values message message_id subject message_body + set content [string trimright [template::util::richtext::get_property contents $message_body]] + set format [string trimright [template::util::richtext::get_property format $message_body]] forum::message::edit \ -message_id $message_id \ -subject $subject \ -content $content \ - -html_p $html_p + -format $format ad_returnredirect "$return_url?message_id=$message_id" ad_script_abort @@ -33,8 +35,7 @@ # Prepare the other data element set_properties message message_id -value $message(message_id) element set_properties message subject -value $message(subject) -element set_properties message content -value $message(content) -element set_properties message html_p -value $message(html_p) +element set_properties message message_body -value [list $message(content) $message(format)] if {[info exists alt_template]} { ad_return_template $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.3.2.1 -r1.3.2.2 --- openacs-4/packages/forums/lib/message/post.tcl 26 Apr 2004 17:53:23 -0000 1.3.2.1 +++ openacs-4/packages/forums/lib/message/post.tcl 22 Jun 2004 16:53:41 -0000 1.3.2.2 @@ -43,6 +43,10 @@ -datatype text \ -widget hidden +if { [exists_and_not_null content] && [exists_and_not_null format] } { + element set_properties message message_body -value [list $content $format] +} + if {[form is_request message]} { ############################## # Form initialisation @@ -77,8 +81,7 @@ forum_id \ parent_id \ subject \ - content \ - html_p \ + message_body \ confirm_p \ subscribe_p \ anonymous_p \ @@ -96,10 +99,11 @@ set confirm_p 1 set subject.spellcheck ":nospell:" set content.spellcheck ":nospell:" - set content [string trimright $content] - set exported_vars [export_form_vars message_id forum_id parent_id subject content html_p confirm_p subject.spellcheck content.spellcheck anonymous_p attach_p] + set content [string trimright [template::util::richtext::get_property contents $message_body]] + set format [string trimright [template::util::richtext::get_property format $message_body]] + set exported_vars [export_vars -form {message_id forum_id parent_id subject {message_body $content} {message_body.format $format} confirm_p subject.spellcheck content.spellcheck anonymous_p attach_p}] - set message(html_p) $html_p + set message(format) $format set message(subject) $subject set message(content) $content set message(user_id) $displayed_user_id @@ -125,13 +129,15 @@ } if { [string equal $action "post"] } { + set content [string trimright [template::util::richtext::get_property contents $message_body]] + set format [string trimright [template::util::richtext::get_property format $message_body]] forum::message::new \ -forum_id $forum_id \ -message_id $message_id \ -parent_id $parent_id \ -subject $subject \ -content $content \ - -html_p $html_p \ + -format $format \ -user_id $displayed_user_id if {[empty_string_p $parent_id]} { Index: openacs-4/packages/forums/lib/message/row.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/row.tcl,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/forums/lib/message/row.tcl 17 Dec 2003 15:45:29 -0000 1.1 +++ openacs-4/packages/forums/lib/message/row.tcl 22 Jun 2004 16:53:41 -0000 1.1.2.1 @@ -17,7 +17,7 @@ set table_bgcolor $bgcolor } -if { [string is false $message(html_p)] } { +if { [string compare $message(format) "text/plain"] == 0 } { set message(content) [ad_text_to_html -- $message(content)] } Index: openacs-4/packages/forums/lib/message/thread-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/thread-chunk-oracle.xql,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/forums/lib/message/thread-chunk-oracle.xql 17 Dec 2003 15:45:29 -0000 1.1 +++ openacs-4/packages/forums/lib/message/thread-chunk-oracle.xql 22 Jun 2004 16:53:41 -0000 1.1.2.1 @@ -21,7 +21,7 @@ 0 as n_attachments, subject, content, - html_p, + format, person.name(user_id) as user_name, to_char(posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, tree.tree_level(tree_sortkey) as tree_level, @@ -41,7 +41,7 @@ (select count(*) from attachments where object_id = message_id) as n_attachments, subject, content, - html_p, + format, person.name(user_id) as user_name, to_char(posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, tree.tree_level(tree_sortkey) as tree_level, Index: openacs-4/packages/forums/lib/message/thread-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/thread-chunk-postgresql.xql,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/forums/lib/message/thread-chunk-postgresql.xql 17 Dec 2003 15:45:29 -0000 1.1 +++ openacs-4/packages/forums/lib/message/thread-chunk-postgresql.xql 22 Jun 2004 16:53:41 -0000 1.1.2.1 @@ -21,7 +21,7 @@ 0 as n_attachments, subject, content, - html_p, + format, person__name(user_id) as user_name, to_char(posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, tree_level(tree_sortkey) as tree_level, @@ -41,7 +41,7 @@ (select count(*) from attachments where object_id = message_id) as n_attachments, subject, content, - html_p, + format, person__name(user_id) as user_name, to_char(posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, tree_level(tree_sortkey) as tree_level, Index: openacs-4/packages/forums/sql/oracle/forums-messages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/oracle/forums-messages-create.sql,v diff -u -r1.7 -r1.7.4.1 --- openacs-4/packages/forums/sql/oracle/forums-messages-create.sql 30 Sep 2003 05:19:19 -0000 1.7 +++ openacs-4/packages/forums/sql/oracle/forums-messages-create.sql 22 Jun 2004 16:53:42 -0000 1.7.4.1 @@ -19,13 +19,6 @@ references forums_forums (forum_id), subject varchar(200), content clob, - -- html_p only applies to the body. The subject is plaintext. - html_p char(1) - default 'f' - constraint forums_mess_html_p_ck - check (html_p in ('t','f')) - constraint forums_mess_html_p_nn - not null, user_id integer constraint forums_mess_user_id_fk references users(user_id) Index: openacs-4/packages/forums/sql/oracle/forums-messages-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/oracle/forums-messages-package-create.sql,v diff -u -r1.6 -r1.6.4.1 --- openacs-4/packages/forums/sql/oracle/forums-messages-package-create.sql 3 Oct 2003 19:38:15 -0000 1.6 +++ openacs-4/packages/forums/sql/oracle/forums-messages-package-create.sql 22 Jun 2004 16:53:42 -0000 1.6.4.1 @@ -20,7 +20,7 @@ forum_id in forums_messages.forum_id%TYPE, subject in forums_messages.subject%TYPE, content in varchar, - html_p in forums_messages.html_p%TYPE default 'f', + format in forums_messages.format%TYPE default 'text/plain', user_id in forums_messages.user_id%TYPE, posting_date in forums_messages.posting_date%TYPE default sysdate, state in forums_messages.state%TYPE default null, @@ -68,7 +68,7 @@ forum_id in forums_messages.forum_id%TYPE, subject in forums_messages.subject%TYPE, content in varchar, - html_p in forums_messages.html_p%TYPE default 'f', + format in forums_messages.format%TYPE default 'text/plain', user_id in forums_messages.user_id%TYPE, posting_date in forums_messages.posting_date%TYPE default sysdate, state in forums_messages.state%TYPE default null, @@ -111,9 +111,9 @@ end if; insert into forums_messages - (message_id, forum_id, subject, content, html_p, user_id, posting_date, parent_id, state) + (message_id, forum_id, subject, content, format, user_id, posting_date, parent_id, state) values - (v_message_id, forum_id, subject, content, html_p, user_id, posting_date, parent_id, v_state); + (v_message_id, forum_id, subject, content, format, user_id, posting_date, parent_id, v_state); -- DRB: Can't use root_message_id() here because it triggers a "mutating table" error Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/forums/sql/oracle/upgrade/upgrade-1.0d4-1.0.1d2.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql,v diff -u -r1.9 -r1.9.4.1 --- openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql 30 Sep 2003 05:19:19 -0000 1.9 +++ openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql 22 Jun 2004 16:53:43 -0000 1.9.4.1 @@ -19,13 +19,6 @@ references forums_forums (forum_id), subject varchar(200), content text, - -- html_p only applies to the body. The subject is plaintext. - html_p char(1) - default 'f' - constraint forums_mess_html_p_ck - check (html_p in ('t','f')) - constraint forums_mess_html_p_nn - not null, user_id integer constraint forums_mess_user_id_fk references users(user_id) Index: openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql,v diff -u -r1.13 -r1.13.2.1 --- openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql 11 Dec 2003 21:40:04 -0000 1.13 +++ openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql 22 Jun 2004 16:53:43 -0000 1.13.2.1 @@ -12,7 +12,7 @@ -- chunks lifted from Gilbert. Thanks Orchard Labs! -- -select define_function_args ('forums_message__new', 'message_id,object_type;forums_message,forum_id,subject,content,html_p,user_id,posting_date,state,parent_id,creation_date,creation_user,creation_ip,context_id'); +select define_function_args ('forums_message__new', 'message_id,object_type;forums_message,forum_id,subject,content,format,user_id,posting_date,state,parent_id,creation_date,creation_user,creation_ip,context_id'); create function forums_message__new (integer,varchar,integer,varchar,text,char,integer,timestamptz,varchar,integer,timestamptz,integer,varchar,integer) returns integer as ' @@ -22,7 +22,7 @@ p_forum_id alias for $3; p_subject alias for $4; p_content alias for $5; - p_html_p alias for $6; + p_format alias for $6; p_user_id alias for $7; p_posting_date alias for $8; p_state alias for $9; @@ -66,9 +66,9 @@ end if; insert into forums_messages - (message_id, forum_id, subject, content, html_p, user_id, posting_date, parent_id, state) + (message_id, forum_id, subject, content, format, user_id, posting_date, parent_id, state) values - (v_message_id, p_forum_id, p_subject, p_content, p_html_p, p_user_id, v_posting_date, p_parent_id, v_state); + (v_message_id, p_forum_id, p_subject, p_content, p_format, p_user_id, v_posting_date, p_parent_id, v_state); update forums_forums set last_post = v_posting_date Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.0d4-1.0.1d2.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/forums/tcl/form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/form-procs.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/forums/tcl/form-procs.tcl 2 Mar 2004 15:52:43 -0000 1.2 +++ openacs-4/packages/forums/tcl/form-procs.tcl 22 Jun 2004 16:53:43 -0000 1.2.2.1 @@ -27,37 +27,22 @@ -widget text \ -html {size 60} - template::element create $form_name ${prefix}content \ + template::element create $form_name ${prefix}message_body \ -label [_ forums.Body] \ - -datatype text \ - -widget textarea \ + -datatype richtext \ + -widget richtext \ -html {rows 20 cols 60 wrap soft} \ - template::element create $form_name ${prefix}html_p \ - -label [_ forums.Format] \ - -datatype text \ - -widget radio \ - -options [list [list [_ forums.text] f] [list [_ forums.html] t]] \ - -value f - ############################## # Form validation # set subject_val [list] - set content_val [list html \ - {expr {[string match $html_p "f"] || \ - ([string match $html_p "t"] && \ - [empty_string_p \ - [set v_message \ - [ad_quotehtml \ - [ad_html_security_check $value]]]])}} \ - {}] + set content_val [list] if {$optional_p} { template::element set_properties $form_name ${prefix}subject -optional - template::element set_properties $form_name ${prefix}content -optional - template::element set_properties $form_name ${prefix}html_p -optional + template::element set_properties $form_name ${prefix}message_body -optional } else { lappend subject_val \ {expr ![empty_string_p [string trim $value]]} \ @@ -71,7 +56,7 @@ template::element set_properties $form_name ${prefix}subject \ -validate $subject_val - template::element set_properties $form_name ${prefix}content \ + template::element set_properties $form_name ${prefix}message_body \ -validate $content_val } 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.24.2.1 -r1.24.2.2 --- openacs-4/packages/forums/tcl/messages-procs.tcl 26 Apr 2004 17:53:24 -0000 1.24.2.1 +++ openacs-4/packages/forums/tcl/messages-procs.tcl 22 Jun 2004 16:53:43 -0000 1.24.2.2 @@ -16,7 +16,7 @@ {-parent_id ""} {-subject:required} {-content:required} - {-html_p "f"} + {-format "text/plain"} {-user_id ""} } { create a new message @@ -30,7 +30,7 @@ set original_message_id $message_id # Prepare the variables for instantiation set extra_vars [ns_set create] - oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {forum_id message_id parent_id subject content html_p user_id} + oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {forum_id message_id parent_id subject content format user_id} db_transaction { set message_id [package_instantiate_object -extra_vars $extra_vars forums_message] @@ -92,7 +92,7 @@ Author: $message(user_name) ($message(user_email))\n\n" - if { $message(html_p) } { + if { [string compare $message(format) "text/plain"] != 0 } { append text_version [ad_html_to_text -- $message(content)] } else { append text_version [wrap_string $message(content)] @@ -131,7 +131,7 @@ {-message_id:required} {-subject:required} {-content:required} - {-html_p:required} + {-format:required} } { Editing a message. There is no versioning here! This means this function is for admins only! @@ -140,14 +140,14 @@ db_dml update_message {} } -ad_proc -public forum::message::set_html_p { +ad_proc -public forum::message::set_format { {-message_id:required} - {-html_p:required} + {-format:required} } { set whether a message is HTML or not } { # Straight update to the DB - db_dml update_message_html_p + db_dml update_message_format } ad_proc -public forum::message::get { Index: openacs-4/packages/forums/tcl/messages-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/messages-procs.xql,v diff -u -r1.3 -r1.3.8.1 --- openacs-4/packages/forums/tcl/messages-procs.xql 20 Sep 2002 21:31:26 -0000 1.3 +++ openacs-4/packages/forums/tcl/messages-procs.xql 22 Jun 2004 16:53:43 -0000 1.3.8.1 @@ -1,10 +1,10 @@ - + update forums_messages - set html_p = :html_p + set format = :format where message_id = :message_id @@ -14,7 +14,7 @@ update forums_messages set subject = :subject, content = :content, - html_p = :html_p + format = :format where message_id = :message_id Index: openacs-4/packages/forums/www/message-post.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-post.tcl,v diff -u -r1.31 -r1.31.2.1 --- openacs-4/packages/forums/www/message-post.tcl 26 Feb 2004 15:29:16 -0000 1.31 +++ openacs-4/packages/forums/www/message-post.tcl 22 Jun 2004 16:53:44 -0000 1.31.2.1 @@ -9,7 +9,6 @@ } -query { {forum_id ""} {parent_id ""} - {html_p "f"} } -validate { forum_id_or_parent_id { if {[empty_string_p $forum_id] && [empty_string_p $parent_id]} {