Index: openacs-4/contrib/packages/simulation/lib/cases.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/cases.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/contrib/packages/simulation/lib/cases.tcl 8 Jan 2004 14:24:44 -0000 1.8 +++ openacs-4/contrib/packages/simulation/lib/cases.tcl 12 Jan 2004 13:43:14 -0000 1.9 @@ -19,15 +19,14 @@ pretty_name { label "Simulation" orderby upper(w.pretty_name) - link_url_eval {[export_vars -base [ad_conn package_url]simplay/case { case_id }]} + link_url_eval {[export_vars -base [ad_conn package_url]simplay/case { case_id role_id }]} } label { label "Case" orderby upper(w.pretty_name) } - role { + role_pretty { label "Role" - display_template { Lawyer 1 } } status { label "Status" @@ -48,7 +47,7 @@ -elements $elements db_multirow cases select_cases " - select distinct wc.case_id, + select wc.case_id, sc.label, w.pretty_name, case when (select count(*) @@ -57,6 +56,8 @@ and wcea.enabled_state = 'enabled')=0 then 'Completed' else 'Active' end as status, + r.role_id, + r.pretty_name as role_pretty, (select count(distinct wa2.action_id) from workflow_case_enabled_actions wcea2, workflow_actions wa2, @@ -70,8 +71,10 @@ from workflow_cases wc, sim_cases sc, workflow_case_role_party_map wcrpm, - workflows w + workflows w, + workflow_roles r where wcrpm.party_id = :party_id + and r.role_id = wcrpm.role_id and wc.case_id = wcrpm.case_id and sc.sim_case_id = wc.object_id and w.workflow_id = wc.workflow_id 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.11 -r1.12 --- openacs-4/contrib/packages/simulation/lib/messages.tcl 6 Jan 2004 13:05:47 -0000 1.11 +++ openacs-4/contrib/packages/simulation/lib/messages.tcl 12 Jan 2004 13:43:14 -0000 1.12 @@ -11,6 +11,9 @@ case_id { required_p 0 } + limit { + default_value {} + } } # TODO: finish. if case id is nil, check that adminplayer_p is true. if not, fail. @@ -98,6 +101,7 @@ and w.workflow_id = wc.workflow_id [ad_decode [exists_and_not_null case_id] 1 "and sm.case_id = :case_id" ""] order by sm.creation_date desc + [ad_decode $limit "" "" "limit $limit"] " { 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"] Index: openacs-4/contrib/packages/simulation/lib/sim-template-states.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/sim-template-states.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/simulation/lib/sim-template-states.tcl 12 Jan 2004 11:31:01 -0000 1.2 +++ openacs-4/contrib/packages/simulation/lib/sim-template-states.tcl 12 Jan 2004 13:43:14 -0000 1.3 @@ -80,6 +80,5 @@ set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type state } state_id { direction down } { return_url [ad_return_url] } }] } - # Get rid of the last down_url set states:${counter}(down_url) {} Index: openacs-4/contrib/packages/simulation/lib/sim-template-tasks.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/sim-template-tasks.adp,v diff -u -r1.12 -r1.13 --- openacs-4/contrib/packages/simulation/lib/sim-template-tasks.adp 12 Jan 2004 11:33:41 -0000 1.12 +++ openacs-4/contrib/packages/simulation/lib/sim-template-tasks.adp 12 Jan 2004 13:43:14 -0000 1.13 @@ -1,4 +1,2 @@ -

-

TODO B (.5h): Allow reordering of roles, tasks.

Index: openacs-4/contrib/packages/simulation/lib/sim-template-tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/sim-template-tasks.tcl,v diff -u -r1.28 -r1.29 --- openacs-4/contrib/packages/simulation/lib/sim-template-tasks.tcl 12 Jan 2004 10:58:37 -0000 1.28 +++ openacs-4/contrib/packages/simulation/lib/sim-template-tasks.tcl 12 Jan 2004 13:43:14 -0000 1.29 @@ -51,6 +51,23 @@ Edit } } +lappend elements down { + sub_class narrow + display_template { + + + + } +} +lappend elements up { + sub_class narrow + display_template { + + + + } +} + lappend elements name { label "
Name" display_col pretty_name @@ -113,10 +130,10 @@ html { align center } \ display_template " - + - + "] @@ -147,7 +164,7 @@ #------------------------------------------------------------- set extend [list] -lappend extend edit_url view_url delete_url assigned_role_edit_url recipient_role_edit_url child_workflow_url +lappend extend edit_url view_url delete_url assigned_role_edit_url recipient_role_edit_url child_workflow_url up_url down_url foreach state_id $states { lappend extend state_$state_id @@ -172,6 +189,7 @@ } set actions [list] +set counter 0 db_multirow -extend $extend tasks select_tasks " select wa.action_id, @@ -204,6 +222,7 @@ and ia.action_id = wa.action_id) order by wa.sort_order " { + incr counter set edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" { action_id }] set view_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" { action_id }] set delete_url \ @@ -236,7 +255,13 @@ } } + if { $counter > 1 } { + set up_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction up } { return_url [ad_return_url] } }] + } + set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction down } { return_url [ad_return_url] } }] + lappend actions $action_id } - +# Get rid of the last down_url +set tasks:${counter}(down_url) {} Index: openacs-4/contrib/packages/simulation/www/siminst/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/index.adp,v diff -u -r1.16 -r1.17 --- openacs-4/contrib/packages/simulation/www/siminst/index.adp 12 Jan 2004 11:35:33 -0000 1.16 +++ openacs-4/contrib/packages/simulation/www/siminst/index.adp 12 Jan 2004 13:43:14 -0000 1.17 @@ -9,6 +9,9 @@ Live Simulations +

Simulations in Casting

-

TODO: make sure dev_sims template shows all simulations, including -those from Simulations in casting list \ No newline at end of file + +

+ +

TODO (1h): Merge the casting_sims list into the dev_sims list

