Index: openacs-4/contrib/packages/simulation/tcl/simulation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/simulation-procs.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/contrib/packages/simulation/tcl/simulation-procs.tcl 6 Jan 2004 16:09:33 -0000 1.20 +++ openacs-4/contrib/packages/simulation/tcl/simulation-procs.tcl 6 Jan 2004 18:36:27 -0000 1.21 @@ -178,7 +178,8 @@ @author Peter Marklund } { # Lookup the application group of the subsite - set subsite_group_id [subsite_group_id] + set subsite_group_id [application_group::group_id_from_package_id \ + -package_id [ad_conn subsite_id]] # Get all groups related to (children of) the subsite group (only one level down) set enrollment_clause [ad_decode $enrolled_only_p "0" "" "and exists (select 1 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.31 -r1.32 --- openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 6 Jan 2004 16:26:37 -0000 1.31 +++ openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 6 Jan 2004 18:36:27 -0000 1.32 @@ -755,7 +755,9 @@
  • none
  • roles_complete
  • tasks_complete -
  • casting_begun +
  • settings_complete +
  • enrollment_complete +
  • participants_complete } { simulation::template::get -workflow_id $workflow_id -array sim_template @@ -775,7 +777,7 @@ and character_id is null }] if { $role_empty_count == 0 } { - set state "roles" + set state "roles_complete" # 2. Tasks set prop_empty_count [db_string prop_empty_count { @@ -787,13 +789,26 @@ }] if { $prop_empty_count == 0 } { - set state "tasks" + set state "tasks_complete" + + 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" + } + } + } } } } - casting_sim { - set state "casting_begun" - } } return $state Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-casting-2.adp,v diff -u -r1.10 -r1.11 --- openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-2.adp 6 Jan 2004 16:26:37 -0000 1.10 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-2.adp 6 Jan 2004 18:36:28 -0000 1.11 @@ -1,14 +1,3 @@ - -

    - You have not yet started casting this simulation. -

    -

    - Once you start casting, you can no longer change the roles mapping or task setup. -

    - Begin casting now -
    - - -

    TODO: implement invitations. -

    TODO: When switching from open enrollment to "by invitation only" and back, the dates are lost -- see if we can avoid that. - + +

    TODO: implement invitations. +

    TODO: When switching from open enrollment to "by invitation only" and back, the dates are lost -- see if we can avoid that. Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-casting-2.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-2.tcl 6 Jan 2004 16:26:37 -0000 1.17 +++ openacs-4/contrib/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 } 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.10 -r1.11 --- openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.tcl 6 Jan 2004 16:04:29 -0000 1.10 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.tcl 6 Jan 2004 18:36:28 -0000 1.11 @@ -20,7 +20,7 @@ foreach role_id [workflow::get_roles -workflow_id $workflow_id] { set role_${role_id}_pretty_name [workflow::role::get_element -role_id $role_id -element pretty_name] - lappend form [list parties_${role_id}:text(checkbox),multiple \ + lappend form [list parties_${role_id}:text(checkbox),multiple,optional \ [list help_text "Only users in these groups can be cast in this role"] \ [list label \$role_${role_id}_pretty_name] \ [list options $eligible_groups] @@ -76,6 +76,8 @@ -parties [set parties_$role_id] \ } - ad_returnredirect . - ad_script_abort + wizard forward } + +wizard submit actors -buttons { back next } + Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/siminst/simulation-edit.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/siminst/simulation-edit.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-enrollment.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-enrollment.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-enrollment.adp 6 Jan 2004 18:36:28 -0000 1.1 @@ -0,0 +1,3 @@ + + +

    TODO B: When switching from open enrollment to "by invitation only" and back, the dates are lost -- see if we can avoid that.

    Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-enrollment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-enrollment.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-enrollment.tcl 6 Jan 2004 18:36:28 -0000 1.1 @@ -0,0 +1,80 @@ +ad_page_contract { + Create a new simulation +} { + workflow_id:integer +} + +simulation::template::get -workflow_id $workflow_id -array sim_template + +set package_id [ad_conn package_id] + +#subsite::get -array closest_subsite +#set group_admin_url [export_vars -base "${closest_subsite(url)}admin/group-types/one" { { group_type group } }] +#set eligible_groups [simulation::casting_groups -workflow_id $workflow_id] + +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"} + } +} -on_request { + + foreach elm { + enroll_type + enroll_start + enroll_end + } { + set $elm $sim_template($elm) + } + +# set auto_enroll [simulation::template::get_parties -workflow_id $workflow_id -rel_type auto_enroll] + + # Default values + set one_month [expr 3600*24*31] + + # TODO: provide more sensible default dates? + if { [empty_string_p $enroll_start] } { + set enroll_start [clock format [expr [clock seconds] + 1*$one_month] -format "%Y-%m-%d"] + } + if { [empty_string_p $enroll_end] } { + set enroll_end [clock format [expr [clock seconds] + 2*$one_month] -format "%Y-%m-%d"] + } + if { [empty_string_p $enroll_type] } { + set enroll_type "closed" + } + + if { [string equal $enroll_type "closed"] } { + element set_properties simulation enroll_start -widget hidden + element set_properties simulation enroll_end -widget hidden + } + +} -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 enroll_type } { + set row($elm) [set $elm] + } + + simulation::template::edit \ + -workflow_id $workflow_id \ + -array row + + wizard forward +} + +wizard submit simulation -buttons { back next } Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-participants.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.adp 6 Jan 2004 18:36:28 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + +

    + + + +
    + +Manage groups Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-participants.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.tcl 6 Jan 2004 18:36:28 -0000 1.1 @@ -0,0 +1,135 @@ +ad_page_contract { + Create a new simulation +} { + workflow_id:integer +} + + +simulation::template::get -workflow_id $workflow_id -array sim_template + +set group_admin_url [export_vars -base "[subsite::get_element -element url]admin/group-types/one" { { group_type group } }] + + + +set permission_group_name [simulation::permission_group_name] + +set subsite_group_id [application_group::group_id_from_package_id \ + -package_id [ad_conn subsite_id]] + +ad_form -name simulation -form { + {workflow_id:integer(hidden) {value $workflow_id}} +} + +set groups [list] + +db_multirow participants select_participants { + select g.group_name, + g.group_id, + (select count(distinct u.user_id) + from party_approved_member_map pamm, + users u + where pamm.party_id = g.group_id + and pamm.member_id = u.user_id + ) as n_users, + (select count(*) + from sim_party_sim_map + where simulation_id = :workflow_id + and party_id = g.group_id + and type = 'auto_enroll') as auto_enroll_p, + (select count(*) + from sim_party_sim_map + where simulation_id = :workflow_id + and party_id = g.group_id + and type = 'invited') as invited_p + from acs_rels ar, + groups g + where ar.object_id_one = :subsite_group_id + and ar.object_id_two = g.group_id + and g.group_name <> :permission_group_name + order by g.group_name +} { + ad_form -extend -name simulation -form \ + [list [list __auto_enroll_$group_id:text,optional]] + + ad_form -extend -name simulation -form \ + [list [list __invited_$group_id:text,optional]] + + lappend groups $group_id +} + +template::list::create \ + -name "participants" \ + -key group_id \ + -elements { + group_name { + label "Group Name" + } + n_users { + label "\# Users" + display_eval {[lc_numeric $n_users]} + html { align right } + } + invited_p { + label "Invited" + display_template { + + + + + + + } + html { align center } + } + auto_enroll_p { + label "Auto-Enroll" + display_template { + + + + + + + } + html { align center } + } + } + +# + +wizard submit simulation -buttons { back next } + +ad_form \ + -extend \ + -name simulation \ + -form { + {groups:text(hidden),optional {value $groups}} + } \ + -on_request { + # Grab values from local vars + } \ + -on_submit { + + db_transaction { + foreach group_id $groups { + foreach type { invited auto_enroll } { + db_dml delete_party { + delete from sim_party_sim_map + where simulation_id = :workflow_id + and type = :type + and party_id = :group_id + } + if { [exists_and_equal __${type}_${group_id} "t"] } { + db_dml insert_party { + insert into sim_party_sim_map (simulation_id, party_id, type) + values (:workflow_id, :group_id, :type) + } + } + } + } + } + + } -after_submit { + wizard forward + } + 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.2 -r1.3 --- openacs-4/contrib/packages/simulation/www/siminst/wizard.tcl 6 Jan 2004 16:26:37 -0000 1.2 +++ openacs-4/contrib/packages/simulation/www/siminst/wizard.tcl 6 Jan 2004 18:36:28 -0000 1.3 @@ -11,45 +11,56 @@ wizard create siminst -steps { 1 -label "Roles" -url "map-characters" 2 -label "Tasks" -url "map-tasks" - 3 -label "Casting" -url "simulation-casting-2" - 4 -label "Groups" -url "simulation-casting-3" + 3 -label "Settings" -url "simulation-edit" + 4 -label "Enrollment" -url "simulation-enrollment" + 5 -label "Participants" -url "simulation-participants" + 6 -label "Casting" -url "simulation-casting-3" } -params { workflow_id } +array set title { + 1 "Assign Roles to Characters" + 2 "Populate Tasks" + 3 "Simulation Settings" + 4 "Define Enrollment" + 5 "Select Participants" + 6 "Define Casting Rules" +} + 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 lowest_available 1 set progress 0 } roles_complete { - set lowest_available 1 set progress 1 } tasks_complete { - set lowest_available 1 set progress 2 } - casting_begun { - set lowest_available 3 - set progress 2 + settings_complete { + set progress 3 } + enrollment_complete { + set progress 4 + } + participants_complete { + set progress 5 + } + default { + error "Unknown state: $state" + } } set highest_available [expr $progress + 1] wizard get_current_step -start $highest_available -array set title { - 1 "Assign Roles to Characters" - 2 "Populate Tasks" - 3 "Define Casting" - 4 "Assign Groups to Roles" -} set sub_title $title(${wizard:current_id}) workflow::get -workflow_id $workflow_id -array workflow Index: openacs-4/packages/simulation/tcl/simulation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/simulation-procs.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/packages/simulation/tcl/simulation-procs.tcl 6 Jan 2004 16:09:33 -0000 1.20 +++ openacs-4/packages/simulation/tcl/simulation-procs.tcl 6 Jan 2004 18:36:27 -0000 1.21 @@ -178,7 +178,8 @@ @author Peter Marklund } { # Lookup the application group of the subsite - set subsite_group_id [subsite_group_id] + set subsite_group_id [application_group::group_id_from_package_id \ + -package_id [ad_conn subsite_id]] # Get all groups related to (children of) the subsite group (only one level down) set enrollment_clause [ad_decode $enrolled_only_p "0" "" "and exists (select 1 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.31 -r1.32 --- openacs-4/packages/simulation/tcl/template-procs.tcl 6 Jan 2004 16:26:37 -0000 1.31 +++ openacs-4/packages/simulation/tcl/template-procs.tcl 6 Jan 2004 18:36:27 -0000 1.32 @@ -755,7 +755,9 @@
  • none
  • roles_complete
  • tasks_complete -
  • casting_begun +
  • settings_complete +
  • enrollment_complete +
  • participants_complete } { simulation::template::get -workflow_id $workflow_id -array sim_template @@ -775,7 +777,7 @@ and character_id is null }] if { $role_empty_count == 0 } { - set state "roles" + set state "roles_complete" # 2. Tasks set prop_empty_count [db_string prop_empty_count { @@ -787,13 +789,26 @@ }] if { $prop_empty_count == 0 } { - set state "tasks" + set state "tasks_complete" + + 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" + } + } + } } } } - casting_sim { - set state "casting_begun" - } } return $state Index: openacs-4/packages/simulation/www/siminst/simulation-casting-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/Attic/simulation-casting-2.adp,v diff -u -r1.10 -r1.11 --- openacs-4/packages/simulation/www/siminst/simulation-casting-2.adp 6 Jan 2004 16:26:37 -0000 1.10 +++ openacs-4/packages/simulation/www/siminst/simulation-casting-2.adp 6 Jan 2004 18:36:28 -0000 1.11 @@ -1,14 +1,3 @@ - -

    - You have not yet started casting this simulation. -

    -

    - Once you start casting, you can no longer change the roles mapping or task setup. -

    - Begin casting now -
    - - -

    TODO: implement invitations. -

    TODO: When switching from open enrollment to "by invitation only" and back, the dates are lost -- see if we can avoid that. - + +

    TODO: implement invitations. +

    TODO: When switching from open enrollment to "by invitation only" and back, the dates are lost -- see if we can avoid that. 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 } 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.10 -r1.11 --- openacs-4/packages/simulation/www/siminst/simulation-casting-3.tcl 6 Jan 2004 16:04:29 -0000 1.10 +++ openacs-4/packages/simulation/www/siminst/simulation-casting-3.tcl 6 Jan 2004 18:36:28 -0000 1.11 @@ -20,7 +20,7 @@ foreach role_id [workflow::get_roles -workflow_id $workflow_id] { set role_${role_id}_pretty_name [workflow::role::get_element -role_id $role_id -element pretty_name] - lappend form [list parties_${role_id}:text(checkbox),multiple \ + lappend form [list parties_${role_id}:text(checkbox),multiple,optional \ [list help_text "Only users in these groups can be cast in this role"] \ [list label \$role_${role_id}_pretty_name] \ [list options $eligible_groups] @@ -76,6 +76,8 @@ -parties [set parties_$role_id] \ } - ad_returnredirect . - ad_script_abort + wizard forward } + +wizard submit actors -buttons { back next } + Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/siminst/simulation-edit.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/siminst/simulation-edit.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/simulation/www/siminst/simulation-enrollment.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/Attic/simulation-enrollment.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/siminst/simulation-enrollment.adp 6 Jan 2004 18:36:28 -0000 1.1 @@ -0,0 +1,3 @@ + + +

    TODO B: When switching from open enrollment to "by invitation only" and back, the dates are lost -- see if we can avoid that.

    Index: openacs-4/packages/simulation/www/siminst/simulation-enrollment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/Attic/simulation-enrollment.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/siminst/simulation-enrollment.tcl 6 Jan 2004 18:36:28 -0000 1.1 @@ -0,0 +1,80 @@ +ad_page_contract { + Create a new simulation +} { + workflow_id:integer +} + +simulation::template::get -workflow_id $workflow_id -array sim_template + +set package_id [ad_conn package_id] + +#subsite::get -array closest_subsite +#set group_admin_url [export_vars -base "${closest_subsite(url)}admin/group-types/one" { { group_type group } }] +#set eligible_groups [simulation::casting_groups -workflow_id $workflow_id] + +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"} + } +} -on_request { + + foreach elm { + enroll_type + enroll_start + enroll_end + } { + set $elm $sim_template($elm) + } + +# set auto_enroll [simulation::template::get_parties -workflow_id $workflow_id -rel_type auto_enroll] + + # Default values + set one_month [expr 3600*24*31] + + # TODO: provide more sensible default dates? + if { [empty_string_p $enroll_start] } { + set enroll_start [clock format [expr [clock seconds] + 1*$one_month] -format "%Y-%m-%d"] + } + if { [empty_string_p $enroll_end] } { + set enroll_end [clock format [expr [clock seconds] + 2*$one_month] -format "%Y-%m-%d"] + } + if { [empty_string_p $enroll_type] } { + set enroll_type "closed" + } + + if { [string equal $enroll_type "closed"] } { + element set_properties simulation enroll_start -widget hidden + element set_properties simulation enroll_end -widget hidden + } + +} -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 enroll_type } { + set row($elm) [set $elm] + } + + simulation::template::edit \ + -workflow_id $workflow_id \ + -array row + + wizard forward +} + +wizard submit simulation -buttons { back next } Index: openacs-4/packages/simulation/www/siminst/simulation-participants.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-participants.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/siminst/simulation-participants.adp 6 Jan 2004 18:36:28 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + +

    + + + +
    + +Manage groups Index: openacs-4/packages/simulation/www/siminst/simulation-participants.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-participants.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/siminst/simulation-participants.tcl 6 Jan 2004 18:36:28 -0000 1.1 @@ -0,0 +1,135 @@ +ad_page_contract { + Create a new simulation +} { + workflow_id:integer +} + + +simulation::template::get -workflow_id $workflow_id -array sim_template + +set group_admin_url [export_vars -base "[subsite::get_element -element url]admin/group-types/one" { { group_type group } }] + + + +set permission_group_name [simulation::permission_group_name] + +set subsite_group_id [application_group::group_id_from_package_id \ + -package_id [ad_conn subsite_id]] + +ad_form -name simulation -form { + {workflow_id:integer(hidden) {value $workflow_id}} +} + +set groups [list] + +db_multirow participants select_participants { + select g.group_name, + g.group_id, + (select count(distinct u.user_id) + from party_approved_member_map pamm, + users u + where pamm.party_id = g.group_id + and pamm.member_id = u.user_id + ) as n_users, + (select count(*) + from sim_party_sim_map + where simulation_id = :workflow_id + and party_id = g.group_id + and type = 'auto_enroll') as auto_enroll_p, + (select count(*) + from sim_party_sim_map + where simulation_id = :workflow_id + and party_id = g.group_id + and type = 'invited') as invited_p + from acs_rels ar, + groups g + where ar.object_id_one = :subsite_group_id + and ar.object_id_two = g.group_id + and g.group_name <> :permission_group_name + order by g.group_name +} { + ad_form -extend -name simulation -form \ + [list [list __auto_enroll_$group_id:text,optional]] + + ad_form -extend -name simulation -form \ + [list [list __invited_$group_id:text,optional]] + + lappend groups $group_id +} + +template::list::create \ + -name "participants" \ + -key group_id \ + -elements { + group_name { + label "Group Name" + } + n_users { + label "\# Users" + display_eval {[lc_numeric $n_users]} + html { align right } + } + invited_p { + label "Invited" + display_template { + + + + + + + } + html { align center } + } + auto_enroll_p { + label "Auto-Enroll" + display_template { + + + + + + + } + html { align center } + } + } + +# + +wizard submit simulation -buttons { back next } + +ad_form \ + -extend \ + -name simulation \ + -form { + {groups:text(hidden),optional {value $groups}} + } \ + -on_request { + # Grab values from local vars + } \ + -on_submit { + + db_transaction { + foreach group_id $groups { + foreach type { invited auto_enroll } { + db_dml delete_party { + delete from sim_party_sim_map + where simulation_id = :workflow_id + and type = :type + and party_id = :group_id + } + if { [exists_and_equal __${type}_${group_id} "t"] } { + db_dml insert_party { + insert into sim_party_sim_map (simulation_id, party_id, type) + values (:workflow_id, :group_id, :type) + } + } + } + } + } + + } -after_submit { + wizard forward + } + 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.2 -r1.3 --- openacs-4/packages/simulation/www/siminst/wizard.tcl 6 Jan 2004 16:26:37 -0000 1.2 +++ openacs-4/packages/simulation/www/siminst/wizard.tcl 6 Jan 2004 18:36:28 -0000 1.3 @@ -11,45 +11,56 @@ wizard create siminst -steps { 1 -label "Roles" -url "map-characters" 2 -label "Tasks" -url "map-tasks" - 3 -label "Casting" -url "simulation-casting-2" - 4 -label "Groups" -url "simulation-casting-3" + 3 -label "Settings" -url "simulation-edit" + 4 -label "Enrollment" -url "simulation-enrollment" + 5 -label "Participants" -url "simulation-participants" + 6 -label "Casting" -url "simulation-casting-3" } -params { workflow_id } +array set title { + 1 "Assign Roles to Characters" + 2 "Populate Tasks" + 3 "Simulation Settings" + 4 "Define Enrollment" + 5 "Select Participants" + 6 "Define Casting Rules" +} + 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 lowest_available 1 set progress 0 } roles_complete { - set lowest_available 1 set progress 1 } tasks_complete { - set lowest_available 1 set progress 2 } - casting_begun { - set lowest_available 3 - set progress 2 + settings_complete { + set progress 3 } + enrollment_complete { + set progress 4 + } + participants_complete { + set progress 5 + } + default { + error "Unknown state: $state" + } } set highest_available [expr $progress + 1] wizard get_current_step -start $highest_available -array set title { - 1 "Assign Roles to Characters" - 2 "Populate Tasks" - 3 "Define Casting" - 4 "Assign Groups to Roles" -} set sub_title $title(${wizard:current_id}) workflow::get -workflow_id $workflow_id -array workflow