Index: openacs-4/contrib/packages/simulation/tcl/template-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/template-procs.tcl,v diff -u -r1.45 -r1.46 --- openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 13 Jan 2004 12:37:12 -0000 1.45 +++ openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 13 Jan 2004 12:45:09 -0000 1.46 @@ -405,56 +405,6 @@ } } -ad_proc -public simulation::template::ready_for_casting_p { - {-workflow_id ""} - {-role_empty_count ""} - {-prop_empty_count ""} -} { - Return 1 if the simulation is ready for casting and 0 otherwise. - Goes to the database if workflow_id is provided and uses the other - proc parameters otherwise to do the test. - - @param workflow_id The id of the simulation to check. The proc - will go to the database to get info about the simulation - if id is provided. - @param role_empty_count The number of empty roles for the simulation. Must be - provided if workflow_id is not. - @param prop_empty_count The number of empty properties for the simulation. Must be - provided if workflow_id is not. - - @author Peter Marklund -} { - if { ![empty_string_p $workflow_id] } { - # workflow_id provided - - set role_empty_count [db_string role_empty_count { - select count(*) - from sim_roles sr, - workflow_roles wr - where sr.role_id = wr.role_id - and wr.workflow_id = :workflow_id - and character_id is null - }] - - set prop_empty_count [db_string prop_empty_count { - select count(*) - from sim_task_object_map stom, - workflow_actions wa - where stom.task_id = wa.action_id - and wa.workflow_id = :workflow_id - and stom.object_id is null - }] - - } else { - # No workflow_id required - if { [empty_string_p $role_empty_count] || [empty_string_p $prop_empty_count] } { - error "When no workflow_id is provided you must provide role_empty_count and prop_empty_count" - } - } - - return [expr [string equal $role_empty_count 0] && [string equal $prop_empty_count 0]] -} - ad_proc -public simulation::template::associate_object { -template_id:required -object_id:required @@ -608,8 +558,6 @@ -object_id $sim_case_id \ -workflow_short_name $workflow_short_name] - ns_log Notice "pm debug sim_case_id=$sim_case_id case_id=$case_id" - # Assign users from the specified group for each role array unset row array set row [list] @@ -618,7 +566,6 @@ array set one_role $roles($role_id) set assignees [list] - ns_log Notice "pm debug case_id=$case_id before users_per_case loop with role_id=$role_id [array get one_role]" for { set i 0 } { $i < $one_role(users_per_case) } { incr i } { # Get user from random group mapped to role set group_id [lindex [util::randomize_list $one_role(parties)] 0] @@ -630,12 +577,10 @@ set group_members($group_id) [lreplace $group_members($group_id) 0 0] # Reduce the total_users count incr total_users -1 - ns_log Notice "pm debug case_id=$case_id group_id=$group_id - group has more users. appending [lindex $group_members($group_id) 0] to assignees. assignees=$assignees . Subtracting one from total users to $total_users" } else { # Current group exhausted, use current user lappend assignees [ad_conn user_id] # Don't add the admin more than once - ns_log Notice "pm debug case_id=$case_id group_id=$group_id - group has no more users, appending professor [ad_conn user_id]" break } } @@ -648,7 +593,6 @@ # set role($short_name) [lsort -unique $role($short_name)] #} - ns_log Notice "pm debug case_id=$case_id role::assign [array get row]" workflow::case::role::assign \ -case_id $case_id \ -array row \ @@ -877,6 +821,30 @@ return [array get tab_complete_p] } +ad_proc -public simulation::template::ready_for_casting_p { + {-workflow_id ""} + {-state ""} +} { + Return 1 if the template is ready for casting and 0 otherwise. + + @author Peter Marklund +} { + if { [empty_string_p $state] } { + set state [get_inst_state -workflow_id $workflow_id] + } + + array set state_array $state + + set incomplete_tabs_count 0 + foreach url [array names state_array] { + if { !$state_array($url) } { + incr incomplete_tabs_count + } + } + + return [expr $incomplete_tabs_count <= 1] +} + ad_proc -public simulation::template::get_wizard_tabs {} { Return a list with the url:s (page script names) of the pages in the instantiation wizard. @@ -888,7 +856,6 @@ map-characters map-tasks simulation-participants - participants_complete simulation-casting-3 } } @@ -902,21 +869,18 @@ } { array set state_array $state - ns_log Notice "pm debug state=$state" - array set states_pretty { simulation-edit "Not started" map-characters "Settings completed" map-tasks "Roles completed" simulation-participants "Tasks completed" participants_complete "Participants completed" - simulation-casting-3 "Casting begun" + simulation-casting-3 "Ready for casting" } set next_index 0 foreach url [get_wizard_tabs] { if { $state_array($url) } { - ns_log Notice "pm debug setting next_url $url" incr next_index } else { break Index: openacs-4/contrib/packages/simulation/www/siminst/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/index.tcl,v diff -u -r1.29 -r1.30 --- openacs-4/contrib/packages/simulation/www/siminst/index.tcl 13 Jan 2004 10:17:11 -0000 1.29 +++ openacs-4/contrib/packages/simulation/www/siminst/index.tcl 13 Jan 2004 12:45:09 -0000 1.30 @@ -74,22 +74,11 @@ workflow_roles wr where sr.role_id = wr.role_id and wr.workflow_id = w.workflow_id) as role_count, - (select count(*) - from sim_roles sr, - workflow_roles wr - where sr.role_id = wr.role_id - and wr.workflow_id = w.workflow_id - and character_id is null) as role_empty_count, (select sum(coalesce(attachment_num,0)) from sim_tasks st, workflow_actions wa where st.task_id = wa.action_id and wa.workflow_id = w.workflow_id) as prop_count, - (select count(*) - from sim_task_object_map stom, - workflow_actions wa - where stom.task_id = wa.action_id - and wa.workflow_id = w.workflow_id) as prop_not_empty_count, (select count(*) from workflow_actions wa where wa.workflow_id = w.workflow_id) as tasks @@ -103,17 +92,18 @@ $sim_in_dev_filter_sql " { set description [ad_html_text_convert -from $description_mime_type -maxlen 200 -- $description] - set prop_empty_count [expr $prop_count - $prop_not_empty_count] - if { [simulation::template::ready_for_casting_p -role_empty_count $role_empty_count -prop_empty_count $prop_empty_count] } { + + # TODO: getting the states here will not scale well (executes a handful queries for every template listed) + set state [simulation::template::get_inst_state -workflow_id $workflow_id] + + if { [simulation::template::ready_for_casting_p -state $state] } { set cast_url [export_vars -base "${base_url}siminst/simulation-casting" { workflow_id return_url {[ad_return_url]}}] } else { set cast_url "" } set map_roles_url [export_vars -base "${base_url}siminst/map-characters" { workflow_id }] set sim_tasks_url [export_vars -base "${base_url}siminst/map-tasks" { workflow_id }] set delete_url [export_vars -base "${base_url}siminst/simulation-delete" { workflow_id }] - # TODO: getting the states here will not scale well (executes a handful queries for every template listed) - set state [simulation::template::get_inst_state -workflow_id $workflow_id] set state_pretty [simulation::template::get_state_pretty -state $state] } Index: openacs-4/contrib/packages/simulation/www/siminst/map-tasks.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/map-tasks.adp,v diff -u -r1.10 -r1.11 --- openacs-4/contrib/packages/simulation/www/siminst/map-tasks.adp 7 Jan 2004 16:27:35 -0000 1.10 +++ openacs-4/contrib/packages/simulation/www/siminst/map-tasks.adp 13 Jan 2004 12:45:09 -0000 1.11 @@ -1 +1,8 @@ - + + +
Some of the tasks of this simulation require attachments. However, there are no CityBuild properties to select from. Someone needs to create properties in CityBuild.
+ +
+ + + \ No newline at end of file Index: openacs-4/contrib/packages/simulation/www/siminst/map-tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/map-tasks.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/contrib/packages/simulation/www/siminst/map-tasks.tcl 12 Jan 2004 11:35:33 -0000 1.10 +++ openacs-4/contrib/packages/simulation/www/siminst/map-tasks.tcl 13 Jan 2004 12:45:09 -0000 1.11 @@ -18,6 +18,9 @@ set prop_options [simulation::object::get_object_type_options -object_type "sim_prop" -null_label "--Not Yet Selected--"] +set prop_count [llength $prop_options] +set missing_props_p 0 + set actions [list] db_foreach tasks { @@ -61,8 +64,13 @@ {value $row(attachment_num)}]] for { set i 1 } { $i <= $row(attachment_num) } { incr i } { + if { $prop_count == "1" } { + set missing_props_p 1 + break + } + ad_form -extend -name tasks -form \ - [list [list attachment_$row(action_id)_$i:integer(select),optional \ + [list [list attachment_$row(action_id)_${i}:integer(select) \ {label "Attachment $i"} \ {options $prop_options} \ {help_text "Select from existing attachments or -
There are no participants selected, so casting is not yet possible. On the previous tab, please select participants or allow open enrollment.
+
There are no participants selected, so casting is not yet possible. On the previous tab, please select participants, or allow open enrollment on the first tab.

Each role may be played by one or by - many users. Each role can only be played by users in the group - specified below. If a group is not selected for any role, user + many users. Each role can only be played by users in the groups + specified below. If a group is not selected for any role, users in that group will not be cast in the simulation

+ +
You cannot submit this form until you have submitted all forms on the previous tabs.
+
+

In Automatic casting, only users from these groups will be assigned to the roles. All user @@ -48,31 +52,6 @@

- TODO: (2h) Make sure rule for checking each tab is correct -

- -

- TODO: (3h) put a warning next to the finish button for any incomplete - requirements, using the same tests we use to determine if tabs are - complete. Should include: - - Warnings: -

- - Don't show wizard button if any of these are true: - -

- -

- TODO: B: finish button should appear on every tab -

- -

TODO: (8h) make sure that we are generating all of the notifications that we should: Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-casting-3.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.tcl 13 Jan 2004 10:17:11 -0000 1.18 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.tcl 13 Jan 2004 12:45:09 -0000 1.19 @@ -24,7 +24,7 @@ {help_text "If participants have not selected groups or roles by the simulation start time, they are automatically assigned."} } -if { [string equal $sim_template(enroll_type) "closed"] } { +if { [string equal $sim_template(enroll_type) "closed"] || [empty_string_p $sim_template(enroll_type)] } { # Closed enrollment so offer only invited or auto_enroll groups set eligible_groups [simulation::casting_groups -mapped_only -workflow_id $workflow_id] } else { @@ -34,6 +34,10 @@ set num_groups [llength $eligible_groups] +if { $num_groups == "0" } { + return +} + foreach role_id [workflow::get_roles -workflow_id $workflow_id] { set role_${role_id}_pretty_name [workflow::role::get_element -role_id $role_id -element pretty_name] @@ -121,7 +125,7 @@ template::form::set_error actors parties_$role_id "At least one group must be selected for each role" set error_p 1 } - } + } if { $error_p } { break } @@ -143,7 +147,32 @@ -parties [set parties_$role_id] \ } } + + set uncast_mapped_groups [db_list uncast_mapped_groups_count " + select g.group_name + from sim_party_sim_map spsm, + groups g + where spsm.simulation_id = :workflow_id + and g.group_id = spsm.party_id + and not exists (select 1 + from sim_role_party_map srpm, + workflow_roles wr + where srpm.role_id = wr.role_id + and wr.workflow_id = :workflow_id + and srpm.party_id = spsm.party_id + ) + "] + if { [llength $uncast_mapped_groups] > 0 } { + template::form::set_error actors parties_$role_id "The following groups are not mapped to any roles: [join $uncast_mapped_groups ", "]." + break + } + wizard forward } -wizard submit actors -buttons { back next finish } +set all_tabs_complete_p [simulation::template::ready_for_casting_p -workflow_id $workflow_id] +if { $all_tabs_complete_p } { + wizard submit actors -buttons { back next finish } +} else { + wizard submit actors -buttons { back next } +} Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-casting.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-casting.adp,v diff -u -r1.7 -r1.8 --- openacs-4/contrib/packages/simulation/www/siminst/simulation-casting.adp 15 Dec 2003 13:40:22 -0000 1.7 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-casting.adp 13 Jan 2004 12:45:09 -0000 1.8 @@ -2,4 +2,4 @@ @page_title;noquote@ @context;noquote@ -The template \"@simulation.pretty_name@\" is not ready for casting as it has unmapped roles or properties. +The template "@simulation.pretty_name@" is not ready for casting. Index: openacs-4/contrib/packages/simulation/www/siminst/wizard.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/wizard.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/contrib/packages/simulation/www/siminst/wizard.tcl 13 Jan 2004 10:17:11 -0000 1.11 +++ openacs-4/contrib/packages/simulation/www/siminst/wizard.tcl 13 Jan 2004 12:45:09 -0000 1.12 @@ -34,20 +34,24 @@ set lowest_available 1 set highest_available 5 -wizard get_current_step -start $highest_available +# Set information about which tabs are complete +array set tab_complete_p [simulation::template::get_inst_state -workflow_id $workflow_id] +multirow extend wizard complete_p +set lowest_incomplete_index -1 +set index 1 +multirow -local foreach wizard { + set complete_p $tab_complete_p($url) + if { !$complete_p && $lowest_incomplete_index == "-1"} { + set lowest_incomplete_index $index + } + + incr index +} +wizard get_current_step -start $lowest_incomplete_index + set sub_title $title(${wizard:current_id}) workflow::get -workflow_id $workflow_id -array workflow set page_title "$workflow(pretty_name)" set context [list [list "." "SimInst"] $page_title] - -array set tab_complete_p [simulation::template::get_inst_state -workflow_id $workflow_id] - -multirow extend wizard complete_p - -multirow create test_multi col1 col2 col3 - -multirow -local foreach wizard { - set complete_p $tab_complete_p($url) -} Index: openacs-4/packages/simulation/tcl/template-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/template-procs.tcl,v diff -u -r1.45 -r1.46 --- openacs-4/packages/simulation/tcl/template-procs.tcl 13 Jan 2004 12:37:12 -0000 1.45 +++ openacs-4/packages/simulation/tcl/template-procs.tcl 13 Jan 2004 12:45:09 -0000 1.46 @@ -405,56 +405,6 @@ } } -ad_proc -public simulation::template::ready_for_casting_p { - {-workflow_id ""} - {-role_empty_count ""} - {-prop_empty_count ""} -} { - Return 1 if the simulation is ready for casting and 0 otherwise. - Goes to the database if workflow_id is provided and uses the other - proc parameters otherwise to do the test. - - @param workflow_id The id of the simulation to check. The proc - will go to the database to get info about the simulation - if id is provided. - @param role_empty_count The number of empty roles for the simulation. Must be - provided if workflow_id is not. - @param prop_empty_count The number of empty properties for the simulation. Must be - provided if workflow_id is not. - - @author Peter Marklund -} { - if { ![empty_string_p $workflow_id] } { - # workflow_id provided - - set role_empty_count [db_string role_empty_count { - select count(*) - from sim_roles sr, - workflow_roles wr - where sr.role_id = wr.role_id - and wr.workflow_id = :workflow_id - and character_id is null - }] - - set prop_empty_count [db_string prop_empty_count { - select count(*) - from sim_task_object_map stom, - workflow_actions wa - where stom.task_id = wa.action_id - and wa.workflow_id = :workflow_id - and stom.object_id is null - }] - - } else { - # No workflow_id required - if { [empty_string_p $role_empty_count] || [empty_string_p $prop_empty_count] } { - error "When no workflow_id is provided you must provide role_empty_count and prop_empty_count" - } - } - - return [expr [string equal $role_empty_count 0] && [string equal $prop_empty_count 0]] -} - ad_proc -public simulation::template::associate_object { -template_id:required -object_id:required @@ -608,8 +558,6 @@ -object_id $sim_case_id \ -workflow_short_name $workflow_short_name] - ns_log Notice "pm debug sim_case_id=$sim_case_id case_id=$case_id" - # Assign users from the specified group for each role array unset row array set row [list] @@ -618,7 +566,6 @@ array set one_role $roles($role_id) set assignees [list] - ns_log Notice "pm debug case_id=$case_id before users_per_case loop with role_id=$role_id [array get one_role]" for { set i 0 } { $i < $one_role(users_per_case) } { incr i } { # Get user from random group mapped to role set group_id [lindex [util::randomize_list $one_role(parties)] 0] @@ -630,12 +577,10 @@ set group_members($group_id) [lreplace $group_members($group_id) 0 0] # Reduce the total_users count incr total_users -1 - ns_log Notice "pm debug case_id=$case_id group_id=$group_id - group has more users. appending [lindex $group_members($group_id) 0] to assignees. assignees=$assignees . Subtracting one from total users to $total_users" } else { # Current group exhausted, use current user lappend assignees [ad_conn user_id] # Don't add the admin more than once - ns_log Notice "pm debug case_id=$case_id group_id=$group_id - group has no more users, appending professor [ad_conn user_id]" break } } @@ -648,7 +593,6 @@ # set role($short_name) [lsort -unique $role($short_name)] #} - ns_log Notice "pm debug case_id=$case_id role::assign [array get row]" workflow::case::role::assign \ -case_id $case_id \ -array row \ @@ -877,6 +821,30 @@ return [array get tab_complete_p] } +ad_proc -public simulation::template::ready_for_casting_p { + {-workflow_id ""} + {-state ""} +} { + Return 1 if the template is ready for casting and 0 otherwise. + + @author Peter Marklund +} { + if { [empty_string_p $state] } { + set state [get_inst_state -workflow_id $workflow_id] + } + + array set state_array $state + + set incomplete_tabs_count 0 + foreach url [array names state_array] { + if { !$state_array($url) } { + incr incomplete_tabs_count + } + } + + return [expr $incomplete_tabs_count <= 1] +} + ad_proc -public simulation::template::get_wizard_tabs {} { Return a list with the url:s (page script names) of the pages in the instantiation wizard. @@ -888,7 +856,6 @@ map-characters map-tasks simulation-participants - participants_complete simulation-casting-3 } } @@ -902,21 +869,18 @@ } { array set state_array $state - ns_log Notice "pm debug state=$state" - array set states_pretty { simulation-edit "Not started" map-characters "Settings completed" map-tasks "Roles completed" simulation-participants "Tasks completed" participants_complete "Participants completed" - simulation-casting-3 "Casting begun" + simulation-casting-3 "Ready for casting" } set next_index 0 foreach url [get_wizard_tabs] { if { $state_array($url) } { - ns_log Notice "pm debug setting next_url $url" incr next_index } else { break Index: openacs-4/packages/simulation/www/siminst/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/index.tcl,v diff -u -r1.29 -r1.30 --- openacs-4/packages/simulation/www/siminst/index.tcl 13 Jan 2004 10:17:11 -0000 1.29 +++ openacs-4/packages/simulation/www/siminst/index.tcl 13 Jan 2004 12:45:09 -0000 1.30 @@ -74,22 +74,11 @@ workflow_roles wr where sr.role_id = wr.role_id and wr.workflow_id = w.workflow_id) as role_count, - (select count(*) - from sim_roles sr, - workflow_roles wr - where sr.role_id = wr.role_id - and wr.workflow_id = w.workflow_id - and character_id is null) as role_empty_count, (select sum(coalesce(attachment_num,0)) from sim_tasks st, workflow_actions wa where st.task_id = wa.action_id and wa.workflow_id = w.workflow_id) as prop_count, - (select count(*) - from sim_task_object_map stom, - workflow_actions wa - where stom.task_id = wa.action_id - and wa.workflow_id = w.workflow_id) as prop_not_empty_count, (select count(*) from workflow_actions wa where wa.workflow_id = w.workflow_id) as tasks @@ -103,17 +92,18 @@ $sim_in_dev_filter_sql " { set description [ad_html_text_convert -from $description_mime_type -maxlen 200 -- $description] - set prop_empty_count [expr $prop_count - $prop_not_empty_count] - if { [simulation::template::ready_for_casting_p -role_empty_count $role_empty_count -prop_empty_count $prop_empty_count] } { + + # TODO: getting the states here will not scale well (executes a handful queries for every template listed) + set state [simulation::template::get_inst_state -workflow_id $workflow_id] + + if { [simulation::template::ready_for_casting_p -state $state] } { set cast_url [export_vars -base "${base_url}siminst/simulation-casting" { workflow_id return_url {[ad_return_url]}}] } else { set cast_url "" } set map_roles_url [export_vars -base "${base_url}siminst/map-characters" { workflow_id }] set sim_tasks_url [export_vars -base "${base_url}siminst/map-tasks" { workflow_id }] set delete_url [export_vars -base "${base_url}siminst/simulation-delete" { workflow_id }] - # TODO: getting the states here will not scale well (executes a handful queries for every template listed) - set state [simulation::template::get_inst_state -workflow_id $workflow_id] set state_pretty [simulation::template::get_state_pretty -state $state] } Index: openacs-4/packages/simulation/www/siminst/map-tasks.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/map-tasks.adp,v diff -u -r1.10 -r1.11 --- openacs-4/packages/simulation/www/siminst/map-tasks.adp 7 Jan 2004 16:27:35 -0000 1.10 +++ openacs-4/packages/simulation/www/siminst/map-tasks.adp 13 Jan 2004 12:45:09 -0000 1.11 @@ -1 +1,8 @@ - + + +

Some of the tasks of this simulation require attachments. However, there are no CityBuild properties to select from. Someone needs to create properties in CityBuild.
+ + + + + \ No newline at end of file Index: openacs-4/packages/simulation/www/siminst/map-tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/map-tasks.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/simulation/www/siminst/map-tasks.tcl 12 Jan 2004 11:35:33 -0000 1.10 +++ openacs-4/packages/simulation/www/siminst/map-tasks.tcl 13 Jan 2004 12:45:09 -0000 1.11 @@ -18,6 +18,9 @@ set prop_options [simulation::object::get_object_type_options -object_type "sim_prop" -null_label "--Not Yet Selected--"] +set prop_count [llength $prop_options] +set missing_props_p 0 + set actions [list] db_foreach tasks { @@ -61,8 +64,13 @@ {value $row(attachment_num)}]] for { set i 1 } { $i <= $row(attachment_num) } { incr i } { + if { $prop_count == "1" } { + set missing_props_p 1 + break + } + ad_form -extend -name tasks -form \ - [list [list attachment_$row(action_id)_$i:integer(select),optional \ + [list [list attachment_$row(action_id)_${i}:integer(select) \ {label "Attachment $i"} \ {options $prop_options} \ {help_text "Select from existing attachments or
-
There are no participants selected, so casting is not yet possible. On the previous tab, please select participants or allow open enrollment.
+
There are no participants selected, so casting is not yet possible. On the previous tab, please select participants, or allow open enrollment on the first tab.

Each role may be played by one or by - many users. Each role can only be played by users in the group - specified below. If a group is not selected for any role, user + many users. Each role can only be played by users in the groups + specified below. If a group is not selected for any role, users in that group will not be cast in the simulation

+ +
You cannot submit this form until you have submitted all forms on the previous tabs.
+
+

In Automatic casting, only users from these groups will be assigned to the roles. All user @@ -48,31 +52,6 @@

- TODO: (2h) Make sure rule for checking each tab is correct -

- -

- TODO: (3h) put a warning next to the finish button for any incomplete - requirements, using the same tests we use to determine if tabs are - complete. Should include: - - Warnings: -

- - Don't show wizard button if any of these are true: - -

- -

- TODO: B: finish button should appear on every tab -

- -

TODO: (8h) make sure that we are generating all of the notifications that we should: Index: openacs-4/packages/simulation/www/siminst/simulation-casting-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-casting-3.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/simulation/www/siminst/simulation-casting-3.tcl 13 Jan 2004 10:17:11 -0000 1.18 +++ openacs-4/packages/simulation/www/siminst/simulation-casting-3.tcl 13 Jan 2004 12:45:09 -0000 1.19 @@ -24,7 +24,7 @@ {help_text "If participants have not selected groups or roles by the simulation start time, they are automatically assigned."} } -if { [string equal $sim_template(enroll_type) "closed"] } { +if { [string equal $sim_template(enroll_type) "closed"] || [empty_string_p $sim_template(enroll_type)] } { # Closed enrollment so offer only invited or auto_enroll groups set eligible_groups [simulation::casting_groups -mapped_only -workflow_id $workflow_id] } else { @@ -34,6 +34,10 @@ set num_groups [llength $eligible_groups] +if { $num_groups == "0" } { + return +} + foreach role_id [workflow::get_roles -workflow_id $workflow_id] { set role_${role_id}_pretty_name [workflow::role::get_element -role_id $role_id -element pretty_name] @@ -121,7 +125,7 @@ template::form::set_error actors parties_$role_id "At least one group must be selected for each role" set error_p 1 } - } + } if { $error_p } { break } @@ -143,7 +147,32 @@ -parties [set parties_$role_id] \ } } + + set uncast_mapped_groups [db_list uncast_mapped_groups_count " + select g.group_name + from sim_party_sim_map spsm, + groups g + where spsm.simulation_id = :workflow_id + and g.group_id = spsm.party_id + and not exists (select 1 + from sim_role_party_map srpm, + workflow_roles wr + where srpm.role_id = wr.role_id + and wr.workflow_id = :workflow_id + and srpm.party_id = spsm.party_id + ) + "] + if { [llength $uncast_mapped_groups] > 0 } { + template::form::set_error actors parties_$role_id "The following groups are not mapped to any roles: [join $uncast_mapped_groups ", "]." + break + } + wizard forward } -wizard submit actors -buttons { back next finish } +set all_tabs_complete_p [simulation::template::ready_for_casting_p -workflow_id $workflow_id] +if { $all_tabs_complete_p } { + wizard submit actors -buttons { back next finish } +} else { + wizard submit actors -buttons { back next } +} Index: openacs-4/packages/simulation/www/siminst/simulation-casting.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-casting.adp,v diff -u -r1.7 -r1.8 --- openacs-4/packages/simulation/www/siminst/simulation-casting.adp 15 Dec 2003 13:40:22 -0000 1.7 +++ openacs-4/packages/simulation/www/siminst/simulation-casting.adp 13 Jan 2004 12:45:09 -0000 1.8 @@ -2,4 +2,4 @@ @page_title;noquote@ @context;noquote@ -The template \"@simulation.pretty_name@\" is not ready for casting as it has unmapped roles or properties. +The template "@simulation.pretty_name@" is not ready for casting. Index: openacs-4/packages/simulation/www/siminst/wizard.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/wizard.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/simulation/www/siminst/wizard.tcl 13 Jan 2004 10:17:11 -0000 1.11 +++ openacs-4/packages/simulation/www/siminst/wizard.tcl 13 Jan 2004 12:45:09 -0000 1.12 @@ -34,20 +34,24 @@ set lowest_available 1 set highest_available 5 -wizard get_current_step -start $highest_available +# Set information about which tabs are complete +array set tab_complete_p [simulation::template::get_inst_state -workflow_id $workflow_id] +multirow extend wizard complete_p +set lowest_incomplete_index -1 +set index 1 +multirow -local foreach wizard { + set complete_p $tab_complete_p($url) + if { !$complete_p && $lowest_incomplete_index == "-1"} { + set lowest_incomplete_index $index + } + + incr index +} +wizard get_current_step -start $lowest_incomplete_index + set sub_title $title(${wizard:current_id}) workflow::get -workflow_id $workflow_id -array workflow set page_title "$workflow(pretty_name)" set context [list [list "." "SimInst"] $page_title] - -array set tab_complete_p [simulation::template::get_inst_state -workflow_id $workflow_id] - -multirow extend wizard complete_p - -multirow create test_multi col1 col2 col3 - -multirow -local foreach wizard { - set complete_p $tab_complete_p($url) -}