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.19 -r1.20 --- openacs-4/packages/contacts/tcl/contacts-callback-procs.tcl 21 Oct 2005 10:54:46 -0000 1.19 +++ openacs-4/packages/contacts/tcl/contacts-callback-procs.tcl 28 Oct 2005 17:55:35 -0000 1.20 @@ -185,16 +185,22 @@ and i.item_id = :project_id } } - + + # A lot of upvar magic is used here to set the variables in the folder-chunk.tcl + # context. 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_var "[_ contacts.Mail_to_contact]" "/contacts/message" "[_ contacts.Mail_to_contact]" lappend local_list "party_ids" + + # Add the message type automatically + # lappend local_list "message_type" + # upvar message_type message_type_loc + # set message_type_loc "email" if {![empty_string_p $project_id]} { lappend local_list "context_id" 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.37 -r1.38 --- openacs-4/packages/contacts/tcl/contacts-procs.tcl 20 Oct 2005 13:21:39 -0000 1.37 +++ openacs-4/packages/contacts/tcl/contacts-procs.tcl 28 Oct 2005 17:55:35 -0000 1.38 @@ -425,38 +425,45 @@ set user_id $person_id set username [contact::email -party_id $person_id] set authority_id [auth::authority::local] - db_transaction { - db_dml upgrade_user {update acs_objects set object_type = 'user' where object_id = :user_id; + + # Make sure that we do not upgrade an already existing user + if {![contact::user_p -party_id $person_id]} { + db_transaction { + db_dml upgrade_user {update acs_objects set object_type = 'user' where object_id = :user_id; + + insert into users + (user_id, authority_id, username, email_verified_p) + values + (:user_id, :authority_id, :username, 't'); + + } + + # Make sure that we we did not store user preferences before + if {![db_string user_prefs_p "select 1 from user_preferences where user_id = :user_id" -default "0"]} { + db_dml update_user_prefs {insert into user_preferences + (user_id) + values + (:user_id); + } + } - insert into users - (user_id, authority_id, username, email_verified_p) - values - (:user_id, :authority_id, :username, 't'); + # we reset the password in admin mode. this means that an email + # will not automatically be sent. + auth::password::reset -authority_id [auth::authority::local] -username $username -admin + group::add_member \ + -group_id "-2" \ + -user_id $person_id \ + -rel_type "membership_rel" - insert into user_preferences - (user_id) - values - (:user_id);} - - # we reset the password in admin mode. this means that an email - # will not automatically be sent. - auth::password::reset -authority_id [auth::authority::local] -username $username -admin - group::add_member \ - -group_id "-2" \ - -user_id $person_id \ - -rel_type "membership_rel" - - # Grant the user to update the password on himself - permission::grant -party_id $user_id -object_id $user_id -privilege write + # Grant the user to update the password on himself + permission::grant -party_id $user_id -object_id $user_id -privilege write - # add him to dotlrn (I'M LAZY) - #dotlrn::user_add -user_id $user_id - - } on_error { - error "There was an error in contact::person_upgrade_to_user: $errmsg" + return 1 + } on_error { + error "There was an error in contact::person_upgrade_to_user: $errmsg" + return 0 + } } - - # I'm too lazy to write } ad_proc -private contact::group::new {