@context_bar@
+@title@
+
+
+
Index: openacs-4/packages/forums/www/master.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/master.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/master.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,6 @@
+
+if {[info exists context_bar]} {
+ set context_bar [eval ad_context_bar $context_bar]
+} else {
+ set context_bar ""
+}
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/message-email.adp 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,13 @@
+
+Email Message: @message.forum_name@ - @message.subject@
+
+
+You're emailing a copy of a posting to a friend.
+Subject of Posting: @message.subject@
+Body of Posting:
+
+@message.content@
+
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/message-email.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,56 @@
+
+ad_page_contract {
+
+ Forward a message to a friend
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-28
+ @cvs-id $id: Exp $
+} {
+ message_id:integer,notnull
+}
+
+form create message
+
+element create message message_id \
+ -label "Message ID" -datatype integer -widget hidden
+
+element create message to_email \
+ -label "Email" -datatype text -widget text -html {size 60}
+
+element create message subject \
+ -label "Subject" -datatype text -widget text -html {size 80}
+
+element create message pre_body \
+ -label "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
+
+ set new_body "$pre_body"
+ append new_body "\n\n===================================\n\n"
+ append new_body "$message(user_name) wrote, on [util_AnsiDatetoPrettyDate $message(posting_date)]:\n"
+ append new_body "Subject: $message(subject)\n\n"
+ append new_body "$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
+
+ ad_returnredirect "message-view?message_id=$message_id"
+ ad_script_abort
+}
+
+# Get the message information
+forum::message::get -message_id $message_id -array message
+
+element set_properties message subject -value "\[Fwd from $message(user_name): $message(subject)\]"
+element set_properties message message_id -value $message_id
+
+ad_return_template
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/message-post.adp 29 May 2002 21:40:10 -0000 1.1
@@ -0,0 +1,5 @@
+
+Post to Forum: @forum.name@
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/message-post.tcl 29 May 2002 21:40:10 -0000 1.1
@@ -0,0 +1,70 @@
+
+ad_page_contract {
+
+ Form to create message and insert it
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-25
+ @cvs-id $id: Exp $
+} {
+ {forum_id ""}
+ {parent_id ""}
+}
+
+# Either forum_id or parent_id has to be non-null
+if {[empty_string_p $forum_id] && [empty_string_p $parent_id]} {
+ # error!
+ return -code error
+}
+
+# We would use the nice ad_form construct if we could
+form create message
+
+element create message message_id \
+ -label "Message ID" -datatype integer -widget hidden
+
+element create message subject \
+ -label "Subject" -datatype text -widget text -html {size 60}
+
+element create message content \
+ -label "Body" -datatype text -widget textarea -html {rows 30 cols 60 wrap soft}
+
+element create message parent_id \
+ -label "parent ID" -datatype integer -widget hidden -optional
+
+element create message forum_id \
+ -label "forum ID" -datatype integer -widget hidden
+
+element create message html_p \
+ -label "Format" -datatype text -widget select -options {{text f} {html t}}
+
+if {[form is_valid message]} {
+ template::form get_values message message_id forum_id parent_id subject content html_p
+
+ forum::message::new -forum_id $forum_id \
+ -message_id $message_id \
+ -parent_id $parent_id \
+ -subject $subject \
+ -content $content \
+ -html_p $html_p
+
+ ad_returnredirect "message-view?message_id=$message_id"
+ ad_script_abort
+}
+
+set message_id [db_nextval acs_object_id_seq]
+
+if {[empty_string_p $forum_id]} {
+ # get the parent message information
+ forum::message::get -message_id $parent_id -array parent_message
+ set forum_id $parent_message(forum_id)
+}
+
+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
+
+ad_return_template
Index: openacs-4/packages/forums/www/message-post.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/message-post.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/message-post.xql 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,10 @@
+
+
+
+
+
+select forum_id from forums_messages where message_id= :parent_id
+
+
+
+
Index: openacs-4/packages/forums/www/message-view-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-view-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/message-view-oracle.xql 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,25 @@
+
+
+ oracle8.1.6
+
+
+
+select message_id, subject, content, person.name(user_id) as user_name, posting_date, tree.tree_level(tree_sortkey) as tree_level, state, user_id
+from forums_messages_approved
+where forum_id= :forum_id
+and tree_sortkey between tree.left(:tree_sortkey) and tree.right(:tree_sortkey)
+order by tree_sortkey
+
+
+
+
+
+select message_id, subject, content, person.name(user_id) as user_name, posting_date, tree.tree_level(tree_sortkey) as tree_level, state, user_id
+from forums_messages
+where forum_id= :forum_id
+and tree_sortkey between tree.left(:tree_sortkey) and tree.right(:tree_sortkey)
+order by tree_sortkey
+
+
+
+
Index: openacs-4/packages/forums/www/message-view-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-view-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/message-view-postgresql.xql 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,12 @@
+
+
+ postgresql7.1
+
+
+
+select message_id, subject, content, party__name(user_id) as user_name, posting_date from forums_messages
+where parent_id= :message_id order by posting_date
+
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/message-view.adp 29 May 2002 21:40:10 -0000 1.1
@@ -0,0 +1,37 @@
+
+Forum @forum.name@: @message.subject@
+@context_bar@
+
+
+@notification_chunk@
+
+
+
+response to @message.root_subject@
+
+
+@message.subject@
+
+
+
+
+@message.content@
+
+
+
+Respond!
+ |
+Email
+
+
+
+Administration: [@message.state@] [ delete | approve | reject | edit]
+
+
+
Responses
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/message-view.tcl 29 May 2002 21:40:10 -0000 1.1
@@ -0,0 +1,58 @@
+
+ad_page_contract {
+
+ View a message (and its children)
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-25
+ @cvs-id $id: Exp $
+} {
+ message_id:integer,notnull
+}
+
+# Security
+forum::security::require_read_message -message_id $message_id
+
+# Check if the user has admin on the message
+set moderate_p [forum::security::can_moderate_message_p -message_id $message_id]
+set post_p [forum::security::can_post_message_p -message_id $message_id]
+
+# Load up the message information
+forum::message::get -message_id $message_id -array message
+
+# Check if the message is approved
+if {!$moderate_p && $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
+
+# Check preferences for user
+
+# Set some variables for easy SQL access
+set forum_id $message(forum_id)
+set tree_sortkey $message(tree_sortkey)
+
+if {!$moderate_p} {
+ # Select publicly viewable items
+ db_multirow responses select_message_responses {}
+} else {
+ # Select all items
+ db_multirow responses select_message_responses_moderator {}
+}
+
+# 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 -type forums_message_notif -object_id $message_id -pretty_name $message(subject) -url [ad_conn url]?message_id=$message_id]
+} else {
+ set notification_chunk ""
+}
+
+set context_bar [list [list "./forum-view?forum_id=$message(forum_id)" "$message(forum_name)"] {One Message}]
+
+ad_return_template
+
+
+
Index: openacs-4/packages/forums/www/messsage-view-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/messsage-view-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/messsage-view-oracle.xql 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,12 @@
+
+
+ oracle8.1.6
+
+
+
+select message_id, subject, content, party.name(user_id) as user_name, posting_date from forums_messages
+where parent_id= :message_id order by posting_date
+
+
+
+
Index: openacs-4/packages/forums/www/test.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/test.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/test.tcl 29 May 2002 21:40:10 -0000 1.1
@@ -0,0 +1,9 @@
+
+db_transaction {
+ # create the forum
+ set forum_id [forum::new -name "test" -charter "test chrater" -presentation_type "flat" -posting_policy "open" -package_id [ad_conn package_id]]
+
+ set msg_id [forum::message::new -forum_id $forum_id -subject "Test" -content "this is rocking content" -user_id [ad_conn user_id]]
+}
+
+doc_body_append $msg_id
Index: openacs-4/packages/forums/www/user-history-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/user-history-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/user-history-oracle.xql 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,16 @@
+
+
+ oracle8.1.6
+
+
+
+select message_id, subject, posting_date, forums_forums.forum_id, forums_forums.name as forum_name
+from forums_messages, forums_forums
+where forums_messages.forum_id = forums_forums.forum_id
+and user_id= :user_id
+and package_id = :package_id
+$sql_order_by
+
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/user-history.adp 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,27 @@
+
+Forums: Posting History for @user.full_name@
+@context_bar@
+
+
+@dimensional_chunk@
+
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/user-history.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,38 @@
+
+ad_page_contract {
+
+ Posting History for a User
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-29
+ @cvs-id $id: Exp $
+} {
+ user_id:integer,notnull
+ {view "date"}
+}
+
+set package_id [ad_conn package_id]
+
+# FIXME: for now this shows all postings everywhere in all forums!
+
+# choosing the view
+set dimensional_list {
+ {
+ view "View:" date {
+ {date "by Date" { order by date desc } }
+ {forum "by Forum" { order by forums_forums.name, date desc } }
+ }
+ }
+}
+
+set sql_order_by [ad_dimensional_sql $dimensional_list]
+
+# Select the postings
+db_multirow messages select_messages {}
+
+# Get user information
+oacs::user::get -user_id $user_id -array user
+
+set dimensional_chunk [ad_dimensional $dimensional_list]
+set context_bar {{Posting History}}
+ad_return_template
Index: openacs-4/packages/forums/www/admin/forum-add-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/Attic/forum-add-edit.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/forum-add-edit.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,17 @@
+
+ad_page_contract {
+
+ create or edit a forum
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-24
+ @cvs-id $Id: forum-add-edit.tcl,v 1.1 2002/05/29 21:40:11 ben Exp $
+} {
+}
+
+# Load up forum information
+
+# use ad_form to do some funky stuff with loading up or editing a forum
+
+
+
Index: openacs-4/packages/forums/www/admin/forum-disable.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/forum-disable.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/forum-disable.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,15 @@
+
+ad_page_contract {
+
+ Disable a Forum
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-28
+ @cvs-id $id: Exp $
+} {
+ forum_id:integer,notnull
+}
+
+forum::disable -forum_id $forum_id
+
+ad_returnredirect "./"
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/forum-edit.adp 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,5 @@
+
+Edit Forum: @forum.name@
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/forum-edit.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,71 @@
+
+ad_page_contract {
+
+ Edit a Forum
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-25
+ @cvs-id $id: Exp $
+} {
+ forum_id:integer,notnull
+}
+
+form create forum
+
+element create forum forum_id \
+ -label "Forum ID" -datatype integer -widget hidden
+
+element create forum name \
+ -label "Name" -datatype text -widget text -html {size 60}
+
+element create forum charter \
+ -label "Charter" -datatype text -widget textarea -html {cols 60 rows 10 wrap soft}
+
+element create forum presentation_type \
+ -label "Presentation" -datatype text -widget select -options {{Flat flat} {Threaded threaded}}
+
+element create forum posting_policy \
+ -label "Posting Policy" -datatype text -widget select -options {{open open} {moderated moderated} {closed closed}}
+
+element create forum new_threads_p \
+ -label "Users Can Create New Threads" -datatype integer -widget radio -options {{yes 1} {no 0}}
+
+if {[form is_valid forum]} {
+ template::form get_values forum 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
+
+ # 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 "../forum-view?forum_id=$forum_id"
+ ad_script_abort
+}
+
+# Select the info
+set package_id [ad_conn package_id]
+forum::get -forum_id $forum_id -array forum
+
+# Proper scoping?
+if {$package_id != $forum(package_id)} {
+ ns_log Error "Forum Administration: Bad Scoping of Forum #$forum_id in Forum Editing"
+ ad_returnredirect "./"
+ ad_script_abort
+}
+
+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]
+
+ad_return_template
Index: openacs-4/packages/forums/www/admin/forum-enable.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/forum-enable.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/forum-enable.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,15 @@
+
+ad_page_contract {
+
+ Disable a Forum
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-28
+ @cvs-id $id: Exp $
+} {
+ forum_id:integer,notnull
+}
+
+forum::enable -forum_id $forum_id
+
+ad_returnredirect "./"
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/forum-new.adp 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,5 @@
+
+Create New Forum
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/forum-new.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,61 @@
+
+ad_page_contract {
+
+ Create a Forum
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-25
+ @cvs-id $id: Exp $
+} {
+}
+
+# scoping
+set package_id [ad_conn package_id]
+
+form create forum
+
+element create forum forum_id \
+ -label "Forum ID" -datatype integer -widget hidden
+
+element create forum name \
+ -label "Name" -datatype text -widget text -html {size 60}
+
+element create forum charter \
+ -label "Charter" -datatype text -widget textarea -html {cols 60 rows 10 wrap soft}
+
+element create forum presentation_type \
+ -label "Presentation" -datatype text -widget select -options {{Flat flat} {Threaded threaded}}
+
+element create forum posting_policy \
+ -label "Posting Policy" -datatype text -widget select -options {{open open} {moderated moderated} {closed closed}}
+
+element create forum new_threads_p \
+ -label "Users Can Create New Threads" -datatype integer -widget radio -options {{yes 1} {no 0}}
+
+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]
+
+ # 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
+}
+
+# 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 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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/index.adp 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,21 @@
+
+Forums Administration
+
+
+Forums
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/index.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,19 @@
+
+ad_page_contract {
+
+ Forums Administration
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-24
+ @cvs-id $Id: index.tcl,v 1.1 2002/05/29 21:40:11 ben Exp $
+} {
+}
+
+# scoping
+set package_id [ad_conn package_id]
+
+# List of forums
+db_multirow forums select_forums {}
+
+ad_return_template
+
Index: openacs-4/packages/forums/www/admin/index.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/Attic/index.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/index.xql 29 May 2002 21:40:11 -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/www/moderate/forum.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/moderate/forum.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/moderate/forum.adp 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,16 @@
+
+Manage Forum: @forum.name@
+
+
+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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/moderate/forum.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,22 @@
+
+ad_page_contract {
+
+ Moderate a Forum
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-24
+ @cvs-id $Id: forum.tcl,v 1.1 2002/05/29 21:40:11 ben Exp $
+} {
+ forum_id:integer,notnull
+}
+
+# Check that the user can moderate the forum
+forum::security::require_moderate_forum -forum_id $forum_id
+
+# 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/forum.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/moderate/Attic/forum.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/moderate/forum.xql 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,21 @@
+
+
+
+
+
+select message_id, subject, user_id, posting_date, state,
+tree.tree_level(tree_sortkey) as tree_level
+from forums_messages
+where message_id in
+(select message_id
+from forums_messages_pending
+where forum_id= :forum_id)
+or 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/www/moderate/message-approve.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/moderate/message-approve.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/moderate/message-approve.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,20 @@
+
+ad_page_contract {
+
+ Approve a Message
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-24
+ @cvs-id $Id: message-approve.tcl,v 1.1 2002/05/29 21:40:11 ben Exp $
+} {
+ message_id:integer,notnull
+ {return_url "../message-view"}
+}
+
+# Check that the user can moderate the forum
+forum::security::require_moderate_message -message_id $message_id
+
+# Approve the message
+forum::message::approve -message_id $message_id
+
+ad_returnredirect "$return_url?message_id=$message_id"
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/moderate/message-delete.adp 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,20 @@
+
+Confirm Delete: @message.subject@
+
+
+Are you sure you want to delete this message?
+
+@message.subject@
+
+
+
+
+@message.content@
+
+
+
+
+Yes
+
+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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/moderate/message-delete.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,31 @@
+
+ad_page_contract {
+
+ Delete a Message
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-24
+ @cvs-id $Id: message-delete.tcl,v 1.1 2002/05/29 21:40:11 ben Exp $
+} {
+ message_id:integer,notnull
+ {return_url ""}
+ {confirm_p 0}
+}
+
+# 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
+
+# Confirm?
+if {!$confirm_p} {
+ set url_vars [export_url_vars message_id return_url]
+ ad_return_template
+} else {
+ # 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)"
+}
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/moderate/message-edit.adp 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,5 @@
+
+Edit Message: @message.subject@
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/moderate/message-edit.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,51 @@
+
+ad_page_contract {
+
+ Form to edit a message
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-25
+ @cvs-id $id: Exp $
+} {
+ message_id:integer,notnull
+ {return_url "../message-view"}
+}
+
+# We would use the nice ad_form construct if we could
+form create message
+
+element create message message_id \
+ -label "Message ID" -datatype integer -widget hidden
+
+element create message subject \
+ -label "Subject" -datatype text -widget text -html {size 60}
+
+element create message content \
+ -label "Body" -datatype text -widget textarea -html {rows 30 cols 60 wrap soft}
+
+element create message html_p \
+ -label "Format" -datatype text -widget select -options {{text f} {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
Index: openacs-4/packages/forums/www/moderate/message-reject.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/moderate/message-reject.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/moderate/message-reject.tcl 29 May 2002 21:40:11 -0000 1.1
@@ -0,0 +1,20 @@
+
+ad_page_contract {
+
+ Reject a Message
+
+ @author Ben Adida (ben@openforce)
+ @creation-date 2002-05-24
+ @cvs-id $Id: message-reject.tcl,v 1.1 2002/05/29 21:40:11 ben Exp $
+} {
+ message_id:integer,notnull
+ {return_url "../message-view"}
+}
+
+# Check that the user can moderate the forum
+forum::security::require_moderate_message -message_id $message_id
+
+# Reject the message
+forum::message::reject -message_id $message_id
+
+ad_returnredirect "$return_url?message_id=$message_id"