Index: openacs-4/packages/dotlrn/sql/postgresql/admin-profile-provider-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/admin-profile-provider-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/admin-profile-provider-create.sql 8 Jul 2002 21:04:14 -0000 1.1 @@ -0,0 +1,75 @@ +-- +-- 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. +-- + +-- +-- Implementation of the profile provider interface for dotLRN Admins. +-- +-- @author yon@openforce.net +-- @version $Id: admin-profile-provider-create.sql,v 1.1 2002/07/08 21:04:14 yon Exp $ +-- + +create function inline_0() +returns integer as ' +begin + + -- create the implementation + perform acs_sc_impl__new( + ''profile_provider'', + ''dotlrn_admin_profile_provider'', + ''dotlrn_admin_profile_provider'' + ); + + -- add the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_admin_profile_provider'', + ''name'', + ''dotlrn_admin_profile_provider::name'', + ''TCL'' + ); + + -- prettyName method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_admin_profile_provider'', + ''prettyName'', + ''dotlrn_admin_profile_provider::prettyName'', + ''TCL'' + ); + + -- render method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_admin_profile_provider'', + ''render'', + ''dotlrn_admin_profile_provider::render'', + ''TCL'' + ); + + -- bind this implementation to the interface it implements + perform acs_sc_binding__new( + ''profile_provider'', + ''dotlrn_admin_profile_provider'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/admin-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/admin-profile-provider-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/admin-profile-provider-drop.sql 8 Jul 2002 21:04:14 -0000 1.1 @@ -0,0 +1,72 @@ +-- +-- 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. +-- + +-- +-- Implementation of the profile provider interface for dotLRN Admins. +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: admin-profile-provider-drop.sql,v 1.1 2002/07/08 21:04:14 yon Exp $ +-- + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- drop the binding between this implementation and the interface it + -- implements + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotlrn_admin_profile_provider'' + ); + + -- drop the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_admin_profile_provider'', + ''name'' + ); + + -- prettyName method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_admin_profile_provider'', + ''prettyName'' + ); + + -- render method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_admin_profile_provider'', + ''render'' + ); + + -- drop the implementation + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotlrn_admin_profile_provider'' + ); + + return 0; +end; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/admins-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/admins-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/admins-create.sql 8 Jul 2002 21:04:14 -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. +-- + +-- +-- Create the dotLRN Admins package +-- +-- @author yon@openforce.net +-- @version $Id: admins-create.sql,v 1.1 2002/07/08 21:04:14 yon Exp $ +-- + +create table dotlrn_admin_profile_rels ( + rel_id integer + constraint dotlrn_adm_prfl_rels_rel_id_fk + references dotlrn_user_profile_rels (rel_id) + constraint dotlrn_admin_prfl_rels_pk + primary key +); + +\i admin-profile-provider-create.sql +\i admins-init.sql +\i admins-package-create.sql Index: openacs-4/packages/dotlrn/sql/postgresql/admins-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/admins-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/admins-drop.sql 8 Jul 2002 21:04:14 -0000 1.1 @@ -0,0 +1,28 @@ +-- +-- 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 Admins package +-- +-- @author yon@openforce.net +-- @version $Id: admins-drop.sql,v 1.1 2002/07/08 21:04:14 yon Exp $ +-- + +\i admins-package-drop.sql +\i admins-sanitize.sql +\i admin-profile-provider-drop.sql + +drop table dotlrn_admin_profile_rels; Index: openacs-4/packages/dotlrn/sql/postgresql/admins-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/admins-init.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/admins-init.sql 8 Jul 2002 21:04:14 -0000 1.1 @@ -0,0 +1,89 @@ +-- +-- 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. +-- + +-- +-- Initialize the dotLRN Admins package +-- +-- @author yon@openforce.net +-- @version $Id: admins-init.sql,v 1.1 2002/07/08 21:04:14 yon Exp $ +-- + + +create function inline_1() +returns integer as ' +declare + foo integer; + gid integer; + dotlrn_users_group_id integer; +begin + + PERFORM acs_rel_type__create_type( + ''dotlrn_admin_profile_rel'', + ''dotLRN Profile Admin'', + ''dotLRN Profile Admins'', + ''dotlrn_user_profile_rel'', + ''dotlrn_admin_profile_rels'', + ''rel_id'', + ''dotlrn_admin_profile_rel'', + ''profiled_group'', + null, + 0, + null, + ''user'', + null, + 0, + 1 + ); + + select min(impl_id) + into foo + from acs_sc_impls + where impl_name = ''dotlrn_admin_profile_provider''; + + gid := profiled_group__new( + foo, + ''dotLRN Admins'' + ); + + insert + into dotlrn_user_types + (type, pretty_name, group_id) + values + (''admin'', ''Staff'', gid); + + foo := rel_segment__new( + ''dotLRN Admins'', + gid, + ''dotlrn_admin_profile_rel'' + ); + + select group_id + into dotlrn_users_group_id + from groups + where group_name = ''dotLRN Users''; + + foo := composition_rel__new( + dotlrn_users_group_id, + gid + ); + + return 0; + +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotlrn/sql/postgresql/admins-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/admins-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/admins-package-create.sql 8 Jul 2002 21:04:14 -0000 1.1 @@ -0,0 +1,91 @@ +-- +-- 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 Admin package +-- +-- @author yon@openforce.net +-- @version $Id: admins-package-create.sql,v 1.1 2002/07/08 21:04:14 yon Exp $ +-- + +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,integer,integer,integer,integer,varchar,integer,integer,varchar) +returns integer as ' +DECLARE + 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) + 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_user_profile_rel__new( + v_rel_id, + p_user_id, + p_portal_id, + p_theme_id, + p_id, + p_rel_type, + p_creation_user, + p_creation_ip + ); + + insert + into dotlrn_admin_profile_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +create function dotlrn_admin_profile_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotlrn_admin_profile_rels + where rel_id = p_rel_id; + + PERFORM dotlrn_user_profile_rel__delete(p_rel_id); + return (0); +END; +' language 'plpgsql'; + + Index: openacs-4/packages/dotlrn/sql/postgresql/admins-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/admins-package-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/admins-package-drop.sql 8 Jul 2002 21:04:14 -0000 1.1 @@ -0,0 +1,24 @@ +-- +-- 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 Admins package +-- +-- @author yon@openforce.net +-- @version $Id: admins-package-drop.sql,v 1.1 2002/07/08 21:04:14 yon Exp $ +-- + +select drop_package('dotlrn_admin_profile_rel'); Index: openacs-4/packages/dotlrn/sql/postgresql/admins-sanitize.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/admins-sanitize.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/admins-sanitize.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,91 @@ +-- +-- 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 the dotLRN Admin package +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: admins-sanitize.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +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''; + + perform rel_segment__delete( + foo + ); + + perform acs_rel_type__drop_type( + ''dotlrn_full_admin_profile_rel'', + ''t'' + ); + + 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 Admins''; + + 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''); + + delete + from dotlrn_user_types + where group_id = foo; + + perform profiled_group__delete( + foo + ); + + perform acs_rel_type__drop_type( + ''dotlrn_admin_profile_rel'', + ''t'' + ); + + return 0; +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotlrn/sql/postgresql/applet-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/applet-sc-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/applet-sc-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,314 @@ +-- +-- 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 applet service contract +-- +-- 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 +-- + +-- This is the service contract for dotLRN applets. A dotlrn applet MUST +-- have AT LEAST the procs (with the proper arguments) defined below to work +-- as a dotlrn applet. +-- +-- **** SEE THE ORACLE VERSION FOR FULL DESCRIPTIONS **** +-- + +create function inline_0() +returns integer as ' +begin + perform acs_sc_contract__new ( + ''dotlrn_applet'', + ''dotLRN Applet contract'' + ); + + -- Get a pretty name + perform acs_sc_msg_type__new ( + ''dotlrn_applet.GetPrettyName.InputType'', + '''' + ); + + perform acs_sc_msg_type__new ( + ''dotlrn_applet.GetPrettyName.OutputType'', + ''pretty_name:string'' + ); + + perform acs_sc_operation__new ( + ''dotlrn_applet'', + ''GetPrettyName'', + ''Get the pretty name of the applet'', + ''t'', -- not cacheable + 0, -- n_args + ''dotlrn_applet.GetPrettyName.InputType'', + ''dotlrn_applet.GetPrettyName.OutputType'' + ); + + -- Add the applet to dotlrn (used for one-time initialization) + perform acs_sc_msg_type__new( + ''dotlrn_applet.AddApplet.InputType'', + '''' + ); + + perform acs_sc_msg_type__new( + ''dotlrn_applet.AddApplet.OutputType'', + ''success_p:boolean,error_message:string'' + ); + + perform acs_sc_operation__new ( + ''dotlrn_applet'', + ''AddApplet'', + ''Add the Applet to dotlrn - used for one-time initialization'', + ''f'', -- not cacheable + 0, -- n_args + ''dotlrn_applet.AddApplet.InputType'', + ''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 + -- 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'' + ); + + perform acs_sc_msg_type__new( + ''dotlrn_applet.AddAppletToCommunity.OutputType'', + ''success_p:boolean,error_message:string'' + ); + + perform acs_sc_operation__new ( + ''dotlrn_applet'', + ''AddAppletToCommunity'', + ''Add the Applet to a specific dotlrn community'', + ''f'', -- not cacheable + 1, -- n_args + ''dotlrn_applet.AddAppletToCommunity.InputType'', + ''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) + -- 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'' + ); + + perform acs_sc_msg_type__new( + ''dotlrn_applet.AddUser.OutputType'', + ''success_p:boolean,error_message:string'' + ); + + perform acs_sc_operation__new ( + ''dotlrn_applet'', + ''AddUser'', + ''Add a user to dotlrn, used for user-specific one-time init'', + ''f'', -- not cacheable + 1, -- n_args + ''dotlrn_applet.AddUser.InputType'', + ''dotlrn_applet.AddUser.OutputType'' + ); + + + -- 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'' + ); + + perform acs_sc_msg_type__new( + ''dotlrn_applet.AddUserToCommunity.OutputType'', + ''success_p:boolean,error_message:string'' + ); + + perform acs_sc_operation__new ( + ''dotlrn_applet'', + ''AddUserToCommunity'', + ''Add a user to a community'', + ''f'', -- not cacheable + 2, -- n_args + ''dotlrn_applet.AddUserToCommunity.InputType'', + ''dotlrn_applet.AddUserToCommunity.OutputType'' + ); + + -- 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'' + ); + + perform acs_sc_msg_type__new( + ''dotlrn_applet.RemoveUserFromCommunity.OutputType'', + ''success_p:boolean,error_message:string'' + ); + + perform acs_sc_operation__new ( + ''dotlrn_applet'', + ''RemoveUserFromCommunity'', + ''Remove a user from a community, applet does appropriate cleanup'', + ''f'', -- not cacheable + 2, -- n_args + ''dotlrn_applet.RemoveUserFromCommunity.InputType'', + ''dotlrn_applet.RemoveUserFromCommunity.OutputType'' + ); + + -- AddPortlet: Adds the underlying portlet to the given portal + perform acs_sc_msg_type__new( + ''dotlrn_applet.AddPortlet.InputType'', + ''portal_id:integer'' + ); + + perform acs_sc_msg_type__new( + ''dotlrn_applet.AddPortlet.OutputType'', + ''success_p:boolean,error_message:string'' + ); + + perform acs_sc_operation__new ( + ''dotlrn_applet'', + ''AddPortlet'', + ''Adds the underlying portlet to the portal specified'', + ''f'', -- not cacheable + 1, -- n_args + ''dotlrn_applet.AddPortlet.InputType'', + ''dotlrn_applet.AddPortlet.OutputType'' + ); + + -- RemovePortlet: the remove corollary of above + perform acs_sc_msg_type__new( + ''dotlrn_applet.RemovePortlet.InputType'', + ''portal_id:integer,args:string'' + ); + + perform acs_sc_msg_type__new( + ''dotlrn_applet.RemovePortlet.OutputType'', + ''success_p:boolean,error_message:string'' + ); + + perform acs_sc_operation__new ( + ''dotlrn_applet'', + ''RemovePortlet'', + ''Removes the underlying portlet from the given portal'', + ''f'', -- not cacheable + 2, -- n_args + ''dotlrn_applet.RemovePortlet.InputType'', + ''dotlrn_applet.RemovePortlet.OutputType'' + ); + + -- Clone: Attack of the Clones! + perform acs_sc_msg_type__new( + ''dotlrn_applet.Clone.InputType'', + ''old_community_id:integer,new_community_id:integer'' + ); + + perform acs_sc_msg_type__new( + ''dotlrn_applet.Clone.OutputType'', + ''success_p:boolean,error_message:string'' + ); + + perform acs_sc_operation__new ( + ''dotlrn_applet'', + ''Clone'', + ''Clone this applets content from the old to the new community'', + ''f'', -- not cacheable + 2, -- n_args + ''dotlrn_applet.Clone.InputType'', + ''dotlrn_applet.Clone.OutputType'' + ); + + return 0; + +end; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/applet-sc-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/applet-sc-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/applet-sc-drop.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,197 @@ +-- +-- 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 + +create function inline_0() +returns integer as ' +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'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + + Index: openacs-4/packages/dotlrn/sql/postgresql/class-membership-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/class-membership-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/class-membership-drop.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,72 @@ +-- +-- 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: class-membership-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create function inline_0() +returns integer as ' +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'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + +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/class-memberships-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/class-memberships-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/class-memberships-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,225 @@ +-- +-- 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: class-memberships-create.sql,v 1.1 2002/07/08 21:04:16 yon 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; + + +create function inline_0() +returns integer as ' +begin + perform 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 + ); + + perform 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 + ); + + perform 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 + ); + + perform acs_rel_type__create_type ( + ''dotlrn_cadmin_rel'', + ''dotLRN Course Administrator Community Membership'', + ''dotLRN Course Administrator Community Memberships'', + ''dotlrn_admin_rel'', + ''dotlrn_cadmin_rels'', + ''rel_id'', + ''dotlrn_cadmin_rel'', + ''dotlrn_class_instance'', + null, + 0, + null, + ''user'', + ''course_admin'', + 0, + null + ); + + perform 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 + ); + + return 0; + +END; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/classes-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/classes-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/classes-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,341 @@ +-- +-- 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 basic system +-- copyright 2001, OpenForce, inc. +-- distributed under the GNU GPL v2 +-- +-- for PG 7.1.3 +-- +-- @author Ben Adida (ben@openforce.net) +-- @author yon (yon@openforce.net) +-- @author dan chak (chak@openforce.net) +-- @creation-date 2001-08-18 +-- @version $Id: classes-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create table dotlrn_departments ( + department_key varchar(100) + constraint dotlrn_departments_dept_key_fk + references dotlrn_community_types (community_type) + constraint dotlrn_departments_pk + primary key, + external_url varchar(4000) +); + +create view dotlrn_departments_full +as + select dotlrn_departments.department_key, + dotlrn_community_types.pretty_name, + dotlrn_community_types.description, + dotlrn_community_types.package_id, + dotlrn_community_types.supertype, + (select site_node__url(site_nodes.node_id) + from site_nodes + where site_nodes.object_id = dotlrn_community_types.package_id) as url, + dotlrn_departments.external_url + from dotlrn_departments, + dotlrn_community_types + where dotlrn_departments.department_key = dotlrn_community_types.community_type; + +create table dotlrn_terms ( + term_id integer + constraint dotlrn_terms_pk + primary key, + term_name varchar(20) + constraint dotlrn_t_term_name_nn + not null, + term_year varchar(4) + constraint dotlrn_t_term_year_nn + not null, + start_date date + default now() + constraint dotlrn_t_start_date_nn + not null, + end_date date + default (now() + '180 days'::timespan) + constraint dotlrn_t_end_date_nn + not null +); + +create table dotlrn_classes ( + 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 + references dotlrn_departments (department_key) + constraint dotlrn_classes_dept_key_nn + not null +); + +create view dotlrn_classes_full +as + select dotlrn_classes.class_key, + dotlrn_community_types.pretty_name, + dotlrn_community_types.description, + dotlrn_community_types.package_id, + dotlrn_community_types.supertype, + (select site_node__url(site_nodes.node_id) + from site_nodes + where site_nodes.object_id = dotlrn_community_types.package_id) as url, + dotlrn_classes.department_key + from dotlrn_classes, + dotlrn_community_types + 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 + references dotlrn_communities_all (community_id) + constraint dotlrn_class_instances_pk + primary key, + 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 + references dotlrn_terms (term_id) + constraint dotlrn_ci_term_id_nn + not null +); + +create view dotlrn_class_instances_full +as + select dotlrn_class_instances.class_instance_id, + dotlrn_class_instances.class_key, + dotlrn_class_instances.term_id, + dotlrn_terms.term_name, + dotlrn_terms.term_year, + dotlrn_terms.start_date, + dotlrn_terms.end_date, + 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, + dotlrn_classes_full.department_key, + dotlrn_departments_full.pretty_name as department_name, + dotlrn_departments_full.url as department_url, + groups.join_policy + from dotlrn_communities, + dotlrn_class_instances, + dotlrn_terms, + dotlrn_classes_full, + dotlrn_departments_full, + groups + where dotlrn_communities.community_id = dotlrn_class_instances.class_instance_id + and dotlrn_class_instances.term_id = dotlrn_terms.term_id + and dotlrn_communities.community_type = dotlrn_classes_full.class_key + and dotlrn_classes_full.department_key = dotlrn_departments_full.department_key + and dotlrn_communities.community_id = groups.group_id; + +create view dotlrn_class_instances_current +as + select * + from dotlrn_class_instances_full + where now() between active_start_date and active_end_date; + +create view dotlrn_class_instances_not_old +as + select * + from dotlrn_class_instances_full + where active_end_date >= now(); + + +select define_function_args ('dotlrn_department__new','department_key,pretty_name,pretty_plural,description,package_id,creation_date,creation_user,creation_ip,context_id'); + +select define_function_args ('dotlrn_department__delete', 'department_key'); + + +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; + v_department_key dotlrn_departments.department_key%TYPE; +BEGIN + v_department_key := dotlrn_community_type__new ( + p_department_key, + ''dotlrn_class_instance'', + p_pretty_name, + p_pretty_plural, + p_description, + p_package_id, + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); + + insert + into dotlrn_departments + (department_key) values (v_department_key); + + return v_department_key; +END; +' language 'plpgsql'; + + +create function dotlrn_department__delete(varchar) +returns integer as ' +DECLARE + p_department_key alias for $1; +BEGIN + delete + from dotlrn_departments + where department_key = p_department_key; + + PERFORM dotlrn_community_type__delete(p_department_key); + return(0); +END; +' language 'plpgsql'; + + +select define_function_args('dotlrn_class__new','class_key,department_key,pretty_name,pretty_plural,description,package_id,creation_date,creation_user,creation_ip,context_id'); + +select define_function_args('dotlrn_class__delete','class_key'); + + +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_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; + v_class_key dotlrn_classes.class_key%TYPE; +BEGIN + v_class_key := dotlrn_community_type__new ( + p_class_key, + p_department_key, + p_pretty_name, + p_pretty_plural, + p_description, + p_package_id, + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); + + insert + into dotlrn_classes + (class_key, department_key) values (v_class_key, p_department_key); + + return v_class_key; +END; +' language 'plpgsql'; + + +create function dotlrn_class__delete(varchar) +returns integer as ' +DECLARE + p_class_key alias for $1; +BEGIN + delete + from dotlrn_classes + where class_key = p_class_key; + + PERFORM dotlrn_community_type__delete(p_class_key); + return(0); +END; +' language 'plpgsql'; + + + +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'); + + +create function dotlrn_class_instance__new(integer,varchar,integer,varchar,varchar,varchar,integer,integer,integer,varchar,timestamp,integer,varchar,integer) +returns integer as ' +DECLARE + p_class_instance_id alias for $1; + p_class_key alias for $2; + p_term_id alias for $3; + p_community_key alias for $4; + p_pretty_name alias for $5; + p_description alias for $6; + p_package_id alias for $7; + p_portal_id alias for $8; + 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; + p_creation_ip alias for $13; + p_context_id alias for $14; + v_class_instance_id dotlrn_class_instances.class_instance_id%TYPE; +BEGIN + v_class_instance_id := dotlrn_community__new ( + p_class_instance_id, + p_class_key, + p_community_key, + p_pretty_name, + p_description, + p_package_id, + p_portal_id, + p_non_member_portal_id, + p_join_policy, + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); + + insert + into dotlrn_class_instances + (class_instance_id, class_key, term_id) + values + (v_class_instance_id, p_class_key, p_term_id); + + return v_class_instance_id; +END; +' language 'plpgsql'; + + +create function dotlrn_class_instance__delete(integer) +returns integer as ' +DECLARE + p_class_instance_id alias for $1; +BEGIN + delete + from dotlrn_class_instances + where class_instance_id= p_class_instance_id; + + PERFORM dotlrn_community__delete(p_class_instance_id); + return(0); +END; +' language 'plpgsql'; + Index: openacs-4/packages/dotlrn/sql/postgresql/classes-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/classes-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/classes-drop.sql 8 Jul 2002 21:04:16 -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: classes-drop.sql,v 1.1 2002/07/08 21:04:16 yon 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/clubs-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/clubs-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/clubs-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,113 @@ +-- +-- 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 basic system +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- for PG 7.1.3 +-- +-- @author Ben Adida (ben@openforce.net) +-- @author yon (yon@openforce.net) +-- @author dan chak (chak@openforce.net) +-- @creation-date August 18th, 2001 +-- @version $Id: clubs-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create table dotlrn_clubs ( + club_id integer + constraint dotlrn_clubs_club_id_fk + references dotlrn_communities_all (community_id) + constraint dotlrn_clubs_pk + primary key +); + +create view dotlrn_clubs_full +as + select dotlrn_clubs.club_id, + dotlrn_communities.*, + dotlrn_community__url(dotlrn_communities.community_id::integer) as url, + groups.join_policy + from dotlrn_communities, + dotlrn_clubs, + groups + where dotlrn_communities.community_id = dotlrn_clubs.club_id + 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,non_member_portal_id,join_policy,creation_date,creation_user,creation_ip,context_id'); + +select define_function_args ('dotlrn_club__delete','club_id'); + + +create function dotlrn_club__new(integer,varchar,varchar,varchar,integer,integer,integer,varchar,timestamp,integer,varchar,integer) +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_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, + ''dotlrn_club'', + p_community_key, + p_pretty_name, + p_description, + p_package_id, + p_portal_id, + p_non_member_portal_id, + p_join_policy, + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); + + insert + into dotlrn_clubs (club_id) + values (v_club_id); + + return v_club_id; +END; +' language 'plpgsql'; + + +create function dotlrn_club__delete(integer) +returns integer as ' +DECLARE + p_club_id alias for $1; +BEGIN + delete + from dotlrn_clubs + where club_id = p_club_id; + + PERFORM dotlrn_community__delete(p_club_id); + return(0); +END; +' language 'plpgsql'; + Index: openacs-4/packages/dotlrn/sql/postgresql/clubs-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/clubs-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/clubs-drop.sql 8 Jul 2002 21:04:16 -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: clubs-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +select drop_package('dotlrn_club'); +drop view dotlrn_clubs_full; +drop table dotlrn_clubs; Index: openacs-4/packages/dotlrn/sql/postgresql/communities-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/communities-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/communities-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,177 @@ +-- +-- 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 communities construct +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- for PG +-- +-- @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: communities-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create table dotlrn_community_types ( + 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), + tree_sortkey varbit, + max_child_sortkey varbit +); + +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 + references dotlrn_communities_all (community_id), + community_type varchar(100) not null + constraint dotlrn_c_community_type_fk + references dotlrn_community_types (community_type), + community_key varchar(100) + constraint dotlrn_c_community_key_nn + not null, + pretty_name varchar(100) + constraint dotlrn_c_pretty_name_nn + not null, + description varchar(4000), + active_start_date date, + active_end_date date, + 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), + non_member_portal_id integer + constraint dotlrn_c_non_member_portal_fk + references portals (portal_id), + admin_portal_id integer + constraint dotlrn_c_admin_portal_id_fk + references portals (portal_id), + package_id integer + constraint dotlrn_c_package_id_fk + references apm_packages (package_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 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.*, + groups.join_policy + from dotlrn_communities, + groups + where dotlrn_communities.community_id = groups.group_id + and groups.join_policy <> 'closed'; + +create view dotlrn_active_communities +as + select * + from dotlrn_communities + where (active_start_date is null or active_start_date < now()) + and (active_end_date is null or active_end_date > now()); + +create view dotlrn_active_comms_not_closed +as + select dotlrn_communities.*, + groups.join_policy + from dotlrn_active_communities dotlrn_communities, + groups + where dotlrn_communities.community_id = groups.group_id + and groups.join_policy <> 'closed'; + +create table dotlrn_applets ( + applet_id integer + constraint dotlrn_applets_applet_pk + primary key, + applet_key varchar(100) + constraint dotlrn_applets_applet_key_nn + not null + constraint dotlrn_applets_applet_key_uk + unique, + status char(10) + default 'active' + constraint dotlrn_applets_status_nn + not null + constraint dotlrn_applets_status_ck + check (status in ('active','inactive')) +); + +create table dotlrn_community_applets ( + community_id integer + constraint dotlrn_ca_community_id_nn + not null + constraint dotlrn_ca_community_id_fk + references dotlrn_communities_all (community_id), + applet_id integer + constraint dotlrn_ca_applet_key_nn + not null + references dotlrn_applets (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_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 communities-tree-create.sql Index: openacs-4/packages/dotlrn/sql/postgresql/communities-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/communities-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/communities-drop.sql 8 Jul 2002 21:04:16 -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: communities-drop.sql,v 1.1 2002/07/08 21:04:16 yon 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/communities-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/communities-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/communities-package-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,373 @@ +-- +-- 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 communities construct +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- for PG +-- +-- @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: communities-package-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +select define_function_args ('dotlrn_community_type__new','community_type,parent_type;dotlrn_community,pretty_name,pretty_plural,description,package_id,creation_date,creation_user,creation_ip,context_id'); + +select define_function_args ('dotlrn_community_type__delete','community_type'); + +select define_function_args ('dotlrn_community_type__name','community_type'); + +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; +BEGIN + return dotlrn_community_type__new( + p_community_type, + p_parent_type, + p_pretty_name, + p_pretty_plural, + p_description, + null, + null, + null, + null, + null + ); +END; +' language 'plpgsql'; + +create function dotlrn_community_type__new (varchar,varchar,varchar,varchar,varchar,integer,timestamp,integer,varchar,integer) +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_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_parent_object_type acs_object_types.object_type%TYPE; + v_unique_name acs_objects.object_id%TYPE; +BEGIN + if p_parent_type is null then + v_parent_object_type:= ''group''; + else + v_parent_object_type:= p_parent_type; + end if; + + select acs_object_id_seq.nextval + into v_unique_name + from dual; + + PERFORM acs_object_type__create_type ( + p_community_type, + p_community_type, + p_community_type, + v_parent_object_type, + v_unique_name, + v_unique_name, + v_unique_name, + ''f'', + null, + ''acs_group.name'' + ); + + insert + into group_types + (group_type, default_join_policy) + values + (p_community_type, ''closed''); + + insert + into dotlrn_community_types + (community_type, + pretty_name, + description, + package_id, + supertype) + values + (p_community_type, + p_pretty_name, + p_description, + p_package_id, + p_parent_type); + + return p_community_type; +END; +' language 'plpgsql'; + + +create function dotlrn_community_type__delete(varchar) +returns integer as ' +DECLARE + p_community_type alias for $1; +BEGIN + delete + from dotlrn_community_types + where community_type = p_community_type; + + delete + from group_types + where group_type = p_community_type; + + PERFORM acs_object_type__drop_type(p_community_type, ''f''); + return 0; +END; +' language 'plpgsql'; + + +create function dotlrn_community_type__name(varchar) +returns varchar as ' +DECLARE + p_community_type alias for $1; + v_name dotlrn_community_types.pretty_name%TYPE; +BEGIN + 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_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'); + +select define_function_args('dotlrn_community__delete','community_id'); + +select define_function_args('dotlrn_community__name','community_id'); + +select define_function_args('dotlrn_community__member_p','community_id,party_id'); + +select define_function_args('dotlrn_community__admin_p','community_id,party_id'); + +select define_function_args('dotlrn_community__url','community_id'); + + +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_type alias for $3; + 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, + p_community_key, + p_join_policy + ); + + insert into dotlrn_communities + (community_id, + parent_community_id, + community_type, + community_key, + pretty_name, + description, + package_id, + portal_id, + portal_template_id) + values + (c_id, + p_parent_community_id, + p_community_type, + p_community_key, + p_pretty_name, + p_description, + p_package_id, + p_portal_id, + p_archived_p, + p_portal_id, + p_non_member_portal_id); + + return c_id; +END; +' language 'plpgsql'; + + +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_end_date alias for $3; +BEGIN + update dotlrn_communities_all + set active_start_date = p_start_date, + active_end_date = p_end_date + where community_id = p_community_id; + + return p_community_id; +END; +' language 'plpgsql'; + +create function dotlrn_community__delete(integer) +returns integer as ' +DECLARE + p_community_id alias for $1; +BEGIN + delete + from dotlrn_communities + where community_id = p_community_id; + + PERFORM acs_group__delete(p_community_id); + return 0; +END; +' language 'plpgsql'; + + +create function dotlrn_community__name(integer) +returns varchar as ' +DECLARE + p_community_id alias for $1; +BEGIN + return acs_group__name(p_community_id); +END; +' language 'plpgsql'; + + +create function dotlrn_community__member_p(integer,integer) +returns boolean as ' +DECLARE + p_community_id alias for $1; + p_party_id alias for $2; + v_member_p char(1); +BEGIN + 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_party_id alias for $2; + v_rv char(1); +BEGIN + -- 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; + + return r_rv; +END; +' language 'plpgsql'; + + +create function dotlrn_community__url(integer) +returns varchar as ' +DECLARE + p_community_id alias for $1; + v_node_id site_nodes.node_id%TYPE; +BEGIN + select site_nodes.node_id into v_node_id + from dotlrn_communities_all, + site_nodes + 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 function dotlrn_community__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.*, + dotlrn_community__url(dotlrn_communities.community_id) as url, + groups.group_name, + groups.join_policy + from dotlrn_communities, + groups + where dotlrn_communities.community_id = groups.group_id; Index: openacs-4/packages/dotlrn/sql/postgresql/communities-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/communities-package-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/communities-package-drop.sql 8 Jul 2002 21:04:16 -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: communities-package-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ + +drop view dotlrn_communities_full; +select drop_package('dotlrn_community'); +select drop_package('dotlrn_community_type'); Index: openacs-4/packages/dotlrn/sql/postgresql/communities-tree-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/communities-tree-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/communities-tree-create.sql 8 Jul 2002 21:04:16 -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 new; + 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/communities-tree-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/communities-tree-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/communities-tree-drop.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,23 @@ +-- +-- 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 on dotlrn_communities_all; +drop trigger dotlrn_community_types_in_tr on dotlrn_community_types; +drop function dotlrn_communities_in_tr(); +drop function dotlrn_community_types_in_tr(); Index: openacs-4/packages/dotlrn/sql/postgresql/community-membership-packages-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/Attic/community-membership-packages-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/community-membership-packages-drop.sql 8 Jul 2002 21:04:16 -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: community-membership-packages-drop.sql,v 1.1 2002/07/08 21:04:16 yon 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/community-memberships-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/community-memberships-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/community-memberships-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,82 @@ +-- +-- 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 communities membership constructs +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- for Oracle 8/8i. (We're guessing 9i works, too). +-- ported to PG by Yon and Ben +-- +-- @author Ben Adida (ben@openforce.net) +-- @author yon (yon@openforce.net) +-- @creation-date November 6th, 2001 +-- @version $Id: community-memberships-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create table dotlrn_member_rels ( + rel_id integer + constraint dotlrn_member_rels_rel_id_fk + references membership_rels (rel_id) + constraint dotlrn_member_rels_rel_id_pk + primary key +); + +create view dotlrn_member_rels_full +as + select acs_rels.rel_id as rel_id, + acs_rels.object_id_one as community_id, + acs_rels.object_id_two as user_id, + acs_rels.rel_type, + (select acs_rel_types.role_two + from acs_rel_types + where acs_rel_types.rel_type = acs_rels.rel_type) as role, + membership_rels.member_state + from dotlrn_member_rels, + acs_rels, + membership_rels + where dotlrn_member_rels.rel_id = acs_rels.rel_id + and acs_rels.rel_id = membership_rels.rel_id; + +create view dotlrn_member_rels_approved +as + select * + from dotlrn_member_rels_full + where member_state = 'approved'; + +create table dotlrn_admin_rels ( + rel_id integer + constraint dotlrn_admin_rels_rel_id_fk + references dotlrn_member_rels (rel_id) + constraint dotlrn_admin_rels_rel_id_pk + primary key +); + +create view dotlrn_admin_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_admin_rels + where dotlrn_member_rels_full.rel_id = dotlrn_admin_rels.rel_id; + +-- Index: openacs-4/packages/dotlrn/sql/postgresql/community-memberships-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/community-memberships-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/community-memberships-drop.sql 8 Jul 2002 21:04:16 -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: community-memberships-drop.sql,v 1.1 2002/07/08 21:04:16 yon 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/community-memberships-packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/community-memberships-packages-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/community-memberships-packages-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,423 @@ +-- +-- 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 memberships packages +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- for Oracle 8/8i. (We're guessing 9i works, too). +-- ported to PG by Yon and Ben +-- +-- ben@openforce.net +-- started November 6th, 2001 +-- + +-- +-- Basic dotLRN membership rel +-- + +select define_function_args('dotlrn_member_rel__new','rel_id,rel_type;dotlrn_member_rel,portal_id,community_id,user_id,member_state;approved,creation_user,creation_ip'); + +select define_function_args('dotlrn_member_rel__delete','rel_id'); + + +create function dotlrn_member_rel__new(integer,varchar,integer,integer,integer,varchar,integer,varchar) +returns integer as ' +DECLARE + p_rel_id alias for $1; + p_rel_type alias for $2; + p_portal_id alias for $3; + p_community_id alias for $4; + p_user_id alias for $5; + p_member_state alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + v_rel_id integer; +BEGIN + v_rel_id:= membership_rel__new( + p_rel_id, + p_rel_type, + p_community_id, + p_user_id, + p_member_state, + p_creation_user, + p_creation_ip + ); + + insert + into dotlrn_member_rels + (rel_id, portal_id) + values + (v_rel_id, p_portal_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +create function dotlrn_member_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete from dotlrn_member_rels where rel_id= p_rel_id; + + PERFORM membership_rel__delete(p_rel_id); + + return 0; +END; +' language 'plpgsql'; + + + +select define_function_args('dotlrn_admin_rel__new','rel_id,rel_type;dotlrn_admin_rel,community_id,user_id,member_state,portal_id,creation_user,creation_ip'); + +select define_function_args('dotlrn_admin_rel__delete','rel_id'); + +create function dotlrn_admin_rel__new(integer,varchar,integer,integer,varchar,integer,integer,varchar) +returns integer as ' +DECLARE + p_rel_id alias for $1; + p_rel_type alias for $2; + p_community_id alias for $3; + p_user_id alias for $4; + p_member_state alias for $5; + p_portal_id alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + v_rel_id integer; +BEGIN + v_rel_id:= dotlrn_member_rel__new( + p_rel_id, + p_rel_type, + p_portal_id, + p_community_id, + p_user_id, + p_member_state, + p_creation_user, + p_creation_ip + ); + + insert + into dotlrn_admin_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +create function dotlrn_admin_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete from dotlrn_admin_rels where rel_id= p_rel_id; + + PERFORM dotlrn_admin_rel__delete(p_rel_id); + + return 0; +END; +' language 'plpgsql'; + + +select define_function_args('dotlrn_student_rel__new','rel_id,rel_type;dotlrn_student_rel,portal_id,class_instance_id,user_id,member_state,creation_user,creation_ip'); + +select define_function_args('dotlrn_student_rel__delete','rel_id'); + +create function dotlrn_student_rel__new(integer,varchar,integer,integer,integer,varchar,integer,varchar) +returns integer as ' +DECLARE + p_rel_id alias for $1; + p_rel_type alias for $2; + p_portal_id alias for $3; + p_class_instance_id alias for $4; + p_user_id alias for $5; + p_member_state alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + v_rel_id integer; +BEGIN + v_rel_id:= dotlrn_member_rel__new( + p_rel_id, + p_rel_type, + p_portal_id, + p_class_instance_id, + p_user_id, + p_member_state, + p_creation_user, + p_creation_ip + ); + + insert + into dotlrn_student_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +create function dotlrn_student_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete from dotlrn_student_rels where rel_id= p_rel_id; + + PERFORM dotlrn_member_rel__delete(p_rel_id); + + return 0; +END; +' language 'plpgsql'; + + + +select define_function_args('dotlrn_ta_rel__new','rel_id,rel_type;dotlrn_ta_rel,class_instance_id,user_id,member_state,portal_id,creation_user,creation_ip'); + +select define_function_args('dotlrn_ta_rel__delete','rel_id'); + + +create function dotlrn_ta_rel__new(integer,varchar,integer,integer,varchar,integer,integer,varchar) +returns integer as ' +DECLARE + p_rel_id alias for $1; + p_rel_type alias for $2; + p_class_instance_id alias for $3; + p_user_id alias for $4; + p_member_state alias for $5; + p_portal_id alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + v_rel_id integer; +BEGIN + v_rel_id:= dotlrn_admin_rel__new( + p_rel_id, + p_rel_type, + p_class_instance_id, + p_user_id, + p_member_state, + p_portal_id, + p_creation_user, + p_creation_ip + ); + + insert + into dotlrn_ta_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +create function dotlrn_ta_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotlrn_ta_rels + where rel_id = p_rel_id; + + PERFORM dotlrn_admin_rel__delete(rel_id); + + return 0; +END; +' language 'plpgsql'; + + +-- ca rel + +select define_function_args('dotlrn_ca_rel__new','rel_id,rel_type;dotlrn_ca_rel,class_instance_id,user_id,member_state,portal_id,creation_user,creation_ip'); + +select define_function_args('dotlrn_ca_rel__delete','rel_id'); + + +create function dotlrn_ca_rel__new(integer,varchar,integer,integer,varchar,integer,integer,varchar) +returns integer as ' +DECLARE + p_rel_id alias for $1; + p_rel_type alias for $2; + p_class_instance_id alias for $3; + p_user_id alias for $4; + p_member_state alias for $5; + p_portal_id alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + v_rel_id integer; +BEGIN + v_rel_id:= dotlrn_admin_rel__new( + p_rel_id, + p_rel_type, + p_class_instance_id, + p_user_id, + p_member_state, + p_portal_id, + p_creation_user, + p_creation_ip + ); + + insert + into dotlrn_ca_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +create function dotlrn_ca_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotlrn_ca_rels + where rel_id = p_rel_id; + + PERFORM dotlrn_admin_rel__delete(rel_id); + + return 0; +END; +' language 'plpgsql'; + + +-- course admin + +select define_function_args('dotlrn_cadmin_rel__new','rel_id,rel_type;dotlrn_cadmin_rel,class_instance_id,user_id,member_state,portal_id,creation_user,creation_ip'); + +select define_function_args('dotlrn_cadmin_rel__delete','rel_id'); + + +create function dotlrn_cadmin_rel__new(integer,varchar,integer,integer,varchar,integer,integer,varchar) +returns integer as ' +DECLARE + p_rel_id alias for $1; + p_rel_type alias for $2; + p_class_instance_id alias for $3; + p_user_id alias for $4; + p_member_state alias for $5; + p_portal_id alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + v_rel_id integer; +BEGIN + v_rel_id:= dotlrn_admin_rel__new( + p_rel_id, + p_rel_type, + p_class_instance_id, + p_user_id, + p_member_state, + p_portal_id, + p_creation_user, + p_creation_ip + ); + + insert + into dotlrn_cadmin_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +create function dotlrn_cadmin_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotlrn_cadmin_rels + where rel_id = p_rel_id; + + PERFORM dotlrn_admin_rel__delete(rel_id); + + return 0; +END; +' language 'plpgsql'; + + +-- instructor rel + +select define_function_args('dotlrn_instructor_rel__new','rel_id,rel_type;dotlrn_instructor_rel,class_instance_id,user_id,member_state,portal_id,creation_user,creation_ip'); + +select define_function_args('dotlrn_instructor_rel__delete','rel_id'); + + +create function dotlrn_instructor_rel__new(integer,varchar,integer,integer,varchar,integer,integer,varchar) +returns integer as ' +DECLARE + p_rel_id alias for $1; + p_rel_type alias for $2; + p_class_instance_id alias for $3; + p_user_id alias for $4; + p_member_state alias for $5; + p_portal_id alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + v_rel_id integer; +BEGIN + v_rel_id:= dotlrn_admin_rel__new( + p_rel_id, + p_rel_type, + p_class_instance_id, + p_user_id, + p_member_state, + p_portal_id, + p_creation_user, + p_creation_ip + ); + + insert + into dotlrn_instructor_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +create function dotlrn_instructor_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotlrn_instructor_rels + where rel_id = p_rel_id; + + PERFORM dotlrn_admin_rel__delete(rel_id); + + return 0; +END; +' language 'plpgsql'; + Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admin-profile-provider-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admin-profile-provider-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-init.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-package-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-package-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-admins-sanitize.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-applet-sc-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-applet-sc-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-class-membership-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-class-memberships-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-classes-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-classes-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-clubs-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-clubs-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.7 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-package-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-package-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-tree-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-communities-tree-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-community-membership-packages-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-community-memberships-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-community-memberships-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-community-memberships-packages-create.sql'. Fisheye: No comparison available. Pass `N' to diff? 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.6 -r1.7 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-create.sql 3 Jul 2002 19:58:07 -0000 1.6 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-create.sql 8 Jul 2002 21:04:16 -0000 1.7 @@ -25,17 +25,17 @@ -- started August 18th, 2001 -- -\i dotlrn-users-create.sql -\i dotlrn-portal-types-create.sql -\i dotlrn-communities-create.sql -\i dotlrn-community-memberships-create.sql -\i dotlrn-communities-package-create.sql +\i users-create.sql +\i portal-types-create.sql +\i communities-create.sql +\i community-memberships-create.sql +\i communities-package-create.sql \i dotlrn-init.sql -\i dotlrn-clubs-create.sql -\i dotlrn-classes-create.sql -\i dotlrn-class-memberships-create.sql -\i dotlrn-applet-sc-create.sql -\i dotlrn-community-memberships-packages-create.sql -\i dotlrn-main-portlet-create.sql -\i dotlrn-security-create.sql -\i dotlrn-user-extension-create.sql +\i clubs-create.sql +\i classes-create.sql +\i class-memberships-create.sql +\i applet-sc-create.sql +\i community-memberships-packages-create.sql +\i main-portlet-create.sql +\i security-create.sql +\i user-extension-create.sql Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-dotlrn-sanitize.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/dotlrn-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-drop.sql 3 Jul 2002 19:58:07 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-drop.sql 8 Jul 2002 21:04:16 -0000 1.2 @@ -22,17 +22,17 @@ -- @version $Id$ -- -\i dotlrn-user-extension-drop.sql -\i dotlrn-security-drop.sql -\i dotlrn-main-portlet-drop.sql -\i dotlrn-community-membership-packages-drop.sql -\i dotlrn-applet-sc-drop.sql -\i dotlrn-class-membership-drop.sql -\i dotlrn-classes-drop.sql +\i user-extension-drop.sql +\i security-drop.sql +\i main-portlet-drop.sql +\i community-membership-packages-drop.sql +\i applet-sc-drop.sql +\i class-membership-drop.sql +\i 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 +\i dotlrn-sanitize.sql +\i communities-package-drop.sql +\i community-memberships-drop.sql +\i communities-drop.sql +\i portal-types-drop.sql +\i users-drop.sql Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-external-profile-provider-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-external-profile-provider-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-init.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-package-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-package-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-externals-sanitize.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.7 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-main-portlet-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-main-portlet-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-portal-types-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-portal-types-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professor-profile-provider-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professor-profile-provider-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.7 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-init.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-package-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-package-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-professors-sanitize.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-sanitize.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/dotlrn-sanitize.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-sanitize.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,186 @@ +-- +-- 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-sanitize.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- +-- @note We remember September 11th, 2001 +-- + +create function inline_0() +returns integer as ' +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 + perform dotlrn_community_type__delete( + ''dotlrn_club'' + ); + + -- drop the dotlrn_class community type + perform 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'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-security-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-security-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-student-profile-provider-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-student-profile-provider-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-init.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-package-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-package-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-students-sanitize.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-user-extension-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-user-extension-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-user-profile-provider-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-user-profile-provider-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-init.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-package-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-package-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/sql/postgresql/dotlrn-users-sanitize.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/dotlrn/sql/postgresql/external-profile-provider-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/external-profile-provider-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/external-profile-provider-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,76 @@ +-- +-- 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. +-- + +-- +-- Implementation of the profile provider interface for dotLRN Externals. +-- +-- @author yon@openforce.net +-- @version $Id: external-profile-provider-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create function inline_0() +returns integer as ' +begin + + -- create the implementation + perform acs_sc_impl__new( + ''profile_provider'', + ''dotlrn_external_profile_provider'', + ''dotlrn_external_profile_provider'' + ); + + -- add the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_external_profile_provider'', + ''name'', + ''dotlrn_external_profile_provider::name'', + ''TCL'' + ); + + -- prettyName method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_external_profile_provider'', + ''prettyName'', + ''dotlrn_external_profile_provider::prettyName'', + ''TCL'' + ); + + -- render method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_external_profile_provider'', + ''render'', + ''dotlrn_external_profile_provider::render'', + ''TCL'' + ); + + -- bind this implementation to the interface it implements + perform acs_sc_binding__new( + ''profile_provider'', + ''dotlrn_external_profile_provider'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + Index: openacs-4/packages/dotlrn/sql/postgresql/external-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/external-profile-provider-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/external-profile-provider-drop.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,73 @@ +-- +-- 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. +-- + +-- +-- Implementation of the profile provider interface for dotLRN Externals. +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: external-profile-provider-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- drop the binding between this implementation and the interface it + -- implements. + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotlrn_external_profile_provider'' + ); + + -- drop the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_external_profile_provider'', + ''name'' + ); + + -- prettyName method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_external_profile_provider'', + ''prettyName'' + ); + + -- render method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_external_profile_provider'', + ''render'' + ); + + -- drop the implementation + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotlrn_external_profile_provider'' + ); + + return 0; + +end; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/externals-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/externals-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/externals-create.sql 8 Jul 2002 21:04:16 -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. +-- + +-- +-- Create the dotLRN Externals package +-- +-- @author yon@openforce.net +-- @version $Id: externals-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create table dotlrn_external_profile_rels ( + rel_id integer + constraint dotlrn_external_p_rels_rel_fk + references dotlrn_user_profile_rels (rel_id) + constraint dotlrn_external_p_rels_pk + primary key +); + +\i external-profile-provider-create.sql +\i externals-init.sql +\i externals-package-create.sql Index: openacs-4/packages/dotlrn/sql/postgresql/externals-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/externals-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/externals-drop.sql 8 Jul 2002 21:04:16 -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 the dotLRN Externals package +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: externals-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +\i externals-package-drop.sql +\i externals-sanitize.sql +\i external-profile-provider-drop.sql + +drop table dotlrn_external_profile_rels; Index: openacs-4/packages/dotlrn/sql/postgresql/externals-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/externals-init.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/externals-init.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,90 @@ +-- +-- 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. +-- + +-- +-- Initialize the dotLRN Externals package +-- +-- @author yon@openforce.net +-- @version $Id: externals-init.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + + +create function inline_1() +returns integer as ' +declare + foo integer; + gid integer; + dotlrn_users_group_id integer; +begin + + PERFORM acs_rel_type__create_type( + ''dotlrn_external_profile_rel'', + ''dotLRN Profile External'', + ''dotLRN External Externals'', + ''dotlrn_user_profile_rel'', + ''dotlrn_external_profile_rels'', + ''rel_id'', + ''dotlrn_external_profile_rel'', + ''profiled_group'', + null, + 0, + null, + ''user'', + null, + 0, + 1 + ); + + select min(impl_id) + into foo + from acs_sc_impls + where impl_name = ''dotlrn_external_profile_provider''; + + gid := profiled_group__new( + foo, + ''dotLRN Externals'' + ); + + insert + into dotlrn_user_types + (type, pretty_name, group_id) + values + (''external'', ''dotLRN Externals'', gid); + + foo := rel_segment__new( + ''dotLRN Externals'', + gid, + ''dotlrn_external_profile_rel'' + ); + + select group_id + into dotlrn_users_group_id + from groups + where group_name = ''dotLRN Users''; + + foo := composition_rel__new( + dotlrn_users_group_id, + gid + ); + + return 0; + +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); + Index: openacs-4/packages/dotlrn/sql/postgresql/externals-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/externals-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/externals-package-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,91 @@ +-- +-- 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 External package +-- +-- @author yon@openforce.net +-- @version $Id: externals-package-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +select define_function_args ('dotlrn_external_profile_rel__new','rel_id,id,rel_type;dotlrn_external_profile_rel,group_id,user_id,creation_user,creation_ip'); + +select define_function_args ('dotlrn_external_profile_rel__delete','rel_id'); + + +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_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) + 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_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_creation_user, + p_creation_ip + ); + + insert + into dotlrn_external_profile_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +create function dotlrn_external_profile_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotlrn_external_profile_rels + where rel_id = p_rel_id; + + PERFORM dotlrn_user_profile_rel__delete(p_rel_id); + return (0); +END; +' language 'plpgsql'; + Index: openacs-4/packages/dotlrn/sql/postgresql/externals-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/externals-package-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/externals-package-drop.sql 8 Jul 2002 21:04:16 -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. +-- + +-- +-- Create the dotLRN Externals package +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: externals-package-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +select drop_package('dotlrn_external_profile_rel'); Index: openacs-4/packages/dotlrn/sql/postgresql/externals-sanitize.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/externals-sanitize.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/externals-sanitize.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,93 @@ +-- +-- 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 the dotLRN External package +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: externals-sanitize.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +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''; + + perform rel_segment__delete( + foo + ); + + perform acs_rel_type__drop_type( + ''dotlrn_full_external_profile_rel'', + ''t'' + ); + + 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''; + + 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''); + + delete + from dotlrn_user_types + where group_id = foo; + + perform profiled_group__delete( + foo + ); + + perform acs_rel_type__drop_type( + ''dotlrn_external_profile_rel'', + ''t'' + ); + + return 0; + +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotlrn/sql/postgresql/main-portlet-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/main-portlet-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/main-portlet-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,154 @@ +-- +-- 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. +-- + +-- +-- packages/dotlrn/sql/oracle/dotlrn-main-portlet-create.sql +-- + +-- Creates a dotLRN datasource for including on a user's main portal page. + +-- Copyright (C) 2001 OpenForce, Inc. +-- @author Ben Adida (ben@openforce.net) +-- @author dan chak (chak@openforce.net) +-- @creation-date 2001-11-05 + +-- $Id: main-portlet-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- 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; + foo integer; +begin + ds_id := portal_datasource__new( + null, + ''dotlrn_main_portlet'', + ''Displays the list of communities a user belongs to'', + ''portal_datasource'', + now(), + null, + null, + null + ); + + -- the standard 4 params + + -- shadeable_p + perform portal_datasource__set_def_param( + ds_id, ''t'', ''t'', ''shadeable_p'', ''f'' + ); + + -- hideable_p + perform portal_datasource__set_def_param( + ds_id, ''t'', ''t'', ''hideable_p'', ''f'' + ); + + -- user_editable_p + perform portal_datasource__set_def_param( + ds_id, ''t'', ''t'', ''user_editable_p'', ''f'' + ); + + -- shaded_p + perform portal_datasource__set_def_param( + ds_id, ''t'', ''t'', ''shaded_p'', ''f'' + ); + + -- link_hideable_p + perform portal_datasource__set_def_param( + ds_id, ''t'', ''t'', ''link_hideable_p'', ''t'' + ); + + -- create the implementation + perform acs_sc_impl__new( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''dotlrn_main_portlet'' + ); + + -- add all the hooks + perform acs_sc_impl_alias__new ( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''GetMyName'', + ''dotlrn_main_portlet::get_my_name'', + ''TCL'' + ); + + perform acs_sc_impl_alias__new ( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''GetPrettyName'', + ''dotlrn_main_portlet::get_pretty_name'', + ''TCL'' + ); + + perform acs_sc_impl_alias__new ( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''Link'', + ''dotlrn_main_portlet::link'', + ''TCL'' + ); + + perform acs_sc_impl_alias__new ( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''AddSelfToPage'', + ''dotlrn_main_portlet::add_self_to_page'', + ''TCL'' + ); + + perform acs_sc_impl_alias__new ( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''RemoveSelfFromPage'', + ''dotlrn_main_portlet::remove_self_from_page'', + ''TCL'' + ); + + perform acs_sc_impl_alias__new ( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''Show'', + ''dotlrn_main_portlet::show'', + ''TCL'' + ); + + perform acs_sc_impl_alias__new ( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''Edit'', + ''dotlrn_main_portlet::edit'', + ''TCL'' + ); + + -- Add the binding + perform acs_sc_binding__new ( + ''portal_datasource'', + ''dotlrn_main_portlet'' + ); + + return 0; + +end; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/main-portlet-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/main-portlet-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/main-portlet-drop.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,109 @@ +-- +-- 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. +-- + + +-- Drops dotLRN main portlet datasources for portal portlets + +-- Copyright (C) 2001 Openforce, Inc. +-- @author Ben Adida (ben@openforce.net) +-- @creation-date 2001-11-04 + +-- $Id: main-portlet-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- 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_alias__delete( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''GetMyName'' + ); + + perform acs_sc_impl_alias__delete( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''GetPrettyName'' + ); + + perform acs_sc_impl_alias__delete( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''Link'' + ); + + perform acs_sc_impl_alias__delete( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''AddSelfToPage'' + ); + + perform acs_sc_impl_alias__delete( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''RemoveSelfFromPage'' + ); + + perform acs_sc_impl_alias__delete( + ''portal_datasource'', + ''dotlrn_main_portlet'', + ''Show'' + ); + + perform acs_sc_impl_alias__delete( + ''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''; +-- cant seem to get the exception working properly.. +-- is it really necessary here? look into it later. -dan chak 2002-07-02 +-- exception when no_data_found then +-- ds_id := null; + end; + + if ds_id is not null then + portal_datasource__delete(ds_id); + end if; + + return 0; + +end; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + Index: openacs-4/packages/dotlrn/sql/postgresql/portal-types-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/portal-types-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/portal-types-create.sql 8 Jul 2002 21:04:16 -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: portal-types-create.sql,v 1.1 2002/07/08 21:04:16 yon 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/portal-types-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/portal-types-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/portal-types-drop.sql 8 Jul 2002 21:04:16 -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: portal-types-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +drop table dotlrn_portal_types_map; Index: openacs-4/packages/dotlrn/sql/postgresql/professor-profile-provider-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/professor-profile-provider-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/professor-profile-provider-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,77 @@ +-- +-- 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. +-- + +-- +-- Implementation of the profile provider interface for dotLRN Professors. +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: professor-profile-provider-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create function inline_0() +returns integer as ' +begin + + -- create the implementation + perform acs_sc_impl__new( + ''profile_provider'', + ''dotlrn_professor_profile_provider'', + ''dotlrn_professor_profile_provider'' + ); + + -- add the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_professor_profile_provider'', + ''name'', + ''dotlrn_professor_profile_provider::name'', + ''TCL'' + ); + + -- prettyName method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_professor_profile_provider'', + ''prettyName'', + ''dotlrn_professor_profile_provider::prettyName'', + ''TCL'' + ); + + -- render method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_professor_profile_provider'', + ''render'', + ''dotlrn_professor_profile_provider::render'', + ''TCL'' + ); + + -- bind this implementation to the interface it implements + perform acs_sc_binding__new( + ''profile_provider'', + ''dotlrn_professor_profile_provider'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + Index: openacs-4/packages/dotlrn/sql/postgresql/professor-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/professor-profile-provider-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/professor-profile-provider-drop.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,72 @@ +-- +-- 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. +-- + +-- +-- Implementation of the profile provider interface for dotLRN Professors. +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: professor-profile-provider-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- drop the binding between this implementation and the interface it + -- implements. + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotlrn_professor_profile_provider'' + ); + + -- drop the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_professor_profile_provider'', + ''name'' + ); + + -- prettyName method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_professor_profile_provider'', + ''prettyName'' + ); + + -- render method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_professor_profile_provider'', + ''render'' + ); + + -- drop the implementation + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotlrn_professor_profile_provider'' + ); + + return 0; +end; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/professors-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/professors-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/professors-create.sql 8 Jul 2002 21:04:16 -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. +-- + +-- +-- Create the dotLRN Professors package +-- +-- @author yon@openforce.net +-- @version $Id: professors-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create table dotlrn_professor_profile_rels ( + rel_id integer + constraint dotlrn_prof_rels_rel_id_fk + references dotlrn_user_profile_rels (rel_id) + constraint dotlrn_prof_profile_rels_pk + primary key +); + +\i professor-profile-provider-create.sql +\i professors-init.sql +\i professors-package-create.sql Index: openacs-4/packages/dotlrn/sql/postgresql/professors-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/professors-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/professors-drop.sql 8 Jul 2002 21:04:16 -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 the dotLRN Professors package +-- +-- @author yon@openforce.net +-- author dan chak (chak@openforce.net) +-- @version $Id: professors-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +\i professors-package-drop.sql +\i professors-sanitize.sql +\i professor-profile-provider-drop.sql + +drop table dotlrn_professor_profile_rels; Index: openacs-4/packages/dotlrn/sql/postgresql/professors-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/professors-init.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/professors-init.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,90 @@ +-- +-- 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. +-- + +-- +-- Initialize the dotLRN Professors package +-- +-- @author yon@openforce.net +-- @version $Id: professors-init.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + + +create function inline_1() +returns integer as ' +declare + foo integer; + gid integer; + dotlrn_users_group_id integer; +begin + + PERFORM acs_rel_type__create_type( + ''dotlrn_professor_profile_rel'', + ''dotLRN Professor Profile Professor'', + ''dotLRN Professor Profile Professors'', + ''dotlrn_user_profile_rel'', + ''dotlrn_professor_profile_rels'', + ''rel_id'', + ''dotlrn_professor_profile_rel'', + ''profiled_group'', + null, + 0, + null, + ''user'', + null, + 0, + 1 + ); + + select min(impl_id) + into foo + from acs_sc_impls + where impl_name = ''dotlrn_professor_profile_provider''; + + gid := profiled_group__new( + foo, + ''dotLRN Professors'' + ); + + insert + into dotlrn_user_types + (type, pretty_name, group_id) + values + (''professor'', ''Professor'', gid); + + foo := rel_segment__new( + ''dotLRN Professors'', + gid, + ''dotlrn_professor_profile_rel'' + ); + + select group_id + into dotlrn_users_group_id + from groups + where group_name = ''dotLRN Users''; + + foo := composition_rel__new( + dotlrn_users_group_id, + gid + ); + + return 0; + +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); + Index: openacs-4/packages/dotlrn/sql/postgresql/professors-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/professors-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/professors-package-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,92 @@ +-- +-- 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 Professor package +-- +-- @author yon@openforce.net +-- @version $Id: professors-package-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +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,integer,integer,integer,integer,integer,integer,varchar) +returns integer as ' +DECLARE + 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) + 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_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_creation_user, + p_creation_ip + ); + + insert + into dotlrn_professor_profile_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +create function dotlrn_professor_profile_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotlrn_professor_profile_rels + where rel_id = p_rel_id; + + PERFORM dotlrn_user_profile_rel__delete(p_rel_id); + return (0); +END; +' language 'plpgsql'; + + Index: openacs-4/packages/dotlrn/sql/postgresql/professors-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/professors-package-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/professors-package-drop.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,26 @@ +-- +-- 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 Professors package +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: professors-package-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +select drop_package('dotlrn_full_prof_profile_rel'); +select drop_package('dotlrn_professor_profile_rel'); Index: openacs-4/packages/dotlrn/sql/postgresql/professors-sanitize.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/professors-sanitize.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/professors-sanitize.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,91 @@ +-- +-- 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 the dotLRN Professor package +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: professors-sanitize.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +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''; + + perform rel_segment__delete( + foo + ); + + perform acs_rel_type__drop_type( + ''dotlrn_full_professor_profile_rel'', + ''t'' + ); + + 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 Professors''; + + 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''); + + delete + from dotlrn_user_types + where group_id = foo; + + perform profiled_group__delete( + foo + ); + + perform acs_rel_type__drop_type( + ''dotlrn_professor_profile_rel'', + ''t'' + ); + + return 0; +end; +' language 'plpgsql'; +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotlrn/sql/postgresql/security-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/security-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/security-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,83 @@ +-- +-- 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 Project +-- +-- copyright 2001, OpenForce +-- released under the GPL, v2.0 +-- +-- ben@openforce +-- ported to PG by Yon and Ben +-- @author dan chak (chak@openforce.net) +-- @version $Id: security-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- +-- creation date 11/28/2001 +-- +-- Security Setup for dotLRN +-- privileges, privilege inheritance +-- +create function inline_0() +returns integer as ' +BEGIN + -- the ability to browse dotLRN in general + perform acs_privilege__create_privilege(''dotlrn_browse''); + + -- the ability to even view that a community exists + perform acs_privilege__create_privilege(''dotlrn_view_community''); + + -- the ability to participate in a community + perform acs_privilege__create_privilege(''dotlrn_edit_community''); + + -- the ability to admin a community + perform acs_privilege__create_privilege(''dotlrn_admin_community''); + + -- the ability to create a community + perform acs_privilege__create_privilege(''dotlrn_create_community''); + + -- the ability to even view a community type + perform acs_privilege__create_privilege(''dotlrn_view_community_type''); + + -- the ability to admin a community type + perform acs_privilege__create_privilege(''dotlrn_admin_community_type''); + + -- the ability to create a community type + perform acs_privilege__create_privilege(''dotlrn_create_community_type''); + + -- Consistent permissions + perform acs_privilege__add_child(''dotlrn_edit_community'', ''dotlrn_view_community''); + perform acs_privilege__add_child(''dotlrn_admin_community'', ''dotlrn_edit_community''); + + -- inheritance + perform acs_privilege__add_child(''create'', ''dotlrn_create_community_type''); + perform acs_privilege__add_child(''create'', ''dotlrn_create_community''); + perform acs_privilege__add_child(''write'', ''dotlrn_edit_community''); + perform acs_privilege__add_child(''read'', ''dotlrn_view_community''); + perform acs_privilege__add_child(''read'', ''dotlrn_view_community_type''); + perform acs_privilege__add_child(''admin'', ''dotlrn_admin_community''); + perform acs_privilege__add_child(''admin'', ''dotlrn_admin_community_type''); + + -- for now, we only want admins to be able to browse by default + perform acs_privilege__add_child(''admin'', ''dotlrn_browse''); + + -- no default permissions + + return 0; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/security-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/security-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/security-drop.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,68 @@ +-- +-- 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: security-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create function inline0() +returns integer as ' +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''); + + return 0; + +end;' language 'plpgsql'; + +select inline0(); +drop function inline0(); Index: openacs-4/packages/dotlrn/sql/postgresql/student-profile-provider-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/student-profile-provider-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/student-profile-provider-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,77 @@ +-- +-- 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. +-- + +-- +-- Implementation of the profile provider interface for dotLRN Students. +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: student-profile-provider-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create function inline_0() +returns integer as ' +begin + + -- create the implementation + perform acs_sc_impl__new( + ''profile_provider'', + ''dotlrn_student_profile_provider'', + ''dotlrn_student_profile_provider'' + ); + + -- add the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_student_profile_provider'', + ''name'', + ''dotlrn_student_profile_provider::name'', + ''TCL'' + ); + + -- prettyName method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_student_profile_provider'', + ''prettyName'', + ''dotlrn_student_profile_provider::prettyName'', + ''TCL'' + ); + + -- render method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_student_profile_provider'', + ''render'', + ''dotlrn_student_profile_provider::render'', + ''TCL'' + ); + + -- bind this implementation to the interface it implements + perform acs_sc_binding__new( + ''profile_provider'', + ''dotlrn_student_profile_provider'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + Index: openacs-4/packages/dotlrn/sql/postgresql/student-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/student-profile-provider-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/student-profile-provider-drop.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,71 @@ +-- +-- 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. +-- + +-- +-- Implementation of the profile provider interface for dotLRN Students. +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: student-profile-provider-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- drop the binding between this implementation and the interface it + -- implements__ + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotlrn_student_profile_provider'' + ); + + -- drop the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_student_profile_provider'', + ''name'' + ); + + -- prettyName method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_student_profile_provider'', + ''prettyName'' + ); + + -- render method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_student_profile_provider'', + ''render'' + ); + + -- drop the implementation + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotlrn_student_profile_provider'' + ); + + return 0; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/students-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/students-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/students-create.sql 8 Jul 2002 21:04:16 -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. +-- + +-- +-- Create the dotLRN Students package +-- +-- @author yon@openforce.net +-- @version $Id: students-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create table dotlrn_student_profile_rels ( + rel_id integer + constraint dotlrn_student_p_rels_rel_fk + references dotlrn_user_profile_rels (rel_id) + constraint dotlrn_student_p_rels_pk + primary key +); + +\i student-profile-provider-create.sql +\i students-init.sql +\i students-package-create.sql Index: openacs-4/packages/dotlrn/sql/postgresql/students-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/students-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/students-drop.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,30 @@ +-- +-- 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 Students package +-- +-- @author yon@openforce.net +-- author dan chak (chak@openforce.net) +-- pg port on 2002-07-01 +-- @version $Id: students-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +\i students-package-drop.sql +\i students-sanitize.sql +\i student-profile-provider-drop.sql + +drop table dotlrn_student_profile_rels; Index: openacs-4/packages/dotlrn/sql/postgresql/students-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/students-init.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/students-init.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,90 @@ +-- +-- 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. +-- + +-- +-- Initialize the dotLRN Students package +-- +-- @author yon@openforce.net +-- @version $Id: students-init.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + + +create function inline_1() +returns integer as ' +declare + foo integer; + gid integer; + dotlrn_users_group_id integer; +begin + + PERFORM acs_rel_type__create_type( + ''dotlrn_student_profile_rel'', + ''dotLRN Profile Student'', + ''dotLRN Profile Students'', + ''dotlrn_user_profile_rel'', + ''dotlrn_student_profile_rels'', + ''rel_id'', + ''dotlrn_student_profile_rel'', + ''profiled_group'', + null, + 0, + null, + ''user'', + null, + 0, + 1 + ); + + select min(impl_id) + into foo + from acs_sc_impls + where impl_name = ''dotlrn_student_profile_provider''; + + gid := profiled_group__new( + foo, + ''dotLRN Students'' + ); + + insert + into dotlrn_user_types + (type, pretty_name, group_id) + values + (''student'', ''Student'', gid); + + foo := rel_segment__new( + ''dotLRN Students'', + gid, + ''dotlrn_student_profile_rel'' + ); + + select group_id + into dotlrn_users_group_id + from groups + where group_name = ''dotLRN Users''; + + foo := composition_rel__new( + dotlrn_users_group_id, + gid + ); + + return 0; + +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); + Index: openacs-4/packages/dotlrn/sql/postgresql/students-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/students-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/students-package-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,89 @@ +-- +-- 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 Student package +-- +-- @author yon@openforce.net +-- @version $Id: students-package-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +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,integer,integer,integer,varchar,integer,integer,varchar,integer,integer) +returns integer as ' +DECLARE + 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_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 + 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_user_profile_rel__new( + p_rel_id, + p_id, + p_rel_type, + v_group_id, + p_user_id, + p_creation_user, + p_creation_ip + ); + + insert + into dotlrn_student_profile_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +create function dotlrn_student_profile_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotlrn_student_profile_rels + where rel_id = p_rel_id; + + PERFORM dotlrn_user_profile_rel__delete(p_rel_id); + return (0); +END; +' language 'plpgsql'; + + Index: openacs-4/packages/dotlrn/sql/postgresql/students-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/students-package-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/students-package-drop.sql 8 Jul 2002 21:04:16 -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. +-- + +-- +-- Create the dotLRN Students package +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: students-package-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +select drop_package('dotlrn_student_profile_rel'); Index: openacs-4/packages/dotlrn/sql/postgresql/students-sanitize.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/students-sanitize.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/students-sanitize.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,92 @@ +-- +-- 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 the dotLRN Student package +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: students-sanitize.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +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''; + + perform rel_segment__delete( + foo + ); + + perform acs_rel_type__drop_type( + ''dotlrn_full_student_profile_rel'', + ''t'' + ); + + 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 Students''; + + 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''); + + delete + from dotlrn_user_types + where group_id = foo; + + perform profiled_group__delete( + foo + ); + + perform acs_rel_type__drop_type( + ''dotlrn_student_profile_rel'', + ''t'' + ); + + return 0; +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotlrn/sql/postgresql/user-extension-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/user-extension-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/user-extension-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,98 @@ +-- +-- 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 +-- +-- ported to PG by Yon and Ben +-- ben@openforce.net +-- @author dan chak (chak@openforce.net) +-- $Id: user-extension-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- +-- 01/22/2002 +-- + +create function inline_0() +returns integer as ' +begin + -- create the implementation + perform acs_sc_impl__new ( + ''UserData'', + ''dotlrn_user_extension'', + ''dotlrn_user_extension'' + ); + + -- add all the hooks + + -- UserNew + perform acs_sc_impl_alias__new ( + ''UserData'', + ''dotlrn_user_extension'', + ''UserNew'', + ''dotlrn_user_extension::user_new'', + ''TCL'' + ); + + -- UserNew + perform acs_sc_impl_alias__new ( + ''UserData'', + ''dotlrn_user_extension'', + ''UserApprove'', + ''dotlrn_user_extension::user_approve'', + ''TCL'' + ); + + -- UserNew + perform acs_sc_impl_alias__new ( + ''UserData'', + ''dotlrn_user_extension'', + ''UserDeapprove'', + ''dotlrn_user_extension::user_deapprove'', + ''TCL'' + ); + + -- UserNew + perform acs_sc_impl_alias__new ( + ''UserData'', + ''dotlrn_user_extension'', + ''UserModify'', + ''dotlrn_user_extension::user_modify'', + ''TCL'' + ); + + -- UserNew + perform acs_sc_impl_alias__new ( + ''UserData'', + ''dotlrn_user_extension'', + ''UserDelete'', + ''dotlrn_user_extension::user_delete'', + ''TCL'' + ); + + -- Add the binding + perform acs_sc_binding__new ( + ''UserData'', + ''dotlrn_user_extension'' + ); + + return 0; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/user-extension-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/user-extension-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/user-extension-drop.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,80 @@ +-- +-- 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: user-extension-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- +-- +-- + +create function inline_0() +returns integer as ' +begin + + perform acs_sc_binding__delete ( + ''UserData'', + ''dotlrn_user_extension'' + ); + + perform acs_sc_impl_alias__delete ( + ''UserData'', + ''dotlrn_user_extension'', + ''UserNew'' + ); + + perform acs_sc_impl_alias__delete ( + ''UserData'', + ''dotlrn_user_extension'', + ''UserApprove'' + ); + + perform acs_sc_impl_alias__delete ( + ''UserData'', + ''dotlrn_user_extension'', + ''UserDeapprove'' + ); + + perform acs_sc_impl_alias__delete ( + ''UserData'', + ''dotlrn_user_extension'', + ''UserModify'' + ); + + perform acs_sc_impl_alias__delete ( + ''UserData'', + ''dotlrn_user_extension'', + ''UserDelete'' + ); + + -- create the implementation + perform acs_sc_impl__delete( + ''UserData'', + ''dotlrn_user_extension'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/user-profile-provider-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/user-profile-provider-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/user-profile-provider-create.sql 8 Jul 2002 21:04:16 -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. +-- + +-- +-- Implementation of the profile provider interface for dotlrn users. +-- +-- @author yon@openforce.net +-- @version $Id: user-profile-provider-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- +create function inline_0() +returns integer as ' +begin + + -- create the implementation + perform acs_sc_impl__new( + ''profile_provider'', + ''dotlrn_user_profile_provider'', + ''dotlrn_user_profile_provider'' + ); + + -- add the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_user_profile_provider'', + ''name'', + ''dotlrn_user_profile_provider::name'', + ''TCL'' + ); + + -- prettyName method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_user_profile_provider'', + ''prettyName'', + ''dotlrn_user_profile_provider::prettyName'', + ''TCL'' + ); + + -- render method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotlrn_user_profile_provider'', + ''render'', + ''dotlrn_user_profile_provider::render'', + ''TCL'' + ); + + -- bind this implementation to the interface it implements + perform acs_sc_binding__new( + ''profile_provider'', + ''dotlrn_user_profile_provider'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/user-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/user-profile-provider-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/user-profile-provider-drop.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,71 @@ +-- +-- 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. +-- + +-- +-- Implementation of the profile provider interface for dotlrn users. +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: user-profile-provider-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- drop the binding between this implementation and the interface it + -- implements. + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotlrn_user_profile_provider'' + ); + + -- drop the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_user_profile_provider'', + ''name'' + ); + + -- prettyName method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_user_profile_provider'', + ''prettyName'' + ); + + -- render method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotlrn_user_profile_provider'', + ''render'' + ); + + -- drop the implementation + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotlrn_user_profile_provider'' + ); + + return 0; +END;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn/sql/postgresql/users-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/users-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/users-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,90 @@ +-- +-- 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 Users package +-- +-- @author yon@openforce.net +-- @version $Id: users-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create table dotlrn_user_profile_rels ( + rel_id integer + constraint dotlrn_usr_prfl_rels_rel_id_fk + references dotlrn_user_profile_rels (rel_id) + constraint dotlrn_user_profile_rels_pk + primary key, + portal_id integer + constraint dotlrn_user_p_rels_portal_fk + references portals (portal_id) + constraint dotlrn_user_p_rels_portal_nn + not null, + theme_id integer + constraint dotlrn_user_p_rels_theme_id_fk + references portal_element_themes (theme_id), + id varchar(100) +); + +create table dotlrn_user_types ( + type varchar(100) + constraint dotlrn_user_types_pk + primary key, + pretty_name varchar(200), + group_id integer + constraint dotlrn_user_types_group_id_fk + references profiled_groups (group_id) + constraint dotlrn_user_types_group_id_nn + not null +); + +create view dotlrn_users +as + select acs_rels.rel_id, + dotlrn_user_profile_rels.id, + users.user_id, + persons.first_names, + persons.last_name, + parties.email, + dotlrn_user_types.type, + dotlrn_user_types.pretty_name as pretty_type, + dotlrn_user_types.group_id + from dotlrn_user_profile_rels, + dotlrn_user_types, + acs_rels, + parties, + users, + persons + where dotlrn_user_profile_rels.rel_id = acs_rels.rel_id + and acs_rels.object_id_one = dotlrn_user_types.group_id + and acs_rels.object_id_two = parties.party_id + and parties.party_id = users.user_id + and users.user_id = persons.person_id; + +\i user-profile-provider-create.sql +\i users-init.sql +\i users-package-create.sql + +-- create administrators +\i admins-create.sql + +-- create professors +\i professors-create.sql + +-- create students +\i students-create.sql + +-- create external users +\i externals-create.sql Index: openacs-4/packages/dotlrn/sql/postgresql/users-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/users-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/users-drop.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,43 @@ +-- +-- 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 User Profile package +-- +-- @author yon@openforce.net +-- @version $Id: users-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +-- drop external users +\i externals-drop.sql + +-- drop students +\i students-drop.sql + +-- drop professors +\i professors-drop.sql + +-- drop admins +\i admins-drop.sql + +\i users-package-drop.sql +\i users-sanitize.sql +\i user-profile-provider-drop.sql + +drop view dotlrn_users; + +drop table dotlrn_user_types; +drop table dotlrn_user_profile_rels; Index: openacs-4/packages/dotlrn/sql/postgresql/users-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/users-init.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/users-init.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,69 @@ +-- +-- 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. +-- + +-- +-- Initialize the User Profile package +-- +-- @author yon@openforce.net +-- @version $Id: users-init.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +create function inline_1() +returns integer as ' +declare + foo integer; +begin + + perform acs_rel_type__create_type( + ''dotlrn_user_profile_rel'', + ''dotLRN Profile User'', + ''dotLRN Profile Users'', + ''user_profile_rel'', + ''dotlrn_user_profile_rels'', + ''rel_id'', + ''dotlrn_user_profile_rel'', + ''profiled_group'', + null, + 0, + null, + ''user'', + null, + 0, + 1 + ); + + select min(impl_id) + into foo + from acs_sc_impls + where impl_name = ''dotlrn_user_profile_provider''; + + foo := profiled_group__new( + foo, + ''dotLRN Users'' + ); + + foo := rel_segment__new( + ''dotLRN Users'', + foo, + ''dotlrn_user_profile_rel'' + ); + + return(0); +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotlrn/sql/postgresql/users-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/users-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/users-package-create.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,154 @@ +-- +-- 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 User Profile package +-- +-- @author yon@openforce.net +-- @version $Id: users-package-create.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +select define_function_args ('dotlrn_user_profile_rel__new','rel_id,id,rel_type;dotlrn_user_profile_rel,group_id,user_id,creation_user,creation_ip'); + +select define_function_args ('dotlrn_user_profile_rel__delete','rel_id'); + + +create function dotlrn_user_profile_rel__new(integer,varchar,varchar,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; + v_rel_id 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_user_profile_provider''); + else + v_group_id := p_group_id; + end if; + + v_rel_id := user_profile_rel__new( + p_rel_id, + p_rel_type, + v_group_id, + p_user_id, + p_creation_user, + p_creation_ip + ); + + insert + into dotlrn_user_profile_rels + (rel_id, id) + values + (v_rel_id, p_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +create function dotlrn_user_profile_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotlrn_user_profile_rels + where rel_id = p_rel_id; + + PERFORM user_profile_rel__delete(p_rel_id); + return (0); +END; +' language 'plpgsql'; + + +-- full users + +select define_function_args('dotlrn_full_user_profile_rel__new','rel_id,portal_id,theme_id,id,rel_type;dotlrn_full_user_profile_rel,group_id,user_id,creation_user,creation_ip'); + +select define_function_args('dotlrn_full_user_profile_rel__delete','rel_id'); + + +create function dotlrn_full_user_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_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_user_profile_provider''); + else + v_group_id := p_group_id; + end if; + + v_rel_id := dotlrn_user_profile_rel__new( + p_rel_id, + p_id, + p_rel_type, + v_group_id, + p_user_id, + p_creation_user, + p_creation_ip + ); + + insert + into dotlrn_full_user_profile_rels + (rel_id, portal_id, theme_id) + values + (v_rel_id, p_portal_id, p_theme_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +create function dotlrn_full_user_profile_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotlrn_full_user_profile_rels + where rel_id = p_rel_id; + + PERFORM dotlrn_user_profile_rel__delete(p_rel_id); + return (0); +END; +' language 'plpgsql'; Index: openacs-4/packages/dotlrn/sql/postgresql/users-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/users-package-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/users-package-drop.sql 8 Jul 2002 21:04:16 -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. +-- + +-- +-- Create the User Profile package +-- +-- @author yon@openforce.net +-- @version $Id: users-package-drop.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +select drop_package('dotlrn_full_user_profile_rel'); +select drop_package('dotlrn_user_profile_rel'); Index: openacs-4/packages/dotlrn/sql/postgresql/users-sanitize.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/users-sanitize.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/postgresql/users-sanitize.sql 8 Jul 2002 21:04:16 -0000 1.1 @@ -0,0 +1,89 @@ +-- +-- 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 the User Profile package +-- +-- @author yon@openforce.net +-- @author dan chak (chak@openforce.net) +-- @version $Id: users-sanitize.sql,v 1.1 2002/07/08 21:04:16 yon Exp $ +-- + +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''; + + perform rel_segment__delete( + foo + ); + + perform acs_rel_type__drop_type( + ''dotlrn_full_user_profile_rel'', + ''t'' + ); + + 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 = ''Profiled Users''; + + 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''); + + perform profiled_group__delete( + foo + ); + + perform acs_rel_type__drop_type( + ''dotlrn_user_profile_rel'', + ''t'' + ); + + return 0; +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1();