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.5 -r1.6 --- openacs-4/contrib/packages/simulation/lib/portfolio.tcl 12 Jan 2004 15:14:36 -0000 1.5 +++ openacs-4/contrib/packages/simulation/lib/portfolio.tcl 30 Jan 2004 10:29:16 -0000 1.6 @@ -9,6 +9,8 @@ role_id {} } +simulation::case::assert_user_may_play_role -case_id $case_id -role_id $role_id + set upload_url [export_vars -base document-upload { case_id role_id }] if { [exists_and_not_null case_id] } { Index: openacs-4/contrib/packages/simulation/tcl/ui-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/ui-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/tcl/ui-procs.tcl 21 Jan 2004 11:17:34 -0000 1.1 +++ openacs-4/contrib/packages/simulation/tcl/ui-procs.tcl 30 Jan 2004 10:29:16 -0000 1.2 @@ -45,38 +45,38 @@ } { db_transaction { - set parent_id [bcms::folder::get_id_by_package_id -parent_id 0] + set parent_id [bcms::folder::get_id_by_package_id -parent_id 0] - set existing_items [db_list select_items { select name from cr_items where parent_id = :parent_id }] - set name [util_text_to_url -existing_urls $existing_items -text $title] + set existing_items [db_list select_items { select name from cr_items where parent_id = :parent_id }] + set name [util_text_to_url -existing_urls $existing_items -text $title] - set content_type sim_prop - set storage_type file + set content_type sim_prop + set storage_type file - set item_id [bcms::item::create_item \ + set item_id [bcms::item::create_item \ + -item_id $item_id \ + -item_name $name \ + -parent_id $parent_id \ + -content_type $content_type \ + -storage_type $storage_type] + + set revision_id [bcms::revision::upload_file_revision \ -item_id $item_id \ - -item_name $name \ - -parent_id $parent_id \ + -title $title \ -content_type $content_type \ - -storage_type $storage_type] - - set revision_id [bcms::revision::upload_file_revision \ - -item_id $item_id \ - -title $title \ - -content_type $content_type \ - -upload_file $document_file \ - -description $description] + -upload_file $document_file \ + -description $description] - bcms::revision::set_revision_status \ - -revision_id $revision_id \ - -status "live" + bcms::revision::set_revision_status \ + -revision_id $revision_id \ + -status "live" - set relation_tag "portfolio" - db_dml add_document_to_portfolio { - insert into sim_case_role_object_map - (case_id, object_id, role_id, relation_tag) - values - (:case_id, :item_id, :role_id, :relation_tag) - } + set relation_tag "portfolio" + db_dml add_document_to_portfolio { + insert into sim_case_role_object_map + (case_id, object_id, role_id, relation_tag) + values + (:case_id, :item_id, :role_id, :relation_tag) + } } } Index: openacs-4/contrib/packages/simulation/www/simplay/case-admin-messages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/case-admin-messages.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simplay/case-admin-messages.adp 30 Jan 2004 10:29:16 -0000 1.1 @@ -0,0 +1,5 @@ + + @title;noquote@ + @context;noquote@ + + Index: openacs-4/contrib/packages/simulation/www/simplay/case-admin-messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/case-admin-messages.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simplay/case-admin-messages.tcl 30 Jan 2004 10:29:16 -0000 1.1 @@ -0,0 +1,16 @@ +ad_page_contract { + List of messages for a case +} { + case_id:integer + role_id:integer +} + +set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] +set simulation_name [simulation::template::get_element -workflow_id $workflow_id -element pretty_name] +workflow::role::get -role_id $role_id -array role_array +simulation::case::get -case_id $case_id -array case_array + +set title "Messages for $role_array(pretty_name) in $case_array(label)" +set context [list [list . "SimPlay"] [list [export_vars -base case-admin { case_id }] "Administer $case_array(label)"] "Messages for $role_array(pretty_name)"] + +set user_id [ad_conn user_id] Index: openacs-4/contrib/packages/simulation/www/simplay/case-admin-portfolio.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/case-admin-portfolio.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simplay/case-admin-portfolio.adp 30 Jan 2004 10:29:16 -0000 1.1 @@ -0,0 +1,6 @@ + + @title;noquote@ + @context;noquote@ + + + Index: openacs-4/contrib/packages/simulation/www/simplay/case-admin-portfolio.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/case-admin-portfolio.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simplay/case-admin-portfolio.tcl 30 Jan 2004 10:29:16 -0000 1.1 @@ -0,0 +1,18 @@ +ad_page_contract { + List of sim_props for the role/case. +} { + case_id:integer + role_id:integer +} + +set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] +set simulation_name [simulation::template::get_element -workflow_id $workflow_id -element pretty_name] +workflow::role::get -role_id $role_id -array role_array +simulation::case::get -case_id $case_id -array case_array + +set title "Portfolio for $role_array(pretty_name) in $case_array(label)" +set context [list [list . "SimPlay"] [list [export_vars -base case-admin { case_id }] "Administer $case_array(label)"] "Portfolio for $role_array(pretty_name)"] + +set user_id [ad_conn user_id] +set package_id [ad_conn package_id] +set section_uri [apm_package_url_from_id $package_id]simplay/ 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.9 -r1.10 --- openacs-4/contrib/packages/simulation/www/simplay/case-admin.adp 30 Jan 2004 09:47:42 -0000 1.9 +++ openacs-4/contrib/packages/simulation/www/simplay/case-admin.adp 30 Jan 2004 10:29:16 -0000 1.10 @@ -19,4 +19,4 @@

