Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admin-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-admin-profile-provider-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admin-profile-provider-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admin-profile-provider-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,49 +18,55 @@ -- Implementation of the profile provider interface for dotLRN Admins. -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- +create function inline_0() +returns integer as ' declare foo integer; begin -- drop the binding between this implementation and the interface it - -- implements. - acs_sc_binding.delete( - contract_name => 'profile_provider', - impl_name => 'dotlrn_admin_profile_provider' + -- implements + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotlrn_admin_profile_provider'' ); -- drop the bindings to the method implementations -- name method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_admin_profile_provider', - impl_operation_name => 'name' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_admin_profile_provider'', + ''name'' ); -- prettyName method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_admin_profile_provider', - impl_operation_name => 'prettyName' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_admin_profile_provider'', + ''prettyName'' ); -- render method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_admin_profile_provider', - impl_operation_name => 'render' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_admin_profile_provider'', + ''render'' ); -- drop the implementation - acs_sc_impl.delete( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_admin_profile_provider' + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotlrn_admin_profile_provider'' ); + return 0; end; -/ -show errors +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-admins-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-create.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-create.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -29,14 +29,6 @@ primary key ); -create table dotlrn_full_admin_profile_rels ( - rel_id integer - constraint dotlrn_fl_adm_prfl_rels_rel_fk - references dotlrn_full_user_profile_rels (rel_id) - constraint dotlrn_full_admin_prfl_rels_pk - primary key -); - @@ dotlrn-admin-profile-provider-create.sql @@ dotlrn-admins-init.sql @@ dotlrn-admins-package-create.sql Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-admins-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -21,9 +21,8 @@ -- @version $Id$ -- -@@ dotlrn-admins-package-drop.sql -@@ dotlrn-admins-sanitize.sql -@@ dotlrn-admin-profile-provider-drop.sql +\i dotlrn-admins-package-drop.sql +\i dotlrn-admins-sanitize.sql +\i dotlrn-admin-profile-provider-drop.sql -drop table dotlrn_full_admin_profile_rels; drop table dotlrn_admin_profile_rels; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-admins-init.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-init.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-init.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -32,12 +32,12 @@ PERFORM acs_rel_type__create_type( ''dotlrn_admin_profile_rel'', - ''dotLRN Admin Profile Membership'', - ''dotLRN Admin Profile Memberships'', - ''dotlrn_user_profile_rel'', + ''dotlrn_user_profile_rel'', + ''dotLRN Profile Admin'', + ''dotLRN Profile Admins'', + ''dotlrn_admin_profile_rel'', ''dotlrn_admin_profile_rels'', ''rel_id'', - ''dotlrn_admin_profile_rel'', ''profiled_group'', null, 0, @@ -65,7 +65,7 @@ (''admin'', ''Staff'', group_id); foo := rel_segment__new( - ''dotLRN Profiled Admins'', + ''dotLRN Admins'', group_id, ''dotlrn_admin_profile_rel'' ); @@ -85,46 +85,3 @@ select inline_1(); drop function inline_1(); - - -create function inline_2() -returns integer as ' -declare - foo integer; -begin - PERFORM acs_rel_type--create_type( - ''dotlrn_full_admin_profile_rel'', - ''dotLRN Full Admin Profile Membership'', - ''dotLRN Full Admin Profile Memberships'', - ''dotlrn_full_user_profile_rel'', - ''dotlrn_full_admin_profile_rels'', - ''rel_id'', - ''dotlrn_full_admin_profile_rel'', - ''profiled_group'', - null, - 0, - null, - ''user'', - null, - 0, - 1 - ); - - select min(group_id) - into foo - from profiled_groups - where profile_provider = (select min(impl_id) - from acs_sc_impls - where impl_name = ''dotlrn_admin_profile_provider''); - - foo := rel_segment__new( - ''dotLRN Full Profiled Admins'', - foo, - ''dotlrn_full_admin_profile_rel'' - ); - -end; -' language 'plpgsql'; - -select inline_2(); -drop function inline_2(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-admins-package-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-package-create.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-package-create.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -21,21 +21,23 @@ -- @version $Id$ -- -select define_function_args ('dotlrn_admin_profile_rel__new','rel_id,id,rel_type;dotlrn_admin_profile_rel,group_id,user_id,creation_user,creation_ip'); +select define_function_args ('dotlrn_admin_profile_rel__new','rel_id,user_id,portal_id,theme_id,id,rel_type;dotlrn_admin_profile_rel,group_id,creation_user,creation_ip'); select define_function_args ('dotlrn_admin_profile_rel__delete','rel_id'); -create function dotlrn_admin_profile_rel__new(integer,varchar,varchar,integer,integer,integer,varchar) +create function dotlrn_admin_profile_rel__new(integer,integer,integer,integer,integer,varchar,integer,integer,varchar) returns integer as ' DECLARE p_rel_id alias for $1; - p_id alias for $2; - p_rel_type alias for $3; - p_group_id alias for $4; - p_user_id alias for $5; - p_creation_user alias for $6; - p_creation_ip alias for $7; + p_user_id alias for $2; + p_portal_id alias for $3; + p_theme_id alias for $4; + p_id alias for $5; + p_rel_type alias for $6; + p_group_id alias for $7; + p_creation_user alias for $8; + p_creation_ip alias for $9; v_rel_id dotlrn_user_profile_rels.rel_id%TYPE; v_group_id groups.group_id%TYPE; BEGIN @@ -51,11 +53,12 @@ end if; v_rel_id := dotlrn_user_profile_rel__new( - p_rel_id, + v_rel_id, + p_user_id, + p_portal_id, + p_theme_id, p_id, p_rel_type, - v_group_id, - p_user_id, p_creation_user, p_creation_ip ); @@ -86,72 +89,3 @@ ' language 'plpgsql'; --- full admins - -select define_function_args('dotlrn_full_admin_profile_rel__new','rel_id,portal_id,theme_id,id,rel_type,group_id,user_id,creation_user,creation_ip'); - -select define_function_args('dotlrn_full_admin_profile_rel__delete','rel_id'); - - -create function dotlrn_full_admin_profile_rel__new(integer,integer,integer,varchar,varchar,integer,integer,integer,varchar) -returns integer as ' -DECLARE - p_rel_id alias for $1; - p_portal_id alias for $2; - p_theme_id alias for $3; - p_id alias for $4; - p_rel_type alias for $5; - p_group_id alias for $6; - p_user_id alias for $7; - p_creation_user alias for $8; - p_creation_ip alias for $9; - v_rel_id dotlrn_full_user_profile_rels.rel_id%TYPE; - v_group_id groups.group_id%TYPE; -BEGIN - if p_group_id is null then - select min(group_id) - into v_group_id - from profiled_groups - where profile_provider = (select min(impl_id) - from acs_sc_impls - where impl_name = ''dotlrn_admin_profile_provider''); - else - v_group_id := p_group_id; - end if; - - v_rel_id := dotlrn_full_user_profile_rel__new( - p_rel_id, - p_portal_id, - p_theme_id, - p_id, - p_rel_type, - v_group_id, - p_user_id, - p_creation_user, - p_creation_ip - ); - - insert - into dotlrn_full_admin_profile_rels - (rel_id) - values - (v_rel_id); - - return v_rel_id; -END; -' language 'plpgsql'; - - -create function dotlrn_full_admin_profile_rel__delete(integer) -returns integer as ' -DECLARE - p_rel_id alias for $1; -BEGIN - delete - from dotlrn_full_admin_profile_rels - where rel_id = p_rel_id; - - PERFORM dotlrn_full_user_profile_rel__delete(p_rel_id); - return(0); -END; -' language 'plpgsql'; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-admins-package-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-package-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-package-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -21,5 +21,5 @@ -- @version $Id$ -- -drop package dotlrn_full_admin_profile_rel; -drop package dotlrn_admin_profile_rel; +select drop_package('dotlrn_full_admin_profile_rel'); +select drop_package('dotlrn_admin_profile_rel'); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-sanitize.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-admins-sanitize.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-sanitize.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-sanitize.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,64 +18,74 @@ -- Sanitize the dotLRN Admin package -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- +create function inline_0() +returns integer as ' declare foo integer; begin select min(segment_id) into foo from rel_segments - where segment_name = 'dotLRN Full Profiled Admins'; + where segment_name = ''dotLRN Full Profiled Admins''; - rel_segment.delete( - segment_id => foo + perform rel_segment__delete( + foo ); - acs_rel_type.drop_type( - rel_type => 'dotlrn_full_admin_profile_rel', - cascade_p => 't' + perform acs_rel_type__drop_type( + ''dotlrn_full_admin_profile_rel'', + ''t'' ); + return 0; end; -/ -show errors +' language 'plpgsql'; +select inline_0(); +drop function inline_0(); +create function inline_1() +returns integer as ' declare foo integer; begin select min(segment_id) into foo from rel_segments - where segment_name = 'dotLRN Profiled Admins'; + where segment_name = ''dotLRN Profiled Admins''; - rel_segment.delete( - segment_id => foo + perform rel_segment__delete( + foo ); select min(group_id) into foo from profiled_groups where profile_provider = (select min(impl_id) from acs_sc_impls - where impl_name = 'dotlrn_admin_profile_provider'); + where impl_name = ''dotlrn_admin_profile_provider''); delete from dotlrn_user_types where group_id = foo; - profiled_group.delete( - group_id => foo + perform profiled_group__delete( + foo ); - acs_rel_type.drop_type( - rel_type => 'dotlrn_admin_profile_rel', - cascade_p => 't' + acs_rel_type__drop_type( + ''dotlrn_admin_profile_rel'', + ''t'' ); + return 0; end; -/ -show errors +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-applet-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-applet-sc-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-applet-sc-create.sql 10 May 2002 06:35:14 -0000 1.3 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-applet-sc-create.sql 2 Jul 2002 18:40:08 -0000 1.4 @@ -19,6 +19,7 @@ -- -- ben@openforce.net, arjun@openforce.net -- ported to PG by Yon and Ben +-- @author dan chak (chak@openforce.net) -- -- started October 1st, 2001 -- we remember September 11th @@ -32,23 +33,23 @@ -- begin - select acs_sc_contract__new ( + perform acs_sc_contract__new ( 'dotlrn_applet', 'dotLRN Applet contract' ); -- Get a pretty name - select acs_sc_msg_type__new ( + perform acs_sc_msg_type__new ( 'dotlrn_applet.GetPrettyName.InputType', '' ); - select acs_sc_msg_type__new ( + perform acs_sc_msg_type__new ( 'dotlrn_applet.GetPrettyName.OutputType', 'pretty_name:string' ); - select acs_sc_operation__new ( + perform acs_sc_operation__new ( 'dotlrn_applet', 'GetPrettyName', 'Get the pretty name of the applet', @@ -59,17 +60,17 @@ ); -- Add the applet to dotlrn (used for one-time initialization) - select acs_sc_msg_type__new( + perform acs_sc_msg_type__new( 'dotlrn_applet.AddApplet.InputType', '' ); - select acs_sc_msg_type__new( + perform acs_sc_msg_type__new( 'dotlrn_applet.AddApplet.OutputType', 'success_p:boolean,error_message:string' ); - select acs_sc_operation__new ( + perform acs_sc_operation__new ( 'dotlrn_applet', 'AddApplet', 'Add the Applet to dotlrn - used for one-time initialization', @@ -79,18 +80,42 @@ 'dotlrn_applet.AddApplet.OutputType' ); + -- RemoveApplet: Removes the applet from dotlrn (used for one-time destroy) + -- ** Not yet implimented ** + perform acs_sc_msg_type__new( + 'dotlrn_applet.RemoveApplet.InputType', + '' + ); + + perform acs_sc_msg_type__new( + 'dotlrn_applet.RemoveApplet.OutputType', + 'success_p:boolean,error_message:string' + ); + + perform acs_sc_operation__new ( + 'dotlrn_applet', + 'RemoveApplet', + 'Remove the applet', + 'f', -- not cacheable + 0, -- n_args + 'dotlrn_applet.RemoveApplet.InputType', + 'dotlrn_applet.RemoveApplet.OutputType' + ); + -- Add the applet to a community - select acs_sc_msg_type__new( + -- Called at community creation time. Adding applets after creation time + -- is ** not implimented yet ** + perform acs_sc_msg_type__new( 'dotlrn_applet.AddAppletToCommunity.InputType', 'community_id:integer' ); - select acs_sc_msg_type__new( + perform acs_sc_msg_type__new( 'dotlrn_applet.AddAppletToCommunity.OutputType', 'success_p:boolean,error_message:string' ); - select acs_sc_operation__new ( + perform acs_sc_operation__new ( 'dotlrn_applet', 'AddAppletToCommunity', 'Add the Applet to a specific dotlrn community', @@ -100,18 +125,43 @@ 'dotlrn_applet.AddAppletToCommunity.OutputType' ); + -- RemoveAppletFromCommunity: Removes the appletl from a community + -- Called at community delete time. Deleting applets before that time + -- ** not implimented yet ** + perform acs_sc_msg_type__new( + 'dotlrn_applet.RemoveAppletFromCommunity.InputType', + 'community_id:integer' + ); + + perform acs_sc_msg_type__new( + 'dotlrn_applet.RemoveAppletFromCommunity.OutputType', + 'success_p:boolean,error_message:string' + ); + + perform acs_sc_operation__new ( + 'dotlrn_applet', + 'RemoveAppletFromCommunity', + 'Remove the applet from a given community', + 'f', -- not cacheable + 1, -- n_args + 'dotlrn_applet.RemoveAppletFromCommunity.InputType', + 'dotlrn_applet.RemoveAppletFromCommunity.OutputType' + ); + -- add a user to dotlrn (used for user-specific one time stuff) - select acs_sc_msg_type__new( + -- Called when a user is added as a dotlrn user. An example: + -- dotlrn-calendar will create a personal calendar for the new user. + perform acs_sc_msg_type__new( 'dotlrn_applet.AddUser.InputType', 'user_id:integer' ); - select acs_sc_msg_type.new( + perform acs_sc_msg_type__new( 'dotlrn_applet.AddUser.OutputType', 'success_p:boolean,error_message:string' ); - select acs_sc_operation__new ( + perform acs_sc_operation__new ( 'dotlrn_applet', 'AddUser', 'Add a user to dotlrn, used for user-specific one-time init', @@ -122,18 +172,43 @@ ); - -- add a user to the a specfic dotlrn community - select acs_sc_msg_type__new( + -- RemoveUser: used for user-specific one time stuff + -- Just like AddUser above, but when we delete a dotlrn user + -- Example: dotlrn-calendar would delete the user's personal calendar + perform acs_sc_msg_type__new( + 'dotlrn_applet.RemoveUser.InputType', + 'user_id:integer' + ); + + perform acs_sc_msg_type__new( + 'dotlrn_applet.RemoveUser.OutputType', + 'success_p:boolean,error_message:string' + ); + + perform acs_sc_operation__new ( + 'dotlrn_applet', + 'RemoveUser', + 'Remove a user from dotlrn', + 'f', -- not cacheable + 1, -- n_args + 'dotlrn_applet.RemoveUser.InputType', + 'dotlrn_applet.RemoveUser.OutputType' + ); + + -- AddUserToCommunity: Adds a user to the a specfic dotlrn community. + -- An example of this is to make the community's calendar items + -- visable on user's personal calendar + perform acs_sc_msg_type__new( 'dotlrn_applet.AddUserToCommunity.InputType', 'community_id:integer,user_id:integer' ); - select acs_sc_msg_type__new( + perform acs_sc_msg_type__new( 'dotlrn_applet.AddUserToCommunity.OutputType', 'success_p:boolean,error_message:string' ); - select acs_sc_operation__new ( + perform acs_sc_operation__new ( 'dotlrn_applet', 'AddUserToCommunity', 'Add a user to a community', @@ -143,39 +218,19 @@ 'dotlrn_applet.AddUserToCommunity.OutputType' ); - -- remove a user from dotlrn - select acs_sc_msg_type__new( - 'dotlrn_applet.RemoveUser.InputType', - 'user_id:integer' - ); - - select acs_sc_msg_type__new( - 'dotlrn_applet.RemoveUser.OutputType', - 'success_p:boolean,error_message:string' - ); - - select acs_sc_operation__new ( - 'dotlrn_applet', - 'RemoveUser', - 'Remove a user from dotlrn', - 'f', -- not cacheable - 1, -- n_args - 'dotlrn_applet.RemoveUser.InputType', - 'dotlrn_applet.RemoveUser.OutputType' - ); - - -- remove a user from the community - select acs_sc_msg_type__new( + -- RemoveUserFromCommunity: Removes a user from a specfic dotlrn + -- community. Just like above, but removal. + perform acs_sc_msg_type__new( 'dotlrn_applet.RemoveUserFromCommunity.InputType', 'community_id:integer,user_id:integer' ); - select acs_sc_msg_type__new( + perform acs_sc_msg_type__new( 'dotlrn_applet.RemoveUserFromCommunity.OutputType', 'success_p:boolean,error_message:string' ); - select acs_sc_operation__new ( + perform acs_sc_operation__new ( 'dotlrn_applet', 'RemoveUserFromCommunity', 'Remove a user from a community, applet does appropriate cleanup', @@ -185,60 +240,18 @@ 'dotlrn_applet.RemoveUserFromCommunity.OutputType' ); - -- remove the applet from dotlrn - select acs_sc_msg_type__new( - 'dotlrn_applet.RemoveApplet.InputType', - '' - ); - - select acs_sc_msg_type__new( - 'dotlrn_applet.RemoveApplet.OutputType', - 'success_p:boolean,error_message:string' - ); - - select acs_sc_operation__new ( - 'dotlrn_applet', - 'RemoveApplet', - 'Remove the applet', - 'f', -- not cacheable - 0, -- n_args - 'dotlrn_applet.RemoveApplet.InputType', - 'dotlrn_applet.RemoveApplet.OutputType' - ); - - -- remove the applet from a community - select acs_sc_msg_type__new( - 'dotlrn_applet.RemoveAppletFromCommunity.InputType', - 'community_id:integer' - ); - - select acs_sc_msg_type__new( - 'dotlrn_applet.RemoveAppletFromCommunity.OutputType', - 'success_p:boolean,error_message:string' - ); - - select acs_sc_operation__new ( - 'dotlrn_applet', - 'RemoveAppletFromCommunity', - 'Remove the applet from a given community', - 'f', -- not cacheable - 2, -- n_args - 'dotlrn_applet.RemoveAppletFromCommunity.InputType', - 'dotlrn_applet.RemoveAppletFromCommunity.OutputType' - ); - - -- addportlet - select acs_sc_msg_type__new( + -- AddPortlet: Adds the underlying portlet to the given portal + perform acs_sc_msg_type__new( 'dotlrn_applet.AddPortlet.InputType', - 'args:string' + 'portal_id:integer' ); - select acs_sc_msg_type__new( + perform acs_sc_msg_type__new( 'dotlrn_applet.AddPortlet.OutputType', 'success_p:boolean,error_message:string' ); - select acs_sc_operation__new ( + perform acs_sc_operation__new ( 'dotlrn_applet', 'AddPortlet', 'Adds the underlying portlet to the portal specified', @@ -248,39 +261,39 @@ 'dotlrn_applet.AddPortlet.OutputType' ); - -- removeportlet - select acs_sc_msg_type__new( + -- RemovePortlet: the remove corollary of above + perform acs_sc_msg_type__new( 'dotlrn_applet.RemovePortlet.InputType', - 'portal_id:integer' + 'portal_id:integer,args:string' ); - select acs_sc_msg_type__new( + perform acs_sc_msg_type__new( 'dotlrn_applet.RemovePortlet.OutputType', 'success_p:boolean,error_message:string' ); - select acs_sc_operation__new ( + perform acs_sc_operation__new ( 'dotlrn_applet', 'RemovePortlet', 'Removes the underlying portlet from the given portal', 'f', -- not cacheable - 1, -- n_args + 2, -- n_args 'dotlrn_applet.RemovePortlet.InputType', 'dotlrn_applet.RemovePortlet.OutputType' ); - -- clone - select acs_sc_msg_type__new( + -- Clone: Attack of the Clones! + perform acs_sc_msg_type__new( 'dotlrn_applet.Clone.InputType', 'old_community_id:integer,new_community_id:integer' ); - select acs_sc_msg_type__new( + perform acs_sc_msg_type__new( 'dotlrn_applet.Clone.OutputType', 'success_p:boolean,error_message:string' ); - select acs_sc_operation__new ( + perform acs_sc_operation__new ( 'dotlrn_applet', 'Clone', 'Clone this applets content from the old to the new community', Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-applet-sc-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-applet-sc-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-applet-sc-drop.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,189 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- +-- drop the dotLRN applet service contract +-- +-- started October 1st, 2001 +-- we remember September 11th +-- +-- @author dan chak (chak@openforce.net) +-- porting to PG on 2002-07-01 + +begin + + perform acs_sc_operation__delete( + 'dotlrn_applet', + 'GetPrettyName' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.GetPrettyName.InputType' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.GetPrettyName.OutputType' + ); + + perform acs_sc_operation__delete( + 'dotlrn_applet', + 'AddApplet' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.AddApplet.InputType' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.AddApplet.OutputType' + ); + + perform acs_sc_operation__delete( + 'dotlrn_applet', + 'RemoveApplet' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.RemoveApplet.InputType' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.RemoveApplet.OutputType' + ); + + perform acs_sc_operation__delete( + 'dotlrn_applet', + 'AddAppletToCommunity' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.AddAppletToCommunity.InputType' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.AddAppletToCommunity.OutputType' + ); + + perform acs_sc_operation__delete( + 'dotlrn_applet', + 'RemoveAppletFromCommunity' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.RemoveAppletFromCommunity.InputType' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.RemoveAppletFromCommunity.OutputType' + ); + + perform acs_sc_operation__delete( + 'dotlrn_applet', + 'AddUser' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.AddUser.InputType' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.AddUser.OutputType' + ); + + perform acs_sc_operation__delete( + 'dotlrn_applet', + 'RemoveUser' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.RemoveUser.InputType' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.RemoveUser.OutputType' + ); + + perform acs_sc_operation__delete( + 'dotlrn_applet', + 'AddUserToCommunity' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.AddUserToCommunity.InputType' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.AddUserToCommunity.OutputType' + ); + + perform acs_sc_operation__delete( + 'dotlrn_applet', + 'RemoveUserFromCommunity' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.RemoveUserFromCommunity.InputType' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.RemoveUserFromCommunity.OutputType' + ); + + perform acs_sc_operation__delete( + 'dotlrn_applet', + 'AddPortlet' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.AddPortlet.InputType' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.AddPortlet.OutputType' + ); + + perform acs_sc_operation__delete( + 'dotlrn_applet', + 'RemovePortlet' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.RemovePortlet.InputType' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.RemovePortlet.OutputType' + ); + + perform acs_sc_operation__delete( + 'dotlrn_applet', + 'Clone' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.Clone.InputType' + ); + + perform acs_sc_msg_type__delete( + 'dotlrn_applet.Clone.OutputType' + ); + + perform acs_sc_contract__delete( + 'dotlrn_applet' + ); + +end; + Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-class-membership-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-class-membership-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-class-membership-drop.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,65 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc__ +-- +-- 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__ +-- + +-- +-- drop the dotLRN class membership model +-- +-- @author Ben Adida (ben@openforce__net) +-- @author yon (yon@openforce__net) +-- @author dan chak (chak@openforce__net) +-- @creation-date 2001-08-18 +-- @version $Id: dotlrn-class-membership-drop.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ +-- + +begin + + perform acs_rel_type__drop_type ( + 'dotlrn_student_rel', + 't' + ); + + perform acs_rel_type__drop_type ( + 'dotlrn_ta_rel', + 't' + ); + + perform acs_rel_type__drop_type ( + 'dotlrn_ca_rel', + 't' + ); + + perform acs_rel_type__drop_type ( + 'dotlrn_cadmin_rel', + 't' + ); + + perform acs_rel_type__drop_type ( + 'dotlrn_instructor_rel', + 't' + ); + +end; + +drop view dotlrn_instructor_rels_full; +drop table dotlrn_instructor_rels; +drop view dotlrn_cadmin_rels_full; +drop table dotlrn_cadmin_rels; +drop view dotlrn_ca_rels_full; +drop table dotlrn_ca_rels; +drop view dotlrn_ta_rels_full; +drop table dotlrn_ta_rels; +drop view dotlrn_student_rels_full; +drop table dotlrn_student_rels; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-class-memberships-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-class-memberships-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-class-memberships-create.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,218 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- +-- create the dotLRN class membership model +-- +-- @author Ben Adida (ben@openforce.net) +-- @author yon (yon@openforce.net) +-- @author chak (chak@openforce.net) +-- @creation-date 2002-07-01 +-- @version $Id: dotlrn-class-memberships-create.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ +-- + +create table dotlrn_student_rels ( + rel_id integer + constraint dotlrn_student_rels_rel_id_fk + references dotlrn_member_rels (rel_id) + constraint dotlrn_student_rels_rel_id_pk + primary key +); + +create view dotlrn_student_rels_full +as + select dotlrn_member_rels_full.rel_id, + dotlrn_member_rels_full.community_id, + dotlrn_member_rels_full.user_id, + dotlrn_member_rels_full.rel_type, + dotlrn_member_rels_full.role, + dotlrn_member_rels_full.member_state + from dotlrn_member_rels_full, + dotlrn_student_rels + where dotlrn_member_rels_full.rel_id = dotlrn_student_rels.rel_id; + +create table dotlrn_ta_rels ( + rel_id integer + constraint dotlrn_ta_rels_rel_id_fk + references dotlrn_admin_rels (rel_id) + constraint dotlrn_ta_rels_rel_id_pk + primary key +); + +create view dotlrn_ta_rels_full +as + select dotlrn_admin_rels_full.rel_id, + dotlrn_admin_rels_full.community_id, + dotlrn_admin_rels_full.user_id, + dotlrn_admin_rels_full.rel_type, + dotlrn_admin_rels_full.role, + dotlrn_admin_rels_full.member_state + from dotlrn_admin_rels_full, + dotlrn_ta_rels + where dotlrn_admin_rels_full.rel_id = dotlrn_ta_rels.rel_id; + +create table dotlrn_ca_rels ( + rel_id integer + constraint dotlrn_ca_rels_rel_id_fk + references dotlrn_admin_rels (rel_id) + constraint dotlrn_ca_rels_rel_id_pk + primary key +); + +create view dotlrn_ca_rels_full +as + select dotlrn_admin_rels_full.rel_id, + dotlrn_admin_rels_full.community_id, + dotlrn_admin_rels_full.user_id, + dotlrn_admin_rels_full.rel_type, + dotlrn_admin_rels_full.role, + dotlrn_admin_rels_full.member_state + from dotlrn_admin_rels_full, + dotlrn_ca_rels + where dotlrn_admin_rels_full.rel_id = dotlrn_ca_rels.rel_id; + +create table dotlrn_cadmin_rels ( + rel_id integer + constraint dotlrn_cadmin_rels_rel_id_fk + references dotlrn_admin_rels (rel_id) + constraint dotlrn_cadmin_rels_rel_id_pk + primary key +); + +create view dotlrn_cadmin_rels_full +as + select dotlrn_admin_rels_full.rel_id, + dotlrn_admin_rels_full.community_id, + dotlrn_admin_rels_full.user_id, + dotlrn_admin_rels_full.rel_type, + dotlrn_admin_rels_full.role, + dotlrn_admin_rels_full.member_state + from dotlrn_admin_rels_full, + dotlrn_cadmin_rels + where dotlrn_admin_rels_full.rel_id = dotlrn_cadmin_rels.rel_id; + +create table dotlrn_instructor_rels ( + rel_id integer + constraint dotlrn_instructor_rels_rel_fk + references dotlrn_admin_rels(rel_id) + constraint dotlrn_instructor_rels_rel_pk + primary key +); + +create view dotlrn_instructor_rels_full +as + select dotlrn_admin_rels_full.rel_id, + dotlrn_admin_rels_full.community_id, + dotlrn_admin_rels_full.user_id, + dotlrn_admin_rels_full.rel_type, + dotlrn_admin_rels_full.role, + dotlrn_admin_rels_full.member_state + from dotlrn_admin_rels_full, + dotlrn_instructor_rels + where dotlrn_admin_rels_full.rel_id = dotlrn_instructor_rels.rel_id; + + + +begin + perform acs_rel_type__create_type ( + 'dotlrn_student_rel', + 'dotlrn_member_rel', + 'dotLRN Student Community Membership', + 'dotLRN Student Community Memberships', + 'dotlrn_student_rel', + 'dotlrn_student_rels', + 'rel_id', + 'dotlrn_class_instance', + null, + 0, + null, + 'user', + 'student', + 0, + null + ); + + perform acs_rel_type__create_type ( + 'dotlrn_ta_rel', + 'dotlrn_admin_rel', + 'dotLRN Teaching Assistant Community Membership', + 'dotLRN Teaching Assistant Community Memberships', + 'dotlrn_ta_rel', + 'dotlrn_ta_rels', + 'rel_id', + 'dotlrn_class_instance', + null, + 0, + null, + 'user' + 'teaching_assistant', + 0, + null + ); + + perform acs_rel_type__create_type ( + 'dotlrn_ca_rel', + 'dotlrn_admin_rel', + 'dotLRN Course Assitant Community Membership', + 'dotLRN Course Assitant Community Memberships', + 'dotlrn_ca_rel', + 'dotlrn_ca_rels', + 'rel_id', + 'dotlrn_class_instance', role_one => null, + 0, + null, + 'user' + 'course_assistant', + 0, + null + ); + + perform acs_rel_type__create_type ( + 'dotlrn_cadmin_rel', + 'dotlrn_admin_rel', + 'dotLRN Course Administrator Community Membership', + 'dotLRN Course Administrator Community Memberships', + 'dotlrn_cadmin_rel', + 'dotlrn_cadmin_rels', + 'rel_id', + 'dotlrn_class_instance', + null, + 0, + null, + 'user', + 'course_admin', + 0, + null + ); + + perform acs_rel_type__create_type ( + 'dotlrn_instructor_rel', + 'dotlrn_admin_rel', + 'dotLRN Instructor Community Membership', + 'dotLRN Instructor Community Memberships', + 'dotlrn_instructor_rel', + 'dotlrn_instructor_rels', + 'rel_id', + 'dotlrn_class_instance', role_one => null, + 0, + null, + 'user', + 'instructor', + 0, + null + ); +END; +' language 'plpgsql'; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-classes-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-classes-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-classes-create.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-classes-create.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -23,6 +23,7 @@ -- -- @author Ben Adida (ben@openforce.net) -- @author yon (yon@openforce.net) +-- @author dan chak (chak@openforce.net) -- @creation-date 2001-08-18 -- @version $Id$ -- @@ -33,7 +34,7 @@ references dotlrn_community_types (community_type) constraint dotlrn_departments_pk primary key, - external_url varchar(250) + external_url varchar(4000) ); create view dotlrn_departments_full @@ -72,11 +73,13 @@ ); create table dotlrn_classes ( - class_key varchar(100) constraint dotlrn_classes_class_key_fk + class_key varchar(100) + constraint dotlrn_classes_class_key_fk references dotlrn_community_types (community_type) constraint dotlrn_classes_pk primary key, - department_key varchar(100) constraint dotlrn_classes_dept_key_fk + department_key varchar(100) + constraint dotlrn_classes_dept_key_fk references dotlrn_departments (department_key) constraint dotlrn_classes_dept_key_nn not null @@ -98,15 +101,18 @@ where dotlrn_classes.class_key = dotlrn_community_types.community_type; create table dotlrn_class_instances ( - class_instance_id integer constraint dotlrn_ci_class_instance_id_fk + class_instance_id integer + constraint dotlrn_ci_class_instance_id_fk references dotlrn_communities (community_id) constraint dotlrn_class_instances_pk primary key, - class_key varchar(100) constraint dotlrn_ci_class_key_fk + class_key varchar(100) + constraint dotlrn_ci_class_key_fk references dotlrn_classes (class_key) constraint dotlrn_ci_class_key_nn not null, - term_id integer constraint dotlrn_ci_term_id_fk + term_id integer + constraint dotlrn_ci_term_id_fk references dotlrn_terms (term_id) constraint dotlrn_ci_term_id_nn not null @@ -121,15 +127,7 @@ dotlrn_terms.term_year, dotlrn_terms.start_date, dotlrn_terms.end_date, - dotlrn_communities.community_type, - dotlrn_communities.community_key, - dotlrn_communities.pretty_name, - dotlrn_communities.description, - dotlrn_communities.active_start_date, - dotlrn_communities.active_end_date, - dotlrn_communities.portal_id, - dotlrn_communities.portal_template_id, - dotlrn_communities.package_id, + dotlrn_communities.* dotlrn_community__url(dotlrn_communities.community_id) as url, dotlrn_classes_full.pretty_name as class_name, dotlrn_classes_full.url as class_url, @@ -170,15 +168,15 @@ create function dotlrn_department__new(varchar,varchar,varchar,varchar,integer,timestamp,integer,varchar,integer) returns varchar as ' DECLARE - p_department_key alias for $1; - p_pretty_name alias for $2; - p_pretty_plural alias for $3; - p_description alias for $4; - p_package_id alias for $5; - p_creation_date alias for $6; - p_creation_user alias for $7; - p_creation_ip alias for $8; - p_context_id alias for $9; + p_department_key alias for $1; + p_pretty_name alias for $2; + p_pretty_plural alias for $3; + p_description alias for $4; + p_package_id alias for $5; + p_creation_date alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + p_context_id alias for $9; v_department_key dotlrn_departments.department_key%TYPE; BEGIN v_department_key := dotlrn_community_type__new ( @@ -226,16 +224,16 @@ create function dotlrn_class__new(varchar,varchar,varchar,varchar,varchar,integer,timestamp,integer,varchar,integer) returns varchar as ' DECLARE - p_class_key alias for $1; + p_class_key alias for $1; p_department_key alias for $2; - p_pretty_name alias for $3; - p_pretty_plural alias for $4; - p_description alias for $5; - p_package_id alias for $6; - p_creation_date alias for $7; - p_creation_user alias for $8; - p_creation_ip alias for $9; - p_context_id alias for $10; + p_pretty_name alias for $3; + p_pretty_plural alias for $4; + p_description alias for $5; + p_package_id alias for $6; + p_creation_date alias for $7; + p_creation_user alias for $8; + p_creation_ip alias for $9; + p_context_id alias for $10; v_class_key dotlrn_classes.class_key%TYPE; BEGIN v_class_key := dotlrn_community_type__new ( @@ -276,7 +274,7 @@ -select define_function_args('dotlrn_class_instance__new','class_instance_id,class_key,term_id,community_key,pretty_name,description,package_id,portal_id,portal_template_id,join_policy,creation_date,creation_user,creation_ip,context_id'); +select define_function_args('dotlrn_class_instance__new','class_instance_id,class_key,term_id,community_key,pretty_name,description,package_id,portal_id,non_member_portal_id,join_policy,creation_date,creation_user,creation_ip,context_id'); select define_function_args('dotlrn_class_instance__delete','class_instance_id'); @@ -292,7 +290,7 @@ p_description alias for $6; p_package_id alias for $7; p_portal_id alias for $8; - p_portal_template_id alias for $9; + p_non_member_portal_id alias for $9; p_join_policy alias for $10; p_creation_date alias for $11; p_creation_user alias for $12; @@ -308,7 +306,7 @@ p_description, p_package_id, p_portal_id, - p_portal_template_id, + p_non_member_portal_id, p_join_policy, p_creation_date, p_creation_user, Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-classes-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-classes-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-classes-drop.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,39 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- +-- drop the dotLRN classes model +-- +-- @author Ben Adida (ben@openforce.net) +-- @author yon (yon@openforce.net) +-- @author dan chak (chak@openforce.net) +-- @creation-date 2001-08-18 +-- ported to pg 2002-07-01 +-- @version $Id: dotlrn-classes-drop.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ +-- + +select drop_package('dotlrn_class_instance'); +select drop_package('dotlrn_class'); +select drop_package('dotlrn_department'); +drop view dotlrn_class_instances_not_old; +drop view dotlrn_class_instances_current; +drop view dotlrn_class_instances_full; +drop table dotlrn_class_instances; +drop view dotlrn_classes_full; +drop table dotlrn_classes; +drop table dotlrn_terms; +drop view dotlrn_departments_full; +drop table dotlrn_departments; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-clubs-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-clubs-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-clubs-create.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-clubs-create.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -24,12 +24,13 @@ -- -- @author Ben Adida (ben@openforce.net) -- @author yon (yon@openforce.net) +-- @author dan chak (chak@openforce.net) -- @creation-date August 18th, 2001 -- @version $Id$ -- create table dotlrn_clubs ( - club_id integer + club_id integer constraint dotlrn_clubs_club_id_fk references dotlrn_communities (community_id) constraint dotlrn_clubs_pk @@ -39,15 +40,7 @@ create view dotlrn_clubs_full as select dotlrn_clubs.club_id, - dotlrn_communities.community_type, - dotlrn_communities.community_key, - dotlrn_communities.pretty_name, - dotlrn_communities.description, - dotlrn_communities.active_start_date, - dotlrn_communities.active_end_date, - dotlrn_communities.portal_id, - dotlrn_communities.portal_template_id, - dotlrn_communities.package_id, + dotlrn_communities.*, dotlrn_community__url(dotlrn_communities.community_id) as url, groups.join_policy from dotlrn_communities, @@ -57,7 +50,7 @@ and dotlrn_communities.community_id = groups.group_id; -select define_function_args ('dotlrn_club__new','club_id,community_key,pretty_name,description,package_id,portal_id,portal_template_id,join_policy,creation_date,creation_user,creation_ip,context_id'); +select define_function_args ('dotlrn_club__new','club_id,community_key,pretty_name,description,package_id,portal_id,non_member_portal_id,join_policy,creation_date,creation_user,creation_ip,context_id'); select define_function_args ('dotlrn_club__delete','club_id'); @@ -66,29 +59,28 @@ returns integer as ' DECLARE p_club_id alias for $1; - p_community_key alias for $2; - p_pretty_name alias for $3; - p_description alias for $4; - p_package_id alias for $5; - p_portal_id alias for $6; - p_portal_template_id alias for $7; - p_join_policy alias for $8; - p_creation_date alias for $9; - p_creation_user alias for $10; - p_creation_ip alias for $11; - p_context_id alias for $12; + p_community_key alias for $2; + p_pretty_name alias for $3; + p_description alias for $4; + p_package_id alias for $5; + p_portal_id alias for $6; + p_non_member_portal_id alias for $7; + p_join_policy alias for $8; + p_creation_date alias for $9; + p_creation_user alias for $10; + p_creation_ip alias for $11; + p_context_id alias for $12; v_club_id integer; BEGIN v_club_id := dotlrn_community__new( p_club_id, - NULL, ''dotlrn_club'', p_community_key, p_pretty_name, p_description, p_package_id, p_portal_id, - p_portal_template_id, + p_non_member_portal_id, p_join_policy, p_creation_date, p_creation_user, Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-clubs-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-clubs-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-clubs-drop.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,29 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- +-- drop dotLRN clubs model +-- +-- @author Ben Adida (ben@openforce.net) +-- @author yon (yon@openforce.net) +-- @author dan chak (chak@openforce.net) +-- @creation-date August 18th, 2001 +-- @version $Id: dotlrn-clubs-drop.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ +-- + +select drop_package('dotlrn_club'); +drop view dotlrn_clubs_full; +drop table dotlrn_clubs; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-communities-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-create.sql 16 Apr 2002 13:53:52 -0000 1.4 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-create.sql 2 Jul 2002 18:40:08 -0000 1.5 @@ -29,29 +29,34 @@ -- create table dotlrn_community_types ( - community_type varchar(100) constraint dotlrn_ct_community_type_fk + community_type varchar(100) + constraint dotlrn_ct_community_type_fk references group_types (group_type) constraint dotlrn_community_types_pk primary key, + supertype varchar(100) + constraint dotlrn_ct_supertype_fk + references dotlrn_community_types (community_type), + constraint dotlrn_ct_type_supertype_un unique (community_type, supertype), pretty_name varchar(100) constraint dotlrn_ct_pretty_name_nn not null, description varchar(4000), package_id integer constraint dotlrn_ct_package_id_fk references apm_packages (package_id), - supertype varchar(100) constraint dotlrn_ct_supertype_fk - references dotlrn_community_types (community_type), - portal_template_id constraint dotlrn_ct_portal_template_id_fk - references portals (portal_id) + tree_sortkey varbit, + max_child_sortkey varbit ); -create table dotlrn_communities ( - community_id integer constraint dotlrn_c_community_id_fk +create table dotlrn_communities_all ( + community_id integer + constraint dotlrn_c_community_id_fk references groups (group_id) constraint dotlrn_communities_pk primary key, - parent_community_id integer constraint dotlrn_c_parent_comm_id_fk + parent_community_id integer + constraint dotlrn_c_parent_comm_id_fk references dotlrn_communities (community_id), community_type varchar(100) not null constraint dotlrn_c_community_type_fk @@ -65,20 +70,45 @@ description varchar(4000), active_start_date date, active_end_date date, - portal_id integer constraint dotlrn_c_portal_id_fk + archived_p char(1) + default 'f' + constraint dotlrn_c_archived_p_ck + check (archived_p in ('t', 'f')) + constraint dotlrn_c_archived_p_nn + not null, + portal_id integer + constraint dotlrn_c_portal_id_fk references portals (portal_id), - admin_portal_id integer constraint dotlrn_c_admin_portal_id_fk + non_member_portal_id integer + constraint dotlrn_c_non_member_portal_fk references portals (portal_id), - portal_template_id integer constraint dotlrn_c_portal_template_id_fk + admin_portal_id integer + constraint dotlrn_c_admin_portal_id_fk references portals (portal_id), - package_id integer constraint dotlrn_c_package_id_fk + package_id integer + constraint dotlrn_c_package_id_fk references apm_packages (package_id), - -- We can't have two communities with the same parent with the same key (url) - -- even if the parent_community_id is null, which it will be for non-subcommunities - constraint dotlrn_c_community_key_un - unique (community_key, parent_community_id) + font varchar(100) + default '', + font_size integer + default 0, + header_img varchar(100) + default '', + tree_sortkey varbit, + max_child_sortkey varbit ); +create index dtlrn_com_all_com_par_id_idx on dotlrn_communities_all (community_id, parent_community_id; +create index dtlrn_com_all_archived_p_idx on dotlrn_communities_all (archived_p); + +create or replace view dotlrn_communities +as + select dotlrn_communities_all.* + from dotlrn_communities_all + where dotlrn_communities_all.archived_p = 'f'; + + + create view dotlrn_communities_not_closed as select dotlrn_communities.*, @@ -106,8 +136,6 @@ create table dotlrn_applets ( applet_id integer - constraint dotlrn_applets_applet_id_nn - not null constraint dotlrn_applets_applet_pk primary key, applet_key varchar(100) @@ -133,13 +161,16 @@ constraint dotlrn_ca_applet_key_nn not null references dotlrn_applets (applet_id), - constraint dotlrn_community_applets_pk primary key (community_id, applet_id), -- this is the package_id of the package this applet represents package_id integer, active_p char(1) default 't' - constraint dotlrn_ca_active_p_nn - not null constraint dotlrn_ca_active_p_ck check (active_p in ('t','f')) + constraint dotlrn_ca_active_p_nn + not null, + constraint dotlrn_community_applets_pk + primary key (community_id, applet_id) ); + +\i dotlrn-communities-tree-create.sql Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-communities-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-drop.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,38 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- +-- drop the dotLRN communities model +-- +-- @author Ben Adida (ben@openforce.net) +-- @author yon (yon@openforce.net +-- @author arjun (arjun@openforce.net) +-- @author dan chak (chak@openforce.net) +-- @creation-date September 20th, 2001 (redone) +-- ported to pg 2002-07-01 +-- @version $Id: dotlrn-communities-drop.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ +-- + +\i communities-tree-drop.sql; + +drop table dotlrn_community_applets; +drop table dotlrn_applets; +drop view dotlrn_active_comms_not_closed; +drop view dotlrn_active_communities; +drop view dotlrn_communities_not_closed; +drop view dotlrn_communities; +drop table dotlrn_communities_all; +drop table dotlrn_community_types; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-communities-package-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-package-create.sql 29 Mar 2002 20:21:49 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-package-create.sql 2 Jul 2002 18:40:08 -0000 1.2 @@ -24,6 +24,7 @@ -- @author Ben Adida (ben@openforce.net) -- @author yon (yon@openforce.net -- @author arjun (arjun@openforce.net) +-- @author dan chak (chak@openforce.net) -- @creation-date September 20th, 2001 (redone) -- @version $Id$ -- @@ -37,11 +38,11 @@ create function dotlrn_community_type__new (varchar,varchar,varchar,varchar,varchar) returns varchar as ' DECLARE - p_community_type alias for $1; - p_parent_type alias for $2; - p_pretty_name alias for $3; - p_pretty_plural alias for $4; - p_description alias for $5; + p_community_type alias for $1; + p_parent_type alias for $2; + p_pretty_name alias for $3; + p_pretty_plural alias for $4; + p_description alias for $5; BEGIN return dotlrn_community_type__new( p_community_type, @@ -85,13 +86,13 @@ from dual; PERFORM acs_object_type__create_type ( + v_parent_object_type, p_community_type, p_community_type, p_community_type, - v_parent_object_type, - ''dotlrn_communities'', - ''community_id'', v_unique_name, + v_unique_name, + v_unique_name, ''acs_group.name'' ); @@ -103,9 +104,17 @@ insert into dotlrn_community_types - (community_type, pretty_name, description, package_id, supertype) + (community_type, + pretty_name, + description, + package_id, + supertype) values - (p_community_type, p_pretty_name, p_description, p_package_id, p_parent_type); + (p_community_type, + p_pretty_name, + p_description, + p_package_id, + p_parent_type); return p_community_type; END; @@ -131,15 +140,21 @@ returns varchar as ' DECLARE p_community_type alias for $1; + v_name dotlrn_community_types.pretty_name%TYPE; BEGIN - return name from dotlrn_community_types where community_type= p_community_type; + select dotlrn_community_types.pretty_name + into v_name + from dotlrn_community_types + where dotlrn_community_types.community_type = p_community_type; + + return v_name; END; ' language 'plpgsql'; -- dotlrn_community -select define_function_args('dotlrn_community__new','community_id,parent_community_id,community_id,community_key,pretty_name,description,portal_id,portal_template_id,package_id,join_policy,creation_date,creation_user,creation_ip,context_id'); +select define_function_args('dotlrn_community__new','community_id,parent_community_id,community_type,community_key,pretty_name,description,portal_id,non_member_portal_id,package_id,join_policy,creation_date,creation_user,creation_ip,context_id'); select define_function_args('dotlrn_community__set_active_dates','community_id,start_date,end_date'); @@ -154,36 +169,35 @@ select define_function_args('dotlrn_community__url','community_id'); -create function dotlrn_community__new(integer,integer,varchar,varchar,varchar,varchar,integer,integer,integer,varchar,timestamp,integer,varchar,integer) +create function dotlrn_community__new(integer,integer,varchar,varchar,varchar,varchar,varchar,integer,integer,integer,varchar,timestamp,integer,varchar,integer) returns integer as ' DECLARE - p_community_id alias for $1; - p_parent_community_id alias for $2; + p_community_id alias for $1; + p_parent_community_id alias for $2; p_community_type alias for $3; - p_community_key alias for $4; - p_pretty_name alias for $5; - p_description alias for $6; - p_portal_id alias for $7; - p_portal_template_id alias for $8; - p_package_id alias for $9; - p_join_policy alias for $10; - p_creation_date alias for $11; - p_creation_user alias for $12; - p_creation_ip alias for $13; - p_context_id alias for $14; - c_id integer; + p_community_key alias for $4; + p_pretty_name alias for $5; + p_description alias for $6; + archived_p alias for $7 + p_portal_id alias for $8; + p_non_member_portal_id alias for $9; + p_package_id alias for $10; + p_join_policy alias for $11; + p_creation_date alias for $12; + p_creation_user alias for $13; + p_creation_ip alias for $14; + p_context_id alias for $15; + c_id integer; BEGIN c_id := acs_group__new ( + p_context_id, p_community_id, p_community_type, p_creation_date, p_creation_user, p_creation_ip, - NULL, - NULL, p_community_key, p_join_policy - p_context_id, ); insert into dotlrn_communities @@ -204,8 +218,10 @@ p_pretty_name, p_description, p_package_id, - p_portal_id, - p_portal_template_id); + p_portal_id, + p_archived_p, + p_portal_id, + p_non_member_portal_id); return c_id; END; @@ -215,11 +231,11 @@ create function dotlrn_community__set_active_dates(integer,date,date) returns integer as ' DECLARE - p_community_id alias for $1; - p_start_date alias for $2; + p_community_id alias for $1; + p_start_date alias for $2; p_end_date alias for $3; BEGIN - update dotlrn_communities + update dotlrn_communities_all set active_start_date = p_start_date, active_end_date = p_end_date where community_id = p_community_id; @@ -256,30 +272,46 @@ create function dotlrn_community__member_p(integer,integer) returns boolean as ' DECLARE - p_community_id alias for $1; + p_community_id alias for $1; p_party_id alias for $2; + v_member_p char(1); BEGIN - -- to do (ben) - return ''t''; + select CASE + WHEN count(*) = 0 + THEN 'f' + ELSE 't' + END + into v_member_p + from dual + where exists (select 1 + from dotlrn_member_rels_approved + where dotlrn_member_rels_approved.user_id = dotlrn_community.member_p.party_id + and dotlrn_member_rels_approved.community_id = dotlrn_community.member_p.community_id); + + return v_member_p; + END; ' language 'plpgsql'; create function dotlrn_community__admin_p(integer,integer) returns boolean as ' DECLARE - p_community_id alias for $1; + p_community_id alias for $1; p_party_id alias for $2; + v_rv char(1); BEGIN - IF acs_permission__permission_p(p_community_id, p_party_id, ''dotlrn_admin_community'') = ''t'' - then return ''t''; - end if; + -- THIS NEEDS TO BE CHECKED! + -- chak, 2002-07-01 + select CASE + WHEN acs_permission__permission_p(p_community_id, p_party_id, ''dotlrn_admin_community'') = ''f'' + THEN acs_permission__permission_p(p_community_id,p_party_id,''admin'') + ELSE ''t'' + END + into r_rv + from dual; - IF acs_permission__permission_p(p_community_id, p_party_id, ''admin'') = ''t'' - then return ''t''; - end if; - - return ''f''; + return r_rv; END; ' language 'plpgsql'; @@ -288,16 +320,42 @@ returns varchar as ' DECLARE p_community_id alias for $1; + v_node_id site_nodes.node_id%TYPE; BEGIN - return site_node__url(site_nodes.node_id) - from dotlrn_communities, + select site_nodes.node_id into v_node_id + from dotlrn_communities_all, site_nodes - where dotlrn_communities.community_id = p_community_id - and site_nodes.object_id = dotlrn_communities.package_id; + where dotlrn_communities_all.community_id = p_community_id + and site_nodes.object_id = dotlrn_communities_all.package_id; + + return v_node_id; + + exception + when no_data_found then + return ''; END; ' language 'plpgsql'; +create dotlrn_community__function has_subcomm_p(integer) +returns varchar as ' +DECLARE + p_community_id alias for $1; + v_rv char(1); +BEGIN + select CASE + WHEN count(*) = 0 + THEN 'f' + ELSE 't' + END + into r_rv + from dual + where dotlrn_communities_all.community_id = p_community_id; + + return r_rv; +END; +' language 'plpgsql'; + create view dotlrn_communities_full as select dotlrn_communities.*, Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-communities-package-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-package-drop.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,22 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- +-- @author dan chak (chak@openforce.net) +-- @creation-date 2001-08-18 +-- @version $Id: dotlrn-communities-package-drop.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ + +drop view dotlrn_communities_full; +perform drop_package('dotlrn_community'); +perform drop_package('dotlrn_community_type'); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-tree-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-communities-tree-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-tree-create.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,101 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +create function dotlrn_community_types_in_tr() +returns opaque as ' +declare + v_parent_sortkey dotlrn_community_types.tree_sortkey%TYPE; + v_max_child_sortkey dotlrn_community_types.max_child_sortkey%TYPE; +begin + + if new.supertype is null then + -- if this is the root community_type we leave it''s sortkey as null + return; + else + -- else get the max_child_sortkey of the parent community_type + select tree_sortkey, max_child_sortkey + into v_parent_sortkey, v_max_child_sortkey + from dotlrn_community_types + where community_type = new.supertype + for update; + end if; + + -- increment the sort_key + v_max_child_sortkey := tree_increment_key(v_max_child_sortkey); + + update dotlrn_community_types + set max_child_sortkey = v_max_child_sortkey + where community_type = new.supertype; + + -- generate the sortkey for the current row + new.tree_sortkey := v_parent_sortkey || v_max_child_sortkey; + + return new; +end;' language 'plpgsql'; + +create trigger dotlrn_community_types_in_tr +before insert on dotlrn_community_types +for each row +execute procedure dotlrn_community_types_in_tr(); + + +create function dotlrn_communities_in_tr() +returns opaque as ' +declare + v_parent_sortkey dotlrn_communities_all.tree_sortkey%TYPE; + v_max_child_sortkey dotlrn_communities_all.max_child_sortkey%TYPE; +begin + + if new.parent_community_id is null then + -- if this is the root community we get the sortkey from it''s parent + -- community_type + select tree_sortkey, max_child_sortkey + into v_parent_sortkey, v_max_child_sortkey + from dotlrn_community_types + where community_type = new.community_type + for update; + else + -- else get the max_child_sortkey of the parent community_type + select tree_sortkey, max_child_sortkey + into v_parent_sortkey, v_max_child_sortkey + from dotlrn_communities_all + where community_id = new.parent_community_id + for update; + end if; + + -- increment the sort_key + v_max_child_sortkey := tree_increment_key(v_max_child_sortkey); + + if new.parent_community_id is null then + update dotlrn_community_types + set max_child_sortkey = v_max_child_sortkey + where community_type = new.community_type; + else + update dotlrn_communities_all + set max_child_sortkey = v_max_child_sortkey + where community_id = new.parent_community_id; + end if; + + -- generate the sortkey for the current row + new.tree_sortkey := v_parent_sortkey || v_max_child_sortkey; + + return new; +end;' language 'plpgsql'; + +create trigger dotlrn_communities_in_tr +before insert on dotlrn_communities_all +for each row +execute procedure dotlrn_community_types_in_tr(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-tree-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-communities-tree-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-tree-drop.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,21 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- drop the dotLRN communities tree model +-- @author dan chak (chak@openforce.net) + +drop trigger dotlrn_communities_in_tr; +drop trigger dotlrn_community_types_in_tr; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-community-membership-packages-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-community-membership-packages-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-community-membership-packages-drop.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,33 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- +-- drop the dotLRN memberships packages +-- +-- @author Ben Adida (ben@openforce.net) +-- @author dan chak (chak@openforce.net) +-- @creation-date 2001-11-06 +-- PG Port 2002-07-01 +-- @version $Id: dotlrn-community-membership-packages-drop.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ +-- + +select drop_package('dotlrn_cadmin_rel'); +select drop_package('dotlrn_ca_rel'); +select drop_package('dotlrn_ta_rel'); +select drop_package('dotlrn_instructor_rel'); +select drop_package('dotlrn_student_rel'); +select drop_package('dotlrn_admin_rel'); +select drop_package('dotlrn_member_rel'); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-community-memberships-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-community-memberships-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-community-memberships-create.sql 21 May 2002 07:46:02 -0000 1.3 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-community-memberships-create.sql 2 Jul 2002 18:40:08 -0000 1.4 @@ -35,9 +35,6 @@ references membership_rels (rel_id) constraint dotlrn_member_rels_rel_id_pk primary key, - portal_id integer - constraint dotlrn_member_rels_portal_fk - references portals (portal_id) ); create view dotlrn_member_rels_full @@ -49,7 +46,6 @@ (select acs_rel_types.role_two from acs_rel_types where acs_rel_types.rel_type = acs_rels.rel_type) as role, - dotlrn_member_rels.portal_id, membership_rels.member_state from dotlrn_member_rels, acs_rels, @@ -78,239 +74,9 @@ dotlrn_member_rels_full.user_id, dotlrn_member_rels_full.rel_type, dotlrn_member_rels_full.role, - dotlrn_member_rels_full.portal_id, dotlrn_member_rels_full.member_state from dotlrn_member_rels_full, dotlrn_admin_rels where dotlrn_member_rels_full.rel_id = dotlrn_admin_rels.rel_id; -- --- For Classes --- - -create table dotlrn_student_rels ( - rel_id integer - constraint dotlrn_student_rels_rel_id_fk - references dotlrn_member_rels (rel_id) - constraint dotlrn_student_rels_rel_id_pk - primary key -); - -create view dotlrn_student_rels_full -as - select dotlrn_member_rels_full.rel_id, - dotlrn_member_rels_full.community_id, - dotlrn_member_rels_full.user_id, - dotlrn_member_rels_full.rel_type, - dotlrn_member_rels_full.role, - dotlrn_member_rels_full.portal_id, - dotlrn_member_rels_full.member_state - from dotlrn_member_rels_full, - dotlrn_student_rels - where dotlrn_member_rels_full.rel_id = dotlrn_student_rels.rel_id; - -create table dotlrn_ta_rels ( - rel_id integer - constraint dotlrn_ta_rels_rel_id_fk - references dotlrn_admin_rels (rel_id) - constraint dotlrn_ta_rels_rel_id_pk - primary key -); - -create view dotlrn_ta_rels_full -as - select dotlrn_admin_rels_full.rel_id, - dotlrn_admin_rels_full.community_id, - dotlrn_admin_rels_full.user_id, - dotlrn_admin_rels_full.rel_type, - dotlrn_admin_rels_full.role, - dotlrn_admin_rels_full.portal_id, - dotlrn_admin_rels_full.member_state - from dotlrn_admin_rels_full, - dotlrn_ta_rels - where dotlrn_admin_rels_full.rel_id = dotlrn_ta_rels.rel_id; - -create table dotlrn_ca_rels ( - rel_id integer - constraint dotlrn_ca_rels_rel_id_fk - references dotlrn_admin_rels (rel_id) - constraint dotlrn_ca_rels_rel_id_pk - primary key -); - -create view dotlrn_ca_rels_full -as - select dotlrn_admin_rels_full.rel_id, - dotlrn_admin_rels_full.community_id, - dotlrn_admin_rels_full.user_id, - dotlrn_admin_rels_full.rel_type, - dotlrn_admin_rels_full.role, - dotlrn_admin_rels_full.portal_id, - dotlrn_admin_rels_full.member_state - from dotlrn_admin_rels_full, - dotlrn_ca_rels - where dotlrn_admin_rels_full.rel_id = dotlrn_ca_rels.rel_id; - -create table dotlrn_cadmin_rels ( - rel_id integer - constraint dotlrn_cadmin_rels_rel_id_fk - references dotlrn_admin_rels (rel_id) - constraint dotlrn_cadmin_rels_rel_id_pk - primary key -); - -create view dotlrn_cadmin_rels_full -as - select dotlrn_admin_rels_full.rel_id, - dotlrn_admin_rels_full.community_id, - dotlrn_admin_rels_full.user_id, - dotlrn_admin_rels_full.rel_type, - dotlrn_admin_rels_full.role, - dotlrn_admin_rels_full.portal_id, - dotlrn_admin_rels_full.member_state - from dotlrn_admin_rels_full, - dotlrn_cadmin_rels - where dotlrn_admin_rels_full.rel_id = dotlrn_cadmin_rels.rel_id; - -create table dotlrn_instructor_rels ( - rel_id integer - constraint dotlrn_instructor_rels_rel_fk - references dotlrn_admin_rels(rel_id) - constraint dotlrn_instructor_rels_rel_pk - primary key -); - -create view dotlrn_instructor_rels_full -as - select dotlrn_admin_rels_full.rel_id, - dotlrn_admin_rels_full.community_id, - dotlrn_admin_rels_full.user_id, - dotlrn_admin_rels_full.rel_type, - dotlrn_admin_rels_full.role, - dotlrn_admin_rels_full.portal_id, - dotlrn_admin_rels_full.member_state - from dotlrn_admin_rels_full, - dotlrn_instructor_rels - where dotlrn_admin_rels_full.rel_id = dotlrn_instructor_rels.rel_id; - --- --- Object Types and Attributes --- - -select acs_rel_type__create_type ( - 'dotlrn_member_rel', - 'dotLRN Community Membership', - 'dotLRN Community Memberships', - 'membership_rel', - 'dotlrn_member_rels', - 'rel_id', - 'dotlrn_member_rel', - 'dotlrn_community', null, - 0, null, - 'user', 'member', - 0, null - ); - - select acs_rel_type__create_type ( - 'dotlrn_admin_rel', - 'dotLRN Admin Community Membership', - 'dotLRN Admin Community Memberships', - 'dotlrn_member_rel', - 'dotlrn_admin_rels', - 'rel_id', - 'dotlrn_admin_rel', - 'dotlrn_community', null, - 0, null, - 'user', 'admin', - 0, null - ); - - select acs_rel_type__create_type ( - 'dotlrn_student_rel', - 'dotLRN Student Community Membership', - 'dotLRN Student Community Memberships', - 'dotlrn_member_rel', - 'dotlrn_student_rels', - 'rel_id', - 'dotlrn_student_rel', - 'dotlrn_class_instance', null, - 0, null, - 'user', 'student', - 0, null - ); - - select acs_rel_type__create_type ( - 'dotlrn_ta_rel', - 'dotLRN Teaching Assistant Community Membership', - 'dotLRN Teaching Assistant Community Memberships', - 'dotlrn_admin_rel', - 'dotlrn_ta_rels', - 'rel_id', - 'dotlrn_ta_rel', - 'dotlrn_class_instance', null, - 0, null, - 'user', 'teaching_assistant', - 0, null - ); - - select acs_rel_type__create_type ( - 'dotlrn_ca_rel', - 'dotLRN Course Assitant Community Membership', - 'dotLRN Course Assitant Community Memberships', - 'dotlrn_admin_rel', - 'dotlrn_ca_rels', - 'rel_id', - 'dotlrn_ca_rel', - 'dotlrn_class_instance', null, - 0, null, - 'user', 'course_assistant', - 0, null - ); - - select acs_rel_type__create_type ( - 'dotlrn_cadmin_rel', - 'dotlrn_admin_rel', - 'dotLRN Course Administrator Community Membership', - 'dotLRN Course Administrator Community Memberships', - 'dotlrn_cadmin_rel', - 'dotlrn_cadmin_rels', - 'rel_id', - 'dotlrn_class_instance', null, - 0, null, - 'user', 'course_admin', - 0, null - ); - - select acs_rel_type__create_type ( - 'dotlrn_instructor_rel', - 'dotLRN Instructor Community Membership', - 'dotLRN Instructor Community Memberships', - 'dotlrn_admin_rel', - 'dotlrn_instructor_rels', - 'rel_id', - 'dotlrn_instructor_rel', - 'dotlrn_class_instance', null, - 0, null, - 'user', 'instructor', - 0, null - ); - - -- - -- and now for the attributes - -- - select acs_attribute__create_attribute ( - 'dotlrn_member_rel', - 'portal_id', - 'integer', - 'Page ID', - 'Page IDs', - NULL, - NULL, - NULL, - 1, - 1, - NULL, - 'type_specific', - 'f' - ); -end; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-community-memberships-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-community-memberships-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-community-memberships-drop.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,32 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- +-- drop the dotLRN communities membership model +-- +-- @author Ben Adida (ben@openforce.net) +-- @author yon (yon@openforce.net) +-- @author dan chak (chak@openforce.net) +-- @creation-date November 6th, 2001 +-- porting to PG 2002-07-01 +-- @version $Id: dotlrn-community-memberships-drop.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ +-- + +drop view dotlrn_admin_rels_full; +drop table dotlrn_admin_rels; +drop view dotlrn_member_rels_approved; +drop view dotlrn_member_rels_full; +drop table dotlrn_member_rels; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/dotlrn-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-create.sql 29 Mar 2002 20:21:49 -0000 1.4 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-create.sql 2 Jul 2002 18:40:08 -0000 1.5 @@ -26,6 +26,7 @@ -- \i dotlrn-users-create.sql +\i dotlrn-portal-types-create.sql \i dotlrn-communities-create.sql \i dotlrn-clubs-create.sql \i dotlrn-classes-create.sql Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-dotlrn-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-dotlrn-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-dotlrn-drop.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,38 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- +-- drop the dotLRN model +-- +-- @author dan chak (chak@openforce.net) +-- @creation-date 2001-08-18 +-- @version $Id: dotlrn-dotlrn-drop.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ +-- + +\i dotlrn-user-extension-drop.sql +\i dotlrn-security-drop.sql +\i dotlrn-main-portlet-drop.sql +\i dotlrn-community-memberships-packages-drop.sql +\i dotlrn-applet-sc-drop.sql +\i dotlrn-class-memberships-drop.sql +\i dotlrn-classes-drop.sql +\i dotlrn-clubs-drop.sql +\i dotlrn-dotlrn-sanitize.sql +\i dotlrn-communities-package-drop.sql +\i dotlrn-community-memberships-drop.sql +\i dotlrn-communities-drop.sql +\i dotlrn-portal-types-drop.sql +\i dotlrn-users-drop.sql Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-dotlrn-sanitize.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-dotlrn-sanitize.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-dotlrn-sanitize.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,178 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- +-- sanitize dotLRN +-- +-- @author Ben Adida (ben@openforce.net) +-- @author dan chak (chak@openforce.net) +-- @creation-date 2001-09-25 +-- ported 2002-07-01 +-- @version $Id: dotlrn-dotlrn-sanitize.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ +-- +-- @note We remember September 11th, 2001 +-- + +begin + + perform acs_rel_type__drop_type( + 'dotlrn_admin_rel', + 't' + ); + + -- all rels to communities must have a portal_id + perform acs_attribute__drop_attribute( + 'dotlrn_member_rel', + 'portal_id' + ); + + -- drop basic rel_types + perform acs_rel_type__drop_type( + 'dotlrn_member_rel', + 't' + ); + + -- drop roles + perform acs_rel_type__drop_role( + 'student' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'student_pretty_name' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'student_pretty_plural' + ); + + perform acs_rel_type__drop_role( + 'course_assistant' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'course_assistant_pretty_name' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'course_assistant_pretty_plural' + ); + + perform acs_rel_type__drop_role( + 'teaching_assistant' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'teaching_assistant_pretty_name' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'teaching_assistant_pretty_plural' + ); + + perform acs_rel_type__drop_role( + 'instructor' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'instructor_pretty_name' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'instructor_pretty_plural' + ); + + perform acs_rel_type__drop_role( + 'course_admin' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'course_admin_pretty_name' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'course_admin_pretty_plural' + ); + + perform acs_rel_type__drop_role( + 'admin' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'admin_pretty_name' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'admin_pretty_plural' + ); + + -- drop the dotlrn_club community type + dotlrn_community_type__delete( + 'dotlrn_club' + ); + + -- drop the dotlrn_class community type + dotlrn_community_type__delete( + 'dotlrn_class_instance' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'header_font' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'header_font_size' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'header_font_color' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'header_logo_item_id' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'member_pretty_name' + ); + + perform acs_attribute__drop_attribute( + 'dotlrn_community', + 'member_pretty_plural' + ); + + -- drop the base community type + perform dotlrn_community_type__delete( + 'dotlrn_community' + ); + +end; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-external-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-external-profile-provider-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-external-profile-provider-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-external-profile-provider-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,49 +18,56 @@ -- Implementation of the profile provider interface for dotLRN Externals. -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- +create function inline_0() +returns integer as ' declare foo integer; begin -- drop the binding between this implementation and the interface it -- implements. - acs_sc_binding.delete( - contract_name => 'profile_provider', - impl_name => 'dotlrn_external_profile_provider' + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotlrn_external_profile_provider'' ); -- drop the bindings to the method implementations -- name method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_external_profile_provider', - impl_operation_name => 'name' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_external_profile_provider'', + ''name'' ); -- prettyName method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_external_profile_provider', - impl_operation_name => 'prettyName' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_external_profile_provider'', + ''prettyName'' ); -- render method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_external_profile_provider', - impl_operation_name => 'render' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_external_profile_provider'', + ''render'' ); -- drop the implementation - acs_sc_impl.delete( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_external_profile_provider' + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotlrn_external_profile_provider'' ); + + return 0; end; -/ -show errors +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-externals-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-create.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-create.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -23,20 +23,12 @@ create table dotlrn_external_profile_rels ( rel_id integer - constraint dotlrn_ext_rels_rel_id_fk + constraint dotlrn_external_p_rels_rel_fk references dotlrn_user_profile_rels (rel_id) - constraint dotlrn_ext_profile_rels_pk + constraint dotlrn_external_p_rels_pk primary key ); -create table dotlrn_full_ext_profile_rels ( - rel_id integer - constraint dotlrn_fe_prfl_rels_rel_fk - references dotlrn_full_user_profile_rels (rel_id) - constraint dotlrn_fe_prfl_rels_pk - primary key -); - \i dotlrn-external-profile-provider-create.sql \i dotlrn-externals-init.sql \i dotlrn-externals-package-create.sql Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-externals-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,12 +18,12 @@ -- Drop the dotLRN Externals package -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- -@@ dotlrn-externals-package-drop.sql -@@ dotlrn-externals-sanitize.sql -@@ dotlrn-external-profile-provider-drop.sql +\i dotlrn-externals-package-drop.sql +\i dotlrn-externals-sanitize.sql +\i dotlrn-external-profile-provider-drop.sql -drop table dotlrn_full_ext_profile_rels; drop table dotlrn_external_profile_rels; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-externals-init.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-init.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-init.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -31,13 +31,12 @@ begin PERFORM acs_rel_type__create_type( + ''dotlrn_user_profile_rel'', + ''dotLRN Profile External'', + ''dotLRN External Externals'', ''dotlrn_external_profile_rel'', - ''dotLRN External Profile Membership'', - ''dotLRN External Profile Memberships'', - ''dotlrn_user_profile_rel'', ''dotlrn_external_profile_rels'', ''rel_id'', - ''dotlrn_external_profile_rel'', ''profiled_group'', null, 0, @@ -65,7 +64,7 @@ (''external'', ''External'', group_id); foo := rel_segment__new( - ''dotLRN Profiled Externals'', + ''dotLRN Externals'', group_id, ''dotlrn_external_profile_rel'' ); @@ -86,45 +85,3 @@ select inline_1(); drop function inline_1(); - -create function inline_2() -returns integer as ' -declare - foo integer; -begin - PERFORM acs_rel_type--create_type( - ''dotlrn_full_external_profile_rel'', - ''dotLRN Full External Profile Membership'', - ''dotLRN Full External Profile Memberships'', - ''dotlrn_full_user_profile_rel'', - ''dotlrn_full_external_profile_rels'', - ''rel_id'', - ''dotlrn_full_external_profile_rel'', - ''profiled_group'', - null, - 0, - null, - ''user'', - null, - 0, - 1 - ); - - select min(group_id) - into foo - from profiled_groups - where profile_provider = (select min(impl_id) - from acs_sc_impls - where impl_name = ''dotlrn_external_profile_provider''); - - foo := rel_segment__new( - ''dotLRN Full Profiled Externals'', - foo, - ''dotlrn_full_external_profile_rel'' - ); - -end; -' language 'plpgsql'; - -select inline_2(); -drop function inline_2(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-externals-package-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-package-create.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-package-create.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -26,18 +26,20 @@ select define_function_args ('dotlrn_external_profile_rel__delete','rel_id'); -create function dotlrn_external_profile_rel__new(integer,varchar,varchar,integer,integer,integer,varchar) +create function dotlrn_external_profile_rel__new(integer,integer,integer,integer,integer,varchar,integer,integer,varchar) returns integer as ' DECLARE - p_rel_id alias for $1; - p_id alias for $2; - p_rel_type alias for $3; - p_group_id alias for $4; - p_user_id alias for $5; - p_creation_user alias for $6; - p_creation_ip alias for $7; - v_rel_id dotlrn_user_profile_rels.rel_id%TYPE; - v_group_id groups.group_id%TYPE; + p_rel_id alias for $1; + p_user_id alias for $2; + p_portal_id alias for $3; + p_theme_id alias for $4; + p_id alias for $5; + p_rel_type alias for $6; + p_group_id alias for $7; + p_creation_user alias for $8; + p_creation_ip alias for $9; + v_rel_id dotlrn_user_profile_rels.rel_id%TYPE; + v_group_id groups.group_id%TYPE; BEGIN if p_group_id is null then select min(group_id) @@ -52,10 +54,12 @@ v_rel_id := dotlrn_user_profile_rel__new( p_rel_id, - p_id, + p_user_id, + p_portal_id, + p_theme_id, + p_id, p_rel_type, v_group_id, - p_user_id, p_creation_user, p_creation_ip ); @@ -85,73 +89,3 @@ END; ' language 'plpgsql'; - --- full externals - -select define_function_args('dotlrn_full_external_profile_rel__new','rel_id,portal_id,theme_id,id,rel_type,group_id,user_id,creation_user,creation_ip'); - -select define_function_args('dotlrn_full_external_profile_rel__delete','rel_id'); - - -create function dotlrn_full_external_profile_rel__new(integer,integer,integer,varchar,varchar,integer,integer,integer,varchar) -returns integer as ' -DECLARE - p_rel_id alias for $1; - p_portal_id alias for $2; - p_theme_id alias for $3; - p_id alias for $4; - p_rel_type alias for $5; - p_group_id alias for $6; - p_user_id alias for $7; - p_creation_user alias for $8; - p_creation_ip alias for $9; - v_rel_id dotlrn_full_user_profile_rels.rel_id%TYPE; - v_group_id groups.group_id%TYPE; -BEGIN - if p_group_id is null then - select min(group_id) - into v_group_id - from profiled_groups - where profile_provider = (select min(impl_id) - from acs_sc_impls - where impl_name = ''dotlrn_external_profile_provider''); - else - v_group_id := p_group_id; - end if; - - v_rel_id := dotlrn_full_user_profile_rel__new( - p_rel_id, - p_portal_id, - p_theme_id, - p_id, - p_rel_type, - v_group_id, - p_user_id, - p_creation_user, - p_creation_ip - ); - - insert - into dotlrn_full_external_profile_rels - (rel_id) - values - (v_rel_id); - - return v_rel_id; -END; -' language 'plpgsql'; - - -create function dotlrn_full_external_profile_rel__delete(integer) -returns integer as ' -DECLARE - p_rel_id alias for $1; -BEGIN - delete - from dotlrn_full_external_profile_rels - where rel_id = p_rel_id; - - PERFORM dotlrn_full_user_profile_rel__delete(p_rel_id); - return(0); -END; -' language 'plpgsql'; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-externals-package-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-package-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-package-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,8 +18,8 @@ -- Create the dotLRN Externals package -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- -drop package dotlrn_full_ext_profile_rel; -drop package dotlrn_external_profile_rel; +select drop_package('dotlrn_external_profile_rel'); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-sanitize.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-externals-sanitize.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-sanitize.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-sanitize.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,64 +18,76 @@ -- Sanitize the dotLRN External package -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- +create function inline_0() +returns integer as ' declare foo integer; begin select min(segment_id) into foo from rel_segments - where segment_name = 'dotLRN Full Profiled Externals'; + where segment_name = ''dotLRN Full Profiled Externals''; - rel_segment.delete( - segment_id => foo + perform rel_segment__delete( + foo ); - acs_rel_type.drop_type( - rel_type => 'dotlrn_full_external_profile_rel', - cascade_p => 't' + perform acs_rel_type__drop_type( + ''dotlrn_full_external_profile_rel'', + ''t'' ); -end; -/ -show errors + return 0; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + +create function inline_1() +returns integer as ' declare foo integer; begin select min(segment_id) into foo from rel_segments - where segment_name = 'dotLRN Profiled Externals'; + where segment_name = ''dotLRN Profiled Externals''; - rel_segment.delete( - segment_id => foo + perform rel_segment__delete( + foo ); select min(group_id) into foo from profiled_groups where profile_provider = (select min(impl_id) from acs_sc_impls - where impl_name = 'dotlrn_external_profile_provider'); + where impl_name = ''dotlrn_external_profile_provider''); delete from dotlrn_user_types where group_id = foo; - profiled_group.delete( - group_id => foo + perform profiled_groupd__delete( + foo ); - acs_rel_type.drop_type( - rel_type => 'dotlrn_external_profile_rel', - cascade_p => 't' + perform acs_rel_type__drop_type( + ''dotlrn_external_profile_rel'', + ''t'' ); + return 0; + end; -/ -show errors +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/dotlrn-init.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-init.sql 29 Mar 2002 19:59:46 -0000 1.3 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-init.sql 2 Jul 2002 18:40:08 -0000 1.4 @@ -22,23 +22,83 @@ -- -- for PostgreSQL v7.1 and above -- --- ben@openforce.net --- September 25th, 2001 --- we remember September 11th, 2001 +-- @author Ben Adida (ben@openforce.net) +-- @author dan chak (chak@openforce.net) +-- @creation-date 2001-09-25 +-- @version $Id$ -- +-- @note We remember September 11th, 2001 +-- begin -- Create the base community type - select dotlrn_community_type__new( + perform dotlrn_community_type__new( 'dotlrn_community', null, 'Community', 'Communities', 'Communities - the base community type' ); + -- these are the possible attributes of a community + perform acs_attribute__create_attribute( + 'dotlrn_community', + 'header_font', + 'string', + 'Header Font', + 'Header Fonts', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_attribute( + 'dotlrn_community', + 'header_font_size', + 'string', + 'Header Fon Sizet', + 'Header Fonts Sizes', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_attribute( + 'dotlrn_community', + 'header_font_color', + 'string', + 'Header Font Color', + 'Header Fonts Colors', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_attribute( + 'dotlrn_community', + 'header_logo_item_id', + 'integer', + 'Header Logo Item ID', + 'Header Logo Item ID', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_attribute( + 'dotlrn_community', + 'header_logo_alt_text', + 'integer', + 'Header Logo Alt Text', + 'Header Logo Alt Text', + 0, + 1, + 'generic' + ); + + -- create the dotlrn_class community type - select dotlrn_community_type__new( + perform dotlrn_community_type__new( 'dotlrn_class_instance', 'dotlrn_community', 'Class', @@ -59,11 +119,212 @@ update acs_object_types set table_name = 'dotlrn_class_instance', package_name = 'dotlrn_class_instance' where object_type = 'dotlrn_class_instance'; update acs_object_types set table_name = 'dotlrn_club', package_name = 'dotlrn_club' where object_type = 'dotlrn_club'; + perform acs_attribute__create_atribute( + 'dotlrn_community', + 'member_pretty_name', + 'string', + 'Member Pretty Name', + 'Member Pretty Name', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_atribute( + 'dotlrn_community', + 'member_pretty_plural', + 'string', + 'Member Pretty Plural', + 'Member Pretty Plural', + 0, + 1, + 'generic' + ); + -- create roles acs_rel_type__create_role('student', 'Student', 'Students'); acs_rel_type__create_role('course_assistant', 'Course Assistant', 'Course Assistants'); acs_rel_type__create_role('teaching_assistant', 'Teaching Assistant', 'Teaching Assistants'); acs_rel_type__create_role('instructor', 'Professor', 'Professors'); acs_rel_type__create_role('course_admin', 'Course Administrator', 'Course Administrators'); acs_rel_type__create_role('admin', 'Administrator', 'Administrators'); + + perform acs_attribute__create_atribute ( + 'dotlrn_community', + 'student_pretty_name', + 'string', + 'Student Pretty Name', + 'Student Pretty Name', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_atribute ( + 'dotlrn_community', + 'student_pretty_plural', + 'string', + 'Student Pretty Plural', + 'Student Pretty Plural', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_atribute ( + 'dotlrn_community', + 'course_assistant_pretty_name', + 'string', + 'Course Assistant Pretty Name', + 'Course Assistant Pretty Name', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_atribute ( + 'dotlrn_community', + 'course_assistant_pretty_plural', + 'string', + 'Course Assistant Pretty Plural', + 'Course Assistant Pretty Plural', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_atribute ( + 'dotlrn_community', + 'teaching_assistant_pretty_name', + 'string', + 'Teaching Assistant Pretty Name', + 'Teaching Assistant Pretty Name', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_atribute ( + 'dotlrn_community', + 'teaching_assistant_pretty_plural', + 'string', + 'Teaching Assistant Pretty Plural', + 'Teaching Assistant Pretty Plural', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_atribute ( + 'dotlrn_community', + 'instructor_pretty_name', + 'string', + 'Professor Pretty Name', + 'Professor Pretty Name', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_atribute ( + 'dotlrn_community', + 'instructor_pretty_plural', + 'string', + 'Professor Pretty Plural', + 'Professor Pretty Plural', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_atribute ( + 'dotlrn_community', + 'course_admin_pretty_name', + 'string', + 'Course Administrator Pretty Name', + 'Course Administrator Pretty Name', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_atribute ( + 'dotlrn_community', + 'course_admin_pretty_plural', + 'string', + 'Course Administrator Pretty Plural', + 'Course Administrator Pretty Plural', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_atribute ( + 'dotlrn_community', + 'admin_pretty_name', + 'string', + 'Administrator Pretty Name', + 'Administrator Pretty Name', + 0, + 1, + 'generic' + ); + + perform acs_attribute__create_atribute ( + 'dotlrn_community', + 'admin_pretty_plural', + 'string', + 'Administrator Pretty Plural', + 'Administrator Pretty Plural', + 0, + 1, + 'generic' + ); + + -- create basic rel_types + + perform acs_rel_type__create_type ( + 'dotlrn_member_rel', + 'membership_rel', + 'dotLRN Community Membership', + 'dotLRN Community Memberships', + 'dotlrn_member_rel', + 'dotlrn_member_rels', + 'red_id', + 'dotlrn_community', + null, + 0, + null, + 'user', + 'member', + 0, + null + ); + + perform acs_rel_type__create_type ( + 'dotlrn_admin_rel', + 'dotlrn_member_rel', + 'dotLRN Admin Community Membership', + 'dotLRN Admin Community Memberships', + 'dotlrn_admin_rel', + 'dotlrn_admin_rels', + 'red_id', + 'dotlrn_community', + null, + 0, + null, + 0, + 'admin', + 0, + null + ); + + -- all rels to communities must have a portal_id + perform acs_rel_type__create_type ( + 'dotlrn_member_rel', + 'portal_id', + 'integer', + 'Page ID', + 'Page IDs' + ); end; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-main-portlet-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-main-portlet-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-main-portlet-create.sql 9 May 2002 23:59:51 -0000 1.3 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-main-portlet-create.sql 2 Jul 2002 18:40:08 -0000 1.4 @@ -22,6 +22,7 @@ -- Copyright (C) 2001 OpenForce, Inc. -- @author Ben Adida (ben@openforce.net) +-- @author dan chak (chak@openforce.net) -- @creation-date 2001-11-05 -- $Id$ @@ -111,32 +112,35 @@ select acs_sc_impl_alias__new ( ''portal_datasource'', ''dotlrn_main_portlet'', - ''Show'', - ''dotlrn_main_portlet::show'', + ''RemoveSelfFromPage'', + ''dotlrn_main_portlet::remove_self_from_page'', ''TCL'' ); select acs_sc_impl_alias__new ( ''portal_datasource'', ''dotlrn_main_portlet'', - ''Edit'', - ''dotlrn_main_portlet::edit'', + ''Show'', + ''dotlrn_main_portlet::show'', ''TCL'' ); select acs_sc_impl_alias__new ( ''portal_datasource'', ''dotlrn_main_portlet'', - ''RemoveSelfFromPage'', - ''dotlrn_main_portlet::remove_self_from_page'', + ''Edit'', + ''dotlrn_main_portlet::edit'', ''TCL'' ); + -- Add the binding select acs_sc_binding__new ( ''portal_datasource'', ''dotlrn_main_portlet'' ); + return 0; + end; ' language 'plpgsql'; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-main-portlet-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-main-portlet-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-main-portlet-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-main-portlet-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -27,23 +27,78 @@ -- License version 2 or higher. Full text of the license is available -- from the GNU Project: http://www.fsf.org/copyleft/gpl.html +create function inline_0 () +returns integer as ' declare ds_id portal_datasources.datasource_id%TYPE; begin + perform acs_sc_binding__delete( + ''portal_datasource'', + ''dotlrn_main_portlet'' + ); + + perform acs_sc_impl__delete_alias( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''GetMyName'' + ); + + perform acs_sc_impl__delete_alias( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''GetPrettyName'' + ); + + perform acs_sc_impl__delete_alias( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''Link'' + ); + + perform acs_sc_impl__delete_alias( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''AddSelfToPage'' + ); + + perform acs_sc_impl__delete_alias( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''RemoveSelfFromPage'' + ); + + perform acs_sc_impl__delete_alias( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''Show'' + ); + + perform acs_sc_impl__delete_alias( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''Edit'' + ); + + perform acs_sc_impl__delete( + ''portal_datasource',' + ''dotlrn_main_portlet'' + ); + begin select datasource_id into ds_id from portal_datasources - where name = 'dotlrn-main-portlet'; + where name = ''dotlrn-main-portlet''; exception when no_data_found then ds_id := null; end; if ds_id is not null then - portal_datasource.delete(ds_id); + portal_datasource__delete(ds_id); end if; end; -/ -show errors; +' language 'plpgsql'; +perform inline_0(); +delete function inline_0; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-portal-types-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-portal-types-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-portal-types-create.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,34 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- +-- DotLRN portal types map - a mapping table b/w a type +-- like "subgroups" or "user" and their portal_id +-- +-- @author arjun (arjun@openforce.net) +-- @version $Id: dotlrn-portal-types-create.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ +-- + +create table dotlrn_portal_types_map ( + type varchar(100) + constraint dotlrn_p_t_map_type_pk + primary key, + portal_id integer + constraint dotlrn_p_t_map_portal_id_fk + references portals (portal_id) + constraint dotlrn_p_t_map_portal_id_un + unique +); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-portal-types-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-portal-types-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-portal-types-drop.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,25 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- +-- DotLRN portal templates - drop script +-- +-- @author arjun (arjun@openforce.net) +-- @autho dan chak (chak@openforce.net) +-- @version $Id: dotlrn-portal-types-drop.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ +-- + +drop table dotlrn_portal_types_map; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professor-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-professor-profile-provider-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professor-profile-provider-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professor-profile-provider-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,49 +18,55 @@ -- Implementation of the profile provider interface for dotLRN Professors. -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- +create function inline_0() +returns integer as ' declare foo integer; begin -- drop the binding between this implementation and the interface it -- implements. - acs_sc_binding.delete( - contract_name => 'profile_provider', - impl_name => 'dotlrn_professor_profile_provider' + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotlrn_professor_profile_provider'' ); -- drop the bindings to the method implementations -- name method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_professor_profile_provider', - impl_operation_name => 'name' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_professor_profile_provider'', + ''name'' ); -- prettyName method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_professor_profile_provider', - impl_operation_name => 'prettyName' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_professor_profile_provider'', + ''prettyName'' ); -- render method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_professor_profile_provider', - impl_operation_name => 'render' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_professor_profile_provider'', + ''render'' ); -- drop the implementation - acs_sc_impl.delete( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_professor_profile_provider' + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotlrn_professor_profile_provider'' ); + return 0; end; -/ -show errors +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-professors-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-create.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-create.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -29,14 +29,6 @@ primary key ); -create table dotlrn_full_prof_profile_rels ( - rel_id integer - constraint dotlrn_fp_prfl_rels_rel_fk - references dotlrn_full_user_profile_rels (rel_id) - constraint dotlrn_full_prof_prfl_rels_pk - primary key -); - \i dotlrn-professor-profile-provider-create.sql \i dotlrn-professors-init.sql \i dotlrn-professors-package-create.sql Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-professors-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,12 +18,13 @@ -- Drop the dotLRN Professors package -- -- @author yon@openforce.net +-- author dan chak (chak@openforce.net) -- @version $Id$ -- -@@ dotlrn-professors-package-drop.sql -@@ dotlrn-professors-sanitize.sql -@@ dotlrn-professor-profile-provider-drop.sql +\i dotlrn-professors-package-drop.sql +\i dotlrn-professors-sanitize.sql +\i dotlrn-professor-profile-provider-drop.sql drop table dotlrn_full_prof_profile_rels; drop table dotlrn_professor_profile_rels; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-professors-init.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-init.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-init.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -32,12 +32,12 @@ PERFORM acs_rel_type__create_type( ''dotlrn_professor_profile_rel'', - ''dotLRN Professor Profile Membership'', - ''dotLRN Professor Profile Memberships'', - ''dotlrn_user_profile_rel'', + ''dotlrn_user_profile_rel'', + ''dotLRN Professor Profile Professor'', + ''dotLRN Professor Profile Professors'', + ''dotlrn_professor_profile_rel'', ''dotlrn_professor_profile_rels'', ''rel_id'', - ''dotlrn_professor_profile_rel'', ''profiled_group'', null, 0, @@ -65,7 +65,7 @@ (''professor'', ''Professor'', group_id); foo := rel_segment__new( - ''dotLRN Profiled Professors'', + ''dotLRN Professors'', group_id, ''dotlrn_professor_profile_rel'' ); @@ -95,36 +95,3 @@ PERFORM acs_rel_type--create_type( ''dotlrn_full_professor_profile_rel'', ''dotLRN Full Professor Profile Membership'', - ''dotLRN Full Professor Profile Memberships'', - ''dotlrn_full_user_profile_rel'', - ''dotlrn_full_professor_profile_rels'', - ''rel_id'', - ''dotlrn_full_professor_profile_rel'', - ''profiled_group'', - null, - 0, - null, - ''user'', - null, - 0, - 1 - ); - - select min(group_id) - into foo - from profiled_groups - where profile_provider = (select min(impl_id) - from acs_sc_impls - where impl_name = ''dotlrn_professor_profile_provider''); - - foo := rel_segment__new( - ''dotLRN Full Profiled Professors'', - foo, - ''dotlrn_full_professor_profile_rel'' - ); - -end; -' language 'plpgsql'; - -select inline_2(); -drop function inline_2(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-professors-package-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-package-create.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-package-create.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -21,21 +21,23 @@ -- @version $Id$ -- -select define_function_args ('dotlrn_professor_profile_rel__new','rel_id,id,rel_type;dotlrn_professor_profile_rel,group_id,user_id,creation_user,creation_ip'); +select define_function_args ('dotlrn_professor_profile_rel__new','rel_id,user_id,portal_id,theme_id,id,rel_type;dotlrn_professor_profile_rel,group_id,creation_user,creation_ip'); select define_function_args ('dotlrn_professor_profile_rel__delete','rel_id'); -create function dotlrn_professor_profile_rel__new(integer,varchar,varchar,integer,integer,integer,varchar) +create function dotlrn_professor_profile_rel__new(integer,integer,integer,integer,integer,integer,integer,varchar) returns integer as ' DECLARE p_rel_id alias for $1; - p_id alias for $2; - p_rel_type alias for $3; - p_group_id alias for $4; - p_user_id alias for $5; - p_creation_user alias for $6; - p_creation_ip alias for $7; + p_user_id alias for $2; + p_portal_id alias_for $3; + p_theme_id alias_for $4; + p_id alias_for $5; + p_rel_type alias for $6; + p_group_id alias for $7; + p_creation_user alias for $8; + p_creation_ip alias for $9; v_rel_id dotlrn_user_profile_rels.rel_id%TYPE; v_group_id groups.group_id%TYPE; BEGIN @@ -52,10 +54,12 @@ v_rel_id := dotlrn_user_profile_rel__new( p_rel_id, + p_user_id, + p_portal_id, + p_theme_id, p_id, p_rel_type, v_group_id, - p_user_id, p_creation_user, p_creation_ip ); @@ -86,72 +90,3 @@ ' language 'plpgsql'; --- full professors - -select define_function_args('dotlrn_full_professor_profile_rel__new','rel_id,portal_id,theme_id,id,rel_type,group_id,user_id,creation_user,creation_ip'); - -select define_function_args('dotlrn_full_professor_profile_rel__delete','rel_id'); - - -create function dotlrn_full_professor_profile_rel__new(integer,integer,integer,varchar,varchar,integer,integer,integer,varchar) -returns integer as ' -DECLARE - p_rel_id alias for $1; - p_portal_id alias for $2; - p_theme_id alias for $3; - p_id alias for $4; - p_rel_type alias for $5; - p_group_id alias for $6; - p_user_id alias for $7; - p_creation_user alias for $8; - p_creation_ip alias for $9; - v_rel_id dotlrn_full_user_profile_rels.rel_id%TYPE; - v_group_id groups.group_id%TYPE; -BEGIN - if p_group_id is null then - select min(group_id) - into v_group_id - from profiled_groups - where profile_provider = (select min(impl_id) - from acs_sc_impls - where impl_name = ''dotlrn_professor_profile_provider''); - else - v_group_id := p_group_id; - end if; - - v_rel_id := dotlrn_full_user_profile_rel__new( - p_rel_id, - p_portal_id, - p_theme_id, - p_id, - p_rel_type, - v_group_id, - p_user_id, - p_creation_user, - p_creation_ip - ); - - insert - into dotlrn_full_professor_profile_rels - (rel_id) - values - (v_rel_id); - - return v_rel_id; -END; -' language 'plpgsql'; - - -create function dotlrn_full_professor_profile_rel__delete(integer) -returns integer as ' -DECLARE - p_rel_id alias for $1; -BEGIN - delete - from dotlrn_full_professor_profile_rels - where rel_id = p_rel_id; - - PERFORM dotlrn_full_user_profile_rel__delete(p_rel_id); - return(0); -END; -' language 'plpgsql'; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-professors-package-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-package-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-package-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,8 +18,9 @@ -- Create the dotLRN Professors package -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- -drop package dotlrn_full_prof_profile_rel; -drop package dotlrn_professor_profile_rel; +select drop_package('dotlrn_full_prof_profile_rel'); +select drop_package('dotlrn_professor_profile_rel'); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-sanitize.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-professors-sanitize.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-sanitize.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-sanitize.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,64 +18,74 @@ -- Sanitize the dotLRN Professor package -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- +create function inline_0() +returns integer as ' declare foo integer; begin select min(segment_id) into foo from rel_segments - where segment_name = 'dotLRN Full Profiled Professors'; + where segment_name = ''dotLRN Full Profiled Professors''; - rel_segment.delete( - segment_id => foo + perform rel_segment__delete( + foo ); - acs_rel_type.drop_type( - rel_type => 'dotlrn_full_professor_profile_rel', - cascade_p => 't' + perform acs_rel_type__drop_type( + ''dotlrn_full_professor_profile_rel'', + ''t'' ); + return 0; + end; -/ -show errors +' language 'plpgsql'; +select inline_0(); +drop function inline_0(); +create function inline_1() +returns integer as ' declare foo integer; begin select min(segment_id) into foo from rel_segments - where segment_name = 'dotLRN Profiled Professors'; + where segment_name = ''dotLRN Profiled Professors''; - rel_segment.delete( - segment_id => foo + perform rel_segment__delete( + foo ); select min(group_id) into foo from profiled_groups where profile_provider = (select min(impl_id) from acs_sc_impls - where impl_name = 'dotlrn_professor_profile_provider'); + where impl_name = ''dotlrn_professor_profile_provider''); delete from dotlrn_user_types where group_id = foo; - profiled_group.delete( - group_id => foo + perform profiled_group__delete( + foo ); - acs_rel_type.drop_type( - rel_type => 'dotlrn_professor_profile_rel', - cascade_p => 't' + perform acs_rel_type__drop_type( + ''dotlrn_professor_profile_rel'', + ''t'' ); + return 0; end; -/ -show errors +' language 'plpgsql'; +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-security-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-security-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-security-create.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-security-create.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -23,8 +23,10 @@ -- -- ben@openforce -- ported to PG by Yon and Ben +-- @author dan chak (chak@openforce.net) +-- @version $Id$ -- --- 11/28/2001 +-- creation date 11/28/2001 -- -- Security Setup for dotLRN -- privileges, privilege inheritance Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-security.drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-security.drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-security.drop.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,61 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- +-- drop dotLRN permissions +-- +-- @author Ben Adida (ben@openforce.net) +-- @author dan chak (chak@openforce.net) +-- @creation-date 2001-11-28 +-- ported 2002-07-01 +-- @version $Id: dotlrn-security.drop.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ +-- + +begin + + perform acs_privilege__remove_child('admin', 'dotlrn_admin_community'); + perform acs_privilege__remove_child('admin', 'dotlrn_admin_community_type'); + perform acs_privilege__remove_child('admin', 'dotlrn_browse'); + perform acs_privilege__remove_child('create', 'dotlrn_create_community'); + perform acs_privilege__remove_child('create', 'dotlrn_create_community_type'); + perform acs_privilege__remove_child('read', 'dotlrn_view_community'); + perform acs_privilege__remove_child('read', 'dotlrn_view_community_type'); + perform acs_privilege__remove_child('write', 'dotlrn_edit_community'); + + perform acs_privilege__remove_child('dotlrn_edit_community', 'dotlrn_view_community'); + perform acs_privilege__remove_child('dotlrn_admin_community', 'dotlrn_edit_community'); + + delete + from acs_permissions + where privilege in ('dotlrn_admin_community', + 'dotlrn_admin_community_type', + 'dotlrn_browse', + 'dotlrn_create_community', + 'dotlrn_create_community_type', + 'dotlrn_edit_community', + 'dotlrn_view_community', + 'dotlrn_view_community_type'); + + perform acs_privilege__drop_privilege('dotlrn_admin_community'); + perform acs_privilege__drop_privilege('dotlrn_admin_community_type'); + perform acs_privilege__drop_privilege('dotlrn_browse'); + perform acs_privilege__drop_privilege('dotlrn_create_community'); + perform acs_privilege__drop_privilege('dotlrn_create_community_type'); + perform acs_privilege__drop_privilege('dotlrn_edit_community'); + perform acs_privilege__drop_privilege('dotlrn_view_community'); + perform acs_privilege__drop_privilege('dotlrn_view_community_type'); + +end; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-student-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-student-profile-provider-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-student-profile-provider-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-student-profile-provider-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,49 +18,54 @@ -- Implementation of the profile provider interface for dotLRN Students. -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- +create function inline_0() +returns integer as ' declare foo integer; begin -- drop the binding between this implementation and the interface it - -- implements. - acs_sc_binding.delete( - contract_name => 'profile_provider', - impl_name => 'dotlrn_student_profile_provider' + -- implements__ + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotlrn_student_profile_provider'' ); -- drop the bindings to the method implementations -- name method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_student_profile_provider', - impl_operation_name => 'name' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_student_profile_provider'', + ''name'' ); -- prettyName method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_student_profile_provider', - impl_operation_name => 'prettyName' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_student_profile_provider'', + ''prettyName'' ); -- render method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_student_profile_provider', - impl_operation_name => 'render' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_student_profile_provider'', + ''render'' ); -- drop the implementation - acs_sc_impl.delete( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_student_profile_provider' + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotlrn_student_profile_provider'' ); -end; -/ -show errors + return 0; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-students-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-create.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-create.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -23,20 +23,12 @@ create table dotlrn_student_profile_rels ( rel_id integer - constraint dotlrn_std_rels_rel_id_fk + constraint dotlrn_student_p_rels_rel_fk references dotlrn_user_profile_rels (rel_id) - constraint dotlrn_student_profile_rels_pk + constraint dotlrn_student_p_rels_pk primary key ); -create table dotlrn_full_stud_profile_rels ( - rel_id integer - constraint dotlrn_fs_prfl_rels_rel_fk - references dotlrn_full_user_profile_rels (rel_id) - constraint dotlrn_fs_prfl_rels_pk - primary key -); - \i dotlrn-student-profile-provider-create.sql \i dotlrn-students-init.sql \i dotlrn-students-package-create.sql Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-students-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,12 +18,13 @@ -- Drop the dotLRN Students package -- -- @author yon@openforce.net +-- author dan chak (chak@openforce.net) +-- pg port on 2002-07-01 -- @version $Id$ -- -@@ dotlrn-students-package-drop.sql -@@ dotlrn-students-sanitize.sql -@@ dotlrn-student-profile-provider-drop.sql +\i dotlrn-students-package-drop.sql +\i dotlrn-students-sanitize.sql +\i dotlrn-student-profile-provider-drop.sql -drop table dotlrn_full_stud_profile_rels; drop table dotlrn_student_profile_rels; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-students-init.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-init.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-init.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -32,12 +32,12 @@ PERFORM acs_rel_type__create_type( ''dotlrn_student_profile_rel'', - ''dotLRN Student Profile Membership'', - ''dotLRN Student Profile Memberships'', - ''dotlrn_user_profile_rel'', + ''dotlrn_user_profile_rel'', + ''dotLRN Profile Student'', + ''dotLRN Profile Students'', + ''dotlrn_student_profile_rel'', ''dotlrn_student_profile_rels'', ''rel_id'', - ''dotlrn_student_profile_rel'', ''profiled_group'', null, 0, @@ -65,7 +65,7 @@ (''student'', ''Student'', group_id); foo := rel_segment__new( - ''dotLRN Profiled Students'', + ''dotLRN Students'', group_id, ''dotlrn_student_profile_rel'' ); @@ -86,45 +86,3 @@ select inline_1(); drop function inline_1(); - -create function inline_2() -returns integer as ' -declare - foo integer; -begin - PERFORM acs_rel_type--create_type( - ''dotlrn_full_student_profile_rel'', - ''dotLRN Full Student Profile Membership'', - ''dotLRN Full Student Profile Memberships'', - ''dotlrn_full_user_profile_rel'', - ''dotlrn_full_student_profile_rels'', - ''rel_id'', - ''dotlrn_full_student_profile_rel'', - ''profiled_group'', - null, - 0, - null, - ''user'', - null, - 0, - 1 - ); - - select min(group_id) - into foo - from profiled_groups - where profile_provider = (select min(impl_id) - from acs_sc_impls - where impl_name = ''dotlrn_student_profile_provider''); - - foo := rel_segment__new( - ''dotLRN Full Profiled Students'', - foo, - ''dotlrn_full_student_profile_rel'' - ); - -end; -' language 'plpgsql'; - -select inline_2(); -drop function inline_2(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-students-package-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-package-create.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-package-create.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -21,21 +21,22 @@ -- @version $Id$ -- -select define_function_args ('dotlrn_student_profile_rel__new','rel_id,id,rel_type;dotlrn_student_profile_rel,group_id,user_id,creation_user,creation_ip'); +select define_function_args ('dotlrn_student_profile_rel__new','rel_id,user_id,portal_id,theme_id,id,rel_type;dotlrn_student_profile_rel,group_id,creation_user,creation_ip'); select define_function_args ('dotlrn_student_profile_rel__delete','rel_id'); -create function dotlrn_student_profile_rel__new(integer,varchar,varchar,integer,integer,integer,varchar) +create function dotlrn_student_profile_rel__new(integer,integer,integer,integer,varchar,integer,integer,varchar,integer,integer) returns integer as ' DECLARE p_rel_id alias for $1; - p_id alias for $2; - p_rel_type alias for $3; - p_group_id alias for $4; - p_user_id alias for $5; - p_creation_user alias for $6; - p_creation_ip alias for $7; + p_user_id alias for $2; + p_portal_id alias for $3; + p_theme_id alias for $4; + p_rel_type alias for $5; + p_group_id alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; v_rel_id dotlrn_user_profile_rels.rel_id%TYPE; v_group_id groups.group_id%TYPE; BEGIN @@ -86,72 +87,3 @@ ' language 'plpgsql'; --- full students - -select define_function_args('dotlrn_full_student_profile_rel__new','rel_id,portal_id,theme_id,id,rel_type,group_id,user_id,creation_user,creation_ip'); - -select define_function_args('dotlrn_full_student_profile_rel__delete','rel_id'); - - -create function dotlrn_full_student_profile_rel__new(integer,integer,integer,varchar,varchar,integer,integer,integer,varchar) -returns integer as ' -DECLARE - p_rel_id alias for $1; - p_portal_id alias for $2; - p_theme_id alias for $3; - p_id alias for $4; - p_rel_type alias for $5; - p_group_id alias for $6; - p_user_id alias for $7; - p_creation_user alias for $8; - p_creation_ip alias for $9; - v_rel_id dotlrn_full_user_profile_rels.rel_id%TYPE; - v_group_id groups.group_id%TYPE; -BEGIN - if p_group_id is null then - select min(group_id) - into v_group_id - from profiled_groups - where profile_provider = (select min(impl_id) - from acs_sc_impls - where impl_name = ''dotlrn_student_profile_provider''); - else - v_group_id := p_group_id; - end if; - - v_rel_id := dotlrn_full_user_profile_rel__new( - p_rel_id, - p_portal_id, - p_theme_id, - p_id, - p_rel_type, - v_group_id, - p_user_id, - p_creation_user, - p_creation_ip - ); - - insert - into dotlrn_full_student_profile_rels - (rel_id) - values - (v_rel_id); - - return v_rel_id; -END; -' language 'plpgsql'; - - -create function dotlrn_full_student_profile_rel__delete(integer) -returns integer as ' -DECLARE - p_rel_id alias for $1; -BEGIN - delete - from dotlrn_full_student_profile_rels - where rel_id = p_rel_id; - - PERFORM dotlrn_full_user_profile_rel__delete(p_rel_id); - return(0); -END; -' language 'plpgsql'; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-students-package-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-package-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-package-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,8 +18,8 @@ -- Create the dotLRN Students package -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- -drop package dotlrn_full_stud_profile_rel; -drop package dotlrn_student_profile_rel; +select drop_package('dotlrn_student_profile_rel'); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-sanitize.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-students-sanitize.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-sanitize.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-sanitize.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,64 +18,75 @@ -- Sanitize the dotLRN Student package -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- +create function inline_0() +returns integer as ' declare foo integer; begin select min(segment_id) into foo from rel_segments - where segment_name = 'dotLRN Full Profiled Students'; + where segment_name = ''dotLRN Full Profiled Students''; - rel_segment.delete( - segment_id => foo + perform rel_segment__delete( + foo ); - acs_rel_type.drop_type( - rel_type => 'dotlrn_full_student_profile_rel', - cascade_p => 't' + perform acs_rel_type__drop_type( + ''dotlrn_full_student_profile_rel'', + ''t'' ); + return 0; end; -/ -show errors +' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + +create function inline_1() +returns integer as ' declare foo integer; begin select min(segment_id) into foo from rel_segments - where segment_name = 'dotLRN Profiled Students'; + where segment_name = ''dotLRN Profiled Students''; - rel_segment.delete( - segment_id => foo + perform rel_segment__delete( + foo ); select min(group_id) into foo from profiled_groups where profile_provider = (select min(impl_id) from acs_sc_impls - where impl_name = 'dotlrn_student_profile_provider'); + where impl_name = ''dotlrn_student_profile_provider''); delete from dotlrn_user_types where group_id = foo; - profiled_group.delete( - group_id => foo + perform profiled_group__delete( + foo ); - acs_rel_type.drop_type( - rel_type => 'dotlrn_student_profile_rel', - cascade_p => 't' + perform acs_rel_type__drop_type( + ''dotlrn_student_profile_rel'', + ''t'' ); + return 0; end; -/ -show errors +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-user-extension-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-user-extension-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-user-extension-drop.sql 2 Jul 2002 18:40:08 -0000 1.1 @@ -0,0 +1,74 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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 dotLRN extension to user data notifications +-- copyright 2002, OpenForce +-- distributed under GPL v2.0 +-- +-- +-- @author dan chak (chak@mit.edu) +-- @version $Id: dotlrn-user-extension-drop.sql,v 1.1 2002/07/02 18:40:08 chak Exp $ +-- +-- +-- + + +begin + + perform acs_sc_binding__delete ( + 'UserData', + 'dotlrn_user_extension' + ); + + perform acs_sc_impl__delete_alias ( + 'UserData', + 'dotlrn_user_extension', + 'UserNew' + ); + + perform acs_sc_impl__delete_alias ( + 'UserData', + 'dotlrn_user_extension', + 'UserApprove' + ); + + perform acs_sc_impl__delete_alias ( + 'UserData', + 'dotlrn_user_extension', + 'UserDeapprove' + ); + + perform acs_sc_impl__delete_alias ( + 'UserData', + 'dotlrn_user_extension', + 'UserModify' + ); + + perform acs_sc_impl__delete_alias ( + 'UserData', + 'dotlrn_user_extension', + 'UserDelete' + ); + + -- create the implementation + perform acs_sc_impl__delete( + 'UserData', + 'dotlrn_user_extension' + ); + +end; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-user-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-user-profile-provider-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-user-profile-provider-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-user-profile-provider-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,49 +18,54 @@ -- Implementation of the profile provider interface for dotlrn users. -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- +create function inline_0() +returns integer as ' declare foo integer; begin -- drop the binding between this implementation and the interface it -- implements. - acs_sc_binding.delete( - contract_name => 'profile_provider', - impl_name => 'dotlrn_user_profile_provider' + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotlrn_user_profile_provider'' ); -- drop the bindings to the method implementations -- name method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_user_profile_provider', - impl_operation_name => 'name' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_user_profile_provider'', + ''name'' ); -- prettyName method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_user_profile_provider', - impl_operation_name => 'prettyName' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_user_profile_provider'', + ''prettyName'' ); -- render method - foo := acs_sc_impl.delete_alias( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_user_profile_provider', - impl_operation_name => 'render' + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_user_profile_provider'', + ''render'' ); -- drop the implementation - acs_sc_impl.delete( - impl_contract_name => 'profile_provider', - impl_name => 'dotlrn_user_profile_provider' + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotlrn_user_profile_provider'' ); -end; -/ -show errors + return 0; +END;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-users-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-create.sql 6 Apr 2002 06:27:32 -0000 1.3 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-create.sql 2 Jul 2002 18:40:08 -0000 1.4 @@ -24,26 +24,18 @@ create table dotlrn_user_profile_rels ( rel_id integer constraint dotlrn_usr_prfl_rels_rel_id_fk - references user_profile_rels (rel_id) + references dotlrn_user_profile_rels (rel_id) constraint dotlrn_user_profile_rels_pk primary key, - id varchar(100) -); - -create table dotlrn_full_user_profile_rels ( - rel_id integer - constraint dotlrn_fup_rels_rel_fk - references dotlrn_user_profile_rels (rel_id) - constraint dotlrn_full_user_prfl_rels_pk - primary key, portal_id integer - constraint dotlrn_fup_rels_portal_fk + constraint dotlrn_user_p_rels_portal_fk references portals (portal_id) - constraint dotlrn_fup_rels_portal_nn + constraint dotlrn_user_p_rels_portal_nn not null, theme_id integer - constraint dotlrn_fup_rels_theme_fk - references portal_element_themes (theme_id) + constraint dotlrn_user_p_rels_theme_id_fk + references portal_element_themes (theme_id), + id varchar(100) ); create table dotlrn_user_types ( @@ -58,7 +50,7 @@ not null ); -create or replace view dotlrn_users +create view dotlrn_users as select acs_rels.rel_id, dotlrn_user_profile_rels.id, @@ -81,15 +73,6 @@ and parties.party_id = users.user_id and users.user_id = persons.person_id; -create view dotlrn_full_users -as - select dotlrn_users.*, - dotlrn_full_user_profile_rels.portal_id, - dotlrn_full_user_profile_rels.theme_id - from dotlrn_users, - dotlrn_full_user_profile_rels - where dotlrn_users.rel_id = dotlrn_full_user_profile_rels.rel_id; - \i dotlrn-user-profile-provider-create.sql \i dotlrn-users-init.sql \i dotlrn-users-package-create.sql Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-users-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -22,24 +22,22 @@ -- -- drop external users -@@ dotlrn-externals-drop.sql +\i dotlrn-externals-drop.sql -- drop students -@@ dotlrn-students-drop.sql +\i dotlrn-students-drop.sql -- drop professors -@@ dotlrn-professors-drop.sql +\i dotlrn-professors-drop.sql -- drop admins -@@ dotlrn-admins-drop.sql +\i dotlrn-admins-drop.sql -@@ dotlrn-users-package-drop.sql -@@ dotlrn-users-sanitize.sql -@@ dotlrn-user-profile-provider-drop.sql +\i dotlrn-users-package-drop.sql +\i dotlrn-users-sanitize.sql +\i dotlrn-user-profile-provider-drop.sql -drop view dotlrn_full_users; drop view dotlrn_users; drop table dotlrn_user_types; -drop table dotlrn_full_user_profile_rels; drop table dotlrn_user_profile_rels; Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-users-init.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-init.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-init.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -27,7 +27,7 @@ foo integer; begin - acs_rel_type.create_type( + acs_rel_type__create_type( ''dotlrn_user_profile_rel'', ''dotLRN User Profile Membership'', ''dotLRN User Profile Memberships'', @@ -56,9 +56,9 @@ ); foo := rel_segment__new( - segment_name => ''dotLRN Profiled Users'', - group_id => foo, - rel_type => ''dotlrn_user_profile_rel'' + ''dotLRN Profiled Users'', + foo, + ''dotlrn_user_profile_rel'' ); return(0); @@ -68,7 +68,6 @@ select inline_1(); drop function inline_1(); - create function inline_2() returns integer as ' declare Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-users-package-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-package-drop.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-package-drop.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -21,5 +21,5 @@ -- @version $Id$ -- -drop package dotlrn_full_user_profile_rel; -drop package dotlrn_user_profile_rel; +select drop_package('dotlrn_full_user_profile_rel'); +select drop_package('dotlrn_user_profile_rel'); Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-sanitize.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/dotlrn-users-sanitize.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-sanitize.sql 29 Mar 2002 19:14:44 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-sanitize.sql 2 Jul 2002 18:40:08 -0000 1.3 @@ -18,60 +18,72 @@ -- Sanitize the User Profile package -- -- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) -- @version $Id$ -- +create function inline_0() +returns integer as ' declare foo integer; begin select min(segment_id) into foo from rel_segments - where segment_name = 'dotLRN Full Profiled Users'; + where segment_name = ''dotLRN Full Profiled Users''; - rel_segment.delete( - segment_id => foo + perform rel_segment__delete( + foo ); - acs_rel_type.drop_type( - rel_type => 'dotlrn_full_user_profile_rel', - cascade_p => 't' + perform acs_rel_type__drop_type( + ''dotlrn_full_user_profile_rel'', + ''t'' ); + return 0; end; -/ -show errors +' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + +create function inline_1() +returns integer +as ' declare foo integer; begin select min(segment_id) into foo from rel_segments - where segment_name = 'dotLRN Profiled Users'; + where segment_name = ''dotLRN Profiled Users''; - rel_segment.delete( - segment_id => foo + perform rel_segment__delete( + foo ); select min(group_id) into foo from profiled_groups where profile_provider = (select min(impl_id) from acs_sc_impls - where impl_name = 'dotlrn_user_profile_provider'); + where impl_name = ''dotlrn_user_profile_provider''); - profiled_group.delete( - group_id => foo + perform profiled_group__delete( + foo ); - acs_rel_type.drop_type( - rel_type => 'dotlrn_user_profile_rel', - cascade_p => 't' + perform acs_rel_type__drop_type( + ''dotlrn_user_profile_rel'', + ''t'' ); + return 0; end; -/ -show errors +' language 'plpgsql'; + +select inline_1(); +drop function inline_1();