Index: openacs-4/packages/simulation/tcl/action-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/Attic/action-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/simulation/tcl/action-procs.tcl 1 Dec 2003 10:16:56 -0000 1.2 +++ openacs-4/packages/simulation/tcl/action-procs.tcl 9 Dec 2003 15:58:12 -0000 1.3 @@ -10,61 +10,42 @@ ad_proc -public simulation::action::edit { {-action_id:required} - {-sort_order {}} - {-short_name:required} - {-pretty_name:required} - {-pretty_past_tense {}} - {-edit_fields {}} - {-allowed_roles {}} - {-assigned_role {}} - {-privileges {}} - {-enabled_states {}} - {-assigned_states {}} - {-new_state {}} - {-callbacks {}} - {-always_enabled_p f} - {-initial_action_p f} - {-recipient_role:required {}} - {-description {}} - {-description_mime_type {}} + {-workflow_id {}} + {-array:required} + {-internal:boolean} } { - Edit an action. Mostly a wrapper for fsm, plus some simulation-specific stuff. + Edit an action. Mostly a wrapper for FSM, plus some simulation-specific stuff. } { - - # should call API, but API doesn't exist yet - # deferring at the moment since we're only changing two fields in this - # prototype UI anyway. But it would look like this: - - # workflow::action::fsm::edit \ - # -workflow_id $workflow_id - # -short_name $name \ - # -pretty_name $name \ - # -assigned_role $assigned_role - + upvar 1 $array org_row + array set row [array get org_row] - - - set workflow_id [workflow::action::get_workflow_id -action_id $action_id] - - - db_transaction { - foreach col { short_name pretty_name assigned_role description description_mime_type } { - set action_array($col) [set $col] + if { [info exists row(recipient_role)] } { + set recipient_role_id [workflow::role::get_id \ + -workflow_id $workflow_id \ + -short_name $row(recipient_role)] + + db_dml edit_sim_role { + update sim_tasks + set recipient = :recipient_role_id + where task_id = :action_id + } + + unset row(recipient_role) } - + workflow::action::fsm::edit \ + -internal \ -action_id $action_id \ - -array action_array + -workflow_id $workflow_id \ + -array row - set recipient_role_id [workflow::role::get_id -workflow_id $workflow_id -short_name $recipient_role] - db_dml edit_sim_role { - update sim_tasks - set recipient = :recipient_role_id - where task_id = :action_id + if { !$internal_p } { + workflow::definition_changed_handler -workflow_id $workflow_id } } - workflow::definition_changed_handler -workflow_id $workflow_id - workflow::action::flush_cache -workflow_id $workflow_id + if { !$internal_p } { + workflow::flush_cache -workflow_id $workflow_id + } }