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.8 -r1.9 --- openacs-4/contrib/packages/simulation/www/siminst/index.adp 2 Dec 2003 17:24:33 -0000 1.8 +++ openacs-4/contrib/packages/simulation/www/siminst/index.adp 9 Dec 2003 17:30:49 -0000 1.9 @@ -3,28 +3,13 @@ @context;noquote@

- +

Simulations in Casting

- +

+

+Live Simulations -

Help

- -

- - Casting (Simulation in Development -> Simulation). From a - fully developed simulation, a copy (clone) is created (not sure - we need to clone any more at this point. Just keep working on - the simulation - JA), - and this new template becomes a simulation once it is connected to users in - the real world and time frame and other properties of the simulation are specified. - A simulation is subdivided into one or more simulation cases - that each have their own set of users and will execute independently of - eachother. A large class can thus be divided into smaller groups where each group - has its own simulation case to play in. - -

- 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.5 -r1.6 --- openacs-4/contrib/packages/simulation/www/siminst/index.tcl 2 Dec 2003 17:24:33 -0000 1.5 +++ openacs-4/contrib/packages/simulation/www/siminst/index.tcl 9 Dec 2003 17:30:50 -0000 1.6 @@ -6,35 +6,119 @@ set context [list $page_title] set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege sim_inst +set admin_p [permission::permission_p -object_id $package_id -privilege admin] set add_url "simulation-new" - #--------------------------------------------------------------------- -# Mapped templates +# dev_sims: simulations in development #--------------------------------------------------------------------- template::list::create \ - -name mapped_templates \ - -multirow mapped_templates \ + -name dev_sims \ + -multirow dev_sims \ -actions "{New Simulation From Template} $add_url" \ - -no_data "No templates have been mapped" \ + -no_data "No Simulations are in Development" \ -elements { pretty_name { - label "Template" + label "Simulation" orderby upper(w.pretty_name) } - roles { - label "Developed Roles / Total Roles" + role_count { + label "Roles" + } + role_empty_count { + label "Roles without Characters" + } + prop_count { + label "Props" + } + prop_empty_count { + label "Missing props" + } + delete { display_template { - 0 / 9 + Delete } } - props { - label "Developed Tasks / Total Tasks" + copy { display_template { - 0 / 8 + Copy } } + cast { + link_url_col cast_url + display_template { + Begin casting + } + } + } + +# if user is admin, show all. otherwise, show only records owned by user +if { $admin_p } { + set sim_in_dev_filter_sql "" +} else { + set sim_in_dev_filter_sql "and ao.creation_user = :user_id" +} + +db_multirow -extend { cast_url } dev_sims select_dev_sims " + select w.workflow_id, + w.pretty_name, + (select count(*) + from sim_roles sr, + workflow_roles wr + where wr.workflow_id = w.workflow_id) as role_count, + (select count(*) + from sim_roles sr, + workflow_roles wr + where wr.workflow_id = w.workflow_id + and character_id is null) as role_empty_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_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 + and stom.object_id is null) as prop_empty_count + from workflows w, + sim_simulations ss, + acs_objects ao + where w.object_id = :package_id + and ss.simulation_id = w.workflow_id + and ao.object_id = w.workflow_id + and ss.sim_type = 'dev_sim' + $sim_in_dev_filter_sql +" { + set cast_url [export_vars -base "cast-edit" { workflow_id }] +} + + +#--------------------------------------------------------------------- +# casting_sims: simulations in casting +#--------------------------------------------------------------------- + +template::list::create \ + -name casting_sims \ + -multirow casting_sims \ + -no_data "No Simulations are in Casting" \ + -elements { + pretty_name { + label "Simulation" + orderby upper(w.pretty_name) + } + enroll_type { + label "Enrollment Type" + } + casting_type { + label "Casting Type" + } + users { + label "Users enrolled" + } delete { display_template { Delete @@ -53,25 +137,29 @@ } } -# TODO: update the mapped_p subquery for agents -# Simpler solution: -# type column with possible values: -# incomplete_template -# ready_template -# mapped_template -# simulation -# and not exists (select 1 -# from sim_roles sr, -# workflow_roles wr -# where sr.role_id = wr.role_id -# and sr.character_id is null -# and wr.workflow_id = w.workflow_id -# ) -db_multirow -extend { cast_url } mapped_templates select_mapped_templates { +# if admin, show all. otherwise, filter +if { $admin_p } { + set sim_in_dev_filter_sql "" +} else { + set sim_in_dev_filter_sql "and ao.creation_user = :user_id" +} + +db_multirow -extend { edit_url } casting_sims select_casting_sims " select w.workflow_id, - w.pretty_name - from workflows w - where w.object_id = :package_id -} { - set cast_url [export_vars -base "cast-edit" { workflow_id }] + w.pretty_name, + ss.enroll_type, + ss.casting_type, + (select count(*) + from sim_party_sim_map spsm + where spsm.simulation_id = w.workflow_id) as users + from workflows w, + sim_simulations ss, + acs_objects ao + where w.object_id = :package_id + and ss.simulation_id = w.workflow_id + and ao.object_id = w.workflow_id + and ss.sim_type = 'dev_sim' + $sim_in_dev_filter_sql +" { + set edit_url [export_vars -base "TODO" { workflow_id }] } 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.8 -r1.9 --- openacs-4/packages/simulation/www/siminst/index.adp 2 Dec 2003 17:24:33 -0000 1.8 +++ openacs-4/packages/simulation/www/siminst/index.adp 9 Dec 2003 17:30:49 -0000 1.9 @@ -3,28 +3,13 @@ @context;noquote@

