Index: openacs-4/packages/dotlrn-fs/tcl/dotlrn-fs-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-fs/tcl/dotlrn-fs-procs.tcl,v diff -u -r1.75 -r1.76 --- openacs-4/packages/dotlrn-fs/tcl/dotlrn-fs-procs.tcl 13 Jul 2002 00:16:37 -0000 1.75 +++ openacs-4/packages/dotlrn-fs/tcl/dotlrn-fs-procs.tcl 31 Jul 2002 21:18:33 -0000 1.76 @@ -199,7 +199,7 @@ # non-member portal stuff set non_member_portal_id [dotlrn_community::get_non_member_portal_id \ - -community_id $community_id + -community_id $community_id ] # Make public-folder the only one available at non-member page @@ -633,13 +633,44 @@ file_id => :object_id, target_folder_id => :target_folder_id, creation_user => :user_id, - creation_ip => NULL + creation_ip => null ); end; } } } + ad_proc -public change_event_handler { + community_id + event + old_value + new_value + } { + dotlrn-fs 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 we do when a community is renamed + } { + fs::rename_folder \ + -folder_id [get_community_root_folder -community_id $community_id] \ + -name "${new_value}'s Files" + + fs::rename_folder \ + -folder_id [get_community_shared_folder -community_id $community_id] \ + -name "${new_value}'s Shared Files" + } + ad_proc -public get_user_default_page {} { return the user default page to add the portlet to } { @@ -728,4 +759,27 @@ } -default ""] } + ad_proc -public get_community_root_folder { + {-community_id:required} + } { + get the community's root folder id + } { + set package_id [dotlrn_community::get_applet_package_id \ + -community_id $community_id \ + -applet_key [applet_key] \ + ] + + return [fs::get_root_folder -package_id $package_id] + } + + ad_proc -public get_community_shared_folder { + {-community_id:required} + } { + get the community's sahred folder id + } { + set root_folder_id [get_community_root_folder -community_id $community_id] + + return [db_string select_community_shared_folder {} -default ""] + } + }