Case History

-@activity_html;noquote@ + 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.11 -r1.12 --- openacs-4/contrib/packages/simulation/www/simplay/case-admin.tcl 30 Jan 2004 09:54:50 -0000 1.11 +++ openacs-4/contrib/packages/simulation/www/simplay/case-admin.tcl 30 Jan 2004 10:29:16 -0000 1.12 @@ -38,16 +38,32 @@ } max_n_users { label "Target # users" + html { align center } } assigned_action { label "Assigned action" hide_p {[expr !$assigned_only_p]} } + portfolio { + label "Portfolio" + display_template { + @roles.num_documents@ documents + } + link_url_eval {[export_vars -base case-admin-portfolio { case_id role_id }]} + html { align center } + } + messages { + label "Messages" + display_template { + @roles.num_messages@ messages + } + link_url_eval {[export_vars -base case-admin-messages { case_id role_id }]} + html { align center } + } } template::list::create \ -name roles \ - -multirow roles \ -no_data "There are no roles or users in this simulation case" \ -elements $elements \ -pass_properties { case_id } \ @@ -86,6 +102,12 @@ wr.pretty_name as role, cu.user_id, 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, + (select count(*) + from sim_case_role_object_map + where role_id = wr.role_id) as num_documents, sr.users_per_case as max_n_users $select_clause from workflow_roles wr, @@ -133,5 +155,52 @@ set case_delete_url [export_vars -base case-delete { case_id { return_url [ad_return_url] } }] +#---------------------------------------------------------------------- +# Case activity history +#---------------------------------------------------------------------- -set activity_html [workflow::case::get_activity_html -case_id $case_id] +template::list::create \ + -name log \ + -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]} + } + action_pretty { + label "Action" + } + } + +db_multirow -extend { message } log select_log { + select l.entry_id, + l.case_id, + l.action_id, + a.short_name as action_short_name, + a.pretty_name as action_pretty, + a.pretty_past_tense as action_pretty_past_tense, + role.pretty_name as role_pretty, + io.creation_user, + iou.first_names || ' ' || iou.last_name as user_name, + to_char(io.creation_date, 'YYYY-HH-MM HH24:MI:SS') as creation_date_ansi + from workflow_case_log l join + workflow_actions a using (action_id) join + cr_items i on (i.item_id = l.entry_id) join + acs_objects io on (io.object_id = i.item_id) join + cc_users iou on (iou.user_id = io.creation_user) join + cr_revisions r on (r.revision_id = i.live_revision), + workflow_roles role + where l.case_id = :case_id + and role.role_id = a.assigned_role + and a.trigger_type = 'user' + order by io.creation_date +} { + +} + Index: openacs-4/packages/simulation/lib/portfolio.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/portfolio.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/simulation/lib/portfolio.tcl 12 Jan 2004 15:14:36 -0000 1.5 +++ openacs-4/packages/simulation/lib/portfolio.tcl 30 Jan 2004 10:29:16 -0000 1.6 @@ -9,6 +9,8 @@ role_id {} } +simulation::case::assert_user_may_play_role -case_id $case_id -role_id $role_id + set upload_url [export_vars -base document-upload { case_id role_id }] if { [exists_and_not_null case_id] } { Index: openacs-4/packages/simulation/tcl/ui-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/ui-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/tcl/ui-procs.tcl 21 Jan 2004 11:17:34 -0000 1.1 +++ openacs-4/packages/simulation/tcl/ui-procs.tcl 30 Jan 2004 10:29:16 -0000 1.2 @@ -45,38 +45,38 @@ } { db_transaction { - set parent_id [bcms::folder::get_id_by_package_id -parent_id 0] + set parent_id [bcms::folder::get_id_by_package_id -parent_id 0] - set existing_items [db_list select_items { select name from cr_items where parent_id = :parent_id }] - set name [util_text_to_url -existing_urls $existing_items -text $title] + set existing_items [db_list select_items { select name from cr_items where parent_id = :parent_id }] + set name [util_text_to_url -existing_urls $existing_items -text $title] - set content_type sim_prop - set storage_type file + set content_type sim_prop + set storage_type file - set item_id [bcms::item::create_item \ + set item_id [bcms::item::create_item \ + -item_id $item_id \ + -item_name $name \ + -parent_id $parent_id \ + -content_type $content_type \ + -storage_type $storage_type] + + set revision_id [bcms::revision::upload_file_revision \ -item_id $item_id \ - -item_name $name \ - -parent_id $parent_id \ + -title $title \ -content_type $content_type \ - -storage_type $storage_type] - - set revision_id [bcms::revision::upload_file_revision \ - -item_id $item_id \ - -title $title \ - -content_type $content_type \ - -upload_file $document_file \ - -description $description] + -upload_file $document_file \ + -description $description] - bcms::revision::set_revision_status \ - -revision_id $revision_id \ - -status "live" + bcms::revision::set_revision_status \ + -revision_id $revision_id \ + -status "live" - set relation_tag "portfolio" - db_dml add_document_to_portfolio { - insert into sim_case_role_object_map - (case_id, object_id, role_id, relation_tag) - values - (:case_id, :item_id, :role_id, :relation_tag) - } + set relation_tag "portfolio" + db_dml add_document_to_portfolio { + insert into sim_case_role_object_map + (case_id, object_id, role_id, relation_tag) + values + (:case_id, :item_id, :role_id, :relation_tag) + } } } Index: openacs-4/packages/simulation/www/simplay/case-admin-messages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case-admin-messages.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simplay/case-admin-messages.adp 30 Jan 2004 10:29:16 -0000 1.1 @@ -0,0 +1,5 @@ + + @title;noquote@ + @context;noquote@ + + Index: openacs-4/packages/simulation/www/simplay/case-admin-messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case-admin-messages.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simplay/case-admin-messages.tcl 30 Jan 2004 10:29:16 -0000 1.1 @@ -0,0 +1,16 @@ +ad_page_contract { + List of messages for a case +} { + case_id:integer + role_id:integer +} + +set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] +set simulation_name [simulation::template::get_element -workflow_id $workflow_id -element pretty_name] +workflow::role::get -role_id $role_id -array role_array +simulation::case::get -case_id $case_id -array case_array + +set title "Messages for $role_array(pretty_name) in $case_array(label)" +set context [list [list . "SimPlay"] [list [export_vars -base case-admin { case_id }] "Administer $case_array(label)"] "Messages for $role_array(pretty_name)"] + +set user_id [ad_conn user_id] Index: openacs-4/packages/simulation/www/simplay/case-admin-portfolio.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case-admin-portfolio.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simplay/case-admin-portfolio.adp 30 Jan 2004 10:29:16 -0000 1.1 @@ -0,0 +1,6 @@ + + @title;noquote@ + @context;noquote@ + + + Index: openacs-4/packages/simulation/www/simplay/case-admin-portfolio.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case-admin-portfolio.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simplay/case-admin-portfolio.tcl 30 Jan 2004 10:29:16 -0000 1.1 @@ -0,0 +1,18 @@ +ad_page_contract { + List of sim_props for the role/case. +} { + case_id:integer + role_id:integer +} + +set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] +set simulation_name [simulation::template::get_element -workflow_id $workflow_id -element pretty_name] +workflow::role::get -role_id $role_id -array role_array +simulation::case::get -case_id $case_id -array case_array + +set title "Portfolio for $role_array(pretty_name) in $case_array(label)" +set context [list [list . "SimPlay"] [list [export_vars -base case-admin { case_id }] "Administer $case_array(label)"] "Portfolio for $role_array(pretty_name)"] + +set user_id [ad_conn user_id] +set package_id [ad_conn package_id] +set section_uri [apm_package_url_from_id $package_id]simplay/ 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.9 -r1.10 --- openacs-4/packages/simulation/www/simplay/case-admin.adp 30 Jan 2004 09:47:42 -0000 1.9 +++ openacs-4/packages/simulation/www/simplay/case-admin.adp 30 Jan 2004 10:29:16 -0000 1.10 @@ -19,4 +19,4 @@

