| |
13 |
13 |
if { ![db_0or1row message_exists_p { }] } { |
| |
14 |
14 |
ad_complain "<b>[_ mail-tracking.The_specified_message_does_not_exist]</b>" |
| |
15 |
15 |
} |
| |
16 |
16 |
} |
| |
17 |
17 |
} |
| |
18 |
18 |
|
| |
19 |
19 |
|
| |
20 |
20 |
set page_title "[_ mail-tracking.One_message]" |
| |
21 |
21 |
set context [list] |
| |
22 |
22 |
set sender "" |
| |
23 |
23 |
set receiver "" |
| |
24 |
24 |
|
| |
25 |
25 |
if { [empty_string_p $return_url] } { |
| |
26 |
26 |
set return_url [get_referrer] |
| |
27 |
27 |
} |
| |
28 |
28 |
|
| |
29 |
29 |
# Get the information of the message |
| |
30 |
30 |
db_1row get_message_info { } |
| |
31 |
31 |
|
| |
32 |
32 |
if { [catch { set sender [person::name -person_id $sender_id] } errorMsg] } { |
| |
|
33 |
# We will try to see if it's a contact and has an email. This will break |
| |
|
34 |
# if the contacts package is not installed so this is why we need to put |
| |
|
35 |
# it inside a catch |
| |
|
36 |
if { [catch { set sender [contact::email -party_id $sender_id] } errorMsg] } { |
| |
33 |
37 |
set sender "" |
| |
34 |
38 |
} |
| |
|
39 |
} |
| |
35 |
40 |
|
| |
36 |
41 |
if { [catch { set recipient [person::name -person_id $recipient_id] } errMsg] } { |
| |
|
42 |
# We will try to see if it's a contact and has an email. This will break |
| |
|
43 |
# if the contacts package is not installed so this is why we need to put |
| |
|
44 |
# it inside a catch |
| |
37 |
45 |
set recipient "" |
| |
|
46 |
if { [catch { set recipient [contact::email -party_id $recipient_id] } errorMsg] } { |
| |
|
47 |
set recipient "" |
| |
38 |
48 |
} |
| |
|
49 |
} |
| |
39 |
50 |
|
| |
40 |
51 |
# We get the related files |
| |
41 |
52 |
set files [list] |
| |
42 |
53 |
set file_revisions [application_data_link::get_linked -from_object_id $log_id -to_object_type "content_revision"] |
| |
43 |
54 |
|
| |
44 |
55 |
foreach file $file_revisions { |
| |
45 |
56 |
lappend files [item::get_item_from_revision $file] |
| |
46 |
57 |
} |
| |
47 |
58 |
|
| |
48 |
59 |
foreach file_id [application_data_link::get_linked -from_object_id $log_id -to_object_type "content_item"] { |
| |
49 |
60 |
lappend files $file_id |
| |
50 |
61 |
} |
| |
51 |
62 |
|
| |
52 |
63 |
set download_files "" |
| |
53 |
64 |
|
| |
54 |
65 |
foreach file $files { |
| |
55 |
66 |
set title [content::item::get_title -item_id $file] |
| |
56 |
67 |
# Creating the link to dowload the files |
| |
57 |
68 |
append download_files "<a href=\"[export_vars -base "download/$title" -url {{file_id $file}}]\">$title</a><br>" |
| |
58 |
69 |
} |