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.2 -r1.3 --- openacs-4/contrib/packages/simulation/lib/portfolio.tcl 19 Dec 2003 14:48:30 -0000 1.2 +++ openacs-4/contrib/packages/simulation/lib/portfolio.tcl 5 Jan 2004 12:33:41 -0000 1.3 @@ -10,6 +10,12 @@ set upload_url [export_vars -base document-upload { case_id }] +if { [exists_and_not_null case_id] } { + set user_roles [workflow::case::get_user_roles -case_id $case_id] +} else { + set user_roles [list] +} + template::list::create \ -name documents \ -multirow documents \ @@ -18,6 +24,7 @@ -elements { role_name { label "Role" + hide_p {[ad_decode [llength $user_roles] 1 1 0]} } document_title { label "Document" 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.5 -r1.6 --- openacs-4/contrib/packages/simulation/www/simplay/control-bar.adp 19 Dec 2003 14:00:39 -0000 1.5 +++ openacs-4/contrib/packages/simulation/www/simplay/control-bar.adp 5 Jan 2004 12:33:41 -0000 1.6 @@ -1,6 +1,18 @@ +

Your Options

+ + +

Your Roles

+ + + + 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.7 -r1.8 --- openacs-4/contrib/packages/simulation/www/simplay/control-bar.tcl 19 Dec 2003 14:52:21 -0000 1.7 +++ openacs-4/contrib/packages/simulation/www/simplay/control-bar.tcl 5 Jan 2004 12:33:41 -0000 1.8 @@ -34,16 +34,24 @@ 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 wcrmp, + workflow_case_role_party_map wcrpm, workflow_actions wa, party_approved_member_map pamm where pamm.member_id = :user_id - and wcrmp.party_id = pamm.party_id - and wcrmp.case_id = wcea.case_id - and wcrmp.role_id = wa.assigned_role + and wcrpm.party_id = pamm.party_id + and wcrpm.case_id = wcea.case_id + and wcrpm.role_id = wa.assigned_role and wa.action_id = wcea.action_id and wcea.enabled_state = 'enabled' [ad_decode $case_id "" "" "and wcea.case_id = :case_id"] "] set tasks_url [export_vars -base ${section_uri}tasks { case_id }] + +multirow create roles role_id short_name pretty_name + +foreach role_id [workflow::case::get_user_roles -case_id $case_id] { + array unset role + workflow::role::get -role_id $role_id -array role + multirow append roles $role(role_id) $role(short_name) $role(pretty_name) +} Index: openacs-4/contrib/packages/simulation/www/simplay/document-upload.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/document-upload.adp,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/simplay/document-upload.adp 19 Dec 2003 14:48:30 -0000 1.1 +++ openacs-4/contrib/packages/simulation/www/simplay/document-upload.adp 5 Jan 2004 12:33:41 -0000 1.2 @@ -1,5 +1,6 @@ @page_title;noquote@ @context;noquote@ + @focus;noquote@ 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.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/simplay/document-upload.tcl 19 Dec 2003 14:48:30 -0000 1.1 +++ openacs-4/contrib/packages/simulation/www/simplay/document-upload.tcl 5 Jan 2004 12:33:41 -0000 1.2 @@ -8,18 +8,35 @@ } set page_title "Upload new document to portfolio" -set context [list [list . "SimPlay"] $page_title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "Case"] $page_title] -# TODO: should there be a workflow::case::get_workflow_id? -set workflow_id [workflow::case::fsm::get_element -case_id $case_id -element workflow_id] +set workflow_id [workflow::case::get_element -case_id $case_id -element workflow_id] +# TODO: Only pick from roles the current user is playing in this case +# TODO: If only one role, hide the role select widget + +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] +} + ad_form -name document -export { case_id workflow_id } -html {enctype multipart/form-data} -form { {item_id:key} +} - {role_short_name:text(select) - {label "Role"} - {options {[workflow::role::get_options -workflow_id $workflow_id]}} +if { [llength $role_options] > 1 } { + ad_form -extend -name document -form { + {role_id:text(select) + {label "Role"} + {options $role_options} + } } + set focus "document.role_id" +} else { + set focus "document.document_file" +} + +ad_form -extend -name document -form { {document_file:file(file) {label "Document file"} } @@ -64,7 +81,9 @@ -revision_id $revision_id \ -status "live" - set role_id [workflow::role::get_id -short_name $role_short_name -workflow_id $workflow_id] + if { ![exists_and_not_null role_id] } { + set role_id [lindex [lindex $role_options 0] 1] + } # TODO: Tcl proc? # TODO: what should relation_tag be? 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.12 -r1.13 --- openacs-4/contrib/packages/simulation/www/simplay/index.adp 5 Jan 2004 10:58:30 -0000 1.12 +++ openacs-4/contrib/packages/simulation/www/simplay/index.adp 5 Jan 2004 12:33:41 -0000 1.13 @@ -10,11 +10,16 @@

+

All Messages

+

+

All Tasks

+ +

TODO: how can a player access completed cases?

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.3 -r1.4 --- openacs-4/contrib/packages/simulation/www/simplay/message.tcl 19 Dec 2003 14:53:07 -0000 1.3 +++ openacs-4/contrib/packages/simulation/www/simplay/message.tcl 5 Jan 2004 12:33:41 -0000 1.4 @@ -1,5 +1,8 @@ ad_page_contract { Create or edit a message. +} { + case_id:optional + recipient_id:optional } # TODO: task recipient_id as an optional input parameter @@ -8,5 +11,3 @@ set context [list [list "." "SimPlay"] [list $page_title] ] set package_id [ad_conn package_id] - -# TODO: Pass case_id to master template so the control-bar is right 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.3 -r1.4 --- openacs-4/contrib/packages/simulation/www/simplay/play-master.adp 19 Dec 2003 14:00:39 -0000 1.3 +++ openacs-4/contrib/packages/simulation/www/simplay/play-master.adp 5 Jan 2004 12:33:41 -0000 1.4 @@ -5,7 +5,7 @@ -
+ Index: openacs-4/packages/simulation/lib/portfolio.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/portfolio.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/simulation/lib/portfolio.tcl 19 Dec 2003 14:48:30 -0000 1.2 +++ openacs-4/packages/simulation/lib/portfolio.tcl 5 Jan 2004 12:33:41 -0000 1.3 @@ -10,6 +10,12 @@ set upload_url [export_vars -base document-upload { case_id }] +if { [exists_and_not_null case_id] } { + set user_roles [workflow::case::get_user_roles -case_id $case_id] +} else { + set user_roles [list] +} + template::list::create \ -name documents \ -multirow documents \ @@ -18,6 +24,7 @@ -elements { role_name { label "Role" + hide_p {[ad_decode [llength $user_roles] 1 1 0]} } document_title { label "Document" 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.5 -r1.6 --- openacs-4/packages/simulation/www/simplay/control-bar.adp 19 Dec 2003 14:00:39 -0000 1.5 +++ openacs-4/packages/simulation/www/simplay/control-bar.adp 5 Jan 2004 12:33:41 -0000 1.6 @@ -1,6 +1,18 @@ +

Your Options

+ + +

Your Roles

+ +
    + +
  • @roles.pretty_name@
  • +
    +
+ + 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.7 -r1.8 --- openacs-4/packages/simulation/www/simplay/control-bar.tcl 19 Dec 2003 14:52:21 -0000 1.7 +++ openacs-4/packages/simulation/www/simplay/control-bar.tcl 5 Jan 2004 12:33:41 -0000 1.8 @@ -34,16 +34,24 @@ 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 wcrmp, + workflow_case_role_party_map wcrpm, workflow_actions wa, party_approved_member_map pamm where pamm.member_id = :user_id - and wcrmp.party_id = pamm.party_id - and wcrmp.case_id = wcea.case_id - and wcrmp.role_id = wa.assigned_role + and wcrpm.party_id = pamm.party_id + and wcrpm.case_id = wcea.case_id + and wcrpm.role_id = wa.assigned_role and wa.action_id = wcea.action_id and wcea.enabled_state = 'enabled' [ad_decode $case_id "" "" "and wcea.case_id = :case_id"] "] set tasks_url [export_vars -base ${section_uri}tasks { case_id }] + +multirow create roles role_id short_name pretty_name + +foreach role_id [workflow::case::get_user_roles -case_id $case_id] { + array unset role + workflow::role::get -role_id $role_id -array role + multirow append roles $role(role_id) $role(short_name) $role(pretty_name) +} Index: openacs-4/packages/simulation/www/simplay/document-upload.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/document-upload.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/www/simplay/document-upload.adp 19 Dec 2003 14:48:30 -0000 1.1 +++ openacs-4/packages/simulation/www/simplay/document-upload.adp 5 Jan 2004 12:33:41 -0000 1.2 @@ -1,5 +1,6 @@ @page_title;noquote@ @context;noquote@ + @focus;noquote@ 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.1 -r1.2 --- openacs-4/packages/simulation/www/simplay/document-upload.tcl 19 Dec 2003 14:48:30 -0000 1.1 +++ openacs-4/packages/simulation/www/simplay/document-upload.tcl 5 Jan 2004 12:33:41 -0000 1.2 @@ -8,18 +8,35 @@ } set page_title "Upload new document to portfolio" -set context [list [list . "SimPlay"] $page_title] +set context [list [list . "SimPlay"] [list [export_vars -base case { case_id }] "Case"] $page_title] -# TODO: should there be a workflow::case::get_workflow_id? -set workflow_id [workflow::case::fsm::get_element -case_id $case_id -element workflow_id] +set workflow_id [workflow::case::get_element -case_id $case_id -element workflow_id] +# TODO: Only pick from roles the current user is playing in this case +# TODO: If only one role, hide the role select widget + +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] +} + ad_form -name document -export { case_id workflow_id } -html {enctype multipart/form-data} -form { {item_id:key} +} - {role_short_name:text(select) - {label "Role"} - {options {[workflow::role::get_options -workflow_id $workflow_id]}} +if { [llength $role_options] > 1 } { + ad_form -extend -name document -form { + {role_id:text(select) + {label "Role"} + {options $role_options} + } } + set focus "document.role_id" +} else { + set focus "document.document_file" +} + +ad_form -extend -name document -form { {document_file:file(file) {label "Document file"} } @@ -64,7 +81,9 @@ -revision_id $revision_id \ -status "live" - set role_id [workflow::role::get_id -short_name $role_short_name -workflow_id $workflow_id] + if { ![exists_and_not_null role_id] } { + set role_id [lindex [lindex $role_options 0] 1] + } # TODO: Tcl proc? # TODO: what should relation_tag be? 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.12 -r1.13 --- openacs-4/packages/simulation/www/simplay/index.adp 5 Jan 2004 10:58:30 -0000 1.12 +++ openacs-4/packages/simulation/www/simplay/index.adp 5 Jan 2004 12:33:41 -0000 1.13 @@ -10,11 +10,16 @@

+

All Messages

+

+

All Tasks

+ +

TODO: how can a player access completed cases?

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.3 -r1.4 --- openacs-4/packages/simulation/www/simplay/message.tcl 19 Dec 2003 14:53:07 -0000 1.3 +++ openacs-4/packages/simulation/www/simplay/message.tcl 5 Jan 2004 12:33:41 -0000 1.4 @@ -1,5 +1,8 @@ ad_page_contract { Create or edit a message. +} { + case_id:optional + recipient_id:optional } # TODO: task recipient_id as an optional input parameter @@ -8,5 +11,3 @@ set context [list [list "." "SimPlay"] [list $page_title] ] set package_id [ad_conn package_id] - -# TODO: Pass case_id to master template so the control-bar is right 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.3 -r1.4 --- openacs-4/packages/simulation/www/simplay/play-master.adp 19 Dec 2003 14:00:39 -0000 1.3 +++ openacs-4/packages/simulation/www/simplay/play-master.adp 5 Jan 2004 12:33:41 -0000 1.4 @@ -5,7 +5,7 @@ -
+