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.49 -r1.50 --- openacs-4/packages/dotlrn/tcl/class-procs.tcl 29 Jun 2004 10:17:54 -0000 1.49 +++ openacs-4/packages/dotlrn/tcl/class-procs.tcl 6 Apr 2005 21:21:37 -0000 1.50 @@ -83,6 +83,7 @@ } ad_proc -public check_class_key_valid_p { + {-community_type_key ""} {-class_key:required} {-department_key:required} } { @@ -96,8 +97,10 @@ too. } { + if [empty_string_p $community_type_key] { + set community_type_key "$department_key.$class_key" + } - set community_type_key "$department_key.$class_key" if {[db_0or1row collision_check {}]} { # got a collision @@ -124,17 +127,21 @@ } { if [empty_string_p $class_key] { - set class_key [dotlrn::generate_key -name $pretty_name] - } + set new_class_key $department_key.[dotlrn::generate_key -name $pretty_name] + } else { + set new_class_key $class_key + } # check if the name is already in use, if so, complain loudly if {![check_class_key_valid_p \ - -class_key $class_key \ - -department_key $department_key]} { - ad_return_complaint \ - 1 \ - "[_ dotlrn.The_name] $pretty_name [_ dotlrn.is_already_in_use]. -

[_ dotlrn.lt_Please_select_a_diffe]." + -community_type_key $new_class_key \ + -class_key $class_key \ + -department_key $department_key]} { + return +# ad_return_complaint \ +# 1 \ +# "Duplicate key error. The key $new_class_key already exists. +#

[_ dotlrn.lt_Please_select_a_diffe]." } db_transaction { @@ -184,6 +191,7 @@ ad_proc -public new_instance { {-class_key:required} + {-class_instance_key ""} {-term_id:required} {-pretty_name ""} {-description ""} @@ -205,6 +213,7 @@ } db_transaction { set community_id [dotlrn_community::new \ + -community_key $class_instance_key \ -description $description \ -community_type $class_key \ -object_type [community_type] \