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.13 -r1.14 --- openacs-4/contrib/packages/simulation/lib/messages.tcl 12 Jan 2004 15:14:36 -0000 1.13 +++ openacs-4/contrib/packages/simulation/lib/messages.tcl 10 Mar 2004 14:17:01 -0000 1.14 @@ -6,13 +6,13 @@ @cvs-id $Id$ } { user_id { - default_value "" + default_value {} } case_id { - required_p 0 + default_value {} } role_id { - required_p 0 + default_value {} } limit { default_value {} @@ -61,7 +61,7 @@ } } -if { [exists_and_not_null case_id] } { +if { [exists_and_not_null case_id] && [exists_and_not_null role_id] } { set actions [list "Send new message" [export_vars -base message { case_id role_id }] {}] } else { set actions [list] @@ -70,7 +70,7 @@ template::list::create \ -name messages \ -multirow messages \ - -no_data "You don't have any messages." \ + -no_data "No messages." \ -actions $actions \ -elements $elements @@ -101,19 +101,19 @@ sim_cases sc where cr.revision_id = sm.message_id and wc.case_id = sm.case_id - [ad_decode $mode "user" "and (sm.to_role_id = :role_id or sm.from_role_id = :role_id)" ""] + [ad_decode $role_id "" "" "and (sm.to_role_id = :role_id or sm.from_role_id = :role_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 $mode "user" "and wc.case_id = :case_id" "and exists (select 1 from workflow_case_role_user_map where case_id = wc.case_id and (sm.to_role_id = role_id or sm.from_role_id = role_id) and user_id = :user_id)"] + [ad_decode $case_id "" "" "and wc.case_id = :case_id"] + [ad_decode $user_id "" "" "and exists (select 1 from workflow_case_role_user_map where case_id = wc.case_id and (sm.to_role_id = role_id or sm.from_role_id = role_id) and user_id = :user_id)"] order by sm.creation_date desc [ad_decode $limit "" "" "limit $limit"] " { - - if { [string equal $mode "admin"] } { - set message_url [export_vars -base "[apm_package_url_from_id $package_id]simplay/message" { item_id { case_id $msg_case_id } { role_id $to_role_id } }] - } else { + if { ![empty_string_p $role_id] } { set message_url [export_vars -base "[apm_package_url_from_id $package_id]simplay/message" { item_id case_id role_id }] + } else { + set message_url [export_vars -base "[apm_package_url_from_id $package_id]simplay/message" { item_id { case_id $msg_case_id } { role_id $to_role_id } }] } set creation_date_pretty [lc_time_fmt $creation_date_ansi "%x %X"] } Index: openacs-4/contrib/packages/simulation/lib/portfolio.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/portfolio.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/contrib/packages/simulation/lib/portfolio.tcl 30 Jan 2004 10:29:16 -0000 1.6 +++ openacs-4/contrib/packages/simulation/lib/portfolio.tcl 10 Mar 2004 14:17:01 -0000 1.7 @@ -41,6 +41,7 @@ cr_items ci, cr_revisions cr where scrom.case_id = :case_id + and scrom.role_id = :role_id and scrom.role_id = wr.role_id and scrom.object_id = ci.item_id and ci.live_revision = cr.revision_id Index: openacs-4/contrib/packages/simulation/www/simplay/case-admin.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/case-admin.adp,v diff -u -r1.10 -r1.11 --- openacs-4/contrib/packages/simulation/www/simplay/case-admin.adp 30 Jan 2004 10:29:16 -0000 1.10 +++ openacs-4/contrib/packages/simulation/www/simplay/case-admin.adp 10 Mar 2004 14:17:07 -0000 1.11 @@ -17,6 +17,27 @@
  • Delete this case
  • +
    +

    Case History

    - +@case_history_filter;noquote@ + +

    Actions

    +

    + +

    + + + +

    Messages

    +

    + +

    + +

    Documents

    +

    + +

    + + \ No newline at end of file Index: openacs-4/contrib/packages/simulation/www/simplay/case-admin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/case-admin.tcl,v diff -u -r1.14 -r1.15 --- openacs-4/contrib/packages/simulation/www/simplay/case-admin.tcl 30 Jan 2004 11:23:25 -0000 1.14 +++ openacs-4/contrib/packages/simulation/www/simplay/case-admin.tcl 10 Mar 2004 14:17:07 -0000 1.15 @@ -4,6 +4,7 @@ } { case_id:integer {assigned_only_p 0} + {actions_only_p 1} } set package_id [ad_conn package_id] @@ -104,10 +105,12 @@ cu.first_names || ' ' || cu.last_name as user_name, (select count(*) from sim_messages - where (to_role_id = wr.role_id or from_role_id = wr.role_id)) as num_messages, + where (to_role_id = wr.role_id or from_role_id = wr.role_id) + and case_id = :case_id) as num_messages, (select count(*) from sim_case_role_object_map - where role_id = wr.role_id) as num_documents, + where role_id = wr.role_id + and case_id = :case_id) as num_documents, sr.users_per_case as max_n_users $select_clause from workflow_roles wr, @@ -159,6 +162,14 @@ # Case activity history #---------------------------------------------------------------------- +if { $actions_only_p } { + set toggle_url [export_vars -base case-admin { case_id assigned_only_p {actions_only_p 0}}] + set case_history_filter "Display \[ Only actions | Actions, messages, and documents \]" +} else { + set toggle_url [export_vars -base case-admin { case_id assigned_only_p {actions_only_p 1}}] + set case_history_filter "Display \[ Only actions | Actions, messages, and documents \]" +} + template::list::create \ -name log \ -elements { @@ -220,3 +231,47 @@ } } +template::list::create \ + -name documents \ + -no_data "No documents uploaded in this simulation case" \ + -elements { + timestamp { + label "Time" + display_eval {[lc_time_fmt $creation_date_ansi "%x %X"]} + } + role_pretty { + label "Role" + } + user_name { + label "User" + link_url_eval {[acs_community_member_url -user_id $creation_user]} + } + document_pretty { + label "Document" + link_url_col document_url + } + } + +db_multirow -extend { document_url } documents select_documents { + select to_char(ao.creation_date, 'YYYY-HH-MM HH24:MI:SS') as creation_date_ansi, + wr.pretty_name as role_pretty, + cu.first_names || ' ' || cu.last_name as user_name, + cr.title as document_pretty, + ci.name as document_name, + ao.creation_user + from sim_case_role_object_map scrom, + workflow_roles wr, + acs_objects ao, + cc_users cu, + cr_items ci, + cr_revisions cr + where scrom.role_id = wr.role_id + and scrom.object_id = ao.object_id + and scrom.case_id = :case_id + and cu.user_id = ao.creation_user + and ci.item_id = ao.object_id + and ci.live_revision = cr.revision_id + order by ao.creation_date +} { + set document_url [simulation::object::content_url -name $document_name] +} Index: openacs-4/packages/simulation/lib/messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/messages.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/simulation/lib/messages.tcl 12 Jan 2004 15:14:36 -0000 1.13 +++ openacs-4/packages/simulation/lib/messages.tcl 10 Mar 2004 14:17:01 -0000 1.14 @@ -6,13 +6,13 @@ @cvs-id $Id$ } { user_id { - default_value "" + default_value {} } case_id { - required_p 0 + default_value {} } role_id { - required_p 0 + default_value {} } limit { default_value {} @@ -61,7 +61,7 @@ } } -if { [exists_and_not_null case_id] } { +if { [exists_and_not_null case_id] && [exists_and_not_null role_id] } { set actions [list "Send new message" [export_vars -base message { case_id role_id }] {}] } else { set actions [list] @@ -70,7 +70,7 @@ template::list::create \ -name messages \ -multirow messages \ - -no_data "You don't have any messages." \ + -no_data "No messages." \ -actions $actions \ -elements $elements @@ -101,19 +101,19 @@ sim_cases sc where cr.revision_id = sm.message_id and wc.case_id = sm.case_id - [ad_decode $mode "user" "and (sm.to_role_id = :role_id or sm.from_role_id = :role_id)" ""] + [ad_decode $role_id "" "" "and (sm.to_role_id = :role_id or sm.from_role_id = :role_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 $mode "user" "and wc.case_id = :case_id" "and exists (select 1 from workflow_case_role_user_map where case_id = wc.case_id and (sm.to_role_id = role_id or sm.from_role_id = role_id) and user_id = :user_id)"] + [ad_decode $case_id "" "" "and wc.case_id = :case_id"] + [ad_decode $user_id "" "" "and exists (select 1 from workflow_case_role_user_map where case_id = wc.case_id and (sm.to_role_id = role_id or sm.from_role_id = role_id) and user_id = :user_id)"] order by sm.creation_date desc [ad_decode $limit "" "" "limit $limit"] " { - - if { [string equal $mode "admin"] } { - set message_url [export_vars -base "[apm_package_url_from_id $package_id]simplay/message" { item_id { case_id $msg_case_id } { role_id $to_role_id } }] - } else { + if { ![empty_string_p $role_id] } { set message_url [export_vars -base "[apm_package_url_from_id $package_id]simplay/message" { item_id case_id role_id }] + } else { + set message_url [export_vars -base "[apm_package_url_from_id $package_id]simplay/message" { item_id { case_id $msg_case_id } { role_id $to_role_id } }] } set creation_date_pretty [lc_time_fmt $creation_date_ansi "%x %X"] } Index: openacs-4/packages/simulation/lib/portfolio.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/portfolio.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/simulation/lib/portfolio.tcl 30 Jan 2004 10:29:16 -0000 1.6 +++ openacs-4/packages/simulation/lib/portfolio.tcl 10 Mar 2004 14:17:01 -0000 1.7 @@ -41,6 +41,7 @@ cr_items ci, cr_revisions cr where scrom.case_id = :case_id + and scrom.role_id = :role_id and scrom.role_id = wr.role_id and scrom.object_id = ci.item_id and ci.live_revision = cr.revision_id Index: openacs-4/packages/simulation/www/simplay/case-admin.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case-admin.adp,v diff -u -r1.10 -r1.11 --- openacs-4/packages/simulation/www/simplay/case-admin.adp 30 Jan 2004 10:29:16 -0000 1.10 +++ openacs-4/packages/simulation/www/simplay/case-admin.adp 10 Mar 2004 14:17:07 -0000 1.11 @@ -17,6 +17,27 @@
  • Delete this case
  • +
    +

    Case History

    - +@case_history_filter;noquote@ + +

    Actions

    +

    + +

    + + + +

    Messages

    +

    + +

    + +

    Documents

    +

    + +

    + + \ No newline at end of file Index: openacs-4/packages/simulation/www/simplay/case-admin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case-admin.tcl,v diff -u -r1.14 -r1.15 --- openacs-4/packages/simulation/www/simplay/case-admin.tcl 30 Jan 2004 11:23:25 -0000 1.14 +++ openacs-4/packages/simulation/www/simplay/case-admin.tcl 10 Mar 2004 14:17:07 -0000 1.15 @@ -4,6 +4,7 @@ } { case_id:integer {assigned_only_p 0} + {actions_only_p 1} } set package_id [ad_conn package_id] @@ -104,10 +105,12 @@ cu.first_names || ' ' || cu.last_name as user_name, (select count(*) from sim_messages - where (to_role_id = wr.role_id or from_role_id = wr.role_id)) as num_messages, + where (to_role_id = wr.role_id or from_role_id = wr.role_id) + and case_id = :case_id) as num_messages, (select count(*) from sim_case_role_object_map - where role_id = wr.role_id) as num_documents, + where role_id = wr.role_id + and case_id = :case_id) as num_documents, sr.users_per_case as max_n_users $select_clause from workflow_roles wr, @@ -159,6 +162,14 @@ # Case activity history #---------------------------------------------------------------------- +if { $actions_only_p } { + set toggle_url [export_vars -base case-admin { case_id assigned_only_p {actions_only_p 0}}] + set case_history_filter "Display \[ Only actions | Actions, messages, and documents \]" +} else { + set toggle_url [export_vars -base case-admin { case_id assigned_only_p {actions_only_p 1}}] + set case_history_filter "Display \[ Only actions | Actions, messages, and documents \]" +} + template::list::create \ -name log \ -elements { @@ -220,3 +231,47 @@ } } +template::list::create \ + -name documents \ + -no_data "No documents uploaded in this simulation case" \ + -elements { + timestamp { + label "Time" + display_eval {[lc_time_fmt $creation_date_ansi "%x %X"]} + } + role_pretty { + label "Role" + } + user_name { + label "User" + link_url_eval {[acs_community_member_url -user_id $creation_user]} + } + document_pretty { + label "Document" + link_url_col document_url + } + } + +db_multirow -extend { document_url } documents select_documents { + select to_char(ao.creation_date, 'YYYY-HH-MM HH24:MI:SS') as creation_date_ansi, + wr.pretty_name as role_pretty, + cu.first_names || ' ' || cu.last_name as user_name, + cr.title as document_pretty, + ci.name as document_name, + ao.creation_user + from sim_case_role_object_map scrom, + workflow_roles wr, + acs_objects ao, + cc_users cu, + cr_items ci, + cr_revisions cr + where scrom.role_id = wr.role_id + and scrom.object_id = ao.object_id + and scrom.case_id = :case_id + and cu.user_id = ao.creation_user + and ci.item_id = ao.object_id + and ci.live_revision = cr.revision_id + order by ao.creation_date +} { + set document_url [simulation::object::content_url -name $document_name] +}