Index: openacs-4/contrib/packages/simulation/lib/sim-template-tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/sim-template-tasks.tcl,v diff -u -r1.33 -r1.34 --- openacs-4/contrib/packages/simulation/lib/sim-template-tasks.tcl 23 Jan 2004 13:18:43 -0000 1.33 +++ openacs-4/contrib/packages/simulation/lib/sim-template-tasks.tcl 23 Jan 2004 14:31:56 -0000 1.34 @@ -77,6 +77,13 @@ link_url_col assigned_role_edit_url } +lappend elements add_child_action { + label {} + display_template {} + link_url_col add_child_action_url + link_html { title "Add child task" } +} + lappend elements trigger_type { label "
Type" display_eval {[string totitle $trigger_type]} @@ -149,7 +156,7 @@ #------------------------------------------------------------- set extend [list] -lappend extend edit_url view_url delete_url assigned_role_edit_url up_url down_url +lappend extend edit_url view_url delete_url assigned_role_edit_url up_url down_url add_child_action_url foreach state_id $states { lappend extend state_$state_id @@ -232,6 +239,12 @@ } set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction down } { return_url [ad_return_url] } }] + switch $trigger_type { + workflow - parallel - dynamic { + set add_child_action_url [export_vars -base task-edit { workflow_id { parent_action_id $action_id } }] + } + } + lappend actions $action_id } Index: openacs-4/contrib/packages/simulation/www/simbuild/task-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/task-edit.tcl,v diff -u -r1.29 -r1.30 --- openacs-4/contrib/packages/simulation/www/simbuild/task-edit.tcl 23 Jan 2004 13:30:14 -0000 1.29 +++ openacs-4/contrib/packages/simulation/www/simbuild/task-edit.tcl 23 Jan 2004 14:31:56 -0000 1.30 @@ -6,6 +6,7 @@ } { {workflow_id:integer ""} action_id:integer,optional + parent_action_id:integer,optional } -validate { workflow_id_or_task_id { if { ![exists_and_not_null workflow_id] && @@ -37,6 +38,7 @@ } set trigger_type $task_array(trigger_type) + set parent_action_id $task_array(parent_action_id) } workflow::get -workflow_id $workflow_id -array sim_template_array @@ -55,8 +57,14 @@ set role_options [workflow::role::get_options -workflow_id $workflow_id] set role_options_with_null [concat [list [list "--None--" ""]] $role_options] -set child_workflow_options [simulation::template::get_options] +#set child_workflow_options [simulation::template::get_options] +set actions_options [db_list_of_lists foo { + select pretty_name, action_id + from workflow_actions + where workflow_id = :workflow_id +}] + #--------------------------------------------------------------------- # Logic to determine the current values of a few elements #--------------------------------------------------------------------- @@ -72,7 +80,6 @@ set task_type "message" } - ###################################################################### # # task @@ -96,27 +103,47 @@ ok]] \ -form { {action_id:key} - {pretty_name:text - {label "Task Name"} - {html {size 50}} + } + +if { [exists_and_not_null parent_action_id] } { + ad_form -extend -name task -form { + {parent_action_id:integer(select) + {label "Parent action"} + {mode display} + {options $actions_options} } - {pretty_past_tense:text,optional - {label "Task name in log"} - {html {size 50}} - {help_text "What the task will appear like in the case log. Usually the past tense of the task name, e.g. 'Close' becomes 'Closed'."} - } - {trigger_type:text(radio) - {label "Trigger Type"} - {options { - { "User task" user } - { "Automatic timer" time } - { "Initial action" init } - { "Workflow" workflow } - { "Parallel" parallel } - }} - {html {onChange "javascript:acs_FormRefresh('task');"}} - } } +} else { + ad_form -extend -name task -form { + {parent_action_id:integer(hidden),optional {value {}}} + } +} + +ad_form -extend -name task -form { + {pretty_name:text + {label "Task Name"} + {html {size 50}} + } + {pretty_past_tense:text,optional + {label "Task name in log"} + {html {size 50}} + {help_text "What the task will appear like in the case log. Usually the past tense of the task name, e.g. 'Close' becomes 'Closed'."} + } + {trigger_type:text(radio) + {label "Trigger Type"} + {options { + { "User task" user } + { "Automatic timer" time } + { "Initial action" init } + { "Workflow" workflow } + { "Parallel" parallel } + }} + {html {onChange "javascript:acs_FormRefresh('task');"}} + } +} + + + if { [string equal $trigger_type "user"] } { ad_form -extend -name task -form { {task_type:text(radio) @@ -170,6 +197,11 @@ } } } + default { + ad_form -extend -name task -form { + {timeout_seconds:integer(text),optional} + } + } } ad_form -extend -name task -form { @@ -223,7 +255,7 @@ foreach elm { pretty_name pretty_past_tense new_state_id assigned_role recipient_roles - attachment_num trigger_type timeout_seconds + attachment_num trigger_type timeout_seconds parent_action_id } { set $elm $task_array($elm) } @@ -276,7 +308,7 @@ foreach elm { pretty_name pretty_past_tense assigned_role description description_mime_type new_state_id timeout_seconds - recipient_roles attachment_num trigger_type + recipient_roles attachment_num trigger_type parent_action_id } { set row($elm) [set $elm] } Index: openacs-4/contrib/packages/simulation/www/simbuild/template-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/template-edit.adp,v diff -u -r1.22 -r1.23 --- openacs-4/contrib/packages/simulation/www/simbuild/template-edit.adp 12 Jan 2004 11:31:01 -0000 1.22 +++ openacs-4/contrib/packages/simulation/www/simbuild/template-edit.adp 23 Jan 2004 14:31:56 -0000 1.23 @@ -16,17 +16,18 @@

Template

+
Index: openacs-4/packages/simulation/lib/sim-template-tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-template-tasks.tcl,v diff -u -r1.33 -r1.34 --- openacs-4/packages/simulation/lib/sim-template-tasks.tcl 23 Jan 2004 13:18:43 -0000 1.33 +++ openacs-4/packages/simulation/lib/sim-template-tasks.tcl 23 Jan 2004 14:31:56 -0000 1.34 @@ -77,6 +77,13 @@ link_url_col assigned_role_edit_url } +lappend elements add_child_action { + label {} + display_template {} + link_url_col add_child_action_url + link_html { title "Add child task" } +} + lappend elements trigger_type { label "
Type" display_eval {[string totitle $trigger_type]} @@ -149,7 +156,7 @@ #------------------------------------------------------------- set extend [list] -lappend extend edit_url view_url delete_url assigned_role_edit_url up_url down_url +lappend extend edit_url view_url delete_url assigned_role_edit_url up_url down_url add_child_action_url foreach state_id $states { lappend extend state_$state_id @@ -232,6 +239,12 @@ } set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction down } { return_url [ad_return_url] } }] + switch $trigger_type { + workflow - parallel - dynamic { + set add_child_action_url [export_vars -base task-edit { workflow_id { parent_action_id $action_id } }] + } + } + lappend actions $action_id } Index: openacs-4/packages/simulation/www/simbuild/task-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/task-edit.tcl,v diff -u -r1.29 -r1.30 --- openacs-4/packages/simulation/www/simbuild/task-edit.tcl 23 Jan 2004 13:30:14 -0000 1.29 +++ openacs-4/packages/simulation/www/simbuild/task-edit.tcl 23 Jan 2004 14:31:56 -0000 1.30 @@ -6,6 +6,7 @@ } { {workflow_id:integer ""} action_id:integer,optional + parent_action_id:integer,optional } -validate { workflow_id_or_task_id { if { ![exists_and_not_null workflow_id] && @@ -37,6 +38,7 @@ } set trigger_type $task_array(trigger_type) + set parent_action_id $task_array(parent_action_id) } workflow::get -workflow_id $workflow_id -array sim_template_array @@ -55,8 +57,14 @@ set role_options [workflow::role::get_options -workflow_id $workflow_id] set role_options_with_null [concat [list [list "--None--" ""]] $role_options] -set child_workflow_options [simulation::template::get_options] +#set child_workflow_options [simulation::template::get_options] +set actions_options [db_list_of_lists foo { + select pretty_name, action_id + from workflow_actions + where workflow_id = :workflow_id +}] + #--------------------------------------------------------------------- # Logic to determine the current values of a few elements #--------------------------------------------------------------------- @@ -72,7 +80,6 @@ set task_type "message" } - ###################################################################### # # task @@ -96,27 +103,47 @@ ok]] \ -form { {action_id:key} - {pretty_name:text - {label "Task Name"} - {html {size 50}} + } + +if { [exists_and_not_null parent_action_id] } { + ad_form -extend -name task -form { + {parent_action_id:integer(select) + {label "Parent action"} + {mode display} + {options $actions_options} } - {pretty_past_tense:text,optional - {label "Task name in log"} - {html {size 50}} - {help_text "What the task will appear like in the case log. Usually the past tense of the task name, e.g. 'Close' becomes 'Closed'."} - } - {trigger_type:text(radio) - {label "Trigger Type"} - {options { - { "User task" user } - { "Automatic timer" time } - { "Initial action" init } - { "Workflow" workflow } - { "Parallel" parallel } - }} - {html {onChange "javascript:acs_FormRefresh('task');"}} - } } +} else { + ad_form -extend -name task -form { + {parent_action_id:integer(hidden),optional {value {}}} + } +} + +ad_form -extend -name task -form { + {pretty_name:text + {label "Task Name"} + {html {size 50}} + } + {pretty_past_tense:text,optional + {label "Task name in log"} + {html {size 50}} + {help_text "What the task will appear like in the case log. Usually the past tense of the task name, e.g. 'Close' becomes 'Closed'."} + } + {trigger_type:text(radio) + {label "Trigger Type"} + {options { + { "User task" user } + { "Automatic timer" time } + { "Initial action" init } + { "Workflow" workflow } + { "Parallel" parallel } + }} + {html {onChange "javascript:acs_FormRefresh('task');"}} + } +} + + + if { [string equal $trigger_type "user"] } { ad_form -extend -name task -form { {task_type:text(radio) @@ -170,6 +197,11 @@ } } } + default { + ad_form -extend -name task -form { + {timeout_seconds:integer(text),optional} + } + } } ad_form -extend -name task -form { @@ -223,7 +255,7 @@ foreach elm { pretty_name pretty_past_tense new_state_id assigned_role recipient_roles - attachment_num trigger_type timeout_seconds + attachment_num trigger_type timeout_seconds parent_action_id } { set $elm $task_array($elm) } @@ -276,7 +308,7 @@ foreach elm { pretty_name pretty_past_tense assigned_role description description_mime_type new_state_id timeout_seconds - recipient_roles attachment_num trigger_type + recipient_roles attachment_num trigger_type parent_action_id } { set row($elm) [set $elm] } Index: openacs-4/packages/simulation/www/simbuild/template-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/template-edit.adp,v diff -u -r1.22 -r1.23 --- openacs-4/packages/simulation/www/simbuild/template-edit.adp 12 Jan 2004 11:31:01 -0000 1.22 +++ openacs-4/packages/simulation/www/simbuild/template-edit.adp 23 Jan 2004 14:31:56 -0000 1.23 @@ -16,17 +16,18 @@

Template

+