Index: openacs-4/packages/dotlrn-lorsm/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-lorsm/tcl/apm-callback-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-lorsm/tcl/apm-callback-procs.tcl 26 Sep 2005 22:06:38 -0000 1.2 +++ openacs-4/packages/dotlrn-lorsm/tcl/apm-callback-procs.tcl 14 Nov 2008 14:46:38 -0000 1.3 @@ -1,7 +1,7 @@ ad_library { Procedures for registering implementations for the - dotlrn lorsm package. - + dotlrn lorsm package. + @creation-date 2005-09-25 @author eperez@it.uc3m.es @cvs-id $Id$ @@ -15,36 +15,38 @@ register_portal_datasource_impl } + ad_proc -public dotlrn_lorsm::uninstall {} { dotLRN LORSM package uninstall proc } { unregister_portal_datasource_impl } + ad_proc -public dotlrn_lorsm::register_portal_datasource_impl {} { Register the service contract implementation for the dotlrn_applet service contract } { set spec { name "dotlrn_lorsm" - contract_name "dotlrn_applet" - owner "dotlrn_lorsm" + contract_name "dotlrn_applet" + owner "dotlrn_lorsm" aliases { - GetPrettyName dotlrn_lorsm::get_pretty_name - AddApplet dotlrn_lorsm::add_applet - RemoveApplet dotlrn_lorsm::remove_applet - AddAppletToCommunity dotlrn_lorsm::add_applet_to_community - RemoveAppletFromCommunity dotlrn_lorsm::remove_applet_from_community - AddUser dotlrn_lorsm::add_user - RemoveUser dotlrn_lorsm::remove_user - AddUserToCommunity dotlrn_lorsm::add_user_to_community - RemoveUserFromCommunity dotlrn_lorsm::remove_user_from_community - AddPortlet dotlrn_lorsm::add_portlet - RemovePortlet dotlrn_lorsm::remove_portlet - Clone dotlrn_lorsm::clone - ChangeEventHandler dotlrn_lorsm::change_event_handler + GetPrettyName dotlrn_lorsm::get_pretty_name + AddApplet dotlrn_lorsm::add_applet + RemoveApplet dotlrn_lorsm::remove_applet + AddAppletToCommunity dotlrn_lorsm::add_applet_to_community + RemoveAppletFromCommunity dotlrn_lorsm::remove_applet_from_community + AddUser dotlrn_lorsm::add_user + RemoveUser dotlrn_lorsm::remove_user + AddUserToCommunity dotlrn_lorsm::add_user_to_community + RemoveUserFromCommunity dotlrn_lorsm::remove_user_from_community + AddPortlet dotlrn_lorsm::add_portlet + RemovePortlet dotlrn_lorsm::remove_portlet + Clone dotlrn_lorsm::clone + ChangeEventHandler dotlrn_lorsm::change_event_handler } } - + acs_sc::impl::new_from_spec -spec $spec } @@ -55,4 +57,3 @@ -contract_name "dotlrn_applet" \ -impl_name "dotlrn_lorsm" } - Index: openacs-4/packages/dotlrn-lorsm/tcl/dotlrn-lorsm-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-lorsm/tcl/dotlrn-lorsm-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn-lorsm/tcl/dotlrn-lorsm-procs.tcl 16 Jul 2007 10:28:07 -0000 1.5 +++ openacs-4/packages/dotlrn-lorsm/tcl/dotlrn-lorsm-procs.tcl 14 Nov 2008 14:46:38 -0000 1.6 @@ -13,51 +13,58 @@ # ad_library { - + Procs to set up the dotLRN LORSm applet - + @author Ernie Ghiglione (ErnieG@mm.st) @version $Id$ } namespace eval dotlrn_lorsm { - + ad_proc -public applet_key { } { What's my applet key? } { return "dotlrn_lorsm" } + ad_proc -public package_key { } { What package do I deal with? } { - return "lorsm" + return "lorsm" } + ad_proc -public my_package_key { } { What's my package key? } { - return "dotlrn-lorsm" + return "dotlrn-lorsm" } + ad_proc -public get_pretty_name { } { - returns the pretty name + returns the pretty name } { - return "#lorsm.LORS_Management#" + return "#lorsm.LORS_Management#" } + ad_proc -public add_applet { } { - Add the lorsm applet to dotlrn. One time init - must be repeatable! + Add the lorsm applet to dotlrn. One time init - must be repeatable! } { - dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key] -package_key [my_package_key] + dotlrn_applet::add_applet_to_dotlrn \ + -applet_key [applet_key] \ + -package_key [my_package_key] } + ad_proc -public remove_applet { community_id package_id @@ -67,64 +74,72 @@ ad_return_complaint 1 "[applet_key] remove_applet not implemented!" } + ad_proc -public add_applet_to_community { - community_id + community_id } { - Add the lorsm applet to a specifc dotlrn community + Add the lorsm applet to a specifc 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 lorsm package instance (all in one, I've mounted it) - set package_id [dotlrn::instantiate_and_mount $community_id [package_key]] + # create the lorsm 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 - ] + -community_id $community_id] - lorsm_admin_portlet::add_self_to_page \ + lorsm_admin_portlet::add_self_to_page \ -portal_id $admin_portal_id \ -package_id $package_id # add the portlet to the comm's portal using - # add_portlet_helper - set args [ns_set create] + # add_portlet_helper + 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 + user_id } { - one time user-specifuc init + one time user-specifuc init } { # noop } + ad_proc -public 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 specifc dotlrn community + Add a user to a specifc dotlrn community } { - set package_id [dotlrn_community::get_applet_package_id -community_id $community_id -applet_key [applet_key]] + 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] # use "append" here since we want to aggregate @@ -134,26 +149,30 @@ add_portlet_helper $portal_id $args } + ad_proc -public remove_user_from_community { community_id user_id } { Remove a user from a community } { - set package_id [dotlrn_community::get_applet_package_id -community_id $community_id -applet_key [applet_key]] + 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] set args [ns_set create] ns_set put $args package_id $package_id - remove_portlet $portal_id $args } - + + 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 @@ -164,6 +183,7 @@ add_portlet_helper $portal_id $args } + ad_proc -public add_portlet_helper { portal_id args @@ -179,20 +199,22 @@ -param_action [ns_set get $args param_action] } + ad_proc -public remove_portlet { 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) - } { + } { lorsm_portlet::remove_self_from_page \ -portal_id $portal_id \ -package_id [ns_set get $args package_id] } + ad_proc -public clone { old_community_id new_community_id @@ -202,46 +224,40 @@ ns_log notice "Cloning: [applet_key]" set new_package_id [add_applet_to_community $new_community_id] set old_package_id [dotlrn_community::get_applet_package_id \ - -community_id $old_community_id \ - -applet_key [applet_key] - ] + -community_id $old_community_id \ + -applet_key [applet_key]] - set clone_courses [db_list_of_lists course_clone { - SELECT man_id, lorsm_instance_id, community_id, class_key, isenabled, istrackable - FROM ims_cp_manifest_class - WHERE community_id = :old_community_id - }] + set clone_courses [db_list_of_lists course_clone { SELECT man_id, + lorsm_instance_id, community_id, class_key, isenabled, istrackable + FROM ims_cp_manifest_class + WHERE community_id = :old_community_id }] - if {![empty_string_p $clone_courses]} { + if {![empty_string_p $clone_courses]} { + foreach course $clone_courses { + set man_id [lindex $course 0] + set isenabled [lindex $course 4] + set istrackable [lindex $course 5] + set class_key [dotlrn_community::get_community_type_from_community_id $new_community_id] - foreach course $clone_courses { - set man_id [lindex $course 0] - set isenabled [lindex $course 4] - set istrackable [lindex $course 5] - set class_key [dotlrn_community::get_community_type_from_community_id $new_community_id] - - db_dml add-course { - insert into ims_cp_manifest_class \ - (man_id, lorsm_instance_id, community_id, class_key, isenabled, istrackable) \ - values \ - (:man_id, :new_package_id, :new_community_id, :class_key, :isenabled, :istrackable) - } - - } - - } - + db_dml add-course { + insert into ims_cp_manifest_class \ + (man_id, lorsm_instance_id, community_id, class_key, isenabled, istrackable) \ + values \ + (:man_id, :new_package_id, :new_community_id, :class_key, :isenabled, :istrackable) + } + } + } return $new_package_id } + ad_proc -public change_event_handler { community_id event old_value new_value - } { - listens for the following events: - } { - } - + } { + listens for the following events: + } { + } } Index: openacs-4/packages/lorsm-portlet/tcl/lorsm-admin-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm-portlet/tcl/lorsm-admin-portlet-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/lorsm-portlet/tcl/lorsm-admin-portlet-procs.tcl 17 May 2005 17:53:36 -0000 1.4 +++ openacs-4/packages/lorsm-portlet/tcl/lorsm-admin-portlet-procs.tcl 14 Nov 2008 14:50:58 -0000 1.5 @@ -15,21 +15,25 @@ return "lorsm_admin_portlet" } + ad_proc -public get_pretty_name { } { return "[_ lorsm-portlet.lt_LORS_Management_Admin]" } + ad_proc -private my_package_key { } { return "lorsm-portlet" } + ad_proc -public link { } { return "" } + ad_proc -public add_self_to_page { {-portal_id:required} {-package_id:required} @@ -43,13 +47,13 @@ @return element_id The new element's id } { return [portal::add_element_parameters \ - -portal_id $portal_id \ - -portlet_name [get_my_name] \ - -key package_id \ - -value $package_id - ] + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -key package_id \ + -value $package_id] } + ad_proc -public remove_self_from_page { portal_id } { @@ -58,6 +62,7 @@ portal::remove_element -portal_id $portal_id -portlet_name [get_my_name] } + ad_proc -public show { cf } { @@ -67,5 +72,4 @@ -config_list $cf \ -template_src "lorsm-admin-portlet" } - } Index: openacs-4/packages/lorsm-portlet/tcl/lorsm-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm-portlet/tcl/lorsm-portlet-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/lorsm-portlet/tcl/lorsm-portlet-procs.tcl 16 Jul 2007 09:33:36 -0000 1.5 +++ openacs-4/packages/lorsm-portlet/tcl/lorsm-portlet-procs.tcl 14 Nov 2008 14:50:58 -0000 1.6 @@ -15,21 +15,25 @@ return "lorsm_portlet" } + ad_proc -private my_package_key { } { return "lorsm-portlet" } + ad_proc -public get_pretty_name { } { return "#lorsm-portlet.Learning_Materials#" } + ad_proc -public link { } { return "" } + ad_proc -public add_self_to_page { {-portal_id:required} {-package_id:required} @@ -52,8 +56,7 @@ -force_region [parameter::get_from_package_key \ -package_key [my_package_key] \ -parameter "lorsm_portlet_force_region"] \ - -param_action $param_action - ] + -param_action $param_action] } ad_proc -public remove_self_from_page { @@ -74,6 +77,7 @@ -value $package_id } + ad_proc -public show { cf } { Index: openacs-4/packages/lorsm-portlet/www/lorsm-admin-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm-portlet/www/lorsm-admin-portlet.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/lorsm-portlet/www/lorsm-admin-portlet.adp 31 Dec 2006 01:27:23 -0000 1.5 +++ openacs-4/packages/lorsm-portlet/www/lorsm-admin-portlet.adp 14 Nov 2008 14:50:58 -0000 1.6 @@ -1,26 +1,14 @@ - + - + Index: openacs-4/packages/lorsm-portlet/www/lorsm-admin-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm-portlet/www/lorsm-admin-portlet.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/lorsm-portlet/www/lorsm-admin-portlet.tcl 31 May 2005 22:56:08 -0000 1.4 +++ openacs-4/packages/lorsm-portlet/www/lorsm-admin-portlet.tcl 14 Nov 2008 14:50:58 -0000 1.5 @@ -1,16 +1,15 @@ ad_page_contract { The display logic for the LORS Management admin portlet - + @author Ernie Ghiglione (ErnieG@mm.st) @creation-date 2004-04-10 @cvs-id $Id$ } -properties { - + } - set lors_central_package_id [apm_package_id_from_key "lors-central"] set lors_central_url [apm_package_url_from_id $lors_central_package_id] @@ -27,11 +26,10 @@ if {[llength $list_of_package_ids] > 1} { # We have a problem! return -code error "There should be only one instance of lorsm for admin purposes" -} +} -set package_id [lindex $list_of_package_ids 0] +set package_id [lindex $list_of_package_ids 0] set url [lindex [site_node::get_url_from_object_id -object_id $package_id] 0] -ad_return_template - +ad_return_template Index: openacs-4/packages/lorsm-portlet/www/lorsm-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm-portlet/www/lorsm-portlet.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/lorsm-portlet/www/lorsm-portlet.adp 8 Oct 2008 13:24:32 -0000 1.6 +++ openacs-4/packages/lorsm-portlet/www/lorsm-portlet.adp 14 Nov 2008 14:50:58 -0000 1.7 @@ -1,6 +1,6 @@ - + -   +