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.43 -r1.44
--- openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 12 Jan 2004 16:14:26 -0000 1.43
+++ openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 13 Jan 2004 10:17:11 -0000 1.44
@@ -810,32 +810,38 @@
ad_proc -public simulation::template::get_inst_state {
-workflow_id:required
} {
- Get the instantiation state of a simulation template.
+ Get information about which tab urls in the instantiation wizard
+ have been completed.
- States:
+ @return An array with the following keys (urls) and values either 0 or 1:
- - none
-
- roles_complete
-
- tasks_complete
-
- settings_complete
-
- enrollment_complete
-
- participants_complete
-
- casting
-
- has_cases
+ simulation-edit
+ map-characters
+ map-tasks
+ simulation-participants
+ simulation-casting-3
} {
- simulation::template::get -workflow_id $workflow_id -array sim_template
+ simulation::template::get -workflow_id $workflow_id -array sim_template
# TODO (1.5h): Refactor this and the corresponding wizard.tcl/adp page
# What we really need to know is whether each step is complete
# They're all independent of each other, except for casting, which is dependent on participants.
+ foreach tab [get_wizard_tabs] {
+ set tab_complete_p($tab) 0
+ }
+
switch $sim_template(sim_type) {
dev_sim {
- set state "none"
+
+ # 1. Settings
+ if { ![empty_string_p $sim_template(case_start)] && ![empty_string_p $sim_template(send_start_note_date)] } {
+ set tab_complete_p(simulation-edit) 1
+ }
- # 1. Roles
+ # 2. Roles
set role_empty_count [db_string role_empty_count {
select count(*)
from sim_roles sr,
@@ -845,40 +851,28 @@
and character_id is null
}]
if { $role_empty_count == 0 } {
- set state "roles_complete"
+ set tab_complete_p(map-characters) 1
+ }
- # 2. Tasks
- set prop_empty_count [db_string prop_empty_count {
- select sum((select count(*) from sim_task_object_map where task_id = wa.action_id) - st.attachment_num)
- from sim_tasks st,
- workflow_actions wa
- where st.task_id = wa.action_id
- and wa.workflow_id = :workflow_id
- }]
-
- if { $prop_empty_count == 0 } {
- set state "tasks_complete"
+ # 3. Tasks
+ set prop_empty_count [db_string prop_empty_count {
+ select sum((select count(*) from sim_task_object_map where task_id = wa.action_id) - st.attachment_num)
+ from sim_tasks st,
+ workflow_actions wa
+ where st.task_id = wa.action_id
+ and wa.workflow_id = :workflow_id
+ }]
+ if { $prop_empty_count == 0 } {
+ set tab_complete_p(map-tasks) 1
+ }
- if { ![empty_string_p $sim_template(case_start)] && ![empty_string_p $sim_template(send_start_note_date)] } {
- set state "settings_complete"
-
- if { ![empty_string_p $sim_template(enroll_type)] &&
- (![string equal $sim_template(enroll_type) "open"] ||
- (![empty_string_p $sim_template(enroll_start)] && ![empty_string_p $sim_template(enroll_end)])) } {
- set state "enrollment_complete"
-
- set num_parties [db_string num_parties { select count(*) from sim_party_sim_map where simulation_id = :workflow_id }]
-
- if { $num_parties > 0 } {
- set state "participants_complete"
- }
- }
- }
- }
- }
+ # 4. Participants
+ set num_parties [db_string num_parties { select count(*) from sim_party_sim_map where simulation_id = :workflow_id}]
+ if { [string equal $sim_template(enroll_type) "open"] || $num_parties > 0 } {
+ set tab_complete_p(simulation-participants) 1
+ }
}
casting_sim {
- set state "casting"
set n_cases [db_string select_n_cases {
select count(*)
@@ -887,29 +881,61 @@
}]
if { $n_cases > 0 } {
- set state "has_cases"
- }
+ set tab_complete_p(simulation-casting-3) 1
+ }
}
}
- return $state
+ return [array get tab_complete_p]
}
+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.
+
+ @author Peter Marklund
+} {
+ return {
+ simulation-edit
+ map-characters
+ map-tasks
+ simulation-participants
+ participants_complete
+ simulation-casting-3
+ }
+}
+
ad_proc -public simulation::template::get_state_pretty {
-state:required
} {
Get pretty version of state.
+
+ @see simulation::template::get_inst_state
} {
- array set pretty {
- none "Not started"
- roles_complete "Roles completed"
- tasks_complete "Tasks completed"
- settings_complete "Settings completed"
- enrollment_complete "Enrollment completed"
- participants_complete "Participants completed"
+ 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"
}
+
+ 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
+ }
+ }
- return $pretty($state)
+ return $states_pretty([lindex [get_wizard_tabs] $next_index])
}
ad_proc -public simulation::template::pretty_name_unique_p {
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.28 -r1.29
--- openacs-4/contrib/packages/simulation/www/siminst/index.tcl 8 Jan 2004 11:28:07 -0000 1.28
+++ openacs-4/contrib/packages/simulation/www/siminst/index.tcl 13 Jan 2004 10:17:11 -0000 1.29
@@ -112,6 +112,7 @@
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/simulation-casting-3.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-casting-3.adp,v
diff -u -r1.13 -r1.14
--- openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.adp 12 Jan 2004 13:24:57 -0000 1.13
+++ openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.adp 13 Jan 2004 10:17:11 -0000 1.14
@@ -14,7 +14,6 @@
-TODO: (0.1h) Show total number of users per case
In Automatic casting, only
@@ -44,37 +43,50 @@
-
TODO: (0.5h) if enroll-type is open, show all groups from the subsite in
-each role
+
+ TODO: B: (1h) Show total number of users per case. Javascript. Lars?
+
- 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:
+
+ TODO: (2h) Make sure rule for checking each tab is correct
+
-Warnings:
-
+
+ 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:
-Don't show wizard button if any of these are true:
-
-- missing dates
-
- any invited or enrolled groups that aren't cast to any roles
-
+ Warnings:
+
+ Don't show wizard button if any of these are true:
+
+ - missing dates
+
- any invited or enrolled groups that aren't cast to any roles
+
+
+
-TODO: B: finish button should appear on every tab
+ TODO: B: finish button should appear on every tab
-TODO: (8h) make sure that we are generating all of the notifications
-that we should:
-
-- When a user is enrolled, if casting type is open or group, send a
-notification with a link to the casting page (on finish button)
-
- When a user is invited, send a link to the enrollment page (on finish button)
-
- When simulation notification date is reached, send an email saying
-that the simulation will start at date X. Include the description.
-
- When the simulation starts, send an email with a link to simplay
-with case_id
-
+
+ TODO: (8h) make sure that we are generating all of the notifications
+ that we should:
+
+
+ - When a user is enrolled, if casting type is open or group, send a
+ notification with a link to the casting page (on finish button)
+
- When a user is invited, send a link to the enrollment page (on finish button)
+
- When simulation notification date is reached, send an email saying
+ that the simulation will start at date X. Include the description.
+
- When the simulation starts, send an email with a link to simplay
+ with case_id
+
+
+
+
+ TODO: A: Some data needs to be read only if you return to the wizard after you've clicked the finish button. Test this.
+
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.17 -r1.18
--- openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.tcl 12 Jan 2004 11:35:33 -0000 1.17
+++ openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.tcl 13 Jan 2004 10:17:11 -0000 1.18
@@ -10,6 +10,8 @@
permission::require_write_permission -object_id $workflow_id
+simulation::template::get -workflow_id $workflow_id -array sim_template
+
set page_title "Set user casting rules"
set context [list [list "." "SimInst"] $page_title]
@@ -22,8 +24,14 @@
{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"] } {
+ # Closed enrollment so offer only invited or auto_enroll groups
+ set eligible_groups [simulation::casting_groups -mapped_only -workflow_id $workflow_id]
+} else {
+ # Open enrollment, meaning anybody can sign up, so offer all subsite groups
+ set eligible_groups [simulation::casting_groups -workflow_id $workflow_id]
+}
-set eligible_groups [simulation::casting_groups -mapped_only -workflow_id $workflow_id]
set num_groups [llength $eligible_groups]
foreach role_id [workflow::get_roles -workflow_id $workflow_id] {
Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-edit.tcl,v
diff -u -r1.8 -r1.9
--- openacs-4/contrib/packages/simulation/www/siminst/simulation-edit.tcl 12 Jan 2004 14:46:30 -0000 1.8
+++ openacs-4/contrib/packages/simulation/www/siminst/simulation-edit.tcl 13 Jan 2004 10:17:11 -0000 1.9
@@ -80,6 +80,8 @@
if { [empty_string_p $case_end] } {
set case_end [clock format [expr [clock seconds] + 2*$one_week + $default_duration] -format "%Y-%m-%d"]
}
+ # TODO: B: (0.5h) Offer sensible defaults for enroll_start and enroll_end.
+ # Couldn't get it to work in the on_refresh block. Lars?
if { [empty_string_p $enroll_start] } {
set enroll_start [clock format [expr [clock seconds] + 1*$one_week] -format "%Y-%m-%d"]
}
@@ -91,6 +93,14 @@
# Date validation
set error_p 0
+ # All dates need to be in the future
+ foreach date_var {send_start_note_date case_start case_end enroll_start enroll_end} {
+ if { [clock scan [set $date_var]] < [clock seconds] } {
+ template::form::set_error simulation $date_var "The date needs to be in the future"
+ set error_p 1
+ }
+ }
+
if { [clock scan $send_start_note_date] > [clock scan $case_start] } {
template::form::set_error simulation send_start_note_date "Send start note date must be before simulation start date"
set error_p 1
Index: openacs-4/contrib/packages/simulation/www/siminst/wizard.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/wizard.adp,v
diff -u -r1.6 -r1.7
--- openacs-4/contrib/packages/simulation/www/siminst/wizard.adp 12 Jan 2004 13:24:57 -0000 1.6
+++ openacs-4/contrib/packages/simulation/www/siminst/wizard.adp 13 Jan 2004 10:17:11 -0000 1.7
@@ -13,20 +13,20 @@
@wizard.id@. @wizard.label@
-
+
@wizard.id@. @wizard.label@
-
+
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.10 -r1.11
--- openacs-4/contrib/packages/simulation/www/siminst/wizard.tcl 12 Jan 2004 11:35:33 -0000 1.10
+++ openacs-4/contrib/packages/simulation/www/siminst/wizard.tcl 13 Jan 2004 10:17:11 -0000 1.11
@@ -8,15 +8,16 @@
permission::require_write_permission -object_id $workflow_id
-wizard create siminst -steps {
- 1 -label "Settings" -url "simulation-edit"
- 2 -label "Roles" -url "map-characters"
- 3 -label "Tasks" -url "map-tasks"
- 4 -label "Participants" -url "simulation-participants"
- 5 -label "Casting" -url "simulation-casting-3"
-} -params {
- workflow_id
-}
+wizard create siminst \
+ -steps {
+ 1 -label "Settings" -url "simulation-edit"
+ 2 -label "Roles" -url "map-characters"
+ 3 -label "Tasks" -url "map-tasks"
+ 4 -label "Participants" -url "simulation-participants"
+ 5 -label "Casting" -url "simulation-casting-3"
+ } -params {
+ workflow_id
+ }
wizard set_finish_url [export_vars -base "simulation-casting" { workflow_id }]
@@ -30,54 +31,23 @@
wizard set_param workflow_id $workflow_id
-set state [simulation::template::get_inst_state -workflow_id $workflow_id]
-
set lowest_available 1
-switch $state {
- none {
- set progress 0
- }
- roles_complete {
- set progress 1
- }
- tasks_complete {
- set progress 2
- }
- settings_complete {
- set progress 3
- }
- enrollment_complete {
- set progress 4
- }
- participants_complete {
- set progress 5
- }
- casting {
- set progress 6
- set lowest_available 5
- }
- default {
- error "Unknown state: $state"
- }
-}
+set highest_available 5
-set highest_available [expr $progress + 1]
-if { $highest_available > 6 } {
- set highest_available 6
-}
-
wizard get_current_step -start $highest_available
-if { $highest_available < 5 } {
- set highest_available 5
-}
-
-
-
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.43 -r1.44
--- openacs-4/packages/simulation/tcl/template-procs.tcl 12 Jan 2004 16:14:26 -0000 1.43
+++ openacs-4/packages/simulation/tcl/template-procs.tcl 13 Jan 2004 10:17:11 -0000 1.44
@@ -810,32 +810,38 @@
ad_proc -public simulation::template::get_inst_state {
-workflow_id:required
} {
- Get the instantiation state of a simulation template.
+ Get information about which tab urls in the instantiation wizard
+ have been completed.
- States:
+ @return An array with the following keys (urls) and values either 0 or 1:
- - none
-
- roles_complete
-
- tasks_complete
-
- settings_complete
-
- enrollment_complete
-
- participants_complete
-
- casting
-
- has_cases
+ simulation-edit
+ map-characters
+ map-tasks
+ simulation-participants
+ simulation-casting-3
} {
- simulation::template::get -workflow_id $workflow_id -array sim_template
+ simulation::template::get -workflow_id $workflow_id -array sim_template
# TODO (1.5h): Refactor this and the corresponding wizard.tcl/adp page
# What we really need to know is whether each step is complete
# They're all independent of each other, except for casting, which is dependent on participants.
+ foreach tab [get_wizard_tabs] {
+ set tab_complete_p($tab) 0
+ }
+
switch $sim_template(sim_type) {
dev_sim {
- set state "none"
+
+ # 1. Settings
+ if { ![empty_string_p $sim_template(case_start)] && ![empty_string_p $sim_template(send_start_note_date)] } {
+ set tab_complete_p(simulation-edit) 1
+ }
- # 1. Roles
+ # 2. Roles
set role_empty_count [db_string role_empty_count {
select count(*)
from sim_roles sr,
@@ -845,40 +851,28 @@
and character_id is null
}]
if { $role_empty_count == 0 } {
- set state "roles_complete"
+ set tab_complete_p(map-characters) 1
+ }
- # 2. Tasks
- set prop_empty_count [db_string prop_empty_count {
- select sum((select count(*) from sim_task_object_map where task_id = wa.action_id) - st.attachment_num)
- from sim_tasks st,
- workflow_actions wa
- where st.task_id = wa.action_id
- and wa.workflow_id = :workflow_id
- }]
-
- if { $prop_empty_count == 0 } {
- set state "tasks_complete"
+ # 3. Tasks
+ set prop_empty_count [db_string prop_empty_count {
+ select sum((select count(*) from sim_task_object_map where task_id = wa.action_id) - st.attachment_num)
+ from sim_tasks st,
+ workflow_actions wa
+ where st.task_id = wa.action_id
+ and wa.workflow_id = :workflow_id
+ }]
+ if { $prop_empty_count == 0 } {
+ set tab_complete_p(map-tasks) 1
+ }
- if { ![empty_string_p $sim_template(case_start)] && ![empty_string_p $sim_template(send_start_note_date)] } {
- set state "settings_complete"
-
- if { ![empty_string_p $sim_template(enroll_type)] &&
- (![string equal $sim_template(enroll_type) "open"] ||
- (![empty_string_p $sim_template(enroll_start)] && ![empty_string_p $sim_template(enroll_end)])) } {
- set state "enrollment_complete"
-
- set num_parties [db_string num_parties { select count(*) from sim_party_sim_map where simulation_id = :workflow_id }]
-
- if { $num_parties > 0 } {
- set state "participants_complete"
- }
- }
- }
- }
- }
+ # 4. Participants
+ set num_parties [db_string num_parties { select count(*) from sim_party_sim_map where simulation_id = :workflow_id}]
+ if { [string equal $sim_template(enroll_type) "open"] || $num_parties > 0 } {
+ set tab_complete_p(simulation-participants) 1
+ }
}
casting_sim {
- set state "casting"
set n_cases [db_string select_n_cases {
select count(*)
@@ -887,29 +881,61 @@
}]
if { $n_cases > 0 } {
- set state "has_cases"
- }
+ set tab_complete_p(simulation-casting-3) 1
+ }
}
}
- return $state
+ return [array get tab_complete_p]
}
+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.
+
+ @author Peter Marklund
+} {
+ return {
+ simulation-edit
+ map-characters
+ map-tasks
+ simulation-participants
+ participants_complete
+ simulation-casting-3
+ }
+}
+
ad_proc -public simulation::template::get_state_pretty {
-state:required
} {
Get pretty version of state.
+
+ @see simulation::template::get_inst_state
} {
- array set pretty {
- none "Not started"
- roles_complete "Roles completed"
- tasks_complete "Tasks completed"
- settings_complete "Settings completed"
- enrollment_complete "Enrollment completed"
- participants_complete "Participants completed"
+ 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"
}
+
+ 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
+ }
+ }
- return $pretty($state)
+ return $states_pretty([lindex [get_wizard_tabs] $next_index])
}
ad_proc -public simulation::template::pretty_name_unique_p {
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.28 -r1.29
--- openacs-4/packages/simulation/www/siminst/index.tcl 8 Jan 2004 11:28:07 -0000 1.28
+++ openacs-4/packages/simulation/www/siminst/index.tcl 13 Jan 2004 10:17:11 -0000 1.29
@@ -112,6 +112,7 @@
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/simulation-casting-3.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp,v
diff -u -r1.13 -r1.14
--- openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp 12 Jan 2004 13:24:57 -0000 1.13
+++ openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp 13 Jan 2004 10:17:11 -0000 1.14
@@ -14,7 +14,6 @@
-TODO: (0.1h) Show total number of users per case
In Automatic casting, only
@@ -44,37 +43,50 @@
-
TODO: (0.5h) if enroll-type is open, show all groups from the subsite in
-each role
+
+ TODO: B: (1h) Show total number of users per case. Javascript. Lars?
+
- 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:
+
+ TODO: (2h) Make sure rule for checking each tab is correct
+
-Warnings:
-
+
+ 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:
-Don't show wizard button if any of these are true:
-
-- missing dates
-
- any invited or enrolled groups that aren't cast to any roles
-
+ Warnings:
+
+ Don't show wizard button if any of these are true:
+
+ - missing dates
+
- any invited or enrolled groups that aren't cast to any roles
+
+
+
-TODO: B: finish button should appear on every tab
+ TODO: B: finish button should appear on every tab
-TODO: (8h) make sure that we are generating all of the notifications
-that we should:
-
-- When a user is enrolled, if casting type is open or group, send a
-notification with a link to the casting page (on finish button)
-
- When a user is invited, send a link to the enrollment page (on finish button)
-
- When simulation notification date is reached, send an email saying
-that the simulation will start at date X. Include the description.
-
- When the simulation starts, send an email with a link to simplay
-with case_id
-
+
+ TODO: (8h) make sure that we are generating all of the notifications
+ that we should:
+
+
+ - When a user is enrolled, if casting type is open or group, send a
+ notification with a link to the casting page (on finish button)
+
- When a user is invited, send a link to the enrollment page (on finish button)
+
- When simulation notification date is reached, send an email saying
+ that the simulation will start at date X. Include the description.
+
- When the simulation starts, send an email with a link to simplay
+ with case_id
+
+
+
+
+ TODO: A: Some data needs to be read only if you return to the wizard after you've clicked the finish button. Test this.
+
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.17 -r1.18
--- openacs-4/packages/simulation/www/siminst/simulation-casting-3.tcl 12 Jan 2004 11:35:33 -0000 1.17
+++ openacs-4/packages/simulation/www/siminst/simulation-casting-3.tcl 13 Jan 2004 10:17:11 -0000 1.18
@@ -10,6 +10,8 @@
permission::require_write_permission -object_id $workflow_id
+simulation::template::get -workflow_id $workflow_id -array sim_template
+
set page_title "Set user casting rules"
set context [list [list "." "SimInst"] $page_title]
@@ -22,8 +24,14 @@
{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"] } {
+ # Closed enrollment so offer only invited or auto_enroll groups
+ set eligible_groups [simulation::casting_groups -mapped_only -workflow_id $workflow_id]
+} else {
+ # Open enrollment, meaning anybody can sign up, so offer all subsite groups
+ set eligible_groups [simulation::casting_groups -workflow_id $workflow_id]
+}
-set eligible_groups [simulation::casting_groups -mapped_only -workflow_id $workflow_id]
set num_groups [llength $eligible_groups]
foreach role_id [workflow::get_roles -workflow_id $workflow_id] {
Index: openacs-4/packages/simulation/www/siminst/simulation-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-edit.tcl,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/simulation/www/siminst/simulation-edit.tcl 12 Jan 2004 14:46:30 -0000 1.8
+++ openacs-4/packages/simulation/www/siminst/simulation-edit.tcl 13 Jan 2004 10:17:11 -0000 1.9
@@ -80,6 +80,8 @@
if { [empty_string_p $case_end] } {
set case_end [clock format [expr [clock seconds] + 2*$one_week + $default_duration] -format "%Y-%m-%d"]
}
+ # TODO: B: (0.5h) Offer sensible defaults for enroll_start and enroll_end.
+ # Couldn't get it to work in the on_refresh block. Lars?
if { [empty_string_p $enroll_start] } {
set enroll_start [clock format [expr [clock seconds] + 1*$one_week] -format "%Y-%m-%d"]
}
@@ -91,6 +93,14 @@
# Date validation
set error_p 0
+ # All dates need to be in the future
+ foreach date_var {send_start_note_date case_start case_end enroll_start enroll_end} {
+ if { [clock scan [set $date_var]] < [clock seconds] } {
+ template::form::set_error simulation $date_var "The date needs to be in the future"
+ set error_p 1
+ }
+ }
+
if { [clock scan $send_start_note_date] > [clock scan $case_start] } {
template::form::set_error simulation send_start_note_date "Send start note date must be before simulation start date"
set error_p 1
Index: openacs-4/packages/simulation/www/siminst/wizard.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/wizard.adp,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/simulation/www/siminst/wizard.adp 12 Jan 2004 13:24:57 -0000 1.6
+++ openacs-4/packages/simulation/www/siminst/wizard.adp 13 Jan 2004 10:17:11 -0000 1.7
@@ -13,20 +13,20 @@
@wizard.id@. @wizard.label@
-
+
@wizard.id@. @wizard.label@
-
+
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.10 -r1.11
--- openacs-4/packages/simulation/www/siminst/wizard.tcl 12 Jan 2004 11:35:33 -0000 1.10
+++ openacs-4/packages/simulation/www/siminst/wizard.tcl 13 Jan 2004 10:17:11 -0000 1.11
@@ -8,15 +8,16 @@
permission::require_write_permission -object_id $workflow_id
-wizard create siminst -steps {
- 1 -label "Settings" -url "simulation-edit"
- 2 -label "Roles" -url "map-characters"
- 3 -label "Tasks" -url "map-tasks"
- 4 -label "Participants" -url "simulation-participants"
- 5 -label "Casting" -url "simulation-casting-3"
-} -params {
- workflow_id
-}
+wizard create siminst \
+ -steps {
+ 1 -label "Settings" -url "simulation-edit"
+ 2 -label "Roles" -url "map-characters"
+ 3 -label "Tasks" -url "map-tasks"
+ 4 -label "Participants" -url "simulation-participants"
+ 5 -label "Casting" -url "simulation-casting-3"
+ } -params {
+ workflow_id
+ }
wizard set_finish_url [export_vars -base "simulation-casting" { workflow_id }]
@@ -30,54 +31,23 @@
wizard set_param workflow_id $workflow_id
-set state [simulation::template::get_inst_state -workflow_id $workflow_id]
-
set lowest_available 1
-switch $state {
- none {
- set progress 0
- }
- roles_complete {
- set progress 1
- }
- tasks_complete {
- set progress 2
- }
- settings_complete {
- set progress 3
- }
- enrollment_complete {
- set progress 4
- }
- participants_complete {
- set progress 5
- }
- casting {
- set progress 6
- set lowest_available 5
- }
- default {
- error "Unknown state: $state"
- }
-}
+set highest_available 5
-set highest_available [expr $progress + 1]
-if { $highest_available > 6 } {
- set highest_available 6
-}
-
wizard get_current_step -start $highest_available
-if { $highest_available < 5 } {
- set highest_available 5
-}
-
-
-
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)
+}