Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-classes-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-classes-create.sql,v diff -u -r1.11 -r1.12 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-classes-create.sql 11 Dec 2001 00:45:15 -0000 1.11 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-classes-create.sql 17 Dec 2001 23:02:55 -0000 1.12 @@ -1,6 +1,6 @@ -- -- The DotLRN basic system --- copyright 2001, OpenForce, Inc. +-- copyright 2001, OpenForce, inc. -- distributed under the GNU GPL v2 -- -- for Oracle 8/8i. (We're guessing 9i works, too). @@ -12,219 +12,238 @@ -- create table dotlrn_classes ( - class_key constraint dotlrn_class_class_key_fk - references dotlrn_community_types(community_type) - constraint dotlrn_class_class_key_pk - primary key + class_key constraint dotlrn_class_class_key_fk + references dotlrn_community_types(community_type) + constraint dotlrn_class_class_key_pk + primary key ); create or replace view dotlrn_classes_full as - select class_key, - pretty_name, - description, - package_id, - supertype + 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 from dotlrn_classes, dotlrn_community_types where dotlrn_classes.class_key = dotlrn_community_types.community_type; +create table dotlrn_terms ( + term_id integer + constraint dotlrn_terms_pk + primary key, + term_name varchar2(20) + constraint dotlrn_t_term_name_nn + not null, + term_year varchar2(4) + constraint dotlrn_t_term_year_nn + not null, + start_date date + default sysdate + constraint dotlrn_t_start_date_nn + not null, + end_date date + default (sysdate + 180) + constraint dotlrn_t_end_date_nn + not null +); + create table dotlrn_class_instances ( - class_instance_id constraint dotlrn_class_i_id_fk - references dotlrn_communities(community_id) - constraint dotlrn_class_i_id_pk - primary key, - class_key constraint dotlrn_class_i_class_key_fk - references dotlrn_classes(class_key), - year varchar(10), - term varchar(20) + class_instance_id constraint dotlrn_ci_class_instance_id_fk + references dotlrn_communities (community_id) + constraint dotlrn_class_instances_pk + primary key, + class_key constraint dotlrn_ci_class_key_fk + references dotlrn_classes (class_key), + term_id constraint dotlrn_ci_term_id_fk + references dotlrn_terms (term_id) + constraint dotlrn_ci_term_id_nn + not null ); create or replace view dotlrn_class_instances_full as - select class_instance_id, - class_key, - year, - term, - community_key, - pretty_name, - description, - portal_template_id, - package_id - from dotlrn_class_instances, - dotlrn_communities - where dotlrn_class_instances.class_instance_id = dotlrn_communities.community_id; + select dotlrn_class_instances.class_instance_id, + dotlrn_class_instances.class_key, + dotlrn_terms.term_name, + dotlrn_terms.term_year, + dotlrn_terms.start_date, + dotlrn_terms.end_date, + dotlrn_communities.community_type, + dotlrn_communities.community_key, + dotlrn_communities.pretty_name, + dotlrn_communities.description, + dotlrn_communities.active_start_date, + dotlrn_communities.active_end_date, + dotlrn_communities.portal_id, + dotlrn_communities.portal_template_id, + dotlrn_communities.package_id, + dotlrn_community.url(dotlrn_communities.community_id) as url + from dotlrn_communities, + dotlrn_class_instances, + dotlrn_terms + where dotlrn_communities.community_id = dotlrn_class_instances.class_instance_id + and dotlrn_class_instances.term_id = dotlrn_terms.term_id; --- --- PL/SQL stuff --- - create or replace package dotlrn_class is - function new ( - class_key in dotlrn_classes.class_key%TYPE, - pretty_name in dotlrn_communities.pretty_name%TYPE, - pretty_plural in dotlrn_community_types.pretty_name%TYPE default null, - description in dotlrn_community_types.description%TYPE, - package_id in dotlrn_community_types.package_id%TYPE default null, - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return dotlrn_classes.class_key%TYPE; + function new ( + class_key in dotlrn_classes.class_key%TYPE, + pretty_name in dotlrn_communities.pretty_name%TYPE, + pretty_plural in dotlrn_community_types.pretty_name%TYPE default null, + description in dotlrn_community_types.description%TYPE, + package_id in dotlrn_community_types.package_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return dotlrn_classes.class_key%TYPE; - procedure delete ( - class_key in dotlrn_classes.class_key%TYPE - ); - + procedure delete ( + class_key in dotlrn_classes.class_key%TYPE + ); end; / show errors - - create or replace package body dotlrn_class is - function new ( - class_key in dotlrn_classes.class_key%TYPE, - pretty_name in dotlrn_communities.pretty_name%TYPE, - pretty_plural in dotlrn_community_types.pretty_name%TYPE default null, - description in dotlrn_community_types.description%TYPE, - package_id in dotlrn_community_types.package_id%TYPE default null, - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return dotlrn_classes.class_key%TYPE - is - v_class_key dotlrn_classes.class_key%TYPE; - begin - v_class_key := dotlrn_community_type.new ( - community_type => class_key, - parent_type => 'dotlrn_class', - pretty_name => pretty_name, - pretty_plural => pretty_plural, - description => description, - package_id => package_id, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - context_id => context_id - ); + function new ( + class_key in dotlrn_classes.class_key%TYPE, + pretty_name in dotlrn_communities.pretty_name%TYPE, + pretty_plural in dotlrn_community_types.pretty_name%TYPE default null, + description in dotlrn_community_types.description%TYPE, + package_id in dotlrn_community_types.package_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return dotlrn_classes.class_key%TYPE + is + v_class_key dotlrn_classes.class_key%TYPE; + begin + v_class_key := dotlrn_community_type.new ( + community_type => class_key, + parent_type => 'dotlrn_class', + pretty_name => pretty_name, + pretty_plural => pretty_plural, + description => description, + package_id => package_id, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id + ); - insert into dotlrn_classes - (class_key) values (v_class_key); + insert + into dotlrn_classes + (class_key) values (v_class_key); - return v_class_key; - end; + return v_class_key; + end; - procedure delete ( - class_key in dotlrn_classes.class_key%TYPE - ) - is - begin - delete from dotlrn_classes where class_key = class_key; + procedure delete ( + class_key in dotlrn_classes.class_key%TYPE + ) + is + begin + delete + from dotlrn_classes + where class_key = class_key; - dotlrn_community_type.delete(class_key); - end; - + dotlrn_community_type.delete(class_key); + end; end; / show errors - create or replace package dotlrn_class_instance is - function new ( - class_instance_id in dotlrn_class_instances.class_instance_id%TYPE default null, - class_key in dotlrn_class_instances.class_key%TYPE, - year in dotlrn_class_instances.year%TYPE, - term in dotlrn_class_instances.term%TYPE, - community_key in dotlrn_communities.community_key%TYPE, - pretty_name in dotlrn_communities.pretty_name%TYPE, - description in dotlrn_communities.description%TYPE, - package_id in dotlrn_communities.package_id%TYPE default null, - portal_id in dotlrn_communities.portal_id%TYPE default null, - portal_template_id in dotlrn_communities.portal_template_id%TYPE default null, - join_policy in groups.join_policy%TYPE default null, - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return dotlrn_class_instances.class_instance_id%TYPE; + function new ( + class_instance_id in dotlrn_class_instances.class_instance_id%TYPE default null, + class_key in dotlrn_class_instances.class_key%TYPE, + term_id in dotlrn_class_instances.term_id%TYPE, + community_key in dotlrn_communities.community_key%TYPE, + pretty_name in dotlrn_communities.pretty_name%TYPE, + description in dotlrn_communities.description%TYPE, + package_id in dotlrn_communities.package_id%TYPE default null, + portal_id in dotlrn_communities.portal_id%TYPE default null, + portal_template_id in dotlrn_communities.portal_template_id%TYPE default null, + join_policy in groups.join_policy%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return dotlrn_class_instances.class_instance_id%TYPE; - procedure delete ( - class_instance_id in dotlrn_class_instances.class_instance_id%TYPE - ); + procedure delete ( + class_instance_id in dotlrn_class_instances.class_instance_id%TYPE + ); end; / show errors - create or replace package body dotlrn_class_instance is - function new ( - class_instance_id in dotlrn_class_instances.class_instance_id%TYPE default null, - class_key in dotlrn_class_instances.class_key%TYPE, - year in dotlrn_class_instances.year%TYPE, - term in dotlrn_class_instances.term%TYPE, - community_key in dotlrn_communities.community_key%TYPE, - pretty_name in dotlrn_communities.pretty_name%TYPE, - description in dotlrn_communities.description%TYPE, - package_id in dotlrn_communities.package_id%TYPE default null, - portal_id in dotlrn_communities.portal_id%TYPE default null, - portal_template_id in dotlrn_communities.portal_template_id%TYPE default null, - join_policy in groups.join_policy%TYPE default null, - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return dotlrn_class_instances.class_instance_id%TYPE - is - v_class_instance_id dotlrn_class_instances.class_instance_id%TYPE; - begin - v_class_instance_id := dotlrn_community.new ( - community_id => class_instance_id, - community_type => class_key, - community_key => community_key, - pretty_name => pretty_name, - description => description, - package_id => package_id, - portal_id => portal_id, - portal_template_id => portal_template_id, - join_policy => join_policy, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - context_id => context_id - ); + function new ( + class_instance_id in dotlrn_class_instances.class_instance_id%TYPE default null, + class_key in dotlrn_class_instances.class_key%TYPE, + term_id in dotlrn_class_instances.term_id%TYPE, + community_key in dotlrn_communities.community_key%TYPE, + pretty_name in dotlrn_communities.pretty_name%TYPE, + description in dotlrn_communities.description%TYPE, + package_id in dotlrn_communities.package_id%TYPE default null, + portal_id in dotlrn_communities.portal_id%TYPE default null, + portal_template_id in dotlrn_communities.portal_template_id%TYPE default null, + join_policy in groups.join_policy%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return dotlrn_class_instances.class_instance_id%TYPE + is + v_class_instance_id dotlrn_class_instances.class_instance_id%TYPE; + begin + v_class_instance_id := dotlrn_community.new ( + community_id => class_instance_id, + community_type => class_key, + community_key => community_key, + pretty_name => pretty_name, + description => description, + package_id => package_id, + portal_id => portal_id, + portal_template_id => portal_template_id, + join_policy => join_policy, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id + ); - insert into dotlrn_class_instances - (class_instance_id, class_key, year, term) - values - (v_class_instance_id, class_key, year, term); + insert + into dotlrn_class_instances + (class_instance_id, class_key, term_id) + values + (v_class_instance_id, class_key, term_id); - return v_class_instance_id; - end; + return v_class_instance_id; + end; - procedure delete ( - class_instance_id in dotlrn_class_instances.class_instance_id%TYPE - ) - is - begin - delete from dotlrn_class_instances - where class_instance_id= class_instance_id; + procedure delete ( + class_instance_id in dotlrn_class_instances.class_instance_id%TYPE + ) + is + begin + delete + from dotlrn_class_instances + where class_instance_id= class_instance_id; - dotlrn_community.delete(community_id => class_instance_id); - end; + dotlrn_community.delete(community_id => class_instance_id); + end; end; / show errors Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-clubs-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-clubs-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-clubs-create.sql 11 Dec 2001 00:45:15 -0000 1.3 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-clubs-create.sql 17 Dec 2001 23:02:55 -0000 1.4 @@ -6,20 +6,39 @@ -- -- for Oracle 8/8i. (We're guessing 9i works, too). -- --- ben@openforce.net --- started August 18th, 2001 +-- @author Ben Adida (ben@openforce.net) +-- @author yon (yon@openforce.net) +-- @creation-date August 18th, 2001 +-- @version $Id$ -- -create table dotlrn_clubs( +create table dotlrn_clubs ( club_id constraint dotlrn_clubs_club_id_fk references dotlrn_communities (community_id) constraint dotlrn_clubs_pk primary key ); +create or replace view dotlrn_clubs_full +as + select dotlrn_clubs.club_id, + dotlrn_communities.community_type, + dotlrn_communities.community_key, + dotlrn_communities.pretty_name, + dotlrn_communities.description, + dotlrn_communities.active_start_date, + dotlrn_communities.active_end_date, + dotlrn_communities.portal_id, + dotlrn_communities.portal_template_id, + dotlrn_communities.package_id, + dotlrn_community.url(dotlrn_communities.community_id) as url + from dotlrn_communities, + dotlrn_clubs + where dotlrn_communities.community_id = dotlrn_clubs.club_id; + create or replace package dotlrn_club is - function new( + function new ( club_id in dotlrn_clubs.club_id%TYPE default null, community_key in dotlrn_communities.community_key%TYPE, pretty_name in dotlrn_communities.pretty_name%TYPE, @@ -34,7 +53,7 @@ context_id in acs_objects.context_id%TYPE default null ) return dotlrn_clubs.club_id%TYPE; - procedure delete( + procedure delete ( club_id in dotlrn_clubs.club_id%TYPE ); end; @@ -43,7 +62,7 @@ create or replace package body dotlrn_club is - function new( + function new ( club_id in dotlrn_clubs.club_id%TYPE default null, community_key in dotlrn_communities.community_key%TYPE, pretty_name in dotlrn_communities.pretty_name%TYPE, @@ -83,7 +102,7 @@ return v_club_id; end; - procedure delete( + procedure delete ( club_id in dotlrn_clubs.club_id%TYPE ) is Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-communities-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-communities-create.sql,v diff -u -r1.16 -r1.17 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-communities-create.sql 11 Dec 2001 04:15:19 -0000 1.16 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-communities-create.sql 17 Dec 2001 23:02:55 -0000 1.17 @@ -1,313 +1,341 @@ - -- -- The DotLRN communities construct -- copyright 2001, OpenForce, Inc. -- distributed under the GNU GPL v2 -- -- for Oracle 8/8i. (We're guessing 9i works, too). -- --- ben@openforce.net --- started September 20th, 2001 (redone) +-- @author Ben Adida (ben@openforce.net) +-- @author yon (yon@openforce.net) +-- @creation-date September 20th, 2001 (redone) +-- @version $Id$ -- create table dotlrn_community_types ( - community_type not null - constraint dlrn_comm_type_pk primary key - constraint dlrn_comm_type_fk - references group_types (group_type), - pretty_name varchar(100) not null, - description varchar(4000), - package_id constraint dlrn_comm_type_pack_id_fk - references apm_packages(package_id), - supertype constraint dlrn_comm_supertype_fk - references dotlrn_community_types(community_type) + community_type constraint dotlrn_ct_community_type_fk + references group_types (group_type) + constraint dotlrn_community_types_pk + primary key, + pretty_name varchar(100) + constraint dotlrn_ct_pretty_name_nn + not null, + description varchar(4000), + package_id constraint dotlrn_ct_package_id_fk + references apm_packages (package_id), + supertype constraint dotlrn_ct_supertype_fk + references dotlrn_community_types (community_type) ); - create table dotlrn_communities ( - community_id not null - constraint dlrn_comm_id_pk primary key - constraint dlrn_comm_id_fk - references groups(group_id), - community_type not null - constraint dlrn_comm_id_type_fk - references dotlrn_community_types(community_type), - community_key varchar(100) not null - constraint dlrn_comm_key_un unique, - pretty_name varchar(100) not null, - description varchar(4000), - active_start_date date, - active_end_date date, - portal_id references portals(portal_id), - portal_template_id references portals(portal_id), - package_id constraint dlrn_comm_pack_id_fk - references apm_packages(package_id) + community_id constraint dotlrn_c_community_id_fk + references groups (group_id) + constraint dotlrn_communities_pk + primary key, + community_type 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 + constraint dotlrn_c_community_key_un + unique, + pretty_name varchar(100) + constraint dotlrn_c_pretty_name_nn + not null, + description varchar(4000), + active_start_date date, + active_end_date date, + portal_id constraint dotlrn_c_portal_id_fk + references portals (portal_id), + portal_template_id constraint dotlrn_c_portal_template_id_fk + references portals (portal_id), + package_id constraint dotlrn_c_package_id_fk + references apm_packages (package_id) ); --- active communities -create or replace view dotlrn_active_comms +create or replace view dotlrn_active_communities as - select dotlrn_communities.*, - join_policy - from dotlrn_communities, - groups + select dotlrn_communities.* + from dotlrn_communities where (active_start_date is null or active_start_date < sysdate) - and (active_end_date is null or active_end_date > sysdate) - and dotlrn_communities.community_id = groups.group_id; + and (active_end_date is null or active_end_date > sysdate); -create or replace view dotlrn_active_not_closed_comms +create or replace view dotlrn_active_comms_not_closed as select dotlrn_communities.*, - join_policy - from dotlrn_communities, + groups.join_policy + from dotlrn_active_communities dotlrn_communities, groups - where (active_start_date is null or active_start_date < sysdate) - and (active_end_date is null or active_end_date > sysdate) - and dotlrn_communities.community_id = groups.group_id - and join_policy <> 'closed'; + where dotlrn_communities.community_id = groups.group_id + and groups.join_policy <> 'closed'; create table dotlrn_community_applets ( - community_id integer not null - constraint dlrn_comm_appl_comm_id_fk references dotlrn_communities(community_id), - applet_key varchar(100) not null, - constraint dlrn_comm_appl_pk primary key (community_id, applet_key), - package_id integer, -- this is the package_id for what packge this applet represents - active_p char(1) default 't' not null - constraint dlrn_comm_appl_act_p_ch check (active_p in ('t','f')) + community_id integer + constraint dotlrn_ca_community_id_nn + not null + constraint dotlrn_ca_community_id_fk + references dotlrn_communities (community_id), + applet_key varchar(100) + constraint dotlrn_ca_applet_key_nn + not null, + constraint dotlrn_community_applets_pk primary key (community_id, applet_key), + -- this is the package_id of the package this applet represents + package_id integer, + active_p char(1) + default 't' + constraint dotlrn_ca_active_p_nn + not null + constraint dotlrn_ca_active_p_ck + check (active_p in ('t','f')) ); - --- --- PL/SQL for community and community types --- - create or replace package dotlrn_community_type is - function new ( - community_type in dotlrn_community_types.community_type%TYPE, - parent_type in dotlrn_community_types.supertype%TYPE default 'dotlrn_community', - pretty_name in dotlrn_community_types.pretty_name%TYPE, - pretty_plural in dotlrn_community_types.pretty_name%TYPE default null, - description in dotlrn_community_types.description%TYPE, - package_id in dotlrn_community_types.package_id%TYPE default null, - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return dotlrn_community_types.community_type%TYPE; + function new ( + community_type in dotlrn_community_types.community_type%TYPE, + parent_type in dotlrn_community_types.supertype%TYPE default 'dotlrn_community', + pretty_name in dotlrn_community_types.pretty_name%TYPE, + pretty_plural in dotlrn_community_types.pretty_name%TYPE default null, + description in dotlrn_community_types.description%TYPE, + package_id in dotlrn_community_types.package_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return dotlrn_community_types.community_type%TYPE; - procedure delete ( - community_type in dotlrn_community_types.community_type%TYPE - ); + procedure delete ( + community_type in dotlrn_community_types.community_type%TYPE + ); - function name ( - community_type in dotlrn_community_types.community_type%TYPE - ) return varchar; - + function name ( + community_type in dotlrn_community_types.community_type%TYPE + ) return varchar; end; / show errors - create or replace package body dotlrn_community_type is - function new ( - community_type in dotlrn_community_types.community_type%TYPE, - parent_type in dotlrn_community_types.supertype%TYPE default 'dotlrn_community', - pretty_name in dotlrn_community_types.pretty_name%TYPE, - pretty_plural in dotlrn_community_types.pretty_name%TYPE default null, - description in dotlrn_community_types.description%TYPE, - package_id in dotlrn_community_types.package_id%TYPE default null, - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return dotlrn_community_types.community_type%TYPE - is - v_parent_object_type acs_object_types.object_type%TYPE; - begin - if parent_type is null - then v_parent_object_type:= 'group'; - else v_parent_object_type:= parent_type; - end if; + function new ( + community_type in dotlrn_community_types.community_type%TYPE, + parent_type in dotlrn_community_types.supertype%TYPE default 'dotlrn_community', + pretty_name in dotlrn_community_types.pretty_name%TYPE, + pretty_plural in dotlrn_community_types.pretty_name%TYPE default null, + description in dotlrn_community_types.description%TYPE, + package_id in dotlrn_community_types.package_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return dotlrn_community_types.community_type%TYPE + is + v_parent_object_type acs_object_types.object_type%TYPE; + begin + if parent_type is null then + v_parent_object_type:= 'group'; + else + v_parent_object_type:= parent_type; + end if; - acs_object_type.create_type ( - supertype => v_parent_object_type, - object_type => community_type, - pretty_name => pretty_name, - pretty_plural => pretty_plural, - table_name => community_type, - id_column => 'XXX', - package_name => community_type, - name_method => 'acs_group.name' - ); + acs_object_type.create_type ( + supertype => v_parent_object_type, + object_type => community_type, + pretty_name => pretty_name, + pretty_plural => pretty_plural, + table_name => community_type, + id_column => 'XXX', + package_name => community_type, + name_method => 'acs_group.name' + ); - insert into group_types - (group_type, default_join_policy) values (community_type, 'closed'); + insert + into group_types + (group_type, default_join_policy) + values + (community_type, 'closed'); - insert into dotlrn_community_types - (community_type, pretty_name, description, package_id, supertype) - values - (community_type, pretty_name, description, package_id, parent_type); + insert + into dotlrn_community_types + (community_type, pretty_name, description, package_id, supertype) + values + (community_type, pretty_name, description, package_id, parent_type); - return community_type; - end; + return community_type; + end; - procedure delete ( - community_type in dotlrn_community_types.community_type%TYPE - ) - is - begin - delete from dotlrn_community_types where community_type= community_type; + procedure delete ( + community_type in dotlrn_community_types.community_type%TYPE + ) + is + begin + delete + from dotlrn_community_types + where community_type = community_type; - acs_object_type.drop_type(community_type); - end; + acs_object_type.drop_type(community_type); + end; - function name ( - community_type in dotlrn_community_types.community_type%TYPE - ) return varchar - is - name dotlrn_community_types.pretty_name%TYPE; - begin - select pretty_name into name from dotlrn_community_types; + function name ( + community_type in dotlrn_community_types.community_type%TYPE + ) return varchar + is + name dotlrn_community_types.pretty_name%TYPE; + begin + select pretty_name into name + from dotlrn_community_types; - return name; - end; - + return name; + end; end; / show errors - create or replace package dotlrn_community is - function new ( - community_id in dotlrn_communities.community_id%TYPE default null, - community_type in dotlrn_communities.community_type%TYPE, - community_key in dotlrn_communities.community_key%TYPE, - pretty_name in dotlrn_communities.pretty_name%TYPE, - description in dotlrn_communities.description%TYPE, - portal_id in dotlrn_communities.portal_id%TYPE default null, - portal_template_id in dotlrn_communities.portal_template_id%TYPE default null, - package_id in dotlrn_communities.package_id%TYPE default null, - join_policy in groups.join_policy%TYPE default null, - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return dotlrn_communities.community_id%TYPE; + function new ( + community_id in dotlrn_communities.community_id%TYPE default null, + community_type in dotlrn_communities.community_type%TYPE, + community_key in dotlrn_communities.community_key%TYPE, + pretty_name in dotlrn_communities.pretty_name%TYPE, + description in dotlrn_communities.description%TYPE, + portal_id in dotlrn_communities.portal_id%TYPE default null, + portal_template_id in dotlrn_communities.portal_template_id%TYPE default null, + package_id in dotlrn_communities.package_id%TYPE default null, + join_policy in groups.join_policy%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return dotlrn_communities.community_id%TYPE; - procedure set_active_dates ( - community_id in dotlrn_communities.community_id%TYPE, - start_date in dotlrn_communities.active_start_date%TYPE, - end_date in dotlrn_communities.active_end_date%TYPE - ); + procedure set_active_dates ( + community_id in dotlrn_communities.community_id%TYPE, + start_date in dotlrn_communities.active_start_date%TYPE, + end_date in dotlrn_communities.active_end_date%TYPE + ); - procedure delete ( - community_id in dotlrn_communities.community_id%TYPE - ); + procedure delete ( + community_id in dotlrn_communities.community_id%TYPE + ); - function name ( - community_id in dotlrn_communities.community_id%TYPE - ) return varchar; + function name ( + community_id in dotlrn_communities.community_id%TYPE + ) return varchar; - function member_p ( - community_id in dotlrn_communities.community_id%TYPE, - party_id in parties.party_id%TYPE - ) return char; + function member_p ( + community_id in dotlrn_communities.community_id%TYPE, + party_id in parties.party_id%TYPE + ) return char; + function url ( + community_id in dotlrn_communities.community_id%TYPE + ) return varchar2; end dotlrn_community; / show errors - create or replace package body dotlrn_community as - function new ( - community_id in dotlrn_communities.community_id%TYPE default null, - community_type in dotlrn_communities.community_type%TYPE, - community_key in dotlrn_communities.community_key%TYPE, - pretty_name in dotlrn_communities.pretty_name%TYPE, - description in dotlrn_communities.description%TYPE, - portal_id in dotlrn_communities.portal_id%TYPE default null, - portal_template_id in dotlrn_communities.portal_template_id%TYPE default null, - package_id in dotlrn_communities.package_id%TYPE default null, - join_policy in groups.join_policy%TYPE default null, - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return dotlrn_communities.community_id%TYPE - is - c_id integer; - begin - c_id := acs_group.new ( - context_id => context_id, - group_id => community_id, - object_type => community_type, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - group_name => community_key, - join_policy => join_policy - ); + function new ( + community_id in dotlrn_communities.community_id%TYPE default null, + community_type in dotlrn_communities.community_type%TYPE, + community_key in dotlrn_communities.community_key%TYPE, + pretty_name in dotlrn_communities.pretty_name%TYPE, + description in dotlrn_communities.description%TYPE, + portal_id in dotlrn_communities.portal_id%TYPE default null, + portal_template_id in dotlrn_communities.portal_template_id%TYPE default null, + package_id in dotlrn_communities.package_id%TYPE default null, + join_policy in groups.join_policy%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return dotlrn_communities.community_id%TYPE + is + c_id integer; + begin + c_id := acs_group.new ( + context_id => context_id, + group_id => community_id, + object_type => community_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + group_name => community_key, + join_policy => join_policy + ); - insert into dotlrn_communities - (community_id, community_type, community_key, pretty_name, description, package_id, portal_id, portal_template_id) - values - (c_id, community_type, community_key, pretty_name, description, package_id, portal_id, portal_template_id); + insert + into dotlrn_communities + (community_id, community_type, community_key, pretty_name, description, package_id, portal_id, portal_template_id) + values + (c_id, community_type, community_key, pretty_name, description, package_id, portal_id, portal_template_id); - return c_id; - end; + return c_id; + end; - procedure set_active_dates ( - community_id in dotlrn_communities.community_id%TYPE, - start_date in dotlrn_communities.active_start_date%TYPE, - end_date in dotlrn_communities.active_end_date%TYPE - ) - is - begin - update dotlrn_communities set - active_start_date= start_date, - active_end_date= end_date - where - community_id = set_active_dates.community_id; - end; + procedure set_active_dates ( + community_id in dotlrn_communities.community_id%TYPE, + start_date in dotlrn_communities.active_start_date%TYPE, + end_date in dotlrn_communities.active_end_date%TYPE + ) + is + begin + update dotlrn_communities + set active_start_date = start_date, + active_end_date = end_date + where community_id = set_active_dates.community_id; + end; - procedure delete ( - community_id in dotlrn_communities.community_id%TYPE - ) - is - begin - delete from dotlrn_communities where community_id= community_id; + procedure delete ( + community_id in dotlrn_communities.community_id%TYPE + ) + is + begin + delete + from dotlrn_communities + where community_id = community_id; - acs_group.delete(community_id); - end; + acs_group.delete(community_id); + end; - function name ( - community_id in dotlrn_communities.community_id%TYPE - ) return varchar - is - begin - return acs_group.name(community_id); - end; + function name ( + community_id in dotlrn_communities.community_id%TYPE + ) return varchar + is + begin + return acs_group.name(community_id); + end; - function member_p ( - community_id in dotlrn_communities.community_id%TYPE, - party_id in parties.party_id%TYPE - ) return char - is - begin - -- TODO: a-la aD, implement this for real (bma) - return 't'; - end; + function member_p ( + community_id in dotlrn_communities.community_id%TYPE, + party_id in parties.party_id%TYPE + ) return char + is + begin + -- TODO: a-la aD, implement this for real (bma) + return 't'; + end; + function url ( + community_id in dotlrn_communities.community_id%TYPE + ) return varchar2 + is + v_node_id site_nodes.node_id%TYPE; + begin + select site_nodes.node_id into v_node_id + from dotlrn_communities, + site_nodes + where dotlrn_communities.community_id = dotlrn_community.url.community_id + and site_nodes.object_id = dotlrn_communities.package_id; + + return site_node.url(v_node_id); + + exception + when no_data_found then + return ''; + end; end; / show errors Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-community-memberships-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-create.sql 1 Dec 2001 23:16:27 -0000 1.4 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-create.sql 17 Dec 2001 23:02:55 -0000 1.5 @@ -12,50 +12,70 @@ create table dotlrn_member_rels ( - rel_id integer not null - constraint dlrn_mem_fk references membership_rels(rel_id) - constraint dlrn_mem_pk primary key, - portal_id integer - constraint dlrn_mem_portal_id_fk references portals(portal_id) -); + rel_id integer not null + constraint dlrn_mem_fk references membership_rels(rel_id) + constraint dlrn_mem_pk primary key, + portal_id integer + constraint dlrn_mem_portal_id_fk references portals(portal_id) +); -create view dotlrn_member_rels_full as select acs_rels.rel_id as rel_id, object_id_one as community_id, object_id_two as user_id, rel_type, portal_id from dotlrn_member_rels, acs_rels where dotlrn_member_rels.rel_id = acs_rels.rel_id; +create or replace view dotlrn_member_rels_full +as + select acs_rels.rel_id as rel_id, + object_id_one as community_id, + object_id_two as user_id, + rel_type, + portal_id + from dotlrn_member_rels, + acs_rels + where dotlrn_member_rels.rel_id = acs_rels.rel_id; create table dotlrn_admin_rels ( - rel_id integer not null - constraint dlrn_adm_fk references dotlrn_member_rels(rel_id) - constraint dlrn_adm_pk primary key + rel_id integer not null + constraint dlrn_adm_fk references dotlrn_member_rels(rel_id) + constraint dlrn_adm_pk primary key ); -create view dotlrn_admin_rels_full as select acs_rels.rel_id as rel_id, object_id_one as community_id, object_id_two as user_id, rel_type, portal_id from dotlrn_member_rels, dotlrn_admin_rels, acs_rels where dotlrn_member_rels.rel_id = acs_rels.rel_id and dotlrn_admin_rels.rel_id= acs_rels.rel_id; +create or replace view dotlrn_admin_rels_full +as + select acs_rels.rel_id as rel_id, + object_id_one as community_id, + object_id_two as user_id, + rel_type, + portal_id + from dotlrn_member_rels, + dotlrn_admin_rels, + acs_rels + where dotlrn_member_rels.rel_id = acs_rels.rel_id + and dotlrn_admin_rels.rel_id = acs_rels.rel_id; -- -- For Classes -- create table dotlrn_student_rels ( - rel_id integer not null - constraint dlrn_stud_fk references dotlrn_member_rels(rel_id) - constraint dlrn_stud_pk primary key + rel_id integer not null + constraint dlrn_stud_fk references dotlrn_member_rels(rel_id) + constraint dlrn_stud_pk primary key ); create view dotlrn_student_rels_full as select acs_rels.rel_id as rel_id, object_id_one as community_id, object_id_two as user_id, rel_type from dotlrn_student_rels, acs_rels where dotlrn_student_rels.rel_id = acs_rels.rel_id; create table dotlrn_ta_rels ( - rel_id integer not null - constraint dlrn_ta_fk references dotlrn_admin_rels(rel_id) - constraint dlrn_ta_pk primary key + rel_id integer not null + constraint dlrn_ta_fk references dotlrn_admin_rels(rel_id) + constraint dlrn_ta_pk primary key ); create view dotlrn_ta_rels_full as select acs_rels.rel_id as rel_id, object_id_two as community_id, object_id_two as user_id, rel_type from dotlrn_ta_rels, acs_rels where dotlrn_ta_rels.rel_id = acs_rels.rel_id; create table dotlrn_instructor_rels ( - rel_id integer not null - constraint dlrn_instruct_fk references dotlrn_admin_rels(rel_id) - constraint dlrn_instruct_pk primary key + rel_id integer not null + constraint dlrn_instruct_fk references dotlrn_admin_rels(rel_id) + constraint dlrn_instruct_pk primary key ); create view dotlrn_instructor_rels_full as select acs_rels.rel_id as rel_id, object_id_two as community_id, object_id_two as user_id, rel_type from dotlrn_instructor_rels, acs_rels where dotlrn_instructor_rels.rel_id = acs_rels.rel_id; @@ -66,88 +86,88 @@ -- declare - foo integer; + foo integer; begin - acs_rel_type.create_type ( - rel_type => 'dotlrn_member_rel', - supertype => 'membership_rel', - pretty_name => 'dotLRN Community Membership', - pretty_plural => 'dotLRN Community Memberships', - package_name => 'dotlrn_member_rel', - table_name => 'dotlrn_member_rels', - id_column => 'rel_id', - object_type_one => 'dotlrn_community', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => NULL, - object_type_two => 'user', role_two => NULL, - min_n_rels_two => 0, max_n_rels_two => NULL - ); + acs_rel_type.create_type ( + rel_type => 'dotlrn_member_rel', + supertype => 'membership_rel', + pretty_name => 'dotLRN Community Membership', + pretty_plural => 'dotLRN Community Memberships', + package_name => 'dotlrn_member_rel', + table_name => 'dotlrn_member_rels', + id_column => 'rel_id', + object_type_one => 'dotlrn_community', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => NULL, + object_type_two => 'user', role_two => NULL, + min_n_rels_two => 0, max_n_rels_two => NULL + ); - acs_rel_type.create_type ( - rel_type => 'dotlrn_admin_rel', - supertype => 'dotlrn_member_rel', - pretty_name => 'dotLRN Admin Community Membership', - pretty_plural => 'dotLRN Admin Community Memberships', - package_name => 'dotlrn_admin_rel', - table_name => 'dotlrn_admin_rels', - id_column => 'rel_id', - object_type_one => 'dotlrn_community', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => NULL, - object_type_two => 'user', role_two => NULL, - min_n_rels_two => 0, max_n_rels_two => NULL - ); + acs_rel_type.create_type ( + rel_type => 'dotlrn_admin_rel', + supertype => 'dotlrn_member_rel', + pretty_name => 'dotLRN Admin Community Membership', + pretty_plural => 'dotLRN Admin Community Memberships', + package_name => 'dotlrn_admin_rel', + table_name => 'dotlrn_admin_rels', + id_column => 'rel_id', + object_type_one => 'dotlrn_community', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => NULL, + object_type_two => 'user', role_two => NULL, + min_n_rels_two => 0, max_n_rels_two => NULL + ); - acs_rel_type.create_type ( - rel_type => 'dotlrn_student_rel', - supertype => 'dotlrn_member_rel', - pretty_name => 'dotLRN Student Community Membership', - pretty_plural => 'dotLRN Student Community Memberships', - package_name => 'dotlrn_student_rel', - table_name => 'dotlrn_student_rels', - id_column => 'rel_id', - object_type_one => 'dotlrn_class_instance', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => NULL, - object_type_two => 'user', role_two => NULL, - min_n_rels_two => 0, max_n_rels_two => NULL - ); + acs_rel_type.create_type ( + rel_type => 'dotlrn_student_rel', + supertype => 'dotlrn_member_rel', + pretty_name => 'dotLRN Student Community Membership', + pretty_plural => 'dotLRN Student Community Memberships', + package_name => 'dotlrn_student_rel', + table_name => 'dotlrn_student_rels', + id_column => 'rel_id', + object_type_one => 'dotlrn_class_instance', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => NULL, + object_type_two => 'user', role_two => NULL, + min_n_rels_two => 0, max_n_rels_two => NULL + ); - acs_rel_type.create_type ( - rel_type => 'dotlrn_ta_rel', - supertype => 'dotlrn_admin_rel', - pretty_name => 'dotLRN TA Community Membership', - pretty_plural => 'dotLRN TA Community Memberships', - package_name => 'dotlrn_ta_rel', - table_name => 'dotlrn_ta_rels', - id_column => 'rel_id', - object_type_one => 'dotlrn_class_instance', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => NULL, - object_type_two => 'user', role_two => NULL, - min_n_rels_two => 0, max_n_rels_two => NULL - ); + acs_rel_type.create_type ( + rel_type => 'dotlrn_ta_rel', + supertype => 'dotlrn_admin_rel', + pretty_name => 'dotLRN TA Community Membership', + pretty_plural => 'dotLRN TA Community Memberships', + package_name => 'dotlrn_ta_rel', + table_name => 'dotlrn_ta_rels', + id_column => 'rel_id', + object_type_one => 'dotlrn_class_instance', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => NULL, + object_type_two => 'user', role_two => NULL, + min_n_rels_two => 0, max_n_rels_two => NULL + ); - acs_rel_type.create_type ( - rel_type => 'dotlrn_instructor_rel', - supertype => 'dotlrn_admin_rel', - pretty_name => 'dotLRN Instructor Community Membership', - pretty_plural => 'dotLRN Instructor Community Memberships', - package_name => 'dotlrn_instructor_rel', - table_name => 'dotlrn_instructor_rels', - id_column => 'rel_id', - object_type_one => 'dotlrn_class_instance', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => NULL, - object_type_two => 'user', role_two => NULL, - min_n_rels_two => 0, max_n_rels_two => NULL - ); + acs_rel_type.create_type ( + rel_type => 'dotlrn_instructor_rel', + supertype => 'dotlrn_admin_rel', + pretty_name => 'dotLRN Instructor Community Membership', + pretty_plural => 'dotLRN Instructor Community Memberships', + package_name => 'dotlrn_instructor_rel', + table_name => 'dotlrn_instructor_rels', + id_column => 'rel_id', + object_type_one => 'dotlrn_class_instance', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => NULL, + object_type_two => 'user', role_two => NULL, + min_n_rels_two => 0, max_n_rels_two => NULL + ); - -- - -- and now for the attributes - -- - foo:= acs_attribute.create_attribute ( - object_type => 'dotlrn_member_rel', - attribute_name => 'portal_id', - datatype => 'integer', - pretty_name => 'Page ID', - pretty_plural => 'Page IDs' - ); + -- + -- and now for the attributes + -- + foo:= acs_attribute.create_attribute ( + object_type => 'dotlrn_member_rel', + attribute_name => 'portal_id', + datatype => 'integer', + pretty_name => 'Page ID', + pretty_plural => 'Page IDs' + ); end; / Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/dotlrn-create.sql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-create.sql 29 Nov 2001 04:01:07 -0000 1.7 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-create.sql 17 Dec 2001 23:02:55 -0000 1.8 @@ -1,4 +1,3 @@ - -- -- The DotLRN basic system -- copyright 2001, OpenForce, Inc. @@ -21,4 +20,3 @@ @dotlrn-community-memberships-packages-create.sql @dotlrn-main-portlet-create.sql @dotlrn-security-create.sql - Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql 1 Dec 2001 23:16:27 -0000 1.8 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql 17 Dec 2001 23:02:55 -0000 1.9 @@ -11,72 +11,46 @@ -- we remember September 11th, 2001 -- - declare - year_attr_id acs_attributes.attribute_id%TYPE; - term_attr_id acs_attributes.attribute_id%TYPE; - foo dotlrn_community_types.community_type%TYPE; + foo dotlrn_community_types.community_type%TYPE; begin - -- Create the base community type - foo := dotlrn_community_type.new ( - community_type => 'dotlrn_community', - parent_type => NULL, - pretty_name => 'dotLRN Community', - pretty_plural => 'dotLRN Communities', - description => 'dotLRN Communities - the base community type' - ); + -- Create the base community type + foo := dotlrn_community_type.new ( + community_type => 'dotlrn_community', + parent_type => NULL, + pretty_name => 'dotLRN Community', + pretty_plural => 'dotLRN Communities', + description => 'dotLRN Communities - the base community type' + ); - -- create the dotlrn_class community type - foo := dotlrn_community_type.new ( - community_type => 'dotlrn_class_instance', - parent_type => 'dotlrn_community', - pretty_name => 'dotLRN Class', - pretty_plural => 'dotLRN Classes', - description => 'dotLRN Classes - e.g. 6.001' - ); + -- create the dotlrn_class community type + foo := dotlrn_community_type.new ( + community_type => 'dotlrn_class_instance', + parent_type => 'dotlrn_community', + pretty_name => 'dotLRN Class', + pretty_plural => 'dotLRN Classes', + description => 'dotLRN Classes - e.g. 6.001' + ); - -- create the dotlrn_club community type - foo := dotlrn_community_type.new ( - community_type => 'dotlrn_club', - parent_type => 'dotlrn_community', - pretty_name => 'dotLRN Club', - pretty_plural => 'dotLRN Clubs', - description => 'dotLRN Clubs - e.g. Alumni' - ); + -- create the dotlrn_club community type + foo := dotlrn_community_type.new ( + community_type => 'dotlrn_club', + parent_type => 'dotlrn_community', + pretty_name => 'dotLRN Club', + pretty_plural => 'dotLRN Clubs', + description => 'dotLRN Clubs - e.g. Alumni' + ); - -- year attribute - year_attr_id:= acs_attribute.create_attribute ( - object_type => 'dotlrn_class_instance', - attribute_name => 'year', - datatype => 'string', - pretty_name => 'Year', - pretty_plural => 'Years', - min_n_values => 1, - max_n_values => 1 - ); + -- create roles + acs_rel_type.create_role ('student', 'Student', 'Students'); + acs_rel_type.create_role ('teaching_assistant', 'Teaching Assistant', 'Teaching Assistants'); + acs_rel_type.create_role ('instructor', 'Instructor', 'Instructors'); + acs_rel_type.create_role ('admin', 'Administrator', 'Administrators'); - -- term attribute - term_attr_id:= acs_attribute.create_attribute ( - object_type => 'dotlrn_class_instance', - attribute_name => 'term', - datatype => 'string', - pretty_name => 'Term', - pretty_plural => 'Terms', - min_n_values => 1, - max_n_values => 1 - ); - - -- create roles - acs_rel_type.create_role ('student', 'Student', 'Students'); - acs_rel_type.create_role ('teaching_assistant', 'Teaching Assistant', 'Teaching Assistants'); - acs_rel_type.create_role ('instructor', 'Instructor', 'Instructors'); - acs_rel_type.create_role ('admin', 'Administrator', 'Administrators'); - - -- add the user types - insert into dotlrn_user_types (type_id, type) values (1, 'student'); - insert into dotlrn_user_types (type_id, type) values (2, 'professor'); - insert into dotlrn_user_types (type_id, type) values (3, 'admin'); + -- add the user types + insert into dotlrn_user_types (type_id, type) values (1, 'student'); + insert into dotlrn_user_types (type_id, type) values (2, 'professor'); + insert into dotlrn_user_types (type_id, type) values (3, 'admin'); end; / show errors - Index: openacs-4/packages/dotlrn/tcl/class-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/Attic/class-procs-oracle.xql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/dotlrn/tcl/class-procs-oracle.xql 1 Dec 2001 23:16:27 -0000 1.6 +++ openacs-4/packages/dotlrn/tcl/class-procs-oracle.xql 17 Dec 2001 23:02:55 -0000 1.7 @@ -1,23 +1,19 @@ -oracle8.1.6 + oracle8.1.6 - - -declare -begin - -:1 := dotlrn_class.new ( - class_key => :name, - pretty_name => :pretty_name, - pretty_plural => :pretty_name, - description => :description -); - -end; - - - - + + + declare + begin + :1 := dotlrn_class.new( + class_key => :name, + pretty_name => :pretty_name, + pretty_plural => :pretty_name, + description => :description + ); + end; + + Index: openacs-4/packages/dotlrn/tcl/class-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/class-procs.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/dotlrn/tcl/class-procs.tcl 11 Dec 2001 00:45:15 -0000 1.18 +++ openacs-4/packages/dotlrn/tcl/class-procs.tcl 17 Dec 2001 23:02:55 -0000 1.19 @@ -1,4 +1,3 @@ - # # Procs for DOTLRN Class Management # Copyright 2001 OpenForce, inc. @@ -8,12 +7,12 @@ # ad_library { - Procs to manage DOTLRN Classes - @author ben@openforce.net + @author Ben Adida (ben@openforce.net) + @author yon (yon@openforce.net) @creation-date 2001-08-18 - + @version $Id$ } namespace eval dotlrn_class { @@ -92,34 +91,41 @@ ad_proc -public new_instance { {-description ""} {-class_type:required} - {-term:required} - {-year:required} + {-term_id:required} {-join_policy "needs approval"} } { Creates a new instance of a class for a particular term and year, and returns the class instance key. } { - set term [string trim $term] - set year [string trim $year] +# dotlrn_term::get_term_info -term_id $term_id -term_name_var "term" -term_year_var "year" + set term [dotlrn_term::get_term_name -term_id $term_id] + set year [dotlrn_term::get_term_year -term_id $term_id] + set community_key "${class_type}-${term}-${year}" - set community_key "$class_type-$term-$year" - set extra_vars [ns_set create] - ns_set put $extra_vars year $year - ns_set put $extra_vars term $term + ns_set put $extra_vars term_id $term_id ns_set put $extra_vars class_key $class_type ns_set put $extra_vars join_policy $join_policy set pretty_name "[dotlrn_community::get_community_type_name $class_type]; $term $year" - # Create the community - return [dotlrn_community::new \ - -description $description \ - -community_type $class_type \ - -object_type [community_type] \ - -community_key $community_key \ - -pretty_name $pretty_name \ - -extra_vars $extra_vars] + db_transaction { + # Create the community + set community_id [dotlrn_community::new \ + -description $description \ + -community_type $class_type \ + -object_type [community_type] \ + -community_key $community_key \ + -pretty_name $pretty_name \ + -extra_vars $extra_vars] + + dotlrn_community::set_active_dates \ + -community_id $community_id \ + -start_date [dotlrn_term::get_start_date -term_id $term_id] \ + -end_date [dotlrn_term::get_end_date -term_id $term_id] + } + + return $community_id } ad_proc -public available_roles { @@ -156,4 +162,28 @@ } { return [db_string select_class_pretty_name {} -default ""] } + + ad_proc -public get_term_id { + {-class_instance_id:required} + } { + get the term_id for this class instance + } { + return [db_string get_term_id {}] + } + + ad_proc -public get_term_name { + {-class_instance_id:required} + } { + get the term for this class instance + } { + return [dotlrn_term::get_term_name -term_id [get_term_id -class_instance_id $class_instance_id]] + } + + ad_proc -public get_term_year { + {-class_instance_id:required} + } { + get the term year for this class instance + } { + return [dotlrn_term::get_term_year -term_id [get_term_id -class_instance_id $class_instance_id]] + } } Index: openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql 8 Dec 2001 01:22:40 -0000 1.5 +++ openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql 17 Dec 2001 23:02:56 -0000 1.6 @@ -1,66 +1,85 @@ -oracle8.1.6 + oracle8.1.6 - - -declare -begin - -:1 := dotlrn_community_type.new ( - community_type => :community_type_key, - parent_type => :parent_type, - pretty_name => :pretty_name, - pretty_plural => :pretty_name, - description => :description -); + + + declare + begin + :1 := dotlrn_community_type.new( + community_type => :community_type_key, + parent_type => :parent_type, + pretty_name => :pretty_name, + pretty_plural => :pretty_name, + description => :description + ); + end; + + -end; - - + + + declare + begin + :1 := dotlrn_community.new( + community_type => :community_type, + community_key => :name + pretty_name => :pretty_name, + pretty_plural => :pretty_name, + description => :description + ); + end; + + - - -declare -begin - -:1 := dotlrn_community.new ( - community_type => :community_type, - community_key => :name - pretty_name => :pretty_name, - pretty_plural => :pretty_name, - description => :description -); + + + declare + begin + dotlrn_community.set_active_dates( + community_id => :community_id, + start_date => to_date(:start_date, :date_format), + end_date => to_date(:end_date, :date_format) + ); + end; + + -end; - - + + + select site_node.url(node_id) + from site_nodes + where parent_id = :current_node_id + and object_id= :package_id + + - - -select site_node.url(node_id) from site_nodes where parent_id= :current_node_id and object_id= :package_id - - + + + select site_node.url(node_id) + from site_nodes + where object_id = :package_id + + - - -select site_node.url(node_id) from site_nodes where object_id= :package_id - - + + + select community_type + from dotlrn_communities + where community_id = :community_id + + - - - select community_type - from dotlrn_communities - where community_id = :community_id - - - - - -select object_type from acs_object_types where supertype='dotlrn_community' start with object_type = (select community_type from dotlrn_communities where community_id=:community_id) connect by object_type= prior supertype - - - + + + select object_type + from acs_object_types + where supertype = 'dotlrn_community' + start with object_type = (select community_type + from dotlrn_communities + where community_id = :community_id) + connect by object_type = prior supertype + + Index: openacs-4/packages/dotlrn/tcl/community-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.tcl,v diff -u -r1.41 -r1.42 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 11 Dec 2001 03:47:53 -0000 1.41 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 17 Dec 2001 23:02:56 -0000 1.42 @@ -194,6 +194,20 @@ return $community_id } + ad_proc set_active_dates { + {-community_id:required} + {-start_date:required} + {-end_date:required} + } { + set the community active ebgin and end dates + } { + set start_date "[template::util::date::get_property year $start_date] [template::util::date::get_property month $start_date] [template::util::date::get_property day $start_date]" + set end_date "[template::util::date::get_property year $end_date] [template::util::date::get_property month $end_date] [template::util::date::get_property day $end_date]" + set date_format "YYYY MM DD" + + db_dml set_active_dates {} + } + ad_proc set_package_id { community_id package_id @@ -350,6 +364,15 @@ return [db_string select_count_membership {}] } + ad_proc -public member_pending_p { + {-community_id:required} + {-user_id:required} + } { + is this user awaiting membership in this community? + } { + return [db_string is_pending_membership {}] + } + ad_proc -public add_user { {-rel_type "dotlrn_member_rel"} community_id @@ -390,7 +413,7 @@ ns_set put $extra_vars community_id $community_id # Set up the relationship - set rel_id [relation_add -extra_vars $extra_vars -member_state approved $rel_type $community_id $user_id] + set rel_id [relation_add -extra_vars $extra_vars $rel_type $community_id $user_id] # do the callbacks applets_dispatch $community_id AddUserToCommunity [list $community_id $user_id] @@ -462,20 +485,6 @@ return $list_of_communities } - ad_proc -public get_active_communities { - community_type - } { - Returns a list of active communities for a given type. - } { - set list_of_communities [list] - - db_foreach select_active_communities {} { - lappend list_of_communities [list $community_id $community_type $pretty_name $description [get_url -package_id $package_id]] - } - - return $list_of_communities - } - ad_proc -public get_all_communities { community_type } { Index: openacs-4/packages/dotlrn/tcl/community-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.xql,v diff -u -r1.17 -r1.18 --- openacs-4/packages/dotlrn/tcl/community-procs.xql 8 Dec 2001 01:22:40 -0000 1.17 +++ openacs-4/packages/dotlrn/tcl/community-procs.xql 17 Dec 2001 23:02:56 -0000 1.18 @@ -35,7 +35,6 @@ - select segment_id from rel_segments where group_id= :community_id and rel_type= :rel_type @@ -54,6 +53,18 @@ + + + select count(*) + from group_member_map, + membership_rels + where group_member_map.group_id = :community_id + and group_member_map.member_id = :user_id + and group_member_map.rel_id = membership_rels.rel_id + and membership_rels.member_state = 'needs approval' + + + select rel_id, portal_id from dotlrn_member_rels_full where community_id= :community_id and user_id= :user_id @@ -96,14 +107,6 @@ - - -select community_id, community_type, pretty_name, description, package_id -from dotlrn_active_not_closed_comms -where community_type= :community_type - - - select community_id, community_type, pretty_name, description, package_id, community_key Index: openacs-4/packages/dotlrn/tcl/term-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/Attic/term-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/tcl/term-procs-oracle.xql 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,37 @@ + + + + oracle8.1.6 + + + + insert + into dotlrn_terms + (term_id, term_name, term_year, start_date, end_date) + values + (acs_object_id_seq.nextval, :term_name, :term_year, to_date(:start_date, :date_format), to_date(:end_date, :date_format)) + + + + + + select to_char(dotlrn_terms.start_date, :date_format) as start_date, + to_char(dotlrn_terms.start_date, 'YYYY') as year, + to_char(dotlrn_terms.start_date, 'MM') as month, + to_char(dotlrn_terms.start_date, 'DD') as day + from dotlrn_terms + where dotlrn_terms.term_id = :term_id + + + + + + select to_char(dotlrn_terms.end_date, :date_format) as end_date, + to_char(dotlrn_terms.end_date, 'YYYY') as year, + to_char(dotlrn_terms.end_date, 'MM') as month, + to_char(dotlrn_terms.end_date, 'DD') as day + from dotlrn_terms + where dotlrn_terms.term_id = :term_id + + + Index: openacs-4/packages/dotlrn/tcl/term-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/term-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/tcl/term-procs.tcl 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,74 @@ +# dotlrn/tcl/term-procs.tcl + +ad_library { + @author yon (yon@milliped.com) + @creation-date Dec 12, 2001 + @version $Id: term-procs.tcl,v 1.1 2001/12/17 23:02:56 yon Exp $ +} + +namespace eval dotlrn_term { + ad_proc -public new { + {-term_name:required} + {-term_year:required} + {-start_date:required} + {-end_date:required} + } { + create a new term + } { + set start_date "[template::util::date::get_property year $start_date] [template::util::date::get_property month $start_date] [template::util::date::get_property day $start_date]" + set end_date "[template::util::date::get_property year $end_date] [template::util::date::get_property month $end_date] [template::util::date::get_property day $end_date]" + set date_format "YYYY MM DD" + + db_dml insert_term {} + } + + ad_proc -public get_term_name { + {-term_id:required} + } { + get the term name for this term object + } { + return [db_string get_term_name {}] + } + + ad_proc -public get_term_year { + {-term_id:required} + } { + get the term year for this term object + } { + return [db_string get_term_year {}] + } + + ad_proc -public get_term_info { + {-term_id:required} + {-term_name_var "term_name"} + {-term_year_var "term_year"} + } { + get the term name and year for this term object + } { + db_1row get_term_info {} + upvar 1 $term_name $term_name_var $term_year $term_year_var + } + + ad_proc -public get_start_date { + {-term_id:required} + } { + get the start date of this term + } { + set date_format "YYYY MM DD" + db_1row get_start_date {} + + return [template::util::date::create $year $month $day "" "" "" $date_format] + } + + ad_proc -public get_end_date { + {-term_id:required} + } { + get the end date of this term + } { + set date_format "YYYY MM DD" + db_1row get_end_date {} + + return [template::util::date::create $year $month $day "" "" "" $date_format] + + } +} Index: openacs-4/packages/dotlrn/tcl/term-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/term-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/tcl/term-procs.xql 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,28 @@ + + + + + + select dotlrn_terms.term_name + from dotlrn_terms + where dotlrn_terms.term_id = :term_id + + + + + + select dotlrn_terms.term_year + from dotlrn_terms + where dotlrn_terms.term_id = :term_id + + + + + + select dotlrn_terms.term_name, + dotlrn_terms.term_year + from dotlrn_terms + where dotlrn_terms.term_id = :term_id + + + Index: openacs-4/packages/dotlrn/www/communities-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/communities-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/communities-oracle.xql 8 Dec 2001 01:23:46 -0000 1.1 +++ openacs-4/packages/dotlrn/www/communities-oracle.xql 17 Dec 2001 23:02:56 -0000 1.2 @@ -10,15 +10,13 @@ dotlrn_communities.pretty_name, dotlrn_communities.description, dotlrn_communities.package_id, - (select site_node.url(site_nodes.node_id) - from site_nodes - where site_nodes.object_id = dotlrn_communities.package_id) as url, + dotlrn_community.url(dotlrn_communities.community_id) as url, (select decode(count(*), 0, 'f', 't') from dotlrn_member_rels_full where dotlrn_member_rels_full.user_id = :user_id and dotlrn_member_rels_full.community_id = dotlrn_communities.community_id) as member_p, acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin') as admin_p - from dotlrn_active_not_closed_comms dotlrn_communities + from dotlrn_active_comms_not_closed dotlrn_communities where dotlrn_communities.community_type = :community_type Index: openacs-4/packages/dotlrn/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/index.adp,v diff -u -r1.10 -r1.11 --- openacs-4/packages/dotlrn/www/index.adp 11 Dec 2001 03:19:48 -0000 1.10 +++ openacs-4/packages/dotlrn/www/index.adp 17 Dec 2001 23:02:56 -0000 1.11 @@ -1,7 +1,10 @@ dotLRN -Visit dotLRN Administration.
+ + Visit dotLRN Administration.
+
+ Configure this page.

Index: openacs-4/packages/dotlrn/www/master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/master.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/dotlrn/www/master.adp 13 Nov 2001 16:21:01 -0000 1.4 +++ openacs-4/packages/dotlrn/www/master.adp 17 Dec 2001 23:02:56 -0000 1.5 @@ -1,26 +1,10 @@ @title@ - - - - -
- - - - - -
dotLRNMIT Sloan
-
- - - - -

@title@

- + + <%= [eval dotlrn::navbar $context_bar] %> - +
Index: openacs-4/packages/dotlrn/www/one-community.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/one-community.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/dotlrn/www/one-community.tcl 11 Dec 2001 03:08:21 -0000 1.10 +++ openacs-4/packages/dotlrn/www/one-community.tcl 17 Dec 2001 23:02:56 -0000 1.11 @@ -1,4 +1,3 @@ - ad_page_contract { Displays a community @@ -7,9 +6,6 @@ } { } -# ns_log Notice "BEN TEST!" - - # Check that this is a community type if {[ad_parameter community_level_p] != 1} { ns_returnredirect "./" @@ -28,6 +24,11 @@ if {![dotlrn_community::member_p $community_id $user_id]} { set context_bar [list "Not a member"] + if {[dotlrn_community::member_pending_p -community_id $community_id -user_id $user_id]} { + set member_pending_p "t" + set context_bar [list "Pending approbal"] + } + set portal_id [dotlrn_community::get_community_non_members_portal_id $community_id] # Possible that there is no portal page for non-members Index: openacs-4/packages/dotlrn/www/admin/class-instance-new-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/Attic/class-instance-new-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/admin/class-instance-new-oracle.xql 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,19 @@ + + + + oracle8.1.6 + + + + select dotlrn_terms.term_name || ' ' || dotlrn_terms.term_year as term, + dotlrn_terms.term_id + from dotlrn_terms + where dotlrn_terms.end_date > sysdate + and not exists (select 1 + from dotlrn_class_instances + where dotlrn_class_instances.class_key = :class_key + and dotlrn_class_instances.term_id = dotlrn_terms.term_id) + order by dotlrn_terms.start_date + + + Index: openacs-4/packages/dotlrn/www/admin/class-instance-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/class-instance-new.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/dotlrn/www/admin/class-instance-new.tcl 11 Dec 2001 00:45:16 -0000 1.6 +++ openacs-4/packages/dotlrn/www/admin/class-instance-new.tcl 17 Dec 2001 23:02:56 -0000 1.7 @@ -5,34 +5,31 @@ @creation-date 2001-10-05 @version $Id$ } -query { - class_key + class_key:notnull {referer ""} } form create add_class_instance -element create add_class_instance year \ - -label "Year" -datatype text -widget text -html {size 50} - element create add_class_instance term \ - -label "Term" -datatype text -widget text -html {size 50} + -label "Term" -datatype integer -widget select -options [db_list_of_lists select_terms_for_select_widget {}] element create add_class_instance description \ - -label "Description" -datatype text -widget textarea -html {rows 5 cols 60 wrap soft} + -label "Description" -datatype text -widget textarea -html {rows 5 cols 60 wrap soft} -optional -element create add_class_instance class_key \ - -label "Class Key" -value $class_key -datatype text -widget hidden - element create add_class_instance join_policy \ -label "Join Policy" -datatype text -widget select -options {{Open open} {"Needs Approval" "needs approval"} {Closed closed}} +element create add_class_instance class_key \ + -label "Class Key" -value $class_key -datatype text -widget hidden + element create add_class_instance referer \ -label "Referer" -value $referer -datatype text -widget hidden if {[form is_valid add_class_instance]} { - template::form get_values add_class_instance class_key year term description join_policy referer + template::form get_values add_class_instance term description join_policy class_key referer - set class_instance_id [dotlrn_class::new_instance -description $description -class_type $class_key -term $term -year $year -join_policy $join_policy] + set class_instance_id [dotlrn_class::new_instance -description $description -class_type $class_key -term_id $term -join_policy $join_policy] if {[empty_string_p $referer]} { set referer "one-class?class_key=$class_key" Index: openacs-4/packages/dotlrn/www/admin/class-instance-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/class-instance-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/admin/class-instance-oracle.xql 10 Dec 2001 22:49:39 -0000 1.1 +++ openacs-4/packages/dotlrn/www/admin/class-instance-oracle.xql 17 Dec 2001 23:02:56 -0000 1.2 @@ -5,12 +5,10 @@ - select dotlrn_communities.pretty_name, - (select site_node.url(site_nodes.node_id) - from site_nodes - where site_nodes.object_id = dotlrn_communities.package_id) as url - from dotlrn_active_comms dotlrn_communities - where dotlrn_communities.community_id = :class_instance_id + select dotlrn_class_instances.pretty_name, + dotlrn_class_instances.url + from dotlrn_class_instances_full dotlrn_class_instances + where dotlrn_class_instances.class_instance_id = :class_instance_id Index: openacs-4/packages/dotlrn/www/admin/class.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/class.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/admin/class.adp 10 Dec 2001 22:49:39 -0000 1.1 +++ openacs-4/packages/dotlrn/www/admin/class.adp 17 Dec 2001 23:02:56 -0000 1.2 @@ -1,9 +1,18 @@ @pretty_name@ + [ new instance ] + + +[ + + new instance + +] +
Index: openacs-4/packages/dotlrn/www/admin/class.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/class.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/admin/class.tcl 10 Dec 2001 22:49:39 -0000 1.1 +++ openacs-4/packages/dotlrn/www/admin/class.tcl 17 Dec 2001 23:02:56 -0000 1.2 @@ -9,8 +9,11 @@ class_key:onevalue pretty_name:onevalue instances:multirow + can_instantiate:onevalue } db_multirow instances select_class_instances {} +set can_instantiate [db_string can_instantiate_class {}] + ad_return_template Index: openacs-4/packages/dotlrn/www/admin/class.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/class.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/admin/class.xql 10 Dec 2001 22:49:39 -0000 1.1 +++ openacs-4/packages/dotlrn/www/admin/class.xql 17 Dec 2001 23:02:56 -0000 1.2 @@ -9,4 +9,14 @@ order by class_instance_id + + + + select count(*) + from dotlrn_terms + where dotlrn_terms.term_id not in (select dotlrn_class_instances.term_id + from dotlrn_class_instances + where dotlrn_class_instances.class_key = :class_key) + + Index: openacs-4/packages/dotlrn/www/admin/classes.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/classes.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/dotlrn/www/admin/classes.adp 11 Dec 2001 16:14:13 -0000 1.4 +++ openacs-4/packages/dotlrn/www/admin/classes.adp 17 Dec 2001 23:02:56 -0000 1.5 @@ -4,7 +4,9 @@ [ new class ] -

+

+ +

Index: openacs-4/packages/dotlrn/www/admin/club-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/club-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/admin/club-oracle.xql 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,16 @@ + + + + oracle8.1.6 + + + + select dotlrn_communities.community_key, + dotlrn_communities.pretty_name, + dotlrn_communities.description, + dotlrn_community.url(:club_id) + from dotlrn_communities + where dotlrn_communities.community_id = :club_id + + + Index: openacs-4/packages/dotlrn/www/admin/club.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/club.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/www/admin/club.adp 10 Dec 2001 22:48:57 -0000 1.2 +++ openacs-4/packages/dotlrn/www/admin/club.adp 17 Dec 2001 23:02:56 -0000 1.3 @@ -1 +1 @@ -@pretty_name@ - @description@ +@pretty_name@ - @description@ Index: openacs-4/packages/dotlrn/www/admin/club.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/club.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/www/admin/club.tcl 10 Dec 2001 22:48:57 -0000 1.2 +++ openacs-4/packages/dotlrn/www/admin/club.tcl 17 Dec 2001 23:02:56 -0000 1.3 @@ -9,9 +9,10 @@ club_id:onevalue pretty_name:onevalue descrition:onevalue + url:onevalue } -if {![exists_and_not_null pretty_name]} { +if {![exists_and_not_null url]} { db_1row select_club {} } Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/www/admin/club.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/dotlrn/www/admin/clubs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/clubs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/admin/clubs-oracle.xql 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,18 @@ + + + + oracle8.1.6 + + + + select dotlrn_clubs.club_id, + dotlrn_communities.community_key, + dotlrn_communities.pretty_name, + dotlrn_communities.description, + dotlrn_community.url(dotlrn_communities.community_id) as url + from dotlrn_clubs, + dotlrn_communities + where dotlrn_clubs.club_id = dotlrn_communities.community_id + + + Index: openacs-4/packages/dotlrn/www/admin/clubs.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/clubs.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/www/admin/clubs.adp 11 Dec 2001 16:14:13 -0000 1.3 +++ openacs-4/packages/dotlrn/www/admin/clubs.adp 17 Dec 2001 23:02:56 -0000 1.4 @@ -2,17 +2,21 @@ dotLRN Clubs @context_bar@ -[ new club ] +[ new club ]

- +

-[ new club ] +[ new club ] Index: openacs-4/packages/dotlrn/www/admin/clubs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/clubs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/www/admin/clubs.tcl 10 Dec 2001 22:48:57 -0000 1.2 +++ openacs-4/packages/dotlrn/www/admin/clubs.tcl 17 Dec 2001 23:02:56 -0000 1.3 @@ -1,3 +1,5 @@ +# dotlrn/www/admin/clubs.tcl + ad_page_contract { displays dotLRN clubs admin page @@ -6,11 +8,11 @@ @version $Id$ } { } -properties { - clubs:multirow context_bar:onevalue + clubs:multirow } -set context_bar "clubs" +set context_bar "Clubs" db_multirow clubs select_clubs {} Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/www/admin/clubs.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/dotlrn/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/index.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn/www/admin/index.adp 11 Dec 2001 16:14:13 -0000 1.5 +++ openacs-4/packages/dotlrn/www/admin/index.adp 17 Dec 2001 23:02:56 -0000 1.6 @@ -9,7 +9,8 @@ @context_bar@ Index: openacs-4/packages/dotlrn/www/admin/master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/Attic/master.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/www/admin/master.adp 10 Dec 2001 22:56:31 -0000 1.3 +++ openacs-4/packages/dotlrn/www/admin/master.adp 17 Dec 2001 23:02:56 -0000 1.4 @@ -1,34 +1,10 @@ @title@ - - - - - - - -
- - - - - - - - -
- -
- dotLRN - - MIT Sloan -
-
- -
-

@title@

+ + <%= [eval dotlrn::admin_navbar $context_bar] %> +
Index: openacs-4/packages/dotlrn/www/admin/need-term-note.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/need-term-note.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/admin/need-term-note.adp 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,4 @@ + + Note: You must create terms to be able to create + class instances, since these must be associated with terms. + Index: openacs-4/packages/dotlrn/www/admin/one-class.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/Attic/one-class.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn/www/admin/one-class.adp 11 Dec 2001 16:14:13 -0000 1.5 +++ openacs-4/packages/dotlrn/www/admin/one-class.adp 17 Dec 2001 23:02:56 -0000 1.6 @@ -1,13 +1,27 @@ -dotLRN Class Instances for @class_key@ +@pretty_name@ (@class_key@) @context_bar@ +

+ @description@ +

+ +

+ + +Instances + Index: openacs-4/packages/dotlrn/www/admin/one-class.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/Attic/one-class.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/www/admin/one-class.tcl 29 Nov 2001 06:05:37 -0000 1.3 +++ openacs-4/packages/dotlrn/www/admin/one-class.tcl 17 Dec 2001 23:02:56 -0000 1.4 @@ -1,11 +1,17 @@ - ad_page_contract { Displays single dotLRN class page @author Ben Adida (ben@openforce.net) + @author yon (yon@openforce.net) @creation-date 2001-11-07 -} { - class_key + @version $Id$ +} -query { + class_key:notnull +} -properties { + pretty_name:onevalue + description:onevalue + class_instances:multirow + can_instantiate:onevalue } # Get information about that class @@ -14,14 +20,10 @@ return } -# Get all class instances -set list_of_class_instances [dotlrn_community::get_all_communities $class_key] +db_multirow class_instances select_class_instances {} -template::multirow create class_instances class_instance_id community_key pretty_name description +set can_instantiate [db_string can_instantiate_class {}] -foreach instance $list_of_class_instances { - template::multirow append class_instances [lindex $instance 0] [lindex $instance 5] [lindex $instance 2] [lindex $instance 3] -} - set context_bar {{classes Classes} One} + ad_return_template Index: openacs-4/packages/dotlrn/www/admin/one-class.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/Attic/one-class.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/admin/one-class.xql 7 Nov 2001 20:20:56 -0000 1.1 +++ openacs-4/packages/dotlrn/www/admin/one-class.xql 17 Dec 2001 23:02:56 -0000 1.2 @@ -1,11 +1,31 @@ + + + select pretty_name, + description, + supertype + from dotlrn_classes_full + where class_key = :class_key + + - - -select pretty_name, description, supertype from dotlrn_classes_full where class_key= :class_key - - + + + select * + from dotlrn_class_instances_full dotlrn_class_instances + where dotlrn_class_instances.class_key = :class_key + + + + + select count(*) + from dotlrn_terms + where dotlrn_terms.term_id not in (select dotlrn_class_instances.term_id + from dotlrn_class_instances + where dotlrn_class_instances.class_key = :class_key) + + Index: openacs-4/packages/dotlrn/www/admin/one-club-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/Attic/one-club-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/admin/one-club-oracle.xql 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,15 @@ + + + + oracle8.1.6 + + + + select dotlrn_communities.pretty_name, + dotlrn_communities.description, + dotlrn_community.url(:club_id) as url + from dotlrn_communities + where dotlrn_communities.community_id = :club_id + + + Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/www/admin/one-club.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/dotlrn/www/admin/term-new.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/term-new.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/admin/term-new.adp 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,5 @@ + +dotLRN New Term +@context_bar@ + + Index: openacs-4/packages/dotlrn/www/admin/term-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/term-new.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/admin/term-new.tcl 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,45 @@ +ad_page_contract { + create a new term - input form + + @author yon (yon@openforce.net) + @creation-date 2001-12-13 + @version $Id: term-new.tcl,v 1.1 2001/12/17 23:02:56 yon Exp $ +} -query { + {referer ""} +} -properties { + context_bar:onevalue +} + +form create add_term + +element create add_term term_name \ + -label "Term (e.g. Spring, Fall)" -datatype text -widget text -html {size 30} + +element create add_term term_year \ + -label "Year" -datatype text -widget text -html {size 4} + +element create add_term start_date \ + -label "Start Date" -datatype date -widget date -format {MONTH DD YYYY} + +element create add_term end_date \ + -label "End Date" -datatype date -widget date -format {MONTH DD YYYY} + +element create add_term referer \ + -label "Referer" -value $referer -datatype text -widget hidden + +if {[form is_valid add_term]} { + form get_values add_term term_name term_year start_date end_date referer + + dotlrn_term::new -term_name $term_name -term_year $term_year -start_date $start_date -end_date $end_date + + if {[empty_string_p $referer]} { + set referer "terms" + } + + ad_returnredirect $referer + ad_script_abort +} + +set context_bar {{terms Terms} New} + +ad_return_template Index: openacs-4/packages/dotlrn/www/admin/term.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/term.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/admin/term.adp 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1 @@ +@term_name@ @term_year@ (@start_date@ - @end_date@) Index: openacs-4/packages/dotlrn/www/admin/term.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/term.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/admin/term.tcl 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,20 @@ +# dotlrn/www/admin/term.tcl + +ad_page_contract { + @author yon (yon@openforce.net) + @creation-date 2001-12-03 + @version $Id: term.tcl,v 1.1 2001/12/17 23:02:56 yon Exp $ +} { +} -properties { + term_id:onevalue + term_name:onevalue + term_year:onevalue + start_date:onevalue + end_date:onevalue +} + +if {![exists_and_not_null term_name]} { + db_1row select_term {} +} + +ad_return_template Index: openacs-4/packages/dotlrn/www/admin/term.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/term.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/admin/term.xql 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,14 @@ + + + + + + select dotlrn_terms.term_name, + dotlrn_terms.term_year, + dotlrn_terms.start_date, + dotlrn_terms.end_date + from dotlrn_terms + where dotlrn_terms.term_id = :term_id + + + Index: openacs-4/packages/dotlrn/www/admin/terms.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/terms.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/admin/terms.adp 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,22 @@ + +dotLRN Terms +@context_bar@ + +[ new term ] + +

+ + + + +

+
+
+ + +[ new term ] + Index: openacs-4/packages/dotlrn/www/admin/terms.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/terms.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/admin/terms.tcl 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,17 @@ +# dotlrn/www/admin/terms.tcl + +ad_page_contract { + @author yon (yon@milliped.com) + @creation-date Dec 13, 2001 + @version $Id: terms.tcl,v 1.1 2001/12/17 23:02:56 yon Exp $ +} -query { +} -properties { + context_bar:onevalue + terms:multirow +} + +set context_bar "Terms" + +db_multirow terms select_terms {} + +ad_return_template Index: openacs-4/packages/dotlrn/www/admin/terms.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/terms.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/admin/terms.xql 17 Dec 2001 23:02:56 -0000 1.1 @@ -0,0 +1,15 @@ + + + + + + select term_id, + term_name, + term_year, + start_date, + end_date + from dotlrn_terms + order by start_date + + + Index: openacs-4/packages/dotlrn/www/admin/user-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/user-edit.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/admin/user-edit.tcl 10 Dec 2001 23:58:31 -0000 1.1 +++ openacs-4/packages/dotlrn/www/admin/user-edit.tcl 17 Dec 2001 23:02:56 -0000 1.2 @@ -17,10 +17,10 @@ -label "User Type" -datatype text -widget select -options [dotlrn::get_user_types] element create edit_user rel_type \ - -label "Access" -datatype text -widget select -options {{{Limited Access} dotlrn_user_rel} {{Full Access} dotlrn_full_user_rel}} + -label "Access" -datatype text -widget select -options {{{limited access} dotlrn_user_rel} {{full access} dotlrn_full_user_rel}} element create edit_user read_private_data_p \ - -label "Can Access Private Information?" -datatype text -widget select -options {{Yes t} {No f}} + -label "Can Access Private Information?" -datatype text -widget select -options {{yes t} {no f}} # Create a form of hidden vars @@ -36,8 +36,6 @@ # We verified everything, now we make the change if {[form is_valid verif_edit_user]} { - ns_log Notice "BENLOG - verif_edit_user is VALID!" - template::form get_values verif_edit_user user_id type_id rel_type read_private_data_p set rel_id [db_string select_rel_id "select rel_id from dotlrn_users where user_id=:user_id"] @@ -59,9 +57,7 @@ if {[form is_valid edit_user]} { - ns_log Notice "BENLOG - edit_user is VALID!" template::form get_values edit_user user_id type_id rel_type read_private_data_p - ns_log Notice "BENLOG - immediate read_private_data_p is $read_private_data_p" # Do something set new_rel_type $rel_type @@ -70,22 +66,16 @@ set old_rel_type [db_string select_rel_type "select 'dotlrn_full_user_rel' from dual where exists (select 1 from dotlrn_full_users where user_id=:user_id)" -default "dotlrn_user_rel"] if {$new_rel_type == $old_rel_type} { - ns_log Notice "BENLOG - new_type is the same!" - # Simply update things - db_transaction { # Update straight user info db_dml update_user {} # Update permissions - ns_log Notice "BENLOG - read_private_data set to $read_private_data_p" acs_privacy::set_user_read_private_data -user_id $user_id -object_id [dotlrn::get_package_id] -value $read_private_data_p } } else { - ns_log Notice "BENLOG - new_type is different!" # Warn about the change - element set_properties verif_edit_user user_id -value $user_id element set_properties verif_edit_user type_id -value $type_id element set_properties verif_edit_user rel_type -value $rel_type @@ -114,4 +104,3 @@ element set_properties edit_user read_private_data_p -value $read_private_data_p ad_return_template - Index: openacs-4/packages/dotlrn/www/admin/user-new-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/user-new-2.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/dotlrn/www/admin/user-new-2.tcl 11 Dec 2001 00:27:59 -0000 1.6 +++ openacs-4/packages/dotlrn/www/admin/user-new-2.tcl 17 Dec 2001 23:02:56 -0000 1.7 @@ -17,10 +17,10 @@ -label "User Type" -datatype text -widget select -options [dotlrn::get_user_types] element create add_user rel_type \ - -label "Access" -datatype text -widget select -options {{{Limited Access} dotlrn_user_rel} {{Full Access} dotlrn_full_user_rel}} + -label "Access" -datatype text -widget select -options {{{limited access} dotlrn_user_rel} {{full access} dotlrn_full_user_rel}} element create add_user read_private_data_p \ - -label "Can Access Private Information?" -datatype text -widget select -options {{Yes t} {No f}} + -label "Can Access Private Information?" -datatype text -widget select -options {{yes t} {no f}} if {[form is_valid add_user]} { template::form get_values add_user user_id type_id rel_type read_private_data_p Index: openacs-4/packages/dotlrn/www/admin/users.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/users.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/dotlrn/www/admin/users.adp 11 Dec 2001 16:14:13 -0000 1.6 +++ openacs-4/packages/dotlrn/www/admin/users.adp 17 Dec 2001 23:02:56 -0000 1.7 @@ -26,8 +26,8 @@ @users.last_name@, @users.first_names@ (@users.email@) @users.type@ -LimitedFull -YESNO +limitedfull +yesno