Index: openacs-4/packages/contacts/lib/tasks-tasks-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/tasks-tasks-portlet.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/contacts/lib/tasks-tasks-portlet.tcl 4 Mar 2006 22:58:41 -0000 1.6 +++ openacs-4/packages/contacts/lib/tasks-tasks-portlet.tcl 26 Apr 2006 06:20:18 -0000 1.7 @@ -6,3 +6,6 @@ set portlet_layout [parameter::get -parameter "DefaultPortletLayout"] set package_id [ad_conn package_id] +if {![exists_and_not_null party_id]} { + set party_id $object_id +} \ No newline at end of file Index: openacs-4/packages/contacts/tcl/contacts-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contacts-callback-procs.tcl,v diff -u -r1.36 -r1.37 --- openacs-4/packages/contacts/tcl/contacts-callback-procs.tcl 10 Apr 2006 20:17:03 -0000 1.36 +++ openacs-4/packages/contacts/tcl/contacts-callback-procs.tcl 26 Apr 2006 06:20:18 -0000 1.37 @@ -109,6 +109,7 @@ {-party_id:required} {-object_id_two:required} {-rel_type:required} + {-package_id:required} } { This is a callback that is executed when you add a new person in a relationship to an organization. This will enable other packages to check if the person is added into a special relationship with the @@ -119,6 +120,7 @@ {-party_id:required} {-object_id_two:required} {-rel_type:required} + {-package_id:required} } { This is a callback that is executed when you add a new organization in a relationship. This will enable other packages to check if the organization is added into a special relationship Index: openacs-4/packages/contacts/tcl/contacts-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contacts-procs.tcl,v diff -u -r1.81 -r1.82 --- openacs-4/packages/contacts/tcl/contacts-procs.tcl 25 Apr 2006 14:05:40 -0000 1.81 +++ openacs-4/packages/contacts/tcl/contacts-procs.tcl 26 Apr 2006 06:20:18 -0000 1.82 @@ -966,7 +966,7 @@ } if { $mapped_p || $all_p} { - lappend group_list [list $group_name $group_id $member_count "1" $mapped_p $default_p] + lappend group_list [list [lang::util::localize $group_name] $group_id $member_count "1" $mapped_p $default_p] if { $component_count > 0 && ( $expand == "all" || $expand == $group_id ) } { db_foreach get_components {} { if { $mapped_p || $all_p} { Index: openacs-4/packages/contacts/www/contact-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact-add.tcl,v diff -u -r1.45 -r1.46 --- openacs-4/packages/contacts/www/contact-add.tcl 2 Apr 2006 22:10:29 -0000 1.45 +++ openacs-4/packages/contacts/www/contact-add.tcl 26 Apr 2006 06:20:18 -0000 1.46 @@ -25,7 +25,7 @@ set group_list [concat [list [list [_ contacts.All_Contacts] $default_group "0"]] [contact::groups]] if {[empty_string_p $group_ids] && [llength $group_list] > 1} { - ad_returnredirect "[export_vars -base "../select-groups" -url {object_type}]" + ad_returnredirect "[export_vars -base "../select-groups" -url {object_type object_id_two role_two rel_type}]" } elseif { ![string eq $group_ids ""] && [lsearch $group_ids $default_group] < 0 } { # an invalid group_ids list has been specified or they do not have permission to add person ad_return_error "[_ contacts.lt_Insufficient_Permissi]" "[_ contacts.lt_You_do_not_have_permi]" @@ -94,13 +94,17 @@ } } -# Creating the form -ad_form -extend -name party_ae -form [ams::ad_form::elements \ - -package_key "contacts" \ - -object_type $object_type \ - -list_names $list_names] +set form_definition [ams::ad_form::elements \ + -package_key "contacts" \ + -object_type $object_type \ + -list_names $list_names] +#ad_return_error "$object_type" "$list_names :: $form_definition" + +# Creating the form +ad_form -extend -name party_ae -form $form_definition + # Append relationship attributes if {[exists_and_not_null role_two]} { @@ -310,7 +314,7 @@ -object_id $rel_id } - callback contact::${object_type}_new_rel -object_id_two $object_id_two -rel_type $rel_type -party_id $party_id + callback contact::${object_type}_new_rel -object_id_two $object_id_two -rel_type $rel_type -party_id $party_id -package_id $package_id contact::flush -party_id $object_id_two } Index: openacs-4/packages/contacts/www/contact-rels.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact-rels.tcl,v diff -u -r1.24 -r1.25 --- openacs-4/packages/contacts/www/contact-rels.tcl 25 Apr 2006 15:55:04 -0000 1.24 +++ openacs-4/packages/contacts/www/contact-rels.tcl 26 Apr 2006 06:20:18 -0000 1.25 @@ -36,7 +36,7 @@ # What groups should the person be added to -set group_ids [contacts::default_group] +set group_ids "" set package_url [ad_conn package_url] Index: openacs-4/packages/contacts/www/select-groups.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/select-groups.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/contacts/www/select-groups.tcl 15 Jul 2005 21:01:52 -0000 1.4 +++ openacs-4/packages/contacts/www/select-groups.tcl 26 Apr 2006 06:20:18 -0000 1.5 @@ -6,6 +6,8 @@ @cvs-id $Id$ } { {object_type} + {object_id_two ""} + {role_two ""} } @@ -16,18 +18,23 @@ set form_elements { object_type:text(hidden) + object_id_two:text(hidden) + role_two:text(hidden) } set default_group [contacts::default_group] set group_options [contact::groups -privilege_required "create"] if { [llength $group_options] == "0" } { # only the default group is available to this user set group_ids $default_group - ad_returnredirect [export_vars -base "add/${object_type}" -url {object_type group_ids}] + ad_returnredirect [export_vars -base "add/${object_type}" -url {object_type group_ids object_id_two role_two}] # ad_return_error "[_ contacts.lt_Insufficient_Permissi]" "[_ contacts.lt_You_do_not_have_permi]" } +# If we have a group named like the role select it by default +set role_group_id [group::get_id -group_name $role_two] +set group_options [lsort -index 0 $group_options] append form_elements { - {group_ids:text(checkbox),multiple,optional {label "[_ contacts.Add_to_Groups]"} {options $group_options}} + {group_ids:text(checkbox),multiple,optional {label "[_ contacts.Add_to_Groups]"} {values $role_group_id} {options $group_options}} } set edit_buttons [list [list "[_ contacts.lt_Add_new_in_Selected_Groups]" create]] @@ -42,7 +49,7 @@ } -after_submit { # the contact needs to be added to the default group lappend group_ids $default_group - ad_returnredirect [export_vars -base "add/${object_type}" -url {object_type group_ids}] + ad_returnredirect [export_vars -base "add/${object_type}" -url {object_type group_ids role_two object_id_two}] ad_script_abort }