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.20 -r1.21 --- openacs-4/packages/forums/catalog/forums.en_US.ISO-8859-1.xml 28 Oct 2003 17:04:04 -0000 1.20 +++ openacs-4/packages/forums/catalog/forums.en_US.ISO-8859-1.xml 17 Dec 2003 15:45:29 -0000 1.21 @@ -4,6 +4,7 @@ Administer Administration approve + Anonymous Are you sure you want to delete this message and <strong>all replies to it</strong>? Attach? Attachments: Index: openacs-4/packages/forums/lib/forums/admin-forums-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/admin-forums-chunk.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/forums/admin-forums-chunk.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/packages/forums/lib/forums/admin-forums-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/admin-forums-chunk.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/forums/admin-forums-chunk.tcl 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,69 @@ +ad_page_contract { + + Forums Administration + + @author Ben Adida (ben@openforce.net) + @creation-date 2002-05-24 + @cvs-id $Id: admin-forums-chunk.tcl,v 1.1 2003/12/17 15:45:29 leed Exp $ + +} + +template::list::create \ + -name forums \ + -multirow forums \ + -elements { + edit { + label {} + sub_class narrow + display_template { + + } + link_url_col edit_url + } + name { + label "#forums.Forum_Name#" + link_url_col view_url + } + enabled { + label "Enabled" + html { align center } + display_template { + + \#forums.disable\# + + + \#forums.enable\# + + } + } + permissions { + label "#acs-subsite.Permissions#" + display_template "#acs-subsite.Permissions#" + link_url_col permissions_url + } + } + + +# List of forums +set package_id [ad_conn package_id] +db_multirow -extend { + view_url + edit_url + permissions_url + enable_url + disable_url +} forums select_forums {} { + if { [template::util::is_true $enabled_p] } { + set view_url [export_vars -base "[ad_conn package_url]forum-view" { forum_id }] + } else { + set view_url {} + } + set edit_url [export_vars -base "forum-edit" { forum_id }] + set permissions_url [export_vars -base permissions { { object_id $forum_id } }] + set enable_url [export_vars -base "forum-enable" { forum_id }] + set disable_url [export_vars -base "forum-disable" { forum_id }] +} + +if {[exists_and_not_null alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/forums/admin-forums-chunk.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/admin-forums-chunk.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/forums/admin-forums-chunk.xql 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + +select forum_id, name, posting_policy, enabled_p +from forums_forums +where package_id= :package_id +order by enabled_p desc, name + + + + Index: openacs-4/packages/forums/lib/forums/edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/forums/edit.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/packages/forums/lib/forums/edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/forums/edit.tcl 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,57 @@ +ad_page_contract { + + Edit a Forum + + @author Ben Adida (ben@openforce.net) + @creation-date 2002-05-25 + @cvs-id $Id: edit.tcl,v 1.1 2003/12/17 15:45:29 leed Exp $ + +} { +} + +form create forum + +element create forum return_url \ + -datatype text -widget hidden -optional + +element create forum forum_id \ + -label [_ forums.Forum_ID] -datatype integer -widget hidden + +forums::form::forum forum + +if {[form is_valid forum]} { + template::form get_values forum return_url forum_id name charter presentation_type posting_policy new_threads_p + + forum::edit -forum_id $forum_id \ + -name $name \ + -charter $charter \ + -presentation_type $presentation_type \ + -posting_policy $posting_policy + + forum::posting_policy_set -posting_policy $posting_policy \ + -forum_id $forum_id + + # Users can create new threads? + if {$new_threads_p} { + forum::new_questions_allow -forum_id $forum_id + } else { + forum::new_questions_deny -forum_id $forum_id + } + + ad_returnredirect $return_url + ad_script_abort +} + +if { [form is_request forum] } { + element set_properties forum return_url -value $return_url + element set_properties forum forum_id -value $forum(forum_id) + element set_properties forum name -value $forum(name) + element set_properties forum charter -value $forum(charter) + element set_properties forum presentation_type -value $forum(presentation_type) + element set_properties forum posting_policy -value $forum(posting_policy) + element set_properties forum new_threads_p -value [forum::new_questions_allowed_p -forum_id $forum(forum_id)] +} + +if {[exists_and_not_null alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/forums/forums-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/Attic/forums-chunk-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/forums/forums-chunk-oracle.xql 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,26 @@ + + + + oracle8.1.6 + + + + select forums_forums_enabled.*, + (select count(*) + from forums_messages_approved + where forums_messages_approved.forum_id = forums_forums_enabled.forum_id + and parent_id is null) as n_threads, + to_char(last_post, 'YYYY-MM-DD HH24:MI:SS') as last_post_ansi, + case when last_post > (sysdate - 1) then 't' else 'f' end as new_p + from forums_forums_enabled + where forums_forums_enabled.package_id = :package_id + and ( + forums_forums_enabled.posting_policy = 'open' + or forums_forums_enabled.posting_policy = 'moderated' + or 't' = acs_permission.permission_p(forums_forums_enabled.forum_id, :user_id, 'forum_read') + ) + order by forums_forums_enabled.name + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/forums/forums-chunk-postgresql.xql 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,26 @@ + + + + postgresql7.1 + + + + select forums_forums_enabled.*, + (select count(*) + from forums_messages_approved + where forums_messages_approved.forum_id = forums_forums_enabled.forum_id + and parent_id is null) 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 + from forums_forums_enabled + where forums_forums_enabled.package_id = :package_id + and ( + forums_forums_enabled.posting_policy = 'open' + or forums_forums_enabled.posting_policy = 'moderated' + or 't' = acs_permission__permission_p(forums_forums_enabled.forum_id, :user_id,'forum_read') + ) + order by forums_forums_enabled.name + + + + Index: openacs-4/packages/forums/lib/forums/forums-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/forums-chunk.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/forums/forums-chunk.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#forums.Forum_Name##forums.Threads##forums.Last_Post#
+ + + + @forums.name@ + + + + +
@forums.charter;noquote@ +
+
+ @forums.n_threads@ + + + @forums.last_post_ansi@ +   +
+ #forums.No_Forums# +
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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/forums/forums-chunk.tcl 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,25 @@ +ad_page_contract { + + top level list of forums + + @author Ben Adida (ben@openforce.net) + @creation-date 2002-05-24 + @cvs-id $Id: forums-chunk.tcl,v 1.1 2003/12/17 15:45:29 leed Exp $ + +} + +set package_id [ad_conn package_id] +set user_id [ad_verify_and_get_user_id] + +# get the colors from the params +set table_border_color [parameter::get -parameter table_border_color] +set table_bgcolor [parameter::get -parameter table_bgcolor] +set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] + +db_multirow -extend { last_modified_pretty } forums select_forums {} { + set last_modified_pretty [lc_time_fmt $last_post_ansi "%x %X"] +} + +if {[exists_and_not_null alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/forums/new.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/new.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/forums/new.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/packages/forums/lib/forums/new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/new.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/forums/new.tcl 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,57 @@ +ad_page_contract { + + Create a Forum + By default redirects to the level above as that is prolly where the index page is + + @author Ben Adida (ben@openforce.net) + @creation-date 2002-05-25 + @cvs-id $Id: new.tcl,v 1.1 2003/12/17 15:45:29 leed Exp $ + +} + +set package_id [ad_conn package_id] + +form create forum + +element create forum forum_id \ + -label [_ forums.Forum_ID] \ + -datatype integer \ + -widget hidden + +forums::form::forum forum + +if {[form is_valid forum]} { + template::form get_values forum \ + forum_id name charter presentation_type posting_policy new_threads_p + + set forum_id [forum::new -forum_id $forum_id \ + -name $name \ + -charter $charter \ + -presentation_type $presentation_type \ + -posting_policy $posting_policy \ + -package_id $package_id \ + ] + + forum::posting_policy_set -posting_policy $posting_policy \ + -forum_id $forum_id + + # Users can create new threads? + if {$new_threads_p} { + forum::new_questions_allow -forum_id $forum_id + } else { + forum::new_questions_deny -forum_id $forum_id + } + + ad_returnredirect $return_url + ad_script_abort +} + +if { [form is_request forum] } { + # Pre-fetch the forum_id + set forum_id [db_nextval acs_object_id_seq] + element set_properties forum forum_id -value $forum_id +} + +if {[exists_and_not_null alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/message/attachment-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/attachment-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/attachment-list.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,7 @@ + Index: openacs-4/packages/forums/lib/message/attachment-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/attachment-list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/attachment-list.tcl 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,24 @@ +ad_page_contract { + a message attachment chunk to be included to display attachments + + @author ben (ben@openforce.net) + @creation-date 2002-07-02 + @cvs-id $Id: attachment-list.tcl,v 1.1 2003/12/17 15:45:29 leed Exp $ +} + +if {![array exists message]} { + ad_return_complaint 1 "[_ forums.lt_need_to_provide_a_mes]" +} + +if {![exists_and_not_null bgcolor]} { + set bgcolor "#ffffff" +} + +# get the attachments +set attachments [attachments::get_attachments -object_id $message(message_id)] + +set attachment_graphic [attachments::graphic_url] + +if {![exists_and_not_null alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/message/delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/delete.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/delete.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,17 @@ + + + #forums.Are_you_sure_you_want_to_delete_lt# +

+ +

+ +
+ +

+ + #forums.Yes# +

+ #forums.No# +

+ + Index: openacs-4/packages/forums/lib/message/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/delete.tcl 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,29 @@ +ad_page_contract { + + Delete a Message + + @author Ben Adida (ben@openforce.net) + @creation-date 2002-05-24 + @cvs-id $Id: delete.tcl,v 1.1 2003/12/17 15:45:29 leed Exp $ + +} + +set table_border_color [parameter::get -parameter table_border_color] + +# Confirmed? +if {$confirm_p} { + # Delete the message and all children + forum::message::delete -message_id $message(message_id) + + # Redirect to the forum + ad_returnredirect "../forum-view?forum_id=$message(forum_id)" + ad_script_abort +} + +set message_id $message(message_id) + +set url_vars [export_url_vars message_id return_url] + +if {[exists_and_not_null alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/message/edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/edit.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1 @@ + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/edit.tcl 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,41 @@ +ad_page_contract { + + Form to edit a message + + @author Ben Adida (ben@openforce.net) + @creation-date 2003-12-09 + @cvs-id $Id: edit.tcl,v 1.1 2003/12/17 15:45:29 leed Exp $ + +} + +form create message + +element create message message_id \ + -label [_ forums.Message_ID] \ + -datatype integer \ + -widget hidden + +forums::form::message message + +if {[form is_valid message]} { + template::form get_values message message_id subject content html_p + + forum::message::edit \ + -message_id $message_id \ + -subject $subject \ + -content $content \ + -html_p $html_p + + ad_returnredirect "$return_url?message_id=$message_id" + ad_script_abort +} + +# 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) + +if {[info exists alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/message/messages-table.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/messages-table.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/messages-table.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#forums.Subject##forums.Author##forums.Posting_Date#
+ @messages.subject@ + @messages.user_name@@messages.posting_date@
+ #forums.No_Messages# +
Index: openacs-4/packages/forums/lib/message/messages-table.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/messages-table.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/messages-table.tcl 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,18 @@ +ad_page_contract { + + Search messages for a string + + @author Rob Denison (rob@thaum.net) + @creation-date 2003-12-08 + @cvs-id $Id: messages-table.tcl,v 1.1 2003/12/17 15:45:29 leed Exp $ + +} + +# get the colors from the params +set table_border_color [parameter::get -parameter table_border_color] +set table_bgcolor [parameter::get -parameter table_bgcolor] +set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] + +if {[exists_and_not_null alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/message/pending-list-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/pending-list-chunk-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/pending-list-chunk-oracle.xql 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,20 @@ + + + + oracle8.1.6 + + + + select message_id, + subject + from forums_messages + where forum_id = :forum_id + and tree_sortkey in (select substr(tree_sortkey, 1, 6) + from forums_messages_pending + where forum_id = :forum_id) + order by tree_sortkey + + + + + Index: openacs-4/packages/forums/lib/message/pending-list-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/pending-list-chunk-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/pending-list-chunk-postgresql.xql 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,20 @@ + + + + postgresql7.1 + + + + select message_id, + subject + from forums_messages + where forum_id = :forum_id + and tree_sortkey in (select tree_ancestor_key(tree_sortkey, 1) + from forums_messages_pending + where forum_id = :forum_id) + order by tree_sortkey + + + + + Index: openacs-4/packages/forums/lib/message/pending-list-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/pending-list-chunk.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/pending-list-chunk.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,10 @@ +

Index: openacs-4/packages/forums/lib/message/pending-list-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/pending-list-chunk.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/pending-list-chunk.tcl 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,16 @@ +ad_page_contract { + + Moderate a Forum + + @author Ben Adida (ben@openforce.net) + @creation-date 2002-05-24 + @cvs-id $Id: pending-list-chunk.tcl,v 1.1 2003/12/17 15:45:29 leed Exp $ + +} + +# Get the threads that need approval +db_multirow pending_threads select_pending_threads {} + +if {[exists_and_not_null alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/message/post-confirm.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/post-confirm.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/post-confirm.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,31 @@ +

#forums.lt_Please_confirm_the_fo#

+ +<% set table_border_color [parameter::get -parameter table_border_color] %> + +
+ + +
+
+ +
+ + @exported_vars;noquote@ + +
+ + + #forums.lt_Would_you_like_to_sub# + #forums.No# + #forums.Yes# + + +
#forums.lt_Note_that_you_are_alr# +
+ +
+
+ + + +
Index: openacs-4/packages/forums/lib/message/post-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/post-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/post-oracle.xql 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,12 @@ + + + oracle8.1.6 + + + + select to_char(sysdate, 'YYYY-MM-DD HH24:MI:SS') + from dual + + + + Index: openacs-4/packages/forums/lib/message/post-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/post-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/post-postgresql.xql 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,12 @@ + + + + postgresql7.1 + + + + select to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS') + + + + Index: openacs-4/packages/forums/lib/message/post.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/post.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/post.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,8 @@ + + + +
+
+
+ + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/post.tcl 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,169 @@ +ad_page_contract { + + Form to create message and insert it + + @author Ben Adida (ben@openforce.net) + @creation-date 2003-12-09 + @cvs-id $Id: post.tcl,v 1.1 2003/12/17 15:45:29 leed Exp $ + +} + +set user_id [ad_conn user_id] + +if {[array exists parent_message]} { + set parent_id $parent_message(message_id) +} else { + set parent_id "" +} + +set table_border_color [parameter::get -parameter table_border_color] +set table_bgcolor [parameter::get -parameter table_bgcolor] + +############################## +# Form definition +# +form create message \ + -edit_buttons [list [list [_ forums.Post] post] \ + [list [_ forums.Preview] preview]] + +element create message message_id \ + -label [_ forums.Message_ID] \ + -datatype integer \ + -widget hidden + +forums::form::message message + +forums::form::post_message \ + -show_anonymous_p [expr {$user_id != 0 && $anonymous_allowed_p}] \ + -show_attachments_p $attachments_enabled_p \ + message + +element create message confirm_p \ + -label [_ forums.Confirm] \ + -datatype text \ + -widget hidden + +if {[form is_request message]} { + ############################## + # Form initialisation + # + array set init_msg [list] + + set init_msg(message_id) [db_nextval acs_object_id_seq] + + if {[empty_string_p $parent_id]} { + forum::message::initial_message \ + -forum_id $forum_id \ + -message init_msg + } else { + forum::message::initial_message \ + -parent parent_message \ + -message init_msg + } + + set init_msg(confirm_p) 0 + set init_msg(subscribe_p) 0 + set init_msg(anonymous_p) 0 + set init_msg(attach_p) 0 + + form set_values message init_msg + +} elseif {[form is_valid message]} { + ############################## + # Form processing + # + form get_values message \ + message_id \ + forum_id \ + parent_id \ + subject \ + content \ + html_p \ + confirm_p \ + subscribe_p \ + anonymous_p + + set action [template::form::get_button message] + set displayed_user_id [ad_decode \ + [expr {$anonymous_allowed_p && $anonymous_p}] \ + 0 $user_id \ + 0] + + if { [string equal $action "preview"] } { + 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 message(html_p) $html_p + set message(subject) $subject + set message(content) $content + set message(user_id) $displayed_user_id + set message(user_name) [db_string select_name {}] + set message(posting_date_ansi) [db_string select_date {}] + set message(posting_date_pretty) [lc_time_fmt $message(posting_date_ansi) "%x %X"] + + # Let's check if this person is subscribed to the forum + # in case we might want to subscribe them to the thread + if {[empty_string_p $parent_id]} { + if {![empty_string_p [notification::request::get_request_id \ + -type_id [notification::type::get_type_id -short_name forums_forum_notif] \ + -object_id $forum_id \ + -user_id [ad_conn user_id]]]} { + set forum_notification_p 1 + } else { + set forum_notification_p 0 + } + } + + ad_return_template "/message/post-confirm" + return + } + + if { [string equal $action "post"] } { + forum::message::new \ + -forum_id $forum_id \ + -message_id $message_id \ + -parent_id $parent_id \ + -subject $subject \ + -content $content \ + -html_p $html_p \ + -user_id $displayed_user_id + + if {[empty_string_p $parent_id]} { + set redirect_url "[ad_conn package_url]message-view?message_id=$message_id" + } else { + set redirect_url "[ad_conn package_url]message-view?message_id=$parent_id" + } + + # Wrap the notifications URL + if {![empty_string_p $subscribe_p] && $subscribe_p && [empty_string_p $parent_id]} { + set notification_url [notification::display::subscribe_url \ + -type forums_message_notif \ + -object_id $message_id \ + -url $redirect_url \ + -user_id $user_id] + + # redirect to notification stuff + set redirect_url $notification_url + } + + # Wrap the attachments URL + if {$attachments_enabled_p} { + form get_values message attach_p + + if { ![empty_string_p $attach_p] && $attach_p} { + set redirect_url [attachments::add_attachment_url -object_id $message_id -return_url $redirect_url -pretty_name "[_ forums.Forum_Posting] \"$subject\""] + } + } + + # Do the redirection + ad_returnredirect $redirect_url + ad_script_abort + } +} + +if {[exists_and_not_null alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/message/post.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/Attic/post.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/post.xql 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,21 @@ + + + + + + + select first_names || ' ' || last_name + from persons + where person_id = :user_id + + + + + + select forum_id + from forums_messages + where message_id = :parent_id + + + + Index: openacs-4/packages/forums/lib/message/row.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/row.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/row.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,83 @@ + + + + + + + @message.number@: + @message.subject@ + + + @message.subject@ + + + + + + + + @message.number@ + + + + + + In response to @message.parent_number@ + + + @message.posting_date_pretty@ + + + + +
+ [ #forums.reply# + | #forums.forward# + ] + +
+ [ #forums.edit# + | #forums.delete# + + + + | #forums.approve# + + + | #forums.reject# + + + ] +
+
+ + +
+ + + + + + + + + + + +
+ @message.content;noquote@ +

+ #forums.Posted_by# @message.user_name@ +

+
+ + + + + + + #forums.Attachments# + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/row.tcl 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,39 @@ +ad_page_contract { + + a message chunk to be included in a table listing of messages + + _so that has to be wrapped in a _ + + @author yon (yon@openforce.net) + @author arjun (arjun@openforce.net) + @creation-date 2002-06-02 + @cvs-id $Id: row.tcl,v 1.1 2003/12/17 15:45:29 leed Exp $ + +} + +if {![exists_and_not_null bgcolor]} { + set table_bgcolor [parameter::get -parameter table_bgcolor] +} else { + set table_bgcolor $bgcolor +} + +if { [string is false $message(html_p)] } { + set message(content) [ad_text_to_html -- $message(content)] +} + +# convert emoticons to images if the parameter is set +if { [string is true [parameter::get -parameter DisplayEmoticonsAsImagesP -default 0]] } { + set message(content) [forum::format::emoticons -content $message(content)] +} + +# JCD: display subject only if changed from the root subject +if {![info exists root_subject]} { + set display_subject_p 1 +} else { + regsub {^(Response to |\s*Re:\s*)*} $message(subject) {} subject + set display_subject_p [expr ![string equal $subject $root_subject]] +} + +if {[exists_and_not_null alt_template]} { + ad_return_template $alt_template +} 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/thread-chunk-oracle.xql 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,59 @@ + + + + oracle8.1.6 + + + + select fma.message_id + from forums_messages fm, + forums_messages_approved fma + where fm.message_id = :root_message_id + and fma.forum_id = :forum_id + and fma.tree_sortkey between fm.tree_sortkey and tree.right(fm.tree_sortkey) + order by fma.message_id + + + + + + select message_id, + 0 as n_attachments, + subject, + content, + html_p, + 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, + state, + user_id, + parent_id + from $table_name + where forum_id = :forum_id + and tree_sortkey between tree.left(:tree_sortkey) and tree.right(:tree_sortkey) + order by $order_by + + + + + + select message_id, + (select count(*) from attachments where object_id = message_id) as n_attachments, + subject, + content, + html_p, + 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, + state, + user_id, + parent_id + from $table_name + where forum_id = :forum_id + and tree_sortkey between tree.left(:tree_sortkey) and tree.right(:tree_sortkey) + order by $order_by + + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/thread-chunk-postgresql.xql 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,59 @@ + + + + postgresql7.1 + + + + select fma.message_id + from forums_messages fm, + forums_messages_approved fma + where fm.message_id = :root_message_id + and fma.forum_id = :forum_id + and fma.tree_sortkey between fm.tree_sortkey and tree_right(fm.tree_sortkey) + order by fma.message_id + + + + + + select message_id, + 0 as n_attachments, + subject, + content, + html_p, + 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, + state, + user_id, + parent_id + from $table_name + where forum_id = :forum_id + and tree_sortkey between tree_left(:tree_sortkey) and tree_right(:tree_sortkey) + order by $order_by + + + + + + select message_id, + (select count(*) from attachments where object_id = message_id) as n_attachments, + subject, + content, + html_p, + 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, + state, + user_id, + parent_id + from $table_name + where forum_id = :forum_id + and tree_sortkey between tree_left(:tree_sortkey) and tree_right(:tree_sortkey) + order by $order_by + + + + + Index: openacs-4/packages/forums/lib/message/thread-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/thread-chunk.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/thread-chunk.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,54 @@ + +
+ + +
+ + +
+ + + + + + + +
+ + + + + + <% set width [expr 100 - [expr $responses(tree_level) - 1] * 1] %> + + + + + + + +
+ + + + + + + + + +
+
+
Index: openacs-4/packages/forums/lib/message/thread-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/thread-chunk.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/thread-chunk.tcl 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,89 @@ +ad_page_contract { + + view a message (and its children) + + @author Ben Adida (ben@openforce.net) + @creation-date 2002-05-25 + @cvs-id $Id: thread-chunk.tcl,v 1.1 2003/12/17 15:45:29 leed Exp $ + +} + +if {$forum(posting_policy) == "moderated"} { + set forum_moderated_p 1 +} else { + set forum_moderated_p 0 +} + +# get the colors from the params +set table_border_color [parameter::get -parameter table_border_color] +set table_bgcolor [parameter::get -parameter table_bgcolor] +set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] + +# Check preferences for user + +# Set some variables for easy SQL access +set forum_id $message(forum_id) +set tree_sortkey $message(tree_sortkey) + +if {[forum::attachments_enabled_p]} { + set query select_message_responses_attachments +} else { + set query select_message_responses +} + +# We set a Tcl variable for moderation now (Ben) +if { $permissions(moderate_p) } { + set table_name "forums_messages" +} else { + set table_name "forums_messages_approved" +} + +##### +# +# Find ordering of messages +# +##### + +if { [string equal $forum(presentation_type) flat] } { + set order_by "fma.posting_date, fma.tree_sortkey" +} else { + set order_by "fma.tree_sortkey" +} + +set root_message_id $message(root_message_id) +set message_id_list [db_list select_message_ordering {}] + +set direct_url_base [export_vars -base [ad_conn url] { { message_id $message(root_message_id) } }] +set message(direct_url) "$direct_url_base\#$message(message_id)" + +set message(number) [expr [lsearch $message_id_list $message(message_id)] + 1] +set message(parent_number) {} +if { [exists_and_not_null message(parent_id)] } { + set message(parent_number) [expr [lsearch $message_id_list $message(parent_id)] + 1] + set message(parent_direct_url) "$direct_url_base\#$message(parent_id)" +} + +##### +# +# Find responses +# +##### + +# More Tcl vars (we might as well use them - Ben) +if { [string equal $forum(presentation_type) flat] } { + set order_by "$table_name.posting_date, tree_sortkey" +} else { + set order_by "tree_sortkey" +} + +db_multirow -extend { posting_date_pretty direct_url number parent_number parent_direct_url } responses $query {} { + set posting_date_pretty [lc_time_fmt $posting_date_ansi "%x %X"] + set direct_url "$direct_url_base\#$message(message_id)" + set number [expr [lsearch $message_id_list $message(message_id)] + 1] + set parent_number [expr [lsearch $message_id_list $parent_id] + 1] + set parent_direct_url "$direct_url_base\#$parent_id" +} + +if {[exists_and_not_null alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/message/threads-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/Attic/threads-chunk-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/threads-chunk-oracle.xql 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,58 @@ + + + oracle8.1.6 + + + + select fm.message_id, + fm.subject, + fm.user_id, + person.name(fm.user_id) as user_name, + to_char(fm.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, + fm.state, + (select count(*) + from forums_messages_approved fm1 + where fm1.forum_id = :forum_id + and fm1.tree_sortkey between tree.left(fm.tree_sortkey) and tree.right(fm.tree_sortkey)) 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 > (sysdate - 1) then 't' else 'f' end as new_p + from forums_messages_approved fm + where fm.forum_id = :forum_id + and fm.parent_id is null + [template::list::orderby_clause -orderby -name "messages"] + + + + + + select fm.message_id, + fm.subject, + fm.user_id, + person.name(fm.user_id) as user_name, + to_char(fm.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, + fm.state, + (select count(*) + from forums_messages fm1 + where fm1.forum_id = :forum_id + and fm1.tree_sortkey between tree.left(fm.tree_sortkey) and tree.right(fm.tree_sortkey)) 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 > (sysdate - 1) then 't' else 'f' end as new_p + from forums_messages fm + where fm.forum_id = :forum_id + and fm.parent_id is null + [template::list::orderby_clause -orderby -name "messages"] + + + + + + user_name desc + + + + + user_name asc + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/threads-chunk-postgresql.xql 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,58 @@ + + + postgresql7.1 + + + + select fm.message_id, + fm.subject, + fm.user_id, + person__name(fm.user_id) as user_name, + to_char(fm.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, + fm.state, + (select count(*) + from forums_messages_approved fm1 + where fm1.forum_id = :forum_id + and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) 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 + from forums_messages_approved fm + where fm.forum_id = :forum_id + and fm.parent_id is null + [template::list::orderby_clause -orderby -name "messages"] + + + + + + select fm.message_id, + fm.subject, + fm.user_id, + person__name(fm.user_id) as user_name, + to_char(fm.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, + fm.state, + (select count(*) + from forums_messages fm1 + where fm1.forum_id = :forum_id + and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) 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 + from forums_messages_approved fm + where fm.forum_id = :forum_id + and fm.parent_id is null + [template::list::orderby_clause -orderby -name "messages"] + + + + + + lower(person__name(fm.user_id)) desc + + + + + lower(person__name(fm.user_id)) asc + + + + Index: openacs-4/packages/forums/lib/message/threads-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/threads-chunk.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/threads-chunk.adp 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1 @@ + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/message/threads-chunk.tcl 17 Dec 2003 15:45:29 -0000 1.1 @@ -0,0 +1,115 @@ +ad_page_contract { + + one forum view + + @author Ben Adida (ben@openforce.net) + @creation-date 2002-05-24 + @cvs-id $Id: threads-chunk.tcl,v 1.1 2003/12/17 15:45:29 leed Exp $ + +} + +# Get forum data +forum::get -forum_id $forum_id -array forum + +set query messages_select +if {$moderate_p} { + set query messages_select_moderator +} + +template::list::create \ + -name messages \ + -multirow messages \ + -pass_properties { moderate_p } \ + -elements { + subject { + label "#forums.Subject#" + link_url_col message_url + display_template { + @messages.subject@ + @messages.subject@ + } + } + state_pretty { + label "\#forums.Moderate\#" + hide_p {[ad_decode $moderate_p 1 0 1]} + } + user_name { + label "#forums.Author#" + link_url_col user_url + } + n_messages { + label "#forums.Replies#" + display_col n_messages_pretty + html { align right } + } + posting_date { + label "#forums.First_Post#" + display_col posting_date_pretty + } + last_child_post { + label "#forums.Last_Post#" + display_col last_child_post_pretty + } + } -orderby { + posting_date { + label "#forums.First_Post#" + orderby posting_date + default_direction desc + } + last_child_post { + label "#forums.Last_Post#" + orderby last_child_post + default_direction desc + } + subject { + label "#forums.Subject#" + orderby upper(subject) + } + user_name { + label "#forums.Author#" + orderby_asc_name "orderby_user_name_asc" + orderby_desc_name "orderby_user_name_desc" + } + n_messages { + label "#forums.Replies#" + orderby_asc {n_messages asc, posting_date desc} + orderby_desc {n_messages desc, posting_date desc} + } + } -filters { + forum_id {} + } + +db_multirow -extend { + last_child_post_pretty + posting_date_pretty + message_url + user_url + n_messages_pretty + state_pretty +} messages $query {} { + set last_child_post_ansi [lc_time_system_to_conn $last_child_post_ansi] + set last_child_post_pretty [lc_time_fmt $last_child_post_ansi "%x %X"] + + set posting_date_ansi [lc_time_system_to_conn $posting_date_ansi] + set posting_date_pretty [lc_time_fmt $posting_date_ansi "%x %X"] + + set message_url [export_vars -base "message-view" { message_id }] + set user_url [export_vars -base "user-history" { user_id }] + set n_messages_pretty [lc_numeric $n_messages] + + switch $state { + pending { + set state_pretty [_ forums.Pending] + } + rejected { + set state_pretty [_ forums.Rejected] + } + default { + set state_pretty {} + } + } +} + +if {[exists_and_not_null alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/search/search-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/search/search-chunk-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/search/search-chunk-oracle.xql 17 Dec 2003 15:45:30 -0000 1.1 @@ -0,0 +1,76 @@ + + + + oracle8.1.6 + + + + select forums_messages.*, + person.name(forums_messages.user_id) as user_name, + to_char(forums_messages.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, + 100 as the_score + from forums_messages, + forums_forums + where forums_messages.forum_id = forums_forums.forum_id + and forums_forums.package_id = :package_id + and forums_messages.state = 'approved' + and upper(forums_messages.subject || ' ' || dbms_lob.substr(forums_messages.content) || ' ' || person.name(forums_messages.user_id)) + like '%' || upper(:search_text) || '%' + order by forums_messages.posting_date desc + + + + + + select forums_messages.*, + person.name(forums_messages.user_id) as user_name, + to_char(forums_messages.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, + 100 as the_score + from forums_messages, + forums_forums + where forums_forums.forum_id = :forum_id + and forums_forums.package_id = :package_id + and forums_messages.forum_id = forums_forums.forum_id + and forums_messages.state = 'approved' + and upper(forums_messages.subject || ' ' || dbms_lob.substr(forums_messages.content) || ' ' || person.name(forums_messages.user_id)) + like '%' || upper(:search_text) || '%' + order by forums_messages.posting_date desc + + + + + + select forums_messages.*, + person.name(forums_messages.user_id) as user_name, + to_char(forums_messages.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, + score(1) as the_score + from forums_messages, + forums_forums + where forums_messages.forum_id = forums_forums.forum_id + and forums_forums.package_id = :package_id + and forums_messages.state = 'approved' + and contains(forums_messages.content, '%' || :search_text || '%', 1) > 0 + order by the_score desc, + forums_messages.posting_date desc + + + + + + select forums_messages.*, + person.name(forums_messages.user_id) as user_name, + to_char(forums_messages.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, + score(1) as the_score + from forums_messages, + forums_forums + where forums_forums.forum_id = :forum_id + and forums_forums.package_id = :package_id + and forums_messages.forum_id = forums_forums.forum_id + and forums_messages.state = 'approved' + and contains(forums_messages.content, '%' || :search_text || '%', 1) > 0 + order by the_score desc, + forums_messages.posting_date desc + + + + Index: openacs-4/packages/forums/lib/search/search-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/search/search-chunk-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/search/search-chunk-postgresql.xql 17 Dec 2003 15:45:30 -0000 1.1 @@ -0,0 +1,41 @@ + + + + postgresql7.1 + + + + select forums_messages.*, + person__name(forums_messages.user_id) as user_name, + to_char(forums_messages.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, + 100 as the_score + from forums_messages, + forums_forums + where forums_messages.forum_id = forums_forums.forum_id + and forums_forums.package_id = :package_id + and forums_messages.state = 'approved' + and upper(forums_messages.subject || ' ' || forums_messages.content || ' ' || person__name(forums_messages.user_id)) + like '%' || upper(:search_text) || '%' + order by forums_messages.posting_date desc + + + + + + select forums_messages.*, + person__name(forums_messages.user_id) as user_name, + to_char(forums_messages.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, + 100 as the_score + from forums_messages, + forums_forums + where forums_forums.forum_id = :forum_id + and forums_forums.package_id = :package_id + and forums_messages.forum_id = forums_forums.forum_id + and forums_messages.state = 'approved' + and upper(forums_messages.subject || ' ' || forums_messages.content || ' ' || person__name(forums_messages.user_id)) + like '%' || upper(:search_text) || '%' + order by forums_messages.posting_date desc + + + + Index: openacs-4/packages/forums/lib/search/search-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/search/search-chunk.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/search/search-chunk.adp 17 Dec 2003 15:45:30 -0000 1.1 @@ -0,0 +1,13 @@ + + + + +
+ + #forums.Search#  + +
+ +
+ + Index: openacs-4/packages/forums/lib/search/search-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/search/search-chunk.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/search/search-chunk.tcl 17 Dec 2003 15:45:30 -0000 1.1 @@ -0,0 +1,40 @@ +ad_page_contract { + + @author yon@openforce.net + @creation-date 2002-07-01 + @cvs-id $Id: search-chunk.tcl,v 1.1 2003/12/17 15:45:30 leed Exp $ + +} + +set package_id [ad_conn package_id] + +form create search +forums::form::search search + +if {[form is_valid search]} { + form get_values search search_text forum_id + + # remove any special characters from the search text so we + # don't crash interMedia + regsub -all {[^[:alnum:]_[:blank:]]} $search_text {} search_text + + set query search_all_forums + if {![empty_string_p $forum_id]} { + set query search_one_forum + } + + if { [parameter::get -parameter UseIntermediaForSearchP -default 0] } { + append query "_intermedia" + } + + db_multirow messages $query {} { + set posting_date_pretty [lc_time_fmt $posting_date_ansi "%x %X"] + } + +} else { + set messages:rowcount 0 +} + +if {[exists_and_not_null alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/user/post-history-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/user/post-history-chunk.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/user/post-history-chunk.adp 17 Dec 2003 15:45:30 -0000 1.1 @@ -0,0 +1,100 @@ +

+ #forums.Posting_history_for# + + <% + if {![permission::permission_p -object_id [acs_magic_object security_context_root] -privilege admin]} { + adp_puts [acs_community_member_link -user_id $user_id] + } else { + adp_puts [acs_community_member_admin_link -user_id $user_id] + } + %> + +

+ +

+

+@dimensional_chunk;noquote@ +
+

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#forums.Forum##forums.Subject##forums.Posted#
@messages.forum_name@@messages.subject@@messages.posting_date_pretty@
+ #forums.No_Postings# +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@messages.forum_name@

#forums.Subject##forums.Posted#
@messages.subject@@messages.posting_date_pretty@
+
+ +
+ +
+ +
Index: openacs-4/packages/forums/lib/user/post-history-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/user/post-history-chunk.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/user/post-history-chunk.tcl 17 Dec 2003 15:45:30 -0000 1.1 @@ -0,0 +1,42 @@ +ad_page_contract { + + Posting History for a User + + @author Ben Adida (ben@openforce.net) + @creation-date 2002-05-29 + @cvs-id $Id: post-history-chunk.tcl,v 1.1 2003/12/17 15:45:30 leed Exp $ + +} + +set package_id [ad_conn package_id] + +# get the colors from the params +set table_border_color [parameter::get -parameter table_border_color] +set table_bgcolor [parameter::get -parameter table_bgcolor] +set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] + +# choosing the view +set dimensional_list " + { + view \"[_ forums.View]:\" date { + {date \"[_ forums.by_Date]\" {}} + {forum \"[_ forums.by_Forum]\" {}} + } + } +" + +set query select_messages +if {[string equal $view forum]} { + set query select_messages_by_forum +} + +# Select the postings +db_multirow -extend { posting_date_pretty } messages $query {} { + set posting_date_pretty [lc_time_fmt $posting_date_ansi "%x %X"] +} + +set dimensional_chunk [ad_dimensional $dimensional_list] + +if {[exists_and_not_null alt_template]} { + ad_return_template $alt_template +} Index: openacs-4/packages/forums/lib/user/post-history-chunk.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/user/post-history-chunk.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/lib/user/post-history-chunk.xql 17 Dec 2003 15:45:30 -0000 1.1 @@ -0,0 +1,38 @@ + + + + + + + select forums_messages.message_id, + forums_messages.subject, + to_char(forums_messages.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, + forums_forums.forum_id, + forums_forums.name as forum_name + from forums_messages, + forums_forums + where forums_messages.user_id = :user_id + and forums_messages.forum_id = forums_forums.forum_id + and forums_forums.package_id = :package_id + order by forums_messages.posting_date desc + + + + + + select forums_messages.message_id, + forums_messages.subject, + to_char(forums_messages.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, + forums_forums.forum_id, + forums_forums.name as forum_name + from forums_messages, + forums_forums + where forums_messages.user_id = :user_id + and forums_messages.forum_id = forums_forums.forum_id + and forums_forums.package_id = :package_id + order by forum_name, + forums_messages.posting_date desc + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/tcl/form-procs.tcl 17 Dec 2003 15:45:30 -0000 1.1 @@ -0,0 +1,212 @@ +ad_library { + + Reusable forms in the forums package + + @author lee@thaum.net + @creation-date 2003-11-12 +} + +namespace eval forums { +namespace eval form { + +ad_proc -public message { + {-optional:boolean} + {-prefix {}} + form_name +} { + adds form elements to form_name which represent the data held in a forum + message +} { + + ############################## + # Form definition + # + template::element create $form_name ${prefix}subject \ + -label [_ forums.Subject] \ + -datatype text \ + -widget text \ + -html {size 60} + + template::element create $form_name ${prefix}content \ + -label [_ forums.Body] \ + -datatype text \ + -widget textarea \ + -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]]]])}} \ + {}] + + 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 + } else { + lappend subject_val \ + {expr ![empty_string_p [string trim $value]]} \ + "[_ forums.lt_Please_enter_a_subjec]" + + lappend content_val empty \ + {expr ![empty_string_p [string trim $value]]} \ + "[_ forums.lt_Please_enter_a_messag]" + } + + template::element set_properties $form_name ${prefix}subject \ + -validate $subject_val + + template::element set_properties $form_name ${prefix}content \ + -validate $content_val +} + +ad_proc -public post_message { + {-optional:boolean} + {-show_anonymous_p 1} + {-show_attachments_p 1} + {-prefix {}} + form_name +} { + adds form elements to a form for the default post message form +} { + template::element create $form_name ${prefix}forum_id \ + -label [_ forums.forum_ID] \ + -datatype integer \ + -widget hidden + + template::element create $form_name ${prefix}parent_id \ + -label [_ forums.parent_ID] \ + -datatype integer \ + -widget hidden \ + -optional + + template::element create $form_name ${prefix}subscribe_p \ + -label [_ forums.Subscribe] \ + -datatype text \ + -widget hidden \ + -optional + + set options [list [list [_ forums.post_anonymously] 1 ] ] + + template::element create $form_name ${prefix}anonymous_p \ + -label [_ forums.Anonymous] \ + -datatype integer \ + -widget [ad_decode $show_anonymous_p 0 "hidden" "checkbox"] \ + -options $options \ + -optional + + set options [list [list [_ forums.No] 0] [list [_ forums.Yes] 1]] + + template::element create $form_name ${prefix}attach_p \ + -label [_ forums.Attach] \ + -datatype text \ + -widget [ad_decode $show_attachments_p 0 "hidden" "radio"] \ + -options $options + + if {$optional_p} { + template::element set_properties $form_name ${prefix}forum_id -optional + template::element set_properties $form_name ${prefix}attach_p -optional + } +} + +ad_proc -public forward_message { + {-prefix {}} + form_name +} { + adds form elements to form_name to allow the user to enter the details + of a message they want to forward by email +} { + template::element create $form_name ${prefix}to_email \ + -label [_ forums.Email] \ + -datatype text \ + -widget text \ + -html {size 60} + + template::element create $form_name ${prefix}subject \ + -label [_ forums.Subject] \ + -datatype text \ + -widget text \ + -html {size 80} + + template::element create $form_name ${prefix}pre_body \ + -label [_ forums.Your_Note] \ + -datatype text \ + -widget textarea \ + -html {cols 80 rows 10 wrap hard} +} + +ad_proc -public search { + {-prefix {}} + form_name +} { + Constructs the elements of a form for searching for a term + optionally in a particular forum +} { + template::element create $form_name ${prefix}search_text \ + -label [_ forums.Search_1] \ + -datatype text \ + -widget text + + template::element create $form_name ${prefix}forum_id \ + -label [_ forums.ForumID] \ + -datatype text \ + -widget hidden \ + -optional +} + +ad_proc -public forum { + {-prefix {}} + form_name +} { + Constructs the elements of a form for creating/editing a forum +} { + template::element create $form_name ${prefix}name \ + -label [_ forums.Name] \ + -datatype text \ + -widget text \ + -html {size 60} \ + -validate { {expr ![empty_string_p [string trim $value]]} {Forum Name can not be blank} } + + template::element create $form_name ${prefix}charter \ + -label [_ forums.Charter] \ + -datatype text \ + -widget textarea \ + -html {cols 60 rows 10 wrap soft} \ + -optional + + template::element create $form_name ${prefix}presentation_type \ + -label [_ forums.Presentation] \ + -datatype text \ + -widget select \ + -options [list [list [_ forums.Flat] flat] [list [_ forums.Threaded] threaded]] + + template::element create $form_name ${prefix}posting_policy \ + -label [_ forums.Posting_Policy] \ + -datatype text \ + -widget select \ + -options [list [list [_ forums.open] open] [list [_ forums.moderated] moderated] [list [_ forums.closed] closed] ] + + template::element create $form_name ${prefix}new_threads_p \ + -label [_ forums.lt_Users_Can_Create_New_] \ + -datatype integer \ + -widget radio \ + -options [list [list [_ forums.Yes] 1] [list [_ forums.No] 0] ] +} + +} +} Index: openacs-4/packages/forums/tcl/forums-email-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-email-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/tcl/forums-email-procs.tcl 17 Dec 2003 15:45:30 -0000 1.1 @@ -0,0 +1,33 @@ +ad_library { + + Forums Library + + @creation-date 2002-05-17 + @author Ben Adida + @cvs-id $Id: forums-email-procs.tcl,v 1.1 2003/12/17 15:45:30 leed Exp $ + +} + +namespace eval forum { namespace eval email {} } + +ad_proc -public forum::email::create_forward_email { + {-pre_body:required} + message_passed +} { + create email content to forward a message +} { + # Get the message data array + upvar $message_passed message + + # Variables for I18N message lookup: + set posting_date $message(posting_date) + set user_name $message(user_name) + + # Set up the message body + set new_body "[ad_html_to_text -- $pre_body]" + append new_body "\n\n===================================\n\n" + append new_body "[_ forums.email_alert_body_header]\n\n" + append new_body "[ad_html_to_text -- $message(content)]\n" + + return $new_body +} Index: openacs-4/packages/forums/tcl/forums-security-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-security-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/forums/tcl/forums-security-procs.tcl 11 Dec 2003 21:40:04 -0000 1.8 +++ openacs-4/packages/forums/tcl/forums-security-procs.tcl 17 Dec 2003 15:45:30 -0000 1.9 @@ -138,7 +138,24 @@ } } -} + ad_proc -public permissions { + {-forum_id:required} + array_name + } { + upvar $array_name array + array set array [list admin_p [forum::security::can_admin_forum_p -forum_id $forum_id]] - + if { !$array(admin_p) } { + array set array [list moderate_p [forum::security::can_moderate_forum_p -forum_id $forum_id]] + if { !$array(moderate_p) } { + array set array [list post_p [expr { [ad_conn user_id] == 0 || [forum::security::can_post_forum_p -forum_id $forum_id] }]] + } else { + array set array [list post_p 1] + } + } else { + array set array [list moderate_p 1] + array set array [list post_p 1] + } + } +} Index: openacs-4/packages/forums/tcl/messages-format-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/messages-format-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/forums/tcl/messages-format-procs.tcl 22 Sep 2003 20:46:04 -0000 1.3 +++ openacs-4/packages/forums/tcl/messages-format-procs.tcl 17 Dec 2003 15:45:30 -0000 1.4 @@ -4,6 +4,19 @@ namespace eval forum::format { + ad_proc -public reply_subject { parent_subject } { + + Generates a subject string for a reply to an existing message. + + } { + set subject "[_ forums.Re] $parent_subject" + + # trim multiple leading Re: + regsub "^(\s*Re:\s*)*" $subject {Re: } subject + + return $subject + } + ad_proc emoticons { {-content:required} } { @@ -35,4 +48,5 @@ } return [string map $emoticons_map $content] } + } 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.23 -r1.24 --- openacs-4/packages/forums/tcl/messages-procs.tcl 7 Nov 2003 17:43:33 -0000 1.23 +++ openacs-4/packages/forums/tcl/messages-procs.tcl 17 Dec 2003 15:45:30 -0000 1.24 @@ -39,7 +39,8 @@ if {[info exists message(state)] && [string equal $message(state) approved]} { do_notifications -message_id $message_id } - } on_error { + } on_error { + db_abort_transaction # Check to see if the message with a message_id matching the @@ -273,3 +274,29 @@ return $sort_filter } + +ad_proc -public forum::message::initial_message { + {-forum_id {}} + {-parent {}} + {-message:required} +} { + Create an array with values initialised for a new message. +} { + upvar $message init_msg + + if { [empty_string_p $forum_id] && [empty_string_p $parent] } { + return -code error [_ forums.lt_You_either_have_to] + } + + if { ![empty_string_p $parent] } { + upvar $parent parent_msg + + set init_msg(parent_id) $parent_msg(message_id) + set init_msg(forum_id) $parent_msg(forum_id) + set init_msg(subject) \ + [forum::format::reply_subject $parent_msg(subject)] + } else { + set init_msg(forum_id) $forum_id + set init_msg(parent_id) "" + } +} Fisheye: Tag 1.11 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/forum-view-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.13 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/forum-view-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? 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.23 -r1.24 --- openacs-4/packages/forums/www/forum-view.adp 3 Oct 2003 18:26:31 -0000 1.23 +++ openacs-4/packages/forums/www/forum-view.adp 17 Dec 2003 15:45:30 -0000 1.24 @@ -7,7 +7,7 @@ @notification_chunk;noquote@ - +

» #forums.Post_a_New_Message#

@@ -19,14 +19,14 @@ #forums.Search#  - +
[ - + #forums.Administer# - | + | - + #forums.ManageModerate# ]
@@ -36,5 +36,4 @@ -

- +

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.21 -r1.22 --- openacs-4/packages/forums/www/forum-view.tcl 11 Dec 2003 21:40:05 -0000 1.21 +++ openacs-4/packages/forums/www/forum-view.tcl 17 Dec 2003 15:45:30 -0000 1.22 @@ -11,157 +11,38 @@ {orderby "posting_date,desc"} } - -forum::security::require_read_forum -forum_id $forum_id - -# get the colors from the params -set table_border_color [parameter::get -parameter table_border_color] -set table_bgcolor [parameter::get -parameter table_bgcolor] -set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] - -set package_id [ad_conn package_id] -set admin_p [forum::security::can_admin_forum_p -forum_id $forum_id] - -if { !$admin_p } { - set moderate_p [forum::security::can_moderate_forum_p -forum_id $forum_id] - if { !$moderate_p } { - set post_p [expr { [ad_conn user_id] == 0 || [forum::security::can_post_forum_p -forum_id $forum_id] }] - } else { - set post_p 1 - } -} else { - set moderate_p 1 - set post_p 1 -} - -form create search -action search - -element create search search_text \ - -label [_ forums.Search_1] \ - -datatype text \ - -widget text - -element create search forum_id \ - -label [_ forums.ForumID] \ - -datatype text \ - -widget hidden \ - -value $forum_id - # Get forum data forum::get -forum_id $forum_id -array forum -#it is confusing to provide a moderate link for non-moderated forums. -if { $forum(posting_policy) != "moderated" } { - set moderate_p 0 -} - # If disabled! if {$forum(enabled_p) != "t"} { ad_returnredirect "./" ad_script_abort } -set query messages_select -if {$moderate_p} { - set query messages_select_moderator +forum::security::require_read_forum -forum_id $forum_id +forum::security::permissions -forum_id $forum_id permissions + +#it is confusing to provide a moderate link for non-moderated forums. +if { $forum(posting_policy) != "moderated" } { + array set permissions [list moderate_p 0] } +# get the colors from the params +set table_border_color [parameter::get -parameter table_border_color] +set table_bgcolor [parameter::get -parameter table_bgcolor] +set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] + set admin_url [export_vars -base "admin/forum-edit" { forum_id {return_url [ad_return_url]}}] set moderate_url [export_vars -base "moderate/forum" { forum_id }] set post_url [export_vars -base "message-post" { forum_id }] -template::list::create \ - -name messages \ - -multirow messages \ - -pass_properties { moderate_p } \ - -elements { - subject { - label "#forums.Subject#" - link_url_col message_url - display_template { - @messages.subject@ - @messages.subject@ - } - } - state_pretty { - label "\#forums.Moderate\#" - hide_p {[ad_decode $moderate_p 1 0 1]} - } - user_name { - label "#forums.Author#" - link_url_col user_url - } - n_messages { - label "#forums.Replies#" - display_col n_messages_pretty - html { align right } - } - posting_date { - label "#forums.First_Post#" - display_col posting_date_pretty - } - last_child_post { - label "#forums.Last_Post#" - display_col last_child_post_pretty - } - } -orderby { - posting_date { - label "#forums.First_Post#" - orderby posting_date - default_direction desc - } - last_child_post { - label "#forums.Last_Post#" - orderby last_child_post - default_direction desc - } - subject { - label "#forums.Subject#" - orderby upper(subject) - } - user_name { - label "#forums.Author#" - orderby_asc_name "orderby_user_name_asc" - orderby_desc_name "orderby_user_name_desc" - } - n_messages { - label "#forums.Replies#" - orderby_asc {n_messages asc, posting_date desc} - orderby_desc {n_messages desc, posting_date desc} - } - } -filters { - forum_id {} - } +# Create a search form and action when used +form create search -action search +forums::form::search search -db_multirow -extend { - last_child_post_pretty - posting_date_pretty - message_url - user_url - n_messages_pretty - state_pretty -} messages $query {} { - set last_child_post_ansi [lc_time_system_to_conn $last_child_post_ansi] - set last_child_post_pretty [lc_time_fmt $last_child_post_ansi "%x %X"] - - set posting_date_ansi [lc_time_system_to_conn $posting_date_ansi] - set posting_date_pretty [lc_time_fmt $posting_date_ansi "%x %X"] - - set message_url [export_vars -base "message-view" { message_id }] - set user_url [export_vars -base "user-history" { user_id }] - set n_messages_pretty [lc_numeric $n_messages] - - switch $state { - pending { - set state_pretty [_ forums.Pending] - } - rejected { - set state_pretty [_ forums.Rejected] - } - default { - set state_pretty {} - } - } +if {[form is_request search]} { + element set_properties search forum_id -value $forum_id } # Need to quote forum(name) since it is noquoted on display as part of an @@ -175,6 +56,3 @@ set page_title "[_ forums.Forum_1] $forum(name)" set context [list [ad_quotehtml $forum(name)]] - - - Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/index-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.9 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/index-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/forums/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/index.adp,v diff -u -r1.20 -r1.21 --- openacs-4/packages/forums/www/index.adp 28 Aug 2003 09:41:54 -0000 1.20 +++ openacs-4/packages/forums/www/index.adp 17 Dec 2003 15:45:30 -0000 1.21 @@ -26,57 +26,6 @@
- + - - - - - - - - - - - - - - - - - - - - - - - - - - -
#forums.Forum_Name##forums.Threads##forums.Last_Post#
- - - - @forums.name@ - - - - -
@forums.charter;noquote@ -
-
- @forums.n_threads@ - - - @forums.last_post_ansi@ -   -
- #forums.No_Forums# -
- - - - - Index: openacs-4/packages/forums/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/index.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/forums/www/index.tcl 12 Dec 2002 13:13:11 -0000 1.9 +++ openacs-4/packages/forums/www/index.tcl 17 Dec 2003 15:45:30 -0000 1.10 @@ -12,28 +12,10 @@ set user_id [ad_verify_and_get_user_id] set admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege admin] -# get the colors from the params -set table_border_color [parameter::get -parameter table_border_color] -set table_bgcolor [parameter::get -parameter table_bgcolor] -set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] - +# Create a search form and action when used form create search -action search +forums::form::search search -element create search search_text \ - -label Search \ - -datatype text \ - -widget text - -element create search forum_id \ - -label ForumID \ - -datatype text \ - -widget hidden \ - -value "" - -db_multirow -extend { last_modified_pretty } forums select_forums {} { - set last_modified_pretty [lc_time_fmt $last_post_ansi "%x %X"] -} - set context {} ad_return_template Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/message-attachment-chunk.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/message-attachment-chunk.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.22 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/message-chunk.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.9 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/message-chunk.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/forums/www/message-email.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-email.adp,v diff -u -r1.7 -r1.8 --- openacs-4/packages/forums/www/message-email.adp 22 May 2003 14:56:35 -0000 1.7 +++ openacs-4/packages/forums/www/message-email.adp 17 Dec 2003 15:45:30 -0000 1.8 @@ -5,10 +5,7 @@

#forums.lt_Email_a_copy_of_the_f#

- +
- - - Index: openacs-4/packages/forums/www/message-email.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-email.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/forums/www/message-email.tcl 7 Nov 2003 17:43:33 -0000 1.10 +++ openacs-4/packages/forums/www/message-email.tcl 17 Dec 2003 15:45:30 -0000 1.11 @@ -12,64 +12,39 @@ forum::security::require_read_message -message_id $message_id +# Get the message information +forum::message::get -message_id $message_id -array message + form create message element create message message_id \ -label [_ forums.Message_ID] \ -datatype integer \ -widget hidden -element create message to_email \ - -label [_ forums.Email] \ - -datatype text \ - -widget text \ - -html {size 60} +forums::form::forward_message message -element create message subject \ - -label [_ forums.Subject] \ - -datatype text \ - -widget text \ - -html {size 80} - -element create message pre_body \ - -label [_ forums.Your_Note] \ - -datatype text \ - -widget textarea \ - -html {cols 80 rows 10 wrap hard} - - if {[form is_valid message]} { template::form get_values message message_id to_email subject pre_body - # Get the data - forum::message::get -message_id $message_id -array message + # Create the email body + set email_body [forum::email::create_forward_email -pre_body $pre_body message] - set new_body "[ad_html_to_text -- $pre_body]" - append new_body "\n\n===================================\n\n" - # Variables for I18N message lookup: - set posting_date $message(posting_date) - set user_name $message(user_name) - append new_body "[_ forums.email_alert_body_header]\n\n" - append new_body "[ad_html_to_text -- $message(content)]\n" - # Send the email acs_mail_lite::send -to_addr $to_email \ -from_addr [cc_email_from_party [ad_conn user_id]] \ -subject $subject \ - -body $new_body + -body $email_body ad_returnredirect "message-view?message_id=$message_id" ad_script_abort } -# Get the message information -forum::message::get -message_id $message_id -array message +if {[template::form is_request message]} { + element set_properties message message_id -value $message_id + element set_properties message subject -value $subject +} -element set_properties message subject -value "\[[_ forums.Fwd] $message(subject)\]" -element set_properties message message_id -value $message_id - -set message(subject) - 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)" "[_ forums.Entire_Thread]"] @@ -78,4 +53,3 @@ lappend context [_ forums.Email_to_a_friend] ad_return_template - Index: openacs-4/packages/forums/www/message-post-confirm.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-post-confirm.adp,v diff -u -r1.12 -r1.13 --- openacs-4/packages/forums/www/message-post-confirm.adp 11 Dec 2003 21:40:05 -0000 1.12 +++ openacs-4/packages/forums/www/message-post-confirm.adp 17 Dec 2003 15:45:30 -0000 1.13 @@ -2,37 +2,7 @@ #forums.Confirm_Post_to_Forum# @forum.name;noquote@ @context;noquote@ -

#forums.lt_Please_confirm_the_fo#

- -<% set table_border_color [parameter::get -parameter table_border_color] %> - -
- - -
-
- -
- - @exported_vars;noquote@ - -
- - - #forums.lt_Would_you_like_to_sub# - #forums.No# - #forums.Yes# - - -
#forums.lt_Note_that_you_are_alr# -
- -
-
- - - -
- - - + Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/message-post-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/message-post-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/forums/www/message-post.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-post.adp,v diff -u -r1.8 -r1.9 --- openacs-4/packages/forums/www/message-post.adp 22 May 2003 14:56:35 -0000 1.8 +++ openacs-4/packages/forums/www/message-post.adp 17 Dec 2003 15:45:30 -0000 1.9 @@ -3,14 +3,7 @@ @context;noquote@ message.subject - - - -
-
-
- - - - - + 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.29 -r1.30 --- openacs-4/packages/forums/www/message-post.tcl 11 Dec 2003 21:40:05 -0000 1.29 +++ openacs-4/packages/forums/www/message-post.tcl 17 Dec 2003 15:45:30 -0000 1.30 @@ -18,250 +18,56 @@ } } -if { ![empty_string_p [ns_queryget formbutton:post]] } { - set action post -} elseif { ![empty_string_p [ns_queryget formbutton:preview]] } { - set action preview -} elseif { ![empty_string_p [ns_queryget formbutton:edit]] } { - set action edit -} else { - set action "" -} - set user_id [ad_conn user_id] -# get the colors from the params -set table_border_color [parameter::get -parameter table_border_color] -set table_bgcolor [parameter::get -parameter table_bgcolor] +############################## +# Pull out required forum and parent data and +# perform security checks +# +if {[empty_string_p $parent_id]} { + # no parent_id, therefore new thread + # require thread creation privs + forum::security::require_post_forum -forum_id $forum_id -form create message -edit_buttons [list [list [_ forums.Post] post] [list [_ forums.Preview] preview]] + forum::get -forum_id $forum_id -array forum +} else { + # get the parent message information + forum::message::get -message_id $parent_id -array parent_message -element create message message_id \ - -label [_ forums.Message_ID] \ - -datatype integer \ - -widget hidden + # see if they're allowed to add to this thread + forum::security::require_post_message -message_id $parent_id -element create message subject \ - -label [_ forums.Subject] \ - -datatype text \ - -widget text \ - -html {size 60} \ - -validate { {expr ![empty_string_p [string trim $value]]} "[_ forums.lt_Please_enter_a_subjec]" } + forum::get -forum_id $parent_message(forum_id) -array forum +} -# we use ns_queryget to get the value of html_p because it won't be defined -# until the next element -DaveB +############################## +# Calculate users rights and forums policy +# +set anonymous_allowed_p [expr ([empty_string_p $forum_id] || \ + [forum::security::can_post_forum_p \ + -forum_id $forum_id -user_id 0]) && \ + ([empty_string_p $parent_id] || \ + [forum::security::can_post_message_p \ + -message_id $parent_id -user_id 0])] -element create message content \ - -label [_ forums.Body] \ - -datatype text \ - -widget textarea \ - -html {rows 20 cols 60 wrap soft} \ - -validate { - empty {expr ![empty_string_p [string trim $value]]} { [_ forums.lt_Please_enter_a_messag] } - html { expr {( [string match [set l_html_p [ns_queryget html_p f]] "t"] && [empty_string_p [set v_message [ad_quotehtml [ad_html_security_check $value]]]] ) || [string match $l_html_p "f"] } } - {} - } - - -element create message html_p \ - -label [_ forums.Format] \ - -datatype text \ - -widget radio \ - -options [list [list [_ forums.text] f] [list [_ forums.html] t]] \ - -value f - -element create message parent_id \ - -label [_ forums.parent_ID] \ - -datatype integer \ - -widget hidden \ - -optional - -element create message forum_id \ - -label [_ forums.forum_ID] \ - -datatype integer \ - -widget hidden - -element create message confirm_p \ - -label [_ forums.Confirm] \ - -datatype text \ - -widget hidden - -element create message subscribe_p \ - -label [_ forums.Subscribe] \ - -datatype text \ - -widget hidden \ - -optional - -# We show the anonymous checkbox if you're logged in, and user_id 0 is allowed to post -set anonymous_allowed_p [expr [ad_conn user_id] != 0 && \ - ([empty_string_p $forum_id] || \ - [forum::security::can_post_forum_p -forum_id $forum_id -user_id 0]) && \ - ([empty_string_p $parent_id] || \ - [forum::security::can_post_message_p -message_id $parent_id -user_id 0])] - -element create message anonymous_p \ - -label "Anonymous" \ - -datatype integer \ - -widget [ad_decode $anonymous_allowed_p 0 "hidden" "checkbox"] \ - -options { { "Post anonymously" "1" } } \ - -optional - set attachments_enabled_p [forum::attachments_enabled_p] -if {$attachments_enabled_p} { - element create message attach_p \ - -label [_ forums.Attach] \ - -datatype text \ - -widget radio \ - -value 0 \ - -options [list [list [_ forums.No] 0] [list [_ forums.Yes] 1]] -} +############################## +# Template variables +# -if {[form is_valid message]} { - form get_values message \ - message_id forum_id parent_id subject content html_p confirm_p subscribe_p anonymous_p - if {$attachments_enabled_p} { - form get_values message attach_p - } - if { !$anonymous_allowed_p } { - set anonymous_p 0 - } - - if { [string equal $action "preview"] } { - forum::get -forum_id $forum_id -array forum +if {![string equal [template::form::get_button message] "preview"]} { + set context [list [list "./forum-view?forum_id=$forum_id" [ad_quotehtml $forum(name)]]] - 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 message(html_p) $html_p - set message(subject) $subject - set message(content) $content - if { [template::util::is_true $anonymous_p] } { - set user_id 0 - } - set message(user_id) $user_id - set message(user_name) [db_string select_name {}] - set message(posting_date_ansi) [db_string select_date {}] - set message(posting_date_pretty) [lc_time_fmt $message(posting_date_ansi) "%x %X"] - - # Let's check if this person is subscribed to the forum - # in case we might want to subscribe them to the thread - if {[empty_string_p $parent_id]} { - if {![empty_string_p [notification::request::get_request_id \ - -type_id [notification::type::get_type_id -short_name forums_forum_notif] \ - -object_id $forum_id \ - -user_id [ad_conn user_id]]]} { - set forum_notification_p 1 - } else { - set forum_notification_p 0 - } - } - - - set context [list [list "./forum-view?forum_id=$forum_id" [ad_quotehtml $forum(name)]]] - lappend context "[_ forums.Post_a_Message]" - - ad_return_template message-post-confirm - return + if {[empty_string_p $parent_id]} { + lappend context [_ forums.Post_a_Message] + } else { + lappend context [list "./message-view?message_id=$parent_message(message_id)" "$parent_message(subject)"] + lappend context [_ forums.Post_a_Reply] } - - if { [string equal $action "post"] } { - if { [empty_string_p $anonymous_p] } { - set anonymous_p 0 - } - if { $anonymous_p } { - set post_as_user_id 0 - } else { - set post_as_user_id $user_id - } - - forum::message::new \ - -forum_id $forum_id \ - -message_id $message_id \ - -parent_id $parent_id \ - -subject $subject \ - -content $content \ - -html_p $html_p \ - -user_id $post_as_user_id - - if {[empty_string_p $parent_id]} { - set redirect_url "[ad_conn package_url]message-view?message_id=$message_id" - } else { - set redirect_url "[ad_conn package_url]message-view?message_id=$parent_id" - } - - # Wrap the notifications URL - if {![empty_string_p $subscribe_p] && $subscribe_p && [empty_string_p $parent_id]} { - set notification_url [notification::display::subscribe_url \ - -type forums_message_notif \ - -object_id $message_id \ - -url $redirect_url \ - -user_id [ad_conn user_id] \ - ] - - # redirect to notification stuff - set redirect_url $notification_url - } - - # Wrap the attachments URL - if {$attachments_enabled_p} { - form get_values message attach_p - - if { ![empty_string_p $attach_p] && $attach_p} { - set redirect_url [attachments::add_attachment_url -object_id $message_id -return_url $redirect_url -pretty_name "[_ forums.Forum_Posting] \"$subject\""] - } - } - - # Do the redirection - ad_returnredirect $redirect_url - - ad_script_abort - } -} - -set message_id [db_nextval acs_object_id_seq] -#set subject "" - -if { ![empty_string_p $parent_id] } { - # get the parent message information - forum::message::get -message_id $parent_id -array parent_message - set forum_id $parent_message(forum_id) - if { [form is_request message] } { - set subject "[_ forums.Re] $parent_message(subject)" - - # trim multiple leading Re: - regsub {^(\s*Re:\s*)*} $subject {Re: } subject - } - - # see if they're allowed to add to this thread - forum::security::require_post_message -message_id $parent_id } else { - # no parent_id, therefore new thread - # require thread creation privs - forum::security::require_post_forum -forum_id $forum_id -} + set context [list [list "./forum-view?forum_id=$forum_id" [ad_quotehtml $forum(name)]]] + lappend context "[_ forums.Post_a_Message]" -forum::get -forum_id $forum_id -array forum - -# Prepare the other data -element set_properties message forum_id -value $forum_id -element set_properties message parent_id -value $parent_id -element set_properties message message_id -value $message_id -# only set subject is this is a reply to a previous message -if {[info exists subject]} { - element set_properties message subject -value $subject + ad_return_template "message-post-confirm" } -element set_properties message confirm_p -value 0 -element set_properties message subscribe_p -value 0 - -set context [list [list "./forum-view?forum_id=$forum_id" [ad_quotehtml $forum(name)]]] -if {![empty_string_p $parent_id]} { - lappend context [list "./message-view?message_id=$parent_message(message_id)" "$parent_message(subject)"] - lappend context [_ forums.Post_a_Reply] -} else { - lappend context [_ forums.Post_a_Message] -} Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/message-post.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.12 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/message-view-flat.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/message-view-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.9 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/message-view-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/forums/www/message-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-view.adp,v diff -u -r1.20 -r1.21 --- openacs-4/packages/forums/www/message-view.adp 28 Oct 2003 17:04:04 -0000 1.20 +++ openacs-4/packages/forums/www/message-view.adp 17 Dec 2003 15:45:30 -0000 1.21 @@ -30,53 +30,21 @@
- - -
+ - - - - - - - <% set width [expr 100 - [expr $responses(tree_level) - 1] * 1] %> - - - - - - - -
- - - - - - - -
-
-
-
- #forums.Reply_to_first_post_on_page_label# + + #forums.Post_a_Reply# + + + #forums.Reply_to_first_post_on_page_label# +
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.25 -r1.26 --- openacs-4/packages/forums/www/message-view.tcl 29 Oct 2003 10:20:40 -0000 1.25 +++ openacs-4/packages/forums/www/message-view.tcl 17 Dec 2003 15:45:30 -0000 1.26 @@ -10,48 +10,15 @@ message_id:integer,notnull } -set top_message_id $message_id +####################### +# +# First check all reasons why we might abort +# +####################### -forum::security::require_read_message -message_id $message_id - -# get the colors from the params -set table_border_color [parameter::get -parameter table_border_color] -set table_bgcolor [parameter::get -parameter table_bgcolor] -set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] - # Load up the message information forum::message::get -message_id $message_id -array message -set direct_url_base [export_vars -base [ad_conn url] { { message_id $message(root_message_id) } }] -set message(direct_url) "$direct_url_base\#$message_id" - -# Check if the user has admin on the message -set moderate_p [forum::security::can_moderate_message_p -message_id $message_id] -if {!${moderate_p}} { - set post_p [forum::security::can_post_forum_p -forum_id $message(forum_id)] -} else { - set post_p 1 -} - -form create search -action search - -element create search search_text \ - -label [_ forums.Search] \ - -datatype text \ - -widget text - -element create search forum_id \ - -label [_ forums.ForumID] \ - -datatype text \ - -widget hidden \ - -value $message(forum_id) - -# Check if the message is approved -if {!${moderate_p} && ![string equal $message(state) approved]} { - ad_returnredirect "forum-view?forum_id=$message(forum_id)" - ad_script_abort -} - # Load up the forum information forum::get -forum_id $message(forum_id) -array forum @@ -61,83 +28,37 @@ ad_script_abort } -if {$forum(posting_policy) == "moderated"} { - set forum_moderated_p 1 -} else { - set forum_moderated_p 0 -} +forum::security::require_read_message -message_id $message_id +forum::security::permissions -forum_id $message(forum_id) permissions -# Check preferences for user - -# Set some variables for easy SQL access -set forum_id $message(forum_id) -set tree_sortkey $message(tree_sortkey) - -if {[forum::attachments_enabled_p]} { - set query select_message_responses_attachments +# Check if the user has admin on the message +set permissions(moderate_p) [forum::security::can_moderate_message_p -message_id $message_id] +if {!${permissions(moderate_p)}} { + set permissions(post_p) [forum::security::can_post_forum_p -forum_id $message(forum_id)] } else { - set query select_message_responses + set permissions(post_p) 1 } -# We set a Tcl variable for moderation now (Ben) -if { $moderate_p } { - set table_name "forums_messages" -} else { - set table_name "forums_messages_approved" +# Check if the message is approved +if {!${permissions(moderate_p)} && ![string equal $message(state) approved]} { + ad_returnredirect "forum-view?forum_id=$message(forum_id)" + ad_script_abort } -##### +############################################ # -# Find ordering of messages +# Ok we're not aborting so lets do some work # -##### +############################################ -if { [string equal $forum(presentation_type) flat] } { - set order_by "fma.posting_date, fma.tree_sortkey" -} else { - set order_by "fma.tree_sortkey" -} +# Create a search form and action when used +form create search -action search +forums::form::search search -set forum_id $message(forum_id) -set root_message_id $message(root_message_id) -set message_id_list [db_list select_message_ordering {}] - -set message(number) [expr [lsearch $message_id_list $message(message_id)] + 1] -set message(parent_number) {} -if { [exists_and_not_null message(parent_id)] } { - set message(parent_number) [expr [lsearch $message_id_list $message(parent_id)] + 1] - set message(parent_direct_url) "$direct_url_base\#$message(parent_id)" +if {[form is_request search]} { + element set_properties search forum_id -value $message(forum_id) } - - - - -##### -# -# Find responses -# -##### - -# More Tcl vars (we might as well use them - Ben) -if { [string equal $forum(presentation_type) flat] } { - set order_by "$table_name.posting_date, tree_sortkey" -} else { - set order_by "tree_sortkey" -} - -set last_message_id $message(message_id) -db_multirow -extend { posting_date_pretty direct_url number parent_number parent_direct_url } responses $query {} { - set posting_date_pretty [lc_time_fmt $posting_date_ansi "%x %X"] - set direct_url "$direct_url_base\#$message_id" - set number [expr [lsearch $message_id_list $message_id] + 1] - set parent_number [expr [lsearch $message_id_list $parent_id] + 1] - set parent_direct_url "$direct_url_base\#$parent_id" - - # Note that this variable is purposefully not part of the multirow - set last_message_id $message_id -} - - + # If this is a top-level thread, we allow subscriptions here if { [empty_string_p $message(parent_id)] } { set notification_chunk [notification::display::request_widget \ @@ -158,15 +79,8 @@ lappend context [_ forums.One_Thread] } -if { $post_p || [ad_conn user_id] == 0 } { +if { $permissions(post_p) || [ad_conn user_id] == 0 } { set reply_url [export_vars -base message-post { { parent_id $message(message_id) } }] } set thread_url [export_vars -base forum-view { { forum_id $message(forum_id) } }] - -if {[string equal $forum(presentation_type) flat]} { - ad_return_template "message-view-flat" -} else { - ad_return_template -} - Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/search-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.7 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/search-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/forums/www/search.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/search.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/forums/www/search.adp 3 Oct 2003 11:37:07 -0000 1.6 +++ openacs-4/packages/forums/www/search.adp 17 Dec 2003 15:45:30 -0000 1.7 @@ -4,58 +4,6 @@
- + - - - - -
- - #forums.Search#  - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#forums.Subject##forums.Author##forums.Posting_Date#
- @messages.subject@ - @messages.user_name@@messages.posting_date@
- #forums.No_Messages# -
-
- - - Index: openacs-4/packages/forums/www/search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/search.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/forums/www/search.tcl 3 Oct 2003 11:53:25 -0000 1.13 +++ openacs-4/packages/forums/www/search.tcl 17 Dec 2003 15:45:30 -0000 1.14 @@ -1,57 +1,13 @@ ad_page_contract { @author yon@openforce.net + @author rob@thaum.net @creation-date 2002-07-01 @cvs-id $Id$ } -query { {forum_id ""} } -set package_id [ad_conn package_id] - -form create search - -element create search search_text \ - -label [_ forums.Search] \ - -datatype text \ - -widget text \ - -html {size 60} - -element create search forum_id \ - -label [_ forums.ForumID] \ - -datatype text \ - -widget hidden \ - -value $forum_id \ - -optional - -if {[form is_valid search]} { - form get_values search search_text forum_id - - # remove any special characters from the search text so we - # don't crash interMedia - regsub -all {[^[:alnum:]_[:blank:]]} $search_text {} search_text - - set query search_all_forums - if {![empty_string_p $forum_id]} { - set query search_one_forum - } - - if { [parameter::get -parameter UseIntermediaForSearchP -default 0] } { - append query "_intermedia" - } - - db_multirow messages $query {} { - set posting_date_pretty [lc_time_fmt $posting_date_ansi "%x %X"] - } - -} else { - set messages:rowcount 0 -} - set page_title [_ forums.Search_Forums] set context [list $page_title] - - - - Index: openacs-4/packages/forums/www/user-history.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/user-history.adp,v diff -u -r1.10 -r1.11 --- openacs-4/packages/forums/www/user-history.adp 22 Sep 2003 18:29:04 -0000 1.10 +++ openacs-4/packages/forums/www/user-history.adp 17 Dec 2003 15:45:30 -0000 1.11 @@ -2,106 +2,8 @@ #forums.Forums_Posting_hist_lt# @user.full_name;noquote@ @context;noquote@ -

- #forums.Posting_history_for# - - <% - if {![permission::permission_p -object_id [acs_magic_object security_context_root] -privilege admin]} { - adp_puts [acs_community_member_link -user_id $user(user_id)] - } else { - adp_puts [acs_community_member_admin_link -user_id $user(user_id)] - } - %> - -

- -

-@dimensional_chunk;noquote@ -
-

-
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#forums.Forum##forums.Subject##forums.Posted#
@messages.forum_name@@messages.subject@@messages.posting_date_pretty@
- #forums.No_Postings# -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@messages.forum_name@

#forums.Subject##forums.Posted#
@messages.subject@@messages.posting_date_pretty@
-
- -
- -
-
- - - Index: openacs-4/packages/forums/www/user-history.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/user-history.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/forums/www/user-history.tcl 22 Sep 2003 18:29:04 -0000 1.11 +++ openacs-4/packages/forums/www/user-history.tcl 17 Dec 2003 15:45:30 -0000 1.12 @@ -11,41 +11,9 @@ {view "date"} } -set package_id [ad_conn package_id] - -# get the colors from the params -set table_border_color [parameter::get -parameter table_border_color] -set table_bgcolor [parameter::get -parameter table_bgcolor] -set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] - -# choosing the view -set dimensional_list " - { - view \"[_ forums.View]:\" date { - {date \"[_ forums.by_Date]\" {}} - {forum \"[_ forums.by_Forum]\" {}} - } - } -" - -set query select_messages -if {[string equal $view forum]} { - set query select_messages_by_forum -} - -# Select the postings -db_multirow -extend { posting_date_pretty } messages $query {} { - set posting_date_pretty [lc_time_fmt $posting_date_ansi "%x %X"] -} - # Get user information oacs::user::get -user_id $user_id -array user -set dimensional_chunk [ad_dimensional $dimensional_list] - set context [list [_ forums.Posting_History]] ad_return_template - - - Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/user-history.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/forums/www/admin/forum-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/forum-edit.adp,v diff -u -r1.8 -r1.9 --- openacs-4/packages/forums/www/admin/forum-edit.adp 22 May 2003 14:57:41 -0000 1.8 +++ openacs-4/packages/forums/www/admin/forum-edit.adp 17 Dec 2003 15:45:31 -0000 1.9 @@ -11,6 +11,4 @@

- - - + Index: openacs-4/packages/forums/www/admin/forum-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/forum-edit.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/forums/www/admin/forum-edit.tcl 3 Oct 2003 18:26:31 -0000 1.13 +++ openacs-4/packages/forums/www/admin/forum-edit.tcl 17 Dec 2003 15:45:31 -0000 1.14 @@ -11,52 +11,6 @@ {return_url "."} } -form create forum - -element create forum return_url \ - -datatype text -widget hidden -optional - -element create forum forum_id \ - -label [_ forums.Forum_ID] -datatype integer -widget hidden - -element create forum name \ - -label [_ forums.Name] -datatype text -widget text -html {size 60} -validate { {expr ![empty_string_p [string trim $value]]} {Forum Name can not be blank} } - -element create forum charter \ - -label [_ forums.Charter] -datatype text -widget textarea -html {cols 60 rows 10 wrap soft} -optional - -element create forum presentation_type \ - -label [_ forums.Presentation] -datatype text -widget select -options {{Flat flat} {Threaded threaded}} - -element create forum posting_policy \ - -label [_ forums.Posting_Policy] -datatype text -widget select -options {{Open open} {Moderated moderated} {Closed closed}} - -element create forum new_threads_p \ - -label [_ forums.lt_Users_Can_Create_New_] -datatype integer -widget radio -options {{Yes 1} {No 0}} - -if {[form is_valid forum]} { - template::form get_values forum return_url forum_id name charter presentation_type posting_policy new_threads_p - - forum::edit -forum_id $forum_id \ - -name $name \ - -charter $charter \ - -presentation_type $presentation_type \ - -posting_policy $posting_policy - - forum::posting_policy_set -posting_policy $posting_policy \ - -forum_id $forum_id - - # Users can create new threads? - if {$new_threads_p} { - forum::new_questions_allow -forum_id $forum_id - } else { - forum::new_questions_deny -forum_id $forum_id - } - - ad_returnredirect $return_url - ad_script_abort -} - # Select the info set package_id [ad_conn package_id] forum::get -forum_id $forum_id -array forum @@ -69,13 +23,3 @@ } set context [list [_ forums.Edit_forum]] - -if { [form is_request forum] } { - element set_properties forum return_url -value $return_url - element set_properties forum forum_id -value $forum_id - element set_properties forum name -value $forum(name) - element set_properties forum charter -value $forum(charter) - element set_properties forum presentation_type -value $forum(presentation_type) - element set_properties forum posting_policy -value $forum(posting_policy) - element set_properties forum new_threads_p -value [forum::new_questions_allowed_p -forum_id $forum_id] -} Index: openacs-4/packages/forums/www/admin/forum-new.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/forum-new.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/forums/www/admin/forum-new.adp 22 May 2003 14:57:41 -0000 1.6 +++ openacs-4/packages/forums/www/admin/forum-new.adp 17 Dec 2003 15:45:31 -0000 1.7 @@ -3,9 +3,4 @@ @context;noquote@ forum.name - - - - - - + Index: openacs-4/packages/forums/www/admin/forum-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/forum-new.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/forums/www/admin/forum-new.tcl 3 Oct 2003 17:14:29 -0000 1.13 +++ openacs-4/packages/forums/www/admin/forum-new.tcl 17 Dec 2003 15:45:31 -0000 1.14 @@ -10,86 +10,6 @@ {name ""} } -set package_id [ad_conn package_id] - -form create forum - -element create forum forum_id \ - -label [_ forums.Forum_ID] \ - -datatype integer \ - -widget hidden - -element create forum name \ - -label [_ forums.Name] \ - -datatype text \ - -widget text \ - -html {size 60} \ - -validate { {expr ![empty_string_p [string trim $value]]} {Forum Name can not be blank} - } - -element create forum charter \ - -label [_ forums.Charter] \ - -datatype text \ - -widget textarea \ - -html {cols 60 rows 10 wrap soft} \ - -optional - -element create forum presentation_type \ - -label [_ forums.Presentation] \ - -datatype text \ - -widget select \ - -options [list [list [_ forums.Flat] flat] [list [_ forums.Threaded] threaded]] - -element create forum posting_policy \ - -label [_ forums.Posting_Policy] \ - -datatype text \ - -widget select \ - -options [list [list [_ forums.open] open] [list [_ forums.moderated] moderated] [list [_ forums.closed] closed] ] - -element create forum new_threads_p \ - -label [_ forums.lt_Users_Can_Create_New_] \ - -datatype integer \ - -widget radio \ - -options [list [list [_ forums.Yes] 1] [list [_ forums.No] 0] ] \ - -default 1 - -if {[form is_valid forum]} { - template::form get_values forum \ - forum_id name charter presentation_type posting_policy new_threads_p - - set forum_id [forum::new -forum_id $forum_id \ - -name $name \ - -charter $charter \ - -presentation_type $presentation_type \ - -posting_policy $posting_policy \ - -package_id $package_id \ - ] - - forum::posting_policy_set -posting_policy $posting_policy \ - -forum_id $forum_id - - # Users can create new threads? - if {$new_threads_p} { - forum::new_questions_allow -forum_id $forum_id - } else { - forum::new_questions_deny -forum_id $forum_id - } - - ad_returnredirect "../" - ad_script_abort -} - set context [_ forums.Create_New_Forum] -if { [form is_request forum] } { - # Pre-fetch the forum_id - set forum_id [db_nextval acs_object_id_seq] - element set_properties forum forum_id -value $forum_id - element set_properties forum name -value $name - element set_properties forum presentation_type -value threaded - element set_properties forum new_threads_p -value 1 -} - ad_return_template - - Index: openacs-4/packages/forums/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/index.adp,v diff -u -r1.8 -r1.9 --- openacs-4/packages/forums/www/admin/index.adp 3 Oct 2003 18:26:31 -0000 1.8 +++ openacs-4/packages/forums/www/admin/index.adp 17 Dec 2003 15:45:31 -0000 1.9 @@ -4,7 +4,7 @@

#forums.Forums#

-

+

» #forums.Create_a_New_Forum# Index: openacs-4/packages/forums/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/index.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/forums/www/admin/index.tcl 3 Oct 2003 18:26:31 -0000 1.6 +++ openacs-4/packages/forums/www/admin/index.tcl 17 Dec 2003 15:45:31 -0000 1.7 @@ -8,63 +8,5 @@ } -template::list::create \ - -name forums \ - -multirow forums \ - -elements { - edit { - label {} - sub_class narrow - display_template { - - } - link_url_col edit_url - } - name { - label "#forums.Forum_Name#" - link_url_col view_url - } - enabled { - label "Enabled" - html { align center } - display_template { - - \#forums.disable\# - - - \#forums.enable\# - - } - } - permissions { - label "#acs-subsite.Permissions#" - display_template "#acs-subsite.Permissions#" - link_url_col permissions_url - } - } - - -# List of forums -set package_id [ad_conn package_id] -db_multirow -extend { - view_url - edit_url - permissions_url - enable_url - disable_url -} forums select_forums {} { - if { [template::util::is_true $enabled_p] } { - set view_url [export_vars -base "[ad_conn package_url]forum-view" { forum_id }] - } else { - set view_url {} - } - set edit_url [export_vars -base "forum-edit" { forum_id }] - set permissions_url [export_vars -base permissions { { object_id $forum_id } }] - set enable_url [export_vars -base "forum-enable" { forum_id }] - set disable_url [export_vars -base "forum-disable" { forum_id }] -} - set parameters_url [export_vars -base "/shared/parameters" { { return_url [ad_return_url] } { package_id {[ad_conn package_id]} } }] set permissions_url [export_vars -base "permissions" { { object_id {[ad_conn package_id]} } }] - - Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/admin/index.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/forums/www/admin/permissions-user-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/permissions-user-add.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/forums/www/admin/permissions-user-add.tcl 10 Nov 2003 15:12:02 -0000 1.2 +++ openacs-4/packages/forums/www/admin/permissions-user-add.tcl 17 Dec 2003 15:45:31 -0000 1.3 @@ -18,4 +18,3 @@ set page_title "Add User on $what" set context [list [list [export_vars -base permissions { object_id }] "$what Permissions"] $page_title] - Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/moderate/forum-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/forums/www/moderate/forum-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/forums/www/moderate/forum.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/moderate/forum.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/forums/www/moderate/forum.adp 22 May 2003 14:58:15 -0000 1.5 +++ openacs-4/packages/forums/www/moderate/forum.adp 17 Dec 2003 15:45:31 -0000 1.6 @@ -4,16 +4,4 @@

#forums.Pending_Threads#

- - - - + Index: openacs-4/packages/forums/www/moderate/forum.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/moderate/forum.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/forums/www/moderate/forum.tcl 25 Oct 2002 13:00:04 -0000 1.4 +++ openacs-4/packages/forums/www/moderate/forum.tcl 17 Dec 2003 15:45:31 -0000 1.5 @@ -16,10 +16,4 @@ # Get forum data forum::get -forum_id $forum_id -array forum -# Get the threads that need approval -db_multirow pending_threads select_pending_threads {} - ad_return_template - - - Index: openacs-4/packages/forums/www/moderate/message-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/moderate/message-delete.adp,v diff -u -r1.7 -r1.8 --- openacs-4/packages/forums/www/moderate/message-delete.adp 22 May 2003 14:58:15 -0000 1.7 +++ openacs-4/packages/forums/www/moderate/message-delete.adp 17 Dec 2003 15:45:31 -0000 1.8 @@ -2,23 +2,4 @@ #forums.Confirm_Delete# @message.subject;noquote@ #forums.delete# - - - #forums.Are_you_sure_you_want_to_delete_lt# -

- -

- -
- -

- - #forums.Yes# -

- #forums.No# -

- - - - - + Index: openacs-4/packages/forums/www/moderate/message-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/moderate/message-delete.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/forums/www/moderate/message-delete.tcl 20 Jun 2003 15:24:24 -0000 1.9 +++ openacs-4/packages/forums/www/moderate/message-delete.tcl 17 Dec 2003 15:45:31 -0000 1.10 @@ -12,32 +12,10 @@ {confirm_p 0} } -set table_border_color [parameter::get -parameter table_border_color] - # Check that the user can moderate the forum forum::security::require_moderate_message -message_id $message_id # Select the stuff forum::message::get -message_id $message_id -array message -# Confirmed? -if {$confirm_p} { - # Delete the message and all children - forum::message::delete -message_id $message_id - - # Redirect to the forum - ad_returnredirect "../forum-view?forum_id=$message(forum_id)" - ad_script_abort -} - -set url_vars [export_url_vars message_id return_url] - ad_return_template - - - - - - - - Index: openacs-4/packages/forums/www/moderate/message-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/moderate/message-edit.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/forums/www/moderate/message-edit.adp 22 May 2003 14:58:15 -0000 1.5 +++ openacs-4/packages/forums/www/moderate/message-edit.adp 17 Dec 2003 15:45:31 -0000 1.6 @@ -2,7 +2,4 @@ #forums.Edit_Message# @message.subject;noquote@ #forums.Edit# - - - - + Index: openacs-4/packages/forums/www/moderate/message-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/moderate/message-edit.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/forums/www/moderate/message-edit.tcl 20 Jun 2003 15:24:24 -0000 1.7 +++ openacs-4/packages/forums/www/moderate/message-edit.tcl 17 Dec 2003 15:45:31 -0000 1.8 @@ -11,61 +11,7 @@ {return_url "../message-view"} } -form create message - -element create message message_id \ - -label [_ forums.Message_ID] \ - -datatype integer \ - -widget hidden - -element create message subject \ - -label [_ forums.Subject] \ - -datatype text \ - -widget text \ - -html {size 60} \ - -validate { {expr ![empty_string_p [string trim $value]]} {Please enter a subject} } - -element create message content \ - -label [_ forums.Body] \ - -datatype text \ - -widget textarea \ - -html {rows 20 cols 60 wrap soft} \ - -validate { - empty {expr ![empty_string_p [string trim $value]]} {Please enter a message} - html { expr {( [string match [set l_html_p [ns_queryget html_p f]] "t"] && [empty_string_p [set v_message [ad_html_security_check $value]]] ) || [string match $l_html_p "f"] } } - {} - } - -element create message html_p \ - -label [_ forums.Format] \ - -datatype text \ - -widget select \ - -options [list [list [_ forums.text] f] [list [_ forums.html] t]] - -if {[form is_valid message]} { - template::form get_values message message_id subject content html_p - - forum::message::edit \ - -message_id $message_id \ - -subject $subject \ - -content $content \ - -html_p $html_p - - ad_returnredirect "$return_url?message_id=$message_id" - ad_script_abort -} - forum::message::get -message_id $message_id -array message forum::get -forum_id $message(forum_id) -array forum -# Prepare the other data -element set_properties message message_id -value $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) - ad_return_template - - - -