Index: openacs-4/packages/dotlrn-portlet/tcl/dotlrn-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-portlet/tcl/dotlrn-portlet-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-portlet/tcl/dotlrn-portlet-procs.tcl 8 Oct 2001 23:44:00 -0000 1.2 +++ openacs-4/packages/dotlrn-portlet/tcl/dotlrn-portlet-procs.tcl 9 Oct 2001 05:04:25 -0000 1.3 @@ -85,26 +85,15 @@ @author arjun@openforce.net @creation-date Sept 2001 } { - # Find out the element_id that corresponds to this - # community_id/portal_id pair - if { [db0or1row get_element_id " - select pem.element_id as element_id - from portal_element_parameters pep, portal_element_map pem - where pem.portal_id = $portal_id and - pep.element_id = pem.element_id and - pep.key = 'community_id' and - pep.value = $community_id"] } { - - # delete the params - # delete the element from the map + # get the element IDs (could be more than one!) + set element_ids [portal::get_element_ids_by_ds $portal_id [my_name]] - } else { - ad_return_complaint 1 "dotlrn_portlet::remove_self_from_page: Invalid portal_id and/or community_id given." - ad_script_abort + # remove all elements + db_transaction { + foreach element_id $element_ids { + portal::remove_element $element_id + } } - - # this call removes the PEs params too - set element_id [portal::remove_element {$portal_id $element_id}] } } Index: openacs-4/packages/faq-portlet/tcl/faq-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq-portlet/tcl/faq-portlet-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/faq-portlet/tcl/faq-portlet-procs.tcl 9 Oct 2001 04:04:39 -0000 1.3 +++ openacs-4/packages/faq-portlet/tcl/faq-portlet-procs.tcl 9 Oct 2001 05:04:19 -0000 1.4 @@ -110,34 +110,17 @@ @author arjun@openforce.net @creation-date Sept 2001 } { - # Find out the element_id that corresponds to this package_id + # get the element IDs (could be more than one!) + set element_ids [portal::get_element_ids_by_ds $portal_id [my_name]] - # XXX - fixme - the PE needs to find out it's own ID based on - # the datasource_id. Need a call in NPP to do this - - if { [db0or1row get_element_id " - select pem.element_id as element_id - from portal_element_parameters pep, - portal_element_map pem - where pem.portal_id = $portal_id and - pep.element_id = pem.element_id and - pep.key = 'package_id' and - pep.value = $package_id - "] } { - - # delete the params - # delete the element from the map - ns_log Notice "AKS58 faq-portlet-procs delete called" + # remove all elements + db_transaction { + foreach element_id $element_ids { + portal::remove_element $element_id + } + } + } +} - } else { - ad_return_complaint 1 "faq_portlet::remove_self_from_page: Invalid portal_id and/or package_id given." - ad_script_abort - } - - # this call removes the PEs params too - set element_id [portal::remove_element {$portal_id $element_id}] - } - } - Index: openacs-4/packages/fs-portlet/tcl/fs-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/fs-portlet/tcl/fs-portlet-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/fs-portlet/tcl/fs-portlet-procs.tcl 9 Oct 2001 00:55:50 -0000 1.3 +++ openacs-4/packages/fs-portlet/tcl/fs-portlet-procs.tcl 9 Oct 2001 05:04:25 -0000 1.4 @@ -149,33 +149,17 @@ @author arjun@openforce.net @creation-date Sept 2001 } { - # Find out the element_id that corresponds to this community_id - # and folder_id - - if { [db0or1row get_element_id " - select pem.element_id as element_id - from portal_element_parameters pep, portal_element_map pem - where pem.portal_id = $portal_id and - pep.element_id = pem.element_id and - pep.key = 'community_id' and - pep.value = $community_id and - pep.key = 'folder_id' and - pep.value = $folder_id - "] } { - - # delete the params - # delete the element from the map - ns_log Notice "AKS54 fs-portlet-procs delete called" + # get the element IDs (could be more than one!) + set element_ids [portal::get_element_ids_by_ds $portal_id [my_name]] - } else { - ad_return_complaint 1 "fs_portlet::remove_self_from_page: Invalid portal_id and/or folder_id and/or community_id given." - ad_script_abort - } + # remove all elements + db_transaction { + foreach element_id $element_ids { + portal::remove_element $element_id + } + } + } +} - # this call removes the PEs params too - set element_id [portal::remove_element {$portal_id $element_id}] - } - } -