Index: openacs-4/packages/dotlrn/tcl/dotlrn-main-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/dotlrn-main-portlet-procs.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/packages/dotlrn/tcl/dotlrn-main-portlet-procs.tcl 29 Mar 2002 19:14:45 -0000 1.20 +++ openacs-4/packages/dotlrn/tcl/dotlrn-main-portlet-procs.tcl 9 May 2002 23:59:52 -0000 1.21 @@ -14,24 +14,21 @@ # details. # -# dotlrn/tcl/dotlrn-main-portlet-procs.tcl - ad_library { - Procedures to supports dotlrn main portlet + The "dotlrn main" portlet shows a list of the classes and communities that + the user is a member of on the user's workspace portal. Not to be confused + with the "dotlrn" portlet that shows the subgroups of the current community + and is only on community portals. - Copyright Openforce, Inc. - Licensed under GNU GPL v2 - - @creation-date November 4 2001 - @author ben@openforce.net + @author ben@openforce.net, arjun@openforce.net @version $Id$ } namespace eval dotlrn_main_portlet { - ad_proc -private my_name { + ad_proc -private get_my_name { } { return "dotlrn_main_portlet" } @@ -47,68 +44,37 @@ } ad_proc -public add_self_to_page { - {-page_id ""} portal_id - instance_id } { - Adds a dotLRN PE to the given page with the instance key being - opaque data in the portal configuration. - - @return element_id The new element's id - @param portal_id The page to add self to - @param instance_id The bboard instace to show - @author arjun@openforce.net - @creation-date Nov 2001 + @return new element_id } { + # we use "portal::add_element" here since there is no + # configuration necessary for this portlet (no params) + return [portal::add_element \ + -force_region [ad_parameter "dotlrn_main_portlet_region" dotlrn] \ + -pretty_name [get_pretty_name] \ + -portal_id $portal_id \ + -portlet_name [get_my_name] + ] + } - # Tell portal to add this element to the page - set element_id [portal::add_element -force_region 2 -page_id $page_id -pretty_name [get_pretty_name] $portal_id [my_name]] - - return $element_id + ad_proc -public remove_self_from_page { + portal_id + } { + Removes the dotlrn main PE from the portal + } { + portal::remove_element \ + -portal_id $portal_id \ + -datasource_name [get_my_name] } ad_proc -public show { cf } { - Display the PE - - @return HTML string - @param cf A config array - @author ben@openforce.net - @creation-date Nov 2001 } { - # no return call required with the helper proc portal::show_proc_helper \ -template_src "dotlrn-main-portlet" \ -package_key "dotlrn" \ -config_list $cf } - - ad_proc -public edit { - cf - } { - return "" - } - - ad_proc -public remove_self_from_page { - portal_id - instance_id - } { - Removes a bboard PE from the given page - - @param portal_id The page to remove self from - @param instance_id - @author ben@openforce.net - @creation-date Nov 2001 - } { - # get the element IDs (could be more than one!) - set element_ids [portal::get_element_ids_by_ds $portal_id [my_name]] - - # remove all elements - db_transaction { - foreach element_id $element_ids { - portal::remove_element $element_id - } - } - } }