Index: openacs-4/packages/dotlrn-eduwiki/sql/oracle/dotlrn-eduwiki-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-eduwiki/sql/oracle/dotlrn-eduwiki-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-eduwiki/sql/oracle/dotlrn-eduwiki-create.sql 7 Oct 2009 19:23:16 -0000 1.1 @@ -0,0 +1,139 @@ +declare + foo integer; +begin + +-- create the implementation + foo := acs_sc_impl.new ( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_eduwiki', + impl_pretty_name => 'dotlrn_eduwiki', + impl_owner_name => 'dotlrn_eduwiki' + ); + +-- add all the hooks + +-- GetPrettyName + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'GetPrettyName', + 'eduwiki::get_pretty_name', + 'TCL' + ); + +-- AddApplet + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddApplet', + 'eduwiki::add_applet', + 'TCL' + ); + +-- RemoveApplet + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveApplet', + 'eduwiki::remove_applet', + 'TCL' + ); + +-- AddAppletToCommunity + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddAppletToCommunity', + 'eduwiki::add_applet_to_community', + 'TCL' + ); + +-- RemoveAppletFromCommunity + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveAppletFromCommunity', + 'eduwiki::remove_applet_from_community', + 'TCL' + ); + +-- AddUser + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddUser', + 'eduwiki::add_user', + 'TCL' + ); + +-- RemoveUser + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveUser', + 'eduwiki::remove_user', + 'TCL' + ); + +-- AddUserToCommunity + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddUserToCommunity', + 'eduwiki::add_user_to_community', + 'TCL' + ); + +-- RemoveUserFromCommunity + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveUserFromCommunity', + 'eduwiki::remove_user_from_community', + 'TCL' + ); + +-- AddPortlet + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddPortlet', + 'eduwiki::add_portlet', + 'TCL' + ); + +-- RemovePortlet + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemovePortlet', + 'eduwiki::remove_portlet', + 'TCL' +); + +-- Clone + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'Clone', + 'eduwiki::clone', + 'TCL' +); + + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'ChangeEventHandler', + 'eduwiki::change_event_handler', + 'TCL' +); + +-- Add the binding +acs_sc_binding.new ( + contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_eduwiki' +); + +end; +/ +show errors Index: openacs-4/packages/dotlrn-eduwiki/sql/oracle/dotlrn-eduwiki-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-eduwiki/sql/oracle/dotlrn-eduwiki-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-eduwiki/sql/oracle/dotlrn-eduwiki-drop.sql 7 Oct 2009 19:23:16 -0000 1.1 @@ -0,0 +1,104 @@ +declare + foo integer; +begin + + foo := acs_sc_impl.del ( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_eduwiki' + ); + +-- add all the hooks + +-- GetPrettyName + foo := acs_sc_impl.delete_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'GetPrettyName' + ); + +-- AddApplet +select acs_sc_impl_alias__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddApplet' +); + +-- RemoveApplet + foo := acs_sc_impl.delete_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveApplet' +); + +-- AddAppletToCommunity + foo := acs_sc_impl.delete_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddAppletToCommunity' +); + +-- RemoveAppletFromCommunity + foo := acs_sc_impl.delete_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveAppletFromCommunity' +); + +-- AddUser + foo := acs_sc_impl.delete_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddUser' +); + +-- RemoveUser + foo := acs_sc_impl.delete_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveUser' +); + +-- AddUserToCommunity + foo := acs_sc_impl.delete_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddUserToCommunity' +); + +-- RemoveUserFromCommunity + foo := acs_sc_impl.delete_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveUserFromCommunity' +); + +-- AddPortlet + foo := acs_sc_impl.delete_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddPortlet' + ); + +-- RemovePortlet + foo := acs_sc_impl.delete_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemovePortlet' +); + +-- Clone + foo := acs_sc_impl.delete_alias ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'Clone' +); + + +-- Add the binding + foo := acs_sc_impl.del ( + 'dotlrn_applet', + 'dotlrn_eduwiki' +); +end; +/ +show errors Index: openacs-4/packages/dotlrn-eduwiki/sql/postgresql/dotlrn-eduwiki-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-eduwiki/sql/postgresql/dotlrn-eduwiki-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-eduwiki/sql/postgresql/dotlrn-eduwiki-create.sql 7 Oct 2009 19:23:16 -0000 1.1 @@ -0,0 +1,131 @@ + +-- create the implementation +select acs_sc_impl__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'dotlrn_eduwiki' +); + +-- add all the hooks + +-- GetPrettyName +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'GetPrettyName', + 'eduwiki::get_pretty_name', + 'TCL' +); + +-- AddApplet +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddApplet', + 'eduwiki::add_applet', + 'TCL' +); + +-- RemoveApplet +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveApplet', + 'eduwiki::remove_applet', + 'TCL' +); + +-- AddAppletToCommunity +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddAppletToCommunity', + 'eduwiki::add_applet_to_community', + 'TCL' +); + +-- RemoveAppletFromCommunity +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveAppletFromCommunity', + 'eduwiki::remove_applet_from_community', + 'TCL' +); + +-- AddUser +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddUser', + 'eduwiki::add_user', + 'TCL' +); + +-- RemoveUser +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveUser', + 'eduwiki::remove_user', + 'TCL' +); + +-- AddUserToCommunity +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddUserToCommunity', + 'eduwiki::add_user_to_community', + 'TCL' +); + +-- RemoveUserFromCommunity +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveUserFromCommunity', + 'eduwiki::remove_user_from_community', + 'TCL' +); + +-- AddPortlet +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddPortlet', + 'eduwiki::add_portlet', + 'TCL' + ); + +-- RemovePortlet +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemovePortlet', + 'eduwiki::remove_portlet', + 'TCL' +); + +-- Clone +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'Clone', + 'eduwiki::clone', + 'TCL' +); + +select acs_sc_impl_alias__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'ChangeEventHandler', + 'eduwiki::change_event_handler', + 'TCL' +); + +-- Add the binding +select acs_sc_binding__new ( + 'dotlrn_applet', + 'dotlrn_eduwiki' +); Index: openacs-4/packages/dotlrn-eduwiki/sql/postgresql/dotlrn-eduwiki-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-eduwiki/sql/postgresql/dotlrn-eduwiki-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-eduwiki/sql/postgresql/dotlrn-eduwiki-drop.sql 7 Oct 2009 19:23:16 -0000 1.1 @@ -0,0 +1,99 @@ + +select acs_sc_impl__delete( + 'dotlrn_applet', -- impl_contract_name + 'dotlrn_eduwiki' -- impl_name +); + + +-- add all the hooks + +-- GetPrettyName +select acs_sc_impl_alias__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'GetPrettyName' +); + +-- AddApplet +select acs_sc_impl_alias__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddApplet' +); + +-- RemoveApplet +select acs_sc_impl_alias__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveApplet' +); + +-- AddAppletToCommunity +select acs_sc_impl_alias__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddAppletToCommunity' +); + +-- RemoveAppletFromCommunity +select acs_sc_impl_alias__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveAppletFromCommunity' +); + +-- AddUser +select acs_sc_impl_alias__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddUser' +); + +-- RemoveUser +select acs_sc_impl_alias__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveUser' +); + +-- AddUserToCommunity +select acs_sc_impl_alias__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddUserToCommunity' +); + +-- RemoveUserFromCommunity +select acs_sc_impl_alias__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemoveUserFromCommunity' +); + +-- AddPortlet +select acs_sc_impl_alias__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'AddPortlet' + ); + +-- RemovePortlet +select acs_sc_impl_alias__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'RemovePortlet' +); + +-- Clone +select acs_sc_impl_alias__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki', + 'Clone' +); + + +-- Add the binding +select acs_sc_binding__delete ( + 'dotlrn_applet', + 'dotlrn_eduwiki' +); Index: openacs-4/packages/dotlrn-eduwiki/tcl/eduwiki-applet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-eduwiki/tcl/eduwiki-applet-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-eduwiki/tcl/eduwiki-applet-procs.tcl 7 Oct 2009 19:23:16 -0000 1.1 @@ -0,0 +1,187 @@ +ad_library { + Procs to set up the eduwiki applet +} + +namespace eval eduwiki { + + ad_proc -public applet_key { + } { + What's my applet key? + } { + return "dotlrn_eduwiki" + } + + ad_proc -public my_package_key { + } { + What package do I deal with? + } { + return "dotlrn-eduwiki" + } + + ad_proc -public package_key { + } { + What package do I deal with? + } { + return "eduwiki" + } + + ad_proc -public get_pretty_name { + } { + returns the pretty name + } { + return "Educational Wiki" + } + + ad_proc -public 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 remove_applet { + } { + One time destroy + } { + ad_return_complaint 1 "[applet_key] remove_applet not implimented!" + } + + ad_proc -public add_applet_to_community { + community_id + } { + Add the learn content applet to a specifc dotlrn community + } { + # get the community portal id + set portal_id [dotlrn_community::get_portal_id -community_id $community_id] + + #create the content package instance + set package_id [dotlrn::instantiate_and_mount $community_id [package_key]] + + # set up the admin portlet + set admin_portal_id [dotlrn_community::get_admin_portal_id -community_id $community_id] + + eduwiki_admin_portlet::add_self_to_page \ + -portal_id $admin_portal_id \ + -package_id $package_id + + # set up the content portlet for this community + set portal_id [dotlrn_community::get_portal_id -community_id $community_id] + + #add portlet to community portal + set args [ns_set create] + ns_set put $args package_id $package_id + ns_set put $args param_action "overwrite" + 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 implimented!" + } + + 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 implimented!" + } + + ad_proc -public add_user_to_community { + community_id + user_id + } { + Add a user to a specifc dotlrn community + } { + # noop + } + + ad_proc -public remove_user_from_community { + community_id + user_id + } { + Remove a user from a community + } { + # noop + } + + 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 + 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 + } { + eduwiki_portlet::add_self_to_page \ + -portal_id $portal_id \ + -package_id [ns_set get $args "package_id"] \ + -force_region [ns_set get $args "force_region"] \ + -page_name [get_pretty_name] \ + -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) + } { + eduwiki_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 + } { + 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 clone_data {} + return $new_package_id + } + + ad_proc -public change_event_handler { + community_id:required + event:required + old_value:required + new_value:required + } { + listens for the following events: + } { + } +} \ No newline at end of file