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.14 -r1.15 --- openacs-4/packages/dotlrn/tcl/class-procs.tcl 5 Dec 2001 13:32:40 -0000 1.14 +++ openacs-4/packages/dotlrn/tcl/class-procs.tcl 5 Dec 2001 22:05:23 -0000 1.15 @@ -18,6 +18,39 @@ namespace eval dotlrn_class { + ad_proc -public community_type {} { + returns the base community type for classes + } { + return "dotlrn_class_instance" + } + + ad_proc -public is_initialized {} { + is dotlrn_class initialized with the right community_type? + } { + set community_type [community_type] + return [db_string is_dotlrn_class_initialized { + select count(*) + from dotlrn_community_types + where community_type = :community_type + and package_id is not null + }] + } + + ad_proc -public init {} { + create base community_type for dotlrn_class + } { + db_transaction { + set dotlrn_classes_url "[dotlrn::get_url][dotlrn_class::get_url]/" + if {![dotlrn::is_instantiated_here -url $dotlrn_classes_url]} { + set package_id [dotlrn::mount_package \ + -package_key [dotlrn::package_key] \ + -url [dotlrn_class::get_url_part] \ + -directory_p "t"] + dotlrn_community::set_type_package_id [community_type] $package_id + } + } + } + ad_proc -public new { {-description ""} {-class_key:required} @@ -67,7 +100,7 @@ return [dotlrn_community::new \ -description $description \ -community_type $class_type \ - -object_type dotlrn_class_instance \ + -object_type [community_type] \ -community_key $community_key \ -pretty_name $class_name \ -extra_vars $extra_vars] 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.36 -r1.37 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 4 Dec 2001 23:59:15 -0000 1.36 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 5 Dec 2001 22:05:23 -0000 1.37 @@ -35,22 +35,23 @@ {-community_type_key:required} {-parent_type "dotlrn_community"} {-pretty_name:required} + {-url_part ""} } { Create a new community type. } { # Figure out parent_node_id set parent_node_id [get_type_node_id $parent_type] + array set parent_node [site_node [site_nodes::get_url_from_node_id -node_id $parent_node_id]] db_transaction { # Create the class directly using PL/SQL API set community_type_key [db_exec_plsql create_community_type {}] # Create the node - set new_node_id [site_node_create $parent_node_id $community_type_key] + set new_node_id [site_node_create $parent_node_id [ad_decode $url_part "" $community_type_key $url_part]] # Instantiate the package - # Note that the context_id is the dotLRN package - set package_id [site_node_create_package_instance $new_node_id $pretty_name [dotlrn::get_package_id] [one_community_type_package_key]] + set package_id [site_node_create_package_instance $new_node_id $pretty_name $parent_node(object_id) [one_community_type_package_key]] # Set some parameters ad_parameter -package_id $package_id -set 0 dotlrn_level_p Index: openacs-4/packages/dotlrn/tcl/dotlrn-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/dotlrn-init.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/dotlrn/tcl/dotlrn-init.tcl 5 Dec 2001 14:21:16 -0000 1.8 +++ openacs-4/packages/dotlrn/tcl/dotlrn-init.tcl 5 Dec 2001 22:05:23 -0000 1.9 @@ -21,22 +21,10 @@ # if installed if {[dotlrn::is_instantiated]} { - set dotlrn_classes_url "[dotlrn::get_url][dotlrn_class::get_url]/" - if {![dotlrn::is_instantiated_here -url $dotlrn_classes_url]} { - dotlrn::mount_package \ - -package_key [dotlrn::package_key] \ - -url [dotlrn_class::get_url_part] \ - -directory_p "t" - } + if {![dotlrn::is_initialized]} { dotlrn::init } + if {![dotlrn_class::is_initialized]} { dotlrn_class::init } + if {![dotlrn_club::is_initialized]} { dotlrn_club::init } - set dotlrn_clubs_url "[dotlrn::get_url][dotlrn_club::get_url]/" - if {![dotlrn::is_instantiated_here -url $dotlrn_clubs_url]} { - dotlrn::mount_package \ - -package_key [dotlrn::package_key] \ - -url [dotlrn_club::get_url_part] \ - -directory_p "t" - } - # Grantee set grantee_id [dotlrn::get_full_users_rel_segment_id] 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.22 -r1.23 --- openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl 5 Dec 2001 21:00:53 -0000 1.22 +++ openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl 5 Dec 2001 22:05:23 -0000 1.23 @@ -18,6 +18,12 @@ namespace eval dotlrn { + ad_proc -public community_type {} { + returns the base community type + } { + return "dotlrn_community" + } + ad_proc -public class_group_type_key { } { Returns the group type key used for class groups @@ -78,6 +84,24 @@ return $result } + ad_proc -public is_initialized {} { + is dotlrn initialized with the right community_type? + } { + set community_type [community_type] + return [db_string dotlrn_is_initialized { + select count(*) + from dotlrn_community_types + where community_type = :community_type + and package_id is not null + }] + } + + ad_proc -public init {} { + create base community_type for dotlrn + } { + dotlrn_community::set_type_package_id [community_type] [get_package_id] + } + ad_proc -public is_package_mounted { {-package_key:required} } { @@ -112,6 +136,7 @@ mount a package under dotlrn } { set parent_node_id [ad_decode $parent_node_id "" [get_node_id] $parent_node_id] + db_transaction { set node_id [db_string get_next_seq_val { select acs_object_id_seq.nextval from dual @@ -132,8 +157,10 @@ end; }] - return [site_node_create_package_instance $node_id $package_key $parent_package_id $package_key] + set package_id [site_node_create_package_instance $node_id $package_key $parent_package_id $package_key] } + + return $package_id } ad_proc -public get_node_id {} {