Case History

-@activity_html;noquote@ + 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.11 -r1.12 --- openacs-4/packages/simulation/www/simplay/case-admin.tcl 30 Jan 2004 09:54:50 -0000 1.11 +++ openacs-4/packages/simulation/www/simplay/case-admin.tcl 30 Jan 2004 10:29:16 -0000 1.12 @@ -38,16 +38,32 @@ } max_n_users { label "Target # users" + html { align center } } assigned_action { label "Assigned action" hide_p {[expr !$assigned_only_p]} } + portfolio { + label "Portfolio" + display_template { + @roles.num_documents@ documents + } + link_url_eval {[export_vars -base case-admin-portfolio { case_id role_id }]} + html { align center } + } + messages { + label "Messages" + display_template { + @roles.num_messages@ messages + } + link_url_eval {[export_vars -base case-admin-messages { case_id role_id }]} + html { align center } + } } template::list::create \ -name roles \ - -multirow roles \ -no_data "There are no roles or users in this simulation case" \ -elements $elements \ -pass_properties { case_id } \ @@ -86,6 +102,12 @@ wr.pretty_name as role, cu.user_id, 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, + (select count(*) + from sim_case_role_object_map + where role_id = wr.role_id) as num_documents, sr.users_per_case as max_n_users $select_clause from workflow_roles wr, @@ -133,5 +155,52 @@ set case_delete_url [export_vars -base case-delete { case_id { return_url [ad_return_url] } }] +#---------------------------------------------------------------------- +# Case activity history +#---------------------------------------------------------------------- -set activity_html [workflow::case::get_activity_html -case_id $case_id] +template::list::create \ + -name log \ + -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]} + } + action_pretty { + label "Action" + } + } + +db_multirow -extend { message } log select_log { + select l.entry_id, + l.case_id, + l.action_id, + a.short_name as action_short_name, + a.pretty_name as action_pretty, + a.pretty_past_tense as action_pretty_past_tense, + role.pretty_name as role_pretty, + io.creation_user, + iou.first_names || ' ' || iou.last_name as user_name, + to_char(io.creation_date, 'YYYY-HH-MM HH24:MI:SS') as creation_date_ansi + from workflow_case_log l join + workflow_actions a using (action_id) join + cr_items i on (i.item_id = l.entry_id) join + acs_objects io on (io.object_id = i.item_id) join + cc_users iou on (iou.user_id = io.creation_user) join + cr_revisions r on (r.revision_id = i.live_revision), + workflow_roles role + where l.case_id = :case_id + and role.role_id = a.assigned_role + and a.trigger_type = 'user' + order by io.creation_date +} { + +} +