Index: openacs-4/packages/dotlrn/tcl/applets-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/applets-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/tcl/applets-procs.tcl 24 Jan 2002 22:32:30 -0000 1.3 +++ openacs-4/packages/dotlrn/tcl/applets-procs.tcl 5 Mar 2002 07:18:23 -0000 1.4 @@ -59,4 +59,40 @@ } { return [db_string select_applet_exists_p {}] } + + ad_proc -public add_applet_to_dotlrn { + {-applet_key:required} + {-activate_p "t"} + } { + dotlrn-init.tcl calls AddApplet on all applets using acs_sc directly. + The add_applet proc in the applet (e.g. dotlrn-calendar) calls this + proc to tell dotlrn to register and/or activate itself. This _must_ + be able to be run multiple times! + } { + + if {![empty_string_p [get_applet_id_from_key -applet_key $applet_key]]} { + return + } + + if {[string equal $activate_p "t"] == 1} { + set status "active" + } else { + set status "inactive" + } + + db_transaction { + set applet_id [db_nextval acs_object_id_seq] + db_dml insert {} + } + } + + ad_proc -public get_applet_id_from_key { + {-applet_key:required} + } { + get the id of the dotlrn applet from the applet key or the null + string if the key dosent exist + } { + return [db_string select {} -default ""] + } + }