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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/tcl/contacts-callback-procs.tcl 16 Jun 2005 08:54:18 -0000 1.1 @@ -0,0 +1,109 @@ +# packages/contacts/tcl/contacts-callback-procs.tcl + +ad_library { + + Callback procs for contacts + + @author Malte Sussdorff (sussdorff@sussdorff.de) + @creation-date 2005-06-15 + @arch-tag: 4267c818-0019-4222-8a50-64edbe7563d1 + @cvs-id $Id: contacts-callback-procs.tcl,v 1.1 2005/06/16 08:54:18 maltes Exp $ +} + + +ad_proc -public -callback contact::contact_form { + {-package_id:required} + {-form:required} + {-object_type:required} +} { +} + +ad_proc -public -callback contact::organization_new { + {-package_id:required} + {-contact_id:required} + {-name:required} +} { +} + +ad_proc -public -callback contact::person_new { + {-package_id:required} + {-contact_id:required} +} { +} + +ad_proc -public -callback pm::project_new -impl contacts { + {-package_id:required} + {-project_id:required} + {-data:required} +} { + map selected organization to new project +} { + array set callback_data $data + set project_rev_id [pm::project::get_project_id \ + -project_item_id $project_id] + + if {[exists_and_not_null callback_data(organization_id)]} { + application_data_link::new -this_object_id $project_rev_id -target_object_id $callback_data(organization_id) + } +} + +ad_proc -public -callback pm::project_edit -impl contacts { + {-package_id:required} + {-project_id:required} + {-data:required} +} { + map selected organization to updated project +} { + array set callback_data $data + set project_rev_id [pm::project::get_project_id \ + -project_item_id $project_id] + + if {[exists_and_not_null callback_data(organization_id)]} { + application_data_link::new -this_object_id $project_rev_id -target_object_id $callback_data(organization_id) + } +} + +ad_proc -public -callback fs::folder_chunk::add_bulk_actions -impl contacts { + {-bulk_variable:required} + {-folder_id:required} + {-var_export_list:required} +} { + Callback to add a bulk action for sending a mail to the contact with the files attached that are mapped in the folder view + If you have an organization, all persons related to it will be added to the mail sending as well. + + @author Malte Sussdorff (sussdorff@sussdorff.de) + @creation-date 2005-06-15 + + @param bulk_variable The name of the variable to upvar for extending the bulk variable list + + @return + + @error +} { + + set contact_organizations [application_data_link::get_linked -from_object_id $folder_id -to_object_type "organization"] + + foreach party_id $contact_organizations { + lappend contact_list $party_id + db_foreach select_employee_ids "select CASE WHEN object_id_one = :party_id THEN object_id_two ELSE object_id_one END as other_party_id + from acs_rels, + acs_rel_types + where acs_rels.rel_type = acs_rel_types.rel_type + and ( object_id_one = :party_id or object_id_two = :party_id ) + and acs_rels.rel_type = 'contact_rels_employment'" { + lappend contact_list $other_party_id + } + } + + if {[exists_and_not_null contact_list]} { + upvar $bulk_variable local_var + upvar $var_export_list local_list + upvar party_ids contact_ids_loc + set contact_ids_loc $contact_list + upvar return_url return_loc + set return_loc "/contacts/$party_id" + lappend local_var "Mail to contact" "/contacts/message" "Mail to contact" + lappend local_list "party_ids" + } +} +