- +

Simulations in Casting

- +

+

+Live Simulations -

Help

- -

- - Casting (Simulation in Development -> Simulation). From a - fully developed simulation, a copy (clone) is created (not sure - we need to clone any more at this point. Just keep working on - the simulation - JA), - and this new template becomes a simulation once it is connected to users in - the real world and time frame and other properties of the simulation are specified. - A simulation is subdivided into one or more simulation cases - that each have their own set of users and will execute independently of - eachother. A large class can thus be divided into smaller groups where each group - has its own simulation case to play in. - -

- 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.5 -r1.6 --- openacs-4/packages/simulation/www/siminst/index.tcl 2 Dec 2003 17:24:33 -0000 1.5 +++ openacs-4/packages/simulation/www/siminst/index.tcl 9 Dec 2003 17:30:50 -0000 1.6 @@ -6,35 +6,119 @@ set context [list $page_title] set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege sim_inst +set admin_p [permission::permission_p -object_id $package_id -privilege admin] set add_url "simulation-new" - #--------------------------------------------------------------------- -# Mapped templates +# dev_sims: simulations in development #--------------------------------------------------------------------- template::list::create \ - -name mapped_templates \ - -multirow mapped_templates \ + -name dev_sims \ + -multirow dev_sims \ -actions "{New Simulation From Template} $add_url" \ - -no_data "No templates have been mapped" \ + -no_data "No Simulations are in Development" \ -elements { pretty_name { - label "Template" + label "Simulation" orderby upper(w.pretty_name) } - roles { - label "Developed Roles / Total Roles" + role_count { + label "Roles" + } + role_empty_count { + label "Roles without Characters" + } + prop_count { + label "Props" + } + prop_empty_count { + label "Missing props" + } + delete { display_template { - 0 / 9 + Delete } } - props { - label "Developed Tasks / Total Tasks" + copy { display_template { - 0 / 8 + Copy } } + cast { + link_url_col cast_url + display_template { + Begin casting + } + } + } + +# if user is admin, show all. otherwise, show only records owned by user +if { $admin_p } { + set sim_in_dev_filter_sql "" +} else { + set sim_in_dev_filter_sql "and ao.creation_user = :user_id" +} + +db_multirow -extend { cast_url } dev_sims select_dev_sims " + select w.workflow_id, + w.pretty_name, + (select count(*) + from sim_roles sr, + workflow_roles wr + where wr.workflow_id = w.workflow_id) as role_count, + (select count(*) + from sim_roles sr, + workflow_roles wr + where wr.workflow_id = w.workflow_id + and character_id is null) as role_empty_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_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 + and stom.object_id is null) as prop_empty_count + from workflows w, + sim_simulations ss, + acs_objects ao + where w.object_id = :package_id + and ss.simulation_id = w.workflow_id + and ao.object_id = w.workflow_id + and ss.sim_type = 'dev_sim' + $sim_in_dev_filter_sql +" { + set cast_url [export_vars -base "cast-edit" { workflow_id }] +} + + +#--------------------------------------------------------------------- +# casting_sims: simulations in casting +#--------------------------------------------------------------------- + +template::list::create \ + -name casting_sims \ + -multirow casting_sims \ + -no_data "No Simulations are in Casting" \ + -elements { + pretty_name { + label "Simulation" + orderby upper(w.pretty_name) + } + enroll_type { + label "Enrollment Type" + } + casting_type { + label "Casting Type" + } + users { + label "Users enrolled" + } delete { display_template { Delete @@ -53,25 +137,29 @@ } } -# TODO: update the mapped_p subquery for agents -# Simpler solution: -# type column with possible values: -# incomplete_template -# ready_template -# mapped_template -# simulation -# and not exists (select 1 -# from sim_roles sr, -# workflow_roles wr -# where sr.role_id = wr.role_id -# and sr.character_id is null -# and wr.workflow_id = w.workflow_id -# ) -db_multirow -extend { cast_url } mapped_templates select_mapped_templates { +# if admin, show all. otherwise, filter +if { $admin_p } { + set sim_in_dev_filter_sql "" +} else { + set sim_in_dev_filter_sql "and ao.creation_user = :user_id" +} + +db_multirow -extend { edit_url } casting_sims select_casting_sims " select w.workflow_id, - w.pretty_name - from workflows w - where w.object_id = :package_id -} { - set cast_url [export_vars -base "cast-edit" { workflow_id }] + w.pretty_name, + ss.enroll_type, + ss.casting_type, + (select count(*) + from sim_party_sim_map spsm + where spsm.simulation_id = w.workflow_id) as users + from workflows w, + sim_simulations ss, + acs_objects ao + where w.object_id = :package_id + and ss.simulation_id = w.workflow_id + and ao.object_id = w.workflow_id + and ss.sim_type = 'dev_sim' + $sim_in_dev_filter_sql +" { + set edit_url [export_vars -base "TODO" { workflow_id }] }