Index: openacs-4/packages/beehive-portlet/beehive-portlet.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/beehive-portlet/beehive-portlet.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/beehive-portlet/beehive-portlet.info 10 May 2006 05:55:03 -0000 1.1 @@ -0,0 +1,32 @@ + + + + + beehive Portlet + beehive Portlets + f + t + + + + 0 + + + + + Ernie Ghiglione + 2004-04-10 + OpenACS + + + + + + + + + + + + + Index: openacs-4/packages/beehive-portlet/sql/postgresql/beehive-admin-portlet-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/beehive-portlet/sql/postgresql/beehive-admin-portlet-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/beehive-portlet/sql/postgresql/beehive-admin-portlet-create.sql 10 May 2006 05:55:03 -0000 1.1 @@ -0,0 +1,151 @@ +-- /beehive-portlet/sql/postgresql/beehive-admin-portlet-create.sql +-- +-- Creates LORS Management portlet +-- +-- @author Aiman turani (aimant@mm.st) +-- @creation-date 2004-04-10 +-- @cvs-id $Id: beehive-admin-portlet-create.sql,v 1.1 2006/05/10 05:55:03 aimant Exp $ +-- + +create function inline_0 () +returns integer as ' +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + ds_id = portal_datasource__new( + ''beehive_admin_portlet'', + ''Displays a folder_id'' + ); + +RAISE NOTICE '' created new ds''; + + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''shadeable_p'', + ''f'' + ); + +RAISE NOTICE '' set shadeable''; + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''hideable_p'', + ''f'' + ); + +RAISE NOTICE '' set hideable''; + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''user_editable_p'', + ''f'' + ); + + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''shaded_p'', + ''f'' + ); + + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''link_hideable_p'', + ''t'' + ); + + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''f'', + ''package_id'', + '' '' + ); + + +return 0; + +end;' language 'plpgsql'; + + + +select inline_0(); + +drop function inline_0 (); + +-- create the implementation +select acs_sc_impl__new ( + 'portal_datasource', + 'beehive_admin_portlet', + 'beehive_admin_portlet' +); + +-- add all the hooks +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_admin_portlet', + 'GetMyName', + 'beehive_admin_portlet::get_my_name', + 'TCL' +); + +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_admin_portlet', + 'GetPrettyName', + 'beehive_admin_portlet::get_pretty_name', + 'TCL' +); + +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_admin_portlet', + 'Link', + 'beehive_admin_portlet::link', + 'TCL' +); + +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_admin_portlet', + 'AddSelfToPage', + 'beehive_admin_portlet::add_self_to_page', + 'TCL' +); + +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_admin_portlet', + 'Show', + 'beehive_admin_portlet::show', + 'TCL' +); + +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_admin_portlet', + 'Edit', + 'beehive_admin_portlet::edit', + 'TCL' +); + +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_admin_portlet', + 'RemoveSelfFromPage', + 'beehive_admin_portlet::remove_self_from_page', + 'TCL' +); + +-- Add the binding +select acs_sc_binding__new( + 'portal_datasource', + 'beehive_admin_portlet' +); Index: openacs-4/packages/beehive-portlet/sql/postgresql/beehive-portlet-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/beehive-portlet/sql/postgresql/beehive-portlet-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/beehive-portlet/sql/postgresql/beehive-portlet-create.sql 10 May 2006 05:55:03 -0000 1.1 @@ -0,0 +1,156 @@ +-- /beehive-portlet/sql/postgresql/beehive-portlet-create.sql +-- +-- Creates LORS Management portlet +-- +-- @author Aiman truani (aimant@mm.st) +-- @creation-date 2004-04-10 +-- @cvs-id $Id: beehive-portlet-create.sql,v 1.1 2006/05/10 05:55:03 aimant Exp $ +-- + +create function inline_0 () +returns integer as ' +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + ds_id = portal_datasource__new( + ''beehive_portlet'', + ''Displays a Folder_id'' + ); + + +perform portal_datasource__set_def_param( + ds_id, + ''t'', + ''t'', + ''shadeable_p'', + ''t'' +); + +perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''hideable_p'', + ''t'' +); + +perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''user_editable_p'', + ''f'' +); + +perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''shaded_p'', + ''f'' +); + +perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''link_hideable_p'', + ''t'' +); + +perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''style'', + ''list'' +); + +perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''f'', + ''package_id'', + '' '' +); + +return 0; + +end; ' language 'plpgsql'; + +select inline_0 (); + +drop function inline_0 (); + +-- create the implementation +select acs_sc_impl__new( + 'portal_datasource', + 'beehive_portlet', + 'beehive_portlet' +); + + +-- add all the hooks +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_portlet', + 'GetMyName', + 'beehive_portlet::get_my_name', + 'TCL' +); + +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_portlet', + 'GetPrettyName', + 'beehive_portlet::get_pretty_name', + 'TCL' +); + +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_portlet', + 'Link', + 'beehive_portlet::link', + 'TCL' +); + +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_portlet', + 'AddSelfToPage', + 'beehive_portlet::add_self_to_page', + 'TCL' + ); + +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_portlet', + 'Show', + 'beehive_portlet::show', + 'TCL' + ); + +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_portlet', + 'Edit', + 'beehive_portlet::edit', + 'TCL' + ); + +select acs_sc_impl_alias__new( + 'portal_datasource', + 'beehive_portlet', + 'RemoveSelfFromPage', + 'beehive_portlet::remove_self_from_page', + 'TCL' + ); + + -- Add the binding +select acs_sc_binding__new ( + 'portal_datasource', + 'beehive_portlet' +); + +\i beehive-admin-portlet-create.sql Index: openacs-4/packages/beehive-portlet/tcl/beehive-admin-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/beehive-portlet/tcl/beehive-admin-portlet-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/beehive-portlet/tcl/beehive-admin-portlet-procs.tcl 10 May 2006 05:55:03 -0000 1.1 @@ -0,0 +1,71 @@ +ad_library { + + Procedures to support the beehive portlet. + + @creation-date 2004-04-10 + @author Aiman turani (aimant@mm.st) + @cvs-id $Id: beehive-admin-portlet-procs.tcl,v 1.1 2006/05/10 05:55:03 aimant Exp $ + +} + +namespace eval beehive_admin_portlet { + + ad_proc -private get_my_name { + } { + return "beehive_admin_portlet" + } + + ad_proc -public get_pretty_name { + } { + return "Beehive Administration" + } + + ad_proc -private my_package_key { + } { + return "beehive-portlet" + } + + ad_proc -public link { + } { + return "" + } + + ad_proc -public add_self_to_page { + {-portal_id:required} + {-package_id:required} + } { + Adds a beehive mgt admin PE to the given admin portal. There should only + ever be one of these portals on an admin page with only one beehive_package_id + + @param portal_id The page to add self to + @param package_id the id of the beehive package + + @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 + ] + } + + ad_proc -public remove_self_from_page { + portal_id + } { + Removes a beehive admin PE from the given portal + } { + portal::remove_element -portal_id $portal_id -portlet_name [get_my_name] + } + + ad_proc -public show { + cf + } { + } { + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src "beehive-admin-portlet" + } + +} Index: openacs-4/packages/beehive-portlet/tcl/beehive-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/beehive-portlet/tcl/beehive-portlet-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/beehive-portlet/tcl/beehive-portlet-procs.tcl 10 May 2006 05:55:03 -0000 1.1 @@ -0,0 +1,87 @@ +ad_library { + + Procedures to support the beehive portlet. + + @author Aiman turani (aimant@mm.st) + @creation-date 2004-04-10 + @cvs-id $Id: beehive-portlet-procs.tcl,v 1.1 2006/05/10 05:55:03 aimant Exp $ + +} + +namespace eval beehive_portlet { + + ad_proc -private get_my_name { + } { + return "beehive_portlet" + } + + ad_proc -private my_package_key { + } { + return "beehive-portlet" + } + + ad_proc -public get_pretty_name { + } { + return " Beehive Package" + } + + ad_proc -public link { + } { + return "" + } + + ad_proc -public add_self_to_page { + {-portal_id:required} + {-package_id:required} + {-param_action:required} + } { + Adds a LORS Mgt PE to the given portal or appends the given + beehive_package_id to the params of the beehive pe already there + + @param portal_id The page to add self to + @param package_id the id of the beehive package for this community + + @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 \ + -pretty_name [get_pretty_name] \ + -force_region [parameter::get_from_package_key \ + -package_key [my_package_key] \ + -parameter "beehive_portlet_force_region"] \ + -param_action $param_action + ] + } + + ad_proc -public remove_self_from_page { + {-portal_id:required} + {-package_id:required} + } { + Removes a beehive PE from the given page or just the passed + in beehive_package_id parameter from the portlet + (that has other beehive_package_ids) + + @param portal_id The page to remove self from + @param package_id + } { + portal::remove_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -key package_id \ + -value $package_id + } + + ad_proc -public show { + cf + } { + } { + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src "beehive-portlet" + } + +} Index: openacs-4/packages/beehive-portlet/www/beehive-admin-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/beehive-portlet/www/beehive-admin-portlet.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/beehive-portlet/www/beehive-admin-portlet.adp 10 May 2006 05:55:03 -0000 1.1 @@ -0,0 +1,54 @@ + + +#beehive.Edit_configuration_info# + + + #beehive.Manage_existing_activity_sessions# + +
+ #beehive.Create_new_activities# + + +
+
+#beehive.Create_new_activities_message# +
+ +
+ +
#beehive.Create_new_design# + +
+
+ #beehive.Create_new_activity_session# +
+ +
+#beehive.Edit_configuration_info# + + + +
+ + + + \ No newline at end of file Index: openacs-4/packages/beehive-portlet/www/beehive-admin-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/beehive-portlet/www/beehive-admin-portlet.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/beehive-portlet/www/beehive-admin-portlet.tcl 10 May 2006 05:55:03 -0000 1.1 @@ -0,0 +1,42 @@ +ad_page_contract { + + The logic for the aiman. + + @author turani + @creation-date 2004-04-10 + @cvs-id $Id: beehive-admin-portlet.tcl,v 1.1 2006/05/10 05:55:03 aimant Exp $ + +} -query { +} -properties { + sess:multirow +} + +array set config $cf +set list_of_package_ids $config(package_id) +set package_idn [lindex $list_of_package_ids 0] + +# package_id gives the instance of the application needed to get community name +set package_id [ad_conn package_id] + +set community_id [dotlrn_community::get_community_id -package_id $package_id] +set comm_name [dotlrn_community::get_community_name_not_cached $community_id] +set admin_id [dotlrn_community::list_admin_users $community_id] +set user_id [ad_conn user_id] + + + +set class $comm_name +set name [acs_user::get_element -user_id $user_id -element name] + +# list down the created session +set url [lindex [site_node::get_url_from_object_id -object_id $package_idn] 0] +db_multirow sess get_info "SELECT * from beehive_ses where classname = :comm_name order by number" + + +set flag [parameter::get -package_id $package_idn -parameter "firstTimeFlage"] +if {$flag == 0 } { +set surl [parameter::set_value -package_id $package_idn -parameter "systemURL" -value [ad_url]] +set new [parameter::set_value -package_id $package_idn -parameter "firstTimeFlage" -value 1] +} + +ad_return_template Index: openacs-4/packages/beehive-portlet/www/beehive-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/beehive-portlet/www/beehive-portlet.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/beehive-portlet/www/beehive-portlet.adp 10 May 2006 05:55:03 -0000 1.1 @@ -0,0 +1,86 @@ + + + + + + + + + you can use this portlet only within a class + + + + + + + +
  • +<% +# to fix the date format +set dates $session(datew) +set dates [subst {[string range $dates 0 3]/[string range $dates 5 6]/[string range $dates 8 9] - [string range $dates 11 12]:[string range $dates 14 15]}] + + +%> + + + @session.titlew@ (@session.stype@) @dates@ + + + @session.titlew@ (@session.stype@) @dates@ + + + + + + + +No created sessions + + + +
    + + + + + + + + + + + + + +. + + + + + + +   + Index: openacs-4/packages/beehive-portlet/www/beehive-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/beehive-portlet/www/beehive-portlet.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/beehive-portlet/www/beehive-portlet.tcl 10 May 2006 05:55:03 -0000 1.1 @@ -0,0 +1,43 @@ +ad_page_contract { + + The logic for the aiman. + + @author Aiman turani (aiman@mm.st) + @creation-date 2004-04-10 + @cvs-id $Id: beehive-portlet.tcl,v 1.1 2006/05/10 05:55:03 aimant Exp $ + +} -query { +} -properties { + session:multirow + info:multirow +} + +array set config $cf + +set list_of_package_ids $config(package_id) +set package_idn [lindex $list_of_package_ids 0] + +# package_id gives the instance of the application needed to get community name +set package_id [ad_conn package_id] + +set community_id [dotlrn_community::get_community_id -package_id $package_id] +set comm_name [dotlrn_community::get_community_name_not_cached $community_id] +set admin_id [dotlrn_community::list_admin_users $community_id] +set user_id [ad_conn user_id] + +set shaded_p $config(shaded_p) +set list_of_package_ids [lsort $config(package_id)] + +set one_instance_p [ad_decode [llength $list_of_package_ids] 1 1 0] +set name [acs_user::get_element -user_id $user_id -element name] + +set fflag 0 +db_multirow session get_info "SELECT * from beehive_ses where classname = :comm_name order by number" +template::multirow foreach session { +set fflag 1 +} + + +set url [parameter::get -package_id $package_idn -parameter "systemURL"] +set flashservera [parameter::get -package_id $package_idn -parameter "FlashComServer"] +ad_return_template Index: openacs-4/packages/dotlrn-beehive/dotlrn-beehive.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-beehive/dotlrn-beehive.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-beehive/dotlrn-beehive.info 10 May 2006 05:55:06 -0000 1.1 @@ -0,0 +1,32 @@ + + + + + dotLRN beehive Applet + dotLRN beehive Applets + f + t + + + + 0 + + + + + Aiman Turani + 2004-04-10 + OpenACS + + + + + + + + + + + + + Index: openacs-4/packages/dotlrn-beehive/sql/postgresql/dotlrn-beehive-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-beehive/sql/postgresql/dotlrn-beehive-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-beehive/sql/postgresql/dotlrn-beehive-create.sql 10 May 2006 05:55:06 -0000 1.1 @@ -0,0 +1,149 @@ +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- +-- The beehive applet for dotLRN +-- +-- @author Aimant (aimant@mm.st) +-- @creation-date 2004-04-10 +-- @cvs-id $Id: dotlrn-beehive-create.sql,v 1.1 2006/05/10 05:55:06 aimant Exp $ +-- + +-- create the implementation +select acs_sc_impl__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'dotlrn_beehive' +); + +-- add all the hooks + +-- GetPrettyName +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'GetPrettyName', + 'dotlrn_beehive::get_pretty_name', + 'TCL' +); + +-- AddApplet +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'AddApplet', + 'dotlrn_beehive::add_applet', + 'TCL' +); + +-- RemoveApplet +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'RemoveApplet', + 'dotlrn_beehive::remove_applet', + 'TCL' +); + +-- AddAppletToCommunity +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'AddAppletToCommunity', + 'dotlrn_beehive::add_applet_to_community', + 'TCL' +); + +-- RemoveAppletFromCommunity +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'RemoveAppletFromCommunity', + 'dotlrn_beehive::remove_applet_from_community', + 'TCL' +); + +-- AddUser +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'AddUser', + 'dotlrn_beehive::add_user', + 'TCL' +); + +-- RemoveUser +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'RemoveUser', + 'dotlrn_beehive::remove_user', + 'TCL' +); + +-- AddUserToCommunity +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'AddUserToCommunity', + 'dotlrn_beehive::add_user_to_community', + 'TCL' +); + +-- RemoveUserFromCommunity +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'RemoveUserFromCommunity', + 'dotlrn_beehive::remove_user_from_community', + 'TCL' +); + +-- AddPortlet +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'AddPortlet', + 'dotlrn_beehive::add_portlet', + 'TCL' + ); + +-- RemovePortlet +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'RemovePortlet', + 'dotlrn_beehive::remove_portlet', + 'TCL' +); + +-- Clone +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'Clone', + 'dotlrn_beehive::clone', + 'TCL' +); + +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_beehive', + 'ChangeEventHandler', + 'dotlrn_beehive::change_event_handler', + 'TCL' +); + +-- Add the binding +select acs_sc_binding__new ( + 'dotlrn_applet', + 'dotlrn_beehive' +); Index: openacs-4/packages/dotlrn-beehive/tcl/dotlrn-beehive-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-beehive/tcl/dotlrn-beehive-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-beehive/tcl/dotlrn-beehive-procs-postgresql.xql 10 May 2006 05:55:06 -0000 1.1 @@ -0,0 +1,16 @@ + + + +postgresql7.1 + + + + select beehive__clone ( + :old_package_id, + :new_package_id + ); + + + + + Index: openacs-4/packages/dotlrn-beehive/tcl/dotlrn-beehive-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-beehive/tcl/dotlrn-beehive-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-beehive/tcl/dotlrn-beehive-procs.tcl 10 May 2006 05:55:06 -0000 1.1 @@ -0,0 +1,223 @@ +# +# This file is part of dotLRN. +# +# dotLRN is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + +ad_library { + + Procs to set up the dotLRN beehive applet + + @author aimant (aimant@mm.st) + @version $Id: dotlrn-beehive-procs.tcl,v 1.1 2006/05/10 05:55:06 aimant Exp $ + +} + +namespace eval dotlrn_beehive { + + ad_proc -public applet_key { + } { + What's my applet key? + } { + return "dotlrn_beehive" + } + + ad_proc -public package_key { + } { + What package do I deal with? + } { + return "beehive" + } + + ad_proc -public my_package_key { + } { + What's my package key? + } { + return "dotlrn-beehive" + } + + ad_proc -public get_pretty_name { + } { + returns the pretty name + } { + return "Beehive" + } + + ad_proc -public add_applet { + } { + Add the beehive applet to dotlrn. 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 { + community_id + package_id + } { + remove the applet + } { + ad_return_complaint 1 "[applet_key] remove_applet not implemented!" + } + + ad_proc -public add_applet_to_community { + community_id + } { + Add the beehive applet to a specifc dotlrn community + } { + set portal_id [dotlrn_community::get_portal_id -community_id $community_id] + + # create the beehive 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 + ] + + beehive_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] + ns_set put $args package_id $package_id + add_portlet_helper $portal_id $args + + return $package_id + } + + ad_proc -public remove_applet_from_community { + community_id + } { + 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 + } { + one time user-specifuc init + } { + # noop + } + + ad_proc -public remove_user { + user_id + } { + } { + ad_return_complaint 1 "[applet_key] remove_user not implemented!" + } + + ad_proc -public 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 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 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 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 + } { + beehive_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 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) + } { + beehive_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 + } { + 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_beehive_clone {} + return $new_package_id + } + + ad_proc -public change_event_handler { + community_id + event + old_value + new_value + } { + listens for the following events: + } { + } + +}