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.28 -r1.29 --- openacs-4/packages/dotlrn-portlet/tcl/dotlrn-portlet-procs.tcl 16 Apr 2002 13:58:28 -0000 1.28 +++ openacs-4/packages/dotlrn-portlet/tcl/dotlrn-portlet-procs.tcl 9 May 2002 23:59:52 -0000 1.29 @@ -14,23 +14,22 @@ # details. # -# /packages/dotlrn-portlets/tcl/dotlrn-portlets-procs.tcl ad_library { -Procedures to supports dotlrn portlets + Procedures to supports the "dotlrn" portlet. The "dotlrn" portlet shows + the subcommunities of the community's portal where it's located. This portal + is not to be confused with the "dotlrn-main" portal, that goes on user's + workspace portals and shows the communities that they are members of. -Copyright Openforce, Inc. -Licensed under GNU GPL v2 + @creation-date September 30 2001 + @author arjun@openforce.net + @cvs-id $Id$ -@creation-date September 30 2001 -@author arjun@openforce.net -@cvs-id $Id$ - } namespace eval dotlrn_portlet { - ad_proc -private my_name { + ad_proc -private get_my_name { } { return "dotlrn_portlet" } @@ -40,116 +39,57 @@ return "dotlrn-portlet" } - ad_proc -public get_pretty_name { } { - return [ad_parameter -package_id [dotlrn::get_package_id] subcommunities_pretty_plural] - + # get the param from the dotlrn package + return [ad_parameter subcommunities_pretty_plural dotlrn] } ad_proc -public link { } { return "" } - ad_proc -public add_self_to_page { portal_id community_id } { - Adds a dotlrn PE to the given page with the community_id as - opaque data in the portal configuration. + Adds a dotlrn PE to the given communities's portal + @param portal_id + @param community_id @return element_id The new element's id - @param portal_id The page to add self to - @param community_id The dotlrn community to show info about - @author arjun@openforce.net - @creation-date Sept 2001 } { - # Tell portal to add this element to the page set element_id [portal::add_element \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ -pretty_name [get_pretty_name] \ - -force_region 2 \ - $portal_id \ - [my_name]] - - # The default param must be configured - set key "community_id" - # set value [portal::get_element_param $element_id $key] + -force_region [ad_parameter "dotlrn_portlet_force_region" [my_package_key]] + ] - portal::set_element_param $element_id $key $community_id + portal::set_element_param $element_id "community_id" $community_id return $element_id } ad_proc -public show { cf } { - Call the template to display - - @param cf A config array - @author arjun@openforce.net } { portal::show_proc_helper \ -package_key [my_package_key] \ -config_list $cf - } ad_proc -public remove_self_from_page { portal_id - community_id } { - Removes a dotlrn PE from the given page - - @param portal_id The page to remove self from - @param community_id - @author arjun@openforce.net - @creation-date Sept 2001 + Removes the dotlrn PE from the portal. } { - # 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 - } - } + # since there can be only one dotlrn pe on the portal use: + portal::remove_element \ + -portal_id $portal_id \ + -portlet_name [get_my_name] } - ad_proc -public edit { - nothing here, move along - } { - return "" - } - - ad_proc -public make_self_available { - portal_id - } { - Wrapper for the portal:: proc - - @param portal_id - @author arjun@openforce.net - @creation-date Nov 2001 - } { - portal::make_datasource_available \ - $portal_id [portal::get_datasource_id [my_name]] - } - - ad_proc -public make_self_unavailable { - portal_id - } { - Wrapper for the portal:: proc - - @param portal_id - @author arjun@openforce.net - @creation-date Nov 2001 - } { - portal::make_datasource_unavailable \ - $portal_id [portal::get_datasource_id [my_name]] - } } - - -