Index: openacs-4/packages/dotlrn/tcl/community-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.tcl,v diff -u -r1.116 -r1.117 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 14 May 2002 19:27:54 -0000 1.116 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 14 May 2002 21:42:15 -0000 1.117 @@ -228,8 +228,9 @@ -community_key $community_key \ -parent_community_id $parent_community_id]} { ad_return_complaint \ - 1 "The name $pretty_name is already in use. \n - Please select a different name." + 1 "The name $pretty_name is already in use either by + an active or archived group. \n Please select a different name." + ad_script_abort } # Add core vars @@ -1012,7 +1013,7 @@ community by checking that it's not the same as an existing (possible) sibling's name. } { - if {[db_0or1row collision_check {}]} { + if {[db_string collision_check {}] > 0} { # got a collision return 0 } else { @@ -1418,19 +1419,14 @@ } { db_transaction { - # do RemovePortlet callback, we send comm_id, and user_id + # do RemoveUserFromCommunity callback, which + # calls the RemovePortlet proc with the right params foreach user [list_users $community_id] { set user_id [ns_set get $user user_id] - set portal_id [dotlrn::get_workspace_portal_id $user_id] - set list_args [list $portal_id [list \ - "user_id" $user_id \ - "community_id" $community_id] - ] - applets_dispatch \ -community_id $community_id \ - -op RemovePortlet \ - -list_args $list_args + -op RemoveUserFromCommunity \ + -list_args [list $community_id $user_id] } # revoke privs Index: openacs-4/packages/dotlrn/tcl/community-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.xql,v diff -u -r1.57 -r1.58 --- openacs-4/packages/dotlrn/tcl/community-procs.xql 14 May 2002 19:27:54 -0000 1.57 +++ openacs-4/packages/dotlrn/tcl/community-procs.xql 14 May 2002 21:42:15 -0000 1.58 @@ -50,10 +50,10 @@ - select 1 - from dotlrn_communities + select count(*) + from dotlrn_communities_all where :parent_community_id in (select dc.parent_community_id - from dotlrn_communities dc + from dotlrn_communities_all dc where dc.community_key = :community_key) @@ -392,13 +392,13 @@ - update dotlrn_communities set archive_p = 't' where community_id = :community_id + update dotlrn_communities set archived_p = 't' where community_id = :community_id - update dotlrn_communities set archive_p = 'f' where community_id = :community_id + update dotlrn_communities set archived_p = 'f' where community_id = :community_id 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 -r1.37 -r1.38 --- openacs-4/packages/dotlrn-bboard/tcl/dotlrn-bboard-procs.tcl 13 May 2002 06:00:06 -0000 1.37 +++ openacs-4/packages/dotlrn-bboard/tcl/dotlrn-bboard-procs.tcl 14 May 2002 21:42:15 -0000 1.38 @@ -164,8 +164,11 @@ set admin_portal_id [dotlrn_community::get_admin_portal_id \ -community_id $community_id ] + + bboard_admin_portlet::remove_self_from_page -portal_id $admin_portal_id + # aks fixme - should use remove_portlet below # remove the portlet bboard_portlet::remove_self_from_page $portal_id $package_id @@ -219,15 +222,17 @@ } { Remove a user from a community } { - set package_id [dotlrn_community::get_applet_package_id \ - $community_id \ - [applet_key] - ] + set package_id [dotlrn_community::get_applet_package_id $community_id [applet_key]] set portal_id [dotlrn::get_workspace_portal_id $user_id] - bboard_portlet::remove_self_from_page $portal_id $package_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 { args } { @@ -240,16 +245,31 @@ ** Error in [get_pretty_name]: 'add_portlet' not implemented!" } + 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!" + @param portal_id + @param args A list of key-value pairs (possibly user_id, community_id, and more) + } { + set user_id [ns_set get $args "user_id"] + set community_id [ns_set get $args "community_id"] + + if {![empty_string_p $user_id]} { + # the portal_id is a user's portal + set bboard_package_id [ns_set get $args "bboard_package_id"] + } elseif {![empty_string_p $community_id]} { + # the portal_id is a community portal + ad_return_complaint 1 "[applet_key] aks1 unimplimented" + } else { + # the portal_id is a portal template + ad_return_complaint 1 "[applet_key] aks2 unimplimented" + } + + bboard_portlet::remove_self_from_page $portal_id $bboard_package_id } ad_proc -public clone { Index: openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl,v diff -u -r1.52 -r1.53 --- openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl 13 May 2002 06:00:06 -0000 1.52 +++ openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl 14 May 2002 21:42:16 -0000 1.53 @@ -202,7 +202,8 @@ -object_id $group_calendar_id \ -privilege "read" - return $group_calendar_id + # this should return the package_id + return $package_id } ad_proc -public remove_applet_from_community { @@ -317,13 +318,16 @@ } { Remove a user entirely } { - # FIXME remove the mapping?? - set workspace_portal_id [dotlrn::get_workspace_portal_id $user_id] + # FIXME - not tested + set portal_id [dotlrn::get_workspace_portal_id $user_id] set calendar_id [calendar_have_private_p -return_id 1 $user_id] - calendar_portlet::remove_self_from_page $workspace_portal_id $calendar_id + set args [ns_set create args] + ns_set put $args user_id $user_id + ns_set put $args calendar_id $calendar_id + set list_args [list $portal_id $args] - calendar_full_portlet::remove_self_from_page $workspace_portal_id $calendar_id + remove_portlet $portal_id $args } ad_proc -public add_user_to_community { @@ -350,11 +354,16 @@ } { Remove a user from a community } { - set g_cal_id [get_group_calendar_id -community_id $community_id] - set workspace_portal_id [dotlrn::get_workspace_portal_id $user_id] + set portal_id [dotlrn::get_workspace_portal_id $user_id] + set calendar_id [get_group_calendar_id -community_id $community_id] - calendar_portlet::remove_self_from_page $workspace_portal_id $g_cal_id - calendar_full_portlet::remove_self_from_page $workspace_portal_id $g_cal_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 calendar_id $calendar_id + set list_args [list $portal_id $args] + + remove_portlet $portal_id $args } ad_proc -public add_portlet { @@ -370,15 +379,30 @@ } 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!" + @param portal_id + @param args A list of key-value pairs (possibly user_id, community_id, and more) + } { + set user_id [ns_set get $args "user_id"] + set community_id [ns_set get $args "community_id"] + + if {![empty_string_p $user_id]} { + # the portal_id is a user's portal + set calendar_id [ns_set get $args "calendar_id"] + } elseif {![empty_string_p $community_id]} { + # the portal_id is a community portal + ad_return_complaint 1 "dotlrn_calendar aks1 unimplimented" + } else { + # the portal_id is a portal template + ad_return_complaint 1 "dotlrn_calendar aks2 unimplimented" + } + + calendar_portlet::remove_self_from_page $portal_id $calendar_id + calendar_full_portlet::remove_self_from_page $portal_id $calendar_id } ad_proc -public clone { Index: openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-dotlrn-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-dotlrn-procs.tcl,v diff -u -r1.25 -r1.26 --- openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-dotlrn-procs.tcl 13 May 2002 06:00:06 -0000 1.25 +++ openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-dotlrn-procs.tcl 14 May 2002 21:42:16 -0000 1.26 @@ -81,7 +81,9 @@ -portal_id $admin_portal_id \ -community_id $community_id - return $community_id + # this is not supposed to return anything, since + # any return value here is interpreted as a valid package_id! + return } ad_proc -public remove_applet_from_community { @@ -129,7 +131,8 @@ community_id user_id } { - Remove a user from a community + Remove a user from a community. Since this applet is not shown + on a user's portal, no action is required here. } { } 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.10 -r1.11 --- openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-members-procs.tcl 13 May 2002 06:00:06 -0000 1.10 +++ openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-members-procs.tcl 14 May 2002 21:42:16 -0000 1.11 @@ -93,7 +93,9 @@ -page_name $page_name \ -community_id $community_id - return $community_id + # this is not supposed to return anything, since + # any return value here is interpreted as a valid package_id! + return } ad_proc -public remove_applet_from_community { @@ -138,10 +140,28 @@ community_id user_id } { - Remove a user from a community + 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 { args } { Index: openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-members-staff-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-members-staff-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-members-staff-procs.tcl 13 May 2002 06:00:06 -0000 1.7 +++ openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-members-staff-procs.tcl 14 May 2002 21:42:16 -0000 1.8 @@ -61,6 +61,10 @@ dotlrn_members_staff_portlet::add_self_to_page \ -portal_id $portal_id \ -community_id $community_id + + # this is not supposed to return anything, since + # any return value here is interpreted as a valid package_id! + return } ad_proc -public remove_applet_from_community { Index: openacs-4/packages/dotlrn-faq/tcl/dotlrn-faq-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-faq/tcl/dotlrn-faq-procs.tcl,v diff -u -r1.31 -r1.32 --- openacs-4/packages/dotlrn-faq/tcl/dotlrn-faq-procs.tcl 13 May 2002 06:00:06 -0000 1.31 +++ openacs-4/packages/dotlrn-faq/tcl/dotlrn-faq-procs.tcl 14 May 2002 21:42:16 -0000 1.32 @@ -154,7 +154,13 @@ set package_id [dotlrn_community::get_applet_package_id $community_id [applet_key]] set portal_id [dotlrn::get_workspace_portal_id $user_id] - faq_portlet::remove_self_from_page $portal_id $package_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 { @@ -170,15 +176,29 @@ } 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!" + @param portal_id + @param args A list of key-value pairs (possibly user_id, community_id, and more) + } { + set user_id [ns_set get $args "user_id"] + set community_id [ns_set get $args "community_id"] + + if {![empty_string_p $user_id]} { + # the portal_id is a user's portal + set faq_pacakge_id [ns_set get $args "faq_pacakge_id"] + } elseif {![empty_string_p $community_id]} { + # the portal_id is a community portal + ad_return_complaint 1 "[applet_key] aks1 unimplimented" + } else { + # the portal_id is a portal template + ad_return_complaint 1 "[applet_key] aks2 unimplimented" + } + + faq_portlet::remove_self_from_page $portal_id $faq_pacakge_id } ad_proc -public clone { 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.61 -r1.62 --- openacs-4/packages/dotlrn-fs/tcl/dotlrn-fs-procs.tcl 13 May 2002 21:31:21 -0000 1.61 +++ openacs-4/packages/dotlrn-fs/tcl/dotlrn-fs-procs.tcl 14 May 2002 21:42:16 -0000 1.62 @@ -408,7 +408,14 @@ set portal_id [dotlrn::get_workspace_portal_id $user_id] set folder_id [fs::get_root_folder -package_id $package_id] - fs_portlet::remove_self_from_page $portal_id $package_id $folder_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 + ns_set put $args folder_id $folder_id + set list_args [list $portal_id $args] + + remove_portlet $portal_id $args } ad_proc -public add_portlet { @@ -424,14 +431,30 @@ } ad_proc -public remove_portlet { + portal_id args } { - A helper proc to remove the underlying portlet from the given portal. + A helper proc to remove the underlying portlet from the given portal. + + @param portal_id + @param args A list of key-value pairs (possibly user_id, community_id, and more) + } { + set user_id [ns_set get $args "user_id"] + set community_id [ns_set get $args "community_id"] - @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!" + if {![empty_string_p $user_id]} { + # the portal_id is a user's portal + set fs_package_id [ns_set get $args "fs_package_id"] + set folder_id [ns_set get $args "folder_id"] + } elseif {![empty_string_p $community_id]} { + # the portal_id is a community portal + ad_return_complaint 1 "[applet_key] aks1 unimplimented" + } else { + # the portal_id is a portal template + ad_return_complaint 1 "[applet_key] aks2 unimplimented" + } + + fs_portlet::remove_self_from_page $portal_id $fs_package_id $folder_id } ad_proc -public clone { Index: openacs-4/packages/dotlrn-news/tcl/dotlrn-news-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-news/tcl/dotlrn-news-procs.tcl,v diff -u -r1.21 -r1.22 --- openacs-4/packages/dotlrn-news/tcl/dotlrn-news-procs.tcl 13 May 2002 06:00:06 -0000 1.21 +++ openacs-4/packages/dotlrn-news/tcl/dotlrn-news-procs.tcl 14 May 2002 21:42:16 -0000 1.22 @@ -67,6 +67,13 @@ dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key] } + ad_proc -public remove_applet { + } { + One time destroy. + } { + dotlrn_applet::remove_applet_from_dotlrn -applet_key [applet_key] + } + ad_proc -public add_applet_to_community { community_id } { @@ -157,41 +164,64 @@ } 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 } { set package_id [dotlrn_community::get_applet_package_id $community_id [applet_key]] - set portal_id [dotlrn::get_workspace_portal_id $user_id] + set portal_id [dotlrn::get_workspace_portal_id $user_id] - news_portlet::remove_self_from_page \ - -portal_id $portal_id \ - -package_id $package_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 + @param portal_id + @param args A list of key-value pairs (possibly user_id, community_id, and more) } { 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!" } + 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!" + @param portal_id + @param args A list of key-value pairs (possibly user_id, community_id, and more) + } { + set user_id [ns_set get $args "user_id"] + set community_id [ns_set get $args "community_id"] + + if {![empty_string_p $user_id]} { + # the portal_id is a user's portal + set news_package_id [ns_set get $args "news_package_id"] + } elseif {![empty_string_p $community_id]} { + # the portal_id is a community portal + ad_return_complaint 1 "[applet_key] aks1 unimplimented" + } else { + # the portal_id is a portal template + ad_return_complaint 1 "[applet_key] aks2 unimplimented" + } + + news_portlet::remove_self_from_page \ + -portal_id $portal_id \ + -package_id $news_package_id } ad_proc -public clone { Index: openacs-4/packages/dotlrn-static/tcl/dotlrn-static-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-static/tcl/dotlrn-static-procs.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/dotlrn-static/tcl/dotlrn-static-procs.tcl 13 May 2002 06:00:06 -0000 1.18 +++ openacs-4/packages/dotlrn-static/tcl/dotlrn-static-procs.tcl 14 May 2002 21:42:16 -0000 1.19 @@ -182,7 +182,8 @@ community_id user_id } { - Remove a user from a community + Remove a user from a community. Since this applet is not shown + on a user's portal, no action is required here. } { }