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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql 30 Sep 2001 20:08:47 -0000 1.1 @@ -0,0 +1,134 @@ + +-- +-- The DotLRN basic system +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- for Oracle 8/8i. (We're guessing 9i works, too). +-- +-- ben@openforce.net +-- September 25th, 2001 +-- we remember September 11th, 2001 +-- + + +declare + year_attr_id acs_attributes.attribute_id$TYPE; + term_attr_id acs_attributes.attribute_id$TYPE; +begin + -- create the major group types + acs_object_type.create_type ( + supertype => 'group', + object_type => 'dotlrn_community', + pretty_name => 'dotLRN Community', + pretty_plural => 'dotLRN Communities', + table_name => 'dotlrn_communities', + id_column => 'community_id', + package_name => 'dotlrn', + type_extension_table => 'dotlrn_community_types', + name_method => 'acs_group.name' + ); + + acs_object_type.create_type ( + supertype => 'dotlrn_community', + object_type => 'dotlrn_club', + pretty_name => 'dotLRN Club', + pretty_plural => 'dotLRN Clubs', + table_name => 'dotlrn_clubs', + id_column => 'club_id', + package_name => 'dotlrn', + name_method => 'acs_group.name' + ); + + acs_object_type.create_type ( + supertype => 'dotlrn_community', + object_type => 'dotlrn_class', + pretty_name => 'dotLRN Class', + pretty_plural => 'dotLRN Classes', + table_name => 'dotlrn_classes', + id_column => 'class_id', + package_name => 'dotlrn', + name_method => 'acs_group.name' + ); + + -- year attribute + year_attr_id:= acs_attribute.create_attribute ( + object_type => 'dotlrn_class', + attribute_name => 'year', + datatype => 'string', + pretty_name => 'Year', + pretty_plural => 'Years', + min_n_values => 1, + max_n_values => 1 + ); + + -- term attribute + term_attr_id:= acs_attribute.create_attribute ( + object_type => 'dotlrn_class', + 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'); + + -- create relationships + acs_rel_type.create_type ( + rel_type => 'admin_rel', + supertype => 'membership_rel', + pretty_name => 'Administration Relation', + pretty_plural => 'Administration Relationships', + package_name => 'dotlrn', + object_type_one => 'dotlrn_community', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => null, + object_type_two => 'party', role_two => 'admin', + min_n_rels_two => 0, max_n_rels_two => null + ); + + acs_rel_type.create_type ( + rel_type => 'instructor_rel', + supertype => 'admin_rel', + pretty_name => 'Instructor Relation', + pretty_plural => 'Instructor Relationships', + package_name => 'dotlrn', + object_type_one => 'dotlrn_class', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => null, + object_type_two => 'party', role_two => 'instructor', + min_n_rels_two => 0, max_n_rels_two => null + ); + + acs_rel_type.create_type ( + rel_type => 'ta_rel', + supertype => 'admin_rel', + pretty_name => 'TA Relation', + pretty_plural => 'TA Relationships', + package_name => 'dotlrn', + object_type_one => 'dotlrn_class', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => null, + object_type_two => 'party', role_two => 'teaching_assistant', + min_n_rels_two => 0, max_n_rels_two => null + ); + + acs_rel_type.create_type ( + rel_type => 'student_rel', + supertype => 'membership_rel', + pretty_name => 'Student Relation', + pretty_plural => 'Student Relationships', + package_name => 'dotlrn', + object_type_one => 'dotlrn_class', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => null, + object_type_two => 'party', role_two => 'student', + min_n_rels_two => 0, max_n_rels_two => null + ); + +end; +/ +show errors + 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.1 -r1.2 --- openacs-4/packages/dotlrn/tcl/class-procs.tcl 20 Sep 2001 18:29:35 -0000 1.1 +++ openacs-4/packages/dotlrn/tcl/class-procs.tcl 30 Sep 2001 20:08:47 -0000 1.2 @@ -32,7 +32,7 @@ set parent_node_id [ad_conn -get node_id] - set group_type_name "DOTLRN_CLASS_$name" + set group_type_name "dotlrn_class_$name" db_transaction { # Create a new group type for that class @@ -45,9 +45,11 @@ # Set some parameters ad_parameter -package_id $package_id -set 0 dotlrn_level_p - ad_parameter -package_id $package_id -set 1 class_level_p - ad_parameter -package_id $package_id -set 0 class_instance_level_p + ad_parameter -package_id $package_id -set 1 community_type_level_p + ad_parameter -package_id $package_id -set 0 community_level_p + # Insert the community into the DB + # insert the class into the DB db_dml insert_class {} } @@ -130,4 +132,4 @@ return "dotlrn" } -} \ No newline at end of file +} 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 30 Sep 2001 20:08:47 -0000 1.1 @@ -0,0 +1,56 @@ + +# +# Procs for DOTLRN Community Management +# Copyright 2001 OpenForce, inc. +# Distributed under the GNU GPL v2 +# +# September 28th, 2001 +# + +ad_library { + + Procs to manage DOTLRN Communities + + @author ben@openforce.net + @creation-date 2001-09-28 + +} + +namespace eval dotlrn_community { + + ad_proc new_type { + community_type + supertype + pretty_name + {-description ""} + } { + Create a new community type. + } { + # Create the group type + set group_type_key [group_type::new -group_type $community_type -supertype $parent_type $pretty_name $pretty_name] + + # Insert the community type + db_dml insert_community_type {} + } + + ad_proc set_type_site_node { + community_type + node_id + } { + Update the node ID for the community type + } { + # Exec the statement, easy + db_dml update_site_node {} + } + + ad_proc new { + community_type + name + pretty_name + } { + create a new community + } { + + } + +} Index: openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl 20 Sep 2001 21:04:56 -0000 1.2 +++ openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl 30 Sep 2001 20:08:47 -0000 1.3 @@ -18,96 +18,6 @@ namespace eval dotlrn { - ad_proc install { - } { - This installs the DOTLRN Class System. There is a lot of stuff that needs to - be set up to do this correctly, so it must be done at the Tcl Level. - - This proc can be called multiple times, it will do the right thing. - - It will error out in case of impossible to solve issues. - } { - - # If we've already set things up, bail - set group_type_key [ad_parameter group_type_key] - if {![empty_string_p $group_type_key]} { - if {[db_string check_group_type_exist {}] == 1} { - return - } - } - - # If lower levels, no install - if {[ad_parameter community_type_level_p] == 1 || [ad_parameter community_level_p] == 1} { - return - } - - # Make sure we don't call this proc multiple times simultaneously - ## We should really add a critical section here - - # Set up the top-level group type - set group_type_key [group_type::new -group_type "dotlrn_community" "dotLRN Community" "dotLRN Communities"] - - # Store the group_type_key somewhere for future reference - ad_parameter -set $group_type_key group_type_key - ad_parameter -set 1 dotlrn_level_p - ad_parameter -set 0 class_level_p - ad_parameter -set 0 class_instance_level_p - - # Set up attributes - set start_date_attr_id [attribute::add -min_n_values 1 -max_n_values 1 $group_type_key date "Start Date" "Start Dates"] - set end_date_attr_id [attribute::add -min_n_values 1 -max_n_values 1 $group_type_key date "End Date" "End Dates"] - - # Add the general role of administrator - set role administrator - set pretty_name Administrator - set pretty_plural Administrators - - db_exec_plsql add_role {} - - # Add the administrator relationship - rel_types::new -supertype "membership_rel" -role_two administrator \ - administration_rel Administration Administrations \ - $group_type_key 0 "" \ - person 0 "" - - - # Add permissible relationships - rel_types::add_permissible $group_type_key administrator_rel - rel_types::remove_permissible $group_type_key composition_rel - - # Install a few other things - install_classes $group_type_key - install_clubs $group_type_key - } - - ad_proc -private install_classes { - supertype - } { - Install classes - } { - } - - ad_proc -private install_clubs { - supertype - } { - Install clubs - } { - - # Add the group type for classes - set club_group_type_key [ad_parameter club_group_type_key] - if {![empty_string_p $club_group_type_key]} { - if {[db_string check_group_type_exist {}] == 1} { - return - } - } - - set club_group_type_key [group_type::new -supertype $supertype -group_type "dotlrn_club" "dotLRN Club" "dotLRN Clubs"] - - # Set parameters - ad_parameter -set $club_group_type_key club_group_type_key - - } - ad_proc -public group_type_key { } { Returns the group_type key that is being used for class management