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.23 -r1.24
--- openacs-4/contrib/packages/simulation/lib/sim-template-tasks.tcl 8 Jan 2004 13:03:32 -0000 1.23
+++ openacs-4/contrib/packages/simulation/lib/sim-template-tasks.tcl 8 Jan 2004 16:02:01 -0000 1.24
@@ -68,6 +68,11 @@
link_url_col recipient_role_edit_url
}
+lappend elements child_workflow_pretty {
+ label "
Child"
+ link_url_col child_workflow_url
+}
+
lappend elements delete {
sub_class narrow
hide_p {[ad_decode $display_mode edit 0 1]}
@@ -139,7 +144,7 @@
-element initial_action_id]
set extend [list]
-lappend extend edit_url view_url delete_url initial_p set_initial_url assigned_role_edit_url recipient_role_edit_url
+lappend extend edit_url view_url delete_url initial_p set_initial_url assigned_role_edit_url recipient_role_edit_url child_workflow_url
foreach state_id $states {
lappend extend state_$state_id
@@ -189,7 +194,11 @@
wfa.new_state,
(select pretty_name
from workflow_fsm_states
- where state_id = wfa.new_state) as new_state_pretty
+ where state_id = wfa.new_state) as new_state_pretty,
+ wa.child_workflow_id,
+ (select pretty_name
+ from workflows
+ where workflow_id = wa.child_workflow_id) as child_workflow_pretty
from workflow_actions wa left outer join
sim_tasks st on (st.task_id = wa.action_id) left outer join
workflow_fsm_actions wfa on (wfa.action_id = wa.action_id)
@@ -202,10 +211,16 @@
" {
set edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" { action_id }]
set view_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" { action_id }]
- set delete_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-delete" { action_id {return_url [ad_return_url]} }]
+ set delete_url \
+ [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-delete" { action_id {return_url [ad_return_url]} }]
- set assigned_role_edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-edit" { { role_id $assigned_role } }]
- set recipient_role_edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-edit" { { role_id $recipient_role } }]
+ set assigned_role_edit_url \
+ [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-edit" { { role_id $assigned_role } }]
+ set recipient_role_edit_url \
+ [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-edit" { { role_id $recipient_role } }]
+
+ set child_workflow_url \
+ [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-edit" { { workflow_id $child_workflow_id } }]
set initial_p [string equal $initial_action_id $action_id]
set set_initial_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/initial-action-set" { action_id {return_url [ad_return_url]} }]
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.19 -r1.20
--- openacs-4/contrib/packages/simulation/www/simbuild/task-edit.tcl 8 Jan 2004 13:03:33 -0000 1.19
+++ openacs-4/contrib/packages/simulation/www/simbuild/task-edit.tcl 8 Jan 2004 16:02:01 -0000 1.20
@@ -33,6 +33,16 @@
simulation::action::get -action_id $action_id -array task_array
set workflow_id $task_array(workflow_id)
+
+ if { ![empty_string_p $task_array(child_workflow_id)] } {
+ set task_type "workflow"
+ } else {
+ if { ![empty_string_p $task_array(recipient_role)] } {
+ set task_type "message"
+ } else {
+ set task_type "normal"
+ }
+ }
}
workflow::get -workflow_id $workflow_id -array sim_template_array
@@ -48,8 +58,10 @@
#---------------------------------------------------------------------
# Get a list of relevant roles
#---------------------------------------------------------------------
-set role_options [concat [list [list "--None--" ""]] [workflow::role::get_options -workflow_id $workflow_id]]
+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]
######################################################################
#
@@ -94,28 +106,37 @@
}
{assigned_role:text(select),optional
{label "Assigned To"}
- {options $role_options}
+ {options $role_options_with_null}
}
{recipient_role:text(select),optional
{label "Recipient"}
- {options $role_options}
+ {options $role_options_with_null}
}
{child_workflow_id:integer(select),optional
{label "Child workflow"}
- {options {[simulation::template::get_options]}}
+ {options $child_workflow_options}
{html {onChange "javascript:acs_FormRefresh('task');"}}
}
}
-if { [string equal [element get_value task task_type] "workflow"] } {
- foreach role_id [workflow::get_roles -workflow_id [element get_value task child_workflow_id]] {
- set role__${role_id}__pretty_name [workflow::role::get_element -role_id $role_id -element pretty_name]
+if { [string equal [element get_value task task_type] "workflow"] || [exists_and_equal task_type "workflow"] } {
+ set child_workflow_id [element get_value task child_workflow_id]
+ if { [empty_string_p $child_workflow_id] } {
+ if { [exists_and_not_null task_array(child_workflow_id)] } {
+ set child_workflow_id $task_array(child_workflow_id)
+ } else {
+ set child_workflow_id [lindex [lindex $child_workflow_options 0] 1]
+ }
+ }
+ foreach role_id [workflow::get_roles -workflow_id $child_workflow_id] {
+ array unset role_array
+ workflow::role::get -role_id $role_id -array role_array
+ set role__${role_array(short_name)}__pretty_name $role_array(pretty_name)
ad_form -extend -name task -form \
- [list [list child__$role_id:text(select),optional \
- [list label "\$role__${role_id}__pretty_name"] \
+ [list [list parent_role__${role_array(short_name)}:text(select),optional \
+ [list label "\$role__${role_array(short_name)}__pretty_name Role"] \
{options $role_options} \
]]
-
}
}
@@ -161,17 +182,11 @@
pretty_name pretty_past_tense new_state_id
assigned_role recipient_role
attachment_num
+ child_workflow_id
} {
set $elm $task_array($elm)
}
-
- # TODO: Check for child workflows, and set task_type to 'workflow'
- if { ![empty_string_p $task_array(recipient_role)] } {
- set task_type "message"
- } else {
- set task_type "normal"
- }
-
+
switch $task_type {
message {
element set_properties task assigned_role -widget select
@@ -187,6 +202,10 @@
element set_properties task assigned_role -widget hidden
element set_properties task recipient_role -widget hidden
element set_properties task child_workflow_id -widget select
+
+ foreach { child_short_name elm } $task_array(child_role_map) {
+ set parent_role__${child_short_name} [lindex $elm 0]
+ }
}
}
} -new_request {
@@ -221,6 +240,8 @@
set description_mime_type [template::util::richtext::get_property format $description]
set description [template::util::richtext::get_property contents $description]
+ set child_role_map [list]
+
switch $task_type {
message {
set child_workflow_id {}
@@ -231,7 +252,16 @@
}
workflow {
set recipient_role {}
- error "Missing"
+
+ # we have:
+ # element parent_role__asker = lawyer
+ # element parent_role__giver = client
+
+ foreach role_id [workflow::get_roles -workflow_id $child_workflow_id] {
+ set child_role_short_name [workflow::role::get_element -role_id $role_id -element short_name]
+ set parent_role_short_name [set "parent_role__$child_role_short_name"]
+ lappend child_role_map $child_role_short_name [list $parent_role_short_name "per_role"]
+ }
}
}
@@ -244,6 +274,7 @@
pretty_name pretty_past_tense assigned_role description description_mime_type
new_state_id
recipient_role attachment_num
+ child_workflow_id child_role_map
} {
set row($elm) [set $elm]
}
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.23 -r1.24
--- openacs-4/packages/simulation/lib/sim-template-tasks.tcl 8 Jan 2004 13:03:32 -0000 1.23
+++ openacs-4/packages/simulation/lib/sim-template-tasks.tcl 8 Jan 2004 16:02:01 -0000 1.24
@@ -68,6 +68,11 @@
link_url_col recipient_role_edit_url
}
+lappend elements child_workflow_pretty {
+ label "
Child"
+ link_url_col child_workflow_url
+}
+
lappend elements delete {
sub_class narrow
hide_p {[ad_decode $display_mode edit 0 1]}
@@ -139,7 +144,7 @@
-element initial_action_id]
set extend [list]
-lappend extend edit_url view_url delete_url initial_p set_initial_url assigned_role_edit_url recipient_role_edit_url
+lappend extend edit_url view_url delete_url initial_p set_initial_url assigned_role_edit_url recipient_role_edit_url child_workflow_url
foreach state_id $states {
lappend extend state_$state_id
@@ -189,7 +194,11 @@
wfa.new_state,
(select pretty_name
from workflow_fsm_states
- where state_id = wfa.new_state) as new_state_pretty
+ where state_id = wfa.new_state) as new_state_pretty,
+ wa.child_workflow_id,
+ (select pretty_name
+ from workflows
+ where workflow_id = wa.child_workflow_id) as child_workflow_pretty
from workflow_actions wa left outer join
sim_tasks st on (st.task_id = wa.action_id) left outer join
workflow_fsm_actions wfa on (wfa.action_id = wa.action_id)
@@ -202,10 +211,16 @@
" {
set edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" { action_id }]
set view_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" { action_id }]
- set delete_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-delete" { action_id {return_url [ad_return_url]} }]
+ set delete_url \
+ [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-delete" { action_id {return_url [ad_return_url]} }]
- set assigned_role_edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-edit" { { role_id $assigned_role } }]
- set recipient_role_edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-edit" { { role_id $recipient_role } }]
+ set assigned_role_edit_url \
+ [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-edit" { { role_id $assigned_role } }]
+ set recipient_role_edit_url \
+ [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-edit" { { role_id $recipient_role } }]
+
+ set child_workflow_url \
+ [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-edit" { { workflow_id $child_workflow_id } }]
set initial_p [string equal $initial_action_id $action_id]
set set_initial_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/initial-action-set" { action_id {return_url [ad_return_url]} }]
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.19 -r1.20
--- openacs-4/packages/simulation/www/simbuild/task-edit.tcl 8 Jan 2004 13:03:33 -0000 1.19
+++ openacs-4/packages/simulation/www/simbuild/task-edit.tcl 8 Jan 2004 16:02:01 -0000 1.20
@@ -33,6 +33,16 @@
simulation::action::get -action_id $action_id -array task_array
set workflow_id $task_array(workflow_id)
+
+ if { ![empty_string_p $task_array(child_workflow_id)] } {
+ set task_type "workflow"
+ } else {
+ if { ![empty_string_p $task_array(recipient_role)] } {
+ set task_type "message"
+ } else {
+ set task_type "normal"
+ }
+ }
}
workflow::get -workflow_id $workflow_id -array sim_template_array
@@ -48,8 +58,10 @@
#---------------------------------------------------------------------
# Get a list of relevant roles
#---------------------------------------------------------------------
-set role_options [concat [list [list "--None--" ""]] [workflow::role::get_options -workflow_id $workflow_id]]
+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]
######################################################################
#
@@ -94,28 +106,37 @@
}
{assigned_role:text(select),optional
{label "Assigned To"}
- {options $role_options}
+ {options $role_options_with_null}
}
{recipient_role:text(select),optional
{label "Recipient"}
- {options $role_options}
+ {options $role_options_with_null}
}
{child_workflow_id:integer(select),optional
{label "Child workflow"}
- {options {[simulation::template::get_options]}}
+ {options $child_workflow_options}
{html {onChange "javascript:acs_FormRefresh('task');"}}
}
}
-if { [string equal [element get_value task task_type] "workflow"] } {
- foreach role_id [workflow::get_roles -workflow_id [element get_value task child_workflow_id]] {
- set role__${role_id}__pretty_name [workflow::role::get_element -role_id $role_id -element pretty_name]
+if { [string equal [element get_value task task_type] "workflow"] || [exists_and_equal task_type "workflow"] } {
+ set child_workflow_id [element get_value task child_workflow_id]
+ if { [empty_string_p $child_workflow_id] } {
+ if { [exists_and_not_null task_array(child_workflow_id)] } {
+ set child_workflow_id $task_array(child_workflow_id)
+ } else {
+ set child_workflow_id [lindex [lindex $child_workflow_options 0] 1]
+ }
+ }
+ foreach role_id [workflow::get_roles -workflow_id $child_workflow_id] {
+ array unset role_array
+ workflow::role::get -role_id $role_id -array role_array
+ set role__${role_array(short_name)}__pretty_name $role_array(pretty_name)
ad_form -extend -name task -form \
- [list [list child__$role_id:text(select),optional \
- [list label "\$role__${role_id}__pretty_name"] \
+ [list [list parent_role__${role_array(short_name)}:text(select),optional \
+ [list label "\$role__${role_array(short_name)}__pretty_name Role"] \
{options $role_options} \
]]
-
}
}
@@ -161,17 +182,11 @@
pretty_name pretty_past_tense new_state_id
assigned_role recipient_role
attachment_num
+ child_workflow_id
} {
set $elm $task_array($elm)
}
-
- # TODO: Check for child workflows, and set task_type to 'workflow'
- if { ![empty_string_p $task_array(recipient_role)] } {
- set task_type "message"
- } else {
- set task_type "normal"
- }
-
+
switch $task_type {
message {
element set_properties task assigned_role -widget select
@@ -187,6 +202,10 @@
element set_properties task assigned_role -widget hidden
element set_properties task recipient_role -widget hidden
element set_properties task child_workflow_id -widget select
+
+ foreach { child_short_name elm } $task_array(child_role_map) {
+ set parent_role__${child_short_name} [lindex $elm 0]
+ }
}
}
} -new_request {
@@ -221,6 +240,8 @@
set description_mime_type [template::util::richtext::get_property format $description]
set description [template::util::richtext::get_property contents $description]
+ set child_role_map [list]
+
switch $task_type {
message {
set child_workflow_id {}
@@ -231,7 +252,16 @@
}
workflow {
set recipient_role {}
- error "Missing"
+
+ # we have:
+ # element parent_role__asker = lawyer
+ # element parent_role__giver = client
+
+ foreach role_id [workflow::get_roles -workflow_id $child_workflow_id] {
+ set child_role_short_name [workflow::role::get_element -role_id $role_id -element short_name]
+ set parent_role_short_name [set "parent_role__$child_role_short_name"]
+ lappend child_role_map $child_role_short_name [list $parent_role_short_name "per_role"]
+ }
}
}
@@ -244,6 +274,7 @@
pretty_name pretty_past_tense assigned_role description description_mime_type
new_state_id
recipient_role attachment_num
+ child_workflow_id child_role_map
} {
set row($elm) [set $elm]
}