Index: openacs-4/contrib/packages/simulation/www/simplay/about-sim.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/about-sim.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/simplay/about-sim.tcl 9 Jan 2004 14:40:36 -0000 1.1 +++ openacs-4/contrib/packages/simulation/www/simplay/about-sim.tcl 12 Jan 2004 13:43:14 -0000 1.2 @@ -2,6 +2,7 @@ Information about a sim. } { case_id:integer + role_id:integer } set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] @@ -13,4 +14,4 @@ set simulation_name [simulation::template::get_element -workflow_id $workflow_id -element pretty_name] set title "About $simulation_name" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "$simulation_name"] $title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "$simulation_name"] $title] 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.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/simplay/case-admin.tcl 8 Jan 2004 14:27:56 -0000 1.1 +++ openacs-4/contrib/packages/simulation/www/simplay/case-admin.tcl 12 Jan 2004 13:43:14 -0000 1.2 @@ -1,11 +1,12 @@ ad_page_contract { This page allows users to choose which group to join. It is only relevant for simulations with casting type of group. } { - {case_id:integer ""} + case_id:integer + role_id:integer } set title "Administer" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "Case CASENAME"] $title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "Case CASENAME"] $title] 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.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/case.adp,v diff -u -r1.8 -r1.9 --- openacs-4/contrib/packages/simulation/www/simplay/case.adp 8 Jan 2004 16:02:34 -0000 1.8 +++ openacs-4/contrib/packages/simulation/www/simplay/case.adp 12 Jan 2004 13:43:14 -0000 1.9 @@ -4,10 +4,9 @@

Recent Messages

- - -TODO: show only 5 most recent messages in this view +

+All messages...

Tasks

Index: openacs-4/contrib/packages/simulation/www/simplay/case.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/case.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/simulation/www/simplay/case.tcl 8 Jan 2004 16:02:34 -0000 1.4 +++ openacs-4/contrib/packages/simulation/www/simplay/case.tcl 12 Jan 2004 13:43:14 -0000 1.5 @@ -1,7 +1,8 @@ ad_page_contract { Simplay home page for a user in one case. } { - case_id:integer + case_id:integer,notnull + role_id:integer,notnull } set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] @@ -14,3 +15,5 @@ set section_uri [apm_package_url_from_id $package_id]simplay/ set adminplayer_p [permission::permission_p -object_id $package_id -privilege sim_adminplayer] + +set messages_url [export_vars -base messages { case_id role_id }] Index: openacs-4/contrib/packages/simulation/www/simplay/control-bar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/control-bar.adp,v diff -u -r1.10 -r1.11 --- openacs-4/contrib/packages/simulation/www/simplay/control-bar.adp 8 Jan 2004 16:02:34 -0000 1.10 +++ openacs-4/contrib/packages/simulation/www/simplay/control-bar.adp 12 Jan 2004 13:43:14 -0000 1.11 @@ -1,6 +1,10 @@ -You are Bernadette -(Plaintiff) (TODO: make this real) - +You are @role.character_title@ +(@role.role_pretty@) + + + +

+

Your Options

-

Contactss

+

Contacts

