move-thread.tcl
Move a Message to other thread in the same forum.
- Location:
- /packages/forums/www/moderate/move-thread.tcl
- Author:
- Natalia Pérez <nperper@it.uc3m.es>
- Created:
- 2005-03-14
Related Files
- packages/forums/www/moderate/move-thread.xql
- packages/forums/www/moderate/move-thread.tcl
- packages/forums/www/moderate/move-thread.adp
- packages/forums/www/moderate/move-thread-postgresql.xql
- packages/forums/www/moderate/move-thread-oracle.xql
[ hide source ] | [ make this the default ]
File Contents
ad_page_contract { Move a Message to other thread in the same forum. @author Natalia Pérez (nperper@it.uc3m.es) @creation-date 2005-03-14 } { msg_id:object_type(forums_message),notnull selected_message:object_type(forums_message),notnull {confirm_p:boolean,notnull 0} } set table_border_color [parameter::get -parameter table_border_color] # Select the stuff forum::message::get -message_id $msg_id -array message # Check that the user can moderate the forum forum::security::require_moderate_forum -forum_id $message(forum_id) #form to confirm ad_form -name confirmed_move -mode {display} \ -actions [list [list [_ forums.Yes] yes] [list No no] ] \ -export { msg_id return_url selected_message} \ -html {enctype multipart/form-data} -form { {data:text(hidden) {value 0}} } #get the clicked button set action [template::form::get_action confirmed_move] if {$action eq "yes"} { set confirm_p 1 } if {$action eq "no"} { set confirm_p 2 } #information about final message db_0or1row forums::move_thread::get_subject_message {} # Confirmed if {$confirm_p == 1} { set message_id $selected_message #update the final message: increase reply_count, approved_reply_count and max_child_sortkey db_dml forums::move_thread::update_final_message {} #get the tree_sortkey of final message db_0or1row forums::move_thread::get_father_tree_sortkey {} #update the initial message db_0or1row forums::move_thread::get_final_tree_sortkey {} #update the initial father message: decreasing reply_count and approved_reply_count db_0or1row forums::move_thread::get_father_message_id {} db_dml forums::move_thread::update_father_reply_count {} #get all descendents db_foreach forums::move_thread::get_all_child {} { #update los ocho primeros dígitos de tree_sortkey set join_tree_sortkey $father_tree_sortkey append join_tree_sortkey $father_max_child_sortkey append join_tree_sortkey $child_tree_sortkey #update the children's initial message: update tree_sortkey db_dml forums::move_thread::update_child_thread_father {} #update the final message: increasing reply_count and approved_reply_count db_dml forums::move_thread::update_final_reply_count {} #update the initial father message: decreasing reply_count and approved_reply_count db_dml forums::move_thread::update_father_reply_count {} } #update the initial message set join_tree_sortkey $father_tree_sortkey append join_tree_sortkey $father_max_child_sortkey db_dml forums::move_thread::update_thread_father {} #update the last_child_post final thread and last_child_post initial father thread db_dml forums::move_thread::update_last_child_post_initial {} db_dml forums::move_thread::update_last_child_post_final {} if { [forum::use_ReadingInfo_p] } { ns_log Notice "moving message $message(message_id) to thread $selected_message" db_exec_plsql forums::move_thread::update_reading_info {} } # Redirect to the forum ad_returnredirect "../forum-view?forum_id=$message(forum_id)" ad_script_abort } set msg_id $message(message_id) set return_url "../message-view" #if confirm is no if {$confirm_p == 2} { ad_returnredirect "../message-view?message_id=$message(message_id)" } set url_vars [export_vars {msg_id return_url selected_message}] if {[info exists alt_template] && $alt_template ne ""} { ad_return_template $alt_template } set title "#forums.Move_message_to_thread# \"$subject\"" set context $title # Local variables: # mode: tcl # tcl-indent-level: 4 # indent-tabs-mode: nil # End: