Index: openacs-4/packages/contacts/lib/groups.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/groups.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/contacts/lib/groups.adp 27 May 2005 09:02:14 -0000 1.3 +++ openacs-4/packages/contacts/lib/groups.adp 27 May 2005 09:35:43 -0000 1.4 @@ -1,19 +1,6 @@ - -
- - - - - -
- -
+ +

You cannot add this contact to more groups.

Index: openacs-4/packages/contacts/lib/groups.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/groups.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/contacts/lib/groups.tcl 25 May 2005 02:14:09 -0000 1.3 +++ openacs-4/packages/contacts/lib/groups.tcl 27 May 2005 09:35:43 -0000 1.4 @@ -14,15 +14,36 @@ set groups_belonging_to [db_list get_party_groups { select group_id from group_distinct_member_map where member_id = :party_id }] -multirow create addable_groups group_id group top_level -set active_top_level "" -foreach group [contact::groups -expand "all" -privilege_required "create"] { - if { [lindex $group 2] == "1" } { set active_top_level [lindex $group 0] } - if { [lsearch $groups_belonging_to [lindex $group 1]] < 0 } { - multirow append addable_groups [lindex $group 1] [lindex $group 0] $active_top_level + +if { [string is false $hide_form_p] } { + set group_options [list] + set active_top_level "" + foreach group [contact::groups -expand "all" -privilege_required "create"] { + if { [lindex $group 2] == "1" } { set active_top_level [lindex $group 0] } + if { [lsearch $groups_belonging_to [lindex $group 1]] < 0 } { + lappend group_options [list [lindex $group 0] [lindex $group 1]] + } } + if { [llength $group_options] > 0 } { + set group_options [concat [list [list "- [_ ams.select_one] -" ""]] $group_options] + set package_url [ad_conn package_url] + ad_form -name add_to_group -action "${package_url}group-party-add" \ + -form { + party_id:integer(hidden) + return_url:text(hidden),optional + {group_id:integer(select) {label {}} {options $group_options}} + {save:text(submit),optional {label {Add to Group}}} + } -on_request { + } -after_submit { + } + + } else { + set no_more_available_p 1 + } } + + multirow create groups group_id group sub_p set sub_p "0" foreach group [contact::groups -expand "all" -privilege_required "read"] { Index: openacs-4/packages/contacts/www/contact-groups.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact-groups.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/contacts/www/contact-groups.tcl 18 May 2005 16:45:50 -0000 1.1 +++ openacs-4/packages/contacts/www/contact-groups.tcl 27 May 2005 09:35:43 -0000 1.2 @@ -36,41 +36,3 @@ ad_return_error "Insufficient Permissions" "You do not have permission to add users to groups" } -set form_elements { -} -set edit_buttons [list [list "Add to Selected Group" create]] - - - - -ad_form -action group-parties-add \ - -name add_to_group \ - -edit_buttons $edit_buttons \ - -form { - party_id:integer(hidden) - return_url:text(hidden) - {group_ids:text(select) {label ""} {options $groups_to_add}} - } -on_request { - } -on_submit { - db_transaction { - foreach group_id $group_ids { - foreach party_id $party_ids { - # relation_add verifies that they aren't already in the group - switch [contact::type -party_id $party_id] { - person { - set rel_type "membership_rel" - } - organization { - set rel_type "organization_rel" - } - } - relation_add -member_state "approved" $rel_type $group_id $party_id - } - } - } - } -after_submit { - ad_returnredirect $return_url - ad_script_abort - } - - Index: openacs-4/packages/contacts/www/contact.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/contacts/www/contact.tcl 27 May 2005 09:06:01 -0000 1.4 +++ openacs-4/packages/contacts/www/contact.tcl 27 May 2005 09:35:43 -0000 1.5 @@ -22,7 +22,7 @@ if { $object_type == "person" } { set hidden_attributes [list first_names last_name] } elseif { $object_type == "organization" } { - set hide_attributes [list name] + set hidden_attributes [list name] }