Index: openacs-4/contrib/packages/simulation/www/simplay/control-bar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/control-bar.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/contrib/packages/simulation/www/simplay/control-bar.tcl 8 Jan 2004 16:02:34 -0000 1.10 +++ openacs-4/contrib/packages/simulation/www/simplay/control-bar.tcl 12 Jan 2004 13:43:14 -0000 1.11 @@ -1,75 +1,96 @@ -# an includelet showing messages and tasks for a user +simulation::include_contract { + Displays a menu/control bar for users in a sim + @author Joel Aufrecht + @creation-date 2003-11-12 + @cvs-id $Id$ +} { + case_id {} + role_id {} +} + set package_id [ad_conn package_id] set user_id [ad_conn user_id] set section_uri [apm_package_url_from_id $package_id]simplay/ set adminplayer_p [permission::permission_p -object_id $package_id -privilege sim_adminplayer] -if { ![info exists case_id] } { - set case_id {} - set workflow_id {} -} else { - set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] -} +set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] -if { !$adminplayer_p } { - # TODO: constrain queries based on case_id, which (another TODO) should be passed in -} +set case_home_url [export_vars -base "case" { case_id role_id }] -set case_home_url [export_vars -base "case" { case_id }] - -set message_count [db_string message_count_sql " +set message_count [db_string message_count_sql { select count(*) - from sim_messages sm, - workflow_case_role_party_map wcrmp, - party_approved_member_map pamm - where pamm.member_id = :user_id - and wcrmp.party_id = pamm.party_id - and wcrmp.role_id = sm.to_role_id - and wcrmp.case_id = sm.case_id - [ad_decode $case_id "" "" "and wcrmp.case_id = :case_id"] -"] -set messages_url [export_vars -base ${section_uri}messages { case_id }] + from sim_messages sm + where sm.to_role_id = :role_id + and sm.case_id = :case_id +}] +set messages_url [export_vars -base ${section_uri}messages { case_id role_id }] -# TODO: decide whether to replace direct sql with this API loop: -# get a list of cases in which the user participates -# for each case, do [workflow::case::get_available_actions -case_id case_id -user_id :user_id ] - -set task_count [db_string task_count_sql " +set task_count [db_string task_count_sql { select count(wcea.enabled_action_id) from workflow_case_enabled_actions wcea, - workflow_case_role_party_map wcrpm, - workflow_actions wa, - party_approved_member_map pamm - where pamm.member_id = :user_id - and wcrpm.party_id = pamm.party_id - and wcrpm.case_id = wcea.case_id - and wcrpm.role_id = wa.assigned_role + workflow_actions wa + where wa.assigned_role = :role_id and wa.action_id = wcea.action_id and wcea.enabled_state = 'enabled' - [ad_decode $case_id "" "" "and wcea.case_id = :case_id"] -"] + and wcea.case_id = :case_id +}] -set tasks_url [export_vars -base ${section_uri}tasks { case_id }] -set portfolio_url [export_vars -base ${section_uri}portfolio { case_id }] -set about_sim_url [export_vars -base ${section_uri}about-sim { case_id }] +set tasks_url [export_vars -base ${section_uri}tasks { case_id role_id }] +set portfolio_url [export_vars -base ${section_uri}portfolio { case_id role_id }] +set about_sim_url [export_vars -base ${section_uri}about-sim { case_id role_id }] -# TODO: exclude records where wcrpm.party_id includes current user -db_multirow -extend { character_url } roles select_roles " - select wcrpm.role_id, - wr.pretty_name as role_name, - scx.name, - scx.title - from workflow_case_role_party_map wcrpm, +db_1row your_role { + select wr.role_id, + wr.pretty_name as role_pretty, + scx.name as character_name, + scx.title as character_title, + scx.item_id as character_item_id + from workflow_roles wr, + sim_roles sr, + sim_charactersx scx, + cr_items ci + where wr.role_id = :role_id + and sr.role_id = wr.role_id + and scx.item_id = sr.character_id + and ci.item_id = scx.item_id + and ci.live_revision = scx.object_id +} -column_array role + +set role(character_url) [simulation::object::url -name $role(character_name)] + +array set thumbnail [lindex [util_list_of_ns_sets_to_list_of_lists -list_of_ns_sets [bcms::item::list_related_items -item_id $role(character_item_id) -relation_tag "thumbnail" -return_list]] 0] + +if { [exists_and_not_null thumbnail(name)] && [exists_and_not_null thumbnail(live_revision)] } { + set role(thumbnail_url) [simulation::object::content_url -name $thumbnail(name)] + set role(thumbnail_name) $thumbnail(name) + + array set thumbnail_rev [bcms::revision::get_revision \ + -revision_id $thumbnail(live_revision) \ + -additional_properties { width height }] + + set role(thumbnail_height) $thumbnail_rev(height) + set role(thumbnail_width) $thumbnail_rev(width) +} + +db_multirow -unclobber -extend { character_url } contacts select_contacts " + select wr.role_id, + wr.pretty_name as role_pretty, + scx.name as character_name, + scx.title as character_title + from workflow_cases wc, workflow_roles wr, sim_roles sr, - sim_charactersx scx - where wcrpm.case_id = :case_id - and wr.role_id = wcrpm.role_id - and sr.role_id = wcrpm.role_id - and scx.object_id = sr.character_id + sim_charactersx scx, + cr_items ci + where wc.case_id = :case_id + and wr.workflow_id = wc.workflow_id + and sr.role_id = wr.role_id + and scx.item_id = sr.character_id + and ci.item_id = scx.item_id + and ci.live_revision = scx.object_id + and wr.role_id != :role_id " { - set character_url [simulation::object::url -name $name] + set character_url [simulation::object::url -name $character_name] } - Index: openacs-4/contrib/packages/simulation/www/simplay/document-upload.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/document-upload.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/simulation/www/simplay/document-upload.tcl 5 Jan 2004 15:29:51 -0000 1.3 +++ openacs-4/contrib/packages/simulation/www/simplay/document-upload.tcl 12 Jan 2004 13:43:14 -0000 1.4 @@ -4,20 +4,21 @@ @author Peter Marklund } { case_id:integer + role_id:integer item_id:optional } set page_title "Upload new document to portfolio" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "Case"] $page_title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "Case"] $page_title] set workflow_id [workflow::case::get_element -case_id $case_id -element workflow_id] set role_options [list] -foreach role_id [workflow::case::get_user_roles -case_id $case_id] { - lappend role_options [list [workflow::role::get_element -role_id $role_id -element pretty_name] $role_id] +foreach one_role_id [workflow::case::get_user_roles -case_id $case_id] { + lappend role_options [list [workflow::role::get_element -role_id $one_role_id -element pretty_name] $one_role_id] } -ad_form -name document -export { case_id workflow_id } -html {enctype multipart/form-data} -form { +ad_form -name document -export { case_id role_id workflow_id } -html {enctype multipart/form-data} -form { {item_id:key} } @@ -51,15 +52,12 @@ set parent_id [bcms::folder::get_id_by_package_id -parent_id 0] - # TODO: this is a copy-and-paste from object-edit.tcl 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 - #error "$item_id $name $parent_id $content_type $storage_type" - set item_id [bcms::item::create_item \ -item_id $item_id \ -item_name $name \ @@ -82,9 +80,7 @@ set role_id [lindex [lindex $role_options 0] 1] } - # TODO: Tcl proc? - # TODO: what should relation_tag be? - set relation_tag "dummy" + 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) @@ -93,5 +89,5 @@ } } - ad_returnredirect [export_vars -base case { case_id }] + ad_returnredirect [export_vars -base case { case_id role_id }] } Index: openacs-4/contrib/packages/simulation/www/simplay/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/index.adp,v diff -u -r1.18 -r1.19 --- openacs-4/contrib/packages/simulation/www/simplay/index.adp 9 Jan 2004 14:40:03 -0000 1.18 +++ openacs-4/contrib/packages/simulation/www/simplay/index.adp 12 Jan 2004 13:43:14 -0000 1.19 @@ -3,12 +3,14 @@ @context;noquote@ +

Administration

You administer these cases

+

All Messages

@@ -18,8 +20,8 @@

All Tasks

+

-

TODO: how can a player access completed cases?

-

TODO: all of simplay should require role_id

\ No newline at end of file +

TODO (1h): all of simplay should require role_id

Index: openacs-4/contrib/packages/simulation/www/simplay/message.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/message.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/contrib/packages/simulation/www/simplay/message.tcl 8 Jan 2004 16:02:34 -0000 1.16 +++ openacs-4/contrib/packages/simulation/www/simplay/message.tcl 12 Jan 2004 13:43:14 -0000 1.17 @@ -1,10 +1,11 @@ ad_page_contract { Create or edit a message. } { - item_id:optional - case_id:optional - sender_role_id:optional - recipient_role_id:optional,multiple + item_id:integer,optional + case_id:integer + role_id:integer + sender_role_id:integer,optional + recipient_role_id:integer,optional,multiple subject:optional body_text:optional body_mime_type:optional @@ -13,14 +14,14 @@ # TODO: store messages in a folder specific to the case set page_title "Message" -set context [list [list "." "SimPlay"] [list [export_vars -base case { case_id }] "Case"] $page_title] +set context [list [list "." "SimPlay"] [list [export_vars -base case { case_id role_id }] "Case"] $page_title] set package_id [ad_conn package_id] set workflow_id [workflow::case::get_element -case_id $case_id -element workflow_id] set from_role_options [list] -foreach role_id [workflow::case::get_user_roles -case_id $case_id] { - lappend from_role_options [list [workflow::role::get_element -role_id $role_id -element pretty_name] $role_id] +foreach one_role_id [workflow::case::get_user_roles -case_id $case_id] { + lappend from_role_options [list [workflow::role::get_element -role_id $one_role_id -element pretty_name] $one_role_id] } # First sender role selected by default @@ -29,15 +30,15 @@ } set all_role_options [list] -foreach role_id [workflow::role::get_ids -workflow_id $workflow_id] { - lappend all_role_options [list [workflow::role::get_element -role_id $role_id -element pretty_name] $role_id] +foreach one_role_id [workflow::role::get_ids -workflow_id $workflow_id] { + lappend all_role_options [list [workflow::role::get_element -role_id $one_role_id -element pretty_name] $one_role_id] } set to_role_options [list] -foreach role_id [workflow::role::get_ids -workflow_id $workflow_id] { +foreach one_role_id [workflow::role::get_ids -workflow_id $workflow_id] { # A role cannot send message to himself - if { ![exists_and_equal sender_role_id $role_id] } { - lappend to_role_options [list [workflow::role::get_element -role_id $role_id -element pretty_name] $role_id] + if { ![exists_and_equal sender_role_id $one_role_id] } { + lappend to_role_options [list [workflow::role::get_element -role_id $one_role_id -element pretty_name] $one_role_id] } } @@ -205,6 +206,6 @@ } } - ad_returnredirect [export_vars -base case { case_id }] + ad_returnredirect [export_vars -base case { case_id role_id }] ad_script_abort } Index: openacs-4/contrib/packages/simulation/www/simplay/messages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/messages.adp,v diff -u -r1.9 -r1.10 --- openacs-4/contrib/packages/simulation/www/simplay/messages.adp 7 Jan 2004 13:12:17 -0000 1.9 +++ openacs-4/contrib/packages/simulation/www/simplay/messages.adp 12 Jan 2004 13:43:14 -0000 1.10 @@ -5,5 +5,6 @@

TODO: show sent messages as well +

TODO: automatically create a Notification entry for each user per -role, and show an add/remove link here \ No newline at end of file +role, and show an add/remove link here Index: openacs-4/contrib/packages/simulation/www/simplay/messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/messages.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/contrib/packages/simulation/www/simplay/messages.tcl 8 Jan 2004 16:02:34 -0000 1.6 +++ openacs-4/contrib/packages/simulation/www/simplay/messages.tcl 12 Jan 2004 13:43:14 -0000 1.7 @@ -2,12 +2,13 @@ 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] set title "Messages" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "$simulation_name"] $title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "$simulation_name"] $title] set user_id [ad_conn user_id] Index: openacs-4/contrib/packages/simulation/www/simplay/play-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/play-master.adp,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/packages/simulation/www/simplay/play-master.adp 5 Jan 2004 17:05:07 -0000 1.5 +++ openacs-4/contrib/packages/simulation/www/simplay/play-master.adp 12 Jan 2004 13:43:14 -0000 1.6 @@ -7,7 +7,7 @@
- + Index: openacs-4/contrib/packages/simulation/www/simplay/play-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/play-master.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/simulation/www/simplay/play-master.tcl 5 Jan 2004 17:05:07 -0000 1.3 +++ openacs-4/contrib/packages/simulation/www/simplay/play-master.tcl 12 Jan 2004 13:43:14 -0000 1.4 @@ -5,6 +5,10 @@ set case_id [ns_queryget case_id] } +if { ![exists_and_not_null role_id] } { + set role_id [ns_queryget role_id] +} + if { [template::util::is_nil header_stuff] } { set header_stuff "" } Index: openacs-4/contrib/packages/simulation/www/simplay/portfolio.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/portfolio.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/simulation/www/simplay/portfolio.tcl 8 Jan 2004 16:02:34 -0000 1.4 +++ openacs-4/contrib/packages/simulation/www/simplay/portfolio.tcl 12 Jan 2004 13:43:14 -0000 1.5 @@ -2,13 +2,14 @@ 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] set title "Portfolio" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "$simulation_name"] $title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "$simulation_name"] $title] set user_id [ad_conn user_id] set package_id [ad_conn package_id] Index: openacs-4/contrib/packages/simulation/www/simplay/task-detail.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/task-detail.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/contrib/packages/simulation/www/simplay/task-detail.tcl 6 Jan 2004 13:11:54 -0000 1.9 +++ openacs-4/contrib/packages/simulation/www/simplay/task-detail.tcl 12 Jan 2004 13:43:14 -0000 1.10 @@ -1,12 +1,13 @@ ad_page_contract { Details for a task } { + case_id:integer + role_id:integer enabled_action_id:integer } workflow::case::enabled_action_get -enabled_action_id $enabled_action_id -array enabled_action -set case_id $enabled_action(case_id) set action_id $enabled_action(action_id) simulation::action::get -action_id $action_id -array action @@ -16,9 +17,9 @@ } set title "Task" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "Case"] [list [export_vars -base tasks { case_id }] "Tasks"] $title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "Case"] [list [export_vars -base tasks { case_id role_id }] "Tasks"] $title] -ad_form -name action -edit_buttons { { Send ok } } -export { enabled_action_id } -form { +ad_form -name action -edit_buttons { { Send ok } } -export { case_id role_id enabled_action_id } -form { {pretty_name:text(inform) {label "Task"} } @@ -99,6 +100,6 @@ -attachments $attachments } - ad_returnredirect [export_vars -base tasks { case_id }] + ad_returnredirect [export_vars -base tasks { case_id role_id }] ad_script_abort } Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/simplay/task.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/simplay/task.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/simulation/www/simplay/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/tasks.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/packages/simulation/www/simplay/tasks.tcl 8 Jan 2004 16:02:34 -0000 1.5 +++ openacs-4/contrib/packages/simulation/www/simplay/tasks.tcl 12 Jan 2004 13:43:14 -0000 1.6 @@ -2,12 +2,13 @@ List of tasks 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] set title "Tasks" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "$simulation_name"] $title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "$simulation_name"] $title] set user_id [ad_conn user_id] Index: openacs-4/packages/simulation/lib/cases.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/cases.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/simulation/lib/cases.tcl 8 Jan 2004 14:24:44 -0000 1.8 +++ openacs-4/packages/simulation/lib/cases.tcl 12 Jan 2004 13:43:14 -0000 1.9 @@ -19,15 +19,14 @@ pretty_name { label "Simulation" orderby upper(w.pretty_name) - link_url_eval {[export_vars -base [ad_conn package_url]simplay/case { case_id }]} + link_url_eval {[export_vars -base [ad_conn package_url]simplay/case { case_id role_id }]} } label { label "Case" orderby upper(w.pretty_name) } - role { + role_pretty { label "Role" - display_template { Lawyer 1 } } status { label "Status" @@ -48,7 +47,7 @@ -elements $elements db_multirow cases select_cases " - select distinct wc.case_id, + select wc.case_id, sc.label, w.pretty_name, case when (select count(*) @@ -57,6 +56,8 @@ and wcea.enabled_state = 'enabled')=0 then 'Completed' else 'Active' end as status, + r.role_id, + r.pretty_name as role_pretty, (select count(distinct wa2.action_id) from workflow_case_enabled_actions wcea2, workflow_actions wa2, @@ -70,8 +71,10 @@ from workflow_cases wc, sim_cases sc, workflow_case_role_party_map wcrpm, - workflows w + workflows w, + workflow_roles r where wcrpm.party_id = :party_id + and r.role_id = wcrpm.role_id and wc.case_id = wcrpm.case_id and sc.sim_case_id = wc.object_id and w.workflow_id = wc.workflow_id Index: openacs-4/packages/simulation/lib/messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/messages.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/simulation/lib/messages.tcl 6 Jan 2004 13:05:47 -0000 1.11 +++ openacs-4/packages/simulation/lib/messages.tcl 12 Jan 2004 13:43:14 -0000 1.12 @@ -11,6 +11,9 @@ case_id { required_p 0 } + limit { + default_value {} + } } # TODO: finish. if case id is nil, check that adminplayer_p is true. if not, fail. @@ -98,6 +101,7 @@ and w.workflow_id = wc.workflow_id [ad_decode [exists_and_not_null case_id] 1 "and sm.case_id = :case_id" ""] order by sm.creation_date desc + [ad_decode $limit "" "" "limit $limit"] " { 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"] Index: openacs-4/packages/simulation/lib/sim-template-states.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-template-states.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/simulation/lib/sim-template-states.tcl 12 Jan 2004 11:31:01 -0000 1.2 +++ openacs-4/packages/simulation/lib/sim-template-states.tcl 12 Jan 2004 13:43:14 -0000 1.3 @@ -80,6 +80,5 @@ set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type state } state_id { direction down } { return_url [ad_return_url] } }] } - # Get rid of the last down_url set states:${counter}(down_url) {} Index: openacs-4/packages/simulation/lib/sim-template-tasks.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-template-tasks.adp,v diff -u -r1.12 -r1.13 --- openacs-4/packages/simulation/lib/sim-template-tasks.adp 12 Jan 2004 11:33:41 -0000 1.12 +++ openacs-4/packages/simulation/lib/sim-template-tasks.adp 12 Jan 2004 13:43:14 -0000 1.13 @@ -1,4 +1,2 @@ -

-

TODO B (.5h): Allow reordering of roles, tasks.

Index: openacs-4/packages/simulation/lib/sim-template-tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-template-tasks.tcl,v diff -u -r1.28 -r1.29 --- openacs-4/packages/simulation/lib/sim-template-tasks.tcl 12 Jan 2004 10:58:37 -0000 1.28 +++ openacs-4/packages/simulation/lib/sim-template-tasks.tcl 12 Jan 2004 13:43:14 -0000 1.29 @@ -51,6 +51,23 @@ Edit } } +lappend elements down { + sub_class narrow + display_template { + + + + } +} +lappend elements up { + sub_class narrow + display_template { + + + + } +} + lappend elements name { label "
Name" display_col pretty_name @@ -113,10 +130,10 @@ html { align center } \ display_template " - + - + "] @@ -147,7 +164,7 @@ #------------------------------------------------------------- set extend [list] -lappend extend edit_url view_url delete_url assigned_role_edit_url recipient_role_edit_url child_workflow_url +lappend extend edit_url view_url delete_url assigned_role_edit_url recipient_role_edit_url child_workflow_url up_url down_url foreach state_id $states { lappend extend state_$state_id @@ -172,6 +189,7 @@ } set actions [list] +set counter 0 db_multirow -extend $extend tasks select_tasks " select wa.action_id, @@ -204,6 +222,7 @@ and ia.action_id = wa.action_id) order by wa.sort_order " { + incr counter set edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" { action_id }] set view_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" { action_id }] set delete_url \ @@ -236,7 +255,13 @@ } } + if { $counter > 1 } { + set up_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction up } { return_url [ad_return_url] } }] + } + set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction down } { return_url [ad_return_url] } }] + lappend actions $action_id } - +# Get rid of the last down_url +set tasks:${counter}(down_url) {} Index: openacs-4/packages/simulation/www/siminst/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/index.adp,v diff -u -r1.16 -r1.17 --- openacs-4/packages/simulation/www/siminst/index.adp 12 Jan 2004 11:35:33 -0000 1.16 +++ openacs-4/packages/simulation/www/siminst/index.adp 12 Jan 2004 13:43:14 -0000 1.17 @@ -9,6 +9,9 @@ Live Simulations +

