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.19 -r1.20 --- openacs-4/contrib/packages/simulation/lib/sim-template-tasks.tcl 7 Jan 2004 14:44:08 -0000 1.19 +++ openacs-4/contrib/packages/simulation/lib/sim-template-tasks.tcl 8 Jan 2004 09:30:50 -0000 1.20 @@ -52,19 +52,6 @@ Edit } } -lappend elements initialize { - label "Init" - display_template { - - Initial action - - - Set as initial action - - } - html { align center } - sub_class narrow -} lappend elements name { label "Name" display_col pretty_name @@ -82,17 +69,11 @@ } lappend elements state_spacer { - label "        " + label "|   States:" sub_class narrow display_template " " } -lappend elements state_spacer2 { - label "States:" - sub_class narrow - display_template " " -} - set states [list] db_foreach select_states { @@ -120,21 +101,6 @@ } } -# TODO: make the mocked up task enable list real -# LARS: Add state button in header removed -if 0 { - lappend elements add_state { - label { -
- [export_vars -form { workflow_id}] - -
- } - display_template { } - } -} - - lappend elements delete { sub_class narrow hide_p {[ad_decode $display_mode edit 0 1]} @@ -204,6 +170,10 @@ workflow_fsm_actions wfa where wa.workflow_id = :workflow_id and wfa.action_id = wa.action_id + and not exists (select 1 + from workflow_initial_action ia + where ia.workflow_id = wa.workflow_id + and ia.action_id = wa.action_id) order by wa.sort_order " { set edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" { action_id }] Index: openacs-4/contrib/packages/simulation/lib/sim-templates.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/sim-templates.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/contrib/packages/simulation/lib/sim-templates.tcl 17 Dec 2003 20:25:34 -0000 1.12 +++ openacs-4/contrib/packages/simulation/lib/sim-templates.tcl 8 Jan 2004 09:30:51 -0000 1.13 @@ -76,23 +76,27 @@ label "Ready" display_eval {[ad_decode $sim_type "ready_template" "Yes" "No"]} } - delete { + copy { sub_class narrow display_template { + Copy + } + link_url_col clone_url + link_html { title "Clone this template" } + } + delete { + sub_class narrow + link_url_col delete_url + link_html { + title "Delete this template" + onclick "return confirm('Are you sure you want to delete template @sim_templates.name@?');" + } + display_template { - Delete - } } - clone { - display_template { - Clone this template - } - - } } } } @@ -124,9 +128,13 @@ (select count(role_id) from workflow_roles where workflow_id = w.workflow_id) as role_count, - (select count(action_id) - from workflow_actions - where workflow_id = w.workflow_id) as task_count + (select count(a2.action_id) + from workflow_actions a2 + where a2.workflow_id = w.workflow_id + and not exists (select 1 + from workflow_initial_action ia2 + where ia2.workflow_id = w.workflow_id + and ia2.action_id = a2.action_id)) as task_count from workflows w, sim_simulations ss, acs_objects a @@ -142,9 +150,10 @@ set view_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-edit" {workflow_id} ] - set delete_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-delete" {workflow_id} ] - set clone_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-clone" {workflow_id} ] set edit_p [permission::write_permission_p -object_id $workflow_id] + + set delete_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-delete" {workflow_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.17 -r1.18 --- openacs-4/contrib/packages/simulation/www/simbuild/task-edit.tcl 7 Jan 2004 14:43:15 -0000 1.17 +++ openacs-4/contrib/packages/simulation/www/simbuild/task-edit.tcl 8 Jan 2004 09:30:51 -0000 1.18 @@ -70,12 +70,19 @@ {label "Task Name"} {html {size 20}} } - {task_type:text(inform) + {pretty_past_tense:text,optional + {label "Task name in log"} + {html {size 20}} + {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'."} + } + {task_type:text(radio) {label "Task is complete when"} - {value " -assignee sends message to recipient -
assignee uploads document -
child workflow is complete"} + {options { + { "Assignee sends message to recipient" message } + { "Assignee uploads document" normal } + { "Child workflow is complete" workflow } + }} + {html {onChange "javascript:acs_FormRefresh('task');"}} } {assigned_role:text(select),optional {label "Assigned To"} @@ -121,26 +128,75 @@ set description [template::util::richtext::create $task_array(description) $task_array(description_mime_type)] foreach elm { - pretty_name new_state_id + pretty_name pretty_past_tense new_state_id assigned_role recipient_role - assigned_state_ids enabled_state_ids attachment_num } { 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 recipient_role -widget select + } + normal { + element set_properties task recipient_role -widget hidden + } + child { + element set_properties task recipient_role -widget hidden + } + } } -new_request { permission::require_write_permission -object_id $workflow_id - #TODO: is this the right way to set defaults in ad_form? set attachment_num 0 + + set task_type "message" +} -on_refresh { + # TODO: Add other child widgets + switch $task_type { + message { + element set_properties task recipient_role -widget select + } + normal { + element set_properties task recipient_role -widget hidden + } + child { + element set_properties task recipient_role -widget hidden + } + } } -on_submit { set description_mime_type [template::util::richtext::get_property format $description] set description [template::util::richtext::get_property contents $description] + switch $task_type { + message { + } + normal { + # Normal messages don't have a recipient + set recipient_role {} + } + workflow { + # TODO + } + } + + # Default pretty_past_tense + if { [empty_string_p $pretty_past_tense] } { + set pretty_past_tense $pretty_name + } + foreach elm { - pretty_name assigned_role description description_mime_type - enabled_state_ids assigned_state_ids new_state_id + pretty_name pretty_past_tense assigned_role description description_mime_type + new_state_id recipient_role attachment_num } { 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.19 -r1.20 --- openacs-4/packages/simulation/lib/sim-template-tasks.tcl 7 Jan 2004 14:44:08 -0000 1.19 +++ openacs-4/packages/simulation/lib/sim-template-tasks.tcl 8 Jan 2004 09:30:50 -0000 1.20 @@ -52,19 +52,6 @@ Edit } } -lappend elements initialize { - label "Init" - display_template { - - Initial action - - - Set as initial action - - } - html { align center } - sub_class narrow -} lappend elements name { label "Name" display_col pretty_name @@ -82,17 +69,11 @@ } lappend elements state_spacer { - label "        " + label "|   States:" sub_class narrow display_template " " } -lappend elements state_spacer2 { - label "States:" - sub_class narrow - display_template " " -} - set states [list] db_foreach select_states { @@ -120,21 +101,6 @@ } } -# TODO: make the mocked up task enable list real -# LARS: Add state button in header removed -if 0 { - lappend elements add_state { - label { -
- [export_vars -form { workflow_id}] - -
- } - display_template { } - } -} - - lappend elements delete { sub_class narrow hide_p {[ad_decode $display_mode edit 0 1]} @@ -204,6 +170,10 @@ workflow_fsm_actions wfa where wa.workflow_id = :workflow_id and wfa.action_id = wa.action_id + and not exists (select 1 + from workflow_initial_action ia + where ia.workflow_id = wa.workflow_id + and ia.action_id = wa.action_id) order by wa.sort_order " { set edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" { action_id }] Index: openacs-4/packages/simulation/lib/sim-templates.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-templates.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/simulation/lib/sim-templates.tcl 17 Dec 2003 20:25:34 -0000 1.12 +++ openacs-4/packages/simulation/lib/sim-templates.tcl 8 Jan 2004 09:30:51 -0000 1.13 @@ -76,23 +76,27 @@ label "Ready" display_eval {[ad_decode $sim_type "ready_template" "Yes" "No"]} } - delete { + copy { sub_class narrow display_template { + Copy + } + link_url_col clone_url + link_html { title "Clone this template" } + } + delete { + sub_class narrow + link_url_col delete_url + link_html { + title "Delete this template" + onclick "return confirm('Are you sure you want to delete template @sim_templates.name@?');" + } + display_template { - Delete - } } - clone { - display_template { - Clone this template - } - - } } } } @@ -124,9 +128,13 @@ (select count(role_id) from workflow_roles where workflow_id = w.workflow_id) as role_count, - (select count(action_id) - from workflow_actions - where workflow_id = w.workflow_id) as task_count + (select count(a2.action_id) + from workflow_actions a2 + where a2.workflow_id = w.workflow_id + and not exists (select 1 + from workflow_initial_action ia2 + where ia2.workflow_id = w.workflow_id + and ia2.action_id = a2.action_id)) as task_count from workflows w, sim_simulations ss, acs_objects a @@ -142,9 +150,10 @@ set view_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-edit" {workflow_id} ] - set delete_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-delete" {workflow_id} ] - set clone_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-clone" {workflow_id} ] set edit_p [permission::write_permission_p -object_id $workflow_id] + + set delete_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-delete" {workflow_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.17 -r1.18 --- openacs-4/packages/simulation/www/simbuild/task-edit.tcl 7 Jan 2004 14:43:15 -0000 1.17 +++ openacs-4/packages/simulation/www/simbuild/task-edit.tcl 8 Jan 2004 09:30:51 -0000 1.18 @@ -70,12 +70,19 @@ {label "Task Name"} {html {size 20}} } - {task_type:text(inform) + {pretty_past_tense:text,optional + {label "Task name in log"} + {html {size 20}} + {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'."} + } + {task_type:text(radio) {label "Task is complete when"} - {value " -assignee sends message to recipient -
assignee uploads document -
child workflow is complete"} + {options { + { "Assignee sends message to recipient" message } + { "Assignee uploads document" normal } + { "Child workflow is complete" workflow } + }} + {html {onChange "javascript:acs_FormRefresh('task');"}} } {assigned_role:text(select),optional {label "Assigned To"} @@ -121,26 +128,75 @@ set description [template::util::richtext::create $task_array(description) $task_array(description_mime_type)] foreach elm { - pretty_name new_state_id + pretty_name pretty_past_tense new_state_id assigned_role recipient_role - assigned_state_ids enabled_state_ids attachment_num } { 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 recipient_role -widget select + } + normal { + element set_properties task recipient_role -widget hidden + } + child { + element set_properties task recipient_role -widget hidden + } + } } -new_request { permission::require_write_permission -object_id $workflow_id - #TODO: is this the right way to set defaults in ad_form? set attachment_num 0 + + set task_type "message" +} -on_refresh { + # TODO: Add other child widgets + switch $task_type { + message { + element set_properties task recipient_role -widget select + } + normal { + element set_properties task recipient_role -widget hidden + } + child { + element set_properties task recipient_role -widget hidden + } + } } -on_submit { set description_mime_type [template::util::richtext::get_property format $description] set description [template::util::richtext::get_property contents $description] + switch $task_type { + message { + } + normal { + # Normal messages don't have a recipient + set recipient_role {} + } + workflow { + # TODO + } + } + + # Default pretty_past_tense + if { [empty_string_p $pretty_past_tense] } { + set pretty_past_tense $pretty_name + } + foreach elm { - pretty_name assigned_role description description_mime_type - enabled_state_ids assigned_state_ids new_state_id + pretty_name pretty_past_tense assigned_role description description_mime_type + new_state_id recipient_role attachment_num } { set row($elm) [set $elm]