Index: openacs-4/contrib/packages/simulation/lib/sim-objects.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/sim-objects.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/contrib/packages/simulation/lib/sim-objects.tcl 14 Nov 2003 14:03:42 -0000 1.2
+++ openacs-4/contrib/packages/simulation/lib/sim-objects.tcl 18 Nov 2003 12:19:38 -0000 1.3
@@ -23,14 +23,14 @@
set elements {
object_type_pretty {
- label "Type"
- orderby upper(ot.pretty_name)
- }
- title {
- label "Name"
- orderby r.title
- link_url_col view_url
- }
+ label "Type"
+ orderby upper(ot.pretty_name)
+ }
+ title {
+ label "Name"
+ orderby r.title
+ link_url_col view_url
+ }
}
if { [string equal $display_mode "edit"] } {
Index: openacs-4/contrib/packages/simulation/lib/simulations.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/simulations.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/simulation/lib/simulations.adp 18 Nov 2003 12:19:38 -0000 1.1
@@ -0,0 +1 @@
+
Index: openacs-4/contrib/packages/simulation/lib/simulations.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/simulations.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/simulation/lib/simulations.tcl 18 Nov 2003 12:19:38 -0000 1.1
@@ -0,0 +1,57 @@
+simulation::include_contract {
+ Displays a list of simulations for admins
+
+ @author Joel Aufrecht
+ @creation-date 2003-11-12
+ @cvs-id $Id: simulations.tcl,v 1.1 2003/11/18 12:19:38 joela Exp $
+}
+
+set package_id [ad_conn package_id]
+
+######################################################################
+#
+# live_sims
+#
+# A list of currently active simulations
+#
+######################################################################
+
+#---------------------------------------------------------------------
+# live_sims list
+#---------------------------------------------------------------------
+
+set elements {
+ pretty_name {
+ label "Simulation"
+ orderby upper(w.pretty_name)
+ link_url_col edit_url
+ }
+ cases {
+ label "Cases"
+ orderby cases
+ }
+}
+
+template::list::create \
+ -name live_sims \
+ -multirow live_sims \
+ -no_data "No currently active simulations." \
+ -elements $elements
+
+#---------------------------------------------------------------------
+# live_sims multirow
+#---------------------------------------------------------------------
+
+db_multirow -extend {edit_url} live_sims select_live_sims "
+ select w.pretty_name,
+ (select count(case_id)
+ from workflow_cases
+ where workflow_id = w.workflow_id) as cases
+ from workflows w, sim_simulations ss
+ where w.package_key = :package_id
+ and ss.simulation_id = w.workflow_id
+ and ss.case_start <= now()
+ and ss.case_end >= now()
+" {
+ set edit_url [export_vars -base "simulation-edit" { simulation_id }]
+}
Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-tables-create.sql,v
diff -u -r1.7 -r1.8
--- openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-create.sql 18 Nov 2003 09:44:31 -0000 1.7
+++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-create.sql 18 Nov 2003 12:19:39 -0000 1.8
@@ -34,6 +34,8 @@
on delete cascade
constraint sim_simulation_pk
primary key,
+ suggested_duration interval,
+ ready_p boolean,
enroll_type varchar(20) constraint sim_simulations_enroll_type_ck
check (1=1),
casting_type varchar(20) constraint sim_simulations_casting_type_ck
Index: openacs-4/contrib/packages/simulation/tcl/role-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/role-procs.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/contrib/packages/simulation/tcl/role-procs.tcl 18 Nov 2003 10:06:38 -0000 1.3
+++ openacs-4/contrib/packages/simulation/tcl/role-procs.tcl 18 Nov 2003 12:19:39 -0000 1.4
@@ -26,8 +26,7 @@
-short_name $role_short_name \
-pretty_name $role_pretty_name]
-
- }
+ }
}
ad_proc -public simulation::role::delete {
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.1 -r1.2
--- openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 12 Nov 2003 13:14:07 -0000 1.1
+++ openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 18 Nov 2003 12:19:39 -0000 1.2
@@ -11,32 +11,102 @@
ad_proc -public simulation::template::new {
{-short_name:required}
{-pretty_name:required}
+ {-ready_p "f"}
+ {-suggested_duration ""}
{-package_key:required}
{-object_id:required}
} {
- Create a new simulation template.
+ Create a new simulation template. TODO: need better tests for duration before passing it into the database.
@return The workflow_id of the created simulation.
@author Peter Marklund
} {
- set workflow_id [workflow::new \
- -short_name $short_name \
- -pretty_name $pretty_name \
- -package_key $package_key \
- -object_id $object_id]
+ if { ![exists_and_not_null ready_p] } {
+ set ready_p "f"
+ }
+ db_transaction {
+ set workflow_id [workflow::new \
+ -short_name $short_name \
+ -pretty_name $pretty_name \
+ -package_key $package_key \
+ -object_id $object_id]
+
+ # TODO: this step should be rendered obsolete by updates to workflow
+ # and then this step should be removed
+ # create a dummy action with initial action setting because
+ # workflow::get doesn't work on bare workflows
+ workflow::action::fsm::new \
+ -initial_action_p t \
+ -workflow_id $workflow_id \
+ -short_name "dummy action" \
+ -pretty_name "dummy action"
+
+ db_dml new_sim "
+ insert into sim_simulations
+ (simulation_id, ready_p, suggested_duration)
+ values ($workflow_id, '$ready_p', interval '$suggested_duration')
+ "
+
+ }
+ return $workflow_id
+}
- # create a dummy action with initial action setting because
- # workflow::get doesn't work on bare workflows
- workflow::action::fsm::new \
- -initial_action_p t \
- -workflow_id $workflow_id \
- -short_name "dummy action" \
- -pretty_name "dummy action"
+ad_proc -public simulation::template::edit {
+ {-short_name:required}
+ {-pretty_name:required}
+ {-ready_p "f"}
+ {-suggested_duration ""}
+ {-package_key:required}
+ {-object_id:required}
+} {
+ Edit a new simulation template. TODO: need better tests for duration before passing it into the database.
+ @return nothing
+
+ @author Joel Aufrecht
+} {
+ if { ![exists_and_not_null ready_p] } {
+ set ready_p "f"
+ }
+ db_transaction {
+
+ # TODO: this should be in a new API call, workflow::edit
+
+ db_dml edit_workflow "
+ update workflows
+ set short_name=:short_name,
+ pretty_name=:pretty_name
+ where workflow_id=:object_id
+"
+
+ db_dml edit_sim "
+ update sim_simulations
+ set ready_p=:ready_p,
+ suggested_duration=(interval ':suggested_duration')
+ where simulation_id=:object_id
+ "
+
+ }
return $workflow_id
}
+ad_proc -public simulation::template::get {
+ {-package_key:required}
+ {-object_id:required}
+ {-array:required}
+} {
+ STUB ONLY. Return information about a simulation template. This should be a wrapper anound workflow::get, supplementing it with the columns from sim_simulation.
+
+ @param object_id ID of simulation template.
+ @param array name of array in which the info will be returned
+ @return An array list with keys workflow_id, short_name,
+ pretty_name, object_id, package_key, object_type, initial_action,
+ and callbacks, plus records in sim_simulation.
+} {
+ return 1
+}
+
ad_proc -public simulation::template::delete {
{-workflow_id:required}
} {
Index: openacs-4/contrib/packages/simulation/www/simbuild/template-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/template-edit.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/packages/simulation/www/simbuild/template-edit.tcl 13 Nov 2003 15:35:48 -0000 1.1
+++ openacs-4/contrib/packages/simulation/www/simbuild/template-edit.tcl 18 Nov 2003 12:19:39 -0000 1.2
@@ -31,15 +31,38 @@
{label "Template Name"}
{html {size 40}}
}
+ {ready_p:boolean(checkbox),optional
+ {label "Ready for use?"}
+ {options {""}}
+ }
+ {suggested_duration:string,optional
+ {label "Suggested Duration"}
+ }
} -edit_request {
workflow::get -workflow_id $workflow_id -array sim_template_array
set name $sim_template_array(pretty_name)
+ set ready_p 't'
+#TODO: replace workflow api call with simulation::template::get,
+# combining data from workflows with data from sim_simulation,
+# hence providing $sim_template_array(ready_p)
} -new_data {
set workflow_id [simulation::template::new \
-short_name $name \
-pretty_name $name \
+ -ready_p $ready_p \
+ -suggested_duration $suggested_duration \
-package_key $package_key \
-object_id $package_id]
+} -edit_data {
+ set workflow_id [simulation::template::edit \
+ -short_name $name \
+ -pretty_name $name \
+ -ready_p $ready_p \
+ -suggested_duration $suggested_duration \
+ -package_key $package_key \
+ -object_id $package_id]
+
+
} -after_submit {
ad_returnredirect template-edit?workflow_id=$workflow_id
ad_script_abort
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.3 -r1.4
--- openacs-4/contrib/packages/simulation/www/siminst/index.adp 18 Nov 2003 09:44:32 -0000 1.3
+++ openacs-4/contrib/packages/simulation/www/siminst/index.adp 18 Nov 2003 12:19:39 -0000 1.4
@@ -2,24 +2,8 @@
@page_title;noquote@
@context;noquote@
-List of eligible templates for instantiation. :
-
-select workflow_id,
- suggested_duration,
- pretty_name
- (...) as number_of_roles
- () as min_number_of_human_roles
- Instantiate this template
- from workflows
- where ready_p = 't'
-
+Instantiate a template
+
-
-Sort and filter based on "expected duration" and number
-of roles. May have arbitrary meta-data (depending on if categories
-package is usable or not).
-
-
-
- TODO: Show a list of simulations with no cases so that you can continue working on one that was partially instantiated.
-
+Current simulations
+
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.1 -r1.2
--- openacs-4/contrib/packages/simulation/www/siminst/index.tcl 13 Nov 2003 12:19:50 -0000 1.1
+++ openacs-4/contrib/packages/simulation/www/siminst/index.tcl 18 Nov 2003 12:19:39 -0000 1.2
@@ -2,6 +2,68 @@
List active simulations.
}
-set page_title "Choose a template"
+set page_title "Template Instantiation"
set context [list $page_title]
set package_id [ad_conn package_id]
+
+######################################################################
+#
+# avail_templates
+#
+# A list of templates that can be instantiated
+#
+######################################################################
+
+#---------------------------------------------------------------------
+# avail_templates list
+#---------------------------------------------------------------------
+
+set elements {
+ pretty_name {
+ label "Template"
+ orderby upper(w.pretty_name)
+ }
+ suggested_duration {
+ label "Suggested Duration"
+ orderby suggested_duration
+ }
+ number_of_roles {
+ label "Roles"
+ orderby number_of_roles
+ }
+ min_number_of_human_roles {
+ label "Min \# of players"
+ orderby min_number_of_human_roles
+ }
+ instantiate {
+ display_template {
+ "Instantiate"
+ link_url_col inst_url
+ }
+ }
+}
+
+template::list::create \
+ -name avail_templates \
+ -multirow avail_templates \
+ -no_data "No simulation templates available for instantiation." \
+ -elements $elements
+
+#---------------------------------------------------------------------
+# avail_templates multirow
+#---------------------------------------------------------------------
+
+db_multirow -extend {inst_url} avail_templates select_avail_templates "
+select workflow_id,
+ suggested_duration,
+ pretty_name,
+ (select 1) as number_of_roles,
+ (select 1) as min_number_of_human_roles
+ from sim_simulations ss,
+ workflows w
+ where ss.simulation_id = w.workflow_id
+ and w.package_key = :package_id
+ and ready_p = 't'
+" {
+ set inst_url [export_vars -base "simulation-edit" { simulation_id }]
+}
\ No newline at end of file
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.1 -r1.2
--- openacs-4/contrib/packages/simulation/www/simplay/messages.adp 18 Nov 2003 09:44:32 -0000 1.1
+++ openacs-4/contrib/packages/simulation/www/simplay/messages.adp 18 Nov 2003 12:19:39 -0000 1.2
@@ -2,6 +2,6 @@
@page_title;noquote@
@context;noquote@
- Need to pass in case_id and role_id
+ TODO: Need to pass in case_id and role_id
\ No newline at end of file
Index: openacs-4/packages/simulation/lib/sim-objects.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-objects.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/simulation/lib/sim-objects.tcl 14 Nov 2003 14:03:42 -0000 1.2
+++ openacs-4/packages/simulation/lib/sim-objects.tcl 18 Nov 2003 12:19:38 -0000 1.3
@@ -23,14 +23,14 @@
set elements {
object_type_pretty {
- label "Type"
- orderby upper(ot.pretty_name)
- }
- title {
- label "Name"
- orderby r.title
- link_url_col view_url
- }
+ label "Type"
+ orderby upper(ot.pretty_name)
+ }
+ title {
+ label "Name"
+ orderby r.title
+ link_url_col view_url
+ }
}
if { [string equal $display_mode "edit"] } {
Index: openacs-4/packages/simulation/lib/simulations.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/simulations.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/simulation/lib/simulations.adp 18 Nov 2003 12:19:38 -0000 1.1
@@ -0,0 +1 @@
+
Index: openacs-4/packages/simulation/lib/simulations.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/simulations.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/simulation/lib/simulations.tcl 18 Nov 2003 12:19:38 -0000 1.1
@@ -0,0 +1,57 @@
+simulation::include_contract {
+ Displays a list of simulations for admins
+
+ @author Joel Aufrecht
+ @creation-date 2003-11-12
+ @cvs-id $Id: simulations.tcl,v 1.1 2003/11/18 12:19:38 joela Exp $
+}
+
+set package_id [ad_conn package_id]
+
+######################################################################
+#
+# live_sims
+#
+# A list of currently active simulations
+#
+######################################################################
+
+#---------------------------------------------------------------------
+# live_sims list
+#---------------------------------------------------------------------
+
+set elements {
+ pretty_name {
+ label "Simulation"
+ orderby upper(w.pretty_name)
+ link_url_col edit_url
+ }
+ cases {
+ label "Cases"
+ orderby cases
+ }
+}
+
+template::list::create \
+ -name live_sims \
+ -multirow live_sims \
+ -no_data "No currently active simulations." \
+ -elements $elements
+
+#---------------------------------------------------------------------
+# live_sims multirow
+#---------------------------------------------------------------------
+
+db_multirow -extend {edit_url} live_sims select_live_sims "
+ select w.pretty_name,
+ (select count(case_id)
+ from workflow_cases
+ where workflow_id = w.workflow_id) as cases
+ from workflows w, sim_simulations ss
+ where w.package_key = :package_id
+ and ss.simulation_id = w.workflow_id
+ and ss.case_start <= now()
+ and ss.case_end >= now()
+" {
+ set edit_url [export_vars -base "simulation-edit" { simulation_id }]
+}
Index: openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql 18 Nov 2003 09:44:31 -0000 1.7
+++ openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql 18 Nov 2003 12:19:39 -0000 1.8
@@ -34,6 +34,8 @@
on delete cascade
constraint sim_simulation_pk
primary key,
+ suggested_duration interval,
+ ready_p boolean,
enroll_type varchar(20) constraint sim_simulations_enroll_type_ck
check (1=1),
casting_type varchar(20) constraint sim_simulations_casting_type_ck
Index: openacs-4/packages/simulation/tcl/role-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/Attic/role-procs.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/simulation/tcl/role-procs.tcl 18 Nov 2003 10:06:38 -0000 1.3
+++ openacs-4/packages/simulation/tcl/role-procs.tcl 18 Nov 2003 12:19:39 -0000 1.4
@@ -26,8 +26,7 @@
-short_name $role_short_name \
-pretty_name $role_pretty_name]
-
- }
+ }
}
ad_proc -public simulation::role::delete {
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.1 -r1.2
--- openacs-4/packages/simulation/tcl/template-procs.tcl 12 Nov 2003 13:14:07 -0000 1.1
+++ openacs-4/packages/simulation/tcl/template-procs.tcl 18 Nov 2003 12:19:39 -0000 1.2
@@ -11,32 +11,102 @@
ad_proc -public simulation::template::new {
{-short_name:required}
{-pretty_name:required}
+ {-ready_p "f"}
+ {-suggested_duration ""}
{-package_key:required}
{-object_id:required}
} {
- Create a new simulation template.
+ Create a new simulation template. TODO: need better tests for duration before passing it into the database.
@return The workflow_id of the created simulation.
@author Peter Marklund
} {
- set workflow_id [workflow::new \
- -short_name $short_name \
- -pretty_name $pretty_name \
- -package_key $package_key \
- -object_id $object_id]
+ if { ![exists_and_not_null ready_p] } {
+ set ready_p "f"
+ }
+ db_transaction {
+ set workflow_id [workflow::new \
+ -short_name $short_name \
+ -pretty_name $pretty_name \
+ -package_key $package_key \
+ -object_id $object_id]
+
+ # TODO: this step should be rendered obsolete by updates to workflow
+ # and then this step should be removed
+ # create a dummy action with initial action setting because
+ # workflow::get doesn't work on bare workflows
+ workflow::action::fsm::new \
+ -initial_action_p t \
+ -workflow_id $workflow_id \
+ -short_name "dummy action" \
+ -pretty_name "dummy action"
+
+ db_dml new_sim "
+ insert into sim_simulations
+ (simulation_id, ready_p, suggested_duration)
+ values ($workflow_id, '$ready_p', interval '$suggested_duration')
+ "
+
+ }
+ return $workflow_id
+}
- # create a dummy action with initial action setting because
- # workflow::get doesn't work on bare workflows
- workflow::action::fsm::new \
- -initial_action_p t \
- -workflow_id $workflow_id \
- -short_name "dummy action" \
- -pretty_name "dummy action"
+ad_proc -public simulation::template::edit {
+ {-short_name:required}
+ {-pretty_name:required}
+ {-ready_p "f"}
+ {-suggested_duration ""}
+ {-package_key:required}
+ {-object_id:required}
+} {
+ Edit a new simulation template. TODO: need better tests for duration before passing it into the database.
+ @return nothing
+
+ @author Joel Aufrecht
+} {
+ if { ![exists_and_not_null ready_p] } {
+ set ready_p "f"
+ }
+ db_transaction {
+
+ # TODO: this should be in a new API call, workflow::edit
+
+ db_dml edit_workflow "
+ update workflows
+ set short_name=:short_name,
+ pretty_name=:pretty_name
+ where workflow_id=:object_id
+"
+
+ db_dml edit_sim "
+ update sim_simulations
+ set ready_p=:ready_p,
+ suggested_duration=(interval ':suggested_duration')
+ where simulation_id=:object_id
+ "
+
+ }
return $workflow_id
}
+ad_proc -public simulation::template::get {
+ {-package_key:required}
+ {-object_id:required}
+ {-array:required}
+} {
+ STUB ONLY. Return information about a simulation template. This should be a wrapper anound workflow::get, supplementing it with the columns from sim_simulation.
+
+ @param object_id ID of simulation template.
+ @param array name of array in which the info will be returned
+ @return An array list with keys workflow_id, short_name,
+ pretty_name, object_id, package_key, object_type, initial_action,
+ and callbacks, plus records in sim_simulation.
+} {
+ return 1
+}
+
ad_proc -public simulation::template::delete {
{-workflow_id:required}
} {
Index: openacs-4/packages/simulation/www/simbuild/template-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/template-edit.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/simulation/www/simbuild/template-edit.tcl 13 Nov 2003 15:35:48 -0000 1.1
+++ openacs-4/packages/simulation/www/simbuild/template-edit.tcl 18 Nov 2003 12:19:39 -0000 1.2
@@ -31,15 +31,38 @@
{label "Template Name"}
{html {size 40}}
}
+ {ready_p:boolean(checkbox),optional
+ {label "Ready for use?"}
+ {options {""}}
+ }
+ {suggested_duration:string,optional
+ {label "Suggested Duration"}
+ }
} -edit_request {
workflow::get -workflow_id $workflow_id -array sim_template_array
set name $sim_template_array(pretty_name)
+ set ready_p 't'
+#TODO: replace workflow api call with simulation::template::get,
+# combining data from workflows with data from sim_simulation,
+# hence providing $sim_template_array(ready_p)
} -new_data {
set workflow_id [simulation::template::new \
-short_name $name \
-pretty_name $name \
+ -ready_p $ready_p \
+ -suggested_duration $suggested_duration \
-package_key $package_key \
-object_id $package_id]
+} -edit_data {
+ set workflow_id [simulation::template::edit \
+ -short_name $name \
+ -pretty_name $name \
+ -ready_p $ready_p \
+ -suggested_duration $suggested_duration \
+ -package_key $package_key \
+ -object_id $package_id]
+
+
} -after_submit {
ad_returnredirect template-edit?workflow_id=$workflow_id
ad_script_abort
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.3 -r1.4
--- openacs-4/packages/simulation/www/siminst/index.adp 18 Nov 2003 09:44:32 -0000 1.3
+++ openacs-4/packages/simulation/www/siminst/index.adp 18 Nov 2003 12:19:39 -0000 1.4
@@ -2,24 +2,8 @@
@page_title;noquote@
@context;noquote@
-List of eligible templates for instantiation. :
-
-select workflow_id,
- suggested_duration,
- pretty_name
- (...) as number_of_roles
- () as min_number_of_human_roles
- Instantiate this template
- from workflows
- where ready_p = 't'
-
+Instantiate a template
+
-
-Sort and filter based on "expected duration" and number
-of roles. May have arbitrary meta-data (depending on if categories
-package is usable or not).
-
-
-
- TODO: Show a list of simulations with no cases so that you can continue working on one that was partially instantiated.
-
+Current simulations
+
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.1 -r1.2
--- openacs-4/packages/simulation/www/siminst/index.tcl 13 Nov 2003 12:19:50 -0000 1.1
+++ openacs-4/packages/simulation/www/siminst/index.tcl 18 Nov 2003 12:19:39 -0000 1.2
@@ -2,6 +2,68 @@
List active simulations.
}
-set page_title "Choose a template"
+set page_title "Template Instantiation"
set context [list $page_title]
set package_id [ad_conn package_id]
+
+######################################################################
+#
+# avail_templates
+#
+# A list of templates that can be instantiated
+#
+######################################################################
+
+#---------------------------------------------------------------------
+# avail_templates list
+#---------------------------------------------------------------------
+
+set elements {
+ pretty_name {
+ label "Template"
+ orderby upper(w.pretty_name)
+ }
+ suggested_duration {
+ label "Suggested Duration"
+ orderby suggested_duration
+ }
+ number_of_roles {
+ label "Roles"
+ orderby number_of_roles
+ }
+ min_number_of_human_roles {
+ label "Min \# of players"
+ orderby min_number_of_human_roles
+ }
+ instantiate {
+ display_template {
+ "Instantiate"
+ link_url_col inst_url
+ }
+ }
+}
+
+template::list::create \
+ -name avail_templates \
+ -multirow avail_templates \
+ -no_data "No simulation templates available for instantiation." \
+ -elements $elements
+
+#---------------------------------------------------------------------
+# avail_templates multirow
+#---------------------------------------------------------------------
+
+db_multirow -extend {inst_url} avail_templates select_avail_templates "
+select workflow_id,
+ suggested_duration,
+ pretty_name,
+ (select 1) as number_of_roles,
+ (select 1) as min_number_of_human_roles
+ from sim_simulations ss,
+ workflows w
+ where ss.simulation_id = w.workflow_id
+ and w.package_key = :package_id
+ and ready_p = 't'
+" {
+ set inst_url [export_vars -base "simulation-edit" { simulation_id }]
+}
\ No newline at end of file
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.1 -r1.2
--- openacs-4/packages/simulation/www/simplay/messages.adp 18 Nov 2003 09:44:32 -0000 1.1
+++ openacs-4/packages/simulation/www/simplay/messages.adp 18 Nov 2003 12:19:39 -0000 1.2
@@ -2,6 +2,6 @@
@page_title;noquote@
@context;noquote@
- Need to pass in case_id and role_id
+ TODO: Need to pass in case_id and role_id
\ No newline at end of file