Simulations in Casting

-

TODO: make sure dev_sims template shows all simulations, including -those from Simulations in casting list \ No newline at end of file + +

+ +

TODO (1h): Merge the casting_sims list into the dev_sims list

Index: openacs-4/packages/simulation/www/simplay/about-sim.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/about-sim.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/www/simplay/about-sim.tcl 9 Jan 2004 14:40:36 -0000 1.1 +++ openacs-4/packages/simulation/www/simplay/about-sim.tcl 12 Jan 2004 13:43:14 -0000 1.2 @@ -2,6 +2,7 @@ Information about a sim. } { case_id:integer + role_id:integer } set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] @@ -13,4 +14,4 @@ set simulation_name [simulation::template::get_element -workflow_id $workflow_id -element pretty_name] set title "About $simulation_name" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "$simulation_name"] $title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "$simulation_name"] $title] 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.1 -r1.2 --- openacs-4/packages/simulation/www/simplay/case-admin.tcl 8 Jan 2004 14:27:56 -0000 1.1 +++ openacs-4/packages/simulation/www/simplay/case-admin.tcl 12 Jan 2004 13:43:14 -0000 1.2 @@ -1,11 +1,12 @@ ad_page_contract { This page allows users to choose which group to join. It is only relevant for simulations with casting type of group. } { - {case_id:integer ""} + case_id:integer + role_id:integer } set title "Administer" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "Case CASENAME"] $title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "Case CASENAME"] $title] 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.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case.adp,v diff -u -r1.8 -r1.9 --- openacs-4/packages/simulation/www/simplay/case.adp 8 Jan 2004 16:02:34 -0000 1.8 +++ openacs-4/packages/simulation/www/simplay/case.adp 12 Jan 2004 13:43:14 -0000 1.9 @@ -4,10 +4,9 @@

