Index: openacs-4/packages/mail-tracking/www/one-message.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/mail-tracking/www/one-message.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/mail-tracking/www/one-message.tcl 17 Mar 2006 10:06:46 -0000 1.7
+++ openacs-4/packages/mail-tracking/www/one-message.tcl 14 May 2006 16:11:19 -0000 1.8
@@ -16,6 +16,8 @@
}
}
+# We need to figure out a way to detect which contacts package a party_id belongs to
+set contacts_package_id [apm_package_id_from_key contacts]
set page_title "[_ mail-tracking.One_message]"
set context [list]
@@ -33,25 +35,53 @@
set cc ""
}
-if { [catch { set sender [person::name -person_id $sender_id] } errorMsg] } {
- # We will try to see if it's a contact and has an email. This will break
- # if the contacts package is not installed so this is why we need to put
- # it inside a catch
- if { [catch { set sender [contact::email -party_id $sender_id] } errorMsg] } {
- set sender ""
+if {$contacts_package_id} {
+ set sender "[party::name -party_id $sender_id]"
+} else {
+ set sender [party::name -party_id $sender_id]
+}
+
+set reciever_list [list]
+db_foreach reciever_id {select recipient_id from acs_mail_log_recipient_map where type ='to' and log_id = :log_id and recipient_id is not null} {
+ if {$contacts_package_id} {
+ lappend reciever_list "[party::name -party_id $recipient_id]"
+ } else {
+ lappend reciever_list "[party::name -party_id $recipient_id]"
}
}
+if {![string eq "" $to_addr]} {
+ lappend reciever_list $to_addr
+}
+set recipient [join $reciever_list ","]
-if { [catch { set recipient [person::name -person_id $recipient_id] } errMsg] } {
- # We will try to see if it's a contact and has an email. This will break
- # if the contacts package is not installed so this is why we need to put
- # it inside a catch
- set recipient ""
- if { [catch { set recipient [contact::email -party_id $recipient_id] } errorMsg] } {
- set recipient ""
+# Now the CC users
+set reciever_list [list]
+db_foreach reciever_id {select recipient_id from acs_mail_log_recipient_map where type ='cc' and log_id = :log_id and recipient_id is not null} {
+ if {$contacts_package_id} {
+ lappend reciever_list "[party::name -party_id $recipient_id]"
+ } else {
+ lappend reciever_list "[party::name -party_id $recipient_id]"
}
}
+if {![string eq "" $cc]} {
+ lappend reciever_list $cc
+}
+set cc_string [join $reciever_list ","]
+# And the BCC ones
+set reciever_list [list]
+db_foreach reciever_id {select recipient_id from acs_mail_log_recipient_map where type ='bcc' and log_id = :log_id and recipient_id is not null} {
+ if {$contacts_package_id} {
+ lappend reciever_list "[party::name -party_id $recipient_id]"
+ } else {
+ lappend reciever_list "[party::name -party_id $recipient_id]"
+ }
+}
+if {![string eq "" $bcc]} {
+ lappend reciever_list $bcc
+}
+set bcc_string [join $reciever_list ","]
+
# We get the related files
set files [list]