+TODO: get desired layout, see below: +
+ +Role | Actor(s) | In groups of |
---|---|---|
Plaintiff | ++ | ++ + | +
Defendent | ++ | ++ | +
Judge | ++ | ++ | +
+ Instantiate +
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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.tcl 16 Dec 2003 16:00:34 -0000 1.1 @@ -0,0 +1,68 @@ +ad_page_contract { + The page where actors are chosen for the different + roles of a simulation. Part of the casting step + in the instantiation process. + + @author Peter Marklund +} { + workflow_id:integer +} + +set page_title "Choose actors" +set context [list [list "." "SimInst"] $page_title] + +# Loop over all workflow roles and append the actor and "in groups of" widgets to the form +set form [list] + +set eligible_groups [simulation::groups_eligible_for_casting] + +foreach role_id [workflow::get_roles -workflow_id $workflow_id] { + set role_pretty_name [workflow::role::get_element -role_id $role_id -element pretty_name] + lappend form [list actor_${role_id}:text(select) \ + [list label $role_pretty_name] \ + [list options $eligible_groups] + ] + lappend form [list group_${role_id}:integer [list label "In groups of"] [list value 1]] +} + +ad_form \ + -name actors \ + -export { workflow_id } \ + -form $form \ + -on_request { + db_foreach select_group_mappings { + select role_id, + party_id, + group_size + from sim_role_group_map + where role_id in (select role_id + from workflow_roles + where workflow_id = :workflow_id + ) + } { + element set_properties actors actor_${role_id} -value $party_id + element set_properties actors group_${role_id} -value $group_size + } + } -on_submit { + + # TODO: move this code into the simulation::template::edit proc? Low priority. + + # Clear out old mappings + db_dml clear_old_group_mappings { + delete from sim_role_group_map + where role_id in (select role_id + from workflow_roles + where workflow_id = :workflow_id + ) + } + + foreach role_id [workflow::get_roles -workflow_id $workflow_id] { + simulation::template::map_group_to_role \ + -role_id $role_id \ + -group_id [set actor_$role_id] \ + -group_size [set group_$role_id] + } + + ad_returnredirect . + ad_script_abort + } Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-start.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-start.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-start.tcl 16 Dec 2003 16:00:34 -0000 1.1 @@ -0,0 +1,12 @@ +ad_page_contract { + Start a simulation immediately and redirect + to simplay. + + @author Peter Marklund +} { + workflow_id:integer +} + +#simulation::start -workflow_id $workflow_id + +ad_returnredirect "../simplay" 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.18 -r1.19 --- openacs-4/packages/simulation/www/siminst/index.tcl 16 Dec 2003 12:48:31 -0000 1.18 +++ openacs-4/packages/simulation/www/siminst/index.tcl 16 Dec 2003 16:00:34 -0000 1.19 @@ -133,12 +133,11 @@ label "Simulation" orderby upper(w.pretty_name) } - enroll_type { - label "Enrollment Type" + groups { + display_template { + Edit groups + } } - casting_type { - label "Casting Type" - } n_users { label "Users enrolled" } @@ -157,6 +156,11 @@ Copy } } + start_now { + display_template { + Start immediately + } + } } # if admin, show all. otherwise, filter @@ -166,11 +170,9 @@ set sim_in_dev_filter_sql "and ao.creation_user = :user_id" } -db_multirow -extend { edit_url delete_url edit_p } casting_sims select_casting_sims " +db_multirow -extend { edit_url delete_url start_url groups_url } casting_sims select_casting_sims " select w.workflow_id, w.pretty_name, - ss.enroll_type, - ss.casting_type, (select count(*) from sim_party_sim_map spsm, party_approved_member_map pamm, @@ -191,4 +193,6 @@ " { set edit_url [export_vars -base "${base_url}siminst/simulation-casting-2" { workflow_id }] set delete_url [export_vars -base "${base_url}siminst/simulation-delete" { workflow_id }] + set start_url [export_vars -base "simulation-start" { workflow_id }] + set groups_url [export_vars -base "simulation-casting-3" { workflow_id }] } Index: openacs-4/packages/simulation/www/siminst/simulation-casting-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/Attic/simulation-casting-2.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/simulation/www/siminst/simulation-casting-2.tcl 16 Dec 2003 11:34:33 -0000 1.6 +++ openacs-4/packages/simulation/www/siminst/simulation-casting-2.tcl 16 Dec 2003 16:00:34 -0000 1.7 @@ -21,6 +21,8 @@ set in_three_months_date [clock format [expr [clock seconds] + 3*3600*24*31] -format "%Y %m %d"] set in_four_months_date [clock format [expr [clock seconds] + 4*3600*24*31] -format "%Y %m %d"] +set eligible_groups [simulation::groups_eligible_for_casting] + ad_form -export { workflow_id } -name simulation -form { {enroll_start:date,optional {label "Enrollment start date"} @@ -54,12 +56,12 @@ } {enroll_groups:integer(checkbox),multiple,optional {label "Enroll all users in these groups"} - {options {[simulation::groups_eligible_for_casting]}} + {options $eligible_groups} {help_text {Use Group Administration to add groups}} } {invite_groups:integer(checkbox),multiple,optional - {label "Invite all users in these groups"} - {options {[simulation::groups_eligible_for_casting]}} + {label "Invite all users in these groups (mockup only)"} + {options $eligible_groups} {help_text {Use Group Administration to add groups}} } } -on_request { @@ -80,8 +82,9 @@ set sim_template(case_end) $case_end_ansi set sim_template(enroll_type) $enroll_type set sim_template(casting_type) $casting_type - set sim_template(enroll_groups) $enroll_groups - set sim_template(invite_gropus) $invite_groups + set sim_template(auto-enroll) $enroll_groups + # TODO: + #set sim_template(invite_gropus) $invite_groups simulation::template::edit \ -workflow_id $workflow_id \ Index: openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp 16 Dec 2003 16:00:34 -0000 1.1 @@ -0,0 +1,54 @@ ++TODO: get desired layout, see below: +
+ +Role | Actor(s) | In groups of |
---|---|---|
Plaintiff | ++ | ++ + | +
Defendent | ++ | ++ | +
Judge | ++ | ++ | +
+ Instantiate +
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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/siminst/simulation-casting-3.tcl 16 Dec 2003 16:00:34 -0000 1.1 @@ -0,0 +1,68 @@ +ad_page_contract { + The page where actors are chosen for the different + roles of a simulation. Part of the casting step + in the instantiation process. + + @author Peter Marklund +} { + workflow_id:integer +} + +set page_title "Choose actors" +set context [list [list "." "SimInst"] $page_title] + +# Loop over all workflow roles and append the actor and "in groups of" widgets to the form +set form [list] + +set eligible_groups [simulation::groups_eligible_for_casting] + +foreach role_id [workflow::get_roles -workflow_id $workflow_id] { + set role_pretty_name [workflow::role::get_element -role_id $role_id -element pretty_name] + lappend form [list actor_${role_id}:text(select) \ + [list label $role_pretty_name] \ + [list options $eligible_groups] + ] + lappend form [list group_${role_id}:integer [list label "In groups of"] [list value 1]] +} + +ad_form \ + -name actors \ + -export { workflow_id } \ + -form $form \ + -on_request { + db_foreach select_group_mappings { + select role_id, + party_id, + group_size + from sim_role_group_map + where role_id in (select role_id + from workflow_roles + where workflow_id = :workflow_id + ) + } { + element set_properties actors actor_${role_id} -value $party_id + element set_properties actors group_${role_id} -value $group_size + } + } -on_submit { + + # TODO: move this code into the simulation::template::edit proc? Low priority. + + # Clear out old mappings + db_dml clear_old_group_mappings { + delete from sim_role_group_map + where role_id in (select role_id + from workflow_roles + where workflow_id = :workflow_id + ) + } + + foreach role_id [workflow::get_roles -workflow_id $workflow_id] { + simulation::template::map_group_to_role \ + -role_id $role_id \ + -group_id [set actor_$role_id] \ + -group_size [set group_$role_id] + } + + ad_returnredirect . + ad_script_abort + } Index: openacs-4/packages/simulation/www/siminst/simulation-start.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-start.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/siminst/simulation-start.tcl 16 Dec 2003 16:00:34 -0000 1.1 @@ -0,0 +1,12 @@ +ad_page_contract { + Start a simulation immediately and redirect + to simplay. + + @author Peter Marklund +} { + workflow_id:integer +} + +#simulation::start -workflow_id $workflow_id + +ad_returnredirect "../simplay"