Recent Messages

- - -TODO: show only 5 most recent messages in this view +

+All messages...

Tasks

Index: openacs-4/packages/simulation/www/simplay/case.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/simulation/www/simplay/case.tcl 8 Jan 2004 16:02:34 -0000 1.4 +++ openacs-4/packages/simulation/www/simplay/case.tcl 12 Jan 2004 13:43:14 -0000 1.5 @@ -1,7 +1,8 @@ ad_page_contract { Simplay home page for a user in one case. } { - case_id:integer + case_id:integer,notnull + role_id:integer,notnull } set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] @@ -14,3 +15,5 @@ set section_uri [apm_package_url_from_id $package_id]simplay/ set adminplayer_p [permission::permission_p -object_id $package_id -privilege sim_adminplayer] + +set messages_url [export_vars -base messages { case_id role_id }] Index: openacs-4/packages/simulation/www/simplay/control-bar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/control-bar.adp,v diff -u -r1.10 -r1.11 --- openacs-4/packages/simulation/www/simplay/control-bar.adp 8 Jan 2004 16:02:34 -0000 1.10 +++ openacs-4/packages/simulation/www/simplay/control-bar.adp 12 Jan 2004 13:43:14 -0000 1.11 @@ -1,6 +1,10 @@ -You are Bernadette -(Plaintiff) (TODO: make this real) - +You are @role.character_title@ +(@role.role_pretty@) + + + +

+

Your Options

-

Contactss

+

Contacts

