Index: openacs-4/packages/contacts/lib/contacts.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/contacts/lib/contacts.tcl 17 Jun 2005 00:26:21 -0000 1.11 +++ openacs-4/packages/contacts/lib/contacts.tcl 20 Jun 2005 16:48:35 -0000 1.12 @@ -84,9 +84,11 @@ if { [permission::permission_p -object_id $package_id -privilege "admin"] } { lappend bulk_actions "[_ contacts.Bulk_Update]" "${base_url}bulk-update" "[_ contacts.lt_Bulk_update_the_seclected_C]" } -if { [permission::permission_p -object_id $package_id -privilege "delete"] } { - lappend bulk_actions "[_ contacts.Delete]" "${base_url}delete" "[_ contacts.lt_Delete_the_selected_C]" -} + +# Delete file is not there, taking out the code to display the delete button +# if { [permission::permission_p -object_id $package_id -privilege "delete"] } { +# lappend bulk_actions "[_ contacts.Delete]" "${base_url}delete" "[_ contacts.lt_Delete_the_selected_C]" +# } template::list::create \ -html {width 100%} \ -name "contacts" \ Index: openacs-4/packages/contacts/sql/postgresql/contacts-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/sql/postgresql/contacts-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/contacts/sql/postgresql/contacts-create.sql 4 Jun 2005 12:36:45 -0000 1.4 +++ openacs-4/packages/contacts/sql/postgresql/contacts-create.sql 20 Jun 2005 16:48:36 -0000 1.5 @@ -95,6 +95,16 @@ unique(party_id,title,signature) ); +create table contact_mailings ( + mailing_id integer + constraint contact_mailings_id_pk primary key, + title varchar(255) + constraint contact_mailings_title_nn not null, + mailing varchar(1000) + constraint contact_mailings_mailing_nn not null + unique(party_id,title,mailing) +); + -- this view greatly simplifies getting available roles for various contact types create view contact_rel_types as ( select rel_type, 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.2 -r1.3 --- openacs-4/packages/contacts/tcl/contacts-callback-procs.tcl 16 Jun 2005 23:03:34 -0000 1.2 +++ openacs-4/packages/contacts/tcl/contacts-callback-procs.tcl 20 Jun 2005 16:48:36 -0000 1.3 @@ -37,6 +37,11 @@ } { } +ad_proc -public -callback contact::after_instantiate { + {-package_id:required} +} { +} + ad_proc -public -callback pm::project_new -impl contacts { {-package_id:required} {-project_id:required} 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.17 -r1.18 --- openacs-4/packages/contacts/www/contact-add.tcl 17 Jun 2005 09:15:30 -0000 1.17 +++ openacs-4/packages/contacts/www/contact-add.tcl 20 Jun 2005 16:48:36 -0000 1.18 @@ -8,6 +8,8 @@ } { {object_type "person"} {group_ids ""} + {rel_type ""} + {object_id_two ""} } -validate { valid_type -requires {object_type} { if { [lsearch [list organization person] $object_type] < 0 } { @@ -35,6 +37,9 @@ set form_elements {party_id:key} lappend form_elements {object_type:text(hidden)} +lappend form_elements {rel_type:text(hidden)} +lappend form_elements {object_id_two:text(hidden)} + set default_group_id [contacts::default_group -package_id $package_id] set application_group_id [application_group::group_id_from_package_id -package_id [ad_conn subsite_id]] @@ -51,6 +56,7 @@ set group_list [contact::groups -expand "all" -privilege_required "read"] + ad_form -name party_ae \ -mode "edit" \ -cancel_label "[_ contacts.Cancel]" \ @@ -79,6 +85,12 @@ } } +# Append relationship attributes + +if {[exists_and_not_null rel_type]} { + ad_form -extend -name party_ae -form [ams::ad_form::elements -package_key "contacts" -object_type $rel_type -list_name [ad_conn package_id]] +} + # Append the option to create a user who get's a welcome message send # Furthermore set the title. @@ -98,7 +110,6 @@ set context [list $title] - callback contact::contact_form -package_id $package_id -form party_ae -object_type $object_type ad_form -extend -name party_ae \ @@ -263,8 +274,33 @@ callback contact::${object_type}_${group_array(group_name)}_new -package_id $package_id -contact_id $party_id } } + + # Insert the relationship + if {[exists_and_not_null rel_type] && [exists_and_not_null object_id_two]} { + set rel_id {} + set context_id {} + set creation_user [ad_conn user_id] + set creation_ip [ad_conn peeraddr] + set rel_id [db_exec_plsql create_rel "select acs_rel__new ( + :rel_id, + :rel_type, + :party_id, + :object_id_two, + :context_id, + :creation_user, + :creation_ip + )"] - # Add the user to the + if {[exists_and_not_null rel_type]} { + ams::ad_form::save -package_key "contacts" \ + -object_type $rel_type \ + -list_name [ad_conn package_id] \ + -form_name "party_ae" \ + -object_id $rel_id + } + } + + # Add the user to the util_user_message -html -message "The $object_type [contact::name -party_id $party_id] was added" } -after_submit { Index: openacs-4/packages/contacts/www/contact.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact.adp,v diff -u -r1.15 -r1.16 --- openacs-4/packages/contacts/www/contact.adp 17 Jun 2005 11:30:30 -0000 1.15 +++ openacs-4/packages/contacts/www/contact.adp 20 Jun 2005 16:48:36 -0000 1.16 @@ -36,6 +36,13 @@ +
+
+ + Add new employee + + +