Index: openacs-4/packages/dotlrn-news-aggregator/dotlrn-news-aggregator.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-news-aggregator/dotlrn-news-aggregator.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-news-aggregator/dotlrn-news-aggregator.info 16 Jun 2003 13:34:57 -0000 1.1 @@ -0,0 +1,26 @@ + + + + + dotLRN News Aggregator Applet + dotLRN News Aggregator Applets + f + t + + + Simon Carstensen + + + + + + + + + + + + + + + Index: openacs-4/packages/dotlrn-news-aggregator/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-news-aggregator/tcl/apm-callback-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-news-aggregator/tcl/apm-callback-procs.tcl 16 Jun 2003 13:34:58 -0000 1.1 @@ -0,0 +1,57 @@ +ad_library { + Procedures for registering implementations for the + dotlrn nwes-aggregator package. + + @creation-date 8 May 2003 + @author Simon Carstensen (simon@collaboraid.biz) + @cvs-id $Id: apm-callback-procs.tcl,v 1.1 2003/06/16 13:34:58 peterm Exp $ +} + +namespace eval dotlrn_news_aggregator {} + +ad_proc -private dotlrn_news_aggregator::install {} { + dotLRN Weblogger package install proc +} { + register_portal_datasource_impl +} + +ad_proc -private dotlrn_news_aggregator::uninstall {} { + dotLRN Weblogger package uninstall proc +} { + unregister_portal_datasource_impl +} + +ad_proc -private dotlrn_news_aggregator::register_portal_datasource_impl {} { + Register the service contract implementation for the dotlrn_applet service contract +} { + set spec { + name "dotlrn_news_aggregator" + contract_name "dotlrn_applet" + owner "dotlrn-weblogger" + aliases { + GetPrettyName dotlrn_news_aggregator::get_pretty_name + AddApplet dotlrn_news_aggregator::add_applet + RemoveApplet dotlrn_news_aggregator::remove_applet + AddAppletToCommunity dotlrn_news_aggregator::add_applet_to_community + RemoveAppletFromCommunity dotlrn_news_aggregator::remove_applet_from_community + AddUser dotlrn_news_aggregator::add_user + RemoveUser dotlrn_news_aggregator::remove_user + AddUserToCommunity dotlrn_news_aggregator::add_user_to_community + RemoveUserFromCommunity dotlrn_news_aggregator::remove_user_from_community + AddPortlet dotlrn_news_aggregator::add_portlet + RemovePortlet dotlrn_news_aggregator::remove_portlet + Clone dotlrn_news_aggregator::clone + ChangeEventHandler dotlrn_news_aggregator::change_event_handler + } + } + + acs_sc::impl::new_from_spec -spec $spec +} + +ad_proc -private dotlrn_news_aggregator::unregister_portal_datasource_impl {} { + Unregister service contract implementations +} { + acs_sc::impl::delete \ + -contract_name "dotlrn_applet" \ + -impl_name "dotlrn_news_aggregator" +} Index: openacs-4/packages/dotlrn-news-aggregator/tcl/dotlrn-news-aggregator-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-news-aggregator/tcl/dotlrn-news-aggregator-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-news-aggregator/tcl/dotlrn-news-aggregator-procs-oracle.xql 16 Jun 2003 13:34:58 -0000 1.1 @@ -0,0 +1,19 @@ + + + +oracle8.1.6 + + + + begin + news_aggregator.clone ( + old_package_id => :old_package_id, + new_package_id => :new_package_id + ); + end; + + + + + + Index: openacs-4/packages/dotlrn-news-aggregator/tcl/dotlrn-news-aggregator-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-news-aggregator/tcl/dotlrn-news-aggregator-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-news-aggregator/tcl/dotlrn-news-aggregator-procs-postgresql.xql 16 Jun 2003 13:34:57 -0000 1.1 @@ -0,0 +1,16 @@ + + + +postgresql7.1 + + + + select news_aggregator__clone ( + :old_package_id, + :new_package_id + ); + + + + + Index: openacs-4/packages/dotlrn-news-aggregator/tcl/dotlrn-news-aggregator-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-news-aggregator/tcl/dotlrn-news-aggregator-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-news-aggregator/tcl/dotlrn-news-aggregator-procs.tcl 16 Jun 2003 13:34:58 -0000 1.1 @@ -0,0 +1,198 @@ +ad_library { + + Procs to set up the dotLRN news aggregator applet + + @author simon@collaboraid.biz +} + +namespace eval dotlrn_news_aggregator {} + +ad_proc -public dotlrn_news_aggregator::applet_key {} { + What's my applet key? +} { + return dotlrn_news_aggregator +} + +ad_proc -public dotlrn_news_aggregator::package_key {} { + What package do I deal with? +} { + return news-aggregator +} + +ad_proc -public dotlrn_news_aggregator::my_package_key {} { + What package do I deal with? +} { + return "dotlrn-news-aggregator" +} + +ad_proc -public dotlrn_news_aggregator::get_pretty_name {} { + returns the pretty name +} { + return "News Aggregator" +} + +ad_proc -public dotlrn_news_aggregator::add_applet {} { + One time init - must be repeatable! +} { + dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key] -package_key [my_package_key] +} + +ad_proc -public dotlrn_news_aggregator::remove_applet {} { + One time destroy. +} { + dotlrn_applet::remove_applet_from_dotlrn -applet_key [applet_key] +} + +ad_proc -public dotlrn_news_aggregator::add_applet_to_community { + community_id +} { + Add the news-aggregator applet to a specifc dotlrn community +} { + set portal_id [dotlrn_community::get_portal_id -community_id $community_id] + + # create the news-aggregator 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 admin_portal_id [dotlrn_community::get_admin_portal_id \ + -community_id $community_id + ] + + news_aggregator_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 +} + +ad_proc -public dotlrn_news_aggregator::remove_applet_from_community { + community_id +} { + remove the applet from the community +} { + ad_return_complaint 1 "[applet_key] remove_applet_from_community not implimented!" +} + +ad_proc -public dotlrn_news_aggregator::add_user { + user_id +} { + one time user-specifuc init +} { + # noop +} + +ad_proc -public dotlrn_news_aggregator::remove_user { + user_id +} { +} { + ad_return_complaint 1 "[applet_key] remove_user not implimented!" +} + +ad_proc -public dotlrn_news_aggregator::add_user_to_community { + community_id + user_id +} { + 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 portal_id [dotlrn::get_portal_id -user_id $user_id] + + # use "append" here since we want to aggregate + set args [ns_set create] + ns_set put $args package_id $package_id + ns_set put $args param_action append + add_portlet_helper $portal_id $args +} + +ad_proc -public dotlrn_news_aggregator::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 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 dotlrn_news_aggregator::add_portlet { + portal_id +} { + 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 + + set args [ns_set create] + ns_set put $args package_id 0 + ns_set put $args param_action overwrite + add_portlet_helper $portal_id $args +} + +ad_proc -public dotlrn_news_aggregator::add_portlet_helper { + portal_id + args +} { + A helper proc to add the underlying portlet to the given portal. + + @param portal_id + @param args an ns_set +} { + news_aggregator_portlet::add_self_to_page \ + -portal_id $portal_id \ + -package_id [ns_set get $args package_id] \ + -param_action [ns_set get $args param_action] +} + +ad_proc -public dotlrn_news_aggregator::remove_portlet { + portal_id + args +} { + 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_aggregator_portlet::remove_self_from_page \ + -portal_id $portal_id \ + -package_id [ns_set get $args package_id] +} + +ad_proc -public dotlrn_news_aggregator::clone { + old_community_id + new_community_id +} { + Clone this applet's content from the old community to the new one +} { + 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 \ +Z -applet_key [applet_key] + ] + + db_exec_plsql call_news_aggregator_clone {} + return $new_package_id +} + +ad_proc -public dotlrn_news_aggregator::change_event_handler { + community_id + event + old_value + new_value +} { + listens for the following events: +} { + # Hm. Nothing, it seems +} + + Index: openacs-4/packages/dotlrn-weblogger/dotlrn-weblogger.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-weblogger/dotlrn-weblogger.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-weblogger/dotlrn-weblogger.info 16 Jun 2003 13:36:14 -0000 1.1 @@ -0,0 +1,27 @@ + + + + + dotLRN Weblogger Applet + dotLRN Weblogger Applets + f + t + + + Simon Carstensen + Collaboraid + + + + + + + + + + + + + + + Index: openacs-4/packages/dotlrn-weblogger/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-weblogger/tcl/apm-callback-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-weblogger/tcl/apm-callback-procs.tcl 16 Jun 2003 13:36:14 -0000 1.1 @@ -0,0 +1,57 @@ +ad_library { + Procedures for registering implementations for the + dotlrn weblogger package. + + @creation-date 8 May 2003 + @author Simon Carstensen (simon@collaboraid.biz) + @cvs-id $Id: apm-callback-procs.tcl,v 1.1 2003/06/16 13:36:14 peterm Exp $ +} + +namespace eval dotlrn_weblogger {} + +ad_proc -private dotlrn_weblogger::install {} { + dotLRN Weblogger package install proc +} { + register_portal_datasource_impl +} + +ad_proc -private dotlrn_weblogger::uninstall {} { + dotLRN Weblogger package uninstall proc +} { + unregister_portal_datasource_impl +} + +ad_proc -private dotlrn_weblogger::register_portal_datasource_impl {} { + Register the service contract implementation for the dotlrn_applet service contract +} { + set spec { + name "dotlrn_weblogger" + contract_name "dotlrn_applet" + owner "dotlrn-weblogger" + aliases { + GetPrettyName dotlrn_weblogger::get_pretty_name + AddApplet dotlrn_weblogger::add_applet + RemoveApplet dotlrn_weblogger::remove_applet + AddAppletToCommunity dotlrn_weblogger::add_applet_to_community + RemoveAppletFromCommunity dotlrn_weblogger::remove_applet_from_community + AddUser dotlrn_weblogger::add_user + RemoveUser dotlrn_weblogger::remove_user + AddUserToCommunity dotlrn_weblogger::add_user_to_community + RemoveUserFromCommunity dotlrn_weblogger::remove_user_from_community + AddPortlet dotlrn_weblogger::add_portlet + RemovePortlet dotlrn_weblogger::remove_portlet + Clone dotlrn_weblogger::clone + ChangeEventHandler dotlrn_weblogger::change_event_handler + } + } + + acs_sc::impl::new_from_spec -spec $spec +} + +ad_proc -private dotlrn_weblogger::unregister_portal_datasource_impl {} { + Unregister service contract implementations +} { + acs_sc::impl::delete \ + -contract_name "dotlrn_applet" \ + -impl_name "dotlrn_weblogger" +} Index: openacs-4/packages/dotlrn-weblogger/tcl/dotlrn-weblogger-procs-postresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-weblogger/tcl/Attic/dotlrn-weblogger-procs-postresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-weblogger/tcl/dotlrn-weblogger-procs-postresql.xql 16 Jun 2003 13:36:14 -0000 1.1 @@ -0,0 +1,16 @@ + + + +postgresql7.1 + + + + select news-aggregator__clone ( + :old_package_id, + :new_package_id + ); + + + + + Index: openacs-4/packages/dotlrn-weblogger/tcl/dotlrn-weblogger-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-weblogger/tcl/dotlrn-weblogger-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-weblogger/tcl/dotlrn-weblogger-procs.tcl 16 Jun 2003 13:36:14 -0000 1.1 @@ -0,0 +1,196 @@ +ad_library { + + Procs to set up the dotLRN weblogger applet + + @author simon@collaboraid.biz +} + +namespace eval dotlrn_weblogger {} + +ad_proc -public dotlrn_weblogger::applet_key {} { + What's my applet key? +} { + return dotlrn_weblogger +} + +ad_proc -public dotlrn_weblogger::package_key {} { + What package do I deal with? +} { + return "lars-blogger" +} + +ad_proc -public dotlrn_weblogger::my_package_key {} { + What package do I deal with? +} { + return "dotlrn-weblogger" +} + +ad_proc -public dotlrn_weblogger::get_pretty_name {} { + returns the pretty name +} { + return "Weblogger" +} + +ad_proc -public dotlrn_weblogger::add_applet {} { + One time init - must be repeatable! +} { + dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key] -package_key [my_package_key] +} + +ad_proc -public dotlrn_weblogger::remove_applet {} { + One time destroy. +} { + dotlrn_applet::remove_applet_from_dotlrn -applet_key [applet_key] +} + +ad_proc -public dotlrn_weblogger::add_applet_to_community { + community_id +} { + Add the weblogger applet to a specifc dotlrn community +} { + set portal_id [dotlrn_community::get_portal_id -community_id $community_id] + + # create the weblogger 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 admin_portal_id [dotlrn_community::get_admin_portal_id \ + -community_id $community_id + ] + + weblogger_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 +} + +ad_proc -public dotlrn_weblogger::remove_applet_from_community { + community_id +} { + remove the applet from the community +} { + ad_return_complaint 1 "[applet_key] remove_applet_from_community not implimented!" +} + +ad_proc -public dotlrn_weblogger::add_user { + user_id +} { + one time user-specifuc init +} { + # noop +} + +ad_proc -public dotlrn_weblogger::remove_user { + user_id +} { +} { + ad_return_complaint 1 "[applet_key] remove_user not implimented!" +} + +ad_proc -public dotlrn_weblogger::add_user_to_community { + community_id + user_id +} { + 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 portal_id [dotlrn::get_portal_id -user_id $user_id] + + # use "append" here since we want to aggregate + set args [ns_set create] + ns_set put $args package_id $package_id + ns_set put $args param_action append + add_portlet_helper $portal_id $args +} + +ad_proc -public dotlrn_weblogger::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 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 dotlrn_weblogger::add_portlet { + portal_id +} { + 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 + + set args [ns_set create] + ns_set put $args package_id 0 + ns_set put $args param_action overwrite + add_portlet_helper $portal_id $args +} + +ad_proc -public dotlrn_weblogger::add_portlet_helper { + portal_id + args +} { + A helper proc to add the underlying portlet to the given portal. + + @param portal_id + @param args an ns_set +} { + weblogger_portlet::add_self_to_page \ + -portal_id $portal_id \ + -package_id [ns_set get $args package_id] \ + -param_action [ns_set get $args param_action] +} + +ad_proc -public dotlrn_weblogger::remove_portlet { + portal_id + args +} { + 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) +} { + weblogger_portlet::remove_self_from_page \ + -portal_id $portal_id \ + -package_id [ns_set get $args package_id] +} + +ad_proc -public dotlrn_weblogger::clone { + old_community_id + new_community_id +} { + Clone this applet's content from the old community to the new one +} { + 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] + ] + + db_exec_plsql call_weblogger_clone {} + return $new_package_id +} + +ad_proc -public dotlrn_weblogger::change_event_handler { + community_id + event + old_value + new_value +} { + listens for the following events: +} { +} +