Index: openacs-4/packages/simulation/www/simplay/control-bar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/control-bar.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/simulation/www/simplay/control-bar.tcl 8 Jan 2004 16:02:34 -0000 1.10 +++ openacs-4/packages/simulation/www/simplay/control-bar.tcl 12 Jan 2004 13:43:14 -0000 1.11 @@ -1,75 +1,96 @@ -# an includelet showing messages and tasks for a user +simulation::include_contract { + Displays a menu/control bar for users in a sim + @author Joel Aufrecht + @creation-date 2003-11-12 + @cvs-id $Id$ +} { + case_id {} + role_id {} +} + set package_id [ad_conn package_id] set user_id [ad_conn user_id] set section_uri [apm_package_url_from_id $package_id]simplay/ set adminplayer_p [permission::permission_p -object_id $package_id -privilege sim_adminplayer] -if { ![info exists case_id] } { - set case_id {} - set workflow_id {} -} else { - set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] -} +set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] -if { !$adminplayer_p } { - # TODO: constrain queries based on case_id, which (another TODO) should be passed in -} +set case_home_url [export_vars -base "case" { case_id role_id }] -set case_home_url [export_vars -base "case" { case_id }] - -set message_count [db_string message_count_sql " +set message_count [db_string message_count_sql { select count(*) - from sim_messages sm, - workflow_case_role_party_map wcrmp, - party_approved_member_map pamm - where pamm.member_id = :user_id - and wcrmp.party_id = pamm.party_id - and wcrmp.role_id = sm.to_role_id - and wcrmp.case_id = sm.case_id - [ad_decode $case_id "" "" "and wcrmp.case_id = :case_id"] -"] -set messages_url [export_vars -base ${section_uri}messages { case_id }] + from sim_messages sm + where sm.to_role_id = :role_id + and sm.case_id = :case_id +}] +set messages_url [export_vars -base ${section_uri}messages { case_id role_id }] -# TODO: decide whether to replace direct sql with this API loop: -# get a list of cases in which the user participates -# for each case, do [workflow::case::get_available_actions -case_id case_id -user_id :user_id ] - -set task_count [db_string task_count_sql " +set task_count [db_string task_count_sql { select count(wcea.enabled_action_id) from workflow_case_enabled_actions wcea, - workflow_case_role_party_map wcrpm, - workflow_actions wa, - party_approved_member_map pamm - where pamm.member_id = :user_id - and wcrpm.party_id = pamm.party_id - and wcrpm.case_id = wcea.case_id - and wcrpm.role_id = wa.assigned_role + workflow_actions wa + where wa.assigned_role = :role_id and wa.action_id = wcea.action_id and wcea.enabled_state = 'enabled' - [ad_decode $case_id "" "" "and wcea.case_id = :case_id"] -"] + and wcea.case_id = :case_id +}] -set tasks_url [export_vars -base ${section_uri}tasks { case_id }] -set portfolio_url [export_vars -base ${section_uri}portfolio { case_id }] -set about_sim_url [export_vars -base ${section_uri}about-sim { case_id }] +set tasks_url [export_vars -base ${section_uri}tasks { case_id role_id }] +set portfolio_url [export_vars -base ${section_uri}portfolio { case_id role_id }] +set about_sim_url [export_vars -base ${section_uri}about-sim { case_id role_id }] -# TODO: exclude records where wcrpm.party_id includes current user -db_multirow -extend { character_url } roles select_roles " - select wcrpm.role_id, - wr.pretty_name as role_name, - scx.name, - scx.title - from workflow_case_role_party_map wcrpm, +db_1row your_role { + select wr.role_id, + wr.pretty_name as role_pretty, + scx.name as character_name, + scx.title as character_title, + scx.item_id as character_item_id + from workflow_roles wr, + sim_roles sr, + sim_charactersx scx, + cr_items ci + where wr.role_id = :role_id + and sr.role_id = wr.role_id + and scx.item_id = sr.character_id + and ci.item_id = scx.item_id + and ci.live_revision = scx.object_id +} -column_array role + +set role(character_url) [simulation::object::url -name $role(character_name)] + +array set thumbnail [lindex [util_list_of_ns_sets_to_list_of_lists -list_of_ns_sets [bcms::item::list_related_items -item_id $role(character_item_id) -relation_tag "thumbnail" -return_list]] 0] + +if { [exists_and_not_null thumbnail(name)] && [exists_and_not_null thumbnail(live_revision)] } { + set role(thumbnail_url) [simulation::object::content_url -name $thumbnail(name)] + set role(thumbnail_name) $thumbnail(name) + + array set thumbnail_rev [bcms::revision::get_revision \ + -revision_id $thumbnail(live_revision) \ + -additional_properties { width height }] + + set role(thumbnail_height) $thumbnail_rev(height) + set role(thumbnail_width) $thumbnail_rev(width) +} + +db_multirow -unclobber -extend { character_url } contacts select_contacts " + select wr.role_id, + wr.pretty_name as role_pretty, + scx.name as character_name, + scx.title as character_title + from workflow_cases wc, workflow_roles wr, sim_roles sr, - sim_charactersx scx - where wcrpm.case_id = :case_id - and wr.role_id = wcrpm.role_id - and sr.role_id = wcrpm.role_id - and scx.object_id = sr.character_id + sim_charactersx scx, + cr_items ci + where wc.case_id = :case_id + and wr.workflow_id = wc.workflow_id + and sr.role_id = wr.role_id + and scx.item_id = sr.character_id + and ci.item_id = scx.item_id + and ci.live_revision = scx.object_id + and wr.role_id != :role_id " { - set character_url [simulation::object::url -name $name] + set character_url [simulation::object::url -name $character_name] } - Index: openacs-4/packages/simulation/www/simplay/document-upload.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/document-upload.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/simulation/www/simplay/document-upload.tcl 5 Jan 2004 15:29:51 -0000 1.3 +++ openacs-4/packages/simulation/www/simplay/document-upload.tcl 12 Jan 2004 13:43:14 -0000 1.4 @@ -4,20 +4,21 @@ @author Peter Marklund } { case_id:integer + role_id:integer item_id:optional } set page_title "Upload new document to portfolio" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "Case"] $page_title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "Case"] $page_title] set workflow_id [workflow::case::get_element -case_id $case_id -element workflow_id] set role_options [list] -foreach role_id [workflow::case::get_user_roles -case_id $case_id] { - lappend role_options [list [workflow::role::get_element -role_id $role_id -element pretty_name] $role_id] +foreach one_role_id [workflow::case::get_user_roles -case_id $case_id] { + lappend role_options [list [workflow::role::get_element -role_id $one_role_id -element pretty_name] $one_role_id] } -ad_form -name document -export { case_id workflow_id } -html {enctype multipart/form-data} -form { +ad_form -name document -export { case_id role_id workflow_id } -html {enctype multipart/form-data} -form { {item_id:key} } @@ -51,15 +52,12 @@ set parent_id [bcms::folder::get_id_by_package_id -parent_id 0] - # TODO: this is a copy-and-paste from object-edit.tcl 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 - #error "$item_id $name $parent_id $content_type $storage_type" - set item_id [bcms::item::create_item \ -item_id $item_id \ -item_name $name \ @@ -82,9 +80,7 @@ set role_id [lindex [lindex $role_options 0] 1] } - # TODO: Tcl proc? - # TODO: what should relation_tag be? - set relation_tag "dummy" + 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) @@ -93,5 +89,5 @@ } } - ad_returnredirect [export_vars -base case { case_id }] + ad_returnredirect [export_vars -base case { case_id role_id }] } Index: openacs-4/packages/simulation/www/simplay/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/index.adp,v diff -u -r1.18 -r1.19 --- openacs-4/packages/simulation/www/simplay/index.adp 9 Jan 2004 14:40:03 -0000 1.18 +++ openacs-4/packages/simulation/www/simplay/index.adp 12 Jan 2004 13:43:14 -0000 1.19 @@ -3,12 +3,14 @@ @context;noquote@ +

Administration

You administer these cases

+

All Messages

@@ -18,8 +20,8 @@

All Tasks

+

-

TODO: how can a player access completed cases?

-

TODO: all of simplay should require role_id

\ No newline at end of file +

