Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/role-delete.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/role-delete.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/role-edit.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/role-edit.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/role.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/sim-template-add-objects-2.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/sim-template-add-objects.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/sim-template-add-objects.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/sim-template-delete.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/sim-template-delete.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.9 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/sim-template-edit.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/sim-template-edit.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/sim-template.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/sim-template.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/task-delete.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/task-edit.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/task-edit.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/simulation/www/simbuild/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/simbuild/index.tcl 13 Nov 2003 14:16:58 -0000 1.1 +++ openacs-4/contrib/packages/simulation/www/simbuild/index.tcl 13 Nov 2003 15:35:48 -0000 1.2 @@ -2,6 +2,6 @@ List workflows designated as templates (but not simulations or cases) in this package. } -set page_title "Simulation Templates" +set page_title "SimBuild" set context [list $page_title] set package_id [ad_conn package_id] Index: openacs-4/contrib/packages/simulation/www/simbuild/role-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/role-delete.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simbuild/role-delete.adp 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,19 @@ + + @page_title;noquote@ + @context;noquote@ + +

@name@ has dependent tasks. Do you want to delete this role +and all related tasks? + +

Related Tasks

+ + + +

+ » Delete @name@ and tasks +

+ +

+ » Cancel +

+ Index: openacs-4/contrib/packages/simulation/www/simbuild/role-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/role-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simbuild/role-delete.tcl 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,37 @@ +ad_page_contract { + Delete a role. + + Determine if a role has tasks. If show, display all those + tasks and ask for confirmation. If not, delete on the first pass. +} { + {confirm_p:boolean "f"} + role_id:integer + {return_url "."} +} + +set package_id [ad_conn package_id] +set num_of_tasks [db_string task_count " +select count(*) + from workflow_actions wa, + sim_tasks st + where st.task_id = wa.action_id + and wa.assigned_role = :role_id + or st.recipient = :role_id + " + ] +if { [template::util::is_true $confirm_p] || $num_of_tasks == 0 } { + + simulation::role::delete -role_id $role_id + ad_returnredirect $return_url +} + +workflow::role::get -role_id $role_id -array role_array +set name $role_array(pretty_name) +set workflow_id $role_array(workflow_id) +workflow::get -workflow_id $workflow_id -array sim_template_array + +set page_title "Delete $name" +set context [list [list "." "Sim Templates"] [list "template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title] + +set delete_url [export_vars -base [ad_conn url] { role_id return_url { confirm_p 1 } }] +set cancel_url $return_url Index: openacs-4/contrib/packages/simulation/www/simbuild/role-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/role-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simbuild/role-edit.adp 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,6 @@ + + @page_title;noquote@ + @context;noquote@ + object.title + + Index: openacs-4/contrib/packages/simulation/www/simbuild/role-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/role-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simbuild/role-edit.tcl 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,72 @@ +ad_page_contract { + Add/edit role. + + @creation-date 2003-10-27 + @cvs-id $Id: role-edit.tcl,v 1.1 2003/11/13 15:35:48 peterm Exp $ +} { + workflow_id:optional + role_id:optional +} -validate { + workflow_id_or_role_id { + if { ![exists_and_not_null workflow_id] && + ![exists_and_not_null role_id]} { + ad_complain "Either role_id or workflow_id is required." + } + } +} + +###################################################################### +# +# preparation +# +###################################################################### + +set package_key [ad_conn package_key] +set package_id [ad_conn package_id] + +###################################################################### +# +# role +# +# a form showing fields for a role in a workflow +# includes add and edit modes and handles form submission +# display mode is only in list form via template-edit +# +###################################################################### + +#--------------------------------------------------------------------- +# role form +#--------------------------------------------------------------------- + +ad_form -name role -cancel_url index -form { + {role_id:key} + {workflow_id:integer(hidden),optional} + {name:text + {label "Role Name"} + {html {size 20}} + } +} -edit_request { + workflow::role::get -role_id $role_id -array role_array + set workflow_id $role_array(workflow_id) + set name $role_array(pretty_name) + workflow::get -workflow_id $workflow_id -array sim_template_array + set page_title "Edit Role template $name" + set context [list [list "." "Sim Templates"] [list "template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title] +} -new_request { + workflow::get -workflow_id $workflow_id -array sim_template_array + set page_title "Add Role to $sim_template_array(pretty_name)" + set context [list [list "." "Sim Templates"] [list "template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title] +} -new_data { + + simulation::role::new \ + -template_id $workflow_id \ + -role_short_name $name \ + -role_pretty_name $name + +} -after_submit { + ad_returnredirect [export_vars -base "template-edit" { workflow_id }] + ad_script_abort +} + +# maybe replace this chunk of copied text with an includable template +# which passes in a filter for the workflow_id? Index: openacs-4/contrib/packages/simulation/www/simbuild/task-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/task-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simbuild/task-delete.tcl 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,11 @@ +ad_page_contract { + Delete a task + +} { + action_id:integer + {return_url "."} +} + +workflow::action::fsm::delete -action_id $action_id + +ad_returnredirect $return_url \ No newline at end of file Index: openacs-4/contrib/packages/simulation/www/simbuild/task-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/task-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simbuild/task-edit.adp 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,7 @@ + + @page_title;noquote@ + @context;noquote@ + object.title + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simbuild/task-edit.tcl 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,144 @@ +ad_page_contract { + Add/edit task. + + @creation-date 2003-10-27 + @cvs-id $Id: task-edit.tcl,v 1.1 2003/11/13 15:35:48 peterm Exp $ +} { + workflow_id + action_id:optional +} -validate { + workflow_id_or_task_id { + if { ![exists_and_not_null workflow_id] && + ![exists_and_not_null action_id]} { + ad_complain "Either task_id or workflow_id is required." + } + } +} + +###################################################################### +# +# preparation +# +###################################################################### + +workflow::get -workflow_id $workflow_id -array sim_template_array + +set package_key [ad_conn package_key] +set package_id [ad_conn package_id] + +if { ![ad_form_new_p -key action_id] } { + workflow::action::fsm::get -action_id $action_id -array task_array + + set page_title "Edit Task $task_array(pretty_name)" +} else { + set page_title "Add Task to $sim_template_array(pretty_name)" +} +set context [list [list "." "SimBuild"] [list "template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title] + + +#--------------------------------------------------------------------- +# Get a list of relevant roles +#--------------------------------------------------------------------- +# TODO: make sure this query (and other queries to cr) get only the live +# record from cr_revisions +# deliberately not checking to see if character is already cast in sim +# because no reason not to have same character in multiple tasks (?) + +set role_options [db_list_of_lists role_option_list " + select wr.pretty_name, + wr.role_id + from workflow_roles wr + where wr.workflow_id = :workflow_id +"] + +###################################################################### +# +# task +# +# a form showing fields for a task in a workflow +# includes add and edit modes and handles form submission +# display mode is only in list form via template-edit +# +###################################################################### + +#--------------------------------------------------------------------- +# task form +#--------------------------------------------------------------------- + +ad_form -name task -edit_buttons [ + list [list [ad_decode [ad_form_new_p -key action_id] 1 [_ acs-kernel.common_add] [_ acs-kernel.common_edit]] ok] + ] -form { + {action_id:key} + {workflow_id:integer(hidden),optional} + {name:text + {label "Task"} + {html {size 20}} + } + {assigned_role:text(select) + {label "Assigned To"} + {options $role_options} + } + {recipient_role:text(select) + {label "Recipient"} + {options $role_options} + } + {description:richtext,optional + {label "Task Description"} + {html {cols 60 rows 8}} + } +} -edit_request { + + # TODO - get the recipient (and put all this in simulation api) + set workflow_id $task_array(workflow_id) + set name $task_array(pretty_name) + set description [template::util::richtext::create $task_array(description) $task_array(description_mime_type)] + set recipient_role [db_string select_recipient { + select recipient + from sim_tasks + where task_id = :action_id + }] + set assigned_role $task_array(assigned_role) + +} -on_submit { + + set description_content [template::util::richtext::get_property contents $description] + set description_mime_type [template::util::richtext::get_property format $description] + +} -new_data { + + # create the task + + set assigned_role_name [workflow::role::get_element \ + -role_id $assigned_role \ + -element short_name] + set action_id [workflow::action::fsm::new \ + -workflow_id $workflow_id \ + -short_name $name \ + -pretty_name $name \ + -assigned_role $assigned_role_name \ + -description $description_content \ + -description_mime_type $description_mime_type] + + # TODO - put this stuff into simulation api and change previous call + # and then add extra data for simulation + # because workflow::action::fsm::new wants role.short_name instead of + # role_id, we stay consistent for recipient_role + db_dml set_role_recipient { + insert into sim_tasks + values (:action_id, :recipient_role) + } +} -edit_data { + + simulation::action::edit \ + -action_id $action_id \ + -short_name $name \ + -pretty_name $name \ + -assigned_role $assigned_role \ + -recipient_role $recipient_role \ + -description $description_content \ + -description_mime_type $description_mime_type + +} -after_submit { + ad_returnredirect [export_vars -base "template-edit" { workflow_id }] + ad_script_abort +} Index: openacs-4/contrib/packages/simulation/www/simbuild/template-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/template-delete.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simbuild/template-delete.adp 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,11 @@ + + @page_title;noquote@ + @context;noquote@ + +

+ You have deleted template "@template_name@". +

+ +

+ » Return to template list page +

Index: openacs-4/contrib/packages/simulation/www/simbuild/template-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/template-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simbuild/template-delete.tcl 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,17 @@ +ad_page_contract { + Delete a simulation template. + + @creation-date 2003-11-12 + @cvs-id $Id: template-delete.tcl,v 1.1 2003/11/13 15:35:48 peterm Exp $ +} { + workflow_id +} + +set template_name [workflow::get_element -workflow_id $workflow_id -element pretty_name] +set package_id [ad_conn package_id] + +set page_title "Deleting template \"$template_name\"" +set template_list_url . +set context [list [list $template_list_url "Templates"] $page_title] + +simulation::template::delete -workflow_id $workflow_id 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simbuild/template-edit.adp 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,21 @@ + + @page_title;noquote@ + @context;noquote@ + object.title + + + + + +

+ » Delete this template +

+ +

Roles

+ + + +

Tasks

+ + +
Index: openacs-4/contrib/packages/simulation/www/simbuild/template-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/template-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/simbuild/template-edit.tcl 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,74 @@ +ad_page_contract { + Add/edit template. + + @creation-date 2003-10-13 + @cvs-id $Id: template-edit.tcl,v 1.1 2003/11/13 15:35:48 peterm Exp $ +} { + workflow_id:optional +} + +set package_key [ad_conn package_key] +set package_id [ad_conn package_id] + +###################################################################### +# +# sim_template +# +# a form showing fields for a sim template +# includes add, edit, and display modes and handles form submission +# +# TODO: display mode doesn't exist yet - all display is through edit mode +# +###################################################################### + +#--------------------------------------------------------------------- +# sim_template form +#--------------------------------------------------------------------- + +ad_form -name sim_template -cancel_url . -form { + {workflow_id:key} + {name:text,optional + {label "Template Name"} + {html {size 40}} + } +} -edit_request { + workflow::get -workflow_id $workflow_id -array sim_template_array + set name $sim_template_array(pretty_name) +} -new_data { + set workflow_id [simulation::template::new \ + -short_name $name \ + -pretty_name $name \ + -package_key $package_key \ + -object_id $package_id] +} -after_submit { + ad_returnredirect template-edit?workflow_id=$workflow_id + ad_script_abort +} + +#--------------------------------------------------------------------- +# Determine if we are in edit mode or display mode +#--------------------------------------------------------------------- +# this is prototype code to correct for get_action's apparent +# unreliability + +set mode [template::form::get_action sim_template] +if { ![exists_and_not_null workflow_id]} { + set mode "add" +} else { + # for now, use edit mode in place of display mode + # set mode "display" + set mode "edit" +} + +switch $mode { + add { + set page_title "New Simulation Template" + } + edit { + set page_title "Editing $name" + } +} + +set context [list [list "." "SimBuild"] $page_title] + +set delete_url [export_vars -base template-delete { workflow_id }] Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/role-delete.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/role-delete.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/role-edit.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/role-edit.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/role.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/sim-template-add-objects-2.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/sim-template-add-objects.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/sim-template-add-objects.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/sim-template-delete.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/sim-template-delete.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.9 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/sim-template-edit.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/sim-template-edit.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/sim-template.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/sim-template.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/task-delete.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/task-edit.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/task-edit.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/simulation/www/simbuild/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/www/simbuild/index.tcl 13 Nov 2003 14:16:58 -0000 1.1 +++ openacs-4/packages/simulation/www/simbuild/index.tcl 13 Nov 2003 15:35:48 -0000 1.2 @@ -2,6 +2,6 @@ List workflows designated as templates (but not simulations or cases) in this package. } -set page_title "Simulation Templates" +set page_title "SimBuild" set context [list $page_title] set package_id [ad_conn package_id] Index: openacs-4/packages/simulation/www/simbuild/role-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/role-delete.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simbuild/role-delete.adp 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,19 @@ + + @page_title;noquote@ + @context;noquote@ + +

@name@ has dependent tasks. Do you want to delete this role +and all related tasks? + +

Related Tasks

+ + + +

+ » Delete @name@ and tasks +

+ +

+ » Cancel +

+ Index: openacs-4/packages/simulation/www/simbuild/role-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/role-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simbuild/role-delete.tcl 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,37 @@ +ad_page_contract { + Delete a role. + + Determine if a role has tasks. If show, display all those + tasks and ask for confirmation. If not, delete on the first pass. +} { + {confirm_p:boolean "f"} + role_id:integer + {return_url "."} +} + +set package_id [ad_conn package_id] +set num_of_tasks [db_string task_count " +select count(*) + from workflow_actions wa, + sim_tasks st + where st.task_id = wa.action_id + and wa.assigned_role = :role_id + or st.recipient = :role_id + " + ] +if { [template::util::is_true $confirm_p] || $num_of_tasks == 0 } { + + simulation::role::delete -role_id $role_id + ad_returnredirect $return_url +} + +workflow::role::get -role_id $role_id -array role_array +set name $role_array(pretty_name) +set workflow_id $role_array(workflow_id) +workflow::get -workflow_id $workflow_id -array sim_template_array + +set page_title "Delete $name" +set context [list [list "." "Sim Templates"] [list "template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title] + +set delete_url [export_vars -base [ad_conn url] { role_id return_url { confirm_p 1 } }] +set cancel_url $return_url Index: openacs-4/packages/simulation/www/simbuild/role-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/role-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simbuild/role-edit.adp 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,6 @@ + + @page_title;noquote@ + @context;noquote@ + object.title + + Index: openacs-4/packages/simulation/www/simbuild/role-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/role-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simbuild/role-edit.tcl 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,72 @@ +ad_page_contract { + Add/edit role. + + @creation-date 2003-10-27 + @cvs-id $Id: role-edit.tcl,v 1.1 2003/11/13 15:35:48 peterm Exp $ +} { + workflow_id:optional + role_id:optional +} -validate { + workflow_id_or_role_id { + if { ![exists_and_not_null workflow_id] && + ![exists_and_not_null role_id]} { + ad_complain "Either role_id or workflow_id is required." + } + } +} + +###################################################################### +# +# preparation +# +###################################################################### + +set package_key [ad_conn package_key] +set package_id [ad_conn package_id] + +###################################################################### +# +# role +# +# a form showing fields for a role in a workflow +# includes add and edit modes and handles form submission +# display mode is only in list form via template-edit +# +###################################################################### + +#--------------------------------------------------------------------- +# role form +#--------------------------------------------------------------------- + +ad_form -name role -cancel_url index -form { + {role_id:key} + {workflow_id:integer(hidden),optional} + {name:text + {label "Role Name"} + {html {size 20}} + } +} -edit_request { + workflow::role::get -role_id $role_id -array role_array + set workflow_id $role_array(workflow_id) + set name $role_array(pretty_name) + workflow::get -workflow_id $workflow_id -array sim_template_array + set page_title "Edit Role template $name" + set context [list [list "." "Sim Templates"] [list "template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title] +} -new_request { + workflow::get -workflow_id $workflow_id -array sim_template_array + set page_title "Add Role to $sim_template_array(pretty_name)" + set context [list [list "." "Sim Templates"] [list "template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title] +} -new_data { + + simulation::role::new \ + -template_id $workflow_id \ + -role_short_name $name \ + -role_pretty_name $name + +} -after_submit { + ad_returnredirect [export_vars -base "template-edit" { workflow_id }] + ad_script_abort +} + +# maybe replace this chunk of copied text with an includable template +# which passes in a filter for the workflow_id? Index: openacs-4/packages/simulation/www/simbuild/task-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/task-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simbuild/task-delete.tcl 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,11 @@ +ad_page_contract { + Delete a task + +} { + action_id:integer + {return_url "."} +} + +workflow::action::fsm::delete -action_id $action_id + +ad_returnredirect $return_url \ No newline at end of file Index: openacs-4/packages/simulation/www/simbuild/task-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/task-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simbuild/task-edit.adp 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,7 @@ + + @page_title;noquote@ + @context;noquote@ + object.title + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simbuild/task-edit.tcl 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,144 @@ +ad_page_contract { + Add/edit task. + + @creation-date 2003-10-27 + @cvs-id $Id: task-edit.tcl,v 1.1 2003/11/13 15:35:48 peterm Exp $ +} { + workflow_id + action_id:optional +} -validate { + workflow_id_or_task_id { + if { ![exists_and_not_null workflow_id] && + ![exists_and_not_null action_id]} { + ad_complain "Either task_id or workflow_id is required." + } + } +} + +###################################################################### +# +# preparation +# +###################################################################### + +workflow::get -workflow_id $workflow_id -array sim_template_array + +set package_key [ad_conn package_key] +set package_id [ad_conn package_id] + +if { ![ad_form_new_p -key action_id] } { + workflow::action::fsm::get -action_id $action_id -array task_array + + set page_title "Edit Task $task_array(pretty_name)" +} else { + set page_title "Add Task to $sim_template_array(pretty_name)" +} +set context [list [list "." "SimBuild"] [list "template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title] + + +#--------------------------------------------------------------------- +# Get a list of relevant roles +#--------------------------------------------------------------------- +# TODO: make sure this query (and other queries to cr) get only the live +# record from cr_revisions +# deliberately not checking to see if character is already cast in sim +# because no reason not to have same character in multiple tasks (?) + +set role_options [db_list_of_lists role_option_list " + select wr.pretty_name, + wr.role_id + from workflow_roles wr + where wr.workflow_id = :workflow_id +"] + +###################################################################### +# +# task +# +# a form showing fields for a task in a workflow +# includes add and edit modes and handles form submission +# display mode is only in list form via template-edit +# +###################################################################### + +#--------------------------------------------------------------------- +# task form +#--------------------------------------------------------------------- + +ad_form -name task -edit_buttons [ + list [list [ad_decode [ad_form_new_p -key action_id] 1 [_ acs-kernel.common_add] [_ acs-kernel.common_edit]] ok] + ] -form { + {action_id:key} + {workflow_id:integer(hidden),optional} + {name:text + {label "Task"} + {html {size 20}} + } + {assigned_role:text(select) + {label "Assigned To"} + {options $role_options} + } + {recipient_role:text(select) + {label "Recipient"} + {options $role_options} + } + {description:richtext,optional + {label "Task Description"} + {html {cols 60 rows 8}} + } +} -edit_request { + + # TODO - get the recipient (and put all this in simulation api) + set workflow_id $task_array(workflow_id) + set name $task_array(pretty_name) + set description [template::util::richtext::create $task_array(description) $task_array(description_mime_type)] + set recipient_role [db_string select_recipient { + select recipient + from sim_tasks + where task_id = :action_id + }] + set assigned_role $task_array(assigned_role) + +} -on_submit { + + set description_content [template::util::richtext::get_property contents $description] + set description_mime_type [template::util::richtext::get_property format $description] + +} -new_data { + + # create the task + + set assigned_role_name [workflow::role::get_element \ + -role_id $assigned_role \ + -element short_name] + set action_id [workflow::action::fsm::new \ + -workflow_id $workflow_id \ + -short_name $name \ + -pretty_name $name \ + -assigned_role $assigned_role_name \ + -description $description_content \ + -description_mime_type $description_mime_type] + + # TODO - put this stuff into simulation api and change previous call + # and then add extra data for simulation + # because workflow::action::fsm::new wants role.short_name instead of + # role_id, we stay consistent for recipient_role + db_dml set_role_recipient { + insert into sim_tasks + values (:action_id, :recipient_role) + } +} -edit_data { + + simulation::action::edit \ + -action_id $action_id \ + -short_name $name \ + -pretty_name $name \ + -assigned_role $assigned_role \ + -recipient_role $recipient_role \ + -description $description_content \ + -description_mime_type $description_mime_type + +} -after_submit { + ad_returnredirect [export_vars -base "template-edit" { workflow_id }] + ad_script_abort +} Index: openacs-4/packages/simulation/www/simbuild/template-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/template-delete.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simbuild/template-delete.adp 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,11 @@ + + @page_title;noquote@ + @context;noquote@ + +

+ You have deleted template "@template_name@". +

+ +

+ » Return to template list page +

Index: openacs-4/packages/simulation/www/simbuild/template-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/template-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simbuild/template-delete.tcl 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,17 @@ +ad_page_contract { + Delete a simulation template. + + @creation-date 2003-11-12 + @cvs-id $Id: template-delete.tcl,v 1.1 2003/11/13 15:35:48 peterm Exp $ +} { + workflow_id +} + +set template_name [workflow::get_element -workflow_id $workflow_id -element pretty_name] +set package_id [ad_conn package_id] + +set page_title "Deleting template \"$template_name\"" +set template_list_url . +set context [list [list $template_list_url "Templates"] $page_title] + +simulation::template::delete -workflow_id $workflow_id 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simbuild/template-edit.adp 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,21 @@ + + @page_title;noquote@ + @context;noquote@ + object.title + + + + + +

+ » Delete this template +

+ +

Roles

+ + + +

Tasks

+ + +
Index: openacs-4/packages/simulation/www/simbuild/template-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/template-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/simbuild/template-edit.tcl 13 Nov 2003 15:35:48 -0000 1.1 @@ -0,0 +1,74 @@ +ad_page_contract { + Add/edit template. + + @creation-date 2003-10-13 + @cvs-id $Id: template-edit.tcl,v 1.1 2003/11/13 15:35:48 peterm Exp $ +} { + workflow_id:optional +} + +set package_key [ad_conn package_key] +set package_id [ad_conn package_id] + +###################################################################### +# +# sim_template +# +# a form showing fields for a sim template +# includes add, edit, and display modes and handles form submission +# +# TODO: display mode doesn't exist yet - all display is through edit mode +# +###################################################################### + +#--------------------------------------------------------------------- +# sim_template form +#--------------------------------------------------------------------- + +ad_form -name sim_template -cancel_url . -form { + {workflow_id:key} + {name:text,optional + {label "Template Name"} + {html {size 40}} + } +} -edit_request { + workflow::get -workflow_id $workflow_id -array sim_template_array + set name $sim_template_array(pretty_name) +} -new_data { + set workflow_id [simulation::template::new \ + -short_name $name \ + -pretty_name $name \ + -package_key $package_key \ + -object_id $package_id] +} -after_submit { + ad_returnredirect template-edit?workflow_id=$workflow_id + ad_script_abort +} + +#--------------------------------------------------------------------- +# Determine if we are in edit mode or display mode +#--------------------------------------------------------------------- +# this is prototype code to correct for get_action's apparent +# unreliability + +set mode [template::form::get_action sim_template] +if { ![exists_and_not_null workflow_id]} { + set mode "add" +} else { + # for now, use edit mode in place of display mode + # set mode "display" + set mode "edit" +} + +switch $mode { + add { + set page_title "New Simulation Template" + } + edit { + set page_title "Editing $name" + } +} + +set context [list [list "." "SimBuild"] $page_title] + +set delete_url [export_vars -base template-delete { workflow_id }]