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.36 -r1.37 --- openacs-4/packages/simulation/www/simbuild/task-edit.tcl 12 Mar 2004 11:02:39 -0000 1.36 +++ openacs-4/packages/simulation/www/simbuild/task-edit.tcl 30 Nov 2004 21:09:16 -0000 1.37 @@ -5,7 +5,7 @@ @cvs-id $Id$ } { {workflow_id:integer ""} - action_id:integer,optional + action_id:optional parent_action_id:integer,optional return_url:optional } -validate { @@ -60,6 +60,11 @@ set page_title "Add Task to $sim_template_array(pretty_name)" } + +if { ![exists_and_not_null return_url] } { + set return_url [export_vars -base "template-edit" -anchor "tasks" { workflow_id }] +} + set context [list [list "." "SimBuild"] [list [export_vars -base "template-edit" { workflow_id }] "$sim_template_array(pretty_name)"] $page_title] #--------------------------------------------------------------------- @@ -100,9 +105,10 @@ ad_form \ -name task \ -export { workflow_id return_url } \ + -cancel_url $return_url \ -edit_buttons [list \ [list \ - [ad_decode [ad_form_new_p -key action_id] 1 [_ acs-kernel.common_add] [_ acs-kernel.common_finish]] \ + [ad_decode [ad_form_new_p -key action_id] 1 [_ acs-kernel.common_OK] [_ acs-kernel.common_OK]] \ ok]] \ -form { {action_id:key} @@ -114,7 +120,7 @@ {parent_action_id:integer(select) {label "Parent task"} {mode display} - {options {[workflow::action::get_options -workflow_id $workflow_id]}} + {options {[workflow::action::get_options -all=1 -workflow_id $workflow_id]}} } } } else { @@ -181,25 +187,18 @@ switch $trigger_type { - user - message - workflow - parallel - dynamic { + user - message - workflow - parallel - dynamic - time { ad_form -extend -name task -form { - {timeout_hours:integer(text),optional + {timeout_hours:float(text),optional {label "Timeout"} {after_html "hours"} + {help_text "[_ simulation.lt_Duration_in_hours_dec]"} } } } - time { - ad_form -extend -name task -form { - {timeout_hours:integer(text) - {label "Timeout"} - {after_html "hours"} - } - } - } default { ad_form -extend -name task -form { - {timeout_hours:integer(hidden),optional} + {timeout_hours:float(hidden),optional} } } } @@ -218,6 +217,16 @@ } } +if { [string equal $trigger_type "user"] && [string equal $task_type "message"] } { + ad_form -extend -name task -form { + {default_text:richtext,optional + {label "Default Message"} + {html {cols 60 rows 8}} + {help_text "Suggested message; can be edited when template is instantiated."} + } + } +} + if { [string equal $trigger_type "user"] } { ad_form -extend -name task -form { {attachment_num:integer(text) @@ -261,7 +270,9 @@ ad_form -extend -name task -edit_request { set workflow_id $task_array(workflow_id) permission::require_write_permission -object_id $workflow_id + set description [template::util::richtext::create $task_array(description) $task_array(description_mime_type)] + set default_text [template::util::richtext::create $task_array(default_text) $task_array(default_text_mime_type)] foreach elm { pretty_name new_state_id @@ -273,7 +284,7 @@ set timeout_hours "" if { ![empty_string_p $task_array(timeout_seconds)] } { - set timeout_hours [expr $task_array(timeout_seconds) / 3600] + set timeout_hours [expr $task_array(timeout_seconds) / 3600.0] } } -new_request { @@ -308,6 +319,11 @@ set description [template::util::richtext::get_property contents $description] } + if { [info exists default_text] } { + set default_text_mime_type [template::util::richtext::get_property format $default_text] + set default_text [template::util::richtext::get_property contents $default_text] + } + switch $task_type { message { } @@ -320,7 +336,7 @@ foreach elm { pretty_name pretty_past_tense assigned_role description description_mime_type - new_state_id + new_state_id default_text default_text_mime_type recipient_roles attachment_num trigger_type parent_action_id } { if { [info exists $elm] } { @@ -355,9 +371,11 @@ -action_id $action_id \ -array row] - if { ![exists_and_not_null return_url] } { - set return_url [export_vars -base "template-edit" -anchor "tasks" { workflow_id }] - } - ad_returnredirect $return_url + + # Let's mark this template edited + set sim_type "dev_template" + + ad_returnredirect [export_vars -base "template-sim-type-update" { workflow_id sim_type return_url }] + ad_script_abort }