Index: openacs-4/packages/contacts/lib/email.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/email.tcl,v diff -u -N -r1.29 -r1.30 --- openacs-4/packages/contacts/lib/email.tcl 8 Sep 2006 13:49:54 -0000 1.29 +++ openacs-4/packages/contacts/lib/email.tcl 28 Oct 2006 16:53:46 -0000 1.30 @@ -80,6 +80,16 @@ {options $recipients } {html {checked 1}} } + {cc:text(text),optional + {label "[_ contacts.CC]:"} + {html {size 56}} + {help_text "[_ contacts.cc_help]"} + } + {bcc:text(text),optional + {label "[_ acs-mail-lite.BCC]:"} + {html {size 56}} + {help_text "[_ contacts.cc_help]"} + } } } @@ -149,6 +159,12 @@ lappend form_elements $element } +if {![exists_and_not_null mime_type]} { + set mime_type text/plain +} + +set content_list [list $content $mime_type] + append form_elements { {subject:text(text),optional {label "[_ contacts.Subject]"} @@ -159,6 +175,7 @@ {label "[_ contacts.Message]"} {html {cols 55 rows 18}} {help_text "[_ contacts.lt_remember_that_you_can]"} + {value $content_list} } {upload_file:file(file),optional {label "[_ contacts.Upload_file]"} @@ -188,6 +205,10 @@ -form $form_elements \ -on_request { } -new_request { + if {![exists_and_not_null mime_type]} { + set mime_type "text/html" + } + if {[exists_and_not_null folder_id] } { callback contacts::email_subject -folder_id $folder_id } @@ -205,10 +226,9 @@ } } -edit_request { if {![exists_and_not_null mime_type]} { - set mime_type "text/plain" + set mime_type "text/html" } - set content_list [list $content $mime_type] } -on_submit { # We get the attribute_id of the salutation attribute @@ -271,10 +291,14 @@ set name [contact::name -party_id $party_id] set salutation "Dear ladies and gentlemen" set locale [lang::user::site_wide_locale -user_id $party_id] + # the following is a hot fix (nfl 2006/10/20) + set first_names "" + set last_name "" + set mailing_address "" + set directphone "" } set date [lc_time_fmt [dt_sysdate] "%q"] - set to $name set values [list] foreach element [list first_names last_name name date salutation mailing_address directphone] { @@ -315,11 +339,8 @@ -content_format "text/plain" \ -item_id "$item_id" - lappend recipients "$to" - - } else { - lappend recipients "$to" - } + } + lappend recipients "$name" } if {$to eq ""} { @@ -336,7 +357,17 @@ -no_callback_p $no_callback_p \ -single_email } + + # Prepare the user message + foreach cc_addr [concat $cc_list $bcc_list] { + set cc_id [party::get_by_email -email $cc_addr] + if {$cc_id eq ""} { + lappend recipients $cc_addr + } else { + lappend recipients "[contact::name -party_id $cc_id]" + } + } util_user_message -html -message "[_ contacts.Your_message_was_sent_to_-recipients-]" } -after_submit {