Index: openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-members-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-members-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-members-procs.tcl 14 May 2002 21:42:16 -0000 1.11 +++ openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-members-procs.tcl 15 May 2002 21:20:19 -0000 1.12 @@ -30,14 +30,6 @@ } namespace eval dotlrn_members { - - # aks - don't need this, I think - # ad_proc -public package_key { - # } { - # get the package_key this applet deals with - # } { - # return "dotlrn" - # } ad_proc portal_element_key { } { @@ -50,7 +42,7 @@ } { Returns the pretty name of the applet } { - return "dotLRN Members Info" + return "Group Members Info" } ad_proc -public add_applet { @@ -60,39 +52,27 @@ dotlrn_applet::add_applet_to_dotlrn -applet_key "dotlrn_members" } - ad_proc -public get_community_default_page {} { - Returns the user default page to add the portlet to. - FIXME Should be a ad_param. - } { - return "People" - } - ad_proc -public get_subcomm_default_page {} { - FIXME Should be a ad_param. + ad_proc -public remove_applet { + package_id } { - return "Subgroup Info" + remove the applet from dotlrn + } { } ad_proc -public add_applet_to_community { community_id } { Add the dotlrn applet to a specific community } { - # portal template stuff - set portal_id [dotlrn_community::get_portal_id -community_id $community_id] - set community_type [dotlrn_community::get_community_type_from_community_id $community_id] + set portal_id [dotlrn_community::get_portal_id \ + -community_id $community_id + ] + set args [ns_set create args] + ns_set put $args community_id $community_id - if {[string equal $community_type "dotlrn_community"]} { - set page_name [get_subcomm_default_page] - } else { - set page_name [get_community_default_page] - } + dotlrn_members::add_portlet $portal_id $args - dotlrn_members_portlet::add_self_to_page \ - -portal_id $portal_id \ - -page_name $page_name \ - -community_id $community_id - # this is not supposed to return anything, since # any return value here is interpreted as a valid package_id! return @@ -104,22 +84,13 @@ remove the dotlrn members applet from a specific community } { set portal_id [dotlrn_community::get_portal_id -community_id $community_id] - dotlrn_members_portlet::remove_self_from_page -portal_id $portal_id + dotlrn_members::remove_portlet $portal_id "" } - ad_proc -public remove_applet { - package_id - } { - remove the applet from dotlrn - } { - } - ad_proc -public add_user { user_id } { - Called for one time init when this user is added to dotlrn } { - return } ad_proc -public remove_user { @@ -132,69 +103,91 @@ community_id user_id } { - Called when a user is added to a spceific dotlrn community } { } ad_proc -public remove_user_from_community { community_id user_id } { - Remove a user from a community. Since this applet is not shown - on a user's portal, no action is required here. } { } - - ad_proc -public remove_user_from_community { - community_id - user_id - } { - Remove a user from a community - } { - set package_id [dotlrn_community::get_applet_package_id $community_id [applet_key]] - set portal_id [dotlrn::get_workspace_portal_id $user_id] - set args [ns_set create args] - ns_set put $args user_id $user_id - ns_set put $args community_id $community_id - ns_set put $args package_id $package_id - set list_args [list $portal_id $args] - - remove_portlet $portal_id $args - } ad_proc -public add_portlet { + portal_id args } { A helper proc to add the underlying portlet to the given portal. - @param args a list-ified array of args defined in add_applet_to_community + @portal_id + @param args ns_set (community_id?) } { - ns_log notice "** Error in [get_pretty_name]: 'add_portlet' not implemented!" - ad_return_complaint 1 "Please notifiy the administrator of this error: - ** Error in [get_pretty_name]: 'add_portlet' not implemented!" + # since this portlet is only added to community portals or portal templates + # we only need to check for community_id in the ns_set + set community_id [ns_set get $args "community_id"] + + if {![empty_string_p $community_id]} { + # portal_id is a community portal + set community_type \ + [dotlrn_community::get_community_type_from_community_id \ + $community_id] + + if {[string equal $community_type "dotlrn_community"]} { + set page_name [get_subcomm_default_page] + } else { + set page_name [get_community_default_page] + } + } else { + # portal_id is a portal template + set community_id 0 + + # FIXME - AKS - how do we find the right page without a type + # for a template? Maybe they should just pass it in. + set page_name "" + } + + dotlrn_members_portlet::add_self_to_page \ + -portal_id $portal_id \ + -page_name $page_name \ + -community_id $community_id + } ad_proc -public remove_portlet { + portal_id args } { A helper proc to remove the underlying portlet from the given portal. - - @param args a list-ified array of args defined in remove_applet_from_community } { - ns_log notice "** Error in [get_pretty_name]: 'remove_portlet' not implemented!" - ad_return_complaint 1 "Please notifiy the administrator of this error: - ** Error in [get_pretty_name]: 'remove_portlet' not implemented!" + # this is simple since there's no admin portlet or portal type stuff to do + dotlrn_members_portlet::remove_self_from_page -portal_id $portal_id } - + ad_proc -public clone { old_community_id new_community_id } { - Clone this applet's content from the old community to the new one + Clone this applet's content from the old community to the new one. + Since there's no data, just add the applet to the clone } { - ns_log notice "** Error in [get_pretty_name] 'clone' not implemented!" - ad_return_complaint 1 "Please notifiy the administrator of this error: - ** Error in [get_pretty_name]: 'clone' not implemented!" + dotlrn_members::add_applet_to_community $new_community_id } + # + # misc procs + # + + ad_proc -public get_community_default_page {} { + Returns the user default page to add the portlet to. + FIXME Should be a ad_param. + } { + return "People" + } + + ad_proc -public get_subcomm_default_page {} { + FIXME Should be a ad_param. + } { + return "Subgroup Info" + } + }