Index: openacs-4/packages/dotlrn-forums/tcl/dotlrn-forums-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-forums/tcl/dotlrn-forums-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/dotlrn-forums/tcl/dotlrn-forums-procs.tcl 13 Jul 2002 03:05:24 -0000 1.7 +++ openacs-4/packages/dotlrn-forums/tcl/dotlrn-forums-procs.tcl 31 Jul 2002 21:18:33 -0000 1.8 @@ -97,17 +97,12 @@ ] # mount attachments under forums, if available - # attachments requires that dotlrn-fs is already mounted - if {[apm_package_registered_p attachments] - && [dotlrn_community::applet_active_p \ - -community_id $community_id \ - -applet_key [dotlrn_fs::applet_key]]} { + # attachments requires that dotlrn-fs is already mounted + if {[apm_package_registered_p attachments] && [dotlrn_community::applet_active_p -community_id $community_id -applet_key [dotlrn_fs::applet_key]]} { set attachments_node_id [site_node::new \ -name [attachments::get_url] \ - -parent_id [site_node::get_node_id_from_object_id \ - -object_id $package_id - ] + -parent_id [site_node::get_node_id_from_object_id -object_id $package_id] ] site_node::mount \ @@ -116,18 +111,16 @@ set fs_package_id [dotlrn_community::get_applet_package_id \ -community_id $community_id \ - -applet_key [dotlrn_fs::applet_key] + -applet_key [dotlrn_fs::applet_key] \ ] - + # map the fs root folder to the package_id of the new forums pkg attachments::map_root_folder \ -package_id $package_id \ - -folder_id [fs::get_root_folder -package_id $fs_package_id] - - } else { - ns_log Warning "DOTLRN-FORUMS: Warning attachments or dotlrn-fs not found!" + -folder_id [fs::get_root_folder -package_id $fs_package_id] + } - + set auto_create_forum_p [parameter::get_from_package_key \ -package_key [my_package_key] \ -parameter auto_create_forum_p \ @@ -326,4 +319,47 @@ dotlrn_forums::add_applet_to_community $new_community_id } + ad_proc -public change_event_handler { + community_id + event + old_value + new_value + } { + listens for the following events: rename + } { + switch $event { + rename { + handle_rename -community_id $community_id -old_value $old_value -new_value $new_value + } + } + } + + ad_proc -private handle_rename { + {-community_id:required} + {-old_value:required} + {-new_value:required} + } { + what to do with forums when the name of the community changes + } { + set package_id [dotlrn_community::get_applet_package_id \ + -community_id $community_id \ + -applet_key [applet_key] \ + ] + set name "$old_value Forum" + + db_foreach select_forums_with_old_name { + select * + from forums_forums + where package_id = :package_id + and name = :name + } { + forum::edit \ + -forum_id $forum_id \ + -name "$new_value Forum" \ + -charter $charter \ + -presentation_type $presentation_type \ + -posting_policy $posting_policy + } + } + }