Index: openacs-4/packages/dotlrn/tcl/club-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/club-procs.tcl,v diff -u -r1.25 -r1.26 --- openacs-4/packages/dotlrn/tcl/club-procs.tcl 14 Jun 2005 14:11:35 -0000 1.25 +++ openacs-4/packages/dotlrn/tcl/club-procs.tcl 21 Jun 2005 23:26:32 -0000 1.26 @@ -125,17 +125,31 @@ {-package_id:required} {-form:required} {-object_type:required} + {-party_id} } { If organisation, ask to create new club } { if {$object_type != "person" } { - ad_form -extend -name $form -form { - {create_club_p:text(radio) \ - {label "[_ dotlrn.Create_Club]"} \ - {options {{[_ acs-kernel.common_Yes] "t"} {[_ acs-kernel.common_no] "f"}}} \ - {values "f"} + + set already_linked_p "f" + if {[exists_and_not_null party_id]} { + + # if we are in edit mode we need to make that we are not + # already linked to a community + if {[application_data_link::get_linked -from_object_id $party_id -to_object_type "dotlrn_club"] != ""} { + set already_linked_p "t" } } + + if {$already_linked_p == "f"} { + ad_form -extend -name $form -form { + {create_club_p:text(radio) \ + {label "[_ dotlrn.Create_Club]"} \ + {options {{[_ acs-kernel.common_Yes] "t"} {[_ acs-kernel.common_no] "f"}}} \ + {values "f"} + } + } + } } } @@ -153,7 +167,7 @@ # Create the new club and create a link between it and # the new contact. - set club_id [dotlrn_club::new -pretty_name "$contact_id"] + set club_id [dotlrn_club::new -pretty_name "$name"] application_data_link::new -this_object_id $contact_id -target_object_id $club_id # Link the file storage directly to the contact