@page_title;noquote@
@context;noquote@
- object.title
+ sim_template.name
-TODO: Missing from form: description, description-mime-type. Ready
-for use should be a checkbox.
+
TODO: Missing from form: description, description-mime-type.
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 -r1.3 -r1.4
--- openacs-4/contrib/packages/simulation/www/simbuild/template-edit.tcl 18 Nov 2003 15:59:12 -0000 1.3
+++ openacs-4/contrib/packages/simulation/www/simbuild/template-edit.tcl 1 Dec 2003 10:20:16 -0000 1.4
@@ -25,15 +25,21 @@
# sim_template form
#---------------------------------------------------------------------
-ad_form -name sim_template -cancel_url . -form {
+if { [ad_form_new_p -key workflow_id] } {
+ set mode edit
+} else {
+ set mode display
+}
+
+ad_form -name sim_template -mode $mode -cancel_url . -form {
{workflow_id:key}
{name:text,optional
{label "Template Name"}
{html {size 40}}
}
- {ready_p:boolean(radio),optional
+ {ready_p:boolean(checkbox),optional
{label "Ready for use?"}
- {options {{Yes t} {No f}}}
+ {options {{"Ready for use" t}}}
}
{suggested_duration:text,optional
{label "Suggested Duration"}
Index: openacs-4/packages/simulation/lib/sim-template-roles.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-template-roles.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/simulation/lib/sim-template-roles.tcl 18 Nov 2003 14:22:55 -0000 1.7
+++ openacs-4/packages/simulation/lib/sim-template-roles.tcl 1 Dec 2003 10:16:56 -0000 1.8
@@ -43,11 +43,12 @@
}
name {
label "Name"
+ display_col pretty_name
}
delete {
sub_class narrow
display_template {
-
+
}
@@ -59,11 +60,11 @@
set return_url "[ad_conn url]?[ad_conn query]"
db_multirow -extend { edit_url char_url delete_url } roles select_roles "
select wr.role_id,
- wr.pretty_name as name,
+ wr.pretty_name,
wr.sort_order
from workflow_roles wr
where wr.workflow_id = :workflow_id
- [template::list::orderby_clause -orderby -name "roles"]
+ order by lower(pretty_name)
" {
set edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-edit" { role_id }]
set delete_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-delete" { role_id return_url }]
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.6 -r1.7
--- openacs-4/packages/simulation/lib/sim-template-tasks.tcl 18 Nov 2003 14:22:55 -0000 1.6
+++ openacs-4/packages/simulation/lib/sim-template-tasks.tcl 1 Dec 2003 10:16:56 -0000 1.7
@@ -58,6 +58,7 @@
}
name {
label "Name"
+ display_col pretty_name
link_url_col {[ad_decode $display_mode edit view_url ""]}
}
assigned_name {
@@ -70,7 +71,7 @@
sub_class narrow
hide_p {[ad_decode $display_mode edit 0 1]}
display_template {
-
+
}
@@ -84,7 +85,7 @@
set return_url "[ad_conn url]?[ad_conn query]"
db_multirow -extend { edit_url view_url delete_url } tasks select_tasks "
select wa.action_id,
- wa.pretty_name as name,
+ wa.pretty_name,
(select pretty_name
from workflow_roles
where role_id = wa.assigned_role) as assigned_name,
@@ -96,9 +97,10 @@
sim_tasks st
where wa.workflow_id = :workflow_id
and st.task_id = wa.action_id
- [template::list::orderby_clause -orderby -name "tasks"]
+ order by lower(pretty_name)
" {
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 }]
}
+
Index: openacs-4/packages/simulation/tcl/action-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/Attic/action-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/simulation/tcl/action-procs.tcl 13 Nov 2003 13:44:36 -0000 1.1
+++ openacs-4/packages/simulation/tcl/action-procs.tcl 1 Dec 2003 10:16:56 -0000 1.2
@@ -37,29 +37,34 @@
# workflow::action::fsm::edit \
# -workflow_id $workflow_id
- # -short_name $name \
+ # -short_name $name \
# -pretty_name $name \
# -assigned_role $assigned_role
+
+
+
set workflow_id [workflow::action::get_workflow_id -action_id $action_id]
+
+
db_transaction {
- db_dml edit_workflow_action {
- update workflow_actions
- set short_name = :short_name,
- pretty_name = :pretty_name,
- assigned_role = :assigned_role,
- description = :description,
- description_mime_type = :description_mime_type
- where action_id = :action_id
+ foreach col { short_name pretty_name assigned_role description description_mime_type } {
+ set action_array($col) [set $col]
}
-
+
+ workflow::action::fsm::edit \
+ -action_id $action_id \
+ -array action_array
+
+ set recipient_role_id [workflow::role::get_id -workflow_id $workflow_id -short_name $recipient_role]
db_dml edit_sim_role {
update sim_tasks
- set recipient = :recipient_role
+ set recipient = :recipient_role_id
where task_id = :action_id
}
}
+ workflow::definition_changed_handler -workflow_id $workflow_id
workflow::action::flush_cache -workflow_id $workflow_id
}
Index: openacs-4/packages/simulation/tcl/template-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/template-procs.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/simulation/tcl/template-procs.tcl 28 Nov 2003 16:55:52 -0000 1.5
+++ openacs-4/packages/simulation/tcl/template-procs.tcl 1 Dec 2003 10:16:56 -0000 1.6
@@ -22,9 +22,8 @@
@author Peter Marklund
} {
- if { ![exists_and_not_null ready_p] } {
- set ready_p "f"
- }
+ set ready_p [db_boolean [template::util::is_true $ready_p]]
+
db_transaction {
set short_name [util_text_to_url -replacement "_" $short_name]
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 -r1.1 -r1.2
--- openacs-4/packages/simulation/www/simbuild/role-edit.adp 13 Nov 2003 15:35:48 -0000 1.1
+++ openacs-4/packages/simulation/www/simbuild/role-edit.adp 1 Dec 2003 10:20:16 -0000 1.2
@@ -1,6 +1,6 @@
@page_title;noquote@
@context;noquote@
- object.title
+ role.name
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 -r1.2 -r1.3
--- openacs-4/packages/simulation/www/simbuild/role-edit.tcl 18 Nov 2003 09:44:32 -0000 1.2
+++ openacs-4/packages/simulation/www/simbuild/role-edit.tcl 1 Dec 2003 10:20:16 -0000 1.3
@@ -50,7 +50,7 @@
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
+ 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]
@@ -67,6 +67,15 @@
-role_short_name $name \
-role_pretty_name $name
+} -edit_data {
+
+ set role_array(pretty_name) $name
+
+ workflow::role::edit \
+ -role_id $role_id \
+ -workflow_id $workflow_id \
+ -array role_array
+
} -after_submit {
ad_returnredirect [export_vars -base "template-edit" { workflow_id }]
ad_script_abort
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 -r1.2 -r1.3
--- openacs-4/packages/simulation/www/simbuild/task-edit.adp 20 Nov 2003 12:57:00 -0000 1.2
+++ openacs-4/packages/simulation/www/simbuild/task-edit.adp 1 Dec 2003 10:20:16 -0000 1.3
@@ -1,7 +1,7 @@
@page_title;noquote@
@context;noquote@
- object.title
+ task.name
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.3 -r1.4
--- openacs-4/packages/simulation/www/simbuild/task-edit.tcl 28 Nov 2003 11:12:19 -0000 1.3
+++ openacs-4/packages/simulation/www/simbuild/task-edit.tcl 1 Dec 2003 10:20:16 -0000 1.4
@@ -4,7 +4,7 @@
@creation-date 2003-10-27
@cvs-id $Id$
} {
- workflow_id:integer,optional
+ {workflow_id:integer ""}
action_id:integer,optional
} -validate {
workflow_id_or_task_id {
@@ -21,40 +21,29 @@
#
######################################################################
-# if we got task_id instead of workflow_id, figure out workflow_id
-if { ![info exists workflow_id] } {
- set workflow_id [simulation::template::get_workflow_id_from_action -action_id $action_id]
-}
-simulation::template::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 workflow_id $task_array(workflow_id)
+}
+
+workflow::get -workflow_id $workflow_id -array sim_template_array
+
+if { ![ad_form_new_p -key action_id] } {
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]
+set context [list [list "." "SimBuild"] [list [export_vars -base "template-edit" { 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 [workflow::role::get_options -workflow_id $workflow_id]
-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
@@ -77,7 +66,7 @@
{value $workflow_id}
}
{name:text
- {label "Task"}
+ {label "Task Name"}
{html {size 20}}
}
{assigned_role:text(select)
@@ -98,13 +87,14 @@
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 {
+ set recipient_role_id [db_string select_recipient {
select recipient
from sim_tasks
where task_id = :action_id
}]
- set assigned_role $task_array(assigned_role)
+ set recipient_role [workflow::role::get_element -role_id $recipient_role_id -element short_name]
+ set assigned_role $task_array(assigned_role)
} -on_submit {
set description_content [template::util::richtext::get_property contents $description]
@@ -114,24 +104,22 @@
# 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 \
+ -assigned_role $assigned_role \
-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
+ set recipient_role_id [workflow::role::get_id -workflow_id $workflow_id -short_name $recipient_role]
db_dml set_role_recipient {
insert into sim_tasks
- values (:action_id, :recipient_role)
+ values (:action_id, :recipient_role_id)
}
} -edit_data {
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.2 -r1.3
--- openacs-4/packages/simulation/www/simbuild/template-edit.adp 20 Nov 2003 12:57:00 -0000 1.2
+++ openacs-4/packages/simulation/www/simbuild/template-edit.adp 1 Dec 2003 10:20:16 -0000 1.3
@@ -1,12 +1,11 @@
@page_title;noquote@
@context;noquote@
- object.title
+ sim_template.name
-TODO: Missing from form: description, description-mime-type. Ready
-for use should be a checkbox.
+
TODO: Missing from form: description, description-mime-type.
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 -r1.3 -r1.4
--- openacs-4/packages/simulation/www/simbuild/template-edit.tcl 18 Nov 2003 15:59:12 -0000 1.3
+++ openacs-4/packages/simulation/www/simbuild/template-edit.tcl 1 Dec 2003 10:20:16 -0000 1.4
@@ -25,15 +25,21 @@
# sim_template form
#---------------------------------------------------------------------
-ad_form -name sim_template -cancel_url . -form {
+if { [ad_form_new_p -key workflow_id] } {
+ set mode edit
+} else {
+ set mode display
+}
+
+ad_form -name sim_template -mode $mode -cancel_url . -form {
{workflow_id:key}
{name:text,optional
{label "Template Name"}
{html {size 40}}
}
- {ready_p:boolean(radio),optional
+ {ready_p:boolean(checkbox),optional
{label "Ready for use?"}
- {options {{Yes t} {No f}}}
+ {options {{"Ready for use" t}}}
}
{suggested_duration:text,optional
{label "Suggested Duration"}