Index: openacs-4/packages/acs-subsite/www/register/user-join.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/user-join.tcl,v diff -u -r1.8.2.1 -r1.8.2.2 --- openacs-4/packages/acs-subsite/www/register/user-join.tcl 25 Mar 2004 18:19:35 -0000 1.8.2.1 +++ openacs-4/packages/acs-subsite/www/register/user-join.tcl 29 Nov 2005 19:02:59 -0000 1.8.2.2 @@ -54,31 +54,40 @@ template::form create join relation_required_segments_multirow \ - -datasource_name required_segments \ +-datasource_name required_segments \ -group_id $group_id \ -rel_type $rel_type set num_required_segments [multirow size required_segments] - if { [form is_request join] } { for { set rownum 1 } { $rownum <= $num_required_segments } { incr rownum } { set required_seg [multirow get required_segments $rownum] - if { ![group::member_p -group_id $required_segments(group_id)] } { + if { [string equal $required_segments(join_policy) "closed"] } { ad_return_error [_ acs-subsite.Closed_group] "[_ acs-subsite.This_group_is_closed]
$ret_link" ad_script_abort } - + # we need to add a rel_id element for the relation to + # create because add_form_elements only adds elements for + # attributes and id_column is not an attribute + element create join seg_$required_segments(segment_id).rel_id \ + -widget hidden \ + -optional + # add any additional attributes we want to capture when a + # user joins attribute::add_form_elements \ -form_id join \ -variable_prefix seg_$required_segments(segment_id) \ -start_with relationship \ -object_type $required_segments(rel_type) } } -} +} +# don't show the form if all elements are hidden +set not_hidden 0 + attribute::add_form_elements \ -form_id join \ -start_with relationship \ @@ -91,10 +100,15 @@ -datatype text \ -widget hidden } + foreach elm [form get_elements join] { + if {[element get_property join $elm widget] ne "hidden"} { + incr not_hidden + } + } } # Empty form means nothing to ask for, don't have to submit first -if { [form size join] == 0 || [template::form is_valid join] } { +if { $not_hidden == 0 || [template::form is_valid join] } { db_transaction {