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 -r1.8 -r1.9 --- openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.adp 12 Jan 2004 14:46:30 -0000 1.8 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.adp 12 Jan 2004 15:44:46 -0000 1.9 @@ -1,6 +1,3 @@ -

TODO: (0.5h) change invited/mandatory checkboxes to a single radio button -set per row: invited/mandatory/neither invited nor mandatory or preferably use Javascript with checkboxes - 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 -r1.6 -r1.7 --- openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.tcl 12 Jan 2004 14:46:30 -0000 1.6 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.tcl 12 Jan 2004 15:44:46 -0000 1.7 @@ -21,7 +21,7 @@ set groups [list] -db_multirow participants select_participants { +db_multirow -extend { group_radio } participants select_participants { select g.group_name, g.group_id, (select count(distinct u.user_id) @@ -48,12 +48,17 @@ order by lower(g.group_name) } { ad_form -extend -name simulation -form \ - [list [list __auto_enroll_$group_id:text,optional]] + [list [list __group_$group_id:text,optional]] - ad_form -extend -name simulation -form \ - [list [list __invited_$group_id:text,optional]] - lappend groups $group_id + + if { $invited_p > 0 } { + set group_radio invited + } elseif { $auto_enroll_p > 0 } { + set group_radio auto_enroll + } else { + set group_radio neither + } } template::list::create \ @@ -71,27 +76,24 @@ invited_p { label "Invited" display_template { - - - - - - + checked="checked"> } html { align center } } auto_enroll_p { - label "Mandatory Participation" - display_template { - - - - - - + label "Mandatory" + display_template { + checked> } html { align center } } + neither { + label "Neither invited nor mandatory" + display_template { + checked="checked"> + } + html { align center } + } } wizard submit simulation -buttons { back next } @@ -103,13 +105,6 @@ {groups:text(hidden),optional {value $groups}} } -on_submit { - # First, drop all "invited" check marks if the user is also auto-enrolled - foreach group_id $groups { - if { [exists_and_equal __invited_${group_id} "t"] && [exists_and_equal __auto_enroll_${group_id} "t"] } { - unset __invited_${group_id} - } - } - db_transaction { foreach group_id $groups { foreach type { invited auto_enroll } { @@ -119,7 +114,9 @@ and type = :type and party_id = :group_id } - if { [exists_and_equal __${type}_${group_id} "t"] } { + + set selected_type [element get_value simulation __group_${group_id}] + if { [string equal $selected_type $type] } { db_dml insert_party { insert into sim_party_sim_map (simulation_id, party_id, type) values (:workflow_id, :group_id, :type) @@ -132,4 +129,3 @@ } -after_submit { wizard forward } - 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 -r1.8 -r1.9 --- openacs-4/packages/simulation/www/siminst/simulation-participants.adp 12 Jan 2004 14:46:30 -0000 1.8 +++ openacs-4/packages/simulation/www/siminst/simulation-participants.adp 12 Jan 2004 15:44:46 -0000 1.9 @@ -1,6 +1,3 @@ -

TODO: (0.5h) change invited/mandatory checkboxes to a single radio button -set per row: invited/mandatory/neither invited nor mandatory or preferably use Javascript with checkboxes - 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 -r1.6 -r1.7 --- openacs-4/packages/simulation/www/siminst/simulation-participants.tcl 12 Jan 2004 14:46:30 -0000 1.6 +++ openacs-4/packages/simulation/www/siminst/simulation-participants.tcl 12 Jan 2004 15:44:46 -0000 1.7 @@ -21,7 +21,7 @@ set groups [list] -db_multirow participants select_participants { +db_multirow -extend { group_radio } participants select_participants { select g.group_name, g.group_id, (select count(distinct u.user_id) @@ -48,12 +48,17 @@ order by lower(g.group_name) } { ad_form -extend -name simulation -form \ - [list [list __auto_enroll_$group_id:text,optional]] + [list [list __group_$group_id:text,optional]] - ad_form -extend -name simulation -form \ - [list [list __invited_$group_id:text,optional]] - lappend groups $group_id + + if { $invited_p > 0 } { + set group_radio invited + } elseif { $auto_enroll_p > 0 } { + set group_radio auto_enroll + } else { + set group_radio neither + } } template::list::create \ @@ -71,27 +76,24 @@ invited_p { label "Invited" display_template { - - - - - - + checked="checked"> } html { align center } } auto_enroll_p { - label "Mandatory Participation" - display_template { - - - - - - + label "Mandatory" + display_template { + checked> } html { align center } } + neither { + label "Neither invited nor mandatory" + display_template { + checked="checked"> + } + html { align center } + } } wizard submit simulation -buttons { back next } @@ -103,13 +105,6 @@ {groups:text(hidden),optional {value $groups}} } -on_submit { - # First, drop all "invited" check marks if the user is also auto-enrolled - foreach group_id $groups { - if { [exists_and_equal __invited_${group_id} "t"] && [exists_and_equal __auto_enroll_${group_id} "t"] } { - unset __invited_${group_id} - } - } - db_transaction { foreach group_id $groups { foreach type { invited auto_enroll } { @@ -119,7 +114,9 @@ and type = :type and party_id = :group_id } - if { [exists_and_equal __${type}_${group_id} "t"] } { + + set selected_type [element get_value simulation __group_${group_id}] + if { [string equal $selected_type $type] } { db_dml insert_party { insert into sim_party_sim_map (simulation_id, party_id, type) values (:workflow_id, :group_id, :type) @@ -132,4 +129,3 @@ } -after_submit { wizard forward } -