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.17 -r1.18
--- openacs-4/packages/simulation/www/siminst/simulation-casting-2.tcl 6 Jan 2004 16:26:37 -0000 1.17
+++ openacs-4/packages/simulation/www/siminst/simulation-casting-2.tcl 6 Jan 2004 18:36:28 -0000 1.18
@@ -6,134 +6,124 @@
simulation::template::get -workflow_id $workflow_id -array sim_template
-if { ![string equal $sim_template(sim_type) "casting_sim"] } {
- set page_title "Begin Casting"
- set begin_casting_url [export_vars -base simulation-casting { workflow_id {return_url {[ad_return_url]}} }]
+set package_id [ad_conn package_id]
-} else {
+subsite::get -array closest_subsite
+set group_admin_url "${closest_subsite(url)}admin/group-types/one?group_type=group"
- set page_title "Cast $sim_template(pretty_name)"
- set package_id [ad_conn package_id]
+# TODO: verify that prepopulated values work correctly
- subsite::get -array closest_subsite
- set group_admin_url "${closest_subsite(url)}admin/group-types/one?group_type=group"
+# TODO: provide more sensible default dates?
+# Notification send could be start date minus some parameter
+set in_a_month_date [clock format [expr [clock seconds] + 3600*24*31] -format "%Y-%m-%d"]
+set in_two_months_date [clock format [expr [clock seconds] + 2*3600*24*31] -format "%Y-%m-%d"]
+set in_two_and_a_half_months_date [clock format [expr [clock seconds] + 3*3600*24*31 - 3600*24*15] -format "%Y-%m-%d"]
+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"]
- # TODO: verify that prepopulated values work correctly
+set eligible_groups [simulation::casting_groups -workflow_id $workflow_id]
- # TODO: provide more sensible default dates?
- # Notification send could be start date minus some parameter
- set in_a_month_date [clock format [expr [clock seconds] + 3600*24*31] -format "%Y-%m-%d"]
- set in_two_months_date [clock format [expr [clock seconds] + 2*3600*24*31] -format "%Y-%m-%d"]
- set in_two_and_a_half_months_date [clock format [expr [clock seconds] + 3*3600*24*31 - 3600*24*15] -format "%Y-%m-%d"]
- 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"]
+ad_form -export { workflow_id } -name simulation -form {
+ {enroll_type:text(radio)
+ {label "Enrollment type"}
+ {options {{"By invitation only" closed} {Open open}}}
+ {html {onChange "javascript:FormRefresh('simulation');"}}
+ }
+ {enroll_start:date,to_sql(ansi),from_sql(ansi),optional
+ {label "Enrollment start date"}
+ }
+ {enroll_end:date,to_sql(ansi),from_sql(ansi),optional
+ {label "Enrollment end date"}
+ }
+ {send_start_note_date:date,to_sql(ansi),from_sql(ansi),optional
+ {label "Date to send start notification (mockup only)"}
+ }
+ {case_start:date,to_sql(ansi),from_sql(ansi),optional
+ {label "Simulation start date"}
+ }
+ {case_end:date,to_sql(ansi),from_sql(ansi),optional
+ {label "Simulation end date"}
+ }
+ {casting_type:text(radio)
+ {label "Casting type"}
+ {options {{Automatic auto} {Group group} {Open open}}}
+ }
+ {auto_enroll:integer(checkbox),multiple,optional
+ {label "Enroll all users in these groups"}
+ {options $eligible_groups}
+ {help_text {Use Group Administration to add groups}}
+ }
+ {invite_groups:integer(checkbox),multiple,optional
+ {label "Invite all users in these groups (mockup only)"}
+ {options $eligible_groups}
+ {help_text {Use Group Administration to add groups}}
+ }
+} -on_request {
- set eligible_groups [simulation::casting_groups -workflow_id $workflow_id]
+ foreach elm {
+ enroll_type
+ casting_type
+ enroll_start
+ enroll_end
+ case_start
+ case_end
+ send_start_note_date
+ } {
+ set $elm $sim_template($elm)
+ }
- ad_form -export { workflow_id } -name simulation -form {
- {enroll_type:text(radio)
- {label "Enrollment type"}
- {options {{"By invitation only" closed} {Open open}}}
- {html {onChange "javascript:FormRefresh('simulation');"}}
- }
- {enroll_start:date,to_sql(ansi),from_sql(ansi),optional
- {label "Enrollment start date"}
- }
- {enroll_end:date,to_sql(ansi),from_sql(ansi),optional
- {label "Enrollment end date"}
- }
- {send_start_note_date:date,to_sql(ansi),from_sql(ansi),optional
- {label "Date to send start notification (mockup only)"}
- }
- {case_start:date,to_sql(ansi),from_sql(ansi),optional
- {label "Simulation start date"}
- }
- {case_end:date,to_sql(ansi),from_sql(ansi),optional
- {label "Simulation end date"}
- }
- {casting_type:text(radio)
- {label "Casting type"}
- {options {{Automatic auto} {Group group} {Open open}}}
- }
- {auto_enroll:integer(checkbox),multiple,optional
- {label "Enroll all users in these groups"}
- {options $eligible_groups}
- {help_text {Use Group Administration to add groups}}
- }
- {invite_groups:integer(checkbox),multiple,optional
- {label "Invite all users in these groups (mockup only)"}
- {options $eligible_groups}
- {help_text {Use Group Administration to add groups}}
- }
- } -on_request {
+ set auto_enroll [simulation::template::get_parties -workflow_id $workflow_id -rel_type auto_enroll]
- foreach elm {
- enroll_type
- casting_type
- enroll_start
- enroll_end
- case_start
- case_end
- send_start_note_date
- } {
- set $elm $sim_template($elm)
- }
+ # Default values
+ if { [empty_string_p $enroll_start] } {
+ set enroll_start $in_a_month_date
+ }
+ if { [empty_string_p $enroll_end] } {
+ set enroll_end $in_two_months_date
+ }
+ if { [empty_string_p $send_start_note_date] } {
+ set send_start_note_date $in_two_and_a_half_months_date
+ }
+ if { [empty_string_p $case_start] } {
+ set case_start $in_three_months_date
+ }
+ if { [empty_string_p $case_end] } {
+ set case_end $in_three_months_date
+ }
+ if { [empty_string_p $enroll_type] } {
+ set enroll_type "closed"
+ }
+ if { [empty_string_p $casting_type] } {
+ set casting_type "auto"
+ }
- set auto_enroll [simulation::template::get_parties -workflow_id $workflow_id -rel_type auto_enroll]
+ if { [string equal $enroll_type "closed"] } {
+ element set_properties simulation enroll_start -widget hidden
+ element set_properties simulation enroll_end -widget hidden
+ }
- # Default values
- if { [empty_string_p $enroll_start] } {
- set enroll_start $in_a_month_date
- }
- if { [empty_string_p $enroll_end] } {
- set enroll_end $in_two_months_date
- }
- if { [empty_string_p $send_start_note_date] } {
- set send_start_note_date $in_two_and_a_half_months_date
- }
- if { [empty_string_p $case_start] } {
- set case_start $in_three_months_date
- }
- if { [empty_string_p $case_end] } {
- set case_end $in_three_months_date
- }
- if { [empty_string_p $enroll_type] } {
- set enroll_type "closed"
- }
- if { [empty_string_p $casting_type] } {
- set casting_type "auto"
- }
+} -on_refresh {
- if { [string equal $enroll_type "closed"] } {
- element set_properties simulation enroll_start -widget hidden
- element set_properties simulation enroll_end -widget hidden
- }
+ if { [string equal $enroll_type "closed"] } {
+ element set_properties simulation enroll_start -widget hidden
+ element set_properties simulation enroll_end -widget hidden
+ } else {
+ element set_properties simulation enroll_start -widget date
+ element set_properties simulation enroll_end -widget date
+ }
- } -on_refresh {
-
- if { [string equal $enroll_type "closed"] } {
- element set_properties simulation enroll_start -widget hidden
- element set_properties simulation enroll_end -widget hidden
- } else {
- element set_properties simulation enroll_start -widget date
- element set_properties simulation enroll_end -widget date
- }
-
- } -on_submit {
- foreach elm { enroll_start enroll_end send_start_note_date case_start case_end enroll_type casting_type auto_enroll } {
- set row($elm) [set $elm]
- }
-
- # TODO: add invite_gropus to list of elements above
-
- simulation::template::edit \
- -workflow_id $workflow_id \
- -array row
-
- wizard forward
+} -on_submit {
+ foreach elm { enroll_start enroll_end send_start_note_date case_start case_end enroll_type casting_type auto_enroll } {
+ set row($elm) [set $elm]
}
+
+ # TODO: add invite_gropus to list of elements above
- wizard submit simulation -buttons { back next }
+ simulation::template::edit \
+ -workflow_id $workflow_id \
+ -array row
+
+ wizard forward
}
-set context [list [list "." "SimInst"] $page_title]
+wizard submit simulation -buttons { back next }