TODO (1h): all of simplay should require role_id

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.16 -r1.17 --- openacs-4/packages/simulation/www/simplay/message.tcl 8 Jan 2004 16:02:34 -0000 1.16 +++ openacs-4/packages/simulation/www/simplay/message.tcl 12 Jan 2004 13:43:14 -0000 1.17 @@ -1,10 +1,11 @@ ad_page_contract { Create or edit a message. } { - item_id:optional - case_id:optional - sender_role_id:optional - recipient_role_id:optional,multiple + item_id:integer,optional + case_id:integer + role_id:integer + sender_role_id:integer,optional + recipient_role_id:integer,optional,multiple subject:optional body_text:optional body_mime_type:optional @@ -13,14 +14,14 @@ # TODO: store messages in a folder specific to the case set page_title "Message" -set context [list [list "." "SimPlay"] [list [export_vars -base case { case_id }] "Case"] $page_title] +set context [list [list "." "SimPlay"] [list [export_vars -base case { case_id role_id }] "Case"] $page_title] set package_id [ad_conn package_id] set workflow_id [workflow::case::get_element -case_id $case_id -element workflow_id] set from_role_options [list] -foreach role_id [workflow::case::get_user_roles -case_id $case_id] { - lappend from_role_options [list [workflow::role::get_element -role_id $role_id -element pretty_name] $role_id] +foreach one_role_id [workflow::case::get_user_roles -case_id $case_id] { + lappend from_role_options [list [workflow::role::get_element -role_id $one_role_id -element pretty_name] $one_role_id] } # First sender role selected by default @@ -29,15 +30,15 @@ } set all_role_options [list] -foreach role_id [workflow::role::get_ids -workflow_id $workflow_id] { - lappend all_role_options [list [workflow::role::get_element -role_id $role_id -element pretty_name] $role_id] +foreach one_role_id [workflow::role::get_ids -workflow_id $workflow_id] { + lappend all_role_options [list [workflow::role::get_element -role_id $one_role_id -element pretty_name] $one_role_id] } set to_role_options [list] -foreach role_id [workflow::role::get_ids -workflow_id $workflow_id] { +foreach one_role_id [workflow::role::get_ids -workflow_id $workflow_id] { # A role cannot send message to himself - if { ![exists_and_equal sender_role_id $role_id] } { - lappend to_role_options [list [workflow::role::get_element -role_id $role_id -element pretty_name] $role_id] + if { ![exists_and_equal sender_role_id $one_role_id] } { + lappend to_role_options [list [workflow::role::get_element -role_id $one_role_id -element pretty_name] $one_role_id] } } @@ -205,6 +206,6 @@ } } - ad_returnredirect [export_vars -base case { case_id }] + ad_returnredirect [export_vars -base case { case_id role_id }] ad_script_abort } Index: openacs-4/packages/simulation/www/simplay/messages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/messages.adp,v diff -u -r1.9 -r1.10 --- openacs-4/packages/simulation/www/simplay/messages.adp 7 Jan 2004 13:12:17 -0000 1.9 +++ openacs-4/packages/simulation/www/simplay/messages.adp 12 Jan 2004 13:43:14 -0000 1.10 @@ -5,5 +5,6 @@

TODO: show sent messages as well +

TODO: automatically create a Notification entry for each user per -role, and show an add/remove link here \ No newline at end of file +role, and show an add/remove link here Index: openacs-4/packages/simulation/www/simplay/messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/messages.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/simulation/www/simplay/messages.tcl 8 Jan 2004 16:02:34 -0000 1.6 +++ openacs-4/packages/simulation/www/simplay/messages.tcl 12 Jan 2004 13:43:14 -0000 1.7 @@ -2,12 +2,13 @@ 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] set title "Messages" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "$simulation_name"] $title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "$simulation_name"] $title] set user_id [ad_conn user_id] Index: openacs-4/packages/simulation/www/simplay/play-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/play-master.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/simulation/www/simplay/play-master.adp 5 Jan 2004 17:05:07 -0000 1.5 +++ openacs-4/packages/simulation/www/simplay/play-master.adp 12 Jan 2004 13:43:14 -0000 1.6 @@ -7,7 +7,7 @@
- + Index: openacs-4/packages/simulation/www/simplay/play-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/play-master.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/simulation/www/simplay/play-master.tcl 5 Jan 2004 17:05:07 -0000 1.3 +++ openacs-4/packages/simulation/www/simplay/play-master.tcl 12 Jan 2004 13:43:14 -0000 1.4 @@ -5,6 +5,10 @@ set case_id [ns_queryget case_id] } +if { ![exists_and_not_null role_id] } { + set role_id [ns_queryget role_id] +} + if { [template::util::is_nil header_stuff] } { set header_stuff "" } Index: openacs-4/packages/simulation/www/simplay/portfolio.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/portfolio.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/simulation/www/simplay/portfolio.tcl 8 Jan 2004 16:02:34 -0000 1.4 +++ openacs-4/packages/simulation/www/simplay/portfolio.tcl 12 Jan 2004 13:43:14 -0000 1.5 @@ -2,13 +2,14 @@ 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] set title "Portfolio" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "$simulation_name"] $title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "$simulation_name"] $title] set user_id [ad_conn user_id] set package_id [ad_conn package_id] Index: openacs-4/packages/simulation/www/simplay/task-detail.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/task-detail.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/simulation/www/simplay/task-detail.tcl 6 Jan 2004 13:11:54 -0000 1.9 +++ openacs-4/packages/simulation/www/simplay/task-detail.tcl 12 Jan 2004 13:43:14 -0000 1.10 @@ -1,12 +1,13 @@ ad_page_contract { Details for a task } { + case_id:integer + role_id:integer enabled_action_id:integer } workflow::case::enabled_action_get -enabled_action_id $enabled_action_id -array enabled_action -set case_id $enabled_action(case_id) set action_id $enabled_action(action_id) simulation::action::get -action_id $action_id -array action @@ -16,9 +17,9 @@ } set title "Task" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "Case"] [list [export_vars -base tasks { case_id }] "Tasks"] $title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "Case"] [list [export_vars -base tasks { case_id role_id }] "Tasks"] $title] -ad_form -name action -edit_buttons { { Send ok } } -export { enabled_action_id } -form { +ad_form -name action -edit_buttons { { Send ok } } -export { case_id role_id enabled_action_id } -form { {pretty_name:text(inform) {label "Task"} } @@ -99,6 +100,6 @@ -attachments $attachments } - ad_returnredirect [export_vars -base tasks { case_id }] + ad_returnredirect [export_vars -base tasks { case_id role_id }] ad_script_abort } Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/simplay/task.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/simplay/task.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/simulation/www/simplay/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/tasks.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/simulation/www/simplay/tasks.tcl 8 Jan 2004 16:02:34 -0000 1.5 +++ openacs-4/packages/simulation/www/simplay/tasks.tcl 12 Jan 2004 13:43:14 -0000 1.6 @@ -2,12 +2,13 @@ List of tasks 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] set title "Tasks" -set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "$simulation_name"] $title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "$simulation_name"] $title] set user_id [ad_conn user_id]