Index: openacs-4/packages/dotlrn-bboard/tcl/dotlrn-bboard-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-bboard/tcl/dotlrn-bboard-procs.tcl,v diff -u -N -r1.28 -r1.29 --- openacs-4/packages/dotlrn-bboard/tcl/dotlrn-bboard-procs.tcl 29 Mar 2002 19:16:08 -0000 1.28 +++ openacs-4/packages/dotlrn-bboard/tcl/dotlrn-bboard-procs.tcl 8 Apr 2002 22:00:46 -0000 1.29 @@ -25,45 +25,45 @@ # ad_library { - + Procs to set up the dotLRN Bboard applet - + @author ben@openforce.net,arjun@openforce.net @creation-date 2001-10-05 - + } namespace eval dotlrn_bboard { - + ad_proc -private my_package_key { } { return "dotlrn-bboard" } ad_proc -public applet_key {} { - get the applet key + get the applet key } { - return "dotlrn_bboard" + return "dotlrn_bboard" } ad_proc -public package_key { } { - get the package_key this applet deals with + get the package_key this applet deals with } { - return "sloan-bboard" + return "sloan-bboard" } ad_proc -public get_pretty_name { } { - returns the pretty name + returns the pretty name } { - return "dotLRN Discussion Forums" + return "dotLRN Discussion Forums" } ad_proc -public add_applet { } { - Add the bboard applet to dotlrn - for one-time init - Must be repeatable! + Add the bboard applet to dotlrn - for one-time init + Must be repeatable! } { # register/activate self with dotlrn # our service contract is in the db, but we must tell dotlrn @@ -75,15 +75,15 @@ } ad_proc -public add_applet_to_community { - community_id + community_id } { - Add the bboard applet to a dotlrn community + Add the bboard applet to a dotlrn community } { - # Create and Mount - set package_key [package_key] - set package_id [dotlrn::instantiate_and_mount -mount_point "forums" $community_id $package_key] + # Create and Mount + set package_key [package_key] + set package_id [dotlrn::instantiate_and_mount -mount_point "forums" $community_id $package_key] - + set auto_create_forum_p [ad_parameter \ -package_id [apm_package_id_from_key [my_package_key]] \ "auto_create_forum_p" "f"] @@ -92,89 +92,86 @@ -package_id [apm_package_id_from_key [my_package_key]] \ "auto_create_forum_name" "Discussions"] - if {$auto_create_forum_p == "t"} { + if {$auto_create_forum_p == "t"} { # set up a forum inside that instance, with context set to the - # package ID of the bboard package + # package ID of the bboard package bboard_forum_new -bboard_id $package_id \ -short_name $auto_create_forum_name \ -context_id $package_id } - # get the portal_template_id by callback - set pt_id [dotlrn_community::get_portal_template_id $community_id] + # get the portal_template_id by callback + set pt_id [dotlrn_community::get_portal_template_id $community_id] - # set up the DS for the portal template - bboard_portlet::make_self_available $pt_id - bboard_portlet::add_self_to_page $pt_id $package_id + # set up the DS for the portal template + bboard_portlet::make_self_available $pt_id + bboard_portlet::add_self_to_page $pt_id $package_id # set up the DS for the admin page set admin_portal_id [dotlrn_community::get_community_admin_portal_id $community_id] bboard_admin_portlet::make_self_available $admin_portal_id bboard_admin_portlet::add_self_to_page $admin_portal_id $package_id - # Set up permissions for basic members (Admins inherit no problem) - set members [dotlrn_community::get_rel_segment_id -community_id $community_id -rel_type dotlrn_member_rel] - ad_permission_grant $members $package_id bboard_read_forum - ad_permission_grant $members $package_id bboard_read_category - ad_permission_grant $members $package_id bboard_read_message - ad_permission_grant $members $package_id bboard_create_message + # Set up permissions for basic members (Admins inherit no problem) + set members [dotlrn_community::get_rel_segment_id -community_id $community_id -rel_type dotlrn_member_rel] + ad_permission_grant $members $package_id bboard_read_forum + ad_permission_grant $members $package_id bboard_read_category + ad_permission_grant $members $package_id bboard_read_message + ad_permission_grant $members $package_id bboard_create_message - # return the package_id - return $package_id + # return the package_id + return $package_id } ad_proc -public remove_applet { - community_id - package_id + community_id + package_id } { - remove the applet from the community + remove the applet from the community } { - # Dropping all messages, forums + # Dropping all messages, forums - # Killing the package - + # Killing the package + } ad_proc -public add_user { - community_id + community_id } { - Called when the user is initially added as a dotlrn user. - For one-time init stuff - + Called when the user is initially added as a dotlrn user. + For one-time init stuff } { - } - ad_proc -public add_user_to_community { - community_id - user_id + community_id + user_id } { - Add a user to a specific dotlrn community + Add a user to a specific dotlrn community } { - # Get the portal_id by callback - set portal_id [dotlrn_community::get_portal_id $community_id $user_id] - - # Get the package_id by callback - set package_id [dotlrn_community::get_applet_package_id $community_id dotlrn_bboard] + # Get the portal_id by callback + set portal_id [dotlrn_community::get_portal_id $community_id $user_id] - # Allow user to see the bboard forums - # nothing for now + # Get the package_id by callback + set package_id [dotlrn_community::get_applet_package_id $community_id dotlrn_bboard] - # Make bboard DS available to this page - bboard_portlet::make_self_available $portal_id + # Allow user to see the bboard forums + # nothing for now - # Call the portal element to be added correctly - set element_id [bboard_portlet::add_self_to_page $portal_id $package_id] + # Make bboard DS available to this page + bboard_portlet::make_self_available $portal_id + # Call the portal element to be added correctly + set element_id [bboard_portlet::add_self_to_page $portal_id $package_id] + # Make sure that the group name is not displayed here portal::set_element_param $element_id "display_group_name_p" "f" - # Now for the user workspace - set workspace_portal_id [dotlrn::get_workspace_portal_id $user_id] + # Now for the user workspace + set workspace_portal_id [dotlrn::get_workspace_portal_id $user_id] - # Add the portlet here - if { $workspace_portal_id != "" } { + # Add the portlet here + if { $workspace_portal_id != "" } { set element_id [bboard_portlet::add_self_to_page $workspace_portal_id $package_id] # Make sure that the group name IS displayed here @@ -189,33 +186,33 @@ } ad_proc -public remove_user_from_community { - community_id - user_id + community_id + user_id } { - Remove a user from a community + Remove a user from a community } { - # Get the portal_id - set portal_id [dotlrn_community::get_portal_id $community_id $user_id] - - # Get the package_id by callback - set package_id [dotlrn_community::get_applet_package_id $community_id [applet_key]] + # Get the portal_id + set portal_id [dotlrn_community::get_portal_id $community_id $user_id] - # Remove the portal element - bboard_portlet::remove_self_from_page $portal_id $package_id + # Get the package_id by callback + set package_id [dotlrn_community::get_applet_package_id $community_id [applet_key]] - # Buh Bye. - bboard_portlet::make_self_unavailable $portal_id + # Remove the portal element + bboard_portlet::remove_self_from_page $portal_id $package_id - # remove user permissions to see bboards - # nothing to do here + # Buh Bye. + bboard_portlet::make_self_unavailable $portal_id - # Remove from the main workspace - set workspace_portal_id [dotlrn::get_workspace_portal_id $user_id] + # remove user permissions to see bboards + # nothing to do here - # Remove the portlet here + # Remove from the main workspace + set workspace_portal_id [dotlrn::get_workspace_portal_id $user_id] + + # Remove the portlet here if { $workspace_portal_id != "" } { bboard_portlet::remove_self_from_page $workspace_portal_id $package_id } } - + }