Index: openacs-4/packages/simulation/tcl/message-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/message-procs.tcl,v diff -u -r1.6.2.3 -r1.6.2.4 --- openacs-4/packages/simulation/tcl/message-procs.tcl 2 Nov 2006 10:44:12 -0000 1.6.2.3 +++ openacs-4/packages/simulation/tcl/message-procs.tcl 5 Feb 2007 12:06:50 -0000 1.6.2.4 @@ -169,6 +169,50 @@ return [delete_or_undelete -action "undelete" -message_id $message_id -role_id $role_id -case_id $case_id] } +ad_proc -public simulation::message::list_attachments { + -message_id:required + -role_id:required + -case_id:required +} { + get the attachments of message_id. + + @param message_id the id of the message + @param role_id the id of the role + @param case_id the id of the case + + @return a list of attachments for a given message + +} { + return [db_list_of_ns_sets get_attachments { + select i.item_id, + COALESCE(scrom.title, r.title) as title, + i.live_revision, + i.latest_revision, + i.publish_status, + i.content_type, + i.storage_type, + ir.rel_id, + ir.order_n, + content_item__get_path(i.item_id, ir.item_id) as path, + r.revision_id, + r.description, + r.publish_date, + r.mime_type + from cr_items i, + cr_item_rels ir, + sim_case_role_object_map scrom, + cr_revisions r + where ir.item_id = :message_id + and ir.related_object_id = i.item_id + and ir.relation_tag = 'attachment' + and scrom.case_id = :case_id + and scrom.role_id = :role_id + and scrom.object_id = i.item_id + and i.live_revision = r.revision_id + order by order_n + }] +} + ad_proc -private simulation::message::delete_or_undelete { -message_id:required -role_id:required @@ -192,4 +236,4 @@ } return $message_id -} \ No newline at end of file +} Index: openacs-4/packages/simulation/www/simplay/message.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/message.tcl,v diff -u -r1.30.2.1 -r1.30.2.2 --- openacs-4/packages/simulation/www/simplay/message.tcl 10 Dec 2006 21:05:32 -0000 1.30.2.1 +++ openacs-4/packages/simulation/www/simplay/message.tcl 5 Feb 2007 12:06:50 -0000 1.30.2.2 @@ -138,11 +138,10 @@ } if { !$form_new_p } { - set attachments_set_list [bcms::item::list_related_items \ - -revision live \ - -item_id $item_id \ - -relation_tag attachment \ - -return_list] + set attachments_set_list [simulation::message::list_attachments \ + -message_id $item_id \ + -case_id $case_id \ + -role_id $role_id] } if { ![string equal $form_mode "display"] } { @@ -214,7 +213,7 @@ set attachments "" foreach attachment_set $attachments_set_list { set object_url [simulation::object::content_url -name [ns_set get $attachment_set name]] - set object_title [ns_set get $attachment_set title]. + set object_title [ns_set get $attachment_set title] set mime_type [ns_set get $attachment_set mime_type] append attachments "$object_title ($mime_type)
" }