Index: openacs-4/contrib/packages/simulation/lib/messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/messages.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/packages/simulation/lib/messages.tcl 5 Jan 2004 11:44:33 -0000 1.5 +++ openacs-4/contrib/packages/simulation/lib/messages.tcl 5 Jan 2004 15:29:50 -0000 1.6 @@ -19,6 +19,9 @@ from { label "From" } + to { + label "To" + } subject { link_url_col message_url @@ -31,50 +34,56 @@ label "Attachments" html { align center } } - sim_name { - label "Simulation" - hide_p {[ad_decode [exists_and_not_null case_id] 1 1 0]} - } case_label { label "Case" hide_p {[ad_decode [exists_and_not_null case_id] 1 1 0]} } + sim_name { + label "Simulation" + hide_p {[ad_decode [exists_and_not_null case_id] 1 1 0]} + } } template::list::create \ -name messages \ -multirow messages \ -no_data "You don't have any messages." \ + -actions [list "Send new message" [export_vars -base message { case_id }] {}] \ -elements $elements -# TODO: make case_name be a combo of simulation name and case # db_multirow -extend { message_url creation_date_pretty } messages select_messages " select distinct sm.message_id, + cr.item_id, sm.title as subject, sc.label as case_label, w.pretty_name as sim_name, to_char(creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_ansi, - (select p.first_names || ' ' || p.last_name - from persons p - where p.person_id = creation_user) as from, + (select fr.pretty_name + from workflow_roles fr + where fr.role_id = sm.from_role_id) as from, + (select tr.pretty_name + from workflow_roles tr + where tr.role_id = sm.to_role_id) as to, (select count(*) from cr_item_rels where item_id = item_id and relation_tag = 'attachment') as attachment_count - from sim_messagesx sm, + from sim_messagesx sm, + cr_revisions cr, workflow_case_role_party_map wcrmp, party_approved_member_map pamm, workflows w, workflow_cases wc, sim_cases sc - where pamm.member_id = :user_id - and wcrmp.party_id = pamm.party_id - and wcrmp.case_id = sm.case_id - and wc.case_id = sm.case_id - and sc.sim_case_id = wc.object_id - and w.workflow_id = wc.workflow_id - [ad_decode [exists_and_not_null case_id] 1 "and sm.case_id = :case_id" ""] + where cr.revision_id = sm.message_id + and pamm.member_id = :user_id + and wcrmp.party_id = pamm.party_id + and wcrmp.case_id = sm.case_id + and wc.case_id = sm.case_id + and sc.sim_case_id = wc.object_id + and w.workflow_id = wc.workflow_id + [ad_decode [exists_and_not_null case_id] 1 "and sm.case_id = :case_id" ""] " { - set message_url [export_vars -base "[apm_package_url_from_id $package_id]simplay/message" { message_id case_id }] + set message_url [export_vars -base "[apm_package_url_from_id $package_id]simplay/message" { item_id case_id }] set creation_date_pretty [lc_time_fmt $creation_date_ansi "%x %X"] }