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.35 -r1.36 --- openacs-4/packages/dotlrn-news/tcl/dotlrn-news-procs.tcl 27 Mar 2018 14:22:30 -0000 1.35 +++ openacs-4/packages/dotlrn-news/tcl/dotlrn-news-procs.tcl 3 Sep 2024 15:37:38 -0000 1.36 @@ -15,16 +15,16 @@ # ad_library { - + Procs to set up the dotLRN news applet - + @author ben@openforce.net,arjun@openforce.net @cvs-id $Id$ } namespace eval dotlrn_news { - + ad_proc -public applet_key { } { What's my applet key? @@ -36,91 +36,91 @@ } { What package do I deal with? } { - return news + return news } ad_proc -public my_package_key { } { What package do I deal with? } { - return "dotlrn-news" + return "dotlrn-news" } ad_proc -public get_pretty_name { } { - returns the pretty name + returns the pretty name } { - return "[_ dotlrn-news.pretty_name]" + return "[_ dotlrn-news.pretty_name]" } ad_proc -public add_applet { } { - One time init - must be repeatable! + One time init - must be repeatable! } { dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key] -package_key [my_package_key] } ad_proc -public remove_applet { } { - One time destroy. + One time destroy. } { dotlrn_applet::remove_applet_from_dotlrn -applet_key [applet_key] } ad_proc -public add_applet_to_community { - community_id + community_id } { - Add the news applet to a specific dotlrn community + Add the news applet to a specific dotlrn community } { - set portal_id [dotlrn_community::get_portal_id -community_id $community_id] + set portal_id [dotlrn_community::get_portal_id -community_id $community_id] - # create the news package instance (all in one, I've mounted it) - set package_id [dotlrn::instantiate_and_mount $community_id [package_key]] + # create the news package instance (all in one, I've mounted it) + set package_id [dotlrn::instantiate_and_mount $community_id [package_key]] - # set up the admin portal + # set up the admin portal set admin_portal_id [dotlrn_community::get_admin_portal_id \ -community_id $community_id ] - news_admin_portlet::add_self_to_page \ + news_admin_portlet::add_self_to_page \ -portal_id $admin_portal_id \ -package_id $package_id - + set args [ns_set create] ns_set put $args package_id $package_id add_portlet_helper $portal_id $args - return $package_id + return $package_id } ad_proc -public remove_applet_from_community { - community_id + community_id } { - remove the applet from the community + remove the applet from the community } { ad_return_complaint 1 "[applet_key] remove_applet_from_community not implemented!" } - ad_proc -public add_user { - user_id + ad_proc -private add_user { + user_id } { - one time user-specifuc init + one time user-specific init } { # noop } - ad_proc -public remove_user { + ad_proc -private remove_user { user_id } { } { # noop } ad_proc -public add_user_to_community { - community_id - user_id + community_id + user_id } { - Add a user to a specific dotlrn community + Add a user to a specific dotlrn community } { set package_id [dotlrn_community::get_applet_package_id -community_id $community_id -applet_key [applet_key]] set portal_id [dotlrn::get_portal_id -user_id $user_id] @@ -131,12 +131,12 @@ ns_set put $args param_action append add_portlet_helper $portal_id $args - # add notification when a new user is added to the community + # add notification when a new user is added to the community set type_id [notification::type::get_type_id -short_name one_news_item_notif] - set interval_id [notification::get_interval_id -name instant] - set delivery_method_id [notification::get_delivery_method_id -name email] - set community_package_id [dotlrn_community::get_package_id $community_id] - set news_package_id [db_string getnewspackageid { + set interval_id [notification::interval::get_id_from_name -name instant] + set delivery_method_id [notification::delivery::get_id -short_name email] + set community_package_id [dotlrn_community::get_package_id $community_id] + set news_package_id [db_string getnewspackageid { select package_id from apm_packages where package_key ='news' and package_id in (select object_id from acs_objects where context_id = :community_package_id) @@ -165,8 +165,8 @@ remove_portlet $portal_id $args - set community_package_id [dotlrn_community::get_package_id $community_id] - set news_package_id [db_string getnewspackageid { + set community_package_id [dotlrn_community::get_package_id $community_id] + set news_package_id [db_string getnewspackageid { select package_id from apm_packages where package_key ='news' and package_id in (select object_id from acs_objects where context_id = :community_package_id) @@ -179,12 +179,12 @@ -object_id $news_package_id \ ] } - + ad_proc -public add_portlet { portal_id } { - A helper proc to add the underlying portlet to the given portal. - + A helper proc to add the underlying portlet to the given portal. + @param portal_id } { # simple, no type specific stuff, just set some dummy values @@ -214,11 +214,11 @@ 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) - } { + } { news_portlet::remove_self_from_page \ -portal_id $portal_id \ -package_id [ns_set get $args package_id] @@ -241,15 +241,15 @@ return $new_package_id } - ad_proc -public change_event_handler { + ad_proc -private change_event_handler { community_id event old_value new_value - } { - listens for the following events: - } { - } + } { + listens for the